@uniweb/runtime 0.8.11 → 0.8.14
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app/_importmap/@uniweb-core.js +1 -1
- package/dist/app/_importmap/react-dom-server.js +54 -0
- package/dist/app/_importmap/react-dom-server.js.map +1 -0
- package/dist/app/assets/index-B-mKk2Z1.js +133 -0
- package/dist/app/assets/index-B-mKk2Z1.js.map +1 -0
- package/dist/app/assets/{index-sDacLXBC.js → index-BnewW1wW.js} +7 -7
- package/dist/app/assets/index-BnewW1wW.js.map +1 -0
- package/dist/app/index.html +3 -2
- package/dist/app/manifest.json +4 -3
- package/dist/worker-runtime.js +28157 -0
- package/package.json +4 -4
- package/src/foundation-loader.js +37 -4
- package/src/hooks/useLinkInterceptor.js +3 -0
- package/dist/app/assets/index-4Jlbab_T.js +0 -133
- package/dist/app/assets/index-4Jlbab_T.js.map +0 -1
- package/dist/app/assets/index-sDacLXBC.js.map +0 -1
|
@@ -1,133 +0,0 @@
|
|
|
1
|
-
const Pt=Symbol.for("yaml.alias"),_t=Symbol.for("yaml.document"),W=Symbol.for("yaml.map"),$s=Symbol.for("yaml.pair"),D=Symbol.for("yaml.scalar"),he=Symbol.for("yaml.seq"),x=Symbol.for("yaml.node.type"),X=n=>!!n&&typeof n=="object"&&n[x]===Pt,Xe=n=>!!n&&typeof n=="object"&&n[x]===_t,Ne=n=>!!n&&typeof n=="object"&&n[x]===W,$=n=>!!n&&typeof n=="object"&&n[x]===$s,L=n=>!!n&&typeof n=="object"&&n[x]===D,$e=n=>!!n&&typeof n=="object"&&n[x]===he;function O(n){if(n&&typeof n=="object")switch(n[x]){case W:case he:return!0}return!1}function N(n){if(n&&typeof n=="object")switch(n[x]){case Pt:case W:case D:case he:return!0}return!1}const Cs=n=>(L(n)||O(n))&&!!n.anchor,z=Symbol("break visit"),bn=Symbol("skip children"),ke=Symbol("remove node");function de(n,e){const t=wn(e);Xe(n)?re(null,n.contents,t,Object.freeze([n]))===ke&&(n.contents=null):re(null,n,t,Object.freeze([]))}de.BREAK=z;de.SKIP=bn;de.REMOVE=ke;function re(n,e,t,s){const i=kn(n,e,t,s);if(N(i)||$(i))return Sn(n,s,i),re(n,i,t,s);if(typeof i!="symbol"){if(O(e)){s=Object.freeze(s.concat(e));for(let r=0;r<e.items.length;++r){const o=re(r,e.items[r],t,s);if(typeof o=="number")r=o-1;else{if(o===z)return z;o===ke&&(e.items.splice(r,1),r-=1)}}}else if($(e)){s=Object.freeze(s.concat(e));const r=re("key",e.key,t,s);if(r===z)return z;r===ke&&(e.key=null);const o=re("value",e.value,t,s);if(o===z)return z;o===ke&&(e.value=null)}}return i}function wn(n){return typeof n=="object"&&(n.Collection||n.Node||n.Value)?Object.assign({Alias:n.Node,Map:n.Node,Scalar:n.Node,Seq:n.Node},n.Value&&{Map:n.Value,Scalar:n.Value,Seq:n.Value},n.Collection&&{Map:n.Collection,Seq:n.Collection},n):n}function kn(n,e,t,s){if(typeof t=="function")return t(n,e,s);if(Ne(e))return t.Map?.(n,e,s);if($e(e))return t.Seq?.(n,e,s);if($(e))return t.Pair?.(n,e,s);if(L(e))return t.Scalar?.(n,e,s);if(X(e))return t.Alias?.(n,e,s)}function Sn(n,e,t){const s=e[e.length-1];if(O(s))s.items[n]=t;else if($(s))n==="key"?s.key=t:s.value=t;else if(Xe(s))s.contents=t;else{const i=X(s)?"alias":"scalar";throw new Error(`Cannot replace node with ${i} parent`)}}const vn={"!":"%21",",":"%2C","[":"%5B","]":"%5D","{":"%7B","}":"%7D"},An=n=>n.replace(/[!,[\]{}]/g,e=>vn[e]);class E{constructor(e,t){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},E.defaultYaml,e),this.tags=Object.assign({},E.defaultTags,t)}clone(){const e=new E(this.yaml,this.tags);return e.docStart=this.docStart,e}atDocument(){const e=new E(this.yaml,this.tags);switch(this.yaml.version){case"1.1":this.atNextDocument=!0;break;case"1.2":this.atNextDocument=!1,this.yaml={explicit:E.defaultYaml.explicit,version:"1.2"},this.tags=Object.assign({},E.defaultTags);break}return e}add(e,t){this.atNextDocument&&(this.yaml={explicit:E.defaultYaml.explicit,version:"1.1"},this.tags=Object.assign({},E.defaultTags),this.atNextDocument=!1);const s=e.trim().split(/[ \t]+/),i=s.shift();switch(i){case"%TAG":{if(s.length!==2&&(t(0,"%TAG directive should contain exactly two parts"),s.length<2))return!1;const[r,o]=s;return this.tags[r]=o,!0}case"%YAML":{if(this.yaml.explicit=!0,s.length!==1)return t(0,"%YAML directive should contain exactly one part"),!1;const[r]=s;if(r==="1.1"||r==="1.2")return this.yaml.version=r,!0;{const o=/^\d+\.\d+$/.test(r);return t(6,`Unsupported YAML version ${r}`,o),!1}}default:return t(0,`Unknown directive ${i}`,!0),!1}}tagName(e,t){if(e==="!")return"!";if(e[0]!=="!")return t(`Not a valid tag: ${e}`),null;if(e[1]==="<"){const 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)}const[,s,i]=e.match(/^(.*!)([^!]*)$/s);i||t(`The ${e} tag has no suffix`);const r=this.tags[s];if(r)try{return r+decodeURIComponent(i)}catch(o){return t(String(o)),null}return s==="!"?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(const[t,s]of Object.entries(this.tags))if(e.startsWith(s))return t+An(e.substring(s.length));return e[0]==="!"?e:`!<${e}>`}toString(e){const t=this.yaml.explicit?[`%YAML ${this.yaml.version||"1.2"}`]:[],s=Object.entries(this.tags);let i;if(e&&s.length>0&&N(e.contents)){const r={};de(e.contents,(o,a)=>{N(a)&&a.tag&&(r[a.tag]=!0)}),i=Object.keys(r)}else i=[];for(const[r,o]of s)r==="!!"&&o==="tag:yaml.org,2002:"||(!e||i.some(a=>a.startsWith(o)))&&t.push(`%TAG ${r} ${o}`);return t.join(`
|
|
2
|
-
`)}}E.defaultYaml={explicit:!1,version:"1.2"};E.defaultTags={"!!":"tag:yaml.org,2002:"};function Ts(n){if(/[\x00-\x19\s,[\]{}]/.test(n)){const t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(n)}`;throw new Error(t)}return!0}function Es(n){const e=new Set;return de(n,{Value(t,s){s.anchor&&e.add(s.anchor)}}),e}function Ms(n,e){for(let t=1;;++t){const s=`${n}${t}`;if(!e.has(s))return s}}function In(n,e){const t=[],s=new Map;let i=null;return{onAnchor:r=>{t.push(r),i??(i=Es(n));const o=Ms(e,i);return i.add(o),o},setAnchors:()=>{for(const r of t){const o=s.get(r);if(typeof o=="object"&&o.anchor&&(L(o.node)||O(o.node)))o.node.anchor=o.anchor;else{const a=new Error("Failed to resolve repeated object (this should not happen)");throw a.source=r,a}}},sourceObjects:s}}function oe(n,e,t,s){if(s&&typeof s=="object")if(Array.isArray(s))for(let i=0,r=s.length;i<r;++i){const o=s[i],a=oe(n,s,String(i),o);a===void 0?delete s[i]:a!==o&&(s[i]=a)}else if(s instanceof Map)for(const i of Array.from(s.keys())){const r=s.get(i),o=oe(n,s,i,r);o===void 0?s.delete(i):o!==r&&s.set(i,o)}else if(s instanceof Set)for(const i of Array.from(s)){const r=oe(n,s,i,i);r===void 0?s.delete(i):r!==i&&(s.delete(i),s.add(r))}else for(const[i,r]of Object.entries(s)){const o=oe(n,s,i,r);o===void 0?delete s[i]:o!==r&&(s[i]=o)}return n.call(e,t,s)}function j(n,e,t){if(Array.isArray(n))return n.map((s,i)=>j(s,String(i),t));if(n&&typeof n.toJSON=="function"){if(!t||!Cs(n))return n.toJSON(e,t);const s={aliasCount:0,count:1,res:void 0};t.anchors.set(n,s),t.onCreate=r=>{s.res=r,delete t.onCreate};const i=n.toJSON(e,t);return t.onCreate&&t.onCreate(i),i}return typeof n=="bigint"&&!t?.keep?Number(n):n}class jt{constructor(e){Object.defineProperty(this,x,{value:e})}clone(){const e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:s,onAnchor:i,reviver:r}={}){if(!Xe(e))throw new TypeError("A document argument is required");const o={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof s=="number"?s:100},a=j(this,"",o);if(typeof i=="function")for(const{count:l,res:c}of o.anchors.values())i(c,l);return typeof r=="function"?oe(r,{"":a},"",a):a}}class xt extends jt{constructor(e){super(Pt),this.source=e,Object.defineProperty(this,"tag",{set(){throw new Error("Alias nodes cannot have tags")}})}resolve(e,t){let s;t?.aliasResolveCache?s=t.aliasResolveCache:(s=[],de(e,{Node:(r,o)=>{(X(o)||Cs(o))&&s.push(o)}}),t&&(t.aliasResolveCache=s));let i;for(const r of s){if(r===this)break;r.anchor===this.source&&(i=r)}return i}toJSON(e,t){if(!t)return{source:this.source};const{anchors:s,doc:i,maxAliasCount:r}=t,o=this.resolve(i,t);if(!o){const l=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new ReferenceError(l)}let a=s.get(o);if(a||(j(o,null,t),a=s.get(o)),a?.res===void 0){const 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=Ue(i,o,s)),a.count*a.aliasCount>r)){const l="Excessive alias count indicates a resource exhaustion attack";throw new ReferenceError(l)}return a.res}toString(e,t,s){const i=`*${this.source}`;if(e){if(Ts(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){const r=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw new Error(r)}if(e.implicitKey)return`${i} `}return i}}function Ue(n,e,t){if(X(e)){const s=e.resolve(n),i=t&&s&&t.get(s);return i?i.count*i.aliasCount:0}else if(O(e)){let s=0;for(const i of e.items){const r=Ue(n,i,t);r>s&&(s=r)}return s}else if($(e)){const s=Ue(n,e.key,t),i=Ue(n,e.value,t);return Math.max(s,i)}return 1}const Bs=n=>!n||typeof n!="function"&&typeof n!="object";class I extends jt{constructor(e){super(D),this.value=e}toJSON(e,t){return t?.keep?this.value:j(this.value,e,t)}toString(){return String(this.value)}}I.BLOCK_FOLDED="BLOCK_FOLDED";I.BLOCK_LITERAL="BLOCK_LITERAL";I.PLAIN="PLAIN";I.QUOTE_DOUBLE="QUOTE_DOUBLE";I.QUOTE_SINGLE="QUOTE_SINGLE";const _n="tag:yaml.org,2002:";function Ln(n,e,t){if(e){const s=t.filter(r=>r.tag===e),i=s.find(r=>!r.format)??s[0];if(!i)throw new Error(`Tag ${e} not found`);return i}return t.find(s=>s.identify?.(n)&&!s.format)}function Ie(n,e,t){if(Xe(n)&&(n=n.contents),N(n))return n;if($(n)){const u=t.schema[W].createNode?.(t.schema,null,t);return u.items.push(n),u}(n instanceof String||n instanceof Number||n instanceof Boolean||typeof BigInt<"u"&&n instanceof BigInt)&&(n=n.valueOf());const{aliasDuplicateObjects:s,onAnchor:i,onTagObj:r,schema:o,sourceObjects:a}=t;let l;if(s&&n&&typeof n=="object"){if(l=a.get(n),l)return l.anchor??(l.anchor=i(n)),new xt(l.anchor);l={anchor:null,node:null},a.set(n,l)}e?.startsWith("!!")&&(e=_n+e.slice(2));let c=Ln(n,e,o.tags);if(!c){if(n&&typeof n.toJSON=="function"&&(n=n.toJSON()),!n||typeof n!="object"){const u=new I(n);return l&&(l.node=u),u}c=n instanceof Map?o[W]:Symbol.iterator in Object(n)?o[he]:o[W]}r&&(r(c),delete t.onTagObj);const f=c?.createNode?c.createNode(t.schema,n,t):typeof c?.nodeClass?.from=="function"?c.nodeClass.from(t.schema,n,t):new I(n);return e?f.tag=e:c.default||(f.tag=c.tag),l&&(l.node=f),f}function We(n,e,t){let s=t;for(let i=e.length-1;i>=0;--i){const r=e[i];if(typeof r=="number"&&Number.isInteger(r)&&r>=0){const o=[];o[r]=s,s=o}else s=new Map([[r,s]])}return Ie(s,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw new Error("This should not happen, please report a bug.")},schema:n,sourceObjects:new Map})}const ye=n=>n==null||typeof n=="object"&&!!n[Symbol.iterator]().next().done;class Ps extends jt{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){const t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(s=>N(s)||$(s)?s.clone(e):s),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(ye(e))this.add(t);else{const[s,...i]=e,r=this.get(s,!0);if(O(r))r.addIn(i,t);else if(r===void 0&&this.schema)this.set(s,We(this.schema,i,t));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}deleteIn(e){const[t,...s]=e;if(s.length===0)return this.delete(t);const i=this.get(t,!0);if(O(i))return i.deleteIn(s);throw new Error(`Expected YAML collection at ${t}. Remaining path: ${s}`)}getIn(e,t){const[s,...i]=e,r=this.get(s,!0);return i.length===0?!t&&L(r)?r.value:r:O(r)?r.getIn(i,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!$(t))return!1;const s=t.value;return s==null||e&&L(s)&&s.value==null&&!s.commentBefore&&!s.comment&&!s.tag})}hasIn(e){const[t,...s]=e;if(s.length===0)return this.has(t);const i=this.get(t,!0);return O(i)?i.hasIn(s):!1}setIn(e,t){const[s,...i]=e;if(i.length===0)this.set(s,t);else{const r=this.get(s,!0);if(O(r))r.setIn(i,t);else if(r===void 0&&this.schema)this.set(s,We(this.schema,i,t));else throw new Error(`Expected YAML collection at ${s}. Remaining path: ${i}`)}}}const On=n=>n.replace(/^(?!$)(?: $)?/gm,"#");function U(n,e){return/^\n+$/.test(n)?n.substring(1):e?n.replace(/^(?! *$)/gm,e):n}const J=(n,e,t)=>n.endsWith(`
|
|
3
|
-
`)?U(t,e):t.includes(`
|
|
4
|
-
`)?`
|
|
5
|
-
`+U(t,e):(n.endsWith(" ")?"":" ")+t,js="flow",Lt="block",qe="quoted";function Ze(n,e,t="flow",{indentAtStart:s,lineWidth:i=80,minContentWidth:r=20,onFold:o,onOverflow:a}={}){if(!i||i<0)return n;i<r&&(r=0);const l=Math.max(1+r,1+i-e.length);if(n.length<=l)return n;const c=[],f={};let u=i-e.length;typeof s=="number"&&(s>i-Math.max(2,r)?c.push(0):u=i-s);let h,p,m=!1,d=-1,g=-1,y=-1;t===Lt&&(d=Zt(n,d,e.length),d!==-1&&(u=d+l));for(let w;w=n[d+=1];){if(t===qe&&w==="\\"){switch(g=d,n[d+1]){case"x":d+=3;break;case"u":d+=5;break;case"U":d+=9;break;default:d+=1}y=d}if(w===`
|
|
6
|
-
`)t===Lt&&(d=Zt(n,d,e.length)),u=d+e.length+l,h=void 0;else{if(w===" "&&p&&p!==" "&&p!==`
|
|
7
|
-
`&&p!==" "){const k=n[d+1];k&&k!==" "&&k!==`
|
|
8
|
-
`&&k!==" "&&(h=d)}if(d>=u)if(h)c.push(h),u=h+l,h=void 0;else if(t===qe){for(;p===" "||p===" ";)p=w,w=n[d+=1],m=!0;const k=d>y+1?d-2:g-1;if(f[k])return n;c.push(k),f[k]=!0,u=k+l,h=void 0}else m=!0}p=w}if(m&&a&&a(),c.length===0)return n;o&&o();let b=n.slice(0,c[0]);for(let w=0;w<c.length;++w){const k=c[w],S=c[w+1]||n.length;k===0?b=`
|
|
9
|
-
${e}${n.slice(0,S)}`:(t===qe&&f[k]&&(b+=`${n[k]}\\`),b+=`
|
|
10
|
-
${e}${n.slice(k+1,S)}`)}return b}function Zt(n,e,t){let s=e,i=e+1,r=n[i];for(;r===" "||r===" ";)if(e<i+t)r=n[++e];else{do r=n[++e];while(r&&r!==`
|
|
11
|
-
`);s=e,i=e+1,r=n[i]}return s}const et=(n,e)=>({indentAtStart:e?n.indent.length:n.indentAtStart,lineWidth:n.options.lineWidth,minContentWidth:n.options.minContentWidth}),tt=n=>/^(%|---|\.\.\.)/m.test(n);function Nn(n,e,t){if(!e||e<0)return!1;const s=e-t,i=n.length;if(i<=s)return!1;for(let r=0,o=0;r<i;++r)if(n[r]===`
|
|
12
|
-
`){if(r-o>s)return!0;if(o=r+1,i-o<=s)return!1}return!0}function Se(n,e){const t=JSON.stringify(n);if(e.options.doubleQuotedAsJSON)return t;const{implicitKey:s}=e,i=e.options.doubleQuotedMinMultiLineLength,r=e.indent||(tt(n)?" ":"");let 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);const 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(s||t[l+2]==='"'||t.length<i)l+=1;else{for(o+=t.slice(a,l)+`
|
|
13
|
-
|
|
14
|
-
`;t[l+2]==="\\"&&t[l+3]==="n"&&t[l+4]!=='"';)o+=`
|
|
15
|
-
`,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,s?o:Ze(o,r,qe,et(e,!1))}function Ot(n,e){if(e.options.singleQuote===!1||e.implicitKey&&n.includes(`
|
|
16
|
-
`)||/[ \t]\n|\n[ \t]/.test(n))return Se(n,e);const t=e.indent||(tt(n)?" ":""),s="'"+n.replace(/'/g,"''").replace(/\n+/g,`$&
|
|
17
|
-
${t}`)+"'";return e.implicitKey?s:Ze(s,t,js,et(e,!1))}function ae(n,e){const{singleQuote:t}=e.options;let s;if(t===!1)s=Se;else{const i=n.includes('"'),r=n.includes("'");i&&!r?s=Ot:r&&!i?s=Se:s=t?Ot:Se}return s(n,e)}let Nt;try{Nt=new RegExp(`(^|(?<!
|
|
18
|
-
))
|
|
19
|
-
+(?!
|
|
20
|
-
|$)`,"g")}catch{Nt=/\n+(?!\n|$)/g}function Ve({comment:n,type:e,value:t},s,i,r){const{blockQuote:o,commentString:a,lineWidth:l}=s.options;if(!o||/\n[\t ]+$/.test(t))return ae(t,s);const c=s.indent||(s.forceBlockIndent||tt(t)?" ":""),f=o==="literal"?!0:o==="folded"||e===I.BLOCK_FOLDED?!1:e===I.BLOCK_LITERAL?!0:!Nn(t,l,c.length);if(!t)return f?`|
|
|
21
|
-
`:`>
|
|
22
|
-
`;let u,h;for(h=t.length;h>0;--h){const S=t[h-1];if(S!==`
|
|
23
|
-
`&&S!==" "&&S!==" ")break}let p=t.substring(h);const m=p.indexOf(`
|
|
24
|
-
`);m===-1?u="-":t===p||m!==p.length-1?(u="+",r&&r()):u="",p&&(t=t.slice(0,-p.length),p[p.length-1]===`
|
|
25
|
-
`&&(p=p.slice(0,-1)),p=p.replace(Nt,`$&${c}`));let d=!1,g,y=-1;for(g=0;g<t.length;++g){const S=t[g];if(S===" ")d=!0;else if(S===`
|
|
26
|
-
`)y=g;else break}let b=t.substring(0,y<g?y+1:g);b&&(t=t.substring(b.length),b=b.replace(/\n+/g,`$&${c}`));let k=(d?c?"2":"1":"")+u;if(n&&(k+=" "+a(n.replace(/ ?[\r\n]+/g," ")),i&&i()),!f){const S=t.replace(/\n+/g,`
|
|
27
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,"$1$2").replace(/\n+/g,`$&${c}`);let A=!1;const _=et(s,!0);o!=="folded"&&e!==I.BLOCK_FOLDED&&(_.onOverflow=()=>{A=!0});const v=Ze(`${b}${S}${p}`,c,Lt,_);if(!A)return`>${k}
|
|
28
|
-
${c}${v}`}return t=t.replace(/\n+/g,`$&${c}`),`|${k}
|
|
29
|
-
${c}${b}${t}${p}`}function $n(n,e,t,s){const{type:i,value:r}=n,{actualString:o,implicitKey:a,indent:l,indentStep:c,inFlow:f}=e;if(a&&r.includes(`
|
|
30
|
-
`)||f&&/[[\]{},]/.test(r))return ae(r,e);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(r))return a||f||!r.includes(`
|
|
31
|
-
`)?ae(r,e):Ve(n,e,t,s);if(!a&&!f&&i!==I.PLAIN&&r.includes(`
|
|
32
|
-
`))return Ve(n,e,t,s);if(tt(r)){if(l==="")return e.forceBlockIndent=!0,Ve(n,e,t,s);if(a&&l===c)return ae(r,e)}const u=r.replace(/\n+/g,`$&
|
|
33
|
-
${l}`);if(o){const h=d=>d.default&&d.tag!=="tag:yaml.org,2002:str"&&d.test?.test(u),{compat:p,tags:m}=e.doc.schema;if(m.some(h)||p?.some(h))return ae(r,e)}return a?u:Ze(u,l,js,et(e,!1))}function Rt(n,e,t,s){const{implicitKey:i,inFlow:r}=e,o=typeof n.value=="string"?n:Object.assign({},n,{value:String(n.value)});let{type:a}=n;a!==I.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(a=I.QUOTE_DOUBLE);const l=f=>{switch(f){case I.BLOCK_FOLDED:case I.BLOCK_LITERAL:return i||r?ae(o.value,e):Ve(o,e,t,s);case I.QUOTE_DOUBLE:return Se(o.value,e);case I.QUOTE_SINGLE:return Ot(o.value,e);case I.PLAIN:return $n(o,e,t,s);default:return null}};let c=l(a);if(c===null){const{defaultKeyType:f,defaultStringType:u}=e.options,h=i&&f||u;if(c=l(h),c===null)throw new Error(`Unsupported default string type ${h}`)}return c}function xs(n,e){const t=Object.assign({blockQuote:!0,commentString:On,defaultKeyType:null,defaultStringType:"PLAIN",directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:"false",flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:"null",simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:"true",verifyAliasOrder:!0},n.schema.toStringOptions,e);let s;switch(t.collectionStyle){case"block":s=!1;break;case"flow":s=!0;break;default:s=null}return{anchors:new Set,doc:n,flowCollectionPadding:t.flowCollectionPadding?" ":"",indent:"",indentStep:typeof t.indent=="number"?" ".repeat(t.indent):" ",inFlow:s,options:t}}function Cn(n,e){if(e.tag){const i=n.filter(r=>r.tag===e.tag);if(i.length>0)return i.find(r=>r.format===e.format)??i[0]}let t,s;if(L(e)){s=e.value;let i=n.filter(r=>r.identify?.(s));if(i.length>1){const r=i.filter(o=>o.test);r.length>0&&(i=r)}t=i.find(r=>r.format===e.format)??i.find(r=>!r.format)}else s=e,t=n.find(i=>i.nodeClass&&s instanceof i.nodeClass);if(!t){const i=s?.constructor?.name??(s===null?"null":typeof s);throw new Error(`Tag not resolved for ${i} value`)}return t}function Tn(n,e,{anchors:t,doc:s}){if(!s.directives)return"";const i=[],r=(L(n)||O(n))&&n.anchor;r&&Ts(r)&&(t.add(r),i.push(`&${r}`));const o=n.tag??(e.default?null:e.tag);return o&&i.push(s.directives.tagString(o)),i.join(" ")}function fe(n,e,t,s){if($(n))return n.toString(e,t,s);if(X(n)){if(e.doc.directives)return n.toString(e);if(e.resolvedAliases?.has(n))throw new TypeError("Cannot stringify circular structure without alias nodes");e.resolvedAliases?e.resolvedAliases.add(n):e.resolvedAliases=new Set([n]),n=n.resolve(e.doc)}let i;const r=N(n)?n:e.doc.createNode(n,{onTagObj:l=>i=l});i??(i=Cn(e.doc.schema.tags,r));const o=Tn(r,i,e);o.length>0&&(e.indentAtStart=(e.indentAtStart??0)+o.length+1);const a=typeof i.stringify=="function"?i.stringify(r,e,t,s):L(r)?Rt(r,e,t,s):r.toString(e,t,s);return o?L(r)||a[0]==="{"||a[0]==="["?`${o} ${a}`:`${o}
|
|
34
|
-
${e.indent}${a}`:a}function En({key:n,value:e},t,s,i){const{allNullValues:r,doc:o,indent:a,indentStep:l,options:{commentString:c,indentSeq:f,simpleKeys:u}}=t;let h=N(n)&&n.comment||null;if(u){if(h)throw new Error("With simple keys, key nodes cannot have comments");if(O(n)||!N(n)&&typeof n=="object"){const _="With simple keys, collection cannot be used as a key value";throw new Error(_)}}let p=!u&&(!n||h&&e==null&&!t.inFlow||O(n)||(L(n)?n.type===I.BLOCK_FOLDED||n.type===I.BLOCK_LITERAL:typeof n=="object"));t=Object.assign({},t,{allNullValues:!1,implicitKey:!p&&(u||!r),indent:a+l});let m=!1,d=!1,g=fe(n,t,()=>m=!0,()=>d=!0);if(!p&&!t.inFlow&&g.length>1024){if(u)throw new Error("With simple keys, single line scalar must not span more than 1024 characters");p=!0}if(t.inFlow){if(r||e==null)return m&&s&&s(),g===""?"?":p?`? ${g}`:g}else if(r&&!u||e==null&&p)return g=`? ${g}`,h&&!m?g+=J(g,t.indent,c(h)):d&&i&&i(),g;m&&(h=null),p?(h&&(g+=J(g,t.indent,c(h))),g=`? ${g}
|
|
35
|
-
${a}:`):(g=`${g}:`,h&&(g+=J(g,t.indent,c(h))));let y,b,w;N(e)?(y=!!e.spaceBefore,b=e.commentBefore,w=e.comment):(y=!1,b=null,w=null,e&&typeof e=="object"&&(e=o.createNode(e))),t.implicitKey=!1,!p&&!h&&L(e)&&(t.indentAtStart=g.length+1),d=!1,!f&&l.length>=2&&!t.inFlow&&!p&&$e(e)&&!e.flow&&!e.tag&&!e.anchor&&(t.indent=t.indent.substring(2));let k=!1;const S=fe(e,t,()=>k=!0,()=>d=!0);let A=" ";if(h||y||b){if(A=y?`
|
|
36
|
-
`:"",b){const _=c(b);A+=`
|
|
37
|
-
${U(_,t.indent)}`}S===""&&!t.inFlow?A===`
|
|
38
|
-
`&&w&&(A=`
|
|
39
|
-
|
|
40
|
-
`):A+=`
|
|
41
|
-
${t.indent}`}else if(!p&&O(e)){const _=S[0],v=S.indexOf(`
|
|
42
|
-
`),C=v!==-1,V=t.inFlow??e.flow??e.items.length===0;if(C||!V){let Z=!1;if(C&&(_==="&"||_==="!")){let T=S.indexOf(" ");_==="&"&&T!==-1&&T<v&&S[T+1]==="!"&&(T=S.indexOf(" ",T+1)),(T===-1||v<T)&&(Z=!0)}Z||(A=`
|
|
43
|
-
${t.indent}`)}}else(S===""||S[0]===`
|
|
44
|
-
`)&&(A="");return g+=A+S,t.inFlow?k&&s&&s():w&&!k?g+=J(g,t.indent,c(w)):d&&i&&i(),g}function Rs(n,e){(n==="debug"||n==="warn")&&console.warn(e)}const Ee="<<",q={identify:n=>n===Ee||typeof n=="symbol"&&n.description===Ee,default:"key",tag:"tag:yaml.org,2002:merge",test:/^<<$/,resolve:()=>Object.assign(new I(Symbol(Ee)),{addToJSMap:Fs}),stringify:()=>Ee},Mn=(n,e)=>(q.identify(e)||L(e)&&(!e.type||e.type===I.PLAIN)&&q.identify(e.value))&&n?.doc.schema.tags.some(t=>t.tag===q.tag&&t.default);function Fs(n,e,t){if(t=n&&X(t)?t.resolve(n.doc):t,$e(t))for(const s of t.items)ft(n,e,s);else if(Array.isArray(t))for(const s of t)ft(n,e,s);else ft(n,e,t)}function ft(n,e,t){const s=n&&X(t)?t.resolve(n.doc):t;if(!Ne(s))throw new Error("Merge sources must be maps or map aliases");const i=s.toJSON(null,n,Map);for(const[r,o]of i)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}function Ds(n,e,{key:t,value:s}){if(N(t)&&t.addToJSMap)t.addToJSMap(n,e,s);else if(Mn(n,t))Fs(n,e,s);else{const i=j(t,"",n);if(e instanceof Map)e.set(i,j(s,i,n));else if(e instanceof Set)e.add(i);else{const r=Bn(t,i,n),o=j(s,r,n);r in e?Object.defineProperty(e,r,{value:o,writable:!0,enumerable:!0,configurable:!0}):e[r]=o}}return e}function Bn(n,e,t){if(e===null)return"";if(typeof e!="object")return String(e);if(N(n)&&t?.doc){const s=xs(t.doc,{});s.anchors=new Set;for(const r of t.anchors.keys())s.anchors.add(r.anchor);s.inFlow=!0,s.inStringifyKey=!0;const i=n.toString(s);if(!t.mapKeyWarned){let r=JSON.stringify(i);r.length>40&&(r=r.substring(0,36)+'..."'),Rs(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 i}return JSON.stringify(e)}function Ft(n,e,t){const s=Ie(n,void 0,t),i=Ie(e,void 0,t);return new M(s,i)}class M{constructor(e,t=null){Object.defineProperty(this,x,{value:$s}),this.key=e,this.value=t}clone(e){let{key:t,value:s}=this;return N(t)&&(t=t.clone(e)),N(s)&&(s=s.clone(e)),new M(t,s)}toJSON(e,t){const s=t?.mapAsMap?new Map:{};return Ds(t,s,this)}toString(e,t,s){return e?.doc?En(this,e,t,s):JSON.stringify(this)}}function Ks(n,e,t){return(e.inFlow??n.flow?jn:Pn)(n,e,t)}function Pn({comment:n,items:e},t,{blockItemPrefix:s,flowChars:i,itemIndent:r,onChompKeep:o,onComment:a}){const{indent:l,options:{commentString:c}}=t,f=Object.assign({},t,{indent:r,type:null});let u=!1;const h=[];for(let m=0;m<e.length;++m){const d=e[m];let g=null;if(N(d))!u&&d.spaceBefore&&h.push(""),ze(t,h,d.commentBefore,u),d.comment&&(g=d.comment);else if($(d)){const b=N(d.key)?d.key:null;b&&(!u&&b.spaceBefore&&h.push(""),ze(t,h,b.commentBefore,u))}u=!1;let y=fe(d,f,()=>g=null,()=>u=!0);g&&(y+=J(y,r,c(g))),u&&g&&(u=!1),h.push(s+y)}let p;if(h.length===0)p=i.start+i.end;else{p=h[0];for(let m=1;m<h.length;++m){const d=h[m];p+=d?`
|
|
45
|
-
${l}${d}`:`
|
|
46
|
-
`}}return n?(p+=`
|
|
47
|
-
`+U(c(n),l),a&&a()):u&&o&&o(),p}function jn({items:n},e,{flowChars:t,itemIndent:s}){const{indent:i,indentStep:r,flowCollectionPadding:o,options:{commentString:a}}=e;s+=r;const l=Object.assign({},e,{indent:s,inFlow:!0,type:null});let c=!1,f=0;const u=[];for(let m=0;m<n.length;++m){const d=n[m];let g=null;if(N(d))d.spaceBefore&&u.push(""),ze(e,u,d.commentBefore,!1),d.comment&&(g=d.comment);else if($(d)){const b=N(d.key)?d.key:null;b&&(b.spaceBefore&&u.push(""),ze(e,u,b.commentBefore,!1),b.comment&&(c=!0));const w=N(d.value)?d.value:null;w?(w.comment&&(g=w.comment),w.commentBefore&&(c=!0)):d.value==null&&b?.comment&&(g=b.comment)}g&&(c=!0);let y=fe(d,l,()=>g=null);c||(c=u.length>f||y.includes(`
|
|
48
|
-
`)),m<n.length-1?y+=",":e.options.trailingComma&&(e.options.lineWidth>0&&(c||(c=u.reduce((b,w)=>b+w.length+2,2)+(y.length+2)>e.options.lineWidth)),c&&(y+=",")),g&&(y+=J(y,s,a(g))),u.push(y),f=u.length}const{start:h,end:p}=t;if(u.length===0)return h+p;if(!c){const m=u.reduce((d,g)=>d+g.length+2,2);c=e.options.lineWidth>0&&m>e.options.lineWidth}if(c){let m=h;for(const d of u)m+=d?`
|
|
49
|
-
${r}${i}${d}`:`
|
|
50
|
-
`;return`${m}
|
|
51
|
-
${i}${p}`}else return`${h}${o}${u.join(" ")}${o}${p}`}function ze({indent:n,options:{commentString:e}},t,s,i){if(s&&i&&(s=s.replace(/^\n+/,"")),s){const r=U(e(s),n);t.push(r.trimStart())}}function Y(n,e){const t=L(e)?e.value:e;for(const s of n)if($(s)&&(s.key===e||s.key===t||L(s.key)&&s.key.value===t))return s}class P extends Ps{static get tagName(){return"tag:yaml.org,2002:map"}constructor(e){super(W,e),this.items=[]}static from(e,t,s){const{keepUndefined:i,replacer:r}=s,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||i)&&o.items.push(Ft(l,c,s))};if(t instanceof Map)for(const[l,c]of t)a(l,c);else if(t&&typeof t=="object")for(const l of Object.keys(t))a(l,t[l]);return typeof e.sortMapEntries=="function"&&o.items.sort(e.sortMapEntries),o}add(e,t){let s;$(e)?s=e:!e||typeof e!="object"||!("key"in e)?s=new M(e,e?.value):s=new M(e.key,e.value);const i=Y(this.items,s.key),r=this.schema?.sortMapEntries;if(i){if(!t)throw new Error(`Key ${s.key} already set`);L(i.value)&&Bs(s.value)?i.value.value=s.value:i.value=s.value}else if(r){const o=this.items.findIndex(a=>r(s,a)<0);o===-1?this.items.push(s):this.items.splice(o,0,s)}else this.items.push(s)}delete(e){const t=Y(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){const i=Y(this.items,e)?.value;return(!t&&L(i)?i.value:i)??void 0}has(e){return!!Y(this.items,e)}set(e,t){this.add(new M(e,t),!0)}toJSON(e,t,s){const i=s?new s:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(i);for(const r of this.items)Ds(t,i,r);return i}toString(e,t,s){if(!e)return JSON.stringify(this);for(const i of this.items)if(!$(i))throw new Error(`Map items must all be pairs; found ${JSON.stringify(i)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Ks(this,e,{blockItemPrefix:"",flowChars:{start:"{",end:"}"},itemIndent:e.indent||"",onChompKeep:s,onComment:t})}}const pe={collection:"map",default:!0,nodeClass:P,tag:"tag:yaml.org,2002:map",resolve(n,e){return Ne(n)||e("Expected a mapping for this tag"),n},createNode:(n,e,t)=>P.from(n,e,t)};class Q extends Ps{static get tagName(){return"tag:yaml.org,2002:seq"}constructor(e){super(he,e),this.items=[]}add(e){this.items.push(e)}delete(e){const t=Me(e);return typeof t!="number"?!1:this.items.splice(t,1).length>0}get(e,t){const s=Me(e);if(typeof s!="number")return;const i=this.items[s];return!t&&L(i)?i.value:i}has(e){const t=Me(e);return typeof t=="number"&&t<this.items.length}set(e,t){const s=Me(e);if(typeof s!="number")throw new Error(`Expected a valid index, not ${e}.`);const i=this.items[s];L(i)&&Bs(t)?i.value=t:this.items[s]=t}toJSON(e,t){const s=[];t?.onCreate&&t.onCreate(s);let i=0;for(const r of this.items)s.push(j(r,String(i++),t));return s}toString(e,t,s){return e?Ks(this,e,{blockItemPrefix:"- ",flowChars:{start:"[",end:"]"},itemIndent:(e.indent||"")+" ",onChompKeep:s,onComment:t}):JSON.stringify(this)}static from(e,t,s){const{replacer:i}=s,r=new this(e);if(t&&Symbol.iterator in Object(t)){let o=0;for(let a of t){if(typeof i=="function"){const l=t instanceof Set?a:String(o++);a=i.call(t,l,a)}r.items.push(Ie(a,void 0,s))}}return r}}function Me(n){let e=L(n)?n.value:n;return e&&typeof e=="string"&&(e=Number(e)),typeof e=="number"&&Number.isInteger(e)&&e>=0?e:null}const ge={collection:"seq",default:!0,nodeClass:Q,tag:"tag:yaml.org,2002:seq",resolve(n,e){return $e(n)||e("Expected a sequence for this tag"),n},createNode:(n,e,t)=>Q.from(n,e,t)},st={identify:n=>typeof n=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:n=>n,stringify(n,e,t,s){return e=Object.assign({actualString:!0},e),Rt(n,e,t,s)}},nt={identify:n=>n==null,createNode:()=>new I(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new I(null),stringify:({source:n},e)=>typeof n=="string"&&nt.test.test(n)?n:e.options.nullStr},Dt={identify:n=>typeof n=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:n=>new I(n[0]==="t"||n[0]==="T"),stringify({source:n,value:e},t){if(n&&Dt.test.test(n)){const s=n[0]==="t"||n[0]==="T";if(e===s)return n}return e?t.options.trueStr:t.options.falseStr}};function F({format:n,minFractionDigits:e,tag:t,value:s}){if(typeof s=="bigint")return String(s);const i=typeof s=="number"?s:Number(s);if(!isFinite(i))return isNaN(i)?".nan":i<0?"-.inf":".inf";let r=Object.is(s,-0)?"-0":JSON.stringify(s);if(!n&&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}const Us={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:n=>n.slice(-3).toLowerCase()==="nan"?NaN:n[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:F},qs={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:n=>parseFloat(n),stringify(n){const e=Number(n.value);return isFinite(e)?e.toExponential():F(n)}},Vs={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(n){const e=new I(parseFloat(n)),t=n.indexOf(".");return t!==-1&&n[n.length-1]==="0"&&(e.minFractionDigits=n.length-t-1),e},stringify:F},it=n=>typeof n=="bigint"||Number.isInteger(n),Kt=(n,e,t,{intAsBigInt:s})=>s?BigInt(n):parseInt(n.substring(e),t);function Hs(n,e,t){const{value:s}=n;return it(s)&&s>=0?t+s.toString(e):F(n)}const Ws={identify:n=>it(n)&&n>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^0o[0-7]+$/,resolve:(n,e,t)=>Kt(n,2,8,t),stringify:n=>Hs(n,8,"0o")},zs={identify:it,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9]+$/,resolve:(n,e,t)=>Kt(n,0,10,t),stringify:F},Gs={identify:n=>it(n)&&n>=0,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^0x[0-9a-fA-F]+$/,resolve:(n,e,t)=>Kt(n,2,16,t),stringify:n=>Hs(n,16,"0x")},xn=[pe,ge,st,nt,Dt,Ws,zs,Gs,Us,qs,Vs];function es(n){return typeof n=="bigint"||Number.isInteger(n)}const Be=({value:n})=>JSON.stringify(n),Rn=[{identify:n=>typeof n=="string",default:!0,tag:"tag:yaml.org,2002:str",resolve:n=>n,stringify:Be},{identify:n=>n==null,createNode:()=>new I(null),default:!0,tag:"tag:yaml.org,2002:null",test:/^null$/,resolve:()=>null,stringify:Be},{identify:n=>typeof n=="boolean",default:!0,tag:"tag:yaml.org,2002:bool",test:/^true$|^false$/,resolve:n=>n==="true",stringify:Be},{identify:es,default:!0,tag:"tag:yaml.org,2002:int",test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(n,e,{intAsBigInt:t})=>t?BigInt(n):parseInt(n,10),stringify:({value:n})=>es(n)?n.toString():JSON.stringify(n)},{identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:n=>parseFloat(n),stringify:Be}],Fn={default:!0,tag:"",test:/^/,resolve(n,e){return e(`Unresolved plain scalar ${JSON.stringify(n)}`),n}},Dn=[pe,ge].concat(Rn,Fn),Ut={identify:n=>n instanceof Uint8Array,default:!1,tag:"tag:yaml.org,2002:binary",resolve(n,e){if(typeof atob=="function"){const t=atob(n.replace(/[\n\r]/g,"")),s=new Uint8Array(t.length);for(let i=0;i<t.length;++i)s[i]=t.charCodeAt(i);return s}else return e("This environment does not support reading binary tags; either Buffer or atob is required"),n},stringify({comment:n,type:e,value:t},s,i,r){if(!t)return"";const o=t;let a;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=I.BLOCK_LITERAL),e!==I.QUOTE_DOUBLE){const l=Math.max(s.options.lineWidth-s.indent.length,s.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===I.BLOCK_LITERAL?`
|
|
52
|
-
`:" ")}return Rt({comment:n,type:e,value:a},s,i,r)}};function Js(n,e){if($e(n))for(let t=0;t<n.items.length;++t){let s=n.items[t];if(!$(s)){if(Ne(s)){s.items.length>1&&e("Each pair must have its own sequence indicator");const i=s.items[0]||new M(new I(null));if(s.commentBefore&&(i.key.commentBefore=i.key.commentBefore?`${s.commentBefore}
|
|
53
|
-
${i.key.commentBefore}`:s.commentBefore),s.comment){const r=i.value??i.key;r.comment=r.comment?`${s.comment}
|
|
54
|
-
${r.comment}`:s.comment}s=i}n.items[t]=$(s)?s:new M(s)}}else e("Expected a sequence for this tag");return n}function Ys(n,e,t){const{replacer:s}=t,i=new Q(n);i.tag="tag:yaml.org,2002:pairs";let r=0;if(e&&Symbol.iterator in Object(e))for(let o of e){typeof s=="function"&&(o=s.call(e,String(r++),o));let a,l;if(Array.isArray(o))if(o.length===2)a=o[0],l=o[1];else throw new TypeError(`Expected [key, value] tuple: ${o}`);else if(o&&o instanceof Object){const c=Object.keys(o);if(c.length===1)a=c[0],l=o[a];else throw new TypeError(`Expected tuple with one key, not ${c.length} keys`)}else a=o;i.items.push(Ft(a,l,t))}return i}const qt={collection:"seq",default:!1,tag:"tag:yaml.org,2002:pairs",resolve:Js,createNode:Ys};class le extends Q{constructor(){super(),this.add=P.prototype.add.bind(this),this.delete=P.prototype.delete.bind(this),this.get=P.prototype.get.bind(this),this.has=P.prototype.has.bind(this),this.set=P.prototype.set.bind(this),this.tag=le.tag}toJSON(e,t){if(!t)return super.toJSON(e);const s=new Map;t?.onCreate&&t.onCreate(s);for(const i of this.items){let r,o;if($(i)?(r=j(i.key,"",t),o=j(i.value,r,t)):r=j(i,"",t),s.has(r))throw new Error("Ordered maps must not include duplicate keys");s.set(r,o)}return s}static from(e,t,s){const i=Ys(e,t,s),r=new this;return r.items=i.items,r}}le.tag="tag:yaml.org,2002:omap";const Vt={collection:"seq",identify:n=>n instanceof Map,nodeClass:le,default:!1,tag:"tag:yaml.org,2002:omap",resolve(n,e){const t=Js(n,e),s=[];for(const{key:i}of t.items)L(i)&&(s.includes(i.value)?e(`Ordered maps must not include duplicate keys: ${i.value}`):s.push(i.value));return Object.assign(new le,t)},createNode:(n,e,t)=>le.from(n,e,t)};function Qs({value:n,source:e},t){return e&&(n?Xs:Zs).test.test(e)?e:n?t.options.trueStr:t.options.falseStr}const Xs={identify:n=>n===!0,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new I(!0),stringify:Qs},Zs={identify:n=>n===!1,default:!0,tag:"tag:yaml.org,2002:bool",test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new I(!1),stringify:Qs},Kn={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:n=>n.slice(-3).toLowerCase()==="nan"?NaN:n[0]==="-"?Number.NEGATIVE_INFINITY:Number.POSITIVE_INFINITY,stringify:F},Un={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"EXP",test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:n=>parseFloat(n.replace(/_/g,"")),stringify(n){const e=Number(n.value);return isFinite(e)?e.toExponential():F(n)}},qn={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(n){const e=new I(parseFloat(n.replace(/_/g,""))),t=n.indexOf(".");if(t!==-1){const s=n.substring(t+1).replace(/_/g,"");s[s.length-1]==="0"&&(e.minFractionDigits=s.length)}return e},stringify:F},Ce=n=>typeof n=="bigint"||Number.isInteger(n);function rt(n,e,t,{intAsBigInt:s}){const i=n[0];if((i==="-"||i==="+")&&(e+=1),n=n.substring(e).replace(/_/g,""),s){switch(t){case 2:n=`0b${n}`;break;case 8:n=`0o${n}`;break;case 16:n=`0x${n}`;break}const o=BigInt(n);return i==="-"?BigInt(-1)*o:o}const r=parseInt(n,t);return i==="-"?-1*r:r}function Ht(n,e,t){const{value:s}=n;if(Ce(s)){const i=s.toString(e);return s<0?"-"+t+i.substr(1):t+i}return F(n)}const Vn={identify:Ce,default:!0,tag:"tag:yaml.org,2002:int",format:"BIN",test:/^[-+]?0b[0-1_]+$/,resolve:(n,e,t)=>rt(n,2,2,t),stringify:n=>Ht(n,2,"0b")},Hn={identify:Ce,default:!0,tag:"tag:yaml.org,2002:int",format:"OCT",test:/^[-+]?0[0-7_]+$/,resolve:(n,e,t)=>rt(n,1,8,t),stringify:n=>Ht(n,8,"0")},Wn={identify:Ce,default:!0,tag:"tag:yaml.org,2002:int",test:/^[-+]?[0-9][0-9_]*$/,resolve:(n,e,t)=>rt(n,0,10,t),stringify:F},zn={identify:Ce,default:!0,tag:"tag:yaml.org,2002:int",format:"HEX",test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(n,e,t)=>rt(n,2,16,t),stringify:n=>Ht(n,16,"0x")};class ce extends P{constructor(e){super(e),this.tag=ce.tag}add(e){let t;$(e)?t=e:e&&typeof e=="object"&&"key"in e&&"value"in e&&e.value===null?t=new M(e.key,null):t=new M(e,null),Y(this.items,t.key)||this.items.push(t)}get(e,t){const s=Y(this.items,e);return!t&&$(s)?L(s.key)?s.key.value:s.key:s}set(e,t){if(typeof t!="boolean")throw new Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);const s=Y(this.items,e);s&&!t?this.items.splice(this.items.indexOf(s),1):!s&&t&&this.items.push(new M(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,s){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,s);throw new Error("Set items must all have null values")}static from(e,t,s){const{replacer:i}=s,r=new this(e);if(t&&Symbol.iterator in Object(t))for(let o of t)typeof i=="function"&&(o=i.call(t,o,o)),r.items.push(Ft(o,null,s));return r}}ce.tag="tag:yaml.org,2002:set";const Wt={collection:"map",identify:n=>n instanceof Set,nodeClass:ce,default:!1,tag:"tag:yaml.org,2002:set",createNode:(n,e,t)=>ce.from(n,e,t),resolve(n,e){if(Ne(n)){if(n.hasAllNullValues(!0))return Object.assign(new ce,n);e("Set items must all have null values")}else e("Expected a mapping for this tag");return n}};function zt(n,e){const t=n[0],s=t==="-"||t==="+"?n.substring(1):n,i=o=>e?BigInt(o):Number(o),r=s.replace(/_/g,"").split(":").reduce((o,a)=>o*i(60)+i(a),i(0));return t==="-"?i(-1)*r:r}function en(n){let{value:e}=n,t=o=>o;if(typeof e=="bigint")t=o=>BigInt(o);else if(isNaN(e)||!isFinite(e))return F(n);let s="";e<0&&(s="-",e*=t(-1));const i=t(60),r=[e%i];return e<60?r.unshift(0):(e=(e-r[0])/i,r.unshift(e%i),e>=60&&(e=(e-r[0])/i,r.unshift(e))),s+r.map(o=>String(o).padStart(2,"0")).join(":").replace(/000000\d*$/,"")}const tn={identify:n=>typeof n=="bigint"||Number.isInteger(n),default:!0,tag:"tag:yaml.org,2002:int",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(n,e,{intAsBigInt:t})=>zt(n,t),stringify:en},sn={identify:n=>typeof n=="number",default:!0,tag:"tag:yaml.org,2002:float",format:"TIME",test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:n=>zt(n,!1),stringify:en},ot={identify:n=>n instanceof Date,default:!0,tag:"tag:yaml.org,2002:timestamp",test:RegExp("^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$"),resolve(n){const e=n.match(ot.test);if(!e)throw new Error("!!timestamp expects a date, starting with yyyy-mm-dd");const[,t,s,i,r,o,a]=e.map(Number),l=e[7]?Number((e[7]+"00").substr(1,3)):0;let c=Date.UTC(t,s-1,i,r||0,o||0,a||0,l);const f=e[8];if(f&&f!=="Z"){let u=zt(f,!1);Math.abs(u)<30&&(u*=60),c-=6e4*u}return new Date(c)},stringify:({value:n})=>n?.toISOString().replace(/(T00:00:00)?\.000Z$/,"")??""},ts=[pe,ge,st,nt,Xs,Zs,Vn,Hn,Wn,zn,Kn,Un,qn,Ut,q,Vt,qt,Wt,tn,sn,ot],ss=new Map([["core",xn],["failsafe",[pe,ge,st]],["json",Dn],["yaml11",ts],["yaml-1.1",ts]]),ns={binary:Ut,bool:Dt,float:Vs,floatExp:qs,floatNaN:Us,floatTime:sn,int:zs,intHex:Gs,intOct:Ws,intTime:tn,map:pe,merge:q,null:nt,omap:Vt,pairs:qt,seq:ge,set:Wt,timestamp:ot},Gn={"tag:yaml.org,2002:binary":Ut,"tag:yaml.org,2002:merge":q,"tag:yaml.org,2002:omap":Vt,"tag:yaml.org,2002:pairs":qt,"tag:yaml.org,2002:set":Wt,"tag:yaml.org,2002:timestamp":ot};function ut(n,e,t){const s=ss.get(e);if(s&&!n)return t&&!s.includes(q)?s.concat(q):s.slice();let i=s;if(!i)if(Array.isArray(n))i=[];else{const r=Array.from(ss.keys()).filter(o=>o!=="yaml11").map(o=>JSON.stringify(o)).join(", ");throw new Error(`Unknown schema "${e}"; use one of ${r} or define customTags array`)}if(Array.isArray(n))for(const r of n)i=i.concat(r);else typeof n=="function"&&(i=n(i.slice()));return t&&(i=i.concat(q)),i.reduce((r,o)=>{const a=typeof o=="string"?ns[o]:o;if(!a){const l=JSON.stringify(o),c=Object.keys(ns).map(f=>JSON.stringify(f)).join(", ");throw new Error(`Unknown custom tag ${l}; use one of ${c}`)}return r.includes(a)||r.push(a),r},[])}const Jn=(n,e)=>n.key<e.key?-1:n.key>e.key?1:0;class Gt{constructor({compat:e,customTags:t,merge:s,resolveKnownTags:i,schema:r,sortMapEntries:o,toStringDefaults:a}){this.compat=Array.isArray(e)?ut(e,"compat"):e?ut(null,e):null,this.name=typeof r=="string"&&r||"core",this.knownTags=i?Gn:{},this.tags=ut(t,this.name,s),this.toStringOptions=a??null,Object.defineProperty(this,W,{value:pe}),Object.defineProperty(this,D,{value:st}),Object.defineProperty(this,he,{value:ge}),this.sortMapEntries=typeof o=="function"?o:o===!0?Jn:null}clone(){const e=Object.create(Gt.prototype,Object.getOwnPropertyDescriptors(this));return e.tags=this.tags.slice(),e}}function Yn(n,e){const t=[];let s=e.directives===!0;if(e.directives!==!1&&n.directives){const l=n.directives.toString(n);l?(t.push(l),s=!0):n.directives.docStart&&(s=!0)}s&&t.push("---");const i=xs(n,e),{commentString:r}=i.options;if(n.commentBefore){t.length!==1&&t.unshift("");const l=r(n.commentBefore);t.unshift(U(l,""))}let o=!1,a=null;if(n.contents){if(N(n.contents)){if(n.contents.spaceBefore&&s&&t.push(""),n.contents.commentBefore){const f=r(n.contents.commentBefore);t.push(U(f,""))}i.forceBlockIndent=!!n.comment,a=n.contents.comment}const l=a?void 0:()=>o=!0;let c=fe(n.contents,i,()=>a=null,l);a&&(c+=J(c,"",r(a))),(c[0]==="|"||c[0]===">")&&t[t.length-1]==="---"?t[t.length-1]=`--- ${c}`:t.push(c)}else t.push(fe(n.contents,i));if(n.directives?.docEnd)if(n.comment){const l=r(n.comment);l.includes(`
|
|
55
|
-
`)?(t.push("..."),t.push(U(l,""))):t.push(`... ${l}`)}else t.push("...");else{let l=n.comment;l&&o&&(l=l.replace(/^\n+/,"")),l&&((!o||a)&&t[t.length-1]!==""&&t.push(""),t.push(U(r(l),"")))}return t.join(`
|
|
56
|
-
`)+`
|
|
57
|
-
`}class at{constructor(e,t,s){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,x,{value:_t});let i=null;typeof t=="function"||Array.isArray(t)?i=t:s===void 0&&t&&(s=t,t=void 0);const r=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:"warn",prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:"1.2"},s);this.options=r;let{version:o}=r;s?._directives?(this.directives=s._directives.atDocument(),this.directives.yaml.explicit&&(o=this.directives.yaml.version)):this.directives=new E({version:o}),this.setSchema(o,s),this.contents=e===void 0?null:this.createNode(e,i,s)}clone(){const e=Object.create(at.prototype,{[x]:{value:_t}});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=N(this.contents)?this.contents.clone(e.schema):this.contents,this.range&&(e.range=this.range.slice()),e}add(e){ee(this.contents)&&this.contents.add(e)}addIn(e,t){ee(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){const s=Es(this);e.anchor=!t||s.has(t)?Ms(t||"a",s):t}return new xt(e.anchor)}createNode(e,t,s){let i;if(typeof t=="function")e=t.call({"":e},"",e),i=t;else if(Array.isArray(t)){const g=b=>typeof b=="number"||b instanceof String||b instanceof Number,y=t.filter(g).map(String);y.length>0&&(t=t.concat(y)),i=t}else s===void 0&&t&&(s=t,t=void 0);const{aliasDuplicateObjects:r,anchorPrefix:o,flow:a,keepUndefined:l,onTagObj:c,tag:f}=s??{},{onAnchor:u,setAnchors:h,sourceObjects:p}=In(this,o||"a"),m={aliasDuplicateObjects:r??!0,keepUndefined:l??!1,onAnchor:u,onTagObj:c,replacer:i,schema:this.schema,sourceObjects:p},d=Ie(e,f,m);return a&&O(d)&&(d.flow=!0),h(),d}createPair(e,t,s={}){const i=this.createNode(e,null,s),r=this.createNode(t,null,s);return new M(i,r)}delete(e){return ee(this.contents)?this.contents.delete(e):!1}deleteIn(e){return ye(e)?this.contents==null?!1:(this.contents=null,!0):ee(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return O(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return ye(e)?!t&&L(this.contents)?this.contents.value:this.contents:O(this.contents)?this.contents.getIn(e,t):void 0}has(e){return O(this.contents)?this.contents.has(e):!1}hasIn(e){return ye(e)?this.contents!==void 0:O(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=We(this.schema,[e],t):ee(this.contents)&&this.contents.set(e,t)}setIn(e,t){ye(e)?this.contents=t:this.contents==null?this.contents=We(this.schema,Array.from(e),t):ee(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e=="number"&&(e=String(e));let s;switch(e){case"1.1":this.directives?this.directives.yaml.version="1.1":this.directives=new E({version:"1.1"}),s={resolveKnownTags:!1,schema:"yaml-1.1"};break;case"1.2":case"next":this.directives?this.directives.yaml.version=e:this.directives=new E({version:e}),s={resolveKnownTags:!0,schema:"core"};break;case null:this.directives&&delete this.directives,s=null;break;default:{const i=JSON.stringify(e);throw new Error(`Expected '1.1', '1.2' or null as first argument, but found: ${i}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(s)this.schema=new Gt(Object.assign(s,t));else throw new Error("With a null YAML version, the { schema: Schema } option is required")}toJS({json:e,jsonArg:t,mapAsMap:s,maxAliasCount:i,onAnchor:r,reviver:o}={}){const a={anchors:new Map,doc:this,keep:!e,mapAsMap:s===!0,mapKeyWarned:!1,maxAliasCount:typeof i=="number"?i:100},l=j(this.contents,t??"",a);if(typeof r=="function")for(const{count:c,res:f}of a.anchors.values())r(f,c);return typeof o=="function"?oe(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)){const t=JSON.stringify(e.indent);throw new Error(`"indent" option must be a positive integer, not ${t}`)}return Yn(this,e)}}function ee(n){if(O(n))return!0;throw new Error("Expected a YAML collection as document contents")}class nn extends Error{constructor(e,t,s,i){super(),this.name=e,this.code=s,this.message=i,this.pos=t}}class be extends nn{constructor(e,t,s){super("YAMLParseError",e,t,s)}}class Qn extends nn{constructor(e,t,s){super("YAMLWarning",e,t,s)}}const is=(n,e)=>t=>{if(t.pos[0]===-1)return;t.linePos=t.pos.map(a=>e.linePos(a));const{line:s,col:i}=t.linePos[0];t.message+=` at line ${s}, column ${i}`;let r=i-1,o=n.substring(e.lineStarts[s-1],e.lineStarts[s]).replace(/[\n\r]+$/,"");if(r>=60&&o.length>80){const a=Math.min(r-39,o.length-79);o="…"+o.substring(a),r-=a-1}if(o.length>80&&(o=o.substring(0,79)+"…"),s>1&&/^ *$/.test(o.substring(0,r))){let a=n.substring(e.lineStarts[s-2],e.lineStarts[s-1]);a.length>80&&(a=a.substring(0,79)+`…
|
|
58
|
-
`),o=a+o}if(/[^ ]/.test(o)){let a=1;const l=t.linePos[1];l?.line===s&&l.col>i&&(a=Math.max(1,Math.min(l.col-i,80-r)));const c=" ".repeat(r)+"^".repeat(a);t.message+=`:
|
|
59
|
-
|
|
60
|
-
${o}
|
|
61
|
-
${c}
|
|
62
|
-
`}};function ue(n,{flow:e,indicator:t,next:s,offset:i,onError:r,parentIndent:o,startOnNewline:a}){let l=!1,c=a,f=a,u="",h="",p=!1,m=!1,d=null,g=null,y=null,b=null,w=null,k=null,S=null;for(const v of n)switch(m&&(v.type!=="space"&&v.type!=="newline"&&v.type!=="comma"&&r(v.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),m=!1),d&&(c&&v.type!=="comment"&&v.type!=="newline"&&r(d,"TAB_AS_INDENT","Tabs are not allowed as indentation"),d=null),v.type){case"space":!e&&(t!=="doc-start"||s?.type!=="flow-collection")&&v.source.includes(" ")&&(d=v),f=!0;break;case"comment":{f||r(v,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const C=v.source.substring(1)||" ";u?u+=h+C:u=C,h="",c=!1;break}case"newline":c?u?u+=v.source:(!k||t!=="seq-item-ind")&&(l=!0):h+=v.source,c=!0,p=!0,(g||y)&&(b=v),f=!0;break;case"anchor":g&&r(v,"MULTIPLE_ANCHORS","A node can have at most one anchor"),v.source.endsWith(":")&&r(v.offset+v.source.length-1,"BAD_ALIAS","Anchor ending in : is ambiguous",!0),g=v,S??(S=v.offset),c=!1,f=!1,m=!0;break;case"tag":{y&&r(v,"MULTIPLE_TAGS","A node can have at most one tag"),y=v,S??(S=v.offset),c=!1,f=!1,m=!0;break}case t:(g||y)&&r(v,"BAD_PROP_ORDER",`Anchors and tags must be after the ${v.source} indicator`),k&&r(v,"UNEXPECTED_TOKEN",`Unexpected ${v.source} in ${e??"collection"}`),k=v,c=t==="seq-item-ind"||t==="explicit-key-ind",f=!1;break;case"comma":if(e){w&&r(v,"UNEXPECTED_TOKEN",`Unexpected , in ${e}`),w=v,c=!1,f=!1;break}default:r(v,"UNEXPECTED_TOKEN",`Unexpected ${v.type} token`),c=!1,f=!1}const A=n[n.length-1],_=A?A.offset+A.source.length:i;return m&&s&&s.type!=="space"&&s.type!=="newline"&&s.type!=="comma"&&(s.type!=="scalar"||s.source!=="")&&r(s.offset,"MISSING_CHAR","Tags and anchors must be separated from the next token by white space"),d&&(c&&d.indent<=o||s?.type==="block-map"||s?.type==="block-seq")&&r(d,"TAB_AS_INDENT","Tabs are not allowed as indentation"),{comma:w,found:k,spaceBefore:l,comment:u,hasNewline:p,anchor:g,tag:y,newlineAfterProp:b,end:_,start:S??_}}function _e(n){if(!n)return null;switch(n.type){case"alias":case"scalar":case"double-quoted-scalar":case"single-quoted-scalar":if(n.source.includes(`
|
|
63
|
-
`))return!0;if(n.end){for(const e of n.end)if(e.type==="newline")return!0}return!1;case"flow-collection":for(const e of n.items){for(const t of e.start)if(t.type==="newline")return!0;if(e.sep){for(const t of e.sep)if(t.type==="newline")return!0}if(_e(e.key)||_e(e.value))return!0}return!1;default:return!0}}function $t(n,e,t){if(e?.type==="flow-collection"){const s=e.end[0];s.indent===n&&(s.source==="]"||s.source==="}")&&_e(e)&&t(s,"BAD_INDENT","Flow end indicator should be more indented than parent",!0)}}function rn(n,e,t){const{uniqueKeys:s}=n.options;if(s===!1)return!1;const i=typeof s=="function"?s:(r,o)=>r===o||L(r)&&L(o)&&r.value===o.value;return e.some(r=>i(r.key,t))}const rs="All mapping items must start at the same column";function Xn({composeNode:n,composeEmptyNode:e},t,s,i,r){const o=r?.nodeClass??P,a=new o(t.schema);t.atRoot&&(t.atRoot=!1);let l=s.offset,c=null;for(const f of s.items){const{start:u,key:h,sep:p,value:m}=f,d=ue(u,{indicator:"explicit-key-ind",next:h??p?.[0],offset:l,onError:i,parentIndent:s.indent,startOnNewline:!0}),g=!d.found;if(g){if(h&&(h.type==="block-seq"?i(l,"BLOCK_AS_IMPLICIT_KEY","A block sequence may not be used as an implicit map key"):"indent"in h&&h.indent!==s.indent&&i(l,"BAD_INDENT",rs)),!d.anchor&&!d.tag&&!p){c=d.end,d.comment&&(a.comment?a.comment+=`
|
|
64
|
-
`+d.comment:a.comment=d.comment);continue}(d.newlineAfterProp||_e(h))&&i(h??u[u.length-1],"MULTILINE_IMPLICIT_KEY","Implicit keys need to be on a single line")}else d.found?.indent!==s.indent&&i(l,"BAD_INDENT",rs);t.atKey=!0;const y=d.end,b=h?n(t,h,d,i):e(t,y,u,null,d,i);t.schema.compat&&$t(s.indent,h,i),t.atKey=!1,rn(t,a.items,b)&&i(y,"DUPLICATE_KEY","Map keys must be unique");const w=ue(p??[],{indicator:"map-value-ind",next:m,offset:b.range[2],onError:i,parentIndent:s.indent,startOnNewline:!h||h.type==="block-scalar"});if(l=w.end,w.found){g&&(m?.type==="block-map"&&!w.hasNewline&&i(l,"BLOCK_AS_IMPLICIT_KEY","Nested mappings are not allowed in compact mappings"),t.options.strict&&d.start<w.found.offset-1024&&i(b.range,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit block mapping key"));const k=m?n(t,m,w,i):e(t,l,p,null,w,i);t.schema.compat&&$t(s.indent,m,i),l=k.range[2];const S=new M(b,k);t.options.keepSourceTokens&&(S.srcToken=f),a.items.push(S)}else{g&&i(b.range,"MISSING_CHAR","Implicit map keys need to be followed by map values"),w.comment&&(b.comment?b.comment+=`
|
|
65
|
-
`+w.comment:b.comment=w.comment);const k=new M(b);t.options.keepSourceTokens&&(k.srcToken=f),a.items.push(k)}}return c&&c<l&&i(c,"IMPOSSIBLE","Map comment with trailing content"),a.range=[s.offset,l,c??l],a}function Zn({composeNode:n,composeEmptyNode:e},t,s,i,r){const o=r?.nodeClass??Q,a=new o(t.schema);t.atRoot&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let l=s.offset,c=null;for(const{start:f,value:u}of s.items){const h=ue(f,{indicator:"seq-item-ind",next:u,offset:l,onError:i,parentIndent:s.indent,startOnNewline:!0});if(!h.found)if(h.anchor||h.tag||u)u?.type==="block-seq"?i(h.end,"BAD_INDENT","All sequence items must start at the same column"):i(l,"MISSING_CHAR","Sequence item without - indicator");else{c=h.end,h.comment&&(a.comment=h.comment);continue}const p=u?n(t,u,h,i):e(t,h.end,f,null,h,i);t.schema.compat&&$t(s.indent,u,i),l=p.range[2],a.items.push(p)}return a.range=[s.offset,l,c??l],a}function Te(n,e,t,s){let i="";if(n){let r=!1,o="";for(const a of n){const{source:l,type:c}=a;switch(c){case"space":r=!0;break;case"comment":{t&&!r&&s(a,"MISSING_CHAR","Comments must be separated from other tokens by white space characters");const f=l.substring(1)||" ";i?i+=o+f:i=f,o="";break}case"newline":i&&(o+=l),r=!0;break;default:s(a,"UNEXPECTED_TOKEN",`Unexpected ${c} at node end`)}e+=l.length}}return{comment:i,offset:e}}const ht="Block collections are not allowed within flow collections",dt=n=>n&&(n.type==="block-map"||n.type==="block-seq");function ei({composeNode:n,composeEmptyNode:e},t,s,i,r){const o=s.start.source==="{",a=o?"flow map":"flow sequence",l=r?.nodeClass??(o?P:Q),c=new l(t.schema);c.flow=!0;const f=t.atRoot;f&&(t.atRoot=!1),t.atKey&&(t.atKey=!1);let u=s.offset+s.start.source.length;for(let g=0;g<s.items.length;++g){const y=s.items[g],{start:b,key:w,sep:k,value:S}=y,A=ue(b,{flow:a,indicator:"explicit-key-ind",next:w??k?.[0],offset:u,onError:i,parentIndent:s.indent,startOnNewline:!1});if(!A.found){if(!A.anchor&&!A.tag&&!k&&!S){g===0&&A.comma?i(A.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`):g<s.items.length-1&&i(A.start,"UNEXPECTED_TOKEN",`Unexpected empty item in ${a}`),A.comment&&(c.comment?c.comment+=`
|
|
66
|
-
`+A.comment:c.comment=A.comment),u=A.end;continue}!o&&t.options.strict&&_e(w)&&i(w,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line")}if(g===0)A.comma&&i(A.comma,"UNEXPECTED_TOKEN",`Unexpected , in ${a}`);else if(A.comma||i(A.start,"MISSING_CHAR",`Missing , between ${a} items`),A.comment){let _="";e:for(const v of b)switch(v.type){case"comma":case"space":break;case"comment":_=v.source.substring(1);break e;default:break e}if(_){let v=c.items[c.items.length-1];$(v)&&(v=v.value??v.key),v.comment?v.comment+=`
|
|
67
|
-
`+_:v.comment=_,A.comment=A.comment.substring(_.length+1)}}if(!o&&!k&&!A.found){const _=S?n(t,S,A,i):e(t,A.end,k,null,A,i);c.items.push(_),u=_.range[2],dt(S)&&i(_.range,"BLOCK_IN_FLOW",ht)}else{t.atKey=!0;const _=A.end,v=w?n(t,w,A,i):e(t,_,b,null,A,i);dt(w)&&i(v.range,"BLOCK_IN_FLOW",ht),t.atKey=!1;const C=ue(k??[],{flow:a,indicator:"map-value-ind",next:S,offset:v.range[2],onError:i,parentIndent:s.indent,startOnNewline:!1});if(C.found){if(!o&&!A.found&&t.options.strict){if(k)for(const T of k){if(T===C.found)break;if(T.type==="newline"){i(T,"MULTILINE_IMPLICIT_KEY","Implicit keys of flow sequence pairs need to be on a single line");break}}A.start<C.found.offset-1024&&i(C.found,"KEY_OVER_1024_CHARS","The : indicator must be at most 1024 chars after the start of an implicit flow sequence key")}}else S&&("source"in S&&S.source?.[0]===":"?i(S,"MISSING_CHAR",`Missing space after : in ${a}`):i(C.start,"MISSING_CHAR",`Missing , or : between ${a} items`));const V=S?n(t,S,C,i):C.found?e(t,C.end,k,null,C,i):null;V?dt(S)&&i(V.range,"BLOCK_IN_FLOW",ht):C.comment&&(v.comment?v.comment+=`
|
|
68
|
-
`+C.comment:v.comment=C.comment);const Z=new M(v,V);if(t.options.keepSourceTokens&&(Z.srcToken=y),o){const T=c;rn(t,T.items,v)&&i(_,"DUPLICATE_KEY","Map keys must be unique"),T.items.push(Z)}else{const T=new P(t.schema);T.flow=!0,T.items.push(Z);const Xt=(V??v).range;T.range=[v.range[0],Xt[1],Xt[2]],c.items.push(T)}u=V?V.range[2]:C.end}}const h=o?"}":"]",[p,...m]=s.end;let d=u;if(p?.source===h)d=p.offset+p.source.length;else{const g=a[0].toUpperCase()+a.substring(1),y=f?`${g} must end with a ${h}`:`${g} in block collection must be sufficiently indented and end with a ${h}`;i(u,f?"MISSING_CHAR":"BAD_INDENT",y),p&&p.source.length!==1&&m.unshift(p)}if(m.length>0){const g=Te(m,d,t.options.strict,i);g.comment&&(c.comment?c.comment+=`
|
|
69
|
-
`+g.comment:c.comment=g.comment),c.range=[s.offset,d,g.offset]}else c.range=[s.offset,d,d];return c}function pt(n,e,t,s,i,r){const o=t.type==="block-map"?Xn(n,e,t,s,r):t.type==="block-seq"?Zn(n,e,t,s,r):ei(n,e,t,s,r),a=o.constructor;return i==="!"||i===a.tagName?(o.tag=a.tagName,o):(i&&(o.tag=i),o)}function ti(n,e,t,s,i){const r=s.tag,o=r?e.directives.tagName(r.source,h=>i(r,"TAG_RESOLVE_FAILED",h)):null;if(t.type==="block-seq"){const{anchor:h,newlineAfterProp:p}=s,m=h&&r?h.offset>r.offset?h:r:h??r;m&&(!p||p.offset<m.offset)&&i(m,"MISSING_CHAR","Missing newline after block sequence props")}const a=t.type==="block-map"?"map":t.type==="block-seq"?"seq":t.start.source==="{"?"map":"seq";if(!r||!o||o==="!"||o===P.tagName&&a==="map"||o===Q.tagName&&a==="seq")return pt(n,e,t,i,o);let l=e.schema.tags.find(h=>h.tag===o&&h.collection===a);if(!l){const h=e.schema.knownTags[o];if(h?.collection===a)e.schema.tags.push(Object.assign({},h,{default:!1})),l=h;else return h?i(r,"BAD_COLLECTION_TYPE",`${h.tag} used for ${a} collection, but expects ${h.collection??"scalar"}`,!0):i(r,"TAG_RESOLVE_FAILED",`Unresolved tag: ${o}`,!0),pt(n,e,t,i,o)}const c=pt(n,e,t,i,o,l),f=l.resolve?.(c,h=>i(r,"TAG_RESOLVE_FAILED",h),e.options)??c,u=N(f)?f:new I(f);return u.range=c.range,u.tag=o,l?.format&&(u.format=l.format),u}function si(n,e,t){const s=e.offset,i=ni(e,n.options.strict,t);if(!i)return{value:"",type:null,comment:"",range:[s,s,s]};const r=i.mode===">"?I.BLOCK_FOLDED:I.BLOCK_LITERAL,o=e.source?ii(e.source):[];let a=o.length;for(let d=o.length-1;d>=0;--d){const g=o[d][1];if(g===""||g==="\r")a=d;else break}if(a===0){const d=i.chomp==="+"&&o.length>0?`
|
|
70
|
-
`.repeat(Math.max(1,o.length-1)):"";let g=s+i.length;return e.source&&(g+=e.source.length),{value:d,type:r,comment:i.comment,range:[s,g,g]}}let l=e.indent+i.indent,c=e.offset+i.length,f=0;for(let d=0;d<a;++d){const[g,y]=o[d];if(y===""||y==="\r")i.indent===0&&g.length>l&&(l=g.length);else{g.length<l&&t(c+g.length,"MISSING_CHAR","Block scalars with more-indented leading empty lines must use an explicit indentation indicator"),i.indent===0&&(l=g.length),f=d,l===0&&!n.atRoot&&t(c,"BAD_INDENT","Block scalar values in collections must be indented");break}c+=g.length+y.length+1}for(let d=o.length-1;d>=a;--d)o[d][0].length>l&&(a=d+1);let u="",h="",p=!1;for(let d=0;d<f;++d)u+=o[d][0].slice(l)+`
|
|
71
|
-
`;for(let d=f;d<a;++d){let[g,y]=o[d];c+=g.length+y.length+1;const b=y[y.length-1]==="\r";if(b&&(y=y.slice(0,-1)),y&&g.length<l){const k=`Block scalar lines must not be less indented than their ${i.indent?"explicit indentation indicator":"first line"}`;t(c-y.length-(b?2:1),"BAD_INDENT",k),g=""}r===I.BLOCK_LITERAL?(u+=h+g.slice(l)+y,h=`
|
|
72
|
-
`):g.length>l||y[0]===" "?(h===" "?h=`
|
|
73
|
-
`:!p&&h===`
|
|
74
|
-
`&&(h=`
|
|
75
|
-
|
|
76
|
-
`),u+=h+g.slice(l)+y,h=`
|
|
77
|
-
`,p=!0):y===""?h===`
|
|
78
|
-
`?u+=`
|
|
79
|
-
`:h=`
|
|
80
|
-
`:(u+=h+y,h=" ",p=!1)}switch(i.chomp){case"-":break;case"+":for(let d=a;d<o.length;++d)u+=`
|
|
81
|
-
`+o[d][0].slice(l);u[u.length-1]!==`
|
|
82
|
-
`&&(u+=`
|
|
83
|
-
`);break;default:u+=`
|
|
84
|
-
`}const m=s+i.length+e.source.length;return{value:u,type:r,comment:i.comment,range:[s,m,m]}}function ni({offset:n,props:e},t,s){if(e[0].type!=="block-scalar-header")return s(e[0],"IMPOSSIBLE","Block scalar header not found"),null;const{source:i}=e[0],r=i[0];let o=0,a="",l=-1;for(let h=1;h<i.length;++h){const p=i[h];if(!a&&(p==="-"||p==="+"))a=p;else{const m=Number(p);!o&&m?o=m:l===-1&&(l=n+h)}}l!==-1&&s(l,"UNEXPECTED_TOKEN",`Block scalar header includes extra characters: ${i}`);let c=!1,f="",u=i.length;for(let h=1;h<e.length;++h){const p=e[h];switch(p.type){case"space":c=!0;case"newline":u+=p.source.length;break;case"comment":t&&!c&&s(p,"MISSING_CHAR","Comments must be separated from other tokens by white space characters"),u+=p.source.length,f=p.source.substring(1);break;case"error":s(p,"UNEXPECTED_TOKEN",p.message),u+=p.source.length;break;default:{const m=`Unexpected token in block scalar header: ${p.type}`;s(p,"UNEXPECTED_TOKEN",m);const d=p.source;d&&typeof d=="string"&&(u+=d.length)}}}return{mode:r,indent:o,chomp:a,comment:f,length:u}}function ii(n){const e=n.split(/\n( *)/),t=e[0],s=t.match(/^( *)/),r=[s?.[1]?[s[1],t.slice(s[1].length)]:["",t]];for(let o=1;o<e.length;o+=2)r.push([e[o],e[o+1]]);return r}function ri(n,e,t){const{offset:s,type:i,source:r,end:o}=n;let a,l;const c=(h,p,m)=>t(s+h,p,m);switch(i){case"scalar":a=I.PLAIN,l=oi(r,c);break;case"single-quoted-scalar":a=I.QUOTE_SINGLE,l=ai(r,c);break;case"double-quoted-scalar":a=I.QUOTE_DOUBLE,l=li(r,c);break;default:return t(n,"UNEXPECTED_TOKEN",`Expected a flow scalar value, but found: ${i}`),{value:"",type:null,comment:"",range:[s,s+r.length,s+r.length]}}const f=s+r.length,u=Te(o,f,e,t);return{value:l,type:a,comment:u.comment,range:[s,f,u.offset]}}function oi(n,e){let t="";switch(n[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 ${n[0]}`;break}case"@":case"`":{t=`reserved character ${n[0]}`;break}}return t&&e(0,"BAD_SCALAR_START",`Plain value cannot start with ${t}`),on(n)}function ai(n,e){return(n[n.length-1]!=="'"||n.length===1)&&e(n.length,"MISSING_CHAR","Missing closing 'quote"),on(n.slice(1,-1)).replace(/''/g,"'")}function on(n){let e,t;try{e=new RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
85
|
-
`,"sy"),t=new RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
86
|
-
`,"sy")}catch{e=/(.*?)[ \t]*\r?\n/sy,t=/[ \t]*(.*?)[ \t]*\r?\n/sy}let s=e.exec(n);if(!s)return n;let i=s[1],r=" ",o=e.lastIndex;for(t.lastIndex=o;s=t.exec(n);)s[1]===""?r===`
|
|
87
|
-
`?i+=r:r=`
|
|
88
|
-
`:(i+=r+s[1],r=" "),o=t.lastIndex;const a=/[ \t]*(.*)/sy;return a.lastIndex=o,s=a.exec(n),i+r+(s?.[1]??"")}function li(n,e){let t="";for(let s=1;s<n.length-1;++s){const i=n[s];if(!(i==="\r"&&n[s+1]===`
|
|
89
|
-
`))if(i===`
|
|
90
|
-
`){const{fold:r,offset:o}=ci(n,s);t+=r,s=o}else if(i==="\\"){let r=n[++s];const o=fi[r];if(o)t+=o;else if(r===`
|
|
91
|
-
`)for(r=n[s+1];r===" "||r===" ";)r=n[++s+1];else if(r==="\r"&&n[s+1]===`
|
|
92
|
-
`)for(r=n[++s+1];r===" "||r===" ";)r=n[++s+1];else if(r==="x"||r==="u"||r==="U"){const a={x:2,u:4,U:8}[r];t+=ui(n,s+1,a,e),s+=a}else{const a=n.substr(s-1,2);e(s-1,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),t+=a}}else if(i===" "||i===" "){const r=s;let o=n[s+1];for(;o===" "||o===" ";)o=n[++s+1];o!==`
|
|
93
|
-
`&&!(o==="\r"&&n[s+2]===`
|
|
94
|
-
`)&&(t+=s>r?n.slice(r,s+1):i)}else t+=i}return(n[n.length-1]!=='"'||n.length===1)&&e(n.length,"MISSING_CHAR",'Missing closing "quote'),t}function ci(n,e){let t="",s=n[e+1];for(;(s===" "||s===" "||s===`
|
|
95
|
-
`||s==="\r")&&!(s==="\r"&&n[e+2]!==`
|
|
96
|
-
`);)s===`
|
|
97
|
-
`&&(t+=`
|
|
98
|
-
`),e+=1,s=n[e+1];return t||(t=" "),{fold:t,offset:e}}const fi={0:"\0",a:"\x07",b:"\b",e:"\x1B",f:"\f",n:`
|
|
99
|
-
`,r:"\r",t:" ",v:"\v",N:"
",_:" ",L:"\u2028",P:"\u2029"," ":" ",'"':'"',"/":"/","\\":"\\"," ":" "};function ui(n,e,t,s){const i=n.substr(e,t),o=i.length===t&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(o)){const a=n.substr(e-2,t+2);return s(e-2,"BAD_DQ_ESCAPE",`Invalid escape sequence ${a}`),a}return String.fromCodePoint(o)}function an(n,e,t,s){const{value:i,type:r,comment:o,range:a}=e.type==="block-scalar"?si(n,e,s):ri(e,n.options.strict,s),l=t?n.directives.tagName(t.source,u=>s(t,"TAG_RESOLVE_FAILED",u)):null;let c;n.options.stringKeys&&n.atKey?c=n.schema[D]:l?c=hi(n.schema,i,l,t,s):e.type==="scalar"?c=di(n,i,e,s):c=n.schema[D];let f;try{const u=c.resolve(i,h=>s(t??e,"TAG_RESOLVE_FAILED",h),n.options);f=L(u)?u:new I(u)}catch(u){const h=u instanceof Error?u.message:String(u);s(t??e,"TAG_RESOLVE_FAILED",h),f=new I(i)}return f.range=a,f.source=i,r&&(f.type=r),l&&(f.tag=l),c.format&&(f.format=c.format),o&&(f.comment=o),f}function hi(n,e,t,s,i){if(t==="!")return n[D];const r=[];for(const a of n.tags)if(!a.collection&&a.tag===t)if(a.default&&a.test)r.push(a);else return a;for(const a of r)if(a.test?.test(e))return a;const o=n.knownTags[t];return o&&!o.collection?(n.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(s,"TAG_RESOLVE_FAILED",`Unresolved tag: ${t}`,t!=="tag:yaml.org,2002:str"),n[D])}function di({atKey:n,directives:e,schema:t},s,i,r){const o=t.tags.find(a=>(a.default===!0||n&&a.default==="key")&&a.test?.test(s))||t[D];if(t.compat){const a=t.compat.find(l=>l.default&&l.test?.test(s))??t[D];if(o.tag!==a.tag){const l=e.tagString(o.tag),c=e.tagString(a.tag),f=`Value may be parsed as either ${l} or ${c}`;r(i,"TAG_RESOLVE_FAILED",f,!0)}}return o}function pi(n,e,t){if(e){t??(t=e.length);for(let s=t-1;s>=0;--s){let i=e[s];switch(i.type){case"space":case"comment":case"newline":n-=i.source.length;continue}for(i=e[++s];i?.type==="space";)n+=i.source.length,i=e[++s];break}}return n}const gi={composeNode:ln,composeEmptyNode:Jt};function ln(n,e,t,s){const i=n.atKey,{spaceBefore:r,comment:o,anchor:a,tag:l}=t;let c,f=!0;switch(e.type){case"alias":c=mi(n,e,s),(a||l)&&s(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=an(n,e,l,s),a&&(c.anchor=a.source.substring(1));break;case"block-map":case"block-seq":case"flow-collection":try{c=ti(gi,n,e,t,s),a&&(c.anchor=a.source.substring(1))}catch(u){const h=u instanceof Error?u.message:String(u);s(e,"RESOURCE_EXHAUSTION",h)}break;default:{const u=e.type==="error"?e.message:`Unsupported token (type: ${e.type})`;s(e,"UNEXPECTED_TOKEN",u),f=!1}}return c??(c=Jt(n,e.offset,void 0,null,t,s)),a&&c.anchor===""&&s(a,"BAD_ALIAS","Anchor cannot be an empty string"),i&&n.options.stringKeys&&(!L(c)||typeof c.value!="string"||c.tag&&c.tag!=="tag:yaml.org,2002:str")&&s(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),n.options.keepSourceTokens&&f&&(c.srcToken=e),c}function Jt(n,e,t,s,{spaceBefore:i,comment:r,anchor:o,tag:a,end:l},c){const f={type:"scalar",offset:pi(e,t,s),indent:-1,source:""},u=an(n,f,a,c);return o&&(u.anchor=o.source.substring(1),u.anchor===""&&c(o,"BAD_ALIAS","Anchor cannot be an empty string")),i&&(u.spaceBefore=!0),r&&(u.comment=r,u.range[2]=l),u}function mi({options:n},{offset:e,source:t,end:s},i){const r=new xt(t.substring(1));r.source===""&&i(e,"BAD_ALIAS","Alias cannot be an empty string"),r.source.endsWith(":")&&i(e+t.length-1,"BAD_ALIAS","Alias ending in : is ambiguous",!0);const o=e+t.length,a=Te(s,o,n.strict,i);return r.range=[e,o,a.offset],a.comment&&(r.comment=a.comment),r}function yi(n,e,{offset:t,start:s,value:i,end:r},o){const a=Object.assign({_directives:e},n),l=new at(void 0,a),c={atKey:!1,atRoot:!0,directives:l.directives,options:l.options,schema:l.schema},f=ue(s,{indicator:"doc-start",next:i??r?.[0],offset:t,onError:o,parentIndent:0,startOnNewline:!0});f.found&&(l.directives.docStart=!0,i&&(i.type==="block-map"||i.type==="block-seq")&&!f.hasNewline&&o(f.end,"MISSING_CHAR","Block collection cannot start on same line with directives-end marker")),l.contents=i?ln(c,i,f,o):Jt(c,f.end,s,null,f,o);const u=l.contents.range[2],h=Te(r,u,!1,o);return h.comment&&(l.comment=h.comment),l.range=[t,u,h.offset],l}function me(n){if(typeof n=="number")return[n,n+1];if(Array.isArray(n))return n.length===2?n:[n[0],n[1]];const{offset:e,source:t}=n;return[e,e+(typeof t=="string"?t.length:1)]}function os(n){let e="",t=!1,s=!1;for(let i=0;i<n.length;++i){const r=n[i];switch(r[0]){case"#":e+=(e===""?"":s?`
|
|
100
|
-
|
|
101
|
-
`:`
|
|
102
|
-
`)+(r.substring(1)||" "),t=!0,s=!1;break;case"%":n[i+1]?.[0]!=="#"&&(i+=1),t=!1;break;default:t||(s=!0),t=!1}}return{comment:e,afterEmptyLine:s}}class bi{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(t,s,i,r)=>{const o=me(t);r?this.warnings.push(new Qn(o,s,i)):this.errors.push(new be(o,s,i))},this.directives=new E({version:e.version||"1.2"}),this.options=e}decorate(e,t){const{comment:s,afterEmptyLine:i}=os(this.prelude);if(s){const r=e.contents;if(t)e.comment=e.comment?`${e.comment}
|
|
103
|
-
${s}`:s;else if(i||e.directives.docStart||!r)e.commentBefore=s;else if(O(r)&&!r.flow&&r.items.length>0){let o=r.items[0];$(o)&&(o=o.key);const a=o.commentBefore;o.commentBefore=a?`${s}
|
|
104
|
-
${a}`:s}else{const o=r.commentBefore;r.commentBefore=o?`${s}
|
|
105
|
-
${o}`:s}}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:os(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,s=-1){for(const i of e)yield*this.next(i);yield*this.end(t,s)}*next(e){switch(e.type){case"directive":this.directives.add(e.source,(t,s,i)=>{const r=me(e);r[0]+=t,this.onError(r,"BAD_DIRECTIVE",s,i)}),this.prelude.push(e.source),this.atDirectives=!0;break;case"document":{const t=yi(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":{const t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,s=new be(me(e),"UNEXPECTED_TOKEN",t);this.atDirectives||!this.doc?this.errors.push(s):this.doc.errors.push(s);break}case"doc-end":{if(!this.doc){const s="Unexpected doc-end without preceding document";this.errors.push(new be(me(e),"UNEXPECTED_TOKEN",s));break}this.doc.directives.docEnd=!0;const t=Te(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){const s=this.doc.comment;this.doc.comment=s?`${s}
|
|
106
|
-
${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new be(me(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){const s=Object.assign({_directives:this.directives},this.options),i=new at(void 0,s);this.atDirectives&&this.onError(t,"MISSING_CHAR","Missing directives-end indicator line"),i.range=[0,t,t],this.decorate(i,!1),yield i}}}const cn="\uFEFF",fn="",un="",Ct="";function wi(n){switch(n){case cn:return"byte-order-mark";case fn:return"doc-mode";case un:return"flow-error-end";case Ct:return"scalar";case"---":return"doc-start";case"...":return"doc-end";case"":case`
|
|
107
|
-
`:case`\r
|
|
108
|
-
`: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(n[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}function R(n){switch(n){case void 0:case" ":case`
|
|
109
|
-
`:case"\r":case" ":return!0;default:return!1}}const as=new Set("0123456789ABCDEFabcdef"),ki=new Set("0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()"),Pe=new Set(",[]{}"),Si=new Set(` ,[]{}
|
|
110
|
-
\r `),gt=n=>!n||Si.has(n);class vi{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 s=this.next??"stream";for(;s&&(t||this.hasChars(1));)s=yield*this.parseNext(s)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===" "||t===" ";)t=this.buffer[++e];return!t||t==="#"||t===`
|
|
111
|
-
`?!0:t==="\r"?this.buffer[e+1]===`
|
|
112
|
-
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let s=0;for(;t===" ";)t=this.buffer[++s+e];if(t==="\r"){const i=this.buffer[s+e+1];if(i===`
|
|
113
|
-
`||!i&&!this.atEnd)return e+s+1}return t===`
|
|
114
|
-
`||s>=this.indentNext||!t&&!this.atEnd?e+s:-1}if(t==="-"||t==="."){const s=this.buffer.substr(e,3);if((s==="---"||s==="...")&&R(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(`
|
|
115
|
-
`,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]===cn&&(yield*this.pushCount(1),e=e.substring(1)),e[0]==="%"){let t=e.length,s=e.indexOf("#");for(;s!==-1;){const r=e[s-1];if(r===" "||r===" "){t=s-1;break}else s=e.indexOf("#",s+1)}for(;;){const r=e[t-1];if(r===" "||r===" ")t-=1;else break}const i=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-i),this.pushNewline(),"stream"}if(this.atLineEnd()){const t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),"stream"}return yield fn,yield*this.parseLineStart()}*parseLineStart(){const 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");const t=this.peek(3);if((t==="---"||t==="...")&&R(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&&!R(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){const[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext("block-start");if((e==="-"||e==="?"||e===":")&&R(t)){const s=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=s,yield*this.parseBlockStart()}return"doc"}*parseDocument(){yield*this.pushSpaces(!0);const 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(gt),"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,s=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=s=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);const i=this.getLine();if(i===null)return this.setNext("flow");if((s!==-1&&s<this.indentNext&&i[0]!=="#"||s===0&&(i.startsWith("---")||i.startsWith("..."))&&R(i[3]))&&!(s===this.indentNext-1&&this.flowLevel===1&&(i[0]==="]"||i[0]==="}")))return this.flowLevel=0,yield un,yield*this.parseLineStart();let r=0;for(;i[r]===",";)r+=yield*this.pushCount(1),r+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(r+=yield*this.pushIndicators(),i[r]){case void 0:return"flow";case"#":return yield*this.pushCount(i.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(gt),"flow";case'"':case"'":return this.flowKey=!0,yield*this.parseQuotedScalar();case":":{const o=this.charAt(1);if(this.flowKey||R(o)||o===",")return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),"flow"}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){const e=this.charAt(0);let 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)}const s=this.buffer.substring(0,t);let i=s.indexOf(`
|
|
116
|
-
`,this.pos);if(i!==-1){for(;i!==-1;){const r=this.continueScalar(i+1);if(r===-1)break;i=s.indexOf(`
|
|
117
|
-
`,r)}i!==-1&&(t=i-(s[i-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(;;){const 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=>R(t)||t==="#")}*parseBlockScalar(){let e=this.pos-1,t=0,s;e:for(let r=this.pos;s=this.buffer[r];++r)switch(s){case" ":t+=1;break;case`
|
|
118
|
-
`:e=r,t=0;break;case"\r":{const o=this.buffer[r+1];if(!o&&!this.atEnd)return this.setNext("block-scalar");if(o===`
|
|
119
|
-
`)break}default:break e}if(!s&&!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{const r=this.continueScalar(e+1);if(r===-1)break;e=this.buffer.indexOf(`
|
|
120
|
-
`,r)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext("block-scalar");e=this.buffer.length}}let i=e+1;for(s=this.buffer[i];s===" ";)s=this.buffer[++i];if(s===" "){for(;s===" "||s===" "||s==="\r"||s===`
|
|
121
|
-
`;)s=this.buffer[++i];e=i-1}else if(!this.blockScalarKeep)do{let r=e-1,o=this.buffer[r];o==="\r"&&(o=this.buffer[--r]);const a=r;for(;o===" ";)o=this.buffer[--r];if(o===`
|
|
122
|
-
`&&r>=this.pos&&r+1+t>a)e=r;else break}while(!0);return yield Ct,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){const e=this.flowLevel>0;let t=this.pos-1,s=this.pos-1,i;for(;i=this.buffer[++s];)if(i===":"){const r=this.buffer[s+1];if(R(r)||e&&Pe.has(r))break;t=s}else if(R(i)){let r=this.buffer[s+1];if(i==="\r"&&(r===`
|
|
123
|
-
`?(s+=1,i=`
|
|
124
|
-
`,r=this.buffer[s+1]):t=s),r==="#"||e&&Pe.has(r))break;if(i===`
|
|
125
|
-
`){const o=this.continueScalar(s+1);if(o===-1)break;s=Math.max(s,o-2)}}else{if(e&&Pe.has(i))break;t=s}return!i&&!this.atEnd?this.setNext("plain-scalar"):(yield Ct,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){const s=this.buffer.slice(this.pos,e);return s?(yield s,this.pos+=s.length,s.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(gt))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case"-":case"?":case":":{const e=this.flowLevel>0,t=this.charAt(1);if(R(t)||e&&Pe.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(;!R(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(ki.has(t))t=this.buffer[++e];else if(t==="%"&&as.has(this.buffer[e+1])&&as.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){const e=this.buffer[this.pos];return e===`
|
|
126
|
-
`?yield*this.pushCount(1):e==="\r"&&this.charAt(1)===`
|
|
127
|
-
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,s;do s=this.buffer[++t];while(s===" "||e&&s===" ");const i=t-this.pos;return i>0&&(yield this.buffer.substr(this.pos,i),this.pos=t),i}*pushUntil(e){let t=this.pos,s=this.buffer[t];for(;!e(s);)s=this.buffer[++t];return yield*this.pushToIndex(t,!1)}}class Ai{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,s=this.lineStarts.length;for(;t<s;){const r=t+s>>1;this.lineStarts[r]<e?t=r+1:s=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};const i=this.lineStarts[t-1];return{line:t,col:e-i+1}}}}function H(n,e){for(let t=0;t<n.length;++t)if(n[t].type===e)return!0;return!1}function ls(n){for(let e=0;e<n.length;++e)switch(n[e].type){case"space":case"comment":case"newline":break;default:return e}return-1}function hn(n){switch(n?.type){case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":case"flow-collection":return!0;default:return!1}}function je(n){switch(n.type){case"document":return n.start;case"block-map":{const e=n.items[n.items.length-1];return e.sep??e.start}case"block-seq":return n.items[n.items.length-1].start;default:return[]}}function te(n){if(n.length===0)return[];let e=n.length;e:for(;--e>=0;)switch(n[e].type){case"doc-start":case"explicit-key-ind":case"map-value-ind":case"seq-item-ind":case"newline":break e}for(;n[++e]?.type==="space";);return n.splice(e,n.length)}function cs(n){if(n.start.type==="flow-seq-start")for(const e of n.items)e.sep&&!e.value&&!H(e.start,"explicit-key-ind")&&!H(e.sep,"map-value-ind")&&(e.key&&(e.value=e.key),delete e.key,hn(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)}class Ii{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 vi,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(const s of this.lexer.lex(e,t))yield*this.next(s);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}const t=wi(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{const s=`Not a YAML token: ${e}`;yield*this.pop({type:"error",offset:this.offset,message:s,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(){const e=this.peek(1);if(this.type==="doc-end"&&e?.type!=="doc-end"){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:"doc-end",offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case"document":return yield*this.document(e);case"alias":case"scalar":case"single-quoted-scalar":case"double-quoted-scalar":return yield*this.scalar(e);case"block-scalar":return yield*this.blockScalar(e);case"block-map":return yield*this.blockMap(e);case"block-seq":return yield*this.blockSequence(e);case"flow-collection":return yield*this.flowCollection(e);case"doc-end":return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){const 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{const s=this.peek(1);switch(t.type==="block-scalar"?t.indent="indent"in s?s.indent:0:t.type==="flow-collection"&&s.type==="document"&&(t.indent=0),t.type==="flow-collection"&&cs(t),s.type){case"document":s.value=t;break;case"block-scalar":s.props.push(t);break;case"block-map":{const i=s.items[s.items.length-1];if(i.value){s.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}else if(i.sep)i.value=t;else{Object.assign(i,{key:t,sep:[]}),this.onKeyLine=!i.explicitKey;return}break}case"block-seq":{const i=s.items[s.items.length-1];i.value?s.items.push({start:[],value:t}):i.value=t;break}case"flow-collection":{const i=s.items[s.items.length-1];!i||i.value?s.items.push({start:[],key:t,sep:[]}):i.sep?i.value=t:Object.assign(i,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((s.type==="document"||s.type==="block-map"||s.type==="block-seq")&&(t.type==="block-map"||t.type==="block-seq")){const i=t.items[t.items.length-1];i&&!i.sep&&!i.value&&i.start.length>0&&ls(i.start)===-1&&(t.indent===0||i.start.every(r=>r.type!=="comment"||r.indent<t.indent))&&(s.type==="document"?s.end=i.start:s.items.push({start:i.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":{const 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":{ls(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}const 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"){const t=je(this.peek(2)),s=te(t);let i;e.end?(i=e.end,i.push(this.sourceToken),delete e.end):i=[this.sourceToken];const r={type:"block-map",offset:e.offset,indent:e.indent,items:[{start:s,key:e,sep:i}]};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(`
|
|
128
|
-
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
129
|
-
`,t)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){const t=e.items[e.items.length-1];switch(this.type){case"newline":if(this.onKeyLine=!1,t.value){const s="end"in t.value?t.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.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)){const i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,t.start),i.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){const s=!this.onKeyLine&&this.indent===e.indent,i=s&&(t.sep||t.explicitKey)&&this.type!=="seq-item-ind";let r=[];if(i&&t.sep&&!t.value){const o=[];for(let a=0;a<t.sep.length;++a){const 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":i||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):i||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(H(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(hn(t.key)&&!H(t.sep,"newline")){const o=te(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(H(t.start,"newline"))Object.assign(t,{key:null,sep:[this.sourceToken]});else{const o=te(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||i?e.items.push({start:r,key:null,sep:[this.sourceToken]}):H(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":{const o=this.flowScalar(this.type);i||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:{const o=this.startBlockValue(e);if(o){if(o.type==="block-seq"){if(!t.explicitKey&&t.sep&&!H(t.sep,"newline")){yield*this.pop({type:"error",offset:this.offset,message:"Unexpected block-seq-ind on same line with key",source:this.source});return}}else s&&e.items.push({start:r});this.stack.push(o);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){const t=e.items[e.items.length-1];switch(this.type){case"newline":if(t.value){const s="end"in t.value?t.value.end:void 0;(Array.isArray(s)?s[s.length-1]:void 0)?.type==="comment"?s?.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)){const i=e.items[e.items.length-2]?.value?.end;if(Array.isArray(i)){Array.prototype.push.apply(i,t.start),i.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||H(t.start,"seq-item-ind")?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){const s=this.startBlockValue(e);if(s){this.stack.push(s);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){const t=e.items[e.items.length-1];if(this.type==="flow-error-end"){let s;do yield*this.pop(),s=this.peek(1);while(s?.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":{const i=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:i,sep:[]}):t.sep?this.stack.push(i):Object.assign(t,{key:i,sep:[]});return}case"flow-map-end":case"flow-seq-end":e.end.push(this.sourceToken);return}const s=this.startBlockValue(e);s?this.stack.push(s):(yield*this.pop(),yield*this.step())}else{const s=this.peek(2);if(s.type==="block-map"&&(this.type==="map-value-ind"&&s.indent===e.indent||this.type==="newline"&&!s.items[s.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type==="map-value-ind"&&s.type!=="flow-collection"){const i=je(s),r=te(i);cs(e);const o=e.end.splice(1,e.end.length);o.push(this.sourceToken);const 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(`
|
|
130
|
-
`)+1;for(;t!==0;)this.onNewLine(this.offset+t),t=this.source.indexOf(`
|
|
131
|
-
`,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;const t=je(e),s=te(t);return s.push(this.sourceToken),{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,explicitKey:!0}]}}case"map-value-ind":{this.onKeyLine=!0;const t=je(e),s=te(t);return{type:"block-map",offset:this.offset,indent:this.indent,items:[{start:s,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!=="comment"||this.indent<=t?!1:e.every(s=>s.type==="newline"||s.type==="space")}*documentEnd(e){this.type!=="doc-mode"&&(e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop()))}*lineEnd(e){switch(this.type){case"comma":case"doc-start":case"doc-end":case"flow-seq-end":case"flow-map-end":case"map-value-ind":yield*this.pop(),yield*this.step();break;case"newline":this.onKeyLine=!1;default:e.end?e.end.push(this.sourceToken):e.end=[this.sourceToken],this.type==="newline"&&(yield*this.pop())}}}function _i(n){const e=n.prettyErrors!==!1;return{lineCounter:n.lineCounter||e&&new Ai||null,prettyErrors:e}}function Li(n,e={}){const{lineCounter:t,prettyErrors:s}=_i(e),i=new Ii(t?.addNewLine),r=new bi(e);let o=null;for(const a of r.compose(i.parse(n),!0,n.length))if(!o)o=a;else if(o.options.logLevel!=="silent"){o.errors.push(new be(a.range.slice(0,2),"MULTIPLE_DOCS","Source contains multiple documents; please use YAML.parseAllDocuments()"));break}return s&&t&&(o.errors.forEach(is(n,t)),o.warnings.forEach(is(n,t))),o}function Oi(n,e,t){let s;const i=Li(n,t);if(!i)return null;if(i.warnings.forEach(r=>Rs(i.options.logLevel,r)),i.errors.length>0){if(i.options.logLevel!=="silent")throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:s},t))}function Ni(n,e){const{language:t,tag:s,data:i}=e||{};if(!s)return n;if(i!==void 0)return i;const r=(t||"").toLowerCase();if(r==="json")try{return JSON.parse(n)}catch{return n}if(r==="yaml"||r==="yml")try{return Oi(n)}catch{return n}return n}function Le(n){return n.type==="UniwebIcon"||n.type==="image"&&n.attrs?.role==="icon"}function Tt(n,e={}){const t=[];return $i(n,t,e),t}function $i(n,e,t){n.content&&Array.isArray(n.content)&&n.content?.forEach(s=>{const i=Ci(s,t);i&&(Array.isArray(i)?e.push(...i):e.push(i))})}function Ci(n,e={}){const t=n.attrs,s=n.content,i=Ri(n);if(i)return{type:"link",attrs:i};const r=Fi(n);if(r)return r;const o=Di(n);if(o)return o;switch(n.type){case"heading":return{type:"heading",level:n.attrs.level,text:ne(s,e),children:ve(s),attrs:t};case"paragraph":return{type:"paragraph",text:ne(s,e),children:ve(s),attrs:t};case"blockquote":return{type:"blockquote",children:Tt({content:s}),attrs:t};case"dataBlock":return{type:"dataBlock",data:t.data,tag:t.tag};case"codeBlock":{const l=ne(s,e);return t?.tag?{type:"dataBlock",tag:t.tag,data:Ni(l,t)}:{type:"codeBlock",text:l,attrs:t}}case"inset_placeholder":return{type:"inset",refId:t.refId};case"math_display":return{type:"math_display",latex:n.attrs?.latex||"",mathml:n.attrs?.mathml||"",attrs:t};case"ImageBlock":return{type:"image",attrs:Pi(t)};case"image":return{type:"image",attrs:t||{}};case"Video":return{type:"video",attrs:ji(t)};case"bulletList":case"orderedList":{const l=s.map(c=>c.type==="listItem"&&c.content?c.content:null).filter(Boolean);return{type:"list",style:n.type==="bulletList"?"bullet":"ordered",children:l.map(c=>Tt({content:c})),attrs:t}}case"DividerBlock":case"horizontalRule":return{type:"divider"};case"card-group":return{type:"card-group",cards:n.content?.filter(l=>l.type==="card"&&!l.attrs?.hidden).map(l=>Ei(l.attrs))||[]};case"document-group":return{type:"document-group",documents:n.content?.filter(l=>l.type==="document").map(l=>Mi(l.attrs))||[]};case"FormBlock":let a=t?.data;if(typeof a=="string")try{a=JSON.parse(a)}catch{}return{type:"form",schemaId:t?.activeSchemaId||null,data:a,attrs:t};case"button":{let l=ne(s,e);return l?{type:"button",text:l,children:ve(s),attrs:t}:null}case"UniwebIcon":return{type:"icon",attrs:lt(t)};case"Icon":return{type:"icon",attrs:Bi(t)};default:return{type:n.type,content:ne(s,e)}}}function ne(n,e={}){return n?n.reduce((t,s)=>{const{type:i,marks:r=[],text:o}=s;if(i==="text"){let a=o||"";if(r.some(l=>l.type==="textStyle")){const l=r.find(c=>c.type==="textStyle")?.attrs?.color;l&&(a=`<span style="color: var(--${l})">${a}</span>`)}if(r.some(l=>l.type==="highlight")&&(a=`<span style="background-color: var(--highlight)">${a}</span>`),r.some(l=>l.type==="span")){const c=r.find(p=>p.type==="span")?.attrs||{},f=[],u=[];c.class&&f.push(`class="${c.class}"`),c.id&&f.push(`id="${c.id}"`);for(const[p,m]of Object.entries(c))p==="class"||p==="id"||(p==="color"?u.push(`color: ${m}`):p==="bg"?u.push(`background: ${m}`):f.push(`${p}="${m}"`));u.length>0&&f.push(`style="${u.join("; ")}"`),a=`<span${f.length>0?` ${f.join(" ")}`:""}>${a}</span>`}if(r.some(l=>l.type==="bold")&&(a=`<strong>${a}</strong>`),r.some(l=>l.type==="italic")&&(a=`<em>${a}</em>`),r.some(l=>l.type==="link")){const l=r.find(m=>m.type==="link"),c=l.attrs.href,f=l.attrs.target||"_self",u=["pdf","doc","docx","xls","xlsx","ppt","pptx","jpg","jpeg","png","webp","gif","svg","mp4","mp3","wav","mov","zip"],h=c.split(".").pop()?.toLowerCase(),p=u.includes(h);a=`<a href="${c}" target="${f}"${p?" download":""}>${a}</a>`}return t+a}else return i==="math_inline"?t+(s.attrs?.mathml||""):i==="hardBreak"?t+"<br>":t},"").trim():""}function ve(n){if(!n)return[];const e=[];for(const t of n)if(Le(t))e.push({type:"icon",attrs:lt(t.attrs)});else if(t.type==="math-inline")e.push(t);else if(t.type==="text"&&t.marks){const s=t.marks.find(i=>i.type==="link");s&&e.push({type:"link",attrs:{...s.attrs,label:t.text||""}})}return e}const Ti="https://assets.uniweb.app/";function dn(n){if(!n||typeof n!="string")return"";const[e,t]=n.split("/");if(!t)return"";const s=t.substring(t.lastIndexOf(".")+1);return`${Ti}dist/${e}/base.${s}`}function Oe(n){const e=n?.src||n?.url||"";return e||(n?.identifier?dn(n.identifier):"")}function Ei(n){const{address:e,...t}=n;let s=null;try{e&&(s=JSON.parse(e))}catch{}const{coverImg:i=null,icon:r}=t;return r&&(t.icon=lt(r)),{...t,address:s,coverImg:Oe(i)}}function Mi(n){const{src:e,info:t={},coverImg:s=null,...i}=n;let r={...i,coverImg:Oe(s)};if(e)r.href=e;else{const{identifier:o=""}=t;o&&(r.downloadUrl=dn(o))}return r}function lt(n){const{svg:e,url:t,size:s,color:i,preserveColors:r,href:o,target:a,library:l,name:c}=n||{},f={};return e&&(f.svg=e),t&&(f.url=t),s&&(f.size=s),i&&(f.color=i),r&&(f.preserveColors=r),o&&(f.href=o),a&&(f.target=a),l&&(f.library=l),c&&(f.name=c),f}function Bi(n){let{svg:e}=n;return e}function Pi(n){let{info:e,targetId:t,caption:s="",direction:i,filter:r,alt:o="",url:a,href:l="",target:c="",theme:f,role:u,credit:h=""}=n,{contentType:p,viewType:m,contentId:d,identifier:g}=e||{};const y={center:"basic",wide:"lg",fill:"full"};return s=xi(s),g&&(a=Oe(e)),{contentType:p,viewType:m,contentId:t||d,url:a,value:g||"",alt:o||s,caption:s,direction:i,filter:r,imgPos:i==="left"||i==="right"?i:"",size:y[i]||"basic",href:l,target:c,theme:f,role:u,credit:h}}function ji(n){let{src:e,caption:t="",direction:s,info:i={},coverImg:r={},alt:o,href:a="",target:l=""}=n;return{src:Oe({src:e,...i}),caption:t,direction:s,coverImg:Oe(r),alt:o,href:a,target:l}}function xi(n){if(!n||typeof n!="string")return"";const e=n.replace(/<[^>]*>/g,"");return new DOMParser().parseFromString(e,"text/html").body.textContent}function Ri(n){if(["paragraph","heading"].includes(n.type)){const e=n?.content||[],t=e.filter(s=>Le(s)?!1:s.type==="text"?(s.text||"").trim()!=="":!0);if(t.length===1){let s=t[0],i=s?.marks||[];for(let r=0;r<i.length;r++){let o=i[r];if(o?.type==="link"){const a=e.findIndex(f=>f.type==="text"&&f.text===s.text);let l=null,c=null;for(let f=0;f<e.length;f++)if(Le(e[f])){const u=lt(e[f].attrs);f<a?l=u:f>a&&(c||(c=u))}return{...o?.attrs,label:s?.text||"",iconBefore:l,iconAfter:c,children:ve(e)}}}}}return!1}function Fi(n){if(n.type!=="paragraph")return!1;const e=n?.content||[];if(!e.length)return!1;const t=e.filter(i=>!(Le(i)||i.type==="text"&&!(i.text||"").trim()));return t.length<2||!t.every(i=>i.type!=="text"?!1:i.marks?.some(o=>o.type==="link"))?!1:t.map(i=>({type:"link",attrs:{...i.marks.find(o=>o.type==="link")?.attrs,label:i.text||""}}))}function Di(n){if(!["paragraph","heading"].includes(n.type))return!1;let e=n?.content||[];if(!e.length)return!1;e=e.filter(a=>!Le(a));let t=e[0]?.marks?.find(a=>a.type==="link"&&a.attrs);if(!t||!e.every(a=>a?.marks?.some(l=>l.type==="link"&&l.attrs?.href===t.attrs?.href)||!1))return!1;const{href:s,target:i}=t.attrs,r=e.map(a=>{const l=a.marks?.filter(c=>c.type!=="link")||[];return{...a,marks:l}});let o=ne(r);return o?{type:"paragraph",children:ve(n.content),text:`<a target="${i}" href="${s}">${o}</a>`,attrs:n.attrs}:!1}function fs(n){return n?{title:n.header.title||"",pretitle:n.header.pretitle||"",subtitle:n.header.subtitle||"",paragraphs:n.body.paragraphs||[],links:n.body.links||[],images:n.body.images||[],icons:n.body.icons||[],lists:n.body.lists||[],videos:n.body.videos||[],insets:n.body.insets||[],snippets:n.body.snippets||[],data:n.body.data||{},quotes:n.body.quotes||[],headings:n.body.headings||[]}:null}function Ki(n,e={}){if(!n.length)return{title:"",pretitle:"",subtitle:"",paragraphs:[],links:[],images:[],icons:[],lists:[],videos:[],insets:[],snippets:[],data:{},quotes:[],headings:[],items:[]};const s=Ui(n).map(c=>Et(c));let i=null,r=[];Wi(s)?(i=s[0],r=s.slice(1)):r=s;const a=fs(i)||{title:"",pretitle:"",subtitle:"",paragraphs:[],links:[],images:[],icons:[],lists:[],videos:[],insets:[],data:{},quotes:[],headings:[]},l=r.map(fs);return{...a,items:l}}function Ui(n){const e=[];let t=[];for(let s=0;s<n.length;s++){const i=n[s];if(i.type==="divider"){t.length>0&&(e.push(t),t=[]);continue}if(i.type==="heading"){const r=s===1&&Vi(n,0);t.length>0&&!r&&(e.push(t),t=[]);const o=Hi(n,s);t.push(...o),s+=o.length-1}else t.push(i)}return t.length>0&&e.push(t),e}function qi(n,e){return e+1<n.length&&n[e].type==="heading"&&n[e+1].type==="heading"&&n[e].level>n[e+1].level}function Vi(n,e){return e+1<n.length&&n[e].type==="image"&&(n[e].role==="banner"||n[e+1].type==="heading")}function Hi(n,e){const t=[n[e]];let s=!1;for(let i=e+1;i<n.length;i++){const r=n[i],o=t[t.length-1];if(r.type!=="heading")break;if(r.level-o.level===1){s=!0,t.push(r);continue}if(t.length===1&&r.level<o.level){t.push(r);continue}if(r.level===o.level&&!s){t.push(r);continue}break}return t}function Et(n){const e={pretitle:"",title:"",subtitle:""},t={images:[],icons:[],videos:[],insets:[],snippets:[],paragraphs:[],links:[],lists:[],data:{},quotes:[],headings:[]},s={level:null,contentTypes:new Set};if(!n)return{header:e,body:t,metadata:s};let i=null,r=null;for(let o=0;o<n.length;o++){qi(n,o)&&!e.pretitle&&(e.pretitle=n[o].text,o++);const a=n[o];if(a.type==="heading"){if(a.children&&Array.isArray(a.children)&&mt(a.children,t),s.level??=a.level,r!==null&&a.level===r&&i){const l=e[i];Array.isArray(l)?l.push(a.text):e[i]=[l,a.text]}else e.title?e.subtitle?(t.headings.push(a.text),i=null):(e.subtitle=a.text,i="subtitle"):(e.title=a.text,i="title");r=a.level}else if(a.type==="list"){const l=a.children;t.lists.push(l.map(c=>Et(c).body))}else{let l={...a.attrs};switch(a.type){case"paragraph":a.children&&Array.isArray(a.children)&&mt(a.children,t),a.text&&t.paragraphs.push(a.text);break;case"image":a.attrs?.role==="icon"?t.icons.push(a.attrs):t.images.push(l);break;case"video":t.videos.push(l);break;case"link":a.children&&Array.isArray(a.children)&&mt(a.children,t),t.links.push(l);break;case"icon":t.icons.push(a.attrs);break;case"button":t.links.push({href:a.attrs?.href||"",label:a.text||"",role:a.attrs?.variant?`button-${a.attrs.variant}`:"button",variant:a.attrs?.variant||"primary",size:a.attrs?.size,icon:a.attrs?.icon,target:a.attrs?.target,class:a.attrs?.class});break;case"blockquote":const c=Et(a.children);t.quotes.push(c.body);break;case"dataBlock":t.data[a.tag]=a.data;break;case"codeBlock":t.snippets.push({language:a.attrs?.language||"",code:typeof a.text=="string"?a.text:""});break;case"inset":t.insets.push({refId:a.refId});break;case"form":{const f=a.data||a.attrs,u=a.schemaId||"form";t.data[u]=f}break;case"card-group":(a.cards||[]).forEach(f=>{const u=f.cardType||"card";t.data[u]||(t.data[u]=[]);const{cardType:h,...p}=f;t.data[u].push(p)});break;case"document-group":a.documents.forEach(f=>{t.links.push({href:f.href||f.downloadUrl||"",label:f.title||"",role:"document",download:!0,preview:f.coverImg,fileType:f.fileType})});break}}}return{header:e,body:t,metadata:s}}function Wi(n){if(n.length===0)return!1;if(n.length===1)return!0;const e=n[0].metadata.level,t=n[1].metadata.level;return!!(e&&(!t||e<t)||!e&&t)}function mt(n,e){n.forEach(t=>{t.type==="icon"?e.icons.push(t.attrs):t.type==="link"&&e.links.push(t.attrs)})}function zi(n,e={}){const t={...e},s=Tt(n,t),i=Ki(s,t);return{raw:n,sequence:s,...i}}const Ge=[50,100,200,300,400,500,600,700,800,900,950],B={50:.97,100:.93,200:.87,300:.78,400:.68,500:.55,600:.48,700:.4,800:.32,900:.24,950:.14},Gi={50:.15,100:.25,200:.4,300:.65,400:.85,500:1,600:.95,700:.85,800:.75,900:.6,950:.45},Ji=B[50]-B[500],Yi=B[500]-B[950],Je={};for(const n of Ge)n<500?Je[n]=(B[n]-B[500])/Ji:n>500&&(Je[n]=(B[500]-B[n])/Yi);const us={fixed:{hueShift:{light:0,dark:0},chromaBoost:1,lightEndChroma:.15,darkEndChroma:.45},natural:{hueShift:{light:5,dark:-15},chromaBoost:1.1,lightEndChroma:.2,darkEndChroma:.4},vivid:{hueShift:{light:3,dark:-10},chromaBoost:1.4,lightEndChroma:.35,darkEndChroma:.55}};function Qi(n){if(!n||typeof n!="string")throw new Error(`Invalid color: ${n}`);const e=n.trim().toLowerCase();if(e.startsWith("oklch("))return Xi(e);if(e.startsWith("#"))return hs(e);if(e.startsWith("rgb"))return er(e);if(e.startsWith("hsl"))return tr(e);if(/^[0-9a-f]{3,8}$/i.test(e))return hs("#"+e);throw new Error(`Unsupported color format: ${n}`)}function Xi(n){const e=n.match(/oklch\(\s*([0-9.]+)(%?)\s+([0-9.]+)\s+([0-9.]+)(deg)?\s*\)/);if(!e)throw new Error(`Invalid oklch format: ${n}`);let t=parseFloat(e[1]);e[2]==="%"&&(t/=100);const s=parseFloat(e[3]),i=parseFloat(e[4]);return{l:t,c:s,h:i}}function hs(n){const e=Zi(n);return Yt(e.r,e.g,e.b)}function Zi(n){let e=n.replace("#","");e.length===3&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]),e.length===4&&(e=e[0]+e[0]+e[1]+e[1]+e[2]+e[2]+e[3]+e[3]);const t=parseInt(e.slice(0,6),16);return{r:t>>16&255,g:t>>8&255,b:t&255}}function er(n){const e=n.match(/rgba?\(\s*([0-9.]+)[\s,]+([0-9.]+)[\s,]+([0-9.]+)/);if(!e)throw new Error(`Invalid rgb format: ${n}`);const t=parseFloat(e[1]),s=parseFloat(e[2]),i=parseFloat(e[3]);return Yt(t,s,i)}function tr(n){const e=n.match(/hsla?\(\s*([0-9.]+)(deg)?[\s,]+([0-9.]+)%[\s,]+([0-9.]+)%/);if(!e)throw new Error(`Invalid hsl format: ${n}`);const t=parseFloat(e[1]),s=parseFloat(e[3])/100,i=parseFloat(e[4])/100,r=sr(t,s,i);return Yt(r.r*255,r.g*255,r.b*255)}function sr(n,e,t){const s=n/360;let i,r,o;if(e===0)i=r=o=t;else{const a=t<.5?t*(1+e):t+e-t*e,l=2*t-a;i=yt(l,a,s+1/3),r=yt(l,a,s),o=yt(l,a,s-1/3)}return{r:i,g:r,b:o}}function yt(n,e,t){return t<0&&(t+=1),t>1&&(t-=1),t<1/6?n+(e-n)*6*t:t<1/2?e:t<2/3?n+(e-n)*(2/3-t)*6:n}function Yt(n,e,t){n/=255,e/=255,t/=255,n=bt(n),e=bt(e),t=bt(t);const s=.4122214708*n+.5363325363*e+.0514459929*t,i=.2119034982*n+.6806995451*e+.1073969566*t,r=.0883024619*n+.2817188376*e+.6299787005*t,o=Math.cbrt(s),a=Math.cbrt(i),l=Math.cbrt(r),c=.2104542553*o+.793617785*a-.0040720468*l,f=1.9779984951*o-2.428592205*a+.4505937099*l,u=.0259040371*o+.7827717662*a-.808675766*l,h=Math.sqrt(f*f+u*u);let p=Math.atan2(u,f)*(180/Math.PI);return p<0&&(p+=360),{l:c,c:h,h:p}}function bt(n){return n<=.04045?n/12.92:Math.pow((n+.055)/1.055,2.4)}function wt(n){return n<=.0031308?12.92*n:1.055*Math.pow(n,1/2.4)-.055}function ct(n,e,t){const s=t*(Math.PI/180),i=e*Math.cos(s),r=e*Math.sin(s),o=n+.3963377774*i+.2158037573*r,a=n-.1055613458*i-.0638541728*r,l=n-.0894841775*i-1.291485548*r,c=o*o*o,f=a*a*a,u=l*l*l;let h=4.0767416621*c-3.3077115913*f+.2309699292*u,p=-1.2684380046*c+2.6097574011*f-.3413193965*u,m=-.0041960863*c-.7034186147*f+1.707614701*u;return h=Math.round(Math.max(0,Math.min(1,wt(h)))*255),p=Math.round(Math.max(0,Math.min(1,wt(p)))*255),m=Math.round(Math.max(0,Math.min(1,wt(m)))*255),{r:h,g:p,b:m}}function nr(n,e,t){return n>=-.5&&n<=255.5&&e>=-.5&&e<=255.5&&t>=-.5&&t<=255.5}function pn(n,e,t){let s=0,i=t,r=0;for(let o=0;o<8;o++){const a=(s+i)/2,l=ct(n,a,e);nr(l.r,l.g,l.b)?(r=a,s=a):i=a}return r}function ds(n,e,t,s){const i=1-s;return i*i*n+2*i*s*e+s*s*t}function xe(n,e,t){return n+(e-n)*t}function kt(n){return n=n%360,n<0?n+360:n}function ir(n){return n>=0&&n<120||n>300}function Ye(n,e,t){const s=(n*100).toFixed(1),i=e.toFixed(4),r=t.toFixed(1);return`oklch(${s}% ${i} ${r})`}function Qt(n,e,t){const s=i=>i.toString(16).padStart(2,"0");return`#${s(n)}${s(e)}${s(t)}`}function ps(n,e={}){const{format:t="oklch",mode:s="fixed",exactMatch:i}=e,r=Qi(n),o=us[s]||us.fixed;return s==="fixed"?rr(r,n,t,i):or(r,n,t,o,i)}function rr(n,e,t,s){const i={},r=s!==!1;for(const o of Ge){if(r&&o===500){t==="hex"?i[o]=e.startsWith("#")?e:gn(n):i[o]=Ye(n.l,n.c,n.h);continue}let a;r?o<500?a=n.l+Je[o]*(B[50]-n.l):a=n.l-Je[o]*(n.l-B[950]):a=B[o];const l=Gi[o],c=n.c*l,f=pn(a,n.h,c);if(t==="hex"){const u=ct(a,f,n.h);i[o]=Qt(u.r,u.g,u.b)}else i[o]=Ye(a,f,n.h)}return i}function or(n,e,t,s,i){const r={},o=ir(n.h),a=o?s.hueShift.light:-s.hueShift.light,l=o?s.hueShift.dark:-s.hueShift.dark,c={l:B[50],c:n.c*s.lightEndChroma,h:kt(n.h+a)},f={l:B[950],c:n.c*s.darkEndChroma,h:kt(n.h+l)},u=n.c*s.chromaBoost;for(let h=0;h<Ge.length;h++){const p=Ge[h];if(i!==!1&&p===500){t==="hex"?r[p]=e.startsWith("#")?e:gn(n):r[p]=Ye(n.l,n.c,n.h);continue}let m,d,g;if(h<=5){const b=h/5;m=xe(c.l,n.l,b),g=xe(c.h,n.h,b);const w=(c.c+u)/2;d=ds(c.c,w,u,b)}else{const b=(h-5)/5;m=xe(n.l,f.l,b),g=xe(n.h,f.h,b);const w=(u+f.c)/2;d=ds(u,w,f.c,b)}g=kt(g);const y=pn(m,g,d);if(t==="hex"){const b=ct(m,y,g);r[p]=Qt(b.r,b.g,b.b)}else r[p]=Ye(m,y,g)}return r}function gn(n){const e=ct(n.l,n.c,n.h);return Qt(e.r,e.g,e.b)}function Tr(n,e={}){const t={};for(const[s,i]of Object.entries(n)){if(typeof i=="object"&&i!==null&&!i.base&&Object.keys(i).some(o=>!isNaN(parseInt(o)))){t[s]=i;continue}if(typeof i=="object"&&i!==null&&i.base){const{base:r,...o}=i;t[s]=ps(r,{...e,...o})}else typeof i=="string"&&(t[s]=ps(i,e))}return t}const gs=new Set([50,100,200,300,400,500,600,700,800,900,950]),ms=/^([a-z][a-z0-9]*)-(\d+)$/,ar=/^([a-z][a-z0-9]*-\d+)\/(\d+)$/,lr=/^rgba\(\s*(var\(--[^)]+\))\s*\/\s*([\d.]+)\s*\)$/;function ys(n){if(typeof n!="string")return n;const e=n.match(lr);if(e){const r=e[1],o=parseFloat(e[2]);return o>=.999?r:`color-mix(in srgb, ${r} ${Math.round(o*100)}%, transparent)`}if(n.includes("(")||n.startsWith("#"))return n;const t=n.replace(/^-{0,2}/,""),s=t.match(ar);if(s){const r=s[1],o=parseInt(s[2],10),a=r.match(ms);if(a&&gs.has(parseInt(a[2],10)))return o>=100?`var(--${r})`:`color-mix(in srgb, var(--${r}) ${o}%, transparent)`}const i=t.match(ms);if(i){const r=parseInt(i[2],10);if(gs.has(r))return`var(--${t})`}return n}class K{constructor(e,t,s){this.id=t,this.stableId=e.stableId||null,this.page=s,this.website=s.website,this.type=e.type||this.website.getDefaultBlockType(),this.Component=null,this.rawContent=e.content||{},this.parsedContent=this.parseContent(e.content),e.parsedContent?.data&&(this.parsedContent.data={...this.parsedContent.data||{},...e.parsedContent.data}),this.items=this.parsedContent.items||[];const i=e.params||e.config||{};this.preset=e.preset;const r=i.theme;if(r&&typeof r=="object"){const{mode:l,...c}=r;if(this.themeName=l||"",Object.keys(c).length>0){for(const f of Object.keys(c))c[f]=ys(c[f]);this.contextOverrides=c}else this.contextOverrides=null}else this.themeName=r??"",this.contextOverrides=null;this.standardOptions=i.standardOptions||{},this.properties=i.properties||i,this.properties.theme&&typeof this.properties.theme=="object"&&(this.properties={...this.properties,theme:this.themeName});const o=i.background;o&&!this.standardOptions.background&&(this.standardOptions={...this.standardOptions,background:K.normalizeBackground(o)}),this.childBlocks=e.subsections?e.subsections.map((l,c)=>new K(l,`${t}_${c}`,this.page)):[],this.insets=[];const a=e.insets;if(a?.length>0)for(let l=0;l<a.length;l++){const c=a[l],f=c.title||"",u=new K({type:c.type,params:c.params||{},content:{title:f},stableId:c.refId,refId:c.refId},`${t}_inset_${l}`,this.page);this.insets.push(u)}this.fetch=e.fetch||null,this.dataLoading=!1,this.hasBackground=!1,this.refId=e.refId||null,this.dynamicContext=e.dynamicContext||null,this.startState=null,this.state=null,this.resetStateHook=null,this.context=null,this.componentVars=null,Object.seal(this)}get path(){return this.page.getNavRoute()}get key(){return`${this.path}-${this.id}`}get parentPath(){return this.dynamicContext?.templateRoute?this.dynamicContext.templateRoute.split("/").slice(0,-1).join("/")||"/":this.path.split("/").slice(0,-1).join("/")||"/"}parseContent(e){return e?.groups?e.groups:e?.type==="doc"?this.extractFromProseMirror(e):e?.doc?.type==="doc"?this.extractFromProseMirror(e.doc):e&&typeof e=="object"&&!Array.isArray(e)?e:{title:"",paragraphs:[],items:[],sequence:[]}}extractFromProseMirror(e){try{return zi(e)}catch(t){return console.warn("[Block] Semantic parser error, using fallback:",t.message),this.extractFromProseMirrorFallback(e)}}extractFromProseMirrorFallback(e){const t={title:"",pretitle:"",subtitle:"",paragraphs:[],links:[],images:[],lists:[],icons:[],items:[],sequence:[]};if(!e.content)return t;for(const s of e.content)if(s.type==="heading"){const i=this.extractText(s);s.attrs?.level===1?t.title=i:s.attrs?.level===2&&(t.subtitle=i)}else if(s.type==="paragraph"){const i=this.extractText(s);t.paragraphs.push(i)}return t}extractText(e){return e.content?e.content.filter(t=>t.type==="text").map(t=>t.text).join(""):""}initComponent(){if(this.Component)return this.Component;if(this.Component=globalThis.uniweb?.getComponent(this.type),!this.Component)return console.warn(`[Block] Component not found: ${this.type}`),null;const e=globalThis.uniweb?.getComponentMeta(this.type)||{},t=e.initialState;return this.startState=t?{...t}:null,this.initState(),this.context=e.context?{...e.context}:null,e.vars&&(this.componentVars=K.mergeComponentVars(e.vars,this.properties.vars)),this.Component}getBlockProperties(){return this.properties}getInset(e){return this.insets.find(t=>t.refId===e)||null}getChildBlockRenderer(){return globalThis.uniweb.childBlockRenderer}getBlockLinks(e={}){const t=globalThis.uniweb?.activeWebsite,s=this.parsedContent||{};if(e.nested){const o=(s.lists||[])[0];return K.parseNestedLinks(o,t)}return(s.links||[]).map(r=>({route:t?.makeHref(r.href)||r.href,label:r.label}))}initState(){this.state=this.startState,this.resetStateHook&&this.resetStateHook()}getIndex(){return this.page?this.page.getBlockIndex(this):-1}getBlockInfo(){return{type:this.type,theme:this.themeName,contextOverrides:this.contextOverrides,state:this.state,context:this.context}}getNextBlockInfo(){const e=this.getIndex();return e<0||!this.page?null:this.page.getBlockInfo(e+1)}getPrevBlockInfo(){const e=this.getIndex();return e<=0||!this.page?null:this.page.getBlockInfo(e-1)}useBlockState(e,t){t!==void 0&&this.startState===null?(this.startState=t,this.state=t):t=this.startState;const[s,i]=e(t);return this.resetStateHook=()=>i(t),[s,r=>i(this.state=r)]}getDynamicContext(){return this.dynamicContext}static mergeComponentVars(e,t={}){const s={};for(const[i,r]of Object.entries(e)){const o=typeof r=="string"?r:r?.default;o!=null&&(s[i]=o)}if(t&&typeof t=="object")for(const[i,r]of Object.entries(t))r!=null&&i in e&&(s[i]=String(r));return Object.keys(s).length>0?s:null}static normalizeBackground(e){if(typeof e=="string"){if(/^(\/|\.\/|\.\.\/|https?:\/\/)/.test(e)||/\.(jpe?g|png|webp|gif|svg|avif|mp4|webm|ogv|ogg)$/i.test(e)){const t=e.split(".").pop()?.toLowerCase();return["mp4","webm","ogv","ogg"].includes(t)?{mode:"video",video:{src:e}}:{mode:"image",image:{src:e}}}return/^(linear|radial|conic)-gradient\(/.test(e)?{mode:"gradient",gradient:e}:{mode:"color",color:ys(e)}}if(e.mode)return e;if(typeof e.overlay=="number"&&(e={...e,overlay:{enabled:!0,type:"dark",opacity:e.overlay}}),e.video||e.sources)return{mode:"video",...e};if(e.image||e.src){if(e.src){const{src:t,position:s,size:i,lazy:r,...o}=e;return{mode:"image",image:{src:t,position:s,size:i,lazy:r},...o}}if(typeof e.image=="string"){const{image:t,...s}=e;return{mode:"image",image:{src:t},...s}}return{mode:"image",...e}}return e.gradient?{mode:"gradient",...e}:e.color?{mode:"color",...e}:e}static parseNestedLinks(e,t){const s=[];if(!e?.length)return s;for(const i of e){const{links:r=[],lists:o=[],paragraphs:a=[]}=i,l=r[0],c=o[0],f=a[0];let u="",h="",p=[],m=!0;l?(u=l.label,h=l.href,c&&(p=K.parseNestedLinks(c,t))):(u=f,m=!1,c&&(p=K.parseNestedLinks(c,t))),s.push({label:u,route:t?.makeHref(h)||h,child_items:p,hasData:m})}return s}}class mn{constructor(){this._values=new Map,this._keyListeners=new Map,Object.seal(this)}get(e){return this._values.get(e)}has(e){return this._values.has(e)}set(e,t){this._values.has(e)&&this._values.get(e)===t||(this._values.set(e,t),this._notify(e))}delete(e){return this._values.has(e)?(this._values.delete(e),this._notify(e),!0):!1}subscribe(e,t){let s=this._keyListeners.get(e);return s||(s=new Set,this._keyListeners.set(e,s)),s.add(t),()=>{s.delete(t),s.size===0&&this._keyListeners.delete(e)}}_notify(e){const t=this._keyListeners.get(e);if(t)for(const s of t)s()}}class Re{constructor(e,t,s){this.id=t,this.stableId=e.id||null,this.route=e.route,this.sourcePath=e.sourcePath||null,this.isIndex=e.isIndex||!1,this.parentRoute=e.parent||null,this.title=e.title||"",this.description=e.description||"",this.label=e.label||null,this.keywords=e.keywords||null,this.lastModified=e.lastModified||null,this.redirect=e.redirect||null,this.rewrite=e.rewrite||null,this.hidden=e.hidden||!1,this.hideInHeader=e.hideInHeader||!1,this.hideInFooter=e.hideInFooter||!1,this.layout={name:e.layout?.name||null,hide:e.layout?.hide||[],params:e.layout?.params||{}},this.seo={noindex:e.seo?.noindex||!1,image:e.seo?.image||null,ogTitle:e.seo?.ogTitle||null,ogDescription:e.seo?.ogDescription||null,canonical:e.seo?.canonical||null,changefreq:e.seo?.changefreq||null,priority:e.seo?.priority||null},this.parent=null,this.children=[],this.website=s,this.scrollY=0,this.fetch=e.fetch||null,this.dynamicContext=e.dynamicContext||null,this.version=e.version||null,this.versionMeta=e.versionMeta||null,this.versionScope=e.versionScope||null,this._hasContent=e.hasContent??e.sections?.length>0,this._bodySections=e.sections,this._bodyBlocks=null,this._loadingContent=null,this._state=null,Object.seal(this)}get state(){return this._state||(this._state=new mn),this._state}get bodyBlocks(){if(!this._bodyBlocks){if(this._bodySections===void 0)return[];this._bodyBlocks=(this._bodySections||[]).map((e,t)=>new K(e,t,this))}return this._bodyBlocks}getHeadMeta(){const e=this.getTitle();return{title:e,description:this.description,keywords:this.keywords,canonical:this.seo.canonical,robots:this.seo.noindex?"noindex, nofollow":null,og:{title:this.seo.ogTitle||e,description:this.seo.ogDescription||this.description,image:this.seo.image,url:this.route}}}isDynamicPage(){return this.dynamicContext!==null}getDynamicContext(){return this.dynamicContext}getDynamicParam(){return this.dynamicContext?.paramValue||null}getLayoutName(){return this.layout.name||this.website?.getDefaultLayoutName()||null}getBlockGroups(){return{body:this.bodyBlocks,...this.getLayoutAreas()}}getBlockIndex(e){return this.getPageBlocks().indexOf(e)}getBlockInfo(e){return this.getPageBlocks()[e]?.getBlockInfo()||null}getFirstBodyBlockInfo(){return this.bodyBlocks?.[0]?.getBlockInfo()||null}getPageBlocks(){const e=[],t=this.getLayoutAreas(),s=t.header,i=t.footer;return s&&e.push(...s),e.push(...this.bodyBlocks),i&&e.push(...i),e}getBodyBlocks(){return this.bodyBlocks}getAreaBlocks(e){return this.layout.hide.includes(e)?null:this.website.getAreaBlocks(e,this.getLayoutName())}getLayoutAreas(){const e=this.website.getLayoutAreas(this.getLayoutName()),t={};for(const[s,i]of Object.entries(e))this.layout.hide.includes(s)||(t[s]=i);return t}getLayoutParams(){return this.layout.params}resetBlockStates(){const e=this.getLayoutAreas(),t=[...this.bodyBlocks,...Object.values(e).flat()];for(const s of t)typeof s.initState=="function"&&s.initState()}getNavRoute(){return this.isIndex&&this.route.endsWith("/index")?this.route.slice(0,-6)||"/":this.route}getTitle(){if(this.isIndex&&this.route.endsWith("/index")){const e=this.title?.trim();if(!e||e.toLowerCase()==="index")return this.parent?.title||e||""}return this.title}getLabel(){return this.label||this.getTitle()}isHidden(){return this.hidden}showInHeader(){return!this.hidden&&!this.hideInHeader}showInFooter(){return!this.hidden&&!this.hideInFooter}hasChildren(){return this.children.length>0}hasContent(){return this._hasContent}isContentLoaded(){return this._bodySections!==void 0}async loadContent(){if(this._bodySections===void 0)return this._loadingContent?this._loadingContent:(this._loadingContent=(async()=>{try{const e=this.website.basePath||"",t=this.website.activeLocale!==this.website.defaultLocale?`/${this.website.activeLocale}`:"",s=this.route==="/"?"/index":this.route,i=await fetch(`${e}${t}/_pages${s}.json`);if(!i.ok){console.warn(`[Page] Failed to load content for ${this.route}: ${i.status}`),this._bodySections=[];return}const r=await i.json();this._bodySections=r.sections||[],this._bodyBlocks=null}finally{this._loadingContent=null}})(),this._loadingContent)}getNavigableRoute(){if(this.hasContent())return this.route;const e=this.children||[];if(e.find(s=>s.isIndex))return this.route;for(const s of e){const i=s.getNavigableRoute();if(i)return i}return this.route}getNormalizedRoute(){return this.website.normalizeRoute(this.route)}isActiveFor(e){return this.website.isRouteActive(this.route,e)}isActiveOrAncestor(e){if(this.website.isRouteActive(this.route,e))return!0;const t=this.sourcePath||this.route;return this.website.isRouteActiveOrAncestor(t,e)}isVersioned(){return this.version!==null}getVersion(){return this.version}getVersions(){return this.versionMeta?.versions||[]}isLatestVersion(){return this.version?.latest===!0}isDeprecatedVersion(){return this.version?.deprecated===!0}getVersionUrl(e){return this.isVersioned()?this.website.getVersionUrl(e,this.route):null}}function cr(n){const{path:e,url:t,schema:s,transform:i}=n||{},r=n?.method&&n.method.toUpperCase()!=="GET"?n.method.toUpperCase():void 0,o=r==="POST"?n?.body:void 0;return JSON.stringify({path:e,url:t,schema:s,transform:i,method:r,body:o})}class fr{constructor(){this._cache=new Map,this._inflight=new Map,this._listeners=new Set,this._keyedListeners=new Map,Object.seal(this)}subscribe(e,t){if(typeof e=="string"&&typeof t=="function"){const s=e;let i=this._keyedListeners.get(s);return i||(i=new Set,this._keyedListeners.set(s,i)),i.add(t),()=>{const r=this._keyedListeners.get(s);r&&(r.delete(t),r.size===0&&this._keyedListeners.delete(s))}}if(typeof e=="function")return this._listeners.add(e),()=>this._listeners.delete(e);throw new TypeError("DataStore.subscribe: expected (fn) or (key, fn)")}has(e){return this._cache.has(e)}get(e){return this._cache.has(e)?this._cache.get(e):null}set(e,t){this._cache.set(e,t);for(const i of this._listeners)i();const s=this._keyedListeners.get(e);if(s)for(const i of s)i()}get inflight(){return this._inflight}clear(){this._cache.clear(),this._inflight.clear()}}function ie(n){if(!n)return n;const e={people:"person",children:"child",men:"men",women:"woman",series:"series"};if(e[n])return e[n];if(n.endsWith("ies"))return n.slice(0,-3)+"y";if(n.endsWith("es")){const t=n.slice(0,-2),s=t.slice(-1);return["s","x","z"].includes(s)||t.endsWith("ch")||t.endsWith("sh")?t:n.slice(0,-1)}return n.endsWith("s")?n.slice(0,-1):n}const ur=/\{([A-Za-z_][A-Za-z0-9_]*)\}/g;function Ae(n,e,t={}){const{encode:s=!0}=t;if(typeof n=="string")return n.replace(ur,(i,r)=>{if(!(r in(e||{})))return i;const o=e[r];return o==null?i:s?encodeURIComponent(String(o)):String(o)});if(Array.isArray(n))return n.map(i=>Ae(i,e,t));if(n&&typeof n=="object"){const i={};for(const r of Object.keys(n))i[r]=Ae(n[r],e,t);return i}return n}function Fe(n){return n?.refine===!0||n?.inherit===!0}let bs=!1;function hr(n){bs||(bs=!0,console.warn(`[uniweb] 'fetch: { inherit: true }' is deprecated; rename to 'fetch: { refine: true }'. Accepted for one release; will be removed in the next minor. First seen on block ${n?.id??"(unknown)"} of page ${n?.page?.route??"(unknown)"}.`))}class dr{constructor({website:e}){this.website=e,Object.seal(this)}_shouldInheritDetail(e,t){const s=t?.fetch;return Fe(s)&&s?.detail!==void 0?s.detail!==!1:e?e.inheritDetail!==!1:!0}_inheritLimit(e,t){const s=t?.fetch;return Fe(s)&&s?.limit>0?s.limit:e?.inheritLimit>0?e.inheritLimit:null}_inheritOrder(e){const t=e?.fetch;return Fe(t)&&t?.order?.orderBy?t.order:null}_sortItems(e,t){if(!t?.orderBy||!Array.isArray(e)||e.length===0)return e;const{orderBy:s,sortOrder:i="ASC"}=t,r=i==="DESC";return[...e].sort((o,a)=>{const l=o[s]??"",c=a[s]??"",f=typeof l=="string"&&typeof c=="string"?l.localeCompare(c):l>c?1:l<c?-1:0;return r?-f:f})}_getRequestedSchemas(e){return e?e.inheritData===!1?null:[]:[]}_localizeConfig(e,t){if(!e.path||!t)return e;const s=t.getActiveLocale?.(),i=t.getDefaultLocale?.();return!s||s===i||!e.path.startsWith("/data/")?e:{...e,path:`/${s}${e.path}`}}_findFetchConfigs(e,t){const s=new Map,i=t.length===0,r=[];e.fetch?.inherit===!0&&e.fetch?.refine!==!0&&hr(e),e.fetch&&!Fe(e.fetch)&&r.push(e.fetch);const o=e.page;o?.fetch&&r.push(o.fetch),o?.parent?.fetch&&r.push(o.parent.fetch);const a=e.website?.config?.fetch;a&&r.push(a);const l=e.website;for(const c of r){const f=Array.isArray(c)?c:[c];for(const u of f)if(u.schema&&!s.has(u.schema)&&(i||t.includes(u.schema))){const h=this._localizeConfig(u,l),p=this._applyDeferredDetail(h,l);s.set(u.schema,p)}}return s}_applyDeferredDetail(e,t){if(e.detail!==void 0)return e;const s=e.schema;if(!s)return e;const i=t?.config?.collections?.[s];if(!i||typeof i!="object")return e;const r=Array.isArray(i.deferred)?i.deferred:null;if(!r||r.length===0)return e;const o=typeof i.detailUrl=="string"?i.detailUrl:`/data/${s}/{slug}.json`;return{...e,detail:o}}_buildDetailConfig(e,t){const{detail:s}=e;if(!s)return null;const{paramName:i,paramValue:r}=t;if(!i||r===void 0)return null;const o=e.url||e.path;if(!o)return null;const a=!!e.path&&!e.url;if(s&&typeof s=="object"){const c={...a?{path:o}:{url:o},schema:ie(e.schema)||e.schema,transform:e.transform};return e.method&&(c.method=e.method),s.body!==void 0?c.body=Ae(s.body,{[i]:r},{encode:!1}):e.body!==void 0&&(c.body=Ae(e.body,{[i]:r},{encode:!1})),s.envelope&&(c.envelope=s.envelope),c}let l;if(s==="rest"){const[c,f]=o.split("?"),u=c.replace(/\/$/,"");l=f?`${u}/${encodeURIComponent(r)}?${f}`:`${u}/${encodeURIComponent(r)}`}else if(s==="query"){const c=o.includes("?")?"&":"?";l=`${o}${c}${i}=${encodeURIComponent(r)}`}else l=Ae(s,{[i]:r});return{...a?{path:l}:{url:l},schema:ie(e.schema)||e.schema,transform:e.transform}}_resolveSingularItem(e,t){if(!t)return e;const{paramName:s,paramValue:i,schema:r}=t;if(!r||!s||i===void 0)return e;const o=e[r];if(!Array.isArray(o))return e;const a=ie(r),l=o.find(c=>String(c[s])===String(i));return l&&a?{...e,[a]:l}:e}_ctx(e,t={}){return{website:this.website,page:e?.page||null,block:e||null,signal:t.signal}}resolve(e,t){const s=this.website?.fetcher;let i=this._getRequestedSchemas(t);if(i===null&&e.fetch){const m=(Array.isArray(e.fetch)?e.fetch:[e.fetch]).filter(d=>d.schema).map(d=>d.schema);m.length>0&&(i=m)}if(i===null)return{status:"none",data:null};const r=this._findFetchConfigs(e,i);if(r.size===0)return{status:"none",data:null};const o=e.dynamicContext||e.page?.dynamicContext,a=this._shouldInheritDetail(t,e),l=this._inheritLimit(t,e),c=this._inheritOrder(e),f=this._ctx(e),u={};let h=!0;for(const[p,m]of r)if(o&&m.detail&&!a){const d=s?.peek(m,f);if(d){const{paramName:g,paramValue:y}=o,b=d.data;let w=Array.isArray(b)?b.filter(k=>String(k[g])!==String(y)):b;c&&(w=this._sortItems(w,c)),u[p]=l&&Array.isArray(w)?w.slice(0,l):w}else h=!1}else if(o&&m.detail){const d=s?.peek(m,f);if(d){const g=d.data,{paramName:y,paramValue:b}=o,w=ie(p)||p,k=Array.isArray(g)?g.find(S=>String(S[y])===String(b)):null;if(!k)u[w]=null;else{const S=this._buildDetailConfig(m,o),A=S?s?.peek(S,f):null;S&&A?u[w]=A.data:S?h=!1:u[w]=k}}else h=!1}else{const d=s?.peek(m,f);if(d){const g=d.data;u[p]=c?this._sortItems(g,c):g}else h=!1}return h?{status:"ready",data:this._resolveSingularItem(u,o)}:{status:"pending",data:null}}async fetch(e,t,{signal:s}={}){const i=this.website?.fetcher;if(!i)return{data:null};let r=this._getRequestedSchemas(t);if(r===null&&e.fetch){const g=(Array.isArray(e.fetch)?e.fetch:[e.fetch]).filter(y=>y.schema).map(y=>y.schema);g.length>0&&(r=g)}if(r===null)return{data:null};const o=this._findFetchConfigs(e,r);if(o.size===0)return{data:null};const a=e.dynamicContext||e.page?.dynamicContext,l=this._shouldInheritDetail(t,e),c=this._inheritLimit(t,e),f=this._inheritOrder(e),u=this._ctx(e,{signal:s}),h={},p=[];for(const[d,g]of o)if(a&&g.detail&&!l){let y=ws(i,g,u);if(y===null){const S=await i.dispatch(g,u);y=Array.isArray(S?.data)?S.data:null}const{paramName:b,paramValue:w}=a;let k=Array.isArray(y)?y.filter(S=>String(S[b])!==String(w)):y??[];f&&(k=this._sortItems(k,f)),h[d]=c&&Array.isArray(k)?k.slice(0,c):k}else if(a&&g.detail){const{paramName:y,paramValue:b}=a,w=ie(d)||d;let k=ws(i,g,u);if(k===null){const _=await i.dispatch(g,u);k=Array.isArray(_?.data)?_.data:null}const S=k?.find(_=>String(_[y])===String(b))??null;if(!S){h[w]=null;continue}const A=this._buildDetailConfig(g,a);A?p.push(i.dispatch(A,u).then(_=>{h[w]=_?.data!==void 0&&_?.data!==null?_.data:S})):h[w]=S}else p.push(i.dispatch(g,u).then(y=>{y?.data!==void 0&&y?.data!==null&&(h[d]=y.data)}));return p.length>0&&await Promise.all(p),{data:this._resolveSingularItem(h,a)}}}function ws(n,e,t){const s=n.peek(e,t);return s&&Array.isArray(s.data)?s.data:null}function ks(n){return n?n.default&&typeof n.default=="object"?n.default:typeof n=="object"?n:null:null}function yn(n){return!!n&&typeof n.resolve=="function"}function Ss(n,{source:e,dev:t}){const s=new Map;if(!n)return s;let i;try{i=n.transports}catch(r){return t&&console.warn(`[FetcherDispatcher] ${e} transports getter threw:`,r),s}if(!i||typeof i!="object"||Array.isArray(i))return s;for(const r of Object.keys(i)){let o;try{o=i[r]}catch(a){t&&console.warn(`[FetcherDispatcher] ${e} transport "${r}" getter threw:`,a);continue}if(!yn(o)){t&&console.warn(`[FetcherDispatcher] ${e} transport "${r}" missing resolve(); skipped.`);continue}s.set(r,o)}return s}class vs{constructor({foundation:e,extensions:t=[],dataStore:s,defaultFetcher:i=null,transport:r=null,dev:o=!1}){if(!s)throw new Error("FetcherDispatcher: dataStore is required");this._dataStore=s,this._defaultFetcher=i,this._transportOverride=yn(r)?r:null,this._dev=!!o;const a=new Map,l=Ss(ks(e),{source:"primary foundation",dev:this._dev});for(const[c,f]of l)a.set(c,f);for(const c of t){let f;try{f=Ss(ks(c),{source:"extension",dev:this._dev})}catch(u){this._dev&&console.warn("[FetcherDispatcher] extension transports collection threw:",u);continue}for(const[u,h]of f){if(a.has(u)){this._dev&&console.warn(`[FetcherDispatcher] extension transport "${u}" ignored — primary foundation already provides it.`);continue}a.set(u,h)}}this._namedTransports=a,Object.freeze(this)}_selectFetcher(e,t){if(this._transportOverride)return this._transportOverride;const s=t?.website?.config?.fetcher?.transports;if(s&&typeof s=="object"){const i=e?.schema,r=i&&s[i]||s.default;if(r){const o=this._namedTransports.get(r);if(o)return o;this._dev&&console.warn(`[FetcherDispatcher] site selected transport "${r}" for schema "${i??"(none)"}" but no foundation or extension registered it; falling back to the framework default.`)}}return this._defaultFetcher}_cacheKey(e,t){if(e&&typeof e.cacheKey=="function")try{return String(e.cacheKey(t))}catch(s){console.warn("[FetcherDispatcher] fetcher.cacheKey threw:",s)}return cr(t)}peek(e,t={}){const s=this._selectFetcher(e,t),i=this._cacheKey(s,e);return this._dataStore.get(i)}async dispatch(e,t={}){const s=this._selectFetcher(e,t);if(!s)return{data:[],error:"FetcherDispatcher: no fetcher selected and no default configured"};const i=this._cacheKey(s,e),r=this._dataStore.get(i);if(r)return{data:r.data,meta:r.meta};const o=this._dataStore.inflight.get(i);if(o)return this._attachSignal(o,t.signal),o.promise;const a=typeof AbortController<"u"?new AbortController:null,l={promise:null,master:a,signals:new Set,everAttached:!1};this._attachSignal(l,t.signal),this._dataStore.inflight.set(i,l);const c=a?{...t,signal:a.signal}:t;return l.promise=this._runFetcher(s,e,c,i,l),l.promise}_attachSignal(e,t){if(!t||!e.master)return;if(e.everAttached=!0,t.aborted){this._maybeAbortMaster(e);return}e.signals.add(t);const s=()=>{e.signals.delete(t),this._maybeAbortMaster(e)};t.addEventListener("abort",s,{once:!0})}_maybeAbortMaster(e){e.master&&(e.master.signal.aborted||e.everAttached&&(e.signals.size>0||e.master.abort()))}async _runFetcher(e,t,s,i,r){try{const o=await e.resolve(t,s);if(this._dataStore.inflight.get(i)===r&&this._dataStore.inflight.delete(i),!o||typeof o!="object")return this._dev&&console.warn("[FetcherDispatcher] Fetcher returned a non-object; expected { data, error?, meta? }.",{request:t,result:o}),{data:[],error:"Fetcher returned a non-object"};const{data:a,error:l,meta:c}=o;if(this._dev&&this._validateReturnShape(o,t),l)return{data:a??[],error:l,meta:c};if(a==null)return{data:a??[],meta:c};const f=c!==void 0?{data:a,meta:c}:{data:a};return this._dataStore.set(i,f),{data:a,meta:c}}catch(o){return this._dataStore.inflight.get(i)===r&&this._dataStore.inflight.delete(i),{data:[],error:String(o?.message||o)}}}_validateReturnShape(e,t){const s=new Set(["data","error","meta"]),i=Object.keys(e).filter(r=>!s.has(r));i.length>0&&console.warn(`[FetcherDispatcher] Fetcher return has unexpected keys: ${i.join(", ")}. Expected { data, error?, meta? }.`,{request:t,result:e})}}class pr{constructor({content:e={},foundation:t=null,extensions:s=[],defaultFetcher:i=null,transport:r=null,dev:o=!1}={}){this._foundation=t,this._extensions=s,this._defaultFetcher=i,this._transport=r,this._dev=o,this.dataStore=new fr,this.fetcher=new vs({foundation:t,extensions:s,dataStore:this.dataStore,defaultFetcher:i,transport:r,dev:o}),this.entityStore=new dr({website:this}),this._state=null,this.name="",this.description="",this.url="",this._layoutSets={},this.notFoundPage=null,this._dynamicPageData=new Map,this._dynamicPageCache=new Map,this.pages=[],this.activePage=null,this.pageRoutes=[],this.themeData={},this.config={},this.siteDefaultLocale="en",this.defaultLocale="en",this.activeLocale="en",this.locales=[],this.activeLang="en",this.langs=[],this._routeTranslations={},this.basePath="",this.versionedScopes={},this._pageIdMap=new Map,this._applyContent(e),Object.seal(this)}_applyContent(e){const{pages:t=[],theme:s={},config:i={},layouts:r,notFound:o,versionedScopes:a={}}=e||{};if(this.name=i.name||"",this.description=i.description||"",this.url=i.url||"",this._layoutSets={},r&&typeof r=="object")for(const[f,u]of Object.entries(r)){this._layoutSets[f]={};for(const[h,p]of Object.entries(u))p&&(this._layoutSets[f][h]=new Re(p,`layout-${f}-${h}`,this))}const l=o||t.find(f=>f.route==="/404")||null;this.notFoundPage=l?new Re(l,"notFound",this):null;const c=t.filter(f=>f.route!=="/404");this._dynamicPageData=new Map;for(const f of c)(f.isDynamic||f.route?.includes(":"))&&this._dynamicPageData.set(f.route,f);this._dynamicPageCache=new Map,this.pages=c.map((f,u)=>new Re(f,u,this)),this.buildPageHierarchy(),this.activePage=this.pages.find(f=>f.isIndex&&f.getNavRoute()==="/")||this.pages[0]||null,this.pageRoutes=this.pages.map(f=>f.route),this.themeData=s,this.config=i,this.siteDefaultLocale=i.defaultLanguage||"en",this.defaultLocale=i.domainLocale||this.siteDefaultLocale,this.activeLocale=i.activeLocale||this.defaultLocale,this.locales=this.buildLocalesList(i),this.activeLang=this.activeLocale,this.langs=this.locales.map(f=>({label:f.label||f.code,value:f.code})),this._routeTranslations=this._buildRouteTranslations(i),this.versionedScopes=a}rebuild({content:e,foundation:t,extensions:s}={}){const i=t!==void 0,r=s!==void 0;return i&&(this._foundation=t),r&&(this._extensions=s),(i||r)&&(this.fetcher=new vs({foundation:this._foundation,extensions:this._extensions,dataStore:this.dataStore,defaultFetcher:this._defaultFetcher,transport:this._transport,dev:this._dev})),e!==void 0&&this._applyContent(e),this}get state(){return this._state||(this._state=new mn),this._state}buildLocalesList(e){const t=e.defaultLanguage||"en",s=e.languages||[],i=o=>typeof o=="string"?{code:o}:{code:o.code,...o.label&&{label:o.label}},r=new Map;r.set(t,{code:t});for(const o of s){const a=i(o);if(r.has(a.code)){const l=r.get(a.code);r.set(a.code,{...l,...a})}else r.set(a.code,a)}return Array.from(r.values()).map(o=>({...o,isDefault:o.code===t}))}_buildRouteTranslations(e){const t=e.i18n?.routeTranslations||{},s={};for(const[i,r]of Object.entries(t)){const o=new Map,a=new Map;for(const[l,c]of Object.entries(r))o.set(l,c),a.set(c,l);s[i]={forward:o,reverse:a}}return s}translateRoute(e,t=this.activeLocale){if(!t||t===this.siteDefaultLocale)return e;const s=this._routeTranslations[t];if(!s)return e;const i=s.forward.get(e);if(i)return i;for(const[r,o]of s.forward)if(e.startsWith(r+"/"))return o+e.slice(r.length);return e}reverseTranslateRoute(e,t=this.activeLocale){if(!t||t===this.siteDefaultLocale)return e;const s=this._routeTranslations[t];if(!s)return e;const i=s.reverse.get(e);if(i)return i;for(const[r,o]of s.reverse)if(e.startsWith(r+"/"))return o+e.slice(r.length);return e}buildPageHierarchy(){const e=new Map;for(const t of this.pages)e.set(t.route,t);for(const t of this.pages)if(t.parentRoute){const s=e.get(t.parentRoute);s&&(s.children.push(t),t.parent=s)}for(const t of this.pages){if(t.parent||t.route==="/")continue;const s=t.route.replace(/\/[^/]+$/,"");if(!s||s==="/"||s===t.route)continue;const i=e.get(s);i&&(i.children.push(t),t.parent=i)}this._pageIdMap=new Map;for(const t of this.pages){t.stableId&&this._pageIdMap.set(t.stableId,t);const s=this.normalizeRoute(t.route);if(s&&!this._pageIdMap.has(s)&&this._pageIdMap.set(s,t),t.sourcePath){const i=t.sourcePath.replace(/^\//,"").replace(/\/$/,"");i&&!this._pageIdMap.has(i)&&this._pageIdMap.set(i,t)}}}getPage(e){let t=e;if(this.activeLocale&&this.activeLocale!==this.defaultLocale){const l=`/${this.activeLocale}`;t===l||t===`${l}/`?t="/":t.startsWith(`${l}/`)&&(t=t.slice(l.length))}const s=t==="/"?"/":t.replace(/\/$/,""),i=this.pages.find(l=>l.route===s);if(i){const l=i.children.find(c=>c.isIndex);return l||i}t=this.reverseTranslateRoute(t);const r=t==="/"?"/":t.replace(/\/$/,""),o=this.pages.find(l=>l.route===r);if(o){const l=o.children.find(c=>c.isIndex);return l||o}const a=this.pages.find(l=>l.isIndex&&l.getNavRoute()===r);if(a)return a;if(this._dynamicPageCache.has(r))return this._dynamicPageCache.get(r);for(const l of this.pages){if(!l.route.includes(":"))continue;const c=this._matchDynamicRoute(l.route,r);if(c){const f=this._createDynamicPage(l,r,c.params);if(f){const{page:u,collectionLoaded:h}=f;return h&&this._dynamicPageCache.set(r,u),u}}}}_matchDynamicRoute(e,t){const s=[],i=e.replace(/[.*+?^${}()|[\]\\]/g,"\\$&").replace(/:(\w+)/g,(l,c)=>(s.push(c),"([^/]+)")),r=new RegExp(`^${i}$`),o=t.match(r);if(!o)return null;const a={};return s.forEach((l,c)=>{a[l]=decodeURIComponent(o[c+1])}),{params:a}}_createDynamicPage(e,t,s){const i=this._dynamicPageData.get(e.route);if(!i)return null;const r=JSON.parse(JSON.stringify(i));r.route=t,r.isDynamic=!1;const o=Object.keys(s)[0],a=Object.values(s)[0],l=i.parentSchema,c=this._singularize(l);if(r.dynamicContext={templateRoute:e.route,params:s,paramName:o,paramValue:a,schema:l,singularSchema:c},r.sections&&Array.isArray(r.sections))for(const p of r.sections)p.dynamicContext=r.dynamicContext;const f=e.route.replace(/\/:[\w]+$/,"")||"/",u=this.pages.find(p=>p.route===f||p.getNavRoute()===f);if(u&&l){const p=u.fetch;let m=[];if(p&&this.fetcher){const g=Array.isArray(p)?p.find(y=>y.schema===l):p.schema===l?p:null;if(g){const y=this.fetcher.peek(g,{website:this});m=Array.isArray(y?.data)?y.data:[]}}const d=m.find(g=>String(g[o])===String(a));d?(d.title&&(r.title=d.title),(d.description||d.excerpt)&&(r.description=d.description||d.excerpt)):m.length>0&&(r.title="Not found",r.notFound=!0),r.dynamicContext.currentItem=d||null,r.dynamicContext.allItems=m,r._collectionLoaded=m.length>0}const h=new Re(r,`dynamic-${t}`,this);return h.parent=e.parent,{page:h,collectionLoaded:r._collectionLoaded??!0}}_singularize(e){return ie(e)}setActivePage(e){const t=this.getPage(e);t&&(this.activePage=t)}setBasePath(e){!e||e==="/"?this.basePath="":this.basePath=e.endsWith("/")?e.slice(0,-1):e}getRemoteLayout(e){const t=globalThis.uniweb?.foundationConfig;return t?.layouts&&e&&t.layouts[e]?t.layouts[e]:null}getDefaultLayoutName(){return globalThis.uniweb?.foundationConfig?.defaultLayout||null}getDefaultBlockType(){return globalThis.uniweb?.foundationConfig?.defaultSection||"Section"}getAreaBlocks(e,t){return t&&this._layoutSets[t]?this._layoutSets[t][e]?.bodyBlocks||null:this._layoutSets.default&&this._layoutSets.default[e]?.bodyBlocks||null}getLayoutAreas(e){const t=e||"default",s=this._layoutSets[t]||this._layoutSets.default;if(!s)return{};const i={};for(const[r,o]of Object.entries(s))o?.bodyBlocks&&(i[r]=o.bodyBlocks);return i}getLayoutMeta(e){return globalThis.uniweb?.foundationConfig?.layoutMeta?.[e]||null}get viewTransitions(){return globalThis.uniweb.foundationConfig?.viewTransitions!==!1}getRemoteProps(){return globalThis.uniweb?.foundationConfig?.props||null}getRoutingComponents(){return globalThis.uniweb?.routingComponents||{}}makeHref(e){if(!e)return e;let t;if(e.startsWith("page:"))t=e.slice(5);else if(e.startsWith("topic:"))t=e.slice(6);else return e;const[s,i]=t.split("#"),r=this._pageIdMap?.get(s);if(!r)return e;let o=r.route;return i&&(o+=`#section-${i}`),o}getLanguages(){return this.langs}getLanguage(){return this.activeLang}getLocales(){return this.locales}getActiveLocale(){return this.activeLocale}getDefaultLocale(){return this.defaultLocale}hasMultipleLocales(){return this.locales.length>1}setActiveLocale(e){this.locales.find(s=>s.code===e)&&(this.activeLocale=e,this.activeLang=e)}getLocaleUrl(e,t=null){let s=t||this.activePage.getNavRoute();if(this.activeLocale&&this.activeLocale!==this.defaultLocale){const o=`/${this.activeLocale}`;s===o||s===`${o}/`?s="/":s.startsWith(`${o}/`)&&(s=s.slice(o.length))}s=this.reverseTranslateRoute(s);const i=this.config?.domainLocales;if(i){const o=Object.entries(i).find(([,a])=>a===e);if(o){const a=o[0],l=this.translateRoute(s,e);return`https://${a}${l==="/"?"/":l}`}}if(e===this.defaultLocale)return s;const r=this.translateRoute(s,e);return r==="/"?`/${e}/`:`/${e}${r}`}getLocale(e){return this.locales.find(t=>t.code===e)}localize(e,t="",s="",i=!1){const r=s||this.activeLang,o=this.langs[0]?.value||"en";if(typeof e=="object"&&!Array.isArray(e))return i?e?.[r]||e?.[o]||t:e?.[r]||t;if(typeof e=="string"){if(!e.startsWith("{")&&!e.startsWith('"'))return e;try{const a=JSON.parse(e);return typeof a=="object"?i?a?.[r]||a?.[o]||t:a?.[r]||t:a}catch{return e}}return t}isSearchEnabled(){return this.config?.search?.enabled!==!1}getSearchConfig(){const e=this.config?.search||{};return{enabled:this.isSearchEnabled(),indexUrl:this.getSearchIndexUrl(),locale:this.getActiveLocale(),include:{pages:e.include?.pages!==!1,sections:e.include?.sections!==!1,headings:e.include?.headings!==!1,paragraphs:e.include?.paragraphs!==!1,links:e.include?.links!==!1,lists:e.include?.lists!==!1},exclude:{routes:e.exclude?.routes||[],components:e.exclude?.components||[]}}}getSearchIndexUrl(){const e=this.getActiveLocale();return e===this.getDefaultLocale()?"/search-index.json":`/${e}/search-index.json`}getSearchData(){return this.pages.map(e=>({id:e.id,title:e.title,href:e.route,route:e.route,description:e.description,content:e.getPageBlocks().map(t=>t.title).filter(Boolean).join(`
|
|
132
|
-
`)}))}getPageHierarchy(e={}){const{nested:t=!0,for:s,includeHidden:i=!1,filter:r,sort:o}=e,a=f=>!(f.route.includes(":")||f.isIndex&&f.route.endsWith("/index")||!i&&(f.hidden||s==="header"&&f.hideInHeader||s==="footer"&&f.hideInFooter)||!f.hasContent()&&!f.children?.some(h=>h.isIndex)&&!f.children?.some(a)||r&&!r(f));let l=this.pages.filter(a);t&&(l=l.filter(f=>!f.parent&&!f.parentRoute)),o&&l.sort(o);const c=f=>{const u=f.getNavRoute();return{id:f.id,route:u,navigableRoute:f.getNavigableRoute(),translatedRoute:this.translateRoute(u),title:f.getTitle(),label:f.getLabel(),description:f.description,hasContent:f.hasContent(),version:f.version||null,children:t&&f.hasChildren()?f.children.filter(a).map(c):[]}};return l.map(c)}getHeaderPages(){return this.getPageHierarchy({for:"header"})}getFooterPages(){return this.getPageHierarchy({for:"footer"})}getAllPages(e=!1){return this.getPageHierarchy({nested:!1,includeHidden:e})}getNotFoundPage(){return this.notFoundPage}getActiveRoute(){return this.activePage.getNormalizedRoute()}getActiveRootSegment(){return this.getActiveRoute().split("/")[0]}normalizeRoute(e){let t=(e||"").replace(/^\/+/,"").replace(/\/+$/,"");if(this.activeLocale&&this.activeLocale!==this.defaultLocale){const r=this.activeLocale;t===r?t="":t.startsWith(`${r}/`)&&(t=t.slice(r.length+1))}const s="/"+t;return t=this.reverseTranslateRoute(s).replace(/^\//,""),t}isRouteActive(e,t){return this.normalizeRoute(e)===this.normalizeRoute(t)}isRouteActiveOrAncestor(e,t){const s=this.normalizeRoute(e),i=this.normalizeRoute(t);return s===i?!0:s===""?!1:i.startsWith(s+"/")}getVersionedScopes(){return this.versionedScopes}hasVersionedContent(){return Object.keys(this.versionedScopes).length>0}getVersionScope(e){const t=e||"";for(const s of Object.keys(this.versionedScopes)){if(t===s)return s;if(s==="/"){if(t.startsWith("/")||t==="")return s}else if(t.startsWith(s+"/"))return s}return null}isVersionedRoute(e){return this.getVersionScope(e)!==null}getVersionMeta(e){return this.versionedScopes[e]||null}getPageVersion(e){return e?.version||null}getVersionsForRoute(e){const t=this.getVersionScope(e);return t?this.versionedScopes[t]?.versions||[]:[]}getVersionUrl(e,t){const s=this.getVersionScope(t);if(!s)return null;const i=this.versionedScopes[s];if(!i)return null;const r=i.versions.find(l=>l.id===e);if(!r)return null;const o=s==="/"?t:t.slice(s.length);let a=o;for(const l of i.versions){const c=`/${l.id}`;if(o.startsWith(c+"/")||o===c){a=o.slice(c.length);break}}return r.latest?s==="/"?a:s+a:s==="/"?"/"+e+a:s+"/"+e+a}getLatestVersion(e){return this.versionedScopes[e]?.latestId||null}}const St=typeof window<"u"&&typeof document<"u";class gr{constructor(e={}){this.endpoint=e.endpoint||null,this.flushInterval=e.flushInterval||5e3,this.maxQueueSize=e.maxQueueSize||10,this.debug=e.debug||!1,this.queue=[],this.scrollMilestones=new Set,this.sessionId=this.generateSessionId(),this.sessionStart=Date.now(),this.flushIntervalId=null,St&&this.isEnabled()&&(this.setupFlushInterval(),this.setupUnloadHandler()),Object.seal(this)}isEnabled(){return!!this.endpoint}generateSessionId(){return`${Date.now()}-${Math.random().toString(36).substr(2,9)}`}setupFlushInterval(){this.flushIntervalId=setInterval(()=>{this.flush()},this.flushInterval)}setupUnloadHandler(){const e=()=>{this.flush(!0)};window.addEventListener("visibilitychange",()=>{document.visibilityState==="hidden"&&e()}),window.addEventListener("pagehide",e)}addToQueue(e,t){if(!this.isEnabled()||!St)return;const s={type:e,data:t,timestamp:Date.now(),sessionId:this.sessionId,url:window.location.href,referrer:document.referrer||null};this.queue.push(s),this.debug&&console.log("[Analytics] Event queued:",s),this.queue.length>=this.maxQueueSize&&this.flush()}trackPageView(e,t,s={}){this.scrollMilestones.clear(),this.addToQueue("pageview",{path:e,title:t,...s})}trackEvent(e,t={}){this.addToQueue("event",{name:e,...t})}trackScrollDepth(e){[25,50,75,100].includes(e)&&(this.scrollMilestones.has(e)||(this.scrollMilestones.add(e),this.addToQueue("scroll_depth",{depth:e})))}flush(e=!1){if(!this.isEnabled()||!St||this.queue.length===0)return;const t=[...this.queue];this.queue=[];const s=JSON.stringify({events:t,sessionId:this.sessionId,sessionDuration:Date.now()-this.sessionStart});if(this.debug&&console.log("[Analytics] Flushing",t.length,"events"),e&&navigator.sendBeacon){const i=new Blob([s],{type:"application/json"});!navigator.sendBeacon(this.endpoint,i)&&this.debug&&console.warn("[Analytics] sendBeacon failed, events may be lost");return}fetch(this.endpoint,{method:"POST",headers:{"Content-Type":"application/json"},body:s,keepalive:!0}).catch(i=>{this.debug&&console.warn("[Analytics] Flush failed:",i),this.queue.unshift(...t)})}destroy(){this.flushIntervalId&&clearInterval(this.flushIntervalId),this.flush(!0)}}class mr{constructor({content:e={},foundation:t=null,extensions:s=[],defaultFetcher:i=null,transport:r=null,dev:o=!1}={}){this.activeWebsite=new pr({content:e,foundation:t,extensions:s,defaultFetcher:i,transport:r,dev:o}),this.foundation=t,this.foundationConfig={},this.meta=t?.default?.meta||{},this.extensions=[],t?.default?.capabilities&&(this.foundationConfig={...t.default.capabilities}),t?.default?.layoutMeta&&(this.foundationConfig.layoutMeta=t.default.layoutMeta),t?.default?.handlers&&(this.foundationConfig.handlers=t.default.handlers),t?.default?.viewTransitions!==void 0&&(this.foundationConfig.viewTransitions=t.default.viewTransitions);for(const a of s)this._wireExtension(a);this.childBlockRenderer=null,this.routingComponents={},this.language="en",this.iconResolver=null,this.iconCache=new Map,this.analytics=new gr(e?.analytics||e?.config?.analytics||{}),Object.seal(this)}_wireExtension(e){const t=e?.default?.meta||{};this.extensions.push({foundation:e,meta:t})}async resolveIcon(e,t){return this.iconResolver?this.iconResolver(e,t):(console.warn("[Uniweb] No icon resolver configured"),null)}getIconSync(e,t){return this.iconCache.get(`${e}:${t}`)||null}getComponentMeta(e){const t=this.meta[e];if(t)return t;for(const s of this.extensions){const i=s.meta[e];if(i)return i}return null}getComponentDefaults(e){return this.getComponentMeta(e)?.defaults||{}}getComponent(e){if(!this.foundation){console.warn("[Runtime] No foundation loaded");return}const t=this.foundation[e];if(t)return t;for(const s of this.extensions){const i=s.foundation[e];if(i)return i}}listComponents(){const e=new Set;if(this.foundation)for(const t of Object.keys(this.foundation))t!=="default"&&e.add(t);for(const t of this.extensions)for(const s of Object.keys(t.foundation))s!=="default"&&e.add(s);return[...e]}}const yr=new Set(["eq","ne","gt","gte","lt","lte","in","nin","like","exists"]);function He(n,e){if(n==null)return!0;if(typeof n!="object"||Array.isArray(n)||e==null||typeof e!="object")return!1;for(const t of Object.keys(n))if(!br(t,n[t],e))return!1;return!0}function Er(n,e){return Array.isArray(e)?n==null?e.slice():e.filter(t=>He(n,t)):[]}function br(n,e,t){if(n==="and")return Array.isArray(e)?e.every(i=>He(i,t)):!1;if(n==="or")return Array.isArray(e)?e.some(i=>He(i,t)):!1;if(n==="not")return!He(e,t);const s=vr(t,n);return e===null?s==null:typeof e=="object"&&!Array.isArray(e)&&wr(e)?kr(e,s):we(s,e)}function wr(n){if(n==null||typeof n!="object"||Array.isArray(n))return!1;const e=Object.keys(n);return e.length===0?!1:e.every(t=>yr.has(t))}function kr(n,e){for(const t of Object.keys(n))if(!Sr(t,n[t],e))return!1;return!0}function Sr(n,e,t){switch(n){case"eq":return we(t,e);case"ne":return!we(t,e);case"gt":return De(t,e)&&t>e;case"gte":return De(t,e)&&t>=e;case"lt":return De(t,e)&&t<e;case"lte":return De(t,e)&&t<=e;case"in":return Array.isArray(e)?e.some(s=>we(t,s)):!1;case"nin":return Array.isArray(e)?!e.some(s=>we(t,s)):!1;case"like":return typeof t!="string"||typeof e!="string"?!1:Ar(e,t);case"exists":return!!t==!!e;default:return!1}}function we(n,e){return n===e?!0:n==null||e==null?!1:Array.isArray(n)&&!Array.isArray(e)?n.some(t=>t===e):!1}function De(n,e){return n==null||e==null?!1:typeof n==typeof e}function vr(n,e){if(typeof e!="string")return;if(e.indexOf(".")===-1)return n[e];let t=n;for(const s of e.split(".")){if(t==null||typeof t!="object")return;t=t[s]}return t}function Ar(n,e){const t="^"+n.replace(/[.+^${}()|[\]\\]/g,"\\$&").replace(/\*/g,".*").replace(/\?/g,".")+"$";return new RegExp(t).test(e)}function Mr(n){return!n||typeof n!="object"?!1:!!(Array.isArray(n.fields)||n.isComposite===!0||n.childSchema&&typeof n.childSchema=="object")}const Qe={name:"json-body",canPush:new Set(["where","limit","sort"]),defaultEnvelope:null,encode(n,{method:e,pushCandidates:t,rename:s}){const i=new Set,r=[];let o=null;if(e==="GET")t.has("where")&&n.where!==void 0&&(r.push([se("where","_where",s),JSON.stringify(n.where)]),i.add("where")),t.has("limit")&&n.limit!==void 0&&(r.push([se("limit","_limit",s),String(n.limit)]),i.add("limit")),t.has("sort")&&n.sort!==void 0&&(r.push([se("sort","_sort",s),String(n.sort)]),i.add("sort"));else if(e==="POST"){const a={};t.has("where")&&n.where!==void 0&&(a[se("where","where",s)]=n.where,i.add("where")),t.has("limit")&&n.limit!==void 0&&(a[se("limit","limit",s)]=n.limit,i.add("limit")),t.has("sort")&&n.sort!==void 0&&(a[se("sort","sort",s)]=n.sort,i.add("sort")),Object.keys(a).length>0&&(o=a)}return{queryParams:r,bodyMerge:o,pushed:i}}};function se(n,e,t){return t&&typeof t[n]=="string"&&t[n].length>0?t[n]:e}const As={name:"flat-query",canPush:new Set(["where","limit","sort"]),defaultEnvelope:null,encode(n,{method:e,pushCandidates:t,rename:s}){const i=new Set,r=[];if(e!=="GET")return{queryParams:r,bodyMerge:null,pushed:i};if(t.has("where")&&n.where!==void 0){const o=Ir(n.where);if(o!==null){for(const[a,l]of o)r.push([Lr(a),l]);i.add("where")}}if(t.has("limit")&&n.limit!==void 0&&(r.push([Ls("limit","limit",s),String(n.limit)]),i.add("limit")),t.has("sort")&&n.sort!==void 0){const o=_r(n.sort);o!==null&&(r.push([Ls("sort","sort",s),o]),i.add("sort"))}return{queryParams:r,bodyMerge:null,pushed:i}}};function Ir(n){if(!n||typeof n!="object"||Array.isArray(n))return null;const e=[];for(const[t,s]of Object.entries(n)){if(t==="and"||t==="or"||t==="not"||t.includes("."))return null;if(Is(s)){e.push([t,_s(s)]);continue}if(s&&typeof s=="object"&&!Array.isArray(s)){const i=Object.keys(s);if(i.length===1&&i[0]==="eq"&&Is(s.eq)){e.push([t,_s(s.eq)]);continue}}return null}return e}function _r(n){if(typeof n!="string"||n.length===0)return null;const e=n.split(",").map(s=>s.trim()).filter(Boolean);if(e.length===0)return null;const t=[];for(const s of e){const[i,r]=s.split(/\s+/);if(!i)return null;const o=(r||"asc").toLowerCase()==="desc";t.push(o?`-${i}`:i)}return t.join(",")}function Is(n){if(n===null)return!0;const e=typeof n;return e==="string"||e==="number"||e==="boolean"}function _s(n){return n===null?"":String(n)}function Ls(n,e,t){return t&&typeof t[n]=="string"&&t[n].length>0?t[n]:e}function Lr(n,e){return n}const Os={name:"strapi",canPush:new Set(["where","limit","sort"]),defaultEnvelope:{collection:"data",item:"data"},encode(n,{method:e,pushCandidates:t,rename:s}){const i=new Set,r=[];if(e!=="GET")return{queryParams:r,bodyMerge:null,pushed:i};if(t.has("where")&&n.where!==void 0){const o=It("where","filters",s),a=Nr(n.where,o);if(a!==null){for(const l of a)r.push(l);i.add("where")}}if(t.has("limit")&&n.limit!==void 0){const o=It("limit","pagination[limit]",s);r.push([o,String(n.limit)]),i.add("limit")}if(t.has("sort")&&n.sort!==void 0){const o=Cr(n.sort,It("sort","sort",s));if(o!==null){for(const a of o)r.push(a);i.add("sort")}}return{queryParams:r,bodyMerge:null,pushed:i}}},Or={eq:"[$eq]",ne:"[$ne]",gt:"[$gt]",gte:"[$gte]",lt:"[$lt]",lte:"[$lte]",in:"[$in]",nin:"[$notIn]",like:"[$containsi]",exists:"[$notNull]"};function Nr(n,e){const t=[];try{Mt(n,[e],t)}catch(s){if(s&&s.unencodable)return null;throw s}return t.length>0?t:null}function Mt(n,e,t){(!n||typeof n!="object"||Array.isArray(n))&&G();for(const[s,i]of Object.entries(n))s==="and"||s==="or"?(Array.isArray(i)||G(),i.forEach((r,o)=>{Mt(r,[...e,`[$${s}]`,`[${o}]`],t)})):s==="not"?Mt(i,[...e,"[$not]"],t):$r(s,i,e,t)}function $r(n,e,t,s){const i=n.split(".").map(o=>`[${o}]`),r=[...t,...i];if(vt(e)){s.push([Ke(r)+"[$eq]",At(e)]);return}if(e&&typeof e=="object"&&!Array.isArray(e)){for(const[o,a]of Object.entries(e)){const l=Or[o];if(l||G(),o==="in"||o==="nin"){Array.isArray(a)||G(),a.forEach((c,f)=>{vt(c)||G(),s.push([Ke(r)+l+`[${f}]`,At(c)])});continue}if(o==="exists"){const c=!!a;s.push([Ke(r)+(c?"[$notNull]":"[$null]"),"true"]);continue}vt(a)||G(),s.push([Ke(r)+l,At(a)])}return}G()}function Ke(n){return n.join("")}function G(){const n=new Error("unencodable predicate");throw n.unencodable=!0,n}function Cr(n,e){if(typeof n!="string"||n.length===0)return null;const t=n.split(",").map(i=>i.trim()).filter(Boolean);if(t.length===0)return null;const s=[];for(const i of t){const[r,o]=i.split(/\s+/);if(!r)return null;const a=(o||"asc").toLowerCase()==="desc"?"desc":"asc";s.push(`${r}:${a}`)}return s.length===1?[[e,s[0]]]:s.map((i,r)=>[`${e}[${r}]`,i])}function vt(n){if(n===null)return!0;const e=typeof n;return e==="string"||e==="number"||e==="boolean"}function At(n){return n===null?"":String(n)}function It(n,e,t){return t&&typeof t[n]=="string"&&t[n].length>0?t[n]:e}const Bt=new Map([[Qe.name,Qe],[As.name,As],[Os.name,Os]]);function Br(n,{dev:e=!1}={}){if(!n)return Qe;const t=Bt.get(n);return t||(e&&!Ns.has(n)&&(Ns.add(n),console.warn(`[default-fetcher] unknown request style "${n}"; falling back to "json-body". Known styles: ${[...Bt.keys()].join(", ")}.`)),Qe)}const Ns=new Set;function Pr(){return[...Bt.keys()]}function jr(){return globalThis.uniweb}function xr(n,e=null,t=[],{defaultFetcher:s=null,transport:i=null,dev:r=!1}={}){const o=new mr({content:n,foundation:e,extensions:t,defaultFetcher:s,transport:i,dev:r});return globalThis.uniweb=o,o}export{K as B,fr as D,dr as E,vs as F,mn as O,Re as P,mr as U,pr as W,Ae as a,Tr as b,xr as c,cr as d,He as e,jr as g,Mr as i,Pr as l,Er as m,ys as n,Br as r,ie as s};
|
|
133
|
-
//# sourceMappingURL=index-4Jlbab_T.js.map
|