/
githubmirror
/
obsidian-headless
Обзор
Документация
Войти
/
githubmirror
/
obsidian-headless
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
0.0.12
cli.js
168 строк
210 KB
lishid
Add `publish-site-options` command back.
16 июн 2026, 18:09
16 июн 2026, 18:09
14dafca
Код
Авторство
О чём код?
#!/usr/bin/env node var kc=Object.create;var Dr=Object.defineProperty;var xc=Object.getOwnPropertyDescriptor;var qc=Object.getOwnPropertyNames;var Mc=Object.getPrototypeOf,Rc=Object.prototype.hasOwnProperty;var A=(s,e)=>()=>(e||s((e={exports:{}}).exports,e),e.exports);var Bc=(s,e,t,i)=>{if(e&&typeof e=="object"||typeof e=="function")for(let n of qc(e))!Rc.call(s,n)&&n!==t&&Dr(s,n,{get:()=>e[n],enumerable:!(i=xc(e,n))||i.enumerable});return s};var pe=(s,e,t)=>(t=s!=null?kc(Mc(s)):{},Bc(e||!s||!s.__esModule?Dr(t,"default",{value:s,enumerable:!0}):t,s));var L=A(q=>{"use strict";var ks=Symbol.for("yaml.alias"),po=Symbol.for("yaml.document"),Wt=Symbol.for("yaml.map"),go=Symbol.for("yaml.pair"),xs=Symbol.for("yaml.scalar"),Ht=Symbol.for("yaml.seq"),z=Symbol.for("yaml.node.type"),Gc=s=>!!s&&typeof s=="object"&&s[z]===ks,Yc=s=>!!s&&typeof s=="object"&&s[z]===po,Jc=s=>!!s&&typeof s=="object"&&s[z]===Wt,Qc=s=>!!s&&typeof s=="object"&&s[z]===go,mo=s=>!!s&&typeof s=="object"&&s[z]===xs,Xc=s=>!!s&&typeof s=="object"&&s[z]===Ht;function yo(s){if(s&&typeof s=="object")switch(s[z]){case Wt:case Ht:return!0}return!1}function zc(s){if(s&&typeof s=="object")switch(s[z]){case ks:case Wt:case xs:case Ht:return!0}return!1}var Zc=s=>(mo(s)||yo(s))&&!!s.anchor;q.ALIAS=ks;q.DOC=po;q.MAP=Wt;q.NODE_TYPE=z;q.PAIR=go;q.SCALAR=xs;q.SEQ=Ht;q.hasAnchor=Zc;q.isAlias=Gc;q.isCollection=yo;q.isDocument=Yc;q.isMap=Jc;q.isNode=zc;q.isPair=Qc;q.isScalar=mo;q.isSeq=Xc});var Qe=A(qs=>{"use strict";var k=L(),R=Symbol("break visit"),bo=Symbol("skip children"),J=Symbol("remove node");function Gt(s,e){let t=wo(e);k.isDocument(s)?Ce(null,s.contents,t,Object.freeze([s]))===J&&(s.contents=null):Ce(null,s,t,Object.freeze([]))}Gt.BREAK=R;Gt.SKIP=bo;Gt.REMOVE=J;function Ce(s,e,t,i){let n=So(s,e,t,i);if(k.isNode(n)||k.isPair(n))return vo(s,i,n),Ce(s,n,t,i);if(typeof n!="symbol"){if(k.isCollection(e)){i=Object.freeze(i.concat(e));for(let r=0;r<e.items.length;++r){let o=Ce(r,e.items[r],t,i);if(typeof o=="number")r=o-1;else{if(o===R)return R;o===J&&(e.items.splice(r,1),r-=1)}}}else if(k.isPair(e)){i=Object.freeze(i.concat(e));let r=Ce("key",e.key,t,i);if(r===R)return R;r===J&&(e.key=null);let o=Ce("value",e.value,t,i);if(o===R)return R;o===J&&(e.value=null)}}return n}async function Yt(s,e){let t=wo(e);k.isDocument(s)?await Oe(null,s.contents,t,Object.freeze([s]))===J&&(s.contents=null):await Oe(null,s,t,Object.freeze([]))}Yt.BREAK=R;Yt.SKIP=bo;Yt.REMOVE=J;async function Oe(s,e,t,i){let n=await So(s,e,t,i);if(k.isNode(n)||k.isPair(n))return vo(s,i,n),Oe(s,n,t,i);if(typeof n!="symbol"){if(k.isCollection(e)){i=Object.freeze(i.concat(e));for(let r=0;r<e.items.length;++r){let o=await Oe(r,e.items[r],t,i);if(typeof o=="number")r=o-1;else{if(o===R)return R;o===J&&(e.items.splice(r,1),r-=1)}}}else if(k.isPair(e)){i=Object.freeze(i.concat(e));let r=await Oe("key",e.key,t,i);if(r===R)return R;r===J&&(e.key=null);let o=await Oe("value",e.value,t,i);if(o===R)return R;o===J&&(e.value=null)}}return n}function wo(s){return typeof s=="object"&&(s.Collection||s.Node||s.Value)?Object.assign({Alias:s.Node,Map:s.Node,Scalar:s.Node,Seq:s.Node},s.Value&&{Map:s.Value,Scalar:s.Value,Seq:s.Value},s.Collection&&{Map:s.Collection,Seq:s.Collection},s):s}function So(s,e,t,i){if(typeof t=="function")return t(s,e,i);if(k.isMap(e))return t.Map?.(s,e,i);if(k.isSeq(e))return t.Seq?.(s,e,i);if(k.isPair(e))return t.Pair?.(s,e,i);if(k.isScalar(e))return t.Scalar?.(s,e,i);if(k.isAlias(e))return t.Alias?.(s,e,i)}function vo(s,e,t){let i=e[e.length-1];if(k.isCollection(i))i.items[s]=t;else if(k.isPair(i))s==="key"?i.key=t:i.value=t;else if(k.isDocument(i))i.contents=t;else{let n=k.isAlias(i)?"alias":"scalar";throw new Error(`Cannot replace node with ${n} parent`)}}qs.visit=Gt;qs.visitAsync=Yt});var Ms=A(Fo=>{"use strict";var Eo=L(),eu=Qe(),tu={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},iu=s=>s.replace(/[!,[\]{}]/g,e=>tu[e]),Xe=class s{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},s.defaultYaml,e),this.tags=Object.assign({},s.defaultTags,t)}clone(){let e=new s(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){let e=new s(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:s.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},s.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:s.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},s.defaultTags),this.atNextDocument=!1);let i=e.trim().split(/[ \t]+/),n=i.shift();switch(n){case"%TAG":{if(i.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),i.length<2))return!1;let[r,o]=i;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,i.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;let[r]=i;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{let o=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${n}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){let o=e.slice(2,-1);return o==="!"||o==="!!"?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==">"&&t("Verbatim tags must end with a >"),o)}let[,i,n]=e.match(/^(.*!)([^!]*)$/s);n||t(`The ${e} tag has no suffix`);let r=this.tags[i];if(r)try{return r+decodeURIComponent(n)}catch(o){return t(String(o)),null}return i==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,i]of Object.entries(this.tags))if(e.startsWith(i))return t+iu(e.substring(i.length));return e[0]==="!"?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],i=Object.entries(this.tags),n;if(e&&i.length>0&&Eo.isNode(e.contents)){let r={};eu.visit(e.contents,(o,a)=>{Eo.isNode(a)&&a.tag&&(r[a.tag]=!0)}),n=Object.keys(r)}else n=[];for(let[r,o]of i)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||n.some(a=>a.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(` `)}};Xe.defaultYaml={explicit:!1,version:"1.2"};Xe.defaultTags={"!!":"tag:yaml.org,2002:"};Fo.Directives=Xe});var Jt=A(ze=>{"use strict";var Ao=L(),su=Qe();function nu(s){if(/[\x00-\x19\s,[\]{}]/.test(s)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(s)}`;throw new Error(t)}return!0}function Po(s){let e=new Set;return su.visit(s,{Value(t,i){i.anchor&&e.add(i.anchor)}}),e}function Do(s,e){for(let t=1;;++t){let i=`${s}${t}`;if(!e.has(i))return i}}function ru(s,e){let t=[],i=new Map,n=null;return{onAnchor:r=>{t.push(r),n||(n=Po(s));let o=Do(e,n);return n.add(o),o},setAnchors:()=>{for(let r of t){let o=i.get(r);if(typeof o=="object"&&o.anchor&&(Ao.isScalar(o.node)||Ao.isCollection(o.node)))o.node.anchor=o.anchor;else{let a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:i}}ze.anchorIsValid=nu;ze.anchorNames=Po;ze.createNodeAnchors=ru;ze.findNewAnchor=Do});var Rs=A(To=>{"use strict";function Ze(s,e,t,i){if(i&&typeof i=="object")if(Array.isArray(i))for(let n=0,r=i.length;n<r;++n){let o=i[n],a=Ze(s,i,String(n),o);a===void 0?delete i[n]:a!==o&&(i[n]=a)}else if(i instanceof Map)for(let n of Array.from(i.keys())){let r=i.get(n),o=Ze(s,i,n,r);o===void 0?i.delete(n):o!==r&&i.set(n,o)}else if(i instanceof Set)for(let n of Array.from(i)){let r=Ze(s,i,n,n);r===void 0?i.delete(n):r!==n&&(i.delete(n),i.add(r))}else for(let[n,r]of Object.entries(i)){let o=Ze(s,i,n,r);o===void 0?delete i[n]:o!==r&&(i[n]=o)}return s.call(e,t,i)}To.applyReviver=Ze});var ne=A(_o=>{"use strict";var ou=L();function Lo(s,e,t){if(Array.isArray(s))return s.map((i,n)=>Lo(i,String(n),t));if(s&&typeof s.toJSON=="function"){if(!t||!ou.hasAnchor(s))return s.toJSON(e,t);let i={aliasCount:0,count:1,res:void 0};t.anchors.set(s,i),t.onCreate=r=>{i.res=r,delete t.onCreate};let n=s.toJSON(e,t);return t.onCreate&&t.onCreate(n),n}return typeof s=="bigint"&&!t?.keep?Number(s):s}_o.toJS=Lo});var Qt=A(Co=>{"use strict";var au=Rs(),No=L(),lu=ne(),Bs=class{constructor(e){Object.defineProperty(this,No.NODE_TYPE,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:i,onAnchor:n,reviver:r}={}){if(!No.isDocument(e))throw new TypeError("A document argument is required");let o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},a=lu.toJS(this,"",o);if(typeof n=="function")for(let{count:l,res:c}of o.anchors.values())n(c,l);return typeof r=="function"?au.applyReviver(r,{"":a},"",a):a}};Co.NodeBase=Bs});var et=A(Io=>{"use strict";var cu=Jt(),Oo=Qe(),Xt=L(),uu=Qt(),fu=ne(),$s=class extends uu.NodeBase{constructor(e){super(Xt.ALIAS),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e){let t;return Oo.visit(e,{Node:(i,n)=>{if(n===this)return Oo.visit.BREAK;n.anchor===this.source&&(t=n)}}),t}toJSON(e,t){if(!t)return{source:this.source};let{anchors:i,doc:n,maxAliasCount:r}=t,o=this.resolve(n);if(!o){let l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=i.get(o);if(a||(fu.toJS(o,null,t),a=i.get(o)),!a||a.res===void 0){let l="This should not happen: Alias anchor was not resolved?";throw new ReferenceError(l)}if(r>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=zt(n,o,i)),a.count*a.aliasCount>r)){let l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,t,i){let n=`*${this.source}`;if(e){if(cu.anchorIsValid(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${n} `}return n}};function zt(s,e,t){if(Xt.isAlias(e)){let i=e.resolve(s),n=t&&i&&t.get(i);return n?n.count*n.aliasCount:0}else if(Xt.isCollection(e)){let i=0;for(let n of e.items){let r=zt(s,n,t);r>i&&(i=r)}return i}else if(Xt.isPair(e)){let i=zt(s,e.key,t),n=zt(s,e.value,t);return Math.max(i,n)}return 1}Io.Alias=$s});var I=A(js=>{"use strict";var hu=L(),pu=Qt(),du=ne(),gu=s=>!s||typeof s!="function"&&typeof s!="object",re=class extends pu.NodeBase{constructor(e){super(hu.SCALAR),this.value=e}toJSON(e,t){return t?.keep?this.value:du.toJS(this.value,e,t)}toString(){return String(this.value)}};re.BLOCK_FOLDED="BLOCK_FOLDED";re.BLOCK_LITERAL="BLOCK_LITERAL";re.PLAIN="PLAIN";re.QUOTE_DOUBLE="QUOTE_DOUBLE";re.QUOTE_SINGLE="QUOTE_SINGLE";js.Scalar=re;js.isScalarValue=gu});var tt=A(xo=>{"use strict";var mu=et(),be=L(),ko=I(),yu="tag:yaml.org,2002:";function bu(s,e,t){if(e){let i=t.filter(r=>r.tag===e),n=i.find(r=>!r.format)??i[0];if(!n)throw new Error(`Tag ${e} not found`);return n}return t.find(i=>i.identify?.(s)&&!i.format)}function wu(s,e,t){if(be.isDocument(s)&&(s=s.contents),be.isNode(s))return s;if(be.isPair(s)){let u=t.schema[be.MAP].createNode?.(t.schema,null,t);return u.items.push(s),u}(s instanceof String||s instanceof Number||s instanceof Boolean||typeof BigInt<"u"&&s instanceof BigInt)&&(s=s.valueOf());let{aliasDuplicateObjects:i,onAnchor:n,onTagObj:r,schema:o,sourceObjects:a}=t,l;if(i&&s&&typeof s=="object"){if(l=a.get(s),l)return l.anchor||(l.anchor=n(s)),new mu.Alias(l.anchor);l={anchor:null,node:null},a.set(s,l)}e?.startsWith("!!")&&(e=yu+e.slice(2));let c=bu(s,e,o.tags);if(!c){if(s&&typeof s.toJSON=="function"&&(s=s.toJSON()),!s||typeof s!="object"){let u=new ko.Scalar(s);return l&&(l.node=u),u}c=s instanceof Map?o[be.MAP]:Symbol.iterator in Object(s)?o[be.SEQ]:o[be.MAP]}r&&(r(c),delete t.onTagObj);let f=c?.createNode?c.createNode(t.schema,s,t):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(t.schema,s,t):new ko.Scalar(s);return e?f.tag=e:c.default||(f.tag=c.tag),l&&(l.node=f),f}xo.createNode=wu});var ei=A(Zt=>{"use strict";var Su=tt(),Q=L(),vu=Qt();function Us(s,e,t){let i=t;for(let n=e.length-1;n>=0;--n){let r=e[n];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){let o=[];o[r]=i,i=o}else i=new Map([[r,i]])}return Su.createNode(i,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:s,sourceObjects:new Map})}var qo=s=>s==null||typeof s=="object"&&!!s[Symbol.iterator]().next().done,Ks=class extends vu.NodeBase{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(i=>Q.isNode(i)||Q.isPair(i)?i.clone(e):i),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(qo(e))this.add(t);else{let[i,...n]=e,r=this.get(i,!0);if(Q.isCollection(r))r.addIn(n,t);else if(r===void 0&&this.schema)this.set(i,Us(this.schema,n,t));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}deleteIn(e){let[t,...i]=e;if(i.length===0)return this.delete(t);let n=this.get(t,!0);if(Q.isCollection(n))return n.deleteIn(i);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${i}`)}getIn(e,t){let[i,...n]=e,r=this.get(i,!0);return n.length===0?!t&&Q.isScalar(r)?r.value:r:Q.isCollection(r)?r.getIn(n,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!Q.isPair(t))return!1;let i=t.value;return i==null||e&&Q.isScalar(i)&&i.value==null&&!i.commentBefore&&!i.comment&&!i.tag})}hasIn(e){let[t,...i]=e;if(i.length===0)return this.has(t);let n=this.get(t,!0);return Q.isCollection(n)?n.hasIn(i):!1}setIn(e,t){let[i,...n]=e;if(n.length===0)this.set(i,t);else{let r=this.get(i,!0);if(Q.isCollection(r))r.setIn(n,t);else if(r===void 0&&this.schema)this.set(i,Us(this.schema,n,t));else throw new Error(`Expected YAML collection at ${i}. Remaining path: ${n}`)}}};Zt.Collection=Ks;Zt.collectionFromPath=Us;Zt.isEmptyPath=qo});var it=A(ti=>{"use strict";var Eu=s=>s.replace(/^(?!$)(?: $)?/gm,"#");function Vs(s,e){return/^\n+$/.test(s)?s.substring(1):e?s.replace(/^(?! *$)/gm,e):s}var Fu=(s,e,t)=>s.endsWith(` `)?Vs(t,e):t.includes(` `)?` `+Vs(t,e):(s.endsWith(" ")?"":" ")+t;ti.indentComment=Vs;ti.lineComment=Fu;ti.stringifyComment=Eu});var Ro=A(st=>{"use strict";var Au="flow",Ws="block",ii="quoted";function Pu(s,e,t="flow",{indentAtStart:i,lineWidth:n=80,minContentWidth:r=20,onFold:o,onOverflow:a}={}){if(!n||n<0)return s;n<r&&(r=0);let l=Math.max(1+r,1+n-e.length);if(s.length<=l)return s;let c=[],f={},u=n-e.length;typeof i=="number"&&(i>n-Math.max(2,r)?c.push(0):u=n-i);let h,y,S=!1,d=-1,p=-1,m=-1;t===Ws&&(d=Mo(s,d,e.length),d!==-1&&(u=d+l));for(let E;E=s[d+=1];){if(t===ii&&E==="\\"){switch(p=d,s[d+1]){case"x":d+=3;break;case"u":d+=5;break;case"U":d+=9;break;default:d+=1}m=d}if(E===` `)t===Ws&&(d=Mo(s,d,e.length)),u=d+e.length+l,h=void 0;else{if(E===" "&&y&&y!==" "&&y!==` `&&y!==" "){let b=s[d+1];b&&b!==" "&&b!==` `&&b!==" "&&(h=d)}if(d>=u)if(h)c.push(h),u=h+l,h=void 0;else if(t===ii){for(;y===" "||y===" ";)y=E,E=s[d+=1],S=!0;let b=d>m+1?d-2:p-1;if(f[b])return s;c.push(b),f[b]=!0,u=b+l,h=void 0}else S=!0}y=E}if(S&&a&&a(),c.length===0)return s;o&&o();let g=s.slice(0,c[0]);for(let E=0;E<c.length;++E){let b=c[E],w=c[E+1]||s.length;b===0?g=` ${e}${s.slice(0,w)}`:(t===ii&&f[b]&&(g+=`${s[b]}\\`),g+=` ${e}${s.slice(b+1,w)}`)}return g}function Mo(s,e,t){let i=e,n=e+1,r=s[n];for(;r===" "||r===" ";)if(e<n+t)r=s[++e];else{do r=s[++e];while(r&&r!==` `);i=e,n=e+1,r=s[n]}return i}st.FOLD_BLOCK=Ws;st.FOLD_FLOW=Au;st.FOLD_QUOTED=ii;st.foldFlowLines=Pu});var rt=A(Bo=>{"use strict";var H=I(),oe=Ro(),ni=(s,e)=>({indentAtStart:e?s.indent.length:s.indentAtStart,lineWidth:s.options.lineWidth,minContentWidth:s.options.minContentWidth}),ri=s=>/^(%|---|\.\.\.)/m.test(s);function Du(s,e,t){if(!e||e<0)return!1;let i=e-t,n=s.length;if(n<=i)return!1;for(let r=0,o=0;r<n;++r)if(s[r]===` `){if(r-o>i)return!0;if(o=r+1,n-o<=i)return!1}return!0}function nt(s,e){let t=JSON.stringify(s);if(e.options.doubleQuotedAsJSON)return t;let{implicitKey:i}=e,n=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(ri(s)?" ":""),o="",a=0;for(let l=0,c=t[l];c;c=t[++l])if(c===" "&&t[l+1]==="\\"&&t[l+2]==="n"&&(o+=t.slice(a,l)+"\\ ",l+=1,a=l,c="\\"),c==="\\")switch(t[l+1]){case"u":{o+=t.slice(a,l);let f=t.substr(l+2,4);switch(f){case"0000":o+="\\0";break;case"0007":o+="\\a";break;case"000b":o+="\\v";break;case"001b":o+="\\e";break;case"0085":o+="\\N";break;case"00a0":o+="\\_";break;case"2028":o+="\\L";break;case"2029":o+="\\P";break;default:f.substr(0,2)==="00"?o+="\\x"+f.substr(2):o+=t.substr(l,6)}l+=5,a=l+1}break;case"n":if(i||t[l+2]==='"'||t.length<n)l+=1;else{for(o+=t.slice(a,l)+` `;t[l+2]==="\\"&&t[l+3]==="n"&&t[l+4]!=='"';)o+=` `,l+=2;o+=r,t[l+2]===" "&&(o+="\\"),l+=1,a=l+1}break;default:l+=1}return o=a?o+t.slice(a):t,i?o:oe.foldFlowLines(o,r,oe.FOLD_QUOTED,ni(e,!1))}function Hs(s,e){if(e.options.singleQuote===!1||e.implicitKey&&s.includes(` `)||/[ \t]\n|\n[ \t]/.test(s))return nt(s,e);let t=e.indent||(ri(s)?" ":""),i="'"+s.replace(/'/g,"''").replace(/\n+/g,`$& ${t}`)+"'";return e.implicitKey?i:oe.foldFlowLines(i,t,oe.FOLD_FLOW,ni(e,!1))}function Ie(s,e){let{singleQuote:t}=e.options,i;if(t===!1)i=nt;else{let n=s.includes('"'),r=s.includes("'");n&&!r?i=Hs:r&&!n?i=nt:i=t?Hs:nt}return i(s,e)}var Gs;try{Gs=new RegExp(`(^|(?<! )) +(?! |$)`,"g")}catch{Gs=/\n+(?!\n|$)/g}function si({comment:s,type:e,value:t},i,n,r){let{blockQuote:o,commentString:a,lineWidth:l}=i.options;if(!o||/\n[\t ]+$/.test(t)||/^\s*$/.test(t))return Ie(t,i);let c=i.indent||(i.forceBlockIndent||ri(t)?" ":""),f=o==="literal"?!0:o==="folded"||e===H.Scalar.BLOCK_FOLDED?!1:e===H.Scalar.BLOCK_LITERAL?!0:!Du(t,l,c.length);if(!t)return f?`| `:`> `;let u,h;for(h=t.length;h>0;--h){let w=t[h-1];if(w!==` `&&w!==" "&&w!==" ")break}let y=t.substring(h),S=y.indexOf(` `);S===-1?u="-":t===y||S!==y.length-1?(u="+",r&&r()):u="",y&&(t=t.slice(0,-y.length),y[y.length-1]===` `&&(y=y.slice(0,-1)),y=y.replace(Gs,`$&${c}`));let d=!1,p,m=-1;for(p=0;p<t.length;++p){let w=t[p];if(w===" ")d=!0;else if(w===` `)m=p;else break}let g=t.substring(0,m<p?m+1:p);g&&(t=t.substring(g.length),g=g.replace(/\n+/g,`$&${c}`));let b=(d?c?"2":"1":"")+u;if(s&&(b+=" "+a(s.replace(/ ?[\r\n]+/g," ")),n&&n()),!f){let w=t.replace(/\n+/g,` $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`),v=!1,P=ni(i,!0);o!=="folded"&&e!==H.Scalar.BLOCK_FOLDED&&(P.onOverflow=()=>{v=!0});let F=oe.foldFlowLines(`${g}${w}${y}`,c,oe.FOLD_BLOCK,P);if(!v)return`>${b} ${c}${F}`}return t=t.replace(/\n+/g,`$&${c}`),`|${b} ${c}${g}${t}${y}`}function Tu(s,e,t,i){let{type:n,value:r}=s,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:f}=e;if(a&&r.includes(` `)||f&&/[[\]{},]/.test(r))return Ie(r,e);if(!r||/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||f||!r.includes(` `)?Ie(r,e):si(s,e,t,i);if(!a&&!f&&n!==H.Scalar.PLAIN&&r.includes(` `))return si(s,e,t,i);if(ri(r)){if(l==="")return e.forceBlockIndent=!0,si(s,e,t,i);if(a&&l===c)return Ie(r,e)}let u=r.replace(/\n+/g,`$& ${l}`);if(o){let h=d=>d.default&&d.tag!=="tag:yaml.org,2002:str"&&d.test?.test(u),{compat:y,tags:S}=e.doc.schema;if(S.some(h)||y?.some(h))return Ie(r,e)}return a?u:oe.foldFlowLines(u,l,oe.FOLD_FLOW,ni(e,!1))}function Lu(s,e,t,i){let{implicitKey:n,inFlow:r}=e,o=typeof s.value=="string"?s:Object.assign({},s,{value:String(s.value)}),{type:a}=s;a!==H.Scalar.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=H.Scalar.QUOTE_DOUBLE);let l=f=>{switch(f){case H.Scalar.BLOCK_FOLDED:case H.Scalar.BLOCK_LITERAL:return n||r?Ie(o.value,e):si(o,e,t,i);case H.Scalar.QUOTE_DOUBLE:return nt(o.value,e);case H.Scalar.QUOTE_SINGLE:return Hs(o.value,e);case H.Scalar.PLAIN:return Tu(o,e,t,i);default:return null}},c=l(a);if(c===null){let{defaultKeyType:f,defaultStringType:u}=e.options,h=n&&f||u;if(c=l(h),c===null)throw new Error(`Unsupported default string type ${h}`)}return c}Bo.stringifyString=Lu});var ot=A(Ys=>{"use strict";var _u=Jt(),ae=L(),Nu=it(),Cu=rt();function Ou(s,e){let t=Object.assign({blockQuote:!0,commentString:Nu.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,trueStr:"true",verifyAliasOrder:!0},s.schema.toStringOptions,e),i;switch(t.collectionStyle){case"block":i=!1;break;case"flow":i=!0;break;default:i=null}return{anchors:new Set,doc:s,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:i,options:t}}function Iu(s,e){if(e.tag){let n=s.filter(r=>r.tag===e.tag);if(n.length>0)return n.find(r=>r.format===e.format)??n[0]}let t,i;if(ae.isScalar(e)){i=e.value;let n=s.filter(r=>r.identify?.(i));if(n.length>1){let r=n.filter(o=>o.test);r.length>0&&(n=r)}t=n.find(r=>r.format===e.format)??n.find(r=>!r.format)}else i=e,t=s.find(n=>n.nodeClass&&i instanceof n.nodeClass);if(!t){let n=i?.constructor?.name??typeof i;throw new Error(`Tag not resolved for ${n} value`)}return t}function ku(s,e,{anchors:t,doc:i}){if(!i.directives)return"";let n=[],r=(ae.isScalar(s)||ae.isCollection(s))&&s.anchor;r&&_u.anchorIsValid(r)&&(t.add(r),n.push(`&${r}`));let o=s.tag?s.tag:e.default?null:e.tag;return o&&n.push(i.directives.tagString(o)),n.join(" ")}function xu(s,e,t,i){if(ae.isPair(s))return s.toString(e,t,i);if(ae.isAlias(s)){if(e.doc.directives)return s.toString(e);if(e.resolvedAliases?.has(s))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(s):e.resolvedAliases=new Set([s]),s=s.resolve(e.doc)}let n,r=ae.isNode(s)?s:e.doc.createNode(s,{onTagObj:l=>n=l});n||(n=Iu(e.doc.schema.tags,r));let o=ku(r,n,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);let a=typeof n.stringify=="function"?n.stringify(r,e,t,i):ae.isScalar(r)?Cu.stringifyString(r,e,t,i):r.toString(e,t,i);return o?ae.isScalar(r)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o} ${e.indent}${a}`:a}Ys.createStringifyContext=Ou;Ys.stringify=xu});var Ko=A(Uo=>{"use strict";var Z=L(),$o=I(),jo=ot(),at=it();function qu({key:s,value:e},t,i,n){let{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:f,simpleKeys:u}}=t,h=Z.isNode(s)&&s.comment||null;if(u){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(Z.isCollection(s)||!Z.isNode(s)&&typeof s=="object"){let P="With simple keys, collection cannot be used as a key value";throw new Error(P)}}let y=!u&&(!s||h&&e==null&&!t.inFlow||Z.isCollection(s)||(Z.isScalar(s)?s.type===$o.Scalar.BLOCK_FOLDED||s.type===$o.Scalar.BLOCK_LITERAL:typeof s=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!y&&(u||!r),indent:a+l});let S=!1,d=!1,p=jo.stringify(s,t,()=>S=!0,()=>d=!0);if(!y&&!t.inFlow&&p.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");y=!0}if(t.inFlow){if(r||e==null)return S&&i&&i(),p===""?"?":y?`? ${p}`:p}else if(r&&!u||e==null&&y)return p=`? ${p}`,h&&!S?p+=at.lineComment(p,t.indent,c(h)):d&&n&&n(),p;S&&(h=null),y?(h&&(p+=at.lineComment(p,t.indent,c(h))),p=`? ${p} ${a}:`):(p=`${p}:`,h&&(p+=at.lineComment(p,t.indent,c(h))));let m,g,E;Z.isNode(e)?(m=!!e.spaceBefore,g=e.commentBefore,E=e.comment):(m=!1,g=null,E=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!y&&!h&&Z.isScalar(e)&&(t.indentAtStart=p.length+1),d=!1,!f&&l.length>=2&&!t.inFlow&&!y&&Z.isSeq(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let b=!1,w=jo.stringify(e,t,()=>b=!0,()=>d=!0),v=" ";if(h||m||g){if(v=m?` `:"",g){let P=c(g);v+=` ${at.indentComment(P,t.indent)}`}w===""&&!t.inFlow?v===` `&&(v=` `):v+=` ${t.indent}`}else if(!y&&Z.isCollection(e)){let P=w[0],F=w.indexOf(` `),N=F!==-1,M=t.inFlow??e.flow??e.items.length===0;if(N||!M){let te=!1;if(N&&(P==="&"||P==="!")){let O=w.indexOf(" ");P==="&"&&O!==-1&&O<F&&w[O+1]==="!"&&(O=w.indexOf(" ",O+1)),(O===-1||F<O)&&(te=!0)}te||(v=` ${t.indent}`)}}else(w===""||w[0]===` `)&&(v="");return p+=v+w,t.inFlow?b&&i&&i():E&&!b?p+=at.lineComment(p,t.indent,c(E)):d&&n&&n(),p}Uo.stringifyPair=qu});var Qs=A(Js=>{"use strict";var Vo=require("node:process");function Mu(s,...e){s==="debug"&&console.log(...e)}function Ru(s,e){(s==="debug"||s==="warn")&&(typeof Vo.emitWarning=="function"?Vo.emitWarning(e):console.warn(e))}Js.debug=Mu;Js.warn=Ru});var ci=A(li=>{"use strict";var lt=L(),Wo=I(),oi="<<",ai={identify:s=>s===oi||typeof s=="symbol"&&s.description===oi,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new Wo.Scalar(Symbol(oi)),{addToJSMap:Ho}),stringify:()=>oi},Bu=(s,e)=>(ai.identify(e)||lt.isScalar(e)&&(!e.type||e.type===Wo.Scalar.PLAIN)&&ai.identify(e.value))&&s?.doc.schema.tags.some(t=>t.tag===ai.tag&&t.default);function Ho(s,e,t){if(t=s&<.isAlias(t)?t.resolve(s.doc):t,lt.isSeq(t))for(let i of t.items)Xs(s,e,i);else if(Array.isArray(t))for(let i of t)Xs(s,e,i);else Xs(s,e,t)}function Xs(s,e,t){let i=s&<.isAlias(t)?t.resolve(s.doc):t;if(!lt.isMap(i))throw new Error("Merge sources must be maps or map aliases");let n=i.toJSON(null,s,Map);for(let[r,o]of n)e instanceof Map?e.has(r)||e.set(r,o):e instanceof Set?e.add(r):Object.prototype.hasOwnProperty.call(e,r)||Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0});return e}li.addMergeToJSMap=Ho;li.isMergeKey=Bu;li.merge=ai});var Zs=A(Jo=>{"use strict";var $u=Qs(),Go=ci(),ju=ot(),Yo=L(),zs=ne();function Uu(s,e,{key:t,value:i}){if(Yo.isNode(t)&&t.addToJSMap)t.addToJSMap(s,e,i);else if(Go.isMergeKey(s,t))Go.addMergeToJSMap(s,e,i);else{let n=zs.toJS(t,"",s);if(e instanceof Map)e.set(n,zs.toJS(i,n,s));else if(e instanceof Set)e.add(n);else{let r=Ku(t,n,s),o=zs.toJS(i,r,s);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}function Ku(s,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(Yo.isNode(s)&&t?.doc){let i=ju.createStringifyContext(t.doc,{});i.anchors=new Set;for(let r of t.anchors.keys())i.anchors.add(r.anchor);i.inFlow=!0,i.inStringifyKey=!0;let n=s.toString(i);if(!t.mapKeyWarned){let r=JSON.stringify(n);r.length>40&&(r=r.substring(0,36)+'..."'),$u.warn(t.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${r}. Set mapAsMap: true to use object keys.`),t.mapKeyWarned=!0}return n}return JSON.stringify(e)}Jo.addPairToJSMap=Uu});var le=A(en=>{"use strict";var Qo=tt(),Vu=Ko(),Wu=Zs(),ui=L();function Hu(s,e,t){let i=Qo.createNode(s,void 0,t),n=Qo.createNode(e,void 0,t);return new fi(i,n)}var fi=class s{constructor(e,t=null){Object.defineProperty(this,ui.NODE_TYPE,{value:ui.PAIR}),this.key=e,this.value=t}clone(e){let{key:t,value:i}=this;return ui.isNode(t)&&(t=t.clone(e)),ui.isNode(i)&&(i=i.clone(e)),new s(t,i)}toJSON(e,t){let i=t?.mapAsMap?new Map:{};return Wu.addPairToJSMap(t,i,this)}toString(e,t,i){return e?.doc?Vu.stringifyPair(this,e,t,i):JSON.stringify(this)}};en.Pair=fi;en.createPair=Hu});var tn=A(zo=>{"use strict";var we=L(),Xo=ot(),hi=it();function Gu(s,e,t){return(e.inFlow??s.flow?Ju:Yu)(s,e,t)}function Yu({comment:s,items:e},t,{blockItemPrefix:i,flowChars:n,itemIndent:r,onChompKeep:o,onComment:a}){let{indent:l,options:{commentString:c}}=t,f=Object.assign({},t,{indent:r,type:null}),u=!1,h=[];for(let S=0;S<e.length;++S){let d=e[S],p=null;if(we.isNode(d))!u&&d.spaceBefore&&h.push(""),pi(t,h,d.commentBefore,u),d.comment&&(p=d.comment);else if(we.isPair(d)){let g=we.isNode(d.key)?d.key:null;g&&(!u&&g.spaceBefore&&h.push(""),pi(t,h,g.commentBefore,u))}u=!1;let m=Xo.stringify(d,f,()=>p=null,()=>u=!0);p&&(m+=hi.lineComment(m,r,c(p))),u&&p&&(u=!1),h.push(i+m)}let y;if(h.length===0)y=n.start+n.end;else{y=h[0];for(let S=1;S<h.length;++S){let d=h[S];y+=d?` ${l}${d}`:` `}}return s?(y+=` `+hi.indentComment(c(s),l),a&&a()):u&&o&&o(),y}function Ju({items:s},e,{flowChars:t,itemIndent:i}){let{indent:n,indentStep:r,flowCollectionPadding:o,options:{commentString:a}}=e;i+=r;let l=Object.assign({},e,{indent:i,inFlow:!0,type:null}),c=!1,f=0,u=[];for(let S=0;S<s.length;++S){let d=s[S],p=null;if(we.isNode(d))d.spaceBefore&&u.push(""),pi(e,u,d.commentBefore,!1),d.comment&&(p=d.comment);else if(we.isPair(d)){let g=we.isNode(d.key)?d.key:null;g&&(g.spaceBefore&&u.push(""),pi(e,u,g.commentBefore,!1),g.comment&&(c=!0));let E=we.isNode(d.value)?d.value:null;E?(E.comment&&(p=E.comment),E.commentBefore&&(c=!0)):d.value==null&&g?.comment&&(p=g.comment)}p&&(c=!0);let m=Xo.stringify(d,l,()=>p=null);S<s.length-1&&(m+=","),p&&(m+=hi.lineComment(m,i,a(p))),!c&&(u.length>f||m.includes(` `))&&(c=!0),u.push(m),f=u.length}let{start:h,end:y}=t;if(u.length===0)return h+y;if(!c){let S=u.reduce((d,p)=>d+p.length+2,2);c=e.options.lineWidth>0&&S>e.options.lineWidth}if(c){let S=h;for(let d of u)S+=d?` ${r}${n}${d}`:` `;return`${S} ${n}${y}`}else return`${h}${o}${u.join(" ")}${o}${y}`}function pi({indent:s,options:{commentString:e}},t,i,n){if(i&&n&&(i=i.replace(/^\n+/,"")),i){let r=hi.indentComment(e(i),s);t.push(r.trimStart())}}zo.stringifyCollection=Gu});var ue=A(nn=>{"use strict";var Qu=tn(),Xu=Zs(),zu=ei(),ce=L(),di=le(),Zu=I();function ct(s,e){let t=ce.isScalar(e)?e.value:e;for(let i of s)if(ce.isPair(i)&&(i.key===e||i.key===t||ce.isScalar(i.key)&&i.key.value===t))return i}var sn=class extends zu.Collection{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(ce.MAP,e),this.items=[]}static from(e,t,i){let{keepUndefined:n,replacer:r}=i,o=new this(e),a=(l,c)=>{if(typeof r=="function")c=r.call(t,l,c);else if(Array.isArray(r)&&!r.includes(l))return;(c!==void 0||n)&&o.items.push(di.createPair(l,c,i))};if(t instanceof Map)for(let[l,c]of t)a(l,c);else if(t&&typeof t=="object")for(let l of Object.keys(t))a(l,t[l]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,t){let i;ce.isPair(e)?i=e:!e||typeof e!="object"||!("key"in e)?i=new di.Pair(e,e?.value):i=new di.Pair(e.key,e.value);let n=ct(this.items,i.key),r=this.schema?.sortMapEntries;if(n){if(!t)throw new Error(`Key ${i.key} already set`);ce.isScalar(n.value)&&Zu.isScalarValue(i.value)?n.value.value=i.value:n.value=i.value}else if(r){let o=this.items.findIndex(a=>r(i,a)<0);o===-1?this.items.push(i):this.items.splice(o,0,i)}else this.items.push(i)}delete(e){let t=ct(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=ct(this.items,e)?.value;return(!t&&ce.isScalar(n)?n.value:n)??void 0}has(e){return!!ct(this.items,e)}set(e,t){this.add(new di.Pair(e,t),!0)}toJSON(e,t,i){let n=i?new i:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(n);for(let r of this.items)Xu.addPairToJSMap(t,n,r);return n}toString(e,t,i){if(!e)return JSON.stringify(this);for(let n of this.items)if(!ce.isPair(n))throw new Error(`Map items must all be pairs; found ${JSON.stringify(n)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Qu.stringifyCollection(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:i,onComment:t})}};nn.YAMLMap=sn;nn.findPair=ct});var ke=A(ea=>{"use strict";var ef=L(),Zo=ue(),tf={collection:"map",default:!0,nodeClass:Zo.YAMLMap,tag:"tag:yaml.org,2002:map",resolve(s,e){return ef.isMap(s)||e("Expected a mapping for this tag"),s},createNode:(s,e,t)=>Zo.YAMLMap.from(s,e,t)};ea.map=tf});var fe=A(ta=>{"use strict";var sf=tt(),nf=tn(),rf=ei(),mi=L(),of=I(),af=ne(),rn=class extends rf.Collection{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(mi.SEQ,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=gi(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){let i=gi(e);if(typeof i!="number")return;let n=this.items[i];return!t&&mi.isScalar(n)?n.value:n}has(e){let t=gi(e);return typeof t=="number"&&t<this.items.length}set(e,t){let i=gi(e);if(typeof i!="number")throw new Error(`Expected a valid index, not ${e}.`);let n=this.items[i];mi.isScalar(n)&&of.isScalarValue(t)?n.value=t:this.items[i]=t}toJSON(e,t){let i=[];t?.onCreate&&t.onCreate(i);let n=0;for(let r of this.items)i.push(af.toJS(r,String(n++),t));return i}toString(e,t,i){return e?nf.stringifyCollection(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:i,onComment:t}):JSON.stringify(this)}static from(e,t,i){let{replacer:n}=i,r=new this(e);if(t&&Symbol.iterator in Object(t)){let o=0;for(let a of t){if(typeof n=="function"){let l=t instanceof Set?a:String(o++);a=n.call(t,l,a)}r.items.push(sf.createNode(a,void 0,i))}}return r}};function gi(s){let e=mi.isScalar(s)?s.value:s;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}ta.YAMLSeq=rn});var xe=A(sa=>{"use strict";var lf=L(),ia=fe(),cf={collection:"seq",default:!0,nodeClass:ia.YAMLSeq,tag:"tag:yaml.org,2002:seq",resolve(s,e){return lf.isSeq(s)||e("Expected a sequence for this tag"),s},createNode:(s,e,t)=>ia.YAMLSeq.from(s,e,t)};sa.seq=cf});var ut=A(na=>{"use strict";var uf=rt(),ff={identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify(s,e,t,i){return e=Object.assign({actualString:!0},e),uf.stringifyString(s,e,t,i)}};na.string=ff});var yi=A(aa=>{"use strict";var ra=I(),oa={identify:s=>s==null,createNode:()=>new ra.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new ra.Scalar(null),stringify:({source:s},e)=>typeof s=="string"&&oa.test.test(s)?s:e.options.nullStr};aa.nullTag=oa});var on=A(ca=>{"use strict";var hf=I(),la={identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:s=>new hf.Scalar(s[0]==="t"||s[0]==="T"),stringify({source:s,value:e},t){if(s&&la.test.test(s)){let i=s[0]==="t"||s[0]==="T";if(e===i)return s}return e?t.options.trueStr:t.options.falseStr}};ca.boolTag=la});var qe=A(ua=>{"use strict";function pf({format:s,minFractionDigits:e,tag:t,value:i}){if(typeof i=="bigint")return String(i);let n=typeof i=="number"?i:Number(i);if(!isFinite(n))return isNaN(n)?".nan":n<0?"-.inf":".inf";let r=JSON.stringify(i);if(!s&&e&&(!t||t==="tag:yaml.org,2002:float")&&/^\d/.test(r)){let o=r.indexOf(".");o<0&&(o=r.length,r+=".");let a=e-(r.length-o-1);for(;a-- >0;)r+="0"}return r}ua.stringifyNumber=pf});var ln=A(bi=>{"use strict";var df=I(),an=qe(),gf={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:s=>s.slice(-3).toLowerCase()==="nan"?NaN:s[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:an.stringifyNumber},mf={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:s=>parseFloat(s),stringify(s){let e=Number(s.value);return isFinite(e)?e.toExponential():an.stringifyNumber(s)}},yf={identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(s){let e=new df.Scalar(parseFloat(s)),t=s.indexOf(".");return t!==-1&&s[s.length-1]==="0"&&(e.minFractionDigits=s.length-t-1),e},stringify:an.stringifyNumber};bi.float=yf;bi.floatExp=mf;bi.floatNaN=gf});var un=A(Si=>{"use strict";var fa=qe(),wi=s=>typeof s=="bigint"||Number.isInteger(s),cn=(s,e,t,{intAsBigInt:i})=>i?BigInt(s):parseInt(s.substring(e),t);function ha(s,e,t){let{value:i}=s;return wi(i)&&i>=0?t+i.toString(e):fa.stringifyNumber(s)}var bf={identify:s=>wi(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(s,e,t)=>cn(s,2,8,t),stringify:s=>ha(s,8,"0o")},wf={identify:wi,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(s,e,t)=>cn(s,0,10,t),stringify:fa.stringifyNumber},Sf={identify:s=>wi(s)&&s>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(s,e,t)=>cn(s,2,16,t),stringify:s=>ha(s,16,"0x")};Si.int=wf;Si.intHex=Sf;Si.intOct=bf});var da=A(pa=>{"use strict";var vf=ke(),Ef=yi(),Ff=xe(),Af=ut(),Pf=on(),fn=ln(),hn=un(),Df=[vf.map,Ff.seq,Af.string,Ef.nullTag,Pf.boolTag,hn.intOct,hn.int,hn.intHex,fn.floatNaN,fn.floatExp,fn.float];pa.schema=Df});var ya=A(ma=>{"use strict";var Tf=I(),Lf=ke(),_f=xe();function ga(s){return typeof s=="bigint"||Number.isInteger(s)}var vi=({value:s})=>JSON.stringify(s),Nf=[{identify:s=>typeof s=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:s=>s,stringify:vi},{identify:s=>s==null,createNode:()=>new Tf.Scalar(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:vi},{identify:s=>typeof s=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:s=>s==="true",stringify:vi},{identify:ga,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(s,e,{intAsBigInt:t})=>t?BigInt(s):parseInt(s,10),stringify:({value:s})=>ga(s)?s.toString():JSON.stringify(s)},{identify:s=>typeof s=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:s=>parseFloat(s),stringify:vi}],Cf={default:!0,tag:"",test:/^/,resolve(s,e){return e(`Unresolved plain scalar ${JSON.stringify(s)}`),s}},Of=[Lf.map,_f.seq].concat(Nf,Cf);ma.schema=Of});var dn=A(ba=>{"use strict";var ft=require("node:buffer"),pn=I(),If=rt(),kf={identify:s=>s instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(s,e){if(typeof ft.Buffer=="function")return ft.Buffer.from(s,"base64");if(typeof atob=="function"){let t=atob(s.replace(/[\n\r]/g,"")),i=new Uint8Array(t.length);for(let n=0;n<t.length;++n)i[n]=t.charCodeAt(n);return i}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),s},stringify({comment:s,type:e,value:t},i,n,r){let o=t,a;if(typeof ft.Buffer=="function")a=o instanceof ft.Buffer?o.toString("base64"):ft.Buffer.from(o.buffer).toString("base64");else if(typeof btoa=="function"){let l="";for(let c=0;c<o.length;++c)l+=String.fromCharCode(o[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=pn.Scalar.BLOCK_LITERAL),e!==pn.Scalar.QUOTE_DOUBLE){let l=Math.max(i.options.lineWidth-i.indent.length,i.options.minContentWidth),c=Math.ceil(a.length/l),f=new Array(c);for(let u=0,h=0;u<c;++u,h+=l)f[u]=a.substr(h,l);a=f.join(e===pn.Scalar.BLOCK_LITERAL?` `:" ")}return If.stringifyString({comment:s,type:e,value:a},i,n,r)}};ba.binary=kf});var Ai=A(Fi=>{"use strict";var Ei=L(),gn=le(),xf=I(),qf=fe();function wa(s,e){if(Ei.isSeq(s))for(let t=0;t<s.items.length;++t){let i=s.items[t];if(!Ei.isPair(i)){if(Ei.isMap(i)){i.items.length>1&&e("Each pair must have its own sequence indicator");let n=i.items[0]||new gn.Pair(new xf.Scalar(null));if(i.commentBefore&&(n.key.commentBefore=n.key.commentBefore?`${i.commentBefore} ${n.key.commentBefore}`:i.commentBefore),i.comment){let r=n.value??n.key;r.comment=r.comment?`${i.comment} ${r.comment}`:i.comment}i=n}s.items[t]=Ei.isPair(i)?i:new gn.Pair(i)}}else e("Expected a sequence for this tag");return s}function Sa(s,e,t){let{replacer:i}=t,n=new qf.YAMLSeq(s);n.tag="tag:yaml.org,2 … [Строка слишком длинная. Вы можете скачать файл] `)?(t.push("..."),t.push(mt.indentComment(l,""))):t.push(`... ${l}`)}else t.push("...");else{let l=s.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&t[t.length-1]!==""&&t.push(""),t.push(mt.indentComment(r(l),"")))}return t.join(` `)+` `}Ga.stringifyDocument=Sh});var yt=A(Ja=>{"use strict";var vh=et(),Me=ei(),K=L(),Eh=le(),Fh=ne(),Ah=In(),Ph=Ya(),xn=Jt(),Dh=Rs(),Th=tt(),qn=Ms(),Mn=class s{constructor(e,t,i){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,K.NODE_TYPE,{value:K.DOC});let n=null;typeof t=="function"||Array.isArray(t)?n=t:i===void 0&&t&&(i=t,t=void 0);let r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},i);this.options=r;let{version:o}=r;i?._directives?(this.directives=i._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new qn.Directives({version:o}),this.setSchema(o,i),this.contents=e===void 0?null:this.createNode(e,n,i)}clone(){let e=Object.create(s.prototype,{[K.NODE_TYPE]:{value:K.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=K.isNode(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){Re(this.contents)&&this.contents.add(e)}addIn(e,t){Re(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let i=xn.anchorNames(this);e.anchor=!t||i.has(t)?xn.findNewAnchor(t||"a",i):t}return new vh.Alias(e.anchor)}createNode(e,t,i){let n;if(typeof t=="function")e=t.call({"":e},"",e),n=t;else if(Array.isArray(t)){let p=g=>typeof g=="number"||g instanceof String||g instanceof Number,m=t.filter(p).map(String);m.length>0&&(t=t.concat(m)),n=t}else i===void 0&&t&&(i=t,t=void 0);let{aliasDuplicateObjects:r,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:f}=i??{},{onAnchor:u,setAnchors:h,sourceObjects:y}=xn.createNodeAnchors(this,o||"a"),S={aliasDuplicateObjects:r??!0,keepUndefined:l??!1,onAnchor:u,onTagObj:c,replacer:n,schema:this.schema,sourceObjects:y},d=Th.createNode(e,f,S);return a&&K.isCollection(d)&&(d.flow=!0),h(),d}createPair(e,t,i={}){let n=this.createNode(e,null,i),r=this.createNode(t,null,i);return new Eh.Pair(n,r)}delete(e){return Re(this.contents)?this.contents.delete(e):!1}deleteIn(e){return Me.isEmptyPath(e)?this.contents==null?!1:(this.contents=null,!0):Re(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return K.isCollection(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return Me.isEmptyPath(e)?!t&&K.isScalar(this.contents)?this.contents.value:this.contents:K.isCollection(this.contents)?this.contents.getIn(e,t):void 0}has(e){return K.isCollection(this.contents)?this.contents.has(e):!1}hasIn(e){return Me.isEmptyPath(e)?this.contents!==void 0:K.isCollection(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Me.collectionFromPath(this.schema,[e],t):Re(this.contents)&&this.contents.set(e,t)}setIn(e,t){Me.isEmptyPath(e)?this.contents=t:this.contents==null?this.contents=Me.collectionFromPath(this.schema,Array.from(e),t):Re(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let i;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new qn.Directives({version:"1.1"}),i={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new qn.Directives({version:e}),i={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,i=null;break;default:{let n=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${n}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(i)this.schema=new Ah.Schema(Object.assign(i,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:i,maxAliasCount:n,onAnchor:r,reviver:o}={}){let a={anchors:new Map,doc:this,keep:!e,mapAsMap:i===!0,mapKeyWarned:!1,maxAliasCount:typeof n=="number"?n:100},l=Fh.toJS(this.contents,t??"",a);if(typeof r=="function")for(let{count:c,res:f}of a.anchors.values())r(f,c);return typeof o=="function"?Dh.applyReviver(o,{"":l},"",l):l}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw new Error("Document with errors cannot be stringified");if("indent"in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return Ph.stringifyDocument(this,e)}};function Re(s){if(K.isCollection(s))return!0;throw new Error("Expected a YAML collection as document contents")}Ja.Document=Mn});var St=A(wt=>{"use strict";var bt=class extends Error{constructor(e,t,i,n){super(),this.name=e,this.code=i,this.message=n,this.pos=t}},Rn=class extends bt{constructor(e,t,i){super("YAMLParseError",e,t,i)}},Bn=class extends bt{constructor(e,t,i){super("YAMLWarning",e,t,i)}},Lh=(s,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(a=>e.linePos(a));let{line:i,col:n}=t.linePos[0];t.message+=` at line ${i}, column ${n}`;let r=n-1,o=s.substring(e.lineStarts[i-1],e.lineStarts[i]).replace(/[\n\r]+$/,"");if(r>=60&&o.length>80){let a=Math.min(r-39,o.length-79);o="\u2026"+o.substring(a),r-=a-1}if(o.length>80&&(o=o.substring(0,79)+"\u2026"),i>1&&/^ *$/.test(o.substring(0,r))){let a=s.substring(e.lineStarts[i-2],e.lineStarts[i-1]);a.length>80&&(a=a.substring(0,79)+`\u2026 `),o=a+o}if(/[^ ]/.test(o)){let a=1,l=t.linePos[1];l&&l.line===i&&l.col>n&&(a=Math.max(1,Math.min(l.col-n,80-r)));let c=" ".repeat(r)+"^".repeat(a);t.message+=`: ${o} ${c} `}};wt.YAMLError=bt;wt.YAMLParseError=Rn;wt.YAMLWarning=Bn;wt.prettifyError=Lh});var vt=A(Qa=>{"use strict";function _h(s,{flow:e,indicator:t,next:i,offset:n,onError:r,parentIndent:o,startOnNewline:a}){let l=!1,c=a,f=a,u="",h="",y=!1,S=!1,d=null,p=null,m=null,g=null,E=null,b=null,w=null;for(let F of s)switch(S&&(F.type!=="space"&&F.type!=="newline"&&F.type!=="comma"&&r(F.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),S=!1),d&&(c&&F.type!=="comment"&&F.type!=="newline"&&r(d,"TAB_AS_INDENT","Tabs are not allowed as indentation"),d=null),F.type){case"space":!e&&(t!=="doc-start"||i?.type!=="flow-collection")&&F.source.includes(" ")&&(d=F),f=!0;break;case"comment":{f||r(F,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let N=F.source.substring(1)||" ";u?u+=h+N:u=N,h="",c=!1;break}case"newline":c?u?u+=F.source:(!b||t!=="seq-item-ind")&&(l=!0):h+=F.source,c=!0,y=!0,(p||m)&&(g=F),f=!0;break;case"anchor":p&&r(F,"MULTIPLE_ANCHORS","A node can have at most one anchor"),F.source.endsWith(":")&&r(F.offset+F.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),p=F,w===null&&(w=F.offset),c=!1,f=!1,S=!0;break;case"tag":{m&&r(F,"MULTIPLE_TAGS","A node can have at most one tag"),m=F,w===null&&(w=F.offset),c=!1,f=!1,S=!0;break}case t:(p||m)&&r(F,"BAD_PROP_ORDER",`Anchors and tags must be after the ${F.source} indicator`),b&&r(F,"UNEXPECTED_TOKEN",`Unexpected ${F.source} in ${e??"collection"}`),b=F,c=t==="seq-item-ind"||t==="explicit-key-ind",f=!1;break;case"comma":if(e){E&&r(F,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),E=F,c=!1,f=!1;break}default:r(F,"UNEXPECTED_TOKEN",`Unexpected ${F.type} token`),c=!1,f=!1}let v=s[s.length-1],P=v?v.offset+v.source.length:n;return S&&i&&i.type!=="space"&&i.type!=="newline"&&i.type!=="comma"&&(i.type!=="scalar"||i.source!=="")&&r(i.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),d&&(c&&d.indent<=o||i?.type==="block-map"||i?.type==="block-seq")&&r(d,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:E,found:b,spaceBefore:l,comment:u,hasNewline:y,anchor:p,tag:m,newlineAfterProp:g,end:P,start:w??P}}Qa.resolveProps=_h});var ki=A(Xa=>{"use strict";function $n(s){if(!s)return null;switch(s.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(s.source.includes(` `))return!0;if(s.end){for(let e of s.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(let e of s.items){for(let t of e.start)if(t.type==="newline")return!0;if(e.sep){for(let t of e.sep)if(t.type==="newline")return!0}if($n(e.key)||$n(e.value))return!0}return!1;default:return!0}}Xa.containsNewline=$n});var jn=A(za=>{"use strict";var Nh=ki();function Ch(s,e,t){if(e?.type==="flow-collection"){let i=e.end[0];i.indent===s&&(i.source==="]"||i.source==="}")&&Nh.containsNewline(e)&&t(i,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}za.flowIndentCheck=Ch});var Un=A(el=>{"use strict";var Za=L();function Oh(s,e,t){let{uniqueKeys:i}=s.options;if(i===!1)return!1;let n=typeof i=="function"?i:(r,o)=>r===o||Za.isScalar(r)&&Za.isScalar(o)&&r.value===o.value;return e.some(r=>n(r.key,t))}el.mapIncludes=Oh});var ol=A(rl=>{"use strict";var tl=le(),Ih=ue(),il=vt(),kh=ki(),sl=jn(),xh=Un(),nl="All mapping items must start at the same column";function qh({composeNode:s,composeEmptyNode:e},t,i,n,r){let o=r?.nodeClass??Ih.YAMLMap,a=new o(t.schema);t.atRoot&&(t.atRoot=!1);let l=i.offset,c=null;for(let f of i.items){let{start:u,key:h,sep:y,value:S}=f,d=il.resolveProps(u,{indicator:"explicit-key-ind",next:h??y?.[0],offset:l,onError:n,parentIndent:i.indent,startOnNewline:!0}),p=!d.found;if(p){if(h&&(h.type==="block-seq"?n(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in h&&h.indent!==i.indent&&n(l,"BAD_INDENT",nl)),!d.anchor&&!d.tag&&!y){c=d.end,d.comment&&(a.comment?a.comment+=` `+d.comment:a.comment=d.comment);continue}(d.newlineAfterProp||kh.containsNewline(h))&&n(h??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else d.found?.indent!==i.indent&&n(l,"BAD_INDENT",nl);t.atKey=!0;let m=d.end,g=h?s(t,h,d,n):e(t,m,u,null,d,n);t.schema.compat&&sl.flowIndentCheck(i.indent,h,n),t.atKey=!1,xh.mapIncludes(t,a.items,g)&&n(m,"DUPLICATE_KEY","Map keys must be unique");let E=il.resolveProps(y??[],{indicator:"map-value-ind",next:S,offset:g.range[2],onError:n,parentIndent:i.indent,startOnNewline:!h||h.type==="block-scalar"});if(l=E.end,E.found){p&&(S?.type==="block-map"&&!E.hasNewline&&n(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&d.start<E.found.offset-1024&&n(g.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));let b=S?s(t,S,E,n):e(t,l,y,null,E,n);t.schema.compat&&sl.flowIndentCheck(i.indent,S,n),l=b.range[2];let w=new tl.Pair(g,b);t.options.keepSourceTokens&&(w.srcToken=f),a.items.push(w)}else{p&&n(g.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),E.comment&&(g.comment?g.comment+=` `+E.comment:g.comment=E.comment);let b=new tl.Pair(g);t.options.keepSourceTokens&&(b.srcToken=f),a.items.push(b)}}return c&&c<l&&n(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[i.offset,l,c??l],a}rl.resolveBlockMap=qh});var ll=A(al=>{"use strict";var Mh=fe(),Rh=vt(),Bh=jn();function $h({composeNode:s,composeEmptyNode:e},t,i,n,r){let o=r?.nodeClass??Mh.YAMLSeq,a=new o(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let l=i.offset,c=null;for(let{start:f,value:u}of i.items){let h=Rh.resolveProps(f,{indicator:"seq-item-ind",next:u,offset:l,onError:n,parentIndent:i.indent,startOnNewline:!0});if(!h.found)if(h.anchor||h.tag||u)u&&u.type==="block-seq"?n(h.end,"BAD_INDENT","All sequence items must start at the same column"):n(l,"MISSING_CHAR","Sequence item without - indicator");else{c=h.end,h.comment&&(a.comment=h.comment);continue}let y=u?s(t,u,h,n):e(t,h.end,f,null,h,n);t.schema.compat&&Bh.flowIndentCheck(i.indent,u,n),l=y.range[2],a.items.push(y)}return a.range=[i.offset,l,c??l],a}al.resolveBlockSeq=$h});var Be=A(cl=>{"use strict";function jh(s,e,t,i){let n="";if(s){let r=!1,o="";for(let a of s){let{source:l,type:c}=a;switch(c){case"space":r=!0;break;case"comment":{t&&!r&&i(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");let f=l.substring(1)||" ";n?n+=o+f:n=f,o="";break}case"newline":n&&(o+=l),r=!0;break;default:i(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=l.length}}return{comment:n,offset:e}}cl.resolveEnd=jh});var pl=A(hl=>{"use strict";var Uh=L(),Kh=le(),ul=ue(),Vh=fe(),Wh=Be(),fl=vt(),Hh=ki(),Gh=Un(),Kn="Block collections are not allowed within flow collections",Vn=s=>s&&(s.type==="block-map"||s.type==="block-seq");function Yh({composeNode:s,composeEmptyNode:e},t,i,n,r){let o=i.start.source==="{",a=o?"flow map":"flow sequence",l=r?.nodeClass??(o?ul.YAMLMap:Vh.YAMLSeq),c=new l(t.schema);c.flow=!0;let f=t.atRoot;f&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let u=i.offset+i.start.source.length;for(let p=0;p<i.items.length;++p){let m=i.items[p],{start:g,key:E,sep:b,value:w}=m,v=fl.resolveProps(g,{flow:a,indicator:"explicit-key-ind",next:E??b?.[0],offset:u,onError:n,parentIndent:i.indent,startOnNewline:!1});if(!v.found){if(!v.anchor&&!v.tag&&!b&&!w){p===0&&v.comma?n(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):p<i.items.length-1&&n(v.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),v.comment&&(c.comment?c.comment+=` `+v.comment:c.comment=v.comment),u=v.end;continue}!o&&t.options.strict&&Hh.containsNewline(E)&&n(E,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(p===0)v.comma&&n(v.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(v.comma||n(v.start,"MISSING_CHAR",`Missing , between ${a} items`),v.comment){let P="";e:for(let F of g)switch(F.type){case"comma":case"space":break;case"comment":P=F.source.substring(1);break e;default:break e}if(P){let F=c.items[c.items.length-1];Uh.isPair(F)&&(F=F.value??F.key),F.comment?F.comment+=` `+P:F.comment=P,v.comment=v.comment.substring(P.length+1)}}if(!o&&!b&&!v.found){let P=w?s(t,w,v,n):e(t,v.end,b,null,v,n);c.items.push(P),u=P.range[2],Vn(w)&&n(P.range,"BLOCK_IN_FLOW",Kn)}else{t.atKey=!0;let P=v.end,F=E?s(t,E,v,n):e(t,P,g,null,v,n);Vn(E)&&n(F.range,"BLOCK_IN_FLOW",Kn),t.atKey=!1;let N=fl.resolveProps(b??[],{flow:a,indicator:"map-value-ind",next:w,offset:F.range[2],onError:n,parentIndent:i.indent,startOnNewline:!1});if(N.found){if(!o&&!v.found&&t.options.strict){if(b)for(let O of b){if(O===N.found)break;if(O.type==="newline"){n(O,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}v.start<N.found.offset-1024&&n(N.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else w&&("source"in w&&w.source&&w.source[0]===":"?n(w,"MISSING_CHAR",`Missing space after : in ${a}`):n(N.start,"MISSING_CHAR",`Missing , or : between ${a} items`));let M=w?s(t,w,N,n):N.found?e(t,N.end,b,null,N,n):null;M?Vn(w)&&n(M.range,"BLOCK_IN_FLOW",Kn):N.comment&&(F.comment?F.comment+=` `+N.comment:F.comment=N.comment);let te=new Kh.Pair(F,M);if(t.options.keepSourceTokens&&(te.srcToken=m),o){let O=c;Gh.mapIncludes(t,O.items,F)&&n(P,"DUPLICATE_KEY","Map keys must be unique"),O.items.push(te)}else{let O=new ul.YAMLMap(t.schema);O.flow=!0,O.items.push(te);let kt=(M??F).range;O.range=[F.range[0],kt[1],kt[2]],c.items.push(O)}u=M?M.range[2]:N.end}}let h=o?"}":"]",[y,...S]=i.end,d=u;if(y&&y.source===h)d=y.offset+y.source.length;else{let p=a[0].toUpperCase()+a.substring(1),m=f?`${p} must end with a ${h}`:`${p} in block collection must be sufficiently indented and end with a ${h}`;n(u,f?"MISSING_CHAR":"BAD_INDENT",m),y&&y.source.length!==1&&S.unshift(y)}if(S.length>0){let p=Wh.resolveEnd(S,d,t.options.strict,n);p.comment&&(c.comment?c.comment+=` `+p.comment:c.comment=p.comment),c.range=[i.offset,d,p.offset]}else c.range=[i.offset,d,d];return c}hl.resolveFlowCollection=Yh});var gl=A(dl=>{"use strict";var Jh=L(),Qh=I(),Xh=ue(),zh=fe(),Zh=ol(),ep=ll(),tp=pl();function Wn(s,e,t,i,n,r){let o=t.type==="block-map"?Zh.resolveBlockMap(s,e,t,i,r):t.type==="block-seq"?ep.resolveBlockSeq(s,e,t,i,r):tp.resolveFlowCollection(s,e,t,i,r),a=o.constructor;return n==="!"||n===a.tagName?(o.tag=a.tagName,o):(n&&(o.tag=n),o)}function ip(s,e,t,i,n){let r=i.tag,o=r?e.directives.tagName(r.source,h=>n(r,"TAG_RESOLVE_FAILED",h)):null;if(t.type==="block-seq"){let{anchor:h,newlineAfterProp:y}=i,S=h&&r?h.offset>r.offset?h:r:h??r;S&&(!y||y.offset<S.offset)&&n(S,"MISSING_CHAR","Missing newline after block sequence props")}let a=t.type==="block-map"?"map":t.type==="block-seq"?"seq":t.start.source==="{"?"map":"seq";if(!r||!o||o==="!"||o===Xh.YAMLMap.tagName&&a==="map"||o===zh.YAMLSeq.tagName&&a==="seq")return Wn(s,e,t,n,o);let l=e.schema.tags.find(h=>h.tag===o&&h.collection===a);if(!l){let h=e.schema.knownTags[o];if(h&&h.collection===a)e.schema.tags.push(Object.assign({},h,{default:!1})),l=h;else return h?.collection?n(r,"BAD_COLLECTION_TYPE",`${h.tag} used for ${a} collection, but expects ${h.collection}`,!0):n(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),Wn(s,e,t,n,o)}let c=Wn(s,e,t,n,o,l),f=l.resolve?.(c,h=>n(r,"TAG_RESOLVE_FAILED",h),e.options)??c,u=Jh.isNode(f)?f:new Qh.Scalar(f);return u.range=c.range,u.tag=o,l?.format&&(u.format=l.format),u}dl.composeCollection=ip});var Gn=A(ml=>{"use strict";var Hn=I();function sp(s,e,t){let i=e.offset,n=np(e,s.options.strict,t);if(!n)return{value:"",type:null,comment:"",range:[i,i,i]};let r=n.mode===">"?Hn.Scalar.BLOCK_FOLDED:Hn.Scalar.BLOCK_LITERAL,o=e.source?rp(e.source):[],a=o.length;for(let d=o.length-1;d>=0;--d){let p=o[d][1];if(p===""||p==="\r")a=d;else break}if(a===0){let d=n.chomp==="+"&&o.length>0?` `.repeat(Math.max(1,o.length-1)):"",p=i+n.length;return e.source&&(p+=e.source.length),{value:d,type:r,comment:n.comment,range:[i,p,p]}}let l=e.indent+n.indent,c=e.offset+n.length,f=0;for(let d=0;d<a;++d){let[p,m]=o[d];if(m===""||m==="\r")n.indent===0&&p.length>l&&(l=p.length);else{p.length<l&&t(c+p.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),n.indent===0&&(l=p.length),f=d,l===0&&!s.atRoot&&t(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=p.length+m.length+1}for(let d=o.length-1;d>=a;--d)o[d][0].length>l&&(a=d+1);let u="",h="",y=!1;for(let d=0;d<f;++d)u+=o[d][0].slice(l)+` `;for(let d=f;d<a;++d){let[p,m]=o[d];c+=p.length+m.length+1;let g=m[m.length-1]==="\r";if(g&&(m=m.slice(0,-1)),m&&p.length<l){let b=`Block scalar lines must not be less indented than their ${n.indent?"explicit indentation indicator":"first line"}`;t(c-m.length-(g?2:1),"BAD_INDENT",b),p=""}r===Hn.Scalar.BLOCK_LITERAL?(u+=h+p.slice(l)+m,h=` `):p.length>l||m[0]===" "?(h===" "?h=` `:!y&&h===` `&&(h=` `),u+=h+p.slice(l)+m,h=` `,y=!0):m===""?h===` `?u+=` `:h=` `:(u+=h+m,h=" ",y=!1)}switch(n.chomp){case"-":break;case"+":for(let d=a;d<o.length;++d)u+=` `+o[d][0].slice(l);u[u.length-1]!==` `&&(u+=` `);break;default:u+=` `}let S=i+n.length+e.source.length;return{value:u,type:r,comment:n.comment,range:[i,S,S]}}function np({offset:s,props:e},t,i){if(e[0].type!=="block-scalar-header")return i(e[0],"IMPOSSIBLE","Block scalar header not found"),null;let{source:n}=e[0],r=n[0],o=0,a="",l=-1;for(let h=1;h<n.length;++h){let y=n[h];if(!a&&(y==="-"||y==="+"))a=y;else{let S=Number(y);!o&&S?o=S:l===-1&&(l=s+h)}}l!==-1&&i(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${n}`);let c=!1,f="",u=n.length;for(let h=1;h<e.length;++h){let y=e[h];switch(y.type){case"space":c=!0;case"newline":u+=y.source.length;break;case"comment":t&&!c&&i(y,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=y.source.length,f=y.source.substring(1);break;case"error":i(y,"UNEXPECTED_TOKEN",y.message),u+=y.source.length;break;default:{let S=`Unexpected token in block scalar header: ${y.type}`;i(y,"UNEXPECTED_TOKEN",S);let d=y.source;d&&typeof d=="string"&&(u+=d.length)}}}return{mode:r,indent:o,chomp:a,comment:f,length:u}}function rp(s){let e=s.split(/\n( *)/),t=e[0],i=t.match(/^( *)/),r=[i?.[1]?[i[1],t.slice(i[1].length)]:["",t]];for(let o=1;o<e.length;o+=2)r.push([e[o],e[o+1]]);return r}ml.resolveBlockScalar=sp});var Jn=A(bl=>{"use strict";var Yn=I(),op=Be();function ap(s,e,t){let{offset:i,type:n,source:r,end:o}=s,a,l,c=(h,y,S)=>t(i+h,y,S);switch(n){case"scalar":a=Yn.Scalar.PLAIN,l=lp(r,c);break;case"single-quoted-scalar":a=Yn.Scalar.QUOTE_SINGLE,l=cp(r,c);break;case"double-quoted-scalar":a=Yn.Scalar.QUOTE_DOUBLE,l=up(r,c);break;default:return t(s,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${n}`),{value:"",type:null,comment:"",range:[i,i+r.length,i+r.length]}}let f=i+r.length,u=op.resolveEnd(o,f,e,t);return{value:l,type:a,comment:u.comment,range:[i,f,u.offset]}}function lp(s,e){let t="";switch(s[0]){case" ":t="a tab character";break;case",":t="flow indicator character ,";break;case"%":t="directive indicator character %";break;case"|":case">":{t=`block scalar indicator ${s[0]}`;break}case"@":case"`":{t=`reserved character ${s[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),yl(s)}function cp(s,e){return(s[s.length-1]!=="'"||s.length===1)&&e(s.length,"MISSING_CHAR","Missing closing 'quote"),yl(s.slice(1,-1)).replace(/''/g,"'")}function yl(s){let e,t;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r? `,"sy"),t=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r? `,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,t=/[ \t]*(.*?)[ \t]*\r?\n/sy}let i=e.exec(s);if(!i)return s;let n=i[1],r=" ",o=e.lastIndex;for(t.lastIndex=o;i=t.exec(s);)i[1]===""?r===` `?n+=r:r=` `:(n+=r+i[1],r=" "),o=t.lastIndex;let a=/[ \t]*(.*)/sy;return a.lastIndex=o,i=a.exec(s),n+r+(i?.[1]??"")}function up(s,e){let t="";for(let i=1;i<s.length-1;++i){let n=s[i];if(!(n==="\r"&&s[i+1]===` `))if(n===` `){let{fold:r,offset:o}=fp(s,i);t+=r,i=o}else if(n==="\\"){let r=s[++i],o=hp[r];if(o)t+=o;else if(r===` `)for(r=s[i+1];r===" "||r===" ";)r=s[++i+1];else if(r==="\r"&&s[i+1]===` `)for(r=s[++i+1];r===" "||r===" ";)r=s[++i+1];else if(r==="x"||r==="u"||r==="U"){let a={x:2,u:4,U:8}[r];t+=pp(s,i+1,a,e),i+=a}else{let a=s.substr(i-1,2);e(i-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),t+=a}}else if(n===" "||n===" "){let r=i,o=s[i+1];for(;o===" "||o===" ";)o=s[++i+1];o!==` `&&!(o==="\r"&&s[i+2]===` `)&&(t+=i>r?s.slice(r,i+1):n)}else t+=n}return(s[s.length-1]!=='"'||s.length===1)&&e(s.length,"MISSING_CHAR",'Missing closing "quote'),t}function fp(s,e){let t="",i=s[e+1];for(;(i===" "||i===" "||i===` `||i==="\r")&&!(i==="\r"&&s[e+2]!==` `);)i===` `&&(t+=` `),e+=1,i=s[e+1];return t||(t=" "),{fold:t,offset:e}}var hp={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:` `,r:"\r",t:" ",v:"\v",N:"\x85",_:"\xA0",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function pp(s,e,t,i){let n=s.substr(e,t),o=n.length===t&&/^[0-9a-fA-F]+$/.test(n)?parseInt(n,16):NaN;if(isNaN(o)){let a=s.substr(e-2,t+2);return i(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}bl.resolveFlowScalar=ap});var vl=A(Sl=>{"use strict";var Ee=L(),wl=I(),dp=Gn(),gp=Jn();function mp(s,e,t,i){let{value:n,type:r,comment:o,range:a}=e.type==="block-scalar"?dp.resolveBlockScalar(s,e,i):gp.resolveFlowScalar(e,s.options.strict,i),l=t?s.directives.tagName(t.source,u=>i(t,"TAG_RESOLVE_FAILED",u)):null,c;s.options.stringKeys&&s.atKey?c=s.schema[Ee.SCALAR]:l?c=yp(s.schema,n,l,t,i):e.type==="scalar"?c=bp(s,n,e,i):c=s.schema[Ee.SCALAR];let f;try{let u=c.resolve(n,h=>i(t??e,"TAG_RESOLVE_FAILED",h),s.options);f=Ee.isScalar(u)?u:new wl.Scalar(u)}catch(u){let h=u instanceof Error?u.message:String(u);i(t??e,"TAG_RESOLVE_FAILED",h),f=new wl.Scalar(n)}return f.range=a,f.source=n,r&&(f.type=r),l&&(f.tag=l),c.format&&(f.format=c.format),o&&(f.comment=o),f}function yp(s,e,t,i,n){if(t==="!")return s[Ee.SCALAR];let r=[];for(let a of s.tags)if(!a.collection&&a.tag===t)if(a.default&&a.test)r.push(a);else return a;for(let a of r)if(a.test?.test(e))return a;let o=s.knownTags[t];return o&&!o.collection?(s.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(n(i,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),s[Ee.SCALAR])}function bp({atKey:s,directives:e,schema:t},i,n,r){let o=t.tags.find(a=>(a.default===!0||s&&a.default==="key")&&a.test?.test(i))||t[Ee.SCALAR];if(t.compat){let a=t.compat.find(l=>l.default&&l.test?.test(i))??t[Ee.SCALAR];if(o.tag!==a.tag){let l=e.tagString(o.tag),c=e.tagString(a.tag),f=`Value may be parsed as either ${l} or ${c}`;r(n,"TAG_RESOLVE_FAILED",f,!0)}}return o}Sl.composeScalar=mp});var Fl=A(El=>{"use strict";function wp(s,e,t){if(e){t===null&&(t=e.length);for(let i=t-1;i>=0;--i){let n=e[i];switch(n.type){case"space":case"comment":case"newline":s-=n.source.length;continue}for(n=e[++i];n?.type==="space";)s+=n.source.length,n=e[++i];break}}return s}El.emptyScalarPosition=wp});var Dl=A(Xn=>{"use strict";var Sp=et(),vp=L(),Ep=gl(),Al=vl(),Fp=Be(),Ap=Fl(),Pp={composeNode:Pl,composeEmptyNode:Qn};function Pl(s,e,t,i){let n=s.atKey,{spaceBefore:r,comment:o,anchor:a,tag:l}=t,c,f=!0;switch(e.type){case"alias":c=Dp(s,e,i),(a||l)&&i(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=Al.composeScalar(s,e,l,i),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":c=Ep.composeCollection(Pp,s,e,t,i),a&&(c.anchor=a.source.substring(1));break;default:{let u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;i(e,"UNEXPECTED_TOKEN",u),c=Qn(s,e.offset,void 0,null,t,i),f=!1}}return a&&c.anchor===""&&i(a,"BAD_ALIAS","Anchor cannot be an empty string"),n&&s.options.stringKeys&&(!vp.isScalar(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&i(l??e,"NON_STRING_KEY","With stringKeys, all keys must be strings"),r&&(c.spaceBefore=!0),o&&(e.type==="scalar"&&e.source===""?c.comment=o:c.commentBefore=o),s.options.keepSourceTokens&&f&&(c.srcToken=e),c}function Qn(s,e,t,i,{spaceBefore:n,comment:r,anchor:o,tag:a,end:l},c){let f={type:"scalar",offset:Ap.emptyScalarPosition(e,t,i),indent:-1,source:""},u=Al.composeScalar(s,f,a,c);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),n&&(u.spaceBefore=!0),r&&(u.comment=r,u.range[2]=l),u}function Dp({options:s},{offset:e,source:t,end:i},n){let r=new Sp.Alias(t.substring(1));r.source===""&&n(e,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&n(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);let o=e+t.length,a=Fp.resolveEnd(i,o,s.strict,n);return r.range=[e,o,a.offset],a.comment&&(r.comment=a.comment),r}Xn.composeEmptyNode=Qn;Xn.composeNode=Pl});var _l=A(Ll=>{"use strict";var Tp=yt(),Tl=Dl(),Lp=Be(),_p=vt();function Np(s,e,{offset:t,start:i,value:n,end:r},o){let a=Object.assign({_directives:e},s),l=new Tp.Document(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},f=_p.resolveProps(i,{indicator:"doc-start",next:n??r?.[0],offset:t,onError:o,parentIndent:0,startOnNewline:!0});f.found&&(l.directives.docStart=!0,n&&(n.type==="block-map"||n.type==="block-seq")&&!f.hasNewline&&o(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=n?Tl.composeNode(c,n,f,o):Tl.composeEmptyNode(c,f.end,i,null,f,o);let u=l.contents.range[2],h=Lp.resolveEnd(r,u,!1,o);return h.comment&&(l.comment=h.comment),l.range=[t,u,h.offset],l}Ll.composeDoc=Np});var Zn=A(Ol=>{"use strict";var Cp=require("node:process"),Op=Ms(),Ip=yt(),Et=St(),Nl=L(),kp=_l(),xp=Be();function Ft(s){if(typeof s=="number")return[s,s+1];if(Array.isArray(s))return s.length===2?s:[s[0],s[1]];let{offset:e,source:t}=s;return[e,e+(typeof t=="string"?t.length:1)]}function Cl(s){let e="",t=!1,i=!1;for(let n=0;n<s.length;++n){let r=s[n];switch(r[0]){case"#":e+=(e===""?"":i?` `:` `)+(r.substring(1)||" "),t=!0,i=!1;break;case"%":s[n+1]?.[0]!=="#"&&(n+=1),t=!1;break;default:t||(i=!0),t=!1}}return{comment:e,afterEmptyLine:i}}var zn=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,i,n,r)=>{let o=Ft(t);r?this.warnings.push(new Et.YAMLWarning(o,i,n)):this.errors.push(new Et.YAMLParseError(o,i,n))},this.directives=new Op.Directives({version:e.version||"1.2"}),this.options=e}decorate(e,t){let{comment:i,afterEmptyLine:n}=Cl(this.prelude);if(i){let r=e.contents;if(t)e.comment=e.comment?`${e.comment} ${i}`:i;else if(n||e.directives.docStart||!r)e.commentBefore=i;else if(Nl.isCollection(r)&&!r.flow&&r.items.length>0){let o=r.items[0];Nl.isPair(o)&&(o=o.key);let a=o.commentBefore;o.commentBefore=a?`${i} ${a}`:i}else{let o=r.commentBefore;r.commentBefore=o?`${i} ${o}`:i}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Cl(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,i=-1){for(let n of e)yield*this.next(n);yield*this.end(t,i)}*next(e){switch(Cp.env.LOG_STREAM&&console.dir(e,{depth:null}),e.type){case"directive":this.directives.add(e.source,(t,i,n)=>{let r=Ft(e);r[0]+=t,this.onError(r,"BAD_DIRECTIVE",i,n)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{let t=kp.composeDoc(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,"MISSING_CHAR","Missing directives-end/doc-start indicator line"),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case"byte-order-mark":case"space":break;case"comment":case"newline":this.prelude.push(e.source);break;case"error":{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,i=new Et.YAMLParseError(Ft(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(i):this.doc.errors.push(i);break}case"doc-end":{if(!this.doc){let i="Unexpected doc-end without preceding document";this.errors.push(new Et.YAMLParseError(Ft(e),"UNEXPECTED_TOKEN",i));break}this.doc.directives.docEnd=!0;let t=xp.resolveEnd(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let i=this.doc.comment;this.doc.comment=i?`${i} ${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new Et.YAMLParseError(Ft(e),"UNEXPECTED_TOKEN",`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let i=Object.assign({_directives:this.directives},this.options),n=new Ip.Document(void 0,i);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),n.range=[0,t,t],this.decorate(n,!1),yield n}}};Ol.Composer=zn});var xl=A(xi=>{"use strict";var qp=Gn(),Mp=Jn(),Rp=St(),Il=rt();function Bp(s,e=!0,t){if(s){let i=(n,r,o)=>{let a=typeof n=="number"?n:Array.isArray(n)?n[0]:n.offset;if(t)t(a,r,o);else throw new Rp.YAMLParseError([a,a+1],r,o)};switch(s.type){case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return Mp.resolveFlowScalar(s,e,i);case"block-scalar":return qp.resolveBlockScalar({options:{strict:e}},s,i)}}return null}function $p(s,e){let{implicitKey:t=!1,indent:i,inFlow:n=!1,offset:r=-1,type:o="PLAIN"}=e,a=Il.stringifyString({type:o,value:s},{implicitKey:t,indent:i>0?" ".repeat(i):"",inFlow:n,options:{blockQuote:!0,lineWidth:-1}}),l=e.end??[{type:"newline",offset:-1,indent:i,source:` `}];switch(a[0]){case"|":case">":{let c=a.indexOf(` `),f=a.substring(0,c),u=a.substring(c+1)+` `,h=[{type:"block-scalar-header",offset:r,indent:i,source:f}];return kl(h,l)||h.push({type:"newline",offset:-1,indent:i,source:` `}),{type:"block-scalar",offset:r,indent:i,props:h,source:u}}case'"':return{type:"double-quoted-scalar",offset:r,indent:i,source:a,end:l};case"'":return{type:"single-quoted-scalar",offset:r,indent:i,source:a,end:l};default:return{type:"scalar",offset:r,indent:i,source:a,end:l}}}function jp(s,e,t={}){let{afterKey:i=!1,implicitKey:n=!1,inFlow:r=!1,type:o}=t,a="indent"in s?s.indent:null;if(i&&typeof a=="number"&&(a+=2),!o)switch(s.type){case"single-quoted-scalar":o="QUOTE_SINGLE";break;case"double-quoted-scalar":o="QUOTE_DOUBLE";break;case"block-scalar":{let c=s.props[0];if(c.type!=="block-scalar-header")throw new Error("Invalid block scalar header");o=c.source[0]===">"?"BLOCK_FOLDED":"BLOCK_LITERAL";break}default:o="PLAIN"}let l=Il.stringifyString({type:o,value:e},{implicitKey:n||a===null,indent:a!==null&&a>0?" ".repeat(a):"",inFlow:r,options:{blockQuote:!0,lineWidth:-1}});switch(l[0]){case"|":case">":Up(s,l);break;case'"':er(s,l,"double-quoted-scalar");break;case"'":er(s,l,"single-quoted-scalar");break;default:er(s,l,"scalar")}}function Up(s,e){let t=e.indexOf(` `),i=e.substring(0,t),n=e.substring(t+1)+` `;if(s.type==="block-scalar"){let r=s.props[0];if(r.type!=="block-scalar-header")throw new Error("Invalid block scalar header");r.source=i,s.source=n}else{let{offset:r}=s,o="indent"in s?s.indent:-1,a=[{type:"block-scalar-header",offset:r,indent:o,source:i}];kl(a,"end"in s?s.end:void 0)||a.push({type:"newline",offset:-1,indent:o,source:` `});for(let l of Object.keys(s))l!=="type"&&l!=="offset"&&delete s[l];Object.assign(s,{type:"block-scalar",indent:o,props:a,source:n})}}function kl(s,e){if(e)for(let t of e)switch(t.type){case"space":case"comment":s.push(t);break;case"newline":return s.push(t),!0}return!1}function er(s,e,t){switch(s.type){case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":s.type=t,s.source=e;break;case"block-scalar":{let i=s.props.slice(1),n=e.length;s.props[0].type==="block-scalar-header"&&(n-=s.props[0].source.length);for(let r of i)r.offset+=n;delete s.props,Object.assign(s,{type:t,source:e,end:i});break}case"block-map":case"block-seq":{let n={type:"newline",offset:s.offset+e.length,indent:s.indent,source:` `};delete s.items,Object.assign(s,{type:t,source:e,end:[n]});break}default:{let i="indent"in s?s.indent:-1,n="end"in s&&Array.isArray(s.end)?s.end.filter(r=>r.type==="space"||r.type==="comment"||r.type==="newline"):[];for(let r of Object.keys(s))r!=="type"&&r!=="offset"&&delete s[r];Object.assign(s,{type:t,indent:i,source:e,end:n})}}}xi.createScalarToken=$p;xi.resolveAsScalar=Bp;xi.setScalarValue=jp});var Ml=A(ql=>{"use strict";var Kp=s=>"type"in s?Mi(s):qi(s);function Mi(s){switch(s.type){case"block-scalar":{let e="";for(let t of s.props)e+=Mi(t);return e+s.source}case"block-map":case"block-seq":{let e="";for(let t of s.items)e+=qi(t);return e}case"flow-collection":{let e=s.start.source;for(let t of s.items)e+=qi(t);for(let t of s.end)e+=t.source;return e}case"document":{let e=qi(s);if(s.end)for(let t of s.end)e+=t.source;return e}default:{let e=s.source;if("end"in s&&s.end)for(let t of s.end)e+=t.source;return e}}}function qi({start:s,key:e,sep:t,value:i}){let n="";for(let r of s)n+=r.source;if(e&&(n+=Mi(e)),t)for(let r of t)n+=r.source;return i&&(n+=Mi(i)),n}ql.stringify=Kp});var jl=A($l=>{"use strict";var tr=Symbol("break visit"),Vp=Symbol("skip children"),Rl=Symbol("remove item");function Fe(s,e){"type"in s&&s.type==="document"&&(s={start:s.start,value:s.value}),Bl(Object.freeze([]),s,e)}Fe.BREAK=tr;Fe.SKIP=Vp;Fe.REMOVE=Rl;Fe.itemAtPath=(s,e)=>{let t=s;for(let[i,n]of e){let r=t?.[i];if(r&&"items"in r)t=r.items[n];else return}return t};Fe.parentCollection=(s,e)=>{let t=Fe.itemAtPath(s,e.slice(0,-1)),i=e[e.length-1][0],n=t?.[i];if(n&&"items"in n)return n;throw new Error("Parent collection not found")};function Bl(s,e,t){let i=t(e,s);if(typeof i=="symbol")return i;for(let n of["key","value"]){let r=e[n];if(r&&"items"in r){for(let o=0;o<r.items.length;++o){let a=Bl(Object.freeze(s.concat([[n,o]])),r.items[o],t);if(typeof a=="number")o=a-1;else{if(a===tr)return tr;a===Rl&&(r.items.splice(o,1),o-=1)}}typeof i=="function"&&n==="key"&&(i=i(e,s))}}return typeof i=="function"?i(e,s):i}$l.visit=Fe});var Ri=A(B=>{"use strict";var ir=xl(),Wp=Ml(),Hp=jl(),sr="\uFEFF",nr="",rr="",or="",Gp=s=>!!s&&"items"in s,Yp=s=>!!s&&(s.type==="scalar"||s.type==="single-quoted-scalar"||s.type==="double-quoted-scalar"||s.type==="block-scalar");function Jp(s){switch(s){case sr:return"<BOM>";case nr:return"<DOC>";case rr:return"<FLOW_END>";case or:return"<SCALAR>";default:return JSON.stringify(s)}}function Qp(s){switch(s){case sr:return"byte-order-mark";case nr:return"doc-mode";case rr:return"flow-error-end";case or:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case` `:case`\r `:return"newline";case"-":return"seq-item-ind";case"?":return"explicit-key-ind";case":":return"map-value-ind";case"{":return"flow-map-start";case"}":return"flow-map-end";case"[":return"flow-seq-start";case"]":return"flow-seq-end";case",":return"comma"}switch(s[0]){case" ":case" ":return"space";case"#":return"comment";case"%":return"directive-line";case"*":return"alias";case"&":return"anchor";case"!":return"tag";case"'":return"single-quoted-scalar";case'"':return"double-quoted-scalar";case"|":case">":return"block-scalar-header"}return null}B.createScalarToken=ir.createScalarToken;B.resolveAsScalar=ir.resolveAsScalar;B.setScalarValue=ir.setScalarValue;B.stringify=Wp.stringify;B.visit=Hp.visit;B.BOM=sr;B.DOCUMENT=nr;B.FLOW_END=rr;B.SCALAR=or;B.isCollection=Gp;B.isScalar=Yp;B.prettyToken=Jp;B.tokenType=Qp});var cr=A(Kl=>{"use strict";var At=Ri();function G(s){switch(s){case void 0:case" ":case` `:case"\r":case" ":return!0;default:return!1}}var Ul=new Set("0123456789ABCDEFabcdef"),Xp=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Bi=new Set(",[]{}"),zp=new Set(` ,[]{} \r `),ar=s=>!s||zp.has(s),lr=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer="",this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!="string")throw TypeError("source is not a string");this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let i=this.next??"stream";for(;i&&(t||this.hasChars(1));)i=yield*this.parseNext(i)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===` `?!0:t==="\r"?this.buffer[e+1]===` `:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let i=0;for(;t===" ";)t=this.buffer[++i+e];if(t==="\r"){let n=this.buffer[i+e+1];if(n===` `||!n&&!this.atEnd)return e+i+1}return t===` `||i>=this.indentNext||!t&&!this.atEnd?e+i:-1}if(t==="-"||t==="."){let i=this.buffer.substr(e,3);if((i==="---"||i==="...")&&G(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(` `,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]===At.BOM&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,i=e.indexOf("#");for(;i!==-1;){let r=e[i-1];if(r===" "||r===" "){t=i-1;break}else i=e.indexOf("#",i+1)}for(;;){let r=e[t-1];if(r===" "||r===" ")t-=1;else break}let n=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-n),this.pushNewline(),"stream"}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield At.DOCUMENT,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext("line-start");if(e==="-"||e==="."){if(!this.atEnd&&!this.hasChars(4))return this.setNext("line-start");let t=this.peek(3);if((t==="---"||t==="...")&&G(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,t==="---"?"doc":"stream"}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!G(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&G(t)){let i=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=i,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext("doc");let t=yield*this.pushIndicators();switch(e[t]){case"#":yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case"{":case"[":return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,"flow";case"}":case"]":return yield*this.pushCount(1),"doc";case"*":return yield*this.pushUntil(ar),"doc";case'"':case"'":return yield*this.parseQuotedScalar();case"|":case">":return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,i=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=i=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let n=this.getLine();if(n===null)return this.setNext("flow");if((i!==-1&&i<this.indentNext&&n[0]!=="#"||i===0&&(n.startsWith("---")||n.startsWith("..."))&&G(n[3]))&&!(i===this.indentNext-1&&this.flowLevel===1&&(n[0]==="]"||n[0]==="}")))return this.flowLevel=0,yield At.FLOW_END,yield*this.parseLineStart();let r=0;for(;n[r]===",";)r+=yield*this.pushCount(1),r+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(r+=yield*this.pushIndicators(),n[r]){case void 0:return"flow";case"#":return yield*this.pushCount(n.length-r),"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(ar),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{let o=this.charAt(1);if(this.flowKey||G(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e==="'")for(;t!==-1&&this.buffer[t+1]==="'";)t=this.buffer.indexOf("'",t+2);else for(;t!==-1;){let r=0;for(;this.buffer[t-1-r]==="\\";)r+=1;if(r%2===0)break;t=this.buffer.indexOf('"',t+1)}let i=this.buffer.substring(0,t),n=i.indexOf(` `,this.pos);if(n!==-1){for(;n!==-1;){let r=this.continueScalar(n+1);if(r===-1)break;n=i.indexOf(` `,r)}n!==-1&&(t=n-(i[n-1]==="\r"?2:1))}if(t===-1){if(!this.atEnd)return this.setNext("quoted-scalar");t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?"flow":"doc"}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t==="+")this.blockScalarKeep=!0;else if(t>"0"&&t<="9")this.blockScalarIndent=Number(t)-1;else if(t!=="-")break}return yield*this.pushUntil(t=>G(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,i;e:for(let r=this.pos;i=this.buffer[r];++r)switch(i){case" ":t+=1;break;case` `:e=r,t=0;break;case"\r":{let o=this.buffer[r+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===` `)break}default:break e}if(!i&&!this.atEnd)return this.setNext("block-scalar");if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let r=this.continueScalar(e+1);if(r===-1)break;e=this.buffer.indexOf(` `,r)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let n=e+1;for(i=this.buffer[n];i===" ";)i=this.buffer[++n];if(i===" "){for(;i===" "||i===" "||i==="\r"||i===` `;)i=this.buffer[++n];e=n-1}else if(!this.blockScalarKeep)do{let r=e-1,o=this.buffer[r];o==="\r"&&(o=this.buffer[--r]);let a=r;for(;o===" ";)o=this.buffer[--r];if(o===` `&&r>=this.pos&&r+1+t>a)e=r;else break}while(!0);return yield At.SCALAR,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,i=this.pos-1,n;for(;n=this.buffer[++i];)if(n===":"){let r=this.buffer[i+1];if(G(r)||e&&Bi.has(r))break;t=i}else if(G(n)){let r=this.buffer[i+1];if(n==="\r"&&(r===` `?(i+=1,n=` `,r=this.buffer[i+1]):t=i),r==="#"||e&&Bi.has(r))break;if(n===` `){let o=this.continueScalar(i+1);if(o===-1)break;i=Math.max(i,o-2)}}else{if(e&&Bi.has(n))break;t=i}return!n&&!this.atEnd?this.setNext("plain-scalar"):(yield At.SCALAR,yield*this.pushToIndex(t+1,!0),e?"flow":"doc")}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let i=this.buffer.slice(this.pos,e);return i?(yield i,this.pos+=i.length,i.length):(t&&(yield""),0)}*pushIndicators(){switch(this.charAt(0)){case"!":return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"&":return(yield*this.pushUntil(ar))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{let e=this.flowLevel>0,t=this.charAt(1);if(G(t)||e&&Bi.has(t))return e?this.flowKey&&(this.flowKey=!1):this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)==="<"){let e=this.pos+2,t=this.buffer[e];for(;!G(t)&&t!==">";)t=this.buffer[++e];return yield*this.pushToIndex(t===">"?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Xp.has(t))t=this.buffer[++e];else if(t==="%"&&Ul.has(this.buffer[e+1])&&Ul.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===` `?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===` `?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,i;do i=this.buffer[++t];while(i===" "||e&&i===" ");let n=t-this.pos;return n>0&&(yield this.buffer.substr(this.pos,n),this.pos=t),n}*pushUntil(e){let t=this.pos,i=this.buffer[t];for(;!e(i);)i=this.buffer[++t];return yield*this.pushToIndex(t,!1)}};Kl.Lexer=lr});var fr=A(Vl=>{"use strict";var ur=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,i=this.lineStarts.length;for(;t<i;){let r=t+i>>1;this.lineStarts[r]<e?t=r+1:i=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let n=this.lineStarts[t-1];return{line:t,col:e-n+1}}}};Vl.LineCounter=ur});var pr=A(Jl=>{"use strict";var Zp=require("node:process"),Wl=Ri(),ed=cr();function Ae(s,e){for(let t=0;t<s.length;++t)if(s[t].type===e)return!0;return!1}function Hl(s){for(let e=0;e<s.length;++e)switch(s[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function Yl(s){switch(s?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function $i(s){switch(s.type){case"document":return s.start;case"block-map":{let e=s.items[s.items.length-1];return e.sep??e.start}case"block-seq":return s.items[s.items.length-1].start;default:return[]}}function $e(s){if(s.length===0)return[];let e=s.length;e:for(;--e>=0;)switch(s[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;s[++e]?.type==="space";);return s.splice(e,s.length)}function Gl(s){if(s.start.type==="flow-seq-start")for(let e of s.items)e.sep&&!e.value&&!Ae(e.start,"explicit-key-ind")&&!Ae(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,Yl(e.value)?e.value.end?Array.prototype.push.apply(e.value.end,e.sep):e.value.end=e.sep:Array.prototype.push.apply(e.start,e.sep),delete e.sep)}var hr=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 ed.Lexer,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let i of this.lexer.lex(e,t))yield*this.next(i);t||(yield*this.end())}*next(e){if(this.source=e,Zp.env.LOG_TOKENS&&console.log("|",Wl.prettyToken(e)),this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=Wl.tokenType(e);if(t)if(t==="scalar")this.atNewLine=!1,this.atScalar=!0,this.type="scalar";else{switch(this.type=t,yield*this.step(),t){case"newline":this.atNewLine=!0,this.indent=0,this.onNewLine&&this.onNewLine(this.offset+e.length);break;case"space":this.atNewLine&&e[0]===" "&&(this.indent+=e.length);break;case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":this.atNewLine&&(this.indent+=e.length);break;case"doc-mode":case"flow-error-end":return;default:this.atNewLine=!1}this.offset+=e.length}else{let i=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:i,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||e.type!=="doc-end")){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:"error",offset:this.offset,source:"",message:"Tried to pop an empty stack"};else if(this.stack.length===0)yield t;else{let i=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in i?i.indent:0:t.type==="flow-collection"&&i.type==="document"&&(t.indent=0),t.type==="flow-collection"&&Gl(t),i.type){case"document":i.value=t;break;case"block-scalar":i.props.push(t);break;case"block-map":{let n=i.items[i.items.length-1];if(n.value){i.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case"block-seq":{let n=i.items[i.items.length-1];n.value?i.items.push({start:[],value:t}):n.value=t;break}case"flow-collection":{let n=i.items[i.items.length-1];!n||n.value?i.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((i.type==="document"||i.type==="block-map"||i.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&Hl(n.start)===-1&&(t.indent===0||n.start.every(r=>r.type!=="comment"||r.indent<t.indent))&&(i.type==="document"?i.end=n.start:i.items.push({start:n.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case"directive-line":yield{type:"directive",offset:this.offset,source:this.source};return;case"byte-order-mark":case"space":case"comment":case"newline":yield this.sourceToken;return;case"doc-mode":case"doc-start":{let e={type:"document",offset:this.offset,start:[]};this.type==="doc-start"&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case"doc-start":{Hl(e.start)!==-1?(yield*this.pop(),yield*this.step()):e.start.push(this.sourceToken);return}case"anchor":case"tag":case"space":case"comment":case"newline":e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:"error",offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type==="map-value-ind"){let t=$i(this.peek(2)),i=$e(t),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let r={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:i,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case"space":case"comment":case"newline":e.props.push(this.sourceToken);return;case"scalar":if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let t=this.source.indexOf(` `)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(` `,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){let i="end"in t.value?t.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let i=!this.onKeyLine&&this.indent===e.indent,n=i&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind",r=[];if(n&&t.sep&&!t.value){let o=[];for(let a=0;a<t.sep.length;++a){let l=t.sep[a];switch(l.type){case"newline":o.push(a);break;case"space":break;case"comment":l.indent>e.indent&&(o.length=0);break;default:o.length=0}}o.length>=2&&(r=t.sep.splice(o[1]))}switch(this.type){case"anchor":case"tag":n||t.value?(r.push(this.sourceToken),e.items.push({start:r}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"explicit-key-ind":!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):n||t.value?(r.push(this.sourceToken),e.items.push({start:r,explicitKey:!0})):this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case"map-value-ind":if(t.explicitKey)if(t.sep)if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(Ae(t.sep,"map-value-ind"))this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:r,key:null,sep:[this.sourceToken]}]});else if(Yl(t.key)&&!Ae(t.sep,"newline")){let o=$e(t.start),a=t.key,l=t.sep;l.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:a,sep:l}]})}else r.length>0?t.sep=t.sep.concat(r,this.sourceToken):t.sep.push(this.sourceToken);else if(Ae(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let o=$e(t.start);this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:o,key:null,sep:[this.sourceToken]}]})}else t.sep?t.value||n?e.items.push({start:r,key:null,sep:[this.sourceToken]}):Ae(t.sep,"map-value-ind")?this.stack.push({type:"block-map",offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let o=this.flowScalar(this.type);n||t.value?(e.items.push({start:r,key:o,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(o):(Object.assign(t,{key:o,sep:[]}),this.onKeyLine=!0);return}default:{let o=this.startBlockValue(e);if(o){i&&o.type!=="block-seq"&&e.items.push({start:r}),this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){let i="end"in t.value?t.value.end:void 0;(Array.isArray(i)?i[i.length-1]:void 0)?.type==="comment"?i?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case"space":case"comment":if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){Array.prototype.push.apply(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case"anchor":case"tag":if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case"seq-item-ind":if(this.indent!==e.indent)break;t.value||Ae(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let i=this.startBlockValue(e);if(i){this.stack.push(i);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let i;do yield*this.pop(),i=this.peek(1);while(i&&i.type==="flow-collection")}else if(e.end.length===0){switch(this.type){case"comma":case"explicit-key-ind":!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case"map-value-ind":!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case"space":case"comment":case"newline":case"anchor":case"tag":!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}let i=this.startBlockValue(e);i?this.stack.push(i):(yield*this.pop(),yield*this.step())}else{let i=this.peek(2);if(i.type==="block-map"&&(this.type==="map-value-ind"&&i.indent===e.indent||this.type==="newline"&&!i.items[i.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&i.type!=="flow-collection"){let n=$i(i),r=$e(n);Gl(e);let o=e.end.splice(1,e.end.length);o.push(this.sourceToken);let a={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:r,key:e,sep:o}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=a}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let t=this.source.indexOf(` `)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(` `,t)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return this.flowScalar(this.type);case"block-scalar-header":return{type:"block-scalar",offset:this.offset,indent:this.indent,props:[this.sourceToken],source:""};case"flow-map-start":case"flow-seq-start":return{type:"flow-collection",offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case"seq-item-ind":return{type:"block-seq",offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case"explicit-key-ind":{this.onKeyLine=!0;let t=$i(e),i=$e(t);return i.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;let t=$i(e),i=$e(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(i=>i.type==="newline"||i.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;case"space":case"comment":default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}};Jl.Parser=hr});var ec=A(Dt=>{"use strict";var Ql=Zn(),td=yt(),Pt=St(),id=Qs(),sd=L(),nd=fr(),Xl=pr();function zl(s){let e=s.prettyErrors!==!1;return{lineCounter:s.lineCounter||e&&new nd.LineCounter||null,prettyErrors:e}}function rd(s,e={}){let{lineCounter:t,prettyErrors:i}=zl(e),n=new Xl.Parser(t?.addNewLine),r=new Ql.Composer(e),o=Array.from(r.compose(n.parse(s)));if(i&&t)for(let a of o)a.errors.forEach(Pt.prettifyError(s,t)),a.warnings.forEach(Pt.prettifyError(s,t));return o.length>0?o:Object.assign([],{empty:!0},r.streamInfo())}function Zl(s,e={}){let{lineCounter:t,prettyErrors:i}=zl(e),n=new Xl.Parser(t?.addNewLine),r=new Ql.Composer(e),o=null;for(let a of r.compose(n.parse(s),!0,s.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new Pt.YAMLParseError(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return i&&t&&(o.errors.forEach(Pt.prettifyError(s,t)),o.warnings.forEach(Pt.prettifyError(s,t))),o}function od(s,e,t){let i;typeof e=="function"?i=e:t===void 0&&e&&typeof e=="object"&&(t=e);let n=Zl(s,t);if(!n)return null;if(n.warnings.forEach(r=>id.warn(n.options.logLevel,r)),n.errors.length>0){if(n.options.logLevel!=="silent")throw n.errors[0];n.errors=[]}return n.toJS(Object.assign({reviver:i},t))}function ad(s,e,t){let i=null;if(typeof e=="function"||Array.isArray(e)?i=e:t===void 0&&e&&(t=e),typeof t=="string"&&(t=t.length),typeof t=="number"){let n=Math.round(t);t=n<1?void 0:n>8?{indent:8}:{indent:n}}if(s===void 0){let{keepUndefined:n}=t??e??{};if(!n)return}return sd.isDocument(s)&&!i?s.toString(t):new td.Document(s,i,t).toString(t)}Dt.parse=od;Dt.parseAllDocuments=rd;Dt.parseDocument=Zl;Dt.stringify=ad});var ic=A(_=>{"use strict";var ld=Zn(),cd=yt(),ud=In(),dr=St(),fd=et(),he=L(),hd=le(),pd=I(),dd=ue(),gd=fe(),md=Ri(),yd=cr(),bd=fr(),wd=pr(),ji=ec(),tc=Qe();_.Composer=ld.Composer;_.Document=cd.Document;_.Schema=ud.Schema;_.YAMLError=dr.YAMLError;_.YAMLParseError=dr.YAMLParseError;_.YAMLWarning=dr.YAMLWarning;_.Alias=fd.Alias;_.isAlias=he.isAlias;_.isCollection=he.isCollection;_.isDocument=he.isDocument;_.isMap=he.isMap;_.isNode=he.isNode;_.isPair=he.isPair;_.isScalar=he.isScalar;_.isSeq=he.isSeq;_.Pair=hd.Pair;_.Scalar=pd.Scalar;_.YAMLMap=dd.YAMLMap;_.YAMLSeq=gd.YAMLSeq;_.CST=md;_.Lexer=yd.Lexer;_.LineCounter=bd.LineCounter;_.Parser=wd.Parser;_.parse=ji.parse;_.parseAllDocuments=ji.parseAllDocuments;_.parseDocument=ji.parseDocument;_.stringify=ji.stringify;_.visit=tc.visit;_.visitAsync=tc.visitAsync});var _c=require("commander");var Tr=pe(require("node:crypto")),D=pe(require("node:fs")),de=pe(require("node:os")),T=pe(require("node:path")),ns=pe(require("node:url"));global.nodeCrypto=Tr.default;var xt=null;try{let s=T.default.join(__dirname,"btime",process.platform+"-"+process.arch);xt=require(T.default.join(s,"btime.node")).btime}catch{}function Lr(){return xt!==null}function _r(s,e){if(!xt)return;let t=Buffer.alloc(Buffer.byteLength(s,"utf-8")+1);t.write(s,0,t.length-1,"utf-8"),t[t.length-1]=0,xt(t,e)}var rs=["image","audio","video","pdf","unsupported"],Le=["image","audio","pdf","video"],os=["app","appearance","appearance-data","hotkey","core-plugin","core-plugin-data","community-plugin","community-plugin-data"],as=["app","appearance","appearance-data","hotkey","core-plugin","core-plugin-data"];var Nr="obsidian-headless",ge=de.default.platform()==="linux"?T.default.join(process.env.XDG_CONFIG_HOME||T.default.join(de.default.homedir(),".config"),Nr):T.default.join(de.default.homedir(),"."+Nr),Cr="OBSIDIAN_AUTH_TOKEN",ls=T.default.join(ge,"auth_token");function Ke(){if(process.env[Cr])return process.env[Cr];try{return D.default.readFileSync(ls,"utf8")}catch{return null}}function Or(s){D.default.existsSync(ge)||D.default.mkdirSync(ge,{recursive:!0,mode:448}),D.default.writeFileSync(ls,s,{mode:384})}function cs(){D.default.rmSync(ls,{force:!0})}function Ve(s){return T.default.join(ge,"sync",s)}function Ir(s){return T.default.join(Ve(s),"state.db")}function kr(s){return T.default.join(Ve(s),"sync.log")}function xr(s){return T.default.join(Ve(s),"config.json")}function us(s){let e=Ve(s);return D.default.existsSync(e)||D.default.mkdirSync(e,{recursive:!0,mode:448}),e}function fs(s){let e=xr(s);if(!D.default.existsSync(e))return null;try{let t=D.default.readFileSync(e,"utf-8");return JSON.parse(t)}catch{return null}}function hs(s,e){us(s);let t=xr(s);D.default.writeFileSync(t,JSON.stringify(e,null,2),{mode:384})}function qr(s,e){return T.default.join(s,e,".sync.lock")}function Mr(s){let e=Ve(s);D.default.existsSync(e)&&D.default.rmSync(e,{recursive:!0,force:!0})}function ps(){let s=T.default.join(ge,"sync");if(!D.default.existsSync(s))return[];let e=D.default.readdirSync(s,{withFileTypes:!0}),t=[];for(let i of e)if(i.isDirectory()){let n=T.default.join(s,i.name,"config.json");D.default.existsSync(n)&&t.push(i.name)}return t}function We(s){let e=T.default.resolve(s),t=ps();for(let i of t){let n=fs(i);if(n&&T.default.resolve(n.vaultPath)===e)return n}return null}function Rr(s){let e=s.split(",").map(t=>t.trim().toLowerCase());for(let t of e)if(!rs.includes(t))throw new Error(`Invalid file type: "${t}". Valid values: ${rs.join(", ")}`);return e}function Br(s){let e=s.split(",").map(t=>t.trim().toLowerCase());for(let t of e)if(!os.includes(t))throw new Error(`Invalid config: "${t}". Valid values: ${os.join(", ")}`);return e}function ds(s){if(s){if(!s.startsWith(".")||s.includes("/")||s.includes("\\"))throw new Error(`Invalid config directory: "${s}". Must be a dotfolder name (e.g. .obsidian).`);return s}}function qt(s){return T.default.join(ge,"publish",s)}function $r(s){return T.default.join(qt(s),"config.json")}function gs(s){return T.default.join(qt(s),"cache.json")}function ms(s){let e=qt(s);return D.default.existsSync(e)||D.default.mkdirSync(e,{recursive:!0,mode:448}),e}function $c(s){let e=$r(s);if(!D.default.existsSync(e))return null;try{let t=D.default.readFileSync(e,"utf-8");return JSON.parse(t)}catch{return null}}function ys(s,e){ms(s);let t=$r(s);D.default.writeFileSync(t,JSON.stringify(e,null,2),{mode:384})}function jr(s){let e=qt(s);D.default.existsSync(e)&&D.default.rmSync(e,{recursive:!0,force:!0})}function jc(){let s=T.default.join(ge,"publish");if(!D.default.existsSync(s))return[];let e=D.default.readdirSync(s,{withFileTypes:!0}),t=[];for(let i of e)if(i.isDirectory()){let n=T.default.join(s,i.name,"config.json");D.default.existsSync(n)&&t.push(i.name)}return t}function He(s){let e=T.default.resolve(s),t=jc();for(let i of t){let n=$c(i);if(n&&T.default.resolve(n.vaultPath)===e)return n}return null}function bs(){let s=de.default.hostname(),e=de.default.platform();return`${s} (${e==="darwin"?"macOS":e==="win32"?"Windows":e==="linux"?"Linux":e})`}function Ur(s){let e=T.default.dirname(s);D.default.existsSync(e)||D.default.mkdirSync(e,{recursive:!0});let t=D.default.createWriteStream(s,{flags:"a"}),i=console.log,n=console.warn,r=console.error,o=console.debug;function a(...l){let c=new Date().toISOString(),f=l.map(u=>typeof u=="object"?JSON.stringify(u):String(u)).join(" ");t.write(`[${c}] ${f} `)}return console.log=(...l)=>{i(...l),a(...l)},console.warn=(...l)=>{n(...l),a(...l)},console.error=(...l)=>{r(...l),a(...l)},console.debug=(...l)=>{o(...l),a(...l)},()=>{console.log=i,console.warn=n,console.error=r,console.debug=o,t.end()}}var Mt=fetch,Kr="https://"+["api","obsidian","md"].join("."),Uc="https://publish.obsidian.md",Ge=class s extends Error{constructor(e){super(e.error),this.response=e,this.error=e.error,Object.setPrototypeOf(this,s.prototype)}},ws="";function Vr(s){ws=s}async function X(s,e,t){let{preflight:i,headers:n}=t||{};n||(n={}),ws&&(n["User-Agent"]=ws),i&&await Mt(Kr+s,{method:"OPTIONS",headers:n}),n["Content-Type"]="application/json";let r=await Mt(Kr+s,{method:"POST",body:JSON.stringify(e),headers:n});if(!r.ok)throw new Error("HTTP Error "+r.status);let o=await r.json();if("error"in o)throw new Ge(o);return o}async function Ss(s,e,t){return X("/user/signin",{email:s,password:e,mfa:t},{preflight:!0,headers:{Origin:"https://obsidian.md"}})}function vs(s){return X("/user/signout",{token:s})}function Wr(s){return X("/user/info",{token:s})}function Hr(s,e){return X("/vault/regions",{token:s,host:e})}function Es(s,e){return X("/vault/list",{token:s,supported_encryption_version:e})}function Gr(s,e,t,i,n,r){return X("/vault/create",{token:s,name:e,keyhash:t,salt:i,region:n,encryption_version:r})}function Yr(s,e,t,i,n){return X("/vault/access",{token:s,vault_uid:e,keyhash:t,host:i,encryption_version:n})}function Fs(s){return X("/publish/list",{token:s})}function Jr(s){return X("/publish/create",{token:s})}var Rt=class s extends Error{constructor(e,t){super(t),this.name="RequestError",this.code=e,Object.setPrototypeOf(this,s.prototype)}};async function Qr(s,e,t){let i=await(await Mt(s+e,{method:"POST",body:JSON.stringify(t),headers:{"Content-Type":"application/json"}})).json();if(i.code&&i.message)throw new Rt(i.code,i.message);return i}function Xr(s){return s.startsWith("127.0.0.1")||s.startsWith("localhost")?"http://"+s:"https://"+s}function zr(s,e){return Qr(Uc,s,e)}function Zr(s,e,t,i){return zr("/api/slug",{token:s,id:e,host:t,slug:i})}function As(s,e){return zr("/api/slugs",{token:s,ids:e})}function Ps(s,e,t){return Qr(Xr(s),e,t)}function eo(s,e,t){return Ps(e,"/api/list",{token:s,id:t,version:2})}function Ds(s,e,t,i){return Ps(e,"/api/options",{token:s,id:t,options:i})}function to(s,e,t,i){return Ps(e,"/api/remove",{token:s,id:t,path:i})}async function io(s,e,t,i,n,r){let o=Xr(e)+"/api/upload",a=await(await Mt(o,{method:"POST",headers:{"obs-token":s,"obs-id":t,"obs-path":encodeURIComponent(i),"obs-hash":n,"Content-Type":"application/octet-stream"},body:r})).json();if(a.code&&a.message)throw new Rt(a.code,a.message);return a}var so=["obsidian.css","publish.css","favicon.ico","publish.js"];var Kc=/\u00A0|\u202F/g;function Ts(s){return s.replace(Kc," ")}function V(s){let e=s.lastIndexOf("/");return e===-1?s:s.slice(e+1)}function me(s){let e=s.lastIndexOf("/");return e===-1?"":s.slice(0,e)}function Ls(s){for(;s;){if(V(s).startsWith("."))return!0;s=me(s)}return!1}function no(s){let e=V(s),t=e.lastIndexOf(".");return t===-1||t===e.length-1||t===0?e:e.substr(0,t)}function ro(s){let e=s.lastIndexOf(".");return e===-1||e===s.length-1||e===0?s:s.substr(0,e)}function $(s){let e=s.lastIndexOf(".");return e===-1||e===s.length-1||e===0?"":s.substr(e+1).toLowerCase()}function _e(s){return Ts(Ne(s)).normalize("NFC")}function Ne(s){return s=s.replace(/([\\/])+/g,"/").replace(/(^\/+|\/+$)/g,""),s===""&&(s="/"),s}var Bt=["bmp","png","jpg","jpeg","gif","svg","webp","avif"],$t=["mp3","wav","m4a","3gp","flac","ogg","oga","opus"],jt=["mp4","webm","ogv","mov","mkv"],Ut=["pdf"],oo=["md"],_s=["canvas"],ao=["base"];var rg=oo.concat(_s,ao),Vc=[].concat(Bt,$t,jt,Ut,oo,_s);function lo(s){return Vc.includes(s)}var og=[...Bt,...$t,...jt,...Ut,...ao,..._s];function ie(s){return s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength)}function Ns(s){return Buffer.from(s)}var co=crypto,j=co?.subtle,Cs="AES-GCM";function uo(s){return j.importKey("raw",s,Cs,!1,["encrypt","decrypt"])}async function Kt(s,e,t){t||(t=co.getRandomValues(new Uint8Array(12)));let i=await j.encrypt({name:Cs,iv:t},e,s),n=new ArrayBuffer(t.byteLength+i.byteLength),r=new Uint8Array(n);return r.set(new Uint8Array(t),0),r.set(new Uint8Array(i),t.byteLength),n}async function Vt(s,e){if(s.byteLength<12)throw new Error("Encrypted data is bad");if(s.byteLength===12)return new ArrayBuffer(0);let t=new Uint8Array(s,0,12),i=new Uint8Array(s,12);return await j.decrypt({name:Cs,iv:t},e,i)}function Ye(s){return s.buffer.slice(s.byteOffset,s.byteOffset+s.byteLength)}function U(s){return Ye(new TextEncoder().encode(s))}function ye(s){return new TextDecoder().decode(new Uint8Array(s))}function fo(s){let e=atob(s),t=e.length,i=new Uint8Array(t);for(let n=0;n<t;n++)i[n]=e.charCodeAt(n);return i.buffer}function ho(s){return Wc(new Uint8Array(s))}function Wc(s){let e=[],t=s.byteLength;for(let i=0;i<t;i++)e.push(String.fromCharCode(s[i]));return btoa(e.join(""))}function Os(s){let e=s.length/2,t=new ArrayBuffer(e),i=new Uint8Array(t);for(let n=0;n<e;n++)i[n]=parseInt(s.substr(n*2,2),16);return t}function W(s){let e=new Uint8Array(s),t=[];for(let i=0;i<e.length;i++){let n=e[i];t.push((n>>>4).toString(16)),t.push((n&15).toString(16))}return t.join("")}function Is(s){if(s<=0)return"0 B";let e=["B","KB","MB","GB","TB","PB"],t=e.length-1,i=1024;for(let r=0;r<e.length;r++)if(s<Math.pow(i,r+1)){t=r;break}let n=s/Math.pow(i,t);return`${Hc(n,t===0?0:2)} ${e[t]}`}function Hc(s,e=2,t=".",i=","){let n=s<0?"-":"";s=Math.abs(s);let r=parseInt(s.toFixed(e),10)+"",o=r.length>3?r.length%3:0;return n+(o?r.substr(0,o)+i:"")+r.substr(o).replace(/(\d{3})(?=\d)/g,"$1"+i)+(e?t+Math.abs(s-Math.floor(s)).toFixed(e).slice(2):"")}async function se(s){return W(await Je(s))}async function Je(s){return j.digest("SHA-256",new Uint8Array(s))}var sc=pe(ic()),Ui=class{constructor(e,t){this.cache={};this.token=e,this.config=t,this.loadCache()}async scanForChanges(e){let{config:t,token:i,cache:n}=this,r=[],o=await eo(i,t.host,t.siteId),a={};for(let c of o.files)a[c.path]=c;let l=this.walkLocalFiles();for(let c of l){let f=n[c.path],u,h;if(f&&f.mtime===c.mtime&&f.size===c.size)u=f.publish,h=f.hash;else{let S=T.default.join(t.vaultPath,c.path),d;try{d=D.default.readFileSync(S)}catch{continue}u=T.default.extname(c.path).toLowerCase()===".md"?this.parseFrontmatterPublishFlag(d.toString("utf-8")):null,h=await se(ie(d)),n[c.path]={mtime:c.mtime,size:c.size,hash:h,publish:u}}if(u===null&&(u=this.getFolderPublishFlag(c.path)),u===!1)continue;u===null&&e&&(u=!0);let y=a[c.path];y?(h!==y.hash&&r.push({path:c.path,type:"changed"}),delete a[c.path]):u===!0&&r.push({path:c.path,type:"new"})}for(let c in a)r.push({path:c,type:"deleted"});return this.saveCache(),r}async uploadFile(e){let{config:t,token:i}=this,n=T.default.join(t.vaultPath,e),r=D.default.readFileSync(n);if(r.byteLength>52428800)throw new Error(`File exceeds 50MB upload limit: ${e}`);let o=ie(r),a=await se(o);await io(i,t.host,t.siteId,e,a,o)}async removeFile(e){let{config:t,token:i}=this;await to(i,t.host,t.siteId,e)}async publish(e,t){let i=e.length,n=0;for(let r of e)r.type==="new"||r.type==="changed"?await this.uploadFile(r.path):r.type==="deleted"&&await this.removeFile(r.path),n++,t?.(n,i);this.saveCache()}walkLocalFiles(){let{config:e}=this,t=e.vaultPath,i=[],n=r=>{let o;try{o=D.default.readdirSync(T.default.join(t,r),{withFileTypes:!0})}catch{return}for(let a of o){let l=a.name;if(l.startsWith("."))continue;let c=r?r+"/"+l:l;if(a.isDirectory())n(c);else if(a.isFile()&&this.isFileSupported(l,c)){let f;try{f=D.default.statSync(T.default.join(t,c))}catch{continue}i.push({path:c,mtime:f.mtimeMs,size:f.size})}}};return n(""),i}isFileSupported(e,t){if(so.includes(e))return!0;let i=T.default.extname(t);return i.startsWith(".")&&(i=i.slice(1)),lo(i)}getFolderPublishFlag(e){let{config:t}=this;if(t.excludes){for(let i of t.excludes)if(e.startsWith(i+"/"))return!1}if(t.includes){for(let i of t.includes)if(e.startsWith(i+"/"))return!0}return null}parseFrontmatterPublishFlag(e){if(!e.startsWith("---"))return null;let t=e.indexOf(` ---`,3);if(t===-1)return null;let i=e.slice(4,t),n;try{n=(0,sc.parse)(i)}catch{return null}if(!n||typeof n!="object")return null;let r=n.publish;if(r==null)return null;if(typeof r=="string"){let o=r.t … [Строка слишком длинная. Вы можете скачать файл] `),n=0,r=/^@@ -(\d+),?(\d*) \+(\d+),?(\d*) @@$/;for(;n<i.length;){let o=i[n].match(r);if(!o)throw new Error("Invalid patch string: "+i[n]);let a=new Te;t.push(a),a.start1=parseInt(o[1],10),o[2]===""?(a.start1--,a.length1=1):o[2]==="0"?a.length1=0:(a.start1--,a.length1=parseInt(o[2],10)),a.start2=parseInt(o[3],10),o[4]===""?(a.start2--,a.length2=1):o[4]==="0"?a.length2=0:(a.start2--,a.length2=parseInt(o[4],10)),n++;let l,c,f;for(;n<i.length;){l=i[n].charAt(0),f=i[n].substring(1);try{c=decodeURI(f)}catch{throw new Error("Illegal escape in patch_fromText: "+f)}if(l==="-")a.diffs.push([-1,c]);else if(l==="+")a.diffs.push([1,c]);else if(l===" ")a.diffs.push([0,c]);else{if(l==="@")break;if(l!=="")throw new Error('Invalid patch mode "'+l+'" in: '+c)}n++}}return t}diff_compute_(e,t,i,n){let r;if(!e)return[[1,t]];if(!t)return[[-1,e]];let o=e.length>t.length?e:t,a=e.length>t.length?t:e,l=o.indexOf(a);if(l!==-1)return r=[[1,o.substring(0,l)],[0,a],[1,o.substring(l+a.length)]],e.length>t.length&&(r[0][0]=-1,r[2][0]=-1),r;if(a.length===1)return[[-1,e],[1,t]];let c=this.diff_halfMatch_(e,t);if(c){let f=c[0],u=c[1],h=c[2],y=c[3],S=c[4],d=this.diff_main(f,h,i,n),p=this.diff_main(u,y,i,n);return d.concat([[0,S]],p)}return i&&e.length>100&&t.length>100?this.diff_lineMode_(e,t,n):this.diff_bisect_(e,t,n)}diff_lineMode_(e,t,i){let n=this.diff_linesToChars_(e,t);e=n.chars1,t=n.chars2;let r=n.lineArray,o=this.diff_main(e,t,!1,i);this.diff_charsToLines_(o,r),this.diff_cleanupSemantic(o),o.push([0,""]);let a=0,l=0,c=0,f="",u="";for(;a<o.length;){switch(o[a][0]){case 1:c++,u+=o[a][1];break;case-1:l++,f+=o[a][1];break;case 0:if(l>=1&&c>=1){o.splice(a-l-c,l+c),a=a-l-c;let h=this.diff_main(f,u,!1,i);for(let y=h.length-1;y>=0;y--)o.splice(a,0,h[y]);a=a+h.length}c=0,l=0,f="",u="";break}a++}return o.pop(),o}diff_bisect_(e,t,i){let n=e.length,r=t.length,o=Math.ceil((n+r)/2),a=o,l=2*o,c=new Array(l),f=new Array(l);for(let m=0;m<l;m++)c[m]=-1,f[m]=-1;c[a+1]=0,f[a+1]=0;let u=n-r,h=u%2!==0,y=0,S=0,d=0,p=0;for(let m=0;m<o&&!(Date.now()>i);m++){for(let g=-m+y;g<=m-S;g+=2){let E=a+g,b;g===-m||g!==m&&c[E-1]<c[E+1]?b=c[E+1]:b=c[E-1]+1;let w=b-g;for(;b<n&&w<r&&e.charAt(b)===t.charAt(w);)b++,w++;if(c[E]=b,b>n)S+=2;else if(w>r)y+=2;else if(h){let v=a+u-g;if(v>=0&&v<l&&f[v]!==-1){let P=n-f[v];if(b>=P)return this.diff_bisectSplit_(e,t,b,w,i)}}}for(let g=-m+d;g<=m-p;g+=2){let E=a+g,b;g===-m||g!==m&&f[E-1]<f[E+1]?b=f[E+1]:b=f[E-1]+1;let w=b-g;for(;b<n&&w<r&&e.charAt(n-b-1)===t.charAt(r-w-1);)b++,w++;if(f[E]=b,b>n)p+=2;else if(w>r)d+=2;else if(!h){let v=a+u-g;if(v>=0&&v<l&&c[v]!==-1){let P=c[v],F=a+P-v;if(b=n-b,P>=b)return this.diff_bisectSplit_(e,t,P,F,i)}}}}return[[-1,e],[1,t]]}diff_bisectSplit_(e,t,i,n,r){let o=e.substring(0,i),a=t.substring(0,n),l=e.substring(i),c=t.substring(n),f=this.diff_main(o,a,!1,r),u=this.diff_main(l,c,!1,r);return f.concat(u)}diff_linesToChars_(e,t){let i=[],n={};i[0]="";let r=this.diff_linesToCharsMunge_(e,i,n,4e4),o=this.diff_linesToCharsMunge_(t,i,n,65535);return{chars1:r,chars2:o,lineArray:i}}diff_linesToCharsMunge_(e,t,i,n){let r="",o=0,a=-1,l=t.length;for(;a<e.length-1;){a=e.indexOf(` `,o),a===-1&&(a=e.length-1);let c=e.substring(o,a+1);(i.hasOwnProperty?i.hasOwnProperty(c):i[c]!==void 0)?r+=String.fromCharCode(i[c]):(l===n&&(c=e.substring(o),a=e.length),r+=String.fromCharCode(l),i[c]=l,t[l++]=c),o=a+1}return r}diff_charsToLines_(e,t){for(let i=0;i<e.length;i++){let n=e[i][1],r=[];for(let o=0;o<n.length;o++)r[o]=t[n.charCodeAt(o)];e[i][1]=r.join("")}}diff_commonOverlap_(e,t){let i=e.length,n=t.length;if(i===0||n===0)return 0;i>n?e=e.substring(i-n):i<n&&(t=t.substring(0,i));let r=Pe(i,n);if(e===t)return r;let o=0,a=1;for(;;){let l=e.substring(r-a),c=t.indexOf(l);if(c===-1)return o;a+=c,(c===0||e.substring(r-a)===t.substring(0,a))&&(o=a,a++)}}diff_halfMatch_(e,t){if(this.diffTimeout<=0)return null;let i=e.length>t.length?e:t,n=e.length>t.length?t:e;if(i.length<4||n.length*2<i.length)return null;let r=this.diff_halfMatchI_(i,n,Math.ceil(i.length/4)),o=this.diff_halfMatchI_(i,n,Math.ceil(i.length/2)),a;if(!r&&!o)return null;o?r?a=r[4].length>o[4].length?r:o:a=o:a=r;let l,c,f,u,h=a[4];return e.length>t.length?(l=a[0],c=a[1],f=a[2],u=a[3]):(f=a[0],u=a[1],l=a[2],c=a[3]),[l,c,f,u,h]}diff_halfMatchI_(e,t,i){let n=e.substring(i,i+Math.floor(e.length/4)),r="",o,a,l,c,f=t.indexOf(n,0);for(;f!==-1;){let u=this.diff_commonPrefix(e.substring(i),t.substring(f)),h=this.diff_commonSuffix(e.substring(0,i),t.substring(0,f));r.length<h+u&&(r=t.substring(f-h,f)+t.substring(f,f+u),o=e.substring(0,i-h),a=e.substring(i+u),l=t.substring(0,f-h),c=t.substring(f+u)),f=t.indexOf(n,f+1)}return r.length*2>=e.length?[o,a,l,c,r]:null}diff_cleanupSemanticScore_(e,t){if(!e||!t)return 6;let i=e.charAt(e.length-1),n=t.charAt(0),r=i.match(uc),o=n.match(uc),a=r&&i.match(fc),l=o&&n.match(fc),c=a&&i.match(hc),f=l&&n.match(hc),u=c&&e.match(Ad),h=f&&t.match(Pd);return u||h?5:c||f?4:r&&!a&&l?3:a||l?2:r||o?1:0}match_bitap_(e,t,i){if(t.length>this.matchMaxBits)throw new Error("Pattern too long for this browser");let n=this.match_alphabet_(t),r=this.matchThreshold,o=e.indexOf(t,i);o!==-1&&(r=Pe(this.match_bitapScore_(0,o,t,i),r),o=e.lastIndexOf(t,i+t.length),o!==-1&&(r=Pe(this.match_bitapScore_(0,o,t,i),r)));let a=1<<t.length-1;o=-1;let l,c,f=t.length+e.length,u;for(let h=0;h<t.length;h++){for(l=0,c=f;l<c;)this.match_bitapScore_(h,i+c,t,i)<=r?l=c:f=c,c=Math.floor((f-l)/2+l);f=c;let y=De(1,i-c+1),S=Pe(i+c,e.length)+t.length,d=Array(S+2);d[S+1]=(1<<h)-1;for(let p=S;p>=y;p--){let m=n[e.charAt(p-1)];if(h===0?d[p]=(d[p+1]<<1|1)&m:d[p]=(d[p+1]<<1|1)&m|((u[p+1]|u[p])<<1|1)|u[p+1],d[p]&a){let g=this.match_bitapScore_(h,p-1,t,i);if(g<=r)if(r=g,o=p-1,o>i)y=De(1,2*i-o);else break}}if(this.match_bitapScore_(h+1,i,t,i)>r)break;u=d}return o}match_bitapScore_(e,t,i,n){let r=e/i.length,o=Math.abs(n-t);return this.matchDistance?r+o/this.matchDistance:o?1:r}match_alphabet_(e){let t={};for(let i=0;i<e.length;i++)t[e.charAt(i)]=0;for(let i=0;i<e.length;i++)t[e.charAt(i)]|=1<<e.length-i-1;return t}patch_addContext_(e,t){if(t.length===0)return;if(e.start2==null)throw Error("patch not initialized");let i=t.substring(e.start2,e.start2+e.length1),n=0;for(;t.indexOf(i)!==t.lastIndexOf(i)&&i.length<this.matchMaxBits-this.patchMargin-this.patchMargin;)n+=this.patchMargin,i=t.substring(e.start2-n,e.start2+e.length1+n);n+=this.patchMargin;let r=t.substring(e.start2-n,e.start2);r&&e.diffs.unshift([0,r]);let o=t.substring(e.start2+e.length1,e.start2+e.length1+n);o&&e.diffs.push([0,o]),e.start1-=r.length,e.start2-=r.length,e.length1+=r.length+o.length,e.length2+=r.length+o.length}},Te=class{constructor(){this.diffs=[];this.start1=0;this.start2=0;this.length1=0;this.length2=0}toString(){let e,t;this.length1===0?e=this.start1+",0":this.length1===1?e=this.start1+1:e=this.start1+1+","+this.length1,this.length2===0?t=this.start2+",0":this.length2===1?t=this.start2+1:t=this.start2+1+","+this.length2;let i=["@@ -"+e+" +"+t+` @@ `],n;for(let r=0;r<this.diffs.length;r++){switch(this.diffs[r][0]){case 1:n="+";break;case-1:n="-";break;case 0:n=" ";break}i[r+1]=n+encodeURI(this.diffs[r][1])+` `}return i.join("").replace(/%20/g," ")}};function pc(s,e,t){let i=new Hi,n=i.diff_main(s,e,!0,0);n.length>2&&(i.diff_cleanupSemantic(n),i.diff_cleanupEfficiency(n));let r=i.patch_make(s,n);return i.p … [Строка слишком длинная. Вы можете скачать файл] Vaults:`);let t=i=>console.log(` ${i.id} "${i.name}" (${i.region})`);for(let i of e.vaults)t(i);if(e.shared.length>0){console.log(` Shared vaults:`);for(let i of e.shared)t(i)}}catch(s){console.error("Failed to list vaults:",s),process.exit(1)}});x.command("sync-list-local").description("List locally configured vaults").action(()=>{try{let s=ps();if(s.length===0){console.log("No vaults configured.");return}console.log("Configured vaults:");for(let e of s){let t=fs(e);t&&(console.log(` ${e}`),console.log(` Path: ${t.vaultPath}`),console.log(` Host: ${t.host}`))}}catch(s){console.error("Failed to list vaults:",s),process.exit(1)}});x.command("sync-create-remote").description("Create a new remote vault").requiredOption("--name <name>","Vault name").option("--encryption <standard|e2ee>","Encryption").option("--password <encryption-password>","End-to-end encryption password (prompt if omitted)").option("--region <region>","Vault region (leave empty for automatic)").action(async s=>{try{let e=ee(),t=s.name,i=s.password;!i&&s.encryption!=="standard"&&(i=await Ue("End-to-end encryption password (leave empty for standard encryption): "));let n=s.region||"";if(n){let c=(await Hr(e)).regions;if(!c.some(f=>f.value===n)){console.error(`Invalid region: "${n}". Available regions:`);for(let f of c)console.error(` ${f.value} (${f.name})`);process.exit(1)}}console.log("Creating vault...");let r,o=null;if(i){r=W(crypto.getRandomValues(new Uint8Array(16)));let l=await Ar(i,r);o=await Pr(l,r,Er)}let a=await Gr(e,t,o,r,n,Er);console.log(` Vault created successfully!`),console.log(` Vault ID: ${a.id}`),console.log(` Vault name: ${a.name}`),console.log(` Region: ${a.region}`),console.log(` Encryption: ${i?"end-to-end":"managed"}`),console.log(` Run '${Y} sync-setup --vault "${a.id}"' to configure sync.`)}catch(e){console.error("Failed to create vault:",e),process.exit(1)}});x.command("sync-setup").description("Setup sync from a local path to a remote vault").requiredOption("--vault <vault>","Remote vault ID or name").option("--path <local-path>","Local vault path (use current directory if omitted)").option("--password <encryption-password>","End-to-end encryption password (prompted if omitted)").option("--device-name <name>","Device name to identify this client in the sync version history").option("--config-dir <name>","Config directory name (default: .obsidian)").action(async s=>{try{let e=ee(),t=s.vault,i=T.default.resolve(s.path||"."),n=s.password,r=s.deviceName||"",o=ds(s.configDir);console.log("Fetching vault info...");let a=await Es(e,Fr),l=[...a.vaults,...a.shared],c=l.find(S=>S.id===t);if(!c){let S=l.filter(d=>d.name===t);if(S.length===1)c=S[0];else if(S.length>1){console.error(`Multiple vaults named "${t}". Use the vault ID instead:`);for(let d of S)console.error(` ${d.id} "${d.name}"`);process.exit(1)}}c||(console.error(`Vault "${t}" not found.`),process.exit(3));let f=c.id;c.password?n=c.password:n||(n=await Ue("End-to-end encryption password: ")),n||(console.error("Password not provided."),process.exit(2)),console.log("Setting up...");let u=await Ar(n,c.salt),h=await Pr(u,c.salt,c.encryption_version);try{await Yr(e,f,h,c.host,c.encryption_version)}catch(S){console.error("Failed to validate password.",S),process.exit(2)}let y={vaultId:f,vaultName:c.name,vaultPath:i,host:c.host,encryptionVersion:c.encryption_version,encryptionKey:ho(u),encryptionSalt:c.salt,conflictStrategy:"merge",deviceName:r,configDir:o};us(f),hs(f,y),console.log(` Vault configured successfully!`),ss(y),D.default.existsSync(i)?D.default.readdirSync(i).filter(p=>!p.startsWith(".")).length>0&&(console.log(` Warning: Your local vault already contains some notes.`),console.log("If you start syncing, notes in your local vault will be merged with notes from your remote vault."),console.log("In case of conflicts, the most recent version of the note will be preserved.")):D.default.mkdirSync(i,{recursive:!0}),Oc(),console.log(` Run '${Y} sync' to start syncing.`)}catch(e){console.error("Setup failed:",e),process.exit(1)}});x.command("sync-config").description("Change sync configuration for a vault").option("--path <local-path>","Local vault path (use current directory if omitted)").option("--conflict-strategy <strategy>","Conflict resolution strategy (merge or conflict)").option("--excluded-folders <folders>","Folders to exclude, comma-separated (empty string to clear)").option("--file-types <types>","Attachment types to sync, comma-separated: image, audio, video, pdf, unsupported (empty to clear)").option("--configs <settings>","Config categories to sync, comma-separated: app, appearance, appearance-data, hotkey, core-plugin, core-plugin-data, community-plugin, community-plugin-data (empty to clear)").option("--device-name <name>","Device name to identify this client in the sync version history").option("--mode <mode>","Sync mode: bidirectional (default), pull-only (only download, ignore local changes), or mirror-remote (only download, revert local changes)").option("--config-dir <name>","Config directory name (default: .obsidian)").action(s=>{try{let e=T.default.resolve(s.path||"."),t=We(e);t||(console.error(`No sync configuration found for ${e}`),console.error(`Run '${Y} sync-setup' first.`),process.exit(3));let i=!1;s.mode!==void 0&&(s.mode!=="bidirectional"&&s.mode!=="pull-only"&&s.mode!=="mirror-remote"&&(console.error(`Invalid sync mode: "${s.mode}". Must be "bidirectional", "pull-only", or "mirror-remote".`),process.exit(1)),s.mode==="bidirectional"?delete t.syncMode:t.syncMode=s.mode,i=!0),s.conflictStrategy!==void 0&&(s.conflictStrategy!=="merge"&&s.conflictStrategy!=="conflict"&&(console.error(`Invalid conflict strategy: "${s.conflictStrategy}". Must be "merge" or "conflict".`),process.exit(1)),t.conflictStrategy=s.conflictStrategy,i=!0),s.excludedFolders!==void 0&&(s.excludedFolders===""?delete t.ignoreFolders:t.ignoreFolders=s.excludedFolders.split(",").map(n=>n.trim()),i=!0),s.fileTypes!==void 0&&(s.fileTypes===""?delete t.allowTypes:t.allowTypes=Rr(s.fileTypes),i=!0),s.configs!==void 0&&(s.configs===""?delete t.allowSpecialFiles:t.allowSpecialFiles=Br(s.configs),i=!0),s.deviceName!==void 0&&(t.deviceName=s.deviceName,i=!0),s.configDir!==void 0&&(t.configDir=ds(s.configDir),i=!0),i?(hs(t.vaultId,t),console.log("Configuration updated:")):console.log("No options provided. Current configuration:"),ss(t)}catch(e){console.error("Config update failed:",e),process.exit(1)}});x.command("sync-status").description("Show sync status for a vault").option("--path <local-path>","Local vault path (use current directory if omitted)").action(async s=>{try{let e=T.default.resolve(s.path||"."),t=We(e);t||(console.error(`No sync configuration found for ${e}`),process.exit(3)),Ke()||console.log("Not logged in."),t.encryptionKey||console.log("End-to-end encryption key missing. Run setup again."),console.log("Sync Configuration:"),ss(t)}catch(e){console.error("Status check failed:",e),process.exit(1)}});x.command("sync-unlink").description("Disconnect a vault from sync and remove stored credentials").option("--path <local-path>","Local vault path (use current directory if omitted)").action(async s=>{try{let e=T.default.resolve(s.path||"."),t=We(e);t||(console.error(`No sync configuration found for ${e}`),process.exit(3)),Mr(t.vaultId),console.log(`Sync configuration removed for ${e}`)}catch(e){console.error("Unlink failed:",e),process.exit(1)}});x.command("sync").description("Sync a vault").option("--path <local-path>","Local vault path (use current directory if omitted)").option("--continuous","Run in continuous sync mode").action(async s=>{try{let e=T.default.resolve(s.path||"."),t=We(e);t||(console.error(`No sync configuration found for ${e}`),console.error(`Run '${Y} sync-setup' first.`),process.exit(3));let i=ee();(!t.encryptionKey||!t.encryptionSalt||t.encryptionVersion==null)&&(console.error("Encryption key not found. Run setup again."),process.exit(2));let n=await Lc(t.encryptionVersion,fo(t.encryptionKey),t.encryptionSalt),r=Ur(kr(t.vaultId));t.deviceName||(t.deviceName=bs()),(!t.configDir||!t.configDir.startsWith("."))&&(t.configDir=".obsidian"),Oc();let o=new ts(D.default,T.default,qr(t.vaultPath,t.configDir));try{o.acquire()}catch{console.error("Another sync instance is already running for this vault."),r(),process.exit(1)}let a;try{a=new zi({config:t,token:i,encryption:n,continuous:s.continuous});let l=()=>{console.log(` Received signal to shut down...`),a.stop()};process.on("SIGINT",l),process.on("SIGTERM",l),console.log("Starting sync:"),ss(t),await a.sync()}finally{o.release(),r(),a?.stop()}process.exit(0)}catch(e){console.error("Sync failed:",e),process.exit(1)}});function ss(s){console.log(` Vault: ${s.vaultName} (${s.vaultId})`),console.log(` Location: ${s.vaultPath}`),console.log(` Sync mode: ${s.syncMode||"bidirectional"}`),console.log(` Conflict strategy: ${s.conflictStrategy}`),console.log(` Device name: ${s.deviceName||bs()}`),s.configDir&&console.log(` Config directory: ${s.configDir}`);let{allowTypes:e,allowSpecialFiles:t,ignoreFolders:i}=s;console.log(` File types: ${(e||Le).join(", ")}`),console.log(` Configs: ${t?.length?(t||[]).join(", "):"none (config syncing disabled)"}`),i&&i.length>0&&console.log(` Excluded folders: ${i.join(", ")}`)}x.command("publish-list-sites").description("List publish sites").action(async()=>{try{let s=ee();console.log("Fetching sites...");let e=await Fs(s);if(e.sites.length===0&&e.shared.length===0){console.log("No publish sites found.");return}let t=[...e.sites,...e.shared],i={};try{i=await As(s,t.map(r=>r.id))}catch{}console.log(` Sites:`);let n=r=>{let o=i[r.id]||"";console.log(` ${r.id} ${o?'"'+o+'"':"(no slug)"}`)};for(let r of e.sites)n(r);if(e.shared.length>0){console.log("Shared sites:");for(let r of e.shared)n(r)}}catch(s){console.error("Failed to list sites:",s),process.exit(1)}});x.command("publish-create-site").description("Create a new Publish site").requiredOption("--slug <slug>","Site slug (URL identifier)").action(async s=>{try{let e=ee();console.log("Creating site...");let t=await Jr(e);await Zr(e,t.id,t.host,s.slug),console.log(` Site created successfully!`),console.log(` Site ID: ${t.id}`),console.log(` Slug: ${s.slug}`),console.log(` Host: ${t.host}`),console.log(` Run '${Y} publish-setup --site "${t.id}"' to connect a vault.`)}catch(e){console.error("Failed to create site:",e),process.exit(1)}});x.command("publish-setup").description("Connect a local vault to a Publish site").requiredOption("--site <id-or-slug>","Site ID or slug").option("--path <local-path>","Local vault path (use current directory if omitted)").action(async s=>{try{let e=ee(),t=T.default.resolve(s.path||"."),i=s.site;console.log("Fetching sites...");let n=await Fs(e),r=[...n.sites,...n.shared],o=r.find(l=>l.id===i);if(!o){let l={};try{l=await As(e,r.map(f=>f.id))}catch{}let c=Object.entries(l).find(([,f])=>f===i)?.[0];c&&(o=r.find(f=>f.id===c))}o||(console.error(`Site "${i}" not found.`),process.exit(1));let a={siteId:o.id,host:o.host,vaultPath:t};ys(o.id,a),console.log(` Site connected successfully!`),Cc(a),D.default.existsSync(t)||D.default.mkdirSync(t,{recursive:!0}),console.log(` Run '${Y} publish --dry-run' to preview changes.`)}catch(e){console.error("Setup failed:",e),process.exit(1)}});x.command("publish").description("Publish vault changes to site").option("--path <local-path>","Local vault path (use current directory if omitted)").option("--dry-run","Show changes without publishing").option("--yes","Publish without prompting for confirmation").option("--all","Include files without a publish flag").action(async s=>{try{let e=T.default.resolve(s.path||"."),t=He(e);t||(console.error(`No publish configuration found for ${e}`),console.error(`Run '${Y} publish-setup' first.`),process.exit(1));let i=ee(),n=new Ui(i,t);console.log("Scanning for changes...");let r=await n.scanForChanges(s.all);r.length===0&&(console.log("No changes to publish."),process.exit(0));let o=r.filter(u=>u.type==="new"),a=r.filter(u=>u.type==="changed"),l=r.filter(u=>u.type==="deleted");if(o.length>0){console.log(` New (${o.length}):`);for(let u of o)console.log(` + ${u.path}`)}if(a.length>0){console.log(` Changed (${a.length}):`);for(let u of a)console.log(` ~ ${u.path}`)}if(l.length>0){console.log(` Deleted (${l.length}):`);for(let u of l)console.log(` - ${u.path}`)}console.log(` Total: ${r.length} changes`),s.dryRun&&process.exit(0),s.yes||(await Ue("Publish these changes? (y/N) ",!0)).toLowerCase()!=="y"&&(console.log("Cancelled."),process.exit(1)),console.log(` Publishing...`);let c=r.length,f=0;for(let u of r)u.type==="new"||u.type==="changed"?(console.log(`Uploading (${f}/${c}) ${u.path}`),await n.uploadFile(u.path)):u.type==="deleted"&&(console.log(`Deleting (${f}/${c}) ${u.path}`),await n.removeFile(u.path)),f++;console.log(` Done.`),process.exit(0)}catch(e){console.error("Publish failed:",e),process.exit(1)}});x.command("publish-config").description("Configure publish settings for a vault").option("--path <local-path>","Local vault path (use current directory if omitted)").option("--includes <folders>","Folders to include, comma-separated (empty string to clear)").option("--excludes <folders>","Folders to exclude, comma-separated (empty string to clear)").action(s=>{try{let e=T.default.resolve(s.path||"."),t=He(e);t||(console.error(`No publish configuration found for ${e}`),console.error(`Run '${Y} publish-setup' first.`),process.exit(1));let i=!1;s.includes!==void 0&&(s.includes===""?delete t.includes:t.includes=s.includes.split(",").map(n=>n.trim()),i=!0),s.excludes!==void 0&&(s.excludes===""?delete t.excludes:t.excludes=s.excludes.split(",").map(n=>n.trim()),i=!0),i?(ys(t.siteId,t),console.log("Configuration updated:")):console.log("No options provided. Current configuration:"),Cc(t)}catch(e){console.error("Config update failed:",e),process.exit(1)}});x.command("publish-site-options").description("View or update publish site options").option("--path <local-path>","Local vault path (use current directory if omitted)").option("--site-name <name>","Site name").option("--index-file <path>","Home page file path").option("--logo <path>","Logo file path (empty string to clear)").option("--show-navigation <bool>","Show navigation sidebar").option("--show-graph <bool>","Show graph view").option("--show-outline <bool>","Show table of contents").option("--show-search <bool>","Show search").option("--show-backlinks <bool>","Show backlinks").option("--show-hover-preview <bool>","Show hover preview").option("--show-theme-toggle <bool>","Show theme toggle").option("--default-theme <theme>","Default theme: light or dark").option("--readable-line-length <bool>","Readable line length").option("--strict-line-breaks <bool>","Strict line breaks").option("--hide-title <bool>","Hide inline title").option("--sliding-window <bool>","Sliding window mode").option("--nav-order <paths>","Navigation ordering, comma-separated paths in display order (empty string to clear)").option("--nav-hidden <paths>","Navigation hidden items, comma-separated paths (empty string to clear)").action(async s=>{try{let e=T.default.resolve(s.path||"."),t=He(e);t||(console.error(`No publish configuration found for ${e}`),console.error(`Run '${Y} publish-setup' first.`),process.exit(1));let i=ee(),n=l=>{let c=l.toLowerCase();if(c==="true"||c==="1"||c==="yes")return!0;if(c==="false"||c==="0"||c==="no")return!1;throw new Error(`Invalid boolean value: "${l}". Use true/false.`)},r={showNavigation:"showNavigation",showGraph:"showGraph",showOutline:"showOutline",showSearch:"showSearch",showBacklinks:"showBacklinks",showHoverPreview:"showHoverPreview",showThemeToggle:"showThemeToggle",readableLineLength:"readableLineLength",strictLineBreaks:"strictLineBreaks",hideTitle:"hideTitle",slidingWindow:"slidingWindowMode"},o={};for(let[l,c]of Object.entries(r))s[l]!==void 0&&(o[c]=n(s[l]));s.siteName!==void 0&&(o.siteName=s.siteName),s.indexFile!==void 0&&(o.indexFile=s.indexFile),s.logo!==void 0&&(o.logo=s.logo),s.defaultTheme!==void 0&&(s.defaultTheme!=="light"&&s.defaultTheme!=="dark"&&(console.error('Invalid theme. Use "light" or "dark".'),process.exit(1)),o.defaultTheme=s.defaultTheme),s.navOrder!==void 0&&(o.navigationOrdering=s.navOrder===""?null:s.navOrder.split(",").map(l=>l.trim())),s.navHidden!==void 0&&(o.navigationHiddenItems=s.navHidden===""?null:s.navHidden.split(",").map(l=>l.trim()));let a;Object.keys(o).length>0?(a=await Ds(i,t.host,t.siteId,o),console.log("Site options updated.")):a=await Ds(i,t.host,t.siteId),console.log(` Current site options:`);for(let[l,c]of Object.entries(a))console.log(` ${l}: ${JSON.stringify(c)}`)}catch(e){console.error("Site options failed:",e),process.exit(1)}});x.command("publish-unlink").description("Disconnect a vault from a publish site").option("--path <local-path>","Local vault path (use current directory if omitted)").action(s=>{try{let e=T.default.resolve(s.path||"."),t=He(e);t||(console.error(`No publish configuration found for ${e}`),process.exit(1)),jr(t.siteId),console.log(`Publish configuration removed for ${e}`)}catch(e){console.error("Unlink failed:",e),process.exit(1)}});function Cc(s){console.log(` Site: ${s.siteId}`),console.log(` Host: ${s.host}`),console.log(` Location: ${s.vaultPath}`),s.includes?.length&&console.log(` Includes: ${s.includes.join(", ")}`),s.excludes?.length&&console.log(` Excludes: ${s.excludes.join(", ")}`)}function Ue(s,e){return new Promise(t=>{if(process.stdin.isTTY){process.stdout.write(s),process.stdin.setRawMode(!0),process.stdin.resume();let i="",n=()=>{process.stdout.clearLine(0),process.stdout.cursorTo(0),process.stdout.write(s+(e?i:"*".repeat(i.length)))},r=o=>{let a=o.toString();a===` `||a==="\r"?(process.stdin.setRawMode(!1),process.stdin.pause(),process.stdin.removeListener("data",r),process.stdout.write(` `),t(i)):a===""?(process.stdin.setRawMode(!1),process.exit(1)):a==="\x7F"||a==="\b"?(i=i.slice(0,-1),n()):(i+=a,process.stdout.write(e?a:"*".repeat(a.length)))};process.stdin.on("data",r)}else{let i="";process.stdin.setEncoding("utf-8"),process.stdin.on("data",n=>{i+=n}),process.stdin.on("end",()=>{t(i.trimEnd())}),process.stdin.resume()}})}function Oc(){(process.platform==="win32"||process.platform==="darwin")&&!Lr()&&console.warn("Warning: btime native module failed to load. File creation times will not be preserved.")}function ee(){let s=Ke();return s||(console.error(`No account logged in. Run "${Y} login" first.`),process.exit(2)),s}x.parse();