pi-straw-boss 0.97.0 → 0.99.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/NOTICE.md +13 -3
- package/README.md +4 -2
- package/README.zh-TW.md +4 -2
- package/dist/gui/assets/{allyasks-D10CgLCk.js → allyasks-BY-NwiK5.js} +2 -2
- package/dist/gui/assets/allyunits-B9DbNTsq.js +2 -0
- package/dist/gui/assets/{answer-Bf5L7ikL.js → answer-ChjVWtA7.js} +1 -1
- package/dist/gui/assets/{ask-D3RGpzUJ.js → ask-BAt58Mlv.js} +1 -1
- package/dist/gui/assets/{asks-gZy3oCST.js → asks-grX34oB6.js} +1 -1
- package/dist/gui/assets/{askview-BHYiKj0D.js → askview-kfMnaYAk.js} +1 -1
- package/dist/gui/assets/autoback-BwfR4EQl.js +2 -0
- package/dist/gui/assets/{blockschunk-DxGXJvKd.js → blockschunk-DJacWeSo.js} +93 -83
- package/dist/gui/assets/boot-DFAu4Wgr.js +72 -0
- package/dist/gui/assets/{box-oqjw39YP.js → box-DOqsrONn.js} +1 -1
- package/dist/gui/assets/{chat-DhAI904v.js → chat-DrJQ99_m.js} +2 -2
- package/dist/gui/assets/{copy-OYhtU_G-.js → copy-BkYMWq9q.js} +1 -1
- package/dist/gui/assets/drawer-DjXNKvdU.js +1 -0
- package/dist/gui/assets/index-CQtxJFRw.js +4 -0
- package/dist/gui/assets/index-w4qFe3dr.css +1 -0
- package/dist/gui/assets/{lanwait-CnHAARL6.js → lanwait-RymCQjCx.js} +1 -1
- package/dist/gui/assets/layer-BIsQwhRo.js +1 -0
- package/dist/gui/assets/{lightbox-CCzRvB29.js → lightbox-BPXfZTek.js} +1 -1
- package/dist/gui/assets/link-n34y570C.js +1 -0
- package/dist/gui/assets/linkdialogs-CdnqqK-6.js +1 -0
- package/dist/gui/assets/marimba-C8mX0MKf.mp3 +0 -0
- package/dist/gui/assets/{mdbody-CCMLbIiV.js → mdbody-TCBjLlVA.js} +2 -2
- package/dist/gui/assets/{pair-CLHgWyGU.js → pair-Bt3_oS6r.js} +3 -3
- package/dist/gui/assets/{picker-BSsuidyx.js → picker-Dn11L7yC.js} +1 -1
- package/dist/gui/assets/{server-jRKNQ00n.js → server-W2hvaNUi.js} +2 -2
- package/dist/gui/assets/{sessionfacts-B10W8Tnp.js → sessionfacts-k-iYU6UE.js} +1 -1
- package/dist/gui/assets/{settings-CJjA_G-F.js → settings-ppzwBzTR.js} +2 -2
- package/dist/gui/assets/{spawn-Djs0ihu1.js → spawn-Bid-ciT4.js} +1 -1
- package/dist/gui/assets/{termcard-BiVW2HNE.js → termcard-BGxPw11W.js} +5 -5
- package/dist/gui/assets/{towerturns-DJ89gl5C.js → towerturns-CQXPvXLw.js} +1 -1
- package/dist/gui/assets/{trains-CHhLGtkV.js → trains-C-OyGvCg.js} +1 -1
- package/dist/gui/assets/{trust-DmzWsnkn.js → trust-Kha1VLdr.js} +1 -1
- package/dist/gui/assets/views-EUqV1oz2.js +3 -0
- package/dist/gui/assets/waitcard-DoDDMtr6.js +1 -0
- package/dist/gui/assets/yard-6HZ9KXEt.js +1 -0
- package/dist/gui/index.html +8 -7
- package/dist/gui/themes/geek/{geek-BEJdSv6Q.css → geek-DKTbBMez.css} +1 -1
- package/dist/gui/themes/raven/{raven-DGujKSc6.js → raven-C0zmMXos.js} +8 -1
- package/dist/gui/themes/storybook/backdrop-day-Dn3Fw0N1.webp +0 -0
- package/dist/gui/themes/storybook/backdrop-night-CgpfG4j3.webp +0 -0
- package/dist/gui/themes/storybook/favicon-storybook-DEGRmtRq.svg +1 -0
- package/dist/gui/themes/storybook/kalimba-thumb-pluck-BCuhSDJF.mp3 +0 -0
- package/dist/gui/themes/storybook/night-cricket-meadow-Bqg5DdBj.mp3 +0 -0
- package/dist/gui/themes/storybook/place-forest-birds-singing-CAVrIQL7.mp3 +0 -0
- package/dist/gui/themes/storybook/storybook-BMCr3y6o.css +1 -0
- package/dist/gui/themes/storybook/storybook-ChSlGjc_.js +11 -0
- package/dist/gui/themes/zen/zen-BjTzN8F5.js +2 -0
- package/dist/gui/themes.json +14 -8
- package/dist/server/{chunk-OAW6VWNE.mjs → chunk-CS4SR3S3.mjs} +2 -0
- package/dist/server/cli.mjs +1 -1
- package/dist/server/main.mjs +400 -219
- package/package.json +2 -2
- package/prompts/ally-run.md +1 -1
- package/src/answered.ts +2 -2
- package/src/boss.ts +1 -1
- package/src/bossviews.ts +2 -2
- package/src/host.ts +1 -1
- package/src/link/holder.ts +5 -2
- package/src/link/kinds.ts +6 -4
- package/src/link/waitcall.ts +3 -2
- package/src/opener.ts +11 -6
- package/src/server/guihost.ts +4 -3
- package/src/server/guiprefs.ts +10 -2
- package/src/server/runs.ts +2 -2
- package/src/server/runtools.ts +8 -5
- package/src/server/standin.ts +2 -2
- package/src/server/standing.ts +1 -1
- package/src/server/workerally.ts +32 -23
- package/src/server/workerbook.ts +64 -0
- package/src/server/workeropen.ts +10 -4
- package/src/server/workerrelay.ts +17 -7
- package/src/server/workerresume.ts +99 -0
- package/src/server/workersend.ts +5 -3
- package/src/server/workerwire.ts +8 -1
- package/src/views.ts +11 -6
- package/src/workerhandoff.ts +16 -1
- package/src/workerslip.ts +22 -10
- package/dist/gui/assets/allyunits-4W1xhATx.js +0 -2
- package/dist/gui/assets/autoback-DLEkymBb.js +0 -2
- package/dist/gui/assets/boot-BCyyZKXB.js +0 -53
- package/dist/gui/assets/drawer-WFT2-tGS.js +0 -1
- package/dist/gui/assets/index-JNy9LPcl.js +0 -4
- package/dist/gui/assets/index-QWRB6fh0.css +0 -1
- package/dist/gui/assets/layer-C-twSMfn.js +0 -1
- package/dist/gui/assets/link-0Dk9mHpb.js +0 -1
- package/dist/gui/assets/linkdialogs-ZVggush6.js +0 -1
- package/dist/gui/assets/views-B752Jx2Y.js +0 -3
- package/dist/gui/assets/waitcard-BE0DHpyY.js +0 -1
- package/dist/gui/assets/waiting-DOg8-8gu.mp3 +0 -0
- package/dist/gui/assets/yard-v3MeFhGO.js +0 -1
- package/dist/gui/themes/zen/zen-D4lhOxtO.js +0 -2
- /package/dist/gui/themes/geek/{geek-BirbB51I.js → geek-Cwnsup9m.js} +0 -0
|
@@ -1,67 +1,67 @@
|
|
|
1
|
-
import{t as e}from"./runtime-ZX6HkxDa.js";import{s as t}from"./sessionfacts-
|
|
1
|
+
import{t as e}from"./runtime-ZX6HkxDa.js";import{s as t}from"./sessionfacts-k-iYU6UE.js";import{i as n}from"./mdbody-TCBjLlVA.js";import{n as r,r as i}from"./markdown-Bk5NWfKQ.js";import{gt as a}from"./index-CQtxJFRw.js";import{t as o}from"./focusback-DGGGUsJl.js";var s=((t={},n={})=>(n.locale??e())===`zh-TW`?`返回`:`Back`),c=((t={},n={})=>(n.locale??e())===`zh-TW`?`送出`:`Send`),l=((t={},n={})=>(n.locale??e())===`zh-TW`?`你的回答會以這段文字送出:`:`Your answer goes out as this text:`),u=((t={},n={})=>(n.locale??e())===`zh-TW`?`傳送中…`:`Sending…`),d=((t={},n={})=>(n.locale??e())===`zh-TW`?`無法讀取這題是否已回答。`:`Whether this was answered could not be read.`);function f(e){return v(e.replace(/\r\n?/g,`
|
|
2
2
|
`))}var p=/[!-/:-@[-`{-~]/,m=/[\p{L}\p{N}]/u,h=/^https?:\/\/[^\s<>]+/i,g=/^https?:\/\/[^\s<>]+$/i,_=e=>e!==void 0&&m.test(e);function v(e){let t=[],n=``,r=()=>{n&&t.push({type:`text`,text:n}),n=``},i=e=>{r(),t.push(e)},a=0;for(;a<e.length;){let t=e[a];if(t===`\\`&&p.test(e[a+1]??``))n+=e[a+1],a+=2;else if(t===`
|
|
3
3
|
`)i({type:`br`}),a++;else if(t==="`"){let t=y(e,a);if(t===void 0){let t=/^`+/.exec(e.slice(a))?.[0]??"`";n+=t,a+=t.length}else i({type:`code`,text:t.text}),a=t.next}else if(t===`[`){let r=b(e,a);r?(i({type:`link`,href:r.href,children:v(r.label)}),a=r.next):(n+=t,a++)}else if(t===`*`||t===`_`){let r=S(e,a);r?(i({type:r.strong?`strong`:`em`,children:v(r.inner)}),a=r.next):(n+=t,a++)}else if((t===`h`||t===`H`)&&!_(e[a-1])){let r=x(e,a);r?(i({type:`link`,href:r,children:[{type:`text`,text:r}]}),a+=r.length):(n+=t,a++)}else n+=t,a++}return r(),t}function y(e,t){let n=/^`+/.exec(e.slice(t))?.[0],r=t+n.length;for(;r<e.length;){let i=e.indexOf(n,r);if(i<0)return;if(e[i+n.length]==="`"||e[i-1]==="`"){for(r=i+1;e[r]==="`";)r++;continue}let a=e.slice(t+n.length,i).replace(/\n/g,` `);return{text:a.length>2&&a.startsWith(` `)&&a.endsWith(` `)&&a.trim()!==``?a.slice(1,-1):a,next:i+n.length}}}function b(e,t){let n=0,r=-1;for(let i=t;i<e.length;i++){let t=e[i];if(t===`\\`)i++;else if(t===`[`)n++;else if(t===`]`&&--n===0){r=i;break}}if(r<0||e[r+1]!==`(`)return;let i=e.indexOf(`)`,r+2);if(i<0)return;let a=e.slice(r+2,i).trim(),o=e.slice(t+1,r);if(g.test(a)&&o.trim()!==``)return{label:o,href:a,next:i+1}}function x(e,t){let n=h.exec(e.slice(t))?.[0];if(!n)return;let r=n;for(;;){let e=r[r.length-1],t=e===`)`&&(r.match(/\(/g)?.length??0)<(r.match(/\)/g)?.length??0);if(/[.,;:!?'"\]}]/.test(e)||t)r=r.slice(0,-1);else break}return/^https?:\/\/[^/\s]+/i.test(r)&&r.length>8?r:void 0}function S(e,t){let n=e[t],r=e[t+1]===n,i=r?2:1,a=n.repeat(i);if(n===`_`&&_(e[t-1]))return;let o=t+i;if(o>=e.length||/\s/.test(e[o]))return;let s=o;for(;s<e.length;){let t=e.indexOf(a,s);if(t<0)return;if(e[t-1]===`\\`){s=t+1;continue}if(r)for(;e[t+i]===n;)t++;if(!r&&(e[t+1]===n||e[t-1]===n)){s=t+2;continue}let c=e.slice(o,t),l=c===``||/\s$/.test(c),u=n===`_`&&_(e[t+i]);if(l||u)s=t+i;else return{inner:c,strong:r,next:t+i}}}function ee(e){switch(e.type){case`text`:case`code`:return e.text;case`br`:return`
|
|
4
|
-
`;case`strong`:case`em`:return C(e.children);case`link`:{let t=C(e.children);return t===e.href?t:`${t} (${e.href})`}}}var C=e=>e.map(ee).join(``);function w(e){return C(f(e))}function T(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`each ${t} must be a mapping`);return e}function E(e,t){if(Array.isArray(e))return e;let n=e&&typeof e==`object`?e[t]:void 0;if(!Array.isArray(n))throw Error(`expected a YAML list, or a mapping with a \`${t}\` list`);return n}function
|
|
5
|
-
`)||`(no fields)`}`}function
|
|
4
|
+
`;case`strong`:case`em`:return C(e.children);case`link`:{let t=C(e.children);return t===e.href?t:`${t} (${e.href})`}}}var C=e=>e.map(ee).join(``);function w(e){return C(f(e))}var te=class extends Error{path;constructor(e,t){super(t),this.path=e}};function T(e,t){if(typeof e!=`object`||!e||Array.isArray(e))throw Error(`each ${t} must be a mapping`);return e}function E(e,t){if(Array.isArray(e))return e;let n=e&&typeof e==`object`?e[t]:void 0;if(!Array.isArray(n))throw Error(`expected a YAML list, or a mapping with a \`${t}\` list`);return n}function ne(e){return typeof e==`object`&&e&&!Array.isArray(e)?e:{}}function D(e,t){if(e==null)return;if(typeof e==`object`)throw Error(`${t} must be text`);let n=String(e).trim();return n===``?void 0:n}function re(e,t){let n=D(e,t);if(n===void 0)throw Error(`${t} is required`);return n}function ie(e,t){return e==null?[]:(Array.isArray(e)?e.map(e=>D(e,t)):String(e).split(`;`).map(e=>e.trim())).filter(e=>e!==void 0&&e!==``)}function ae(e){if(e===!0)return!0;if(e&&typeof e!=`object`)return String(e)}function oe(e,t){if(e!=null){if(typeof e!=`boolean`)throw Error(`${t} must be true or false`);return e}}function se(e,t){if(e==null)return;let n=Number(e);if(!Number.isFinite(n)||n<=0)throw Error(`${t} must be a positive number`);return n}function ce(e,t,n){if(e==null)return;let r=t.find(t=>t===String(e));if(r===void 0)throw Error(`${n} must be one of ${t.join(`, `)}`);return r}function le(e,t,n){return typeof e==`object`&&e?T(e,n):{[t]:e}}function ue(e){return{cards:E(e,`cards`).map(e=>{let t=T(e,`card`);return{title:D(t.title,`title`),tone:D(t.tone,`tone`),body:D(t.body,`body`)}})}}function de(e){return{options:E(e,`options`).map(e=>{let t=T(e,`option`);return{title:D(t.title,`title`),recommended:ae(t.recommended),body:D(t.body,`body`),pros:ie(t.pros,`pros`),cons:ie(t.cons,`cons`)}})}}var fe=`pi-note`,pe=[`single`,`multi`,`text`];function me(e){let t=le(e,`label`,`choice`),n=D(t.label??t.value,`choice label`);if(n===void 0)throw Error(`each choice needs a label or a value`);return{value:D(t.value,`choice value`)??n,label:n,note:D(t.note,`note`),recommended:ae(t.recommended)}}function he(e){let t=T(e,`question`),n=D(t.label,`label`),r=D(t.name,`name`)??n;if(r===void 0)throw Error(`each question needs a name or a label`);if(r===`pi-note`)throw Error(`the question name "pi-note" is reserved for the other-comments box`);let i=(Array.isArray(t.choices)?t.choices:ie(t.choices,`choices`)).map(me),a=ce(t.type,pe,`type`)??(i.length>0?`single`:`text`),o=t.other===void 0||t.other===null?i.length>0:typeof t.other==`boolean`?t.other:String(t.other);return{name:r,label:n,type:a,hint:D(t.hint,`hint`),required:t.required===!0,other:a!==`text`&&o,choices:i}}function ge(e){let t=ne(e);return{title:D(t.title,`title`),submit:D(t.submit,`submit`),questions:E(e,`questions`).map(he)}}function _e(e){let t=new Set(e.filter(Boolean)),n=new Set,r=0,i=()=>{for(;;){let e=r<26?String.fromCharCode(65+r):String(r+1);if(r++,!t.has(e))return e}};return e.map(e=>{let t=e||i(),r=t;for(let e=2;n.has(r);e++)r=`${t}${e}`;return n.add(r),r})}var ve=e=>e.label?`${e.name} (${e.label})`:e.name;function ye(e){let t=new Map;return e.items.forEach((n,r)=>{let i=e.pickMode===`grouped`?n.group:void 0,a=t.get(i);a?a.push(r):t.set(i,[r])}),t}var be=`picked:`,xe=e=>e===void 0?`picked`:be+e,Se=e=>e.startsWith(be)?e.slice(7):void 0;function Ce(e){return e.flatMap(([e,t])=>{let n=Se(e);return(e===`picked`||n!==void 0)&&t?[{group:n,value:t}]:[]})}var we=(e,t)=>e.title?w(e.title):String(t+1);function Te(e){let t=ne(e),n=E(e,`items`).map(e=>le(e,`image`,`item`)),r=t.pickMode;if(r!==void 0&&r!==`grouped`&&r!==`multi`)throw new te([`pickMode`],`pickMode must be grouped or multi`);let i=(t,n)=>{let i=Array.isArray(e)?[n,`group`]:[`items`,n,`group`];if(r===`grouped`){let e=typeof t.group==`object`?void 0:D(t.group,`group`);if(!e)throw new te(i,`item ${n+1} needs a non-empty group name`);return e}if(`group`in t)throw new te(i,`group requires pickMode: grouped`)},a=_e(n.map(e=>D(e.name,`name`))),o=n.map((e,t)=>({name:a[t],group:i(e,t),label:D(e.label,`label`),image:D(e.image,`image`),page:D(e.page,`page`),height:se(e.height,`height`),body:D(e.body,`body`)}));return{title:D(t.title,`title`),submit:D(t.submit,`submit`),pick:ae(t.pick),pickMode:r,columns:se(t.columns,`columns`),items:o}}var Ee=(e,t)=>e.find(([e])=>e===t)?.[1],De=(e,t)=>e.filter(([e])=>e===t).map(([,e])=>e);function Oe(e){return`User submitted a form in the HTML review pane:\n${e.map(([e,t])=>`- ${e}: ${t}`).join(`
|
|
5
|
+
`)||`(no fields)`}`}function ke(e,t){let n=De(e,`quote`),r=De(e,`comment`),i=n.map((e,t)=>[e?e.split(`
|
|
6
6
|
`).map(e=>`> ${e}`).join(`
|
|
7
7
|
`):``,r[t]||`(no comment)`].filter(Boolean).join(`
|
|
8
|
-
`)),a=
|
|
8
|
+
`)),a=Ee(e,`overall`);return a&&i.push(`Overall: ${a}`),`User feedback on the page "${Ee(e,`page`)??t??``}":\n\n${i.join(`
|
|
9
9
|
|
|
10
|
-
`)||`(empty)`}`}function
|
|
11
|
-
`)}`),i=
|
|
12
|
-
`)}function
|
|
13
|
-
`)}function
|
|
14
|
-
`);case`checklist`:return
|
|
15
|
-
`)}}
|
|
16
|
-
`)?
|
|
10
|
+
`)||`(empty)`}`}function Ae(e,t){let n=De(e,`comment`),r=De(e,`item`).map((e,t)=>`- ${e}: ${(n[t]??``).replace(/\n/g,`
|
|
11
|
+
`)}`),i=Ee(e,`silent`);return[`User reviewed "${Ee(e,`title`)??t??``}":`,...Ce(e).map(({group:e,value:t})=>e===void 0?`Picked: ${t}`:`Picked (${e}): ${t}`),...r,...i?[`No feedback on: ${i}`]:[]].join(`
|
|
12
|
+
`)}function je(e,t){return`User picked "${Ee(e,`picked`)??``}"${t?` for "${t}"`:``}.`}function Me(e,t){let n=e.map(([e,t])=>`${t===`checked`?`☑`:`☐`} ${e}`);return[`User updated the checklist${t?` "${t}"`:``}:`,...n].join(`
|
|
13
|
+
`)}function Ne(e){let t=e.fields.filter(([e])=>e!==`pi-kind`);if(e.kind===`feedback`)return Pe(e,t);let n=Ee(t,fe)?.trim(),r=Pe(e,t.filter(([e])=>e!==fe));return n?`${r}\n\nOther comments: ${n}`:r}function Pe(e,t){switch(e.kind){case`form`:return Oe(t);case`review`:return Ae(t,e.title);case`feedback`:return ke(t,e.title);case`pick`:return je(t,e.title);case`suggest`:return Ee(t,`text`)??t.map(([,e])=>e).join(`
|
|
14
|
+
`);case`checklist`:return Me(t,e.title)}}var Fe=Symbol.for(`yaml.alias`),Ie=Symbol.for(`yaml.document`),O=Symbol.for(`yaml.map`),Le=Symbol.for(`yaml.pair`),k=Symbol.for(`yaml.scalar`),Re=Symbol.for(`yaml.seq`),A=Symbol.for(`yaml.node.type`),ze=e=>!!e&&typeof e==`object`&&e[A]===Fe,Be=e=>!!e&&typeof e==`object`&&e[A]===Ie,Ve=e=>!!e&&typeof e==`object`&&e[A]===O,j=e=>!!e&&typeof e==`object`&&e[A]===Le,M=e=>!!e&&typeof e==`object`&&e[A]===k,He=e=>!!e&&typeof e==`object`&&e[A]===Re;function N(e){if(e&&typeof e==`object`)switch(e[A]){case O:case Re:return!0}return!1}function P(e){if(e&&typeof e==`object`)switch(e[A]){case Fe:case O:case k:case Re:return!0}return!1}var Ue=e=>(M(e)||N(e))&&!!e.anchor,F=Symbol(`break visit`),We=Symbol(`skip children`),Ge=Symbol(`remove node`);function Ke(e,t){let n=Je(t);Be(e)?qe(null,e.contents,n,Object.freeze([e]))===Ge&&(e.contents=null):qe(null,e,n,Object.freeze([]))}Ke.BREAK=F,Ke.SKIP=We,Ke.REMOVE=Ge;function qe(e,t,n,r){let i=Ye(e,t,n,r);if(P(i)||j(i))return Xe(e,r,i),qe(e,i,n,r);if(typeof i!=`symbol`){if(N(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=qe(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===F)return F;else i===Ge&&(t.items.splice(e,1),--e)}}else if(j(t)){r=Object.freeze(r.concat(t));let e=qe(`key`,t.key,n,r);if(e===F)return F;e===Ge&&(t.key=null);let i=qe(`value`,t.value,n,r);if(i===F)return F;i===Ge&&(t.value=null)}}return i}function Je(e){return typeof e==`object`&&(e.Collection||e.Node||e.Value)?Object.assign({Alias:e.Node,Map:e.Node,Scalar:e.Node,Seq:e.Node},e.Value&&{Map:e.Value,Scalar:e.Value,Seq:e.Value},e.Collection&&{Map:e.Collection,Seq:e.Collection},e):e}function Ye(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Ve(t))return n.Map?.(e,t,r);if(He(t))return n.Seq?.(e,t,r);if(j(t))return n.Pair?.(e,t,r);if(M(t))return n.Scalar?.(e,t,r);if(ze(t))return n.Alias?.(e,t,r)}function Xe(e,t,n){let r=t[t.length-1];if(N(r))r.items[e]=n;else if(j(r))e===`key`?r.key=n:r.value=n;else if(Be(r))r.contents=n;else{let e=ze(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var Ze={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},Qe=e=>e.replace(/[!,[\]{}]/g,e=>Ze[e]),$e=class e{constructor(t,n){this.docStart=null,this.docEnd=!1,this.yaml=Object.assign({},e.defaultYaml,t),this.tags=Object.assign({},e.defaultTags,n)}clone(){let t=new e(this.yaml,this.tags);return t.docStart=this.docStart,t}atDocument(){let t=new e(this.yaml,this.tags);switch(this.yaml.version){case`1.1`:this.atNextDocument=!0;break;case`1.2`:this.atNextDocument=!1,this.yaml={explicit:e.defaultYaml.explicit,version:`1.2`},this.tags=Object.assign({},e.defaultTags)}return t}add(t,n){this.atNextDocument&&=(this.yaml={explicit:e.defaultYaml.explicit,version:`1.1`},this.tags=Object.assign({},e.defaultTags),!1);let r=t.trim().split(/[ \t]+/),i=r.shift();switch(i){case`%TAG`:{if(r.length!==2&&(n(0,`%TAG directive should contain exactly two parts`),r.length<2))return!1;let[e,t]=r;return this.tags[e]=t,!0}case`%YAML`:{if(this.yaml.explicit=!0,r.length!==1)return n(0,`%YAML directive should contain exactly one part`),!1;let[e]=r;if(e===`1.1`||e===`1.2`)return this.yaml.version=e,!0;{let t=/^\d+\.\d+$/.test(e);return n(6,`Unsupported YAML version ${e}`,t),!1}}default:return n(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]===`<`){let n=e.slice(2,-1);return n===`!`||n===`!!`?(t(`Verbatim tags aren't resolved, so ${e} is invalid.`),null):(e[e.length-1]!==`>`&&t(`Verbatim tags must end with a >`),n)}let[,n,r]=e.match(/^(.*!)([^!]*)$/s);r||t(`The ${e} tag has no suffix`);let i=this.tags[n];if(i)try{return i+decodeURIComponent(r)}catch(e){return t(String(e)),null}return n===`!`?e:(t(`Could not resolve tag: ${e}`),null)}tagString(e){for(let[t,n]of Object.entries(this.tags))if(e.startsWith(n))return t+Qe(e.substring(n.length));return e[0]===`!`?e:`!<${e}>`}toString(e){let t=this.yaml.explicit?[`%YAML ${this.yaml.version||`1.2`}`]:[],n=Object.entries(this.tags),r;if(e&&n.length>0&&P(e.contents)){let t={};Ke(e.contents,(e,n)=>{P(n)&&n.tag&&(t[n.tag]=!0)}),r=Object.keys(t)}else r=[];for(let[i,a]of n)(i!==`!!`||a!==`tag:yaml.org,2002:`)&&(!e||r.some(e=>e.startsWith(a)))&&t.push(`%TAG ${i} ${a}`);return t.join(`
|
|
15
|
+
`)}};$e.defaultYaml={explicit:!1,version:`1.2`},$e.defaultTags={"!!":`tag:yaml.org,2002:`};function et(e){if(/[\x00-\x19\s,[\]{}]/.test(e)){let t=`Anchor must not contain whitespace or control characters: ${JSON.stringify(e)}`;throw Error(t)}return!0}function tt(e){let t=new Set;return Ke(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function nt(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function rt(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i??=tt(e);let a=nt(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(M(t.node)||N(t.node)))t.node.anchor=t.anchor;else{let t=Error(`Failed to resolve repeated object (this should not happen)`);throw t.source=e,t}}},sourceObjects:r}}function it(e,t,n,r){if(r&&typeof r==`object`){if(Array.isArray(r))for(let t=0,n=r.length;t<n;++t){let n=r[t],i=it(e,r,String(t),n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}else if(r instanceof Map)for(let t of Array.from(r.keys())){let n=r.get(t),i=it(e,r,t,n);i===void 0?r.delete(t):i!==n&&r.set(t,i)}else if(r instanceof Set)for(let t of Array.from(r)){let n=it(e,r,t,t);n===void 0?r.delete(t):n!==t&&(r.delete(t),r.add(n))}else for(let[t,n]of Object.entries(r)){let i=it(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}}return e.call(t,n,r)}function I(e,t,n){if(Array.isArray(e))return e.map((e,t)=>I(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!Ue(e))return e.toJSON(t,n);let r={aliasCount:0,count:1,res:void 0};n.anchors.set(e,r),n.onCreate=e=>{r.res=e,delete n.onCreate};let i=e.toJSON(t,n);return n.onCreate&&n.onCreate(i),i}return typeof e==`bigint`&&!n?.keep?Number(e):e}var at=class{constructor(e){Object.defineProperty(this,A,{value:e})}clone(){let e=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return this.range&&(e.range=this.range.slice()),e}toJS(e,{mapAsMap:t,maxAliasCount:n,onAnchor:r,reviver:i}={}){if(!Be(e))throw TypeError(`A document argument is required`);let a={anchors:new Map,doc:e,keep:!0,mapAsMap:t===!0,mapKeyWarned:!1,maxAliasCount:typeof n==`number`?n:100},o=I(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?it(i,{"":o},``,o):o}},ot=class extends at{constructor(e){super(Fe),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e,t){if(t?.maxAliasCount===0)throw ReferenceError(`Alias resolution is disabled`);let n;t?.aliasResolveCache?n=t.aliasResolveCache:(n=[],Ke(e,{Node:(e,t)=>{(ze(t)||Ue(t))&&n.push(t)}}),t&&(t.aliasResolveCache=n));let r;for(let e of n){if(e===this)break;e.anchor===this.source&&(r=e)}if(r&&t){let{anchors:e,doc:n,maxAliasCount:i}=t,a=e.get(r);if(a||=(I(r,null,t),e.get(r)),a?.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(a.count+=1,a.aliasCount===0&&(a.aliasCount=st(n,r,e)),a.count*a.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`)}return r}toJSON(e,t){if(!t)return{source:this.source};let n=this.resolve(t.doc,t);if(!n){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}return t.anchors.get(n).res}toString(e,t,n){let r=`*${this.source}`;if(e){if(et(this.source),e.options.verifyAliasOrder&&!e.anchors.has(this.source)){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw Error(e)}if(e.implicitKey)return`${r} `}return r}};function st(e,t,n){if(ze(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}if(N(t)){let r=0;for(let i of t.items){let t=st(e,i,n);t>r&&(r=t)}return r}if(j(t)){let r=st(e,t.key,n),i=st(e,t.value,n);return Math.max(r,i)}return 1}var ct=e=>!e||typeof e!=`function`&&typeof e!=`object`,L=class extends at{constructor(e){super(k),this.value=e}toJSON(e,t){return t?.keep?this.value:I(this.value,e,t)}toString(){return String(this.value)}};L.BLOCK_FOLDED=`BLOCK_FOLDED`,L.BLOCK_LITERAL=`BLOCK_LITERAL`,L.PLAIN=`PLAIN`,L.QUOTE_DOUBLE=`QUOTE_DOUBLE`,L.QUOTE_SINGLE=`QUOTE_SINGLE`;var lt=`tag:yaml.org,2002:`;function ut(e,t,n){if(t){let e=n.filter(e=>e.tag===t),r=e.find(e=>!e.format)??e[0];if(!r)throw Error(`Tag ${t} not found`);return r}return n.find(t=>t.identify?.(e)&&!t.format)}function dt(e,t,n){if(Be(e)&&(e=e.contents),P(e))return e;if(j(e)){let t=n.schema[O].createNode?.(n.schema,null,n);return t.items.push(e),t}(e instanceof String||e instanceof Number||e instanceof Boolean||typeof BigInt<`u`&&e instanceof BigInt)&&(e=e.valueOf());let{aliasDuplicateObjects:r,onAnchor:i,onTagObj:a,schema:o,sourceObjects:s}=n,c;if(r&&e&&typeof e==`object`){if(c=s.get(e),c)return c.anchor??(c.anchor=i(e)),new ot(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=lt+t.slice(2));let l=ut(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new L(e);return c&&(c.node=t),t}l=e instanceof Map?o[O]:Symbol.iterator in Object(e)?o[Re]:o[O]}a&&(a(l),delete n.onTagObj);let u=l?.createNode?l.createNode(n.schema,e,n):typeof l?.nodeClass?.from==`function`?l.nodeClass.from(n.schema,e,n):new L(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function ft(e,t,n){let r=n;for(let e=t.length-1;e>=0;--e){let n=t[e];if(typeof n==`number`&&Number.isInteger(n)&&n>=0){let e=[];e[n]=r,r=e}else r=new Map([[n,r]])}return dt(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var pt=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,mt=class extends at{constructor(e,t){super(e),Object.defineProperty(this,"schema",{value:t,configurable:!0,enumerable:!1,writable:!0})}clone(e){let t=Object.create(Object.getPrototypeOf(this),Object.getOwnPropertyDescriptors(this));return e&&(t.schema=e),t.items=t.items.map(t=>P(t)||j(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(pt(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(N(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,ft(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}deleteIn(e){let[t,...n]=e;if(n.length===0)return this.delete(t);let r=this.get(t,!0);if(N(r))return r.deleteIn(n);throw Error(`Expected YAML collection at ${t}. Remaining path: ${n}`)}getIn(e,t){let[n,...r]=e,i=this.get(n,!0);return r.length===0?!t&&M(i)?i.value:i:N(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!j(t))return!1;let n=t.value;return n==null||e&&M(n)&&n.value==null&&!n.commentBefore&&!n.comment&&!n.tag})}hasIn(e){let[t,...n]=e;if(n.length===0)return this.has(t);let r=this.get(t,!0);return N(r)?r.hasIn(n):!1}setIn(e,t){let[n,...r]=e;if(r.length===0)this.set(n,t);else{let e=this.get(n,!0);if(N(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,ft(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},ht=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function R(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var gt=(e,t,n)=>e.endsWith(`
|
|
16
|
+
`)?R(n,t):n.includes(`
|
|
17
17
|
`)?`
|
|
18
|
-
`+
|
|
19
|
-
`)n===`block`&&(h=
|
|
18
|
+
`+R(n,t):(e.endsWith(` `)?``:` `)+n,_t=`flow`,vt=`block`,yt=`quoted`;function bt(e,t,n=`flow`,{indentAtStart:r,lineWidth:i=80,minContentWidth:a=20,onFold:o,onOverflow:s}={}){if(!i||i<0)return e;i<a&&(a=0);let c=Math.max(1+a,1+i-t.length);if(e.length<=c)return e;let l=[],u={},d=i-t.length;typeof r==`number`&&(r>i-Math.max(2,a)?l.push(0):d=i-r);let f,p,m=!1,h=-1,g=-1,_=-1;n===`block`&&(h=xt(e,h,t.length),h!==-1&&(d=h+c));for(let r;r=e[h+=1];){if(n===`quoted`&&r===`\\`){switch(g=h,e[h+1]){case`x`:h+=3;break;case`u`:h+=5;break;case`U`:h+=9;break;default:h+=1}_=h}if(r===`
|
|
19
|
+
`)n===`block`&&(h=xt(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
|
|
20
20
|
`&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
|
|
21
|
-
`&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function
|
|
22
|
-
`);r=t,i=t+1,a=e[i]}return r}var
|
|
23
|
-
`){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function
|
|
21
|
+
`&&t!==` `&&(f=h)}if(h>=d){if(f)l.push(f),d=f+c,f=void 0;else if(n===`quoted`){for(;p===` `||p===` `;)p=r,r=e[h+=1],m=!0;let t=h>_+1?h-2:g-1;if(u[t])return e;l.push(t),u[t]=!0,d=t+c,f=void 0}else m=!0}}p=r}if(m&&s&&s(),l.length===0)return e;o&&o();let v=e.slice(0,l[0]);for(let r=0;r<l.length;++r){let i=l[r],a=l[r+1]||e.length;i===0?v=`\n${t}${e.slice(0,a)}`:(n===`quoted`&&u[i]&&(v+=`${e[i]}\\`),v+=`\n${t}${e.slice(i+1,a)}`)}return v}function xt(e,t,n){let r=t,i=t+1,a=e[i];for(;a===` `||a===` `;)if(t<i+n)a=e[++t];else{do a=e[++t];while(a&&a!==`
|
|
22
|
+
`);r=t,i=t+1,a=e[i]}return r}var St=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Ct=e=>/^(%|---|\.\.\.)/m.test(e);function wt(e,t,n){if(!t||t<0)return!1;let r=t-n,i=e.length;if(i<=r)return!1;for(let t=0,n=0;t<i;++t)if(e[t]===`
|
|
23
|
+
`){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function Tt(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Ct(e)?` `:``),o=``,s=0;for(let e=0,t=n[e];t;t=n[++e])if(t===` `&&n[e+1]===`\\`&&n[e+2]===`n`&&(o+=n.slice(s,e)+`\\ `,e+=1,s=e,t=`\\`),t===`\\`)switch(n[e+1]){case`u`:{o+=n.slice(s,e);let t=n.substr(e+2,4);switch(t){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:t.substr(0,2)===`00`?o+=`\\x`+t.substr(2):o+=n.substr(e,6)}e+=5,s=e+1}break;case`n`:if(r||n[e+2]===`"`||n.length<i)e+=1;else{for(o+=n.slice(s,e)+`
|
|
24
24
|
|
|
25
25
|
`;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
|
|
26
|
-
`,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:
|
|
27
|
-
`)||/[ \t]\n|\n[ \t]/.test(e))return
|
|
26
|
+
`,e+=2;o+=a,n[e+2]===` `&&(o+=`\\`),e+=1,s=e+1}break;default:e+=1}return o=s?o+n.slice(s):n,r?o:bt(o,a,yt,St(t,!1))}function Et(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
27
|
+
`)||/[ \t]\n|\n[ \t]/.test(e))return Tt(e,t);let n=t.indent||(Ct(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:bt(r,n,_t,St(t,!1))}function Dt(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=Tt;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?Et:i&&!t?Tt:n?Et:Tt}return r(e,t)}var Ot;try{Ot=RegExp(`(^|(?<!
|
|
28
28
|
))
|
|
29
29
|
+(?!
|
|
30
|
-
|$)`,`g`)}catch{
|
|
30
|
+
|$)`,`g`)}catch{Ot=/\n+(?!\n|$)/g}function kt({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n))return Dt(n,r);let l=r.indent||(r.forceBlockIndent||Ct(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===L.BLOCK_FOLDED?!1:t===L.BLOCK_LITERAL||!wt(n,c,l.length);if(!n)return u?`|
|
|
31
31
|
`:`>
|
|
32
32
|
`;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
|
|
33
33
|
`&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
|
|
34
34
|
`);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
|
|
35
|
-
`&&(p=p.slice(0,-1)),p.replace(
|
|
35
|
+
`&&(p=p.slice(0,-1)),p.replace(Ot,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
|
|
36
36
|
`)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),!u){let e=n.replace(/\n+/g,`
|
|
37
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=
|
|
38
|
-
`)||u&&/[[\]{},]/.test(a))return
|
|
39
|
-
`)?
|
|
40
|
-
`))return
|
|
41
|
-
`:``,v){let e=l(v);S+=`\n${
|
|
37
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`),i=!1,a=St(r,!0);o!==`folded`&&t!==L.BLOCK_FOLDED&&(a.onOverflow=()=>{i=!0});let s=bt(`${v}${e}${p}`,l,vt,a);if(!i)return`>${y}\n${l}${s}`}return n=n.replace(/\n+/g,`$&${l}`),`|${y}\n${l}${v}${n}${p}`}function At(e,t,n,r){let{type:i,value:a}=e,{actualString:o,implicitKey:s,indent:c,indentStep:l,inFlow:u}=t;if(s&&a.includes(`
|
|
38
|
+
`)||u&&/[[\]{},]/.test(a))return Dt(a,t);if(/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
|
|
39
|
+
`)?Dt(a,t):kt(e,t,n,r);if(!s&&!u&&i!==L.PLAIN&&a.includes(`
|
|
40
|
+
`))return kt(e,t,n,r);if(Ct(a)){if(c===``)return t.forceBlockIndent=!0,kt(e,t,n,r);if(s&&c===l)return Dt(a,t)}let d=a.replace(/\n+/g,`$&\n${c}`);if(o){let e=e=>e.default&&e.tag!==`tag:yaml.org,2002:str`&&e.test?.test(d),{compat:n,tags:r}=t.doc.schema;if(r.some(e)||n?.some(e))return Dt(a,t)}return s?d:bt(d,c,_t,St(t,!1))}function jt(e,t,n,r){let{implicitKey:i,inFlow:a}=t,o=typeof e.value==`string`?e:Object.assign({},e,{value:String(e.value)}),{type:s}=e;s!==L.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=L.QUOTE_DOUBLE);let c=e=>{switch(e){case L.BLOCK_FOLDED:case L.BLOCK_LITERAL:return i||a?Dt(o.value,t):kt(o,t,n,r);case L.QUOTE_DOUBLE:return Tt(o.value,t);case L.QUOTE_SINGLE:return Et(o.value,t);case L.PLAIN:return At(o,t,n,r);default:return null}},l=c(s);if(l===null){let{defaultKeyType:e,defaultStringType:n}=t.options,r=i&&e||n;if(l=c(r),l===null)throw Error(`Unsupported default string type ${r}`)}return l}function Mt(e,t){let n=Object.assign({blockQuote:!0,commentString:ht,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trailingComma:!1,trueStr:`true`,verifyAliasOrder:!0},e.schema.toStringOptions,t),r;switch(n.collectionStyle){case`block`:r=!1;break;case`flow`:r=!0;break;default:r=null}return{anchors:new Set,doc:e,flowCollectionPadding:n.flowCollectionPadding?` `:``,indent:``,indentStep:typeof n.indent==`number`?` `.repeat(n.indent):` `,inFlow:r,options:n}}function Nt(e,t){if(t.tag){let n=e.filter(e=>e.tag===t.tag);if(n.length>0)return n.find(e=>e.format===t.format)??n[0]}let n,r;if(M(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));if(i.length>1){let e=i.filter(e=>e.test);e.length>0&&(i=e)}n=i.find(e=>e.format===t.format)??i.find(e=>!e.format)}else r=t,n=e.find(e=>e.nodeClass&&r instanceof e.nodeClass);if(!n){let e=r?.constructor?.name??(r===null?`null`:typeof r);throw Error(`Tag not resolved for ${e} value`)}return n}function Pt(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(M(e)||N(e))&&e.anchor;a&&et(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag??(t.default?null:t.tag);return o&&i.push(r.directives.tagString(o)),i.join(` `)}function Ft(e,t,n,r){if(j(e))return e.toString(t,n,r);if(ze(e)){if(t.doc.directives)return e.toString(t);if(t.resolvedAliases?.has(e))throw TypeError(`Cannot stringify circular structure without alias nodes`);t.resolvedAliases?t.resolvedAliases.add(e):t.resolvedAliases=new Set([e]),e=e.resolve(t.doc)}let i,a=P(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i??=Nt(t.doc.schema.tags,a);let o=Pt(a,i,t);o.length>0&&(t.indentAtStart=(t.indentAtStart??0)+o.length+1);let s=typeof i.stringify==`function`?i.stringify(a,t,n,r):M(a)?jt(a,t,n,r):a.toString(t,n,r);return o?M(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function It({key:e,value:t},n,r,i){let{allNullValues:a,doc:o,indent:s,indentStep:c,options:{commentString:l,indentSeq:u,simpleKeys:d}}=n,f=P(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(N(e)||!P(e)&&typeof e==`object`)throw Error(`With simple keys, collection cannot be used as a key value`)}let p=!d&&(!e||f&&t==null&&!n.inFlow||N(e)||(M(e)?e.type===L.BLOCK_FOLDED||e.type===L.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=Ft(e,n,()=>m=!0,()=>h=!0);if(!p&&!n.inFlow&&g.length>1024){if(d)throw Error(`With simple keys, single line scalar must not span more than 1024 characters`);p=!0}if(n.inFlow){if(a||t==null)return m&&r&&r(),g===``?`?`:p?`? ${g}`:g}else if(a&&!d||t==null&&p)return g=`? ${g}`,f&&!m?g+=gt(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=gt(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=gt(g,n.indent,l(f))));let _,v,y;P(t)?(_=!!t.spaceBefore,v=t.commentBefore,y=t.comment):(_=!1,v=null,y=null,t&&typeof t==`object`&&(t=o.createNode(t))),n.implicitKey=!1,!p&&!f&&M(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&He(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=Ft(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
|
|
41
|
+
`:``,v){let e=l(v);S+=`\n${R(e,n.indent)}`}x===``&&!n.inFlow?S===`
|
|
42
42
|
`&&y&&(S=`
|
|
43
43
|
|
|
44
|
-
`):S+=`\n${n.indent}`}else if(!p&&
|
|
44
|
+
`):S+=`\n${n.indent}`}else if(!p&&N(t)){let e=x[0],r=x.indexOf(`
|
|
45
45
|
`),i=r!==-1,a=n.inFlow??t.flow??t.items.length===0;if(i||!a){let t=!1;if(i&&(e===`&`||e===`!`)){let n=x.indexOf(` `);e===`&`&&n!==-1&&n<r&&x[n+1]===`!`&&(n=x.indexOf(` `,n+1)),(n===-1||r<n)&&(t=!0)}t||(S=`\n${n.indent}`)}}else(x===``||x[0]===`
|
|
46
|
-
`)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=
|
|
46
|
+
`)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=gt(g,n.indent,l(y)):h&&i&&i(),g}function Lt(e,t){(e===`debug`||e===`warn`)&&console.warn(t)}var Rt=`<<`,z={identify:e=>e===Rt||typeof e==`symbol`&&e.description===Rt,default:`key`,tag:`tag:yaml.org,2002:merge`,test:/^<<$/,resolve:()=>Object.assign(new L(Symbol(Rt)),{addToJSMap:Bt}),stringify:()=>Rt},zt=(e,t)=>(z.identify(t)||M(t)&&(!t.type||t.type===L.PLAIN)&&z.identify(t.value))&&e?.doc.schema.tags.some(e=>e.tag===z.tag&&e.default);function Bt(e,t,n){let r=Ht(e,n);if(He(r))for(let n of r.items)Vt(e,t,n);else if(Array.isArray(r))for(let n of r)Vt(e,t,n);else Vt(e,t,r)}function Vt(e,t,n){let r=Ht(e,n);if(!Ve(r))throw Error(`Merge sources must be maps or map aliases`);let i=r.toJSON(null,e,Map);for(let[e,n]of i)t instanceof Map?t.has(e)||t.set(e,n):t instanceof Set?t.add(e):Object.prototype.hasOwnProperty.call(t,e)||Object.defineProperty(t,e,{value:n,writable:!0,enumerable:!0,configurable:!0});return t}function Ht(e,t){return e&&ze(t)?t.resolve(e.doc,e):t}function Ut(e,t,{key:n,value:r}){if(P(n)&&n.addToJSMap)n.addToJSMap(e,t,r);else if(zt(e,n))Bt(e,t,r);else{let i=I(n,``,e);if(t instanceof Map)t.set(i,I(r,i,e));else if(t instanceof Set)t.add(i);else{let a=Wt(n,i,e),o=I(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}function Wt(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(P(e)&&n?.doc){let t=Mt(n.doc,{});t.anchors=new Set;for(let e of n.anchors.keys())t.anchors.add(e.anchor);t.inFlow=!0,t.inStringifyKey=!0;let r=e.toString(t);if(!n.mapKeyWarned){let e=JSON.stringify(r);e.length>40&&(e=e.substring(0,36)+`..."`),Lt(n.doc.options.logLevel,`Keys with collection values will be stringified due to JS Object restrictions: ${e}. Set mapAsMap: true to use object keys.`),n.mapKeyWarned=!0}return r}return JSON.stringify(t)}function Gt(e,t,n){return new B(dt(e,void 0,n),dt(t,void 0,n))}var B=class e{constructor(e,t=null){Object.defineProperty(this,A,{value:Le}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return P(n)&&(n=n.clone(t)),P(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return Ut(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?It(this,e,t,n):JSON.stringify(this)}};function Kt(e,t,n){return(t.inFlow??e.flow?Jt:qt)(e,t,n)}function qt({comment:e,items:t},n,{blockItemPrefix:r,flowChars:i,itemIndent:a,onChompKeep:o,onComment:s}){let{indent:c,options:{commentString:l}}=n,u=Object.assign({},n,{indent:a,type:null}),d=!1,f=[];for(let e=0;e<t.length;++e){let i=t[e],o=null;if(P(i))!d&&i.spaceBefore&&f.push(``),Yt(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(j(i)){let e=P(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),Yt(n,f,e.commentBefore,d))}d=!1;let s=Ft(i,u,()=>o=null,()=>d=!0);o&&(s+=gt(s,a,l(o))),d&&o&&(d=!1),f.push(r+s)}let p;if(f.length===0)p=i.start+i.end;else{p=f[0];for(let e=1;e<f.length;++e){let t=f[e];p+=t?`\n${c}${t}`:`
|
|
47
47
|
`}}return e?(p+=`
|
|
48
|
-
`+
|
|
49
|
-
`),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=
|
|
50
|
-
`;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function
|
|
51
|
-
`:` `)}return
|
|
52
|
-
`)?(n.push(`...`),n.push(
|
|
48
|
+
`+R(l(e),c),s&&s()):d&&o&&o(),p}function Jt({items:e},t,{flowChars:n,itemIndent:r}){let{indent:i,indentStep:a,flowCollectionPadding:o,options:{commentString:s}}=t;r+=a;let c=Object.assign({},t,{indent:r,inFlow:!0,type:null}),l=!1,u=0,d=[];for(let n=0;n<e.length;++n){let i=e[n],a=null;if(P(i))i.spaceBefore&&d.push(``),Yt(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(j(i)){let e=P(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),Yt(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=P(i.value)?i.value:null;n?(n.comment&&(a=n.comment),n.commentBefore&&(l=!0)):i.value==null&&e?.comment&&(a=e.comment)}a&&(l=!0);let o=Ft(i,c,()=>a=null);l||=d.length>u||o.includes(`
|
|
49
|
+
`),n<e.length-1?o+=`,`:t.options.trailingComma&&(t.options.lineWidth>0&&(l||=d.reduce((e,t)=>e+t.length+2,2)+(o.length+2)>t.options.lineWidth),l&&(o+=`,`)),a&&(o+=gt(o,r,s(a))),d.push(o),u=d.length}let{start:f,end:p}=n;if(d.length===0)return f+p;if(!l){let e=d.reduce((e,t)=>e+t.length+2,2);l=t.options.lineWidth>0&&e>t.options.lineWidth}if(l){let e=f;for(let t of d)e+=t?`\n${a}${i}${t}`:`
|
|
50
|
+
`;return`${e}\n${i}${p}`}return`${f}${o}${d.join(` `)}${o}${p}`}function Yt({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=R(t(r),e);n.push(i.trimStart())}}function V(e,t){let n=M(t)?t.value:t;for(let r of e)if(j(r)&&(r.key===t||r.key===n||M(r.key)&&r.key.value===n))return r}var H=class extends mt{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(O,e),this.items=[]}static from(e,t,n){let{keepUndefined:r,replacer:i}=n,a=new this(e),o=(e,o)=>{if(typeof i==`function`)o=i.call(t,e,o);else if(Array.isArray(i)&&!i.includes(e))return;(o!==void 0||r)&&a.items.push(Gt(e,o,n))};if(t instanceof Map)for(let[e,n]of t)o(e,n);else if(t&&typeof t==`object`)for(let e of Object.keys(t))o(e,t[e]);return typeof e.sortMapEntries==`function`&&a.items.sort(e.sortMapEntries),a}add(e,t){let n;n=j(e)?e:!e||typeof e!=`object`||!(`key`in e)?new B(e,e?.value):new B(e.key,e.value);let r=V(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);M(r.value)&&ct(n.value)?r.value.value=n.value:r.value=n.value}else if(i){let e=this.items.findIndex(e=>i(n,e)<0);e===-1?this.items.push(n):this.items.splice(e,0,n)}else this.items.push(n)}delete(e){let t=V(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=V(this.items,e)?.value;return(!t&&M(n)?n.value:n)??void 0}has(e){return!!V(this.items,e)}set(e,t){this.add(new B(e,t),!0)}toJSON(e,t,n){let r=n?new n:t?.mapAsMap?new Map:{};t?.onCreate&&t.onCreate(r);for(let e of this.items)Ut(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!j(e))throw Error(`Map items must all be pairs; found ${JSON.stringify(e)} instead`);return!e.allNullValues&&this.hasAllNullValues(!1)&&(e=Object.assign({},e,{allNullValues:!0})),Kt(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},Xt={collection:`map`,default:!0,nodeClass:H,tag:`tag:yaml.org,2002:map`,resolve(e,t){return Ve(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>H.from(e,t,n)},U=class extends mt{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(Re,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Zt(e);return typeof t==`number`&&this.items.splice(t,1).length>0}get(e,t){let n=Zt(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&M(r)?r.value:r}has(e){let t=Zt(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=Zt(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];M(r)&&ct(t)?r.value=t:this.items[n]=t}toJSON(e,t){let n=[];t?.onCreate&&t.onCreate(n);let r=0;for(let e of this.items)n.push(I(e,String(r++),t));return n}toString(e,t,n){return e?Kt(this,e,{blockItemPrefix:`- `,flowChars:{start:`[`,end:`]`},itemIndent:(e.indent||``)+` `,onChompKeep:n,onComment:t}):JSON.stringify(this)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t)){let e=0;for(let a of t){if(typeof r==`function`){let n=t instanceof Set?a:String(e++);a=r.call(t,n,a)}i.items.push(dt(a,void 0,n))}}return i}};function Zt(e){let t=M(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var Qt={collection:`seq`,default:!0,nodeClass:U,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return He(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>U.from(e,t,n)},$t={identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify(e,t,n,r){return t=Object.assign({actualString:!0},t),jt(e,t,n,r)}},en={identify:e=>e==null,createNode:()=>new L(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new L(null),stringify:({source:e},t)=>typeof e==`string`&&en.test.test(e)?e:t.options.nullStr},tn={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new L(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&tn.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function W({format:e,minFractionDigits:t,tag:n,value:r}){if(typeof r==`bigint`)return String(r);let i=typeof r==`number`?r:Number(r);if(!isFinite(i))return isNaN(i)?`.nan`:i<0?`-.inf`:`.inf`;let a=Object.is(r,-0)?`-0`:JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^-?\d/.test(a)&&!a.includes(`e`)){let e=a.indexOf(`.`);e<0&&(e=a.length,a+=`.`);let n=t-(a.length-e-1);for(;n-->0;)a+=`0`}return a}var nn={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:W},rn={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:\.[0-9]+|[0-9]+(?:\.[0-9]*)?)[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():W(e)}},an={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:\.[0-9]+|[0-9]+\.[0-9]*)$/,resolve(e){let t=new L(parseFloat(e)),n=e.indexOf(`.`);return n!==-1&&e[e.length-1]===`0`&&(t.minFractionDigits=e.length-n-1),t},stringify:W},on=e=>typeof e==`bigint`||Number.isInteger(e),sn=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function cn(e,t,n){let{value:r}=e;return on(r)&&r>=0?n+r.toString(t):W(e)}var ln={identify:e=>on(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>sn(e,2,8,n),stringify:e=>cn(e,8,`0o`)},un={identify:on,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>sn(e,0,10,n),stringify:W},dn={identify:e=>on(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>sn(e,2,16,n),stringify:e=>cn(e,16,`0x`)},fn=[Xt,Qt,$t,en,tn,ln,un,dn,nn,rn,an];function pn(e){return typeof e==`bigint`||Number.isInteger(e)}var mn=({value:e})=>JSON.stringify(e),hn=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:mn},{identify:e=>e==null,createNode:()=>new L(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:mn},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true$|^false$/,resolve:e=>e===`true`,stringify:mn},{identify:pn,default:!0,tag:`tag:yaml.org,2002:int`,test:/^-?(?:0|[1-9][0-9]*)$/,resolve:(e,t,{intAsBigInt:n})=>n?BigInt(e):parseInt(e,10),stringify:({value:e})=>pn(e)?e.toString():JSON.stringify(e)},{identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^-?(?:0|[1-9][0-9]*)(?:\.[0-9]*)?(?:[eE][-+]?[0-9]+)?$/,resolve:e=>parseFloat(e),stringify:mn}],gn=[Xt,Qt].concat(hn,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}}),_n={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,t){if(typeof atob==`function`){let t=atob(e.replace(/[\n\r]/g,``)),n=new Uint8Array(t.length);for(let e=0;e<t.length;++e)n[e]=t.charCodeAt(e);return n}return t(`This environment does not support reading binary tags; either Buffer or atob is required`),e},stringify({comment:e,type:t,value:n},r,i,a){if(!n)return``;let o=n,s;if(typeof btoa==`function`){let e=``;for(let t=0;t<o.length;++t)e+=String.fromCharCode(o[t]);s=btoa(e)}else throw Error(`This environment does not support writing binary tags; either Buffer or btoa is required`);if(t??=L.BLOCK_LITERAL,t!==L.QUOTE_DOUBLE){let e=Math.max(r.options.lineWidth-r.indent.length,r.options.minContentWidth),n=Math.ceil(s.length/e),i=Array(n);for(let t=0,r=0;t<n;++t,r+=e)i[t]=s.substr(r,e);s=i.join(t===L.BLOCK_LITERAL?`
|
|
51
|
+
`:` `)}return jt({comment:e,type:t,value:s},r,i,a)}};function vn(e,t){if(He(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!j(r)){if(Ve(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new B(new L(null));if(r.commentBefore&&(e.key.commentBefore=e.key.commentBefore?`${r.commentBefore}\n${e.key.commentBefore}`:r.commentBefore),r.comment){let t=e.value??e.key;t.comment=t.comment?`${r.comment}\n${t.comment}`:r.comment}r=e}e.items[n]=j(r)?r:new B(r)}}else t(`Expected a sequence for this tag`);return e}function yn(e,t,n){let{replacer:r}=n,i=new U(e);i.tag=`tag:yaml.org,2002:pairs`;let a=0;if(t&&Symbol.iterator in Object(t))for(let e of t){typeof r==`function`&&(e=r.call(t,String(a++),e));let o,s;if(Array.isArray(e)){if(e.length===2)o=e[0],s=e[1];else throw TypeError(`Expected [key, value] tuple: ${e}`)}else if(e&&e instanceof Object){let t=Object.keys(e);if(t.length===1)o=t[0],s=e[o];else throw TypeError(`Expected tuple with one key, not ${t.length} keys`)}else o=e;i.items.push(Gt(o,s,n))}return i}var bn={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:vn,createNode:yn},xn=class e extends U{constructor(){super(),this.add=H.prototype.add.bind(this),this.delete=H.prototype.delete.bind(this),this.get=H.prototype.get.bind(this),this.has=H.prototype.has.bind(this),this.set=H.prototype.set.bind(this),this.tag=e.tag}toJSON(e,t){if(!t)return super.toJSON(e);let n=new Map;t?.onCreate&&t.onCreate(n);for(let e of this.items){let r,i;if(j(e)?(r=I(e.key,``,t),i=I(e.value,r,t)):r=I(e,``,t),n.has(r))throw Error(`Ordered maps must not include duplicate keys`);n.set(r,i)}return n}static from(e,t,n){let r=yn(e,t,n),i=new this;return i.items=r.items,i}};xn.tag=`tag:yaml.org,2002:omap`;var Sn={collection:`seq`,identify:e=>e instanceof Map,nodeClass:xn,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=vn(e,t),r=[];for(let{key:e}of n.items)M(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new xn,n)},createNode:(e,t,n)=>xn.from(e,t,n)};function Cn({value:e,source:t},n){return t&&(e?wn:Tn).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var wn={identify:e=>e===!0,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:Y|y|[Yy]es|YES|[Tt]rue|TRUE|[Oo]n|ON)$/,resolve:()=>new L(!0),stringify:Cn},Tn={identify:e=>e===!1,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:N|n|[Nn]o|NO|[Ff]alse|FALSE|[Oo]ff|OFF)$/,resolve:()=>new L(!1),stringify:Cn},En={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^(?:[-+]?\.(?:inf|Inf|INF)|\.nan|\.NaN|\.NAN)$/,resolve:e=>e.slice(-3).toLowerCase()===`nan`?NaN:e[0]===`-`?-1/0:1/0,stringify:W},Dn={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`EXP`,test:/^[-+]?(?:[0-9][0-9_]*)?(?:\.[0-9_]*)?[eE][-+]?[0-9]+$/,resolve:e=>parseFloat(e.replace(/_/g,``)),stringify(e){let t=Number(e.value);return isFinite(t)?t.toExponential():W(e)}},On={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,test:/^[-+]?(?:[0-9][0-9_]*)?\.[0-9_]*$/,resolve(e){let t=new L(parseFloat(e.replace(/_/g,``))),n=e.indexOf(`.`);if(n!==-1){let r=e.substring(n+1).replace(/_/g,``);r[r.length-1]===`0`&&(t.minFractionDigits=r.length)}return t},stringify:W},kn=e=>typeof e==`bigint`||Number.isInteger(e);function An(e,t,n,{intAsBigInt:r}){let i=e[0];if((i===`-`||i===`+`)&&(t+=1),e=e.substring(t).replace(/_/g,``),r){switch(n){case 2:e=`0b${e}`;break;case 8:e=`0o${e}`;break;case 16:e=`0x${e}`}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function jn(e,t,n){let{value:r}=e;if(kn(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return W(e)}var Mn={identify:kn,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>An(e,2,2,n),stringify:e=>jn(e,2,`0b`)},Nn={identify:kn,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>An(e,1,8,n),stringify:e=>jn(e,8,`0`)},Pn={identify:kn,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>An(e,0,10,n),stringify:W},Fn={identify:kn,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>An(e,2,16,n),stringify:e=>jn(e,16,`0x`)},In=class e extends H{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=j(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new B(e.key,null):new B(e,null),V(this.items,t.key)||this.items.push(t)}get(e,t){let n=V(this.items,e);return!t&&j(n)?M(n.key)?n.key.value:n.key:n}set(e,t){if(typeof t!=`boolean`)throw Error(`Expected boolean value for set(key, value) in a YAML set, not ${typeof t}`);let n=V(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new B(e))}toJSON(e,t){return super.toJSON(e,t,Set)}toString(e,t,n){if(!e)return JSON.stringify(this);if(this.hasAllNullValues(!0))return super.toString(Object.assign({},e,{allNullValues:!0}),t,n);throw Error(`Set items must all have null values`)}static from(e,t,n){let{replacer:r}=n,i=new this(e);if(t&&Symbol.iterator in Object(t))for(let e of t)typeof r==`function`&&(e=r.call(t,e,e)),i.items.push(Gt(e,null,n));return i}};In.tag=`tag:yaml.org,2002:set`;var Ln={collection:`map`,identify:e=>e instanceof Set,nodeClass:In,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>In.from(e,t,n),resolve(e,t){if(Ve(e)){if(e.hasAllNullValues(!0))return Object.assign(new In,e);t(`Set items must all have null values`)}else t(`Expected a mapping for this tag`);return e}};function Rn(e,t){let n=e[0],r=n===`-`||n===`+`?e.substring(1):e,i=e=>t?BigInt(e):Number(e),a=r.replace(/_/g,``).split(`:`).reduce((e,t)=>e*i(60)+i(t),i(0));return n===`-`?i(-1)*a:a}function zn(e){let{value:t}=e,n=e=>e;if(typeof t==`bigint`)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return W(e);let r=``;t<0&&(r=`-`,t*=n(-1));let i=n(60),a=[t%i];return t<60?a.unshift(0):(t=(t-a[0])/i,a.unshift(t%i),t>=60&&(t=(t-a[0])/i,a.unshift(t))),r+a.map(e=>String(e).padStart(2,`0`)).join(`:`).replace(/000000\d*$/,``)}var Bn={identify:e=>typeof e==`bigint`||Number.isInteger(e),default:!0,tag:`tag:yaml.org,2002:int`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+$/,resolve:(e,t,{intAsBigInt:n})=>Rn(e,n),stringify:zn},Vn={identify:e=>typeof e==`number`,default:!0,tag:`tag:yaml.org,2002:float`,format:`TIME`,test:/^[-+]?[0-9][0-9_]*(?::[0-5]?[0-9])+\.[0-9_]*$/,resolve:e=>Rn(e,!1),stringify:zn},Hn={identify:e=>e instanceof Date,default:!0,tag:`tag:yaml.org,2002:timestamp`,test:RegExp(`^([0-9]{4})-([0-9]{1,2})-([0-9]{1,2})(?:(?:t|T|[ \\t]+)([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2}(\\.[0-9]+)?)(?:[ \\t]*(Z|[-+][012]?[0-9](?::[0-9]{2})?))?)?$`),resolve(e){let t=e.match(Hn.test);if(!t)throw Error(`!!timestamp expects a date, starting with yyyy-mm-dd`);let[,n,r,i,a,o,s]=t.map(Number),c=t[7]?Number((t[7]+`00`).substr(1,3)):0,l=Date.UTC(n,r-1,i,a||0,o||0,s||0,c),u=t[8];if(u&&u!==`Z`){let e=Rn(u,!1);Math.abs(e)<30&&(e*=60),l-=6e4*e}return new Date(l)},stringify:({value:e})=>e?.toISOString().replace(/(T00:00:00)?\.000Z$/,``)??``},Un=[Xt,Qt,$t,en,wn,Tn,Mn,Nn,Pn,Fn,En,Dn,On,_n,z,Sn,bn,Ln,Bn,Vn,Hn],Wn=new Map([[`core`,fn],[`failsafe`,[Xt,Qt,$t]],[`json`,gn],[`yaml11`,Un],[`yaml-1.1`,Un]]),Gn={binary:_n,bool:tn,float:an,floatExp:rn,floatNaN:nn,floatTime:Vn,int:un,intHex:dn,intOct:ln,intTime:Bn,map:Xt,merge:z,null:en,omap:Sn,pairs:bn,seq:Qt,set:Ln,timestamp:Hn},Kn={"tag:yaml.org,2002:binary":_n,"tag:yaml.org,2002:merge":z,"tag:yaml.org,2002:omap":Sn,"tag:yaml.org,2002:pairs":bn,"tag:yaml.org,2002:set":Ln,"tag:yaml.org,2002:timestamp":Hn};function qn(e,t,n){let r=Wn.get(t);if(r&&!e)return n&&!r.includes(z)?r.concat(z):r.slice();let i=r;if(!i){if(Array.isArray(e))i=[];else{let e=Array.from(Wn.keys()).filter(e=>e!==`yaml11`).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown schema "${t}"; use one of ${e} or define customTags array`)}}if(Array.isArray(e))for(let t of e)i=i.concat(t);else typeof e==`function`&&(i=e(i.slice()));return n&&(i=i.concat(z)),i.reduce((e,t)=>{let n=typeof t==`string`?Gn[t]:t;if(!n){let e=JSON.stringify(t),n=Object.keys(Gn).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag ${e}; use one of ${n}`)}return e.includes(n)||e.push(n),e},[])}var Jn=(e,t)=>e.key<t.key?-1:+(e.key>t.key),Yn=class e{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?qn(e,`compat`):e?qn(null,e):null,this.name=typeof i==`string`&&i||`core`,this.knownTags=r?Kn:{},this.tags=qn(t,this.name,n),this.toStringOptions=o??null,Object.defineProperty(this,O,{value:Xt}),Object.defineProperty(this,k,{value:$t}),Object.defineProperty(this,Re,{value:Qt}),this.sortMapEntries=typeof a==`function`?a:a===!0?Jn:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function Xn(e,t){let n=[],r=t.directives===!0;if(t.directives!==!1&&e.directives){let t=e.directives.toString(e);t?(n.push(t),r=!0):e.directives.docStart&&(r=!0)}r&&n.push(`---`);let i=Mt(e,t),{commentString:a}=i.options;if(e.commentBefore){n.length!==1&&n.unshift(``);let t=a(e.commentBefore);n.unshift(R(t,``))}let o=!1,s=null;if(e.contents){if(P(e.contents)){if(e.contents.spaceBefore&&r&&n.push(``),e.contents.commentBefore){let t=a(e.contents.commentBefore);n.push(R(t,``))}i.forceBlockIndent=!!e.comment,s=e.contents.comment}let t=s?void 0:()=>o=!0,c=Ft(e.contents,i,()=>s=null,t);s&&(c+=gt(c,``,a(s))),(c[0]===`|`||c[0]===`>`)&&n[n.length-1]===`---`?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(Ft(e.contents,i));if(e.directives?.docEnd){if(e.comment){let t=a(e.comment);t.includes(`
|
|
52
|
+
`)?(n.push(`...`),n.push(R(t,``))):n.push(`... ${t}`)}else n.push(`...`)}else{let t=e.comment;t&&o&&(t=t.replace(/^\n+/,``)),t&&((!o||s)&&n[n.length-1]!==``&&n.push(``),n.push(R(a(t),``)))}return n.join(`
|
|
53
53
|
`)+`
|
|
54
|
-
`}var
|
|
55
|
-
`),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}};function
|
|
56
|
-
`))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(
|
|
57
|
-
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||
|
|
58
|
-
`+_.comment:g.comment=_.comment);let e=new
|
|
59
|
-
`+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&
|
|
60
|
-
`+e:t.comment=e,h.comment=h.comment.substring(e.length+1)}}if(!o&&!p&&!h.found){let r=m?e(n,m,h,i):t(n,h.end,p,null,h,i);c.items.push(r),u=r.range[2],
|
|
61
|
-
`+_.comment:g.comment=_.comment);let y=new
|
|
62
|
-
`+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function
|
|
54
|
+
`}var Zn=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,A,{value:Ie});let r=null;typeof t==`function`||Array.isArray(t)?r=t:n===void 0&&t&&(n=t,t=void 0);let i=Object.assign({intAsBigInt:!1,keepSourceTokens:!1,logLevel:`warn`,prettyErrors:!0,strict:!0,stringKeys:!1,uniqueKeys:!0,version:`1.2`},n);this.options=i;let{version:a}=i;n?._directives?(this.directives=n._directives.atDocument(),this.directives.yaml.explicit&&(a=this.directives.yaml.version)):this.directives=new $e({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[A]:{value:Ie}});return t.commentBefore=this.commentBefore,t.comment=this.comment,t.errors=this.errors.slice(),t.warnings=this.warnings.slice(),t.options=Object.assign({},this.options),this.directives&&(t.directives=this.directives.clone()),t.schema=this.schema.clone(),t.contents=P(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){Qn(this.contents)&&this.contents.add(e)}addIn(e,t){Qn(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=tt(this);e.anchor=!t||n.has(t)?nt(t||`a`,n):t}return new ot(e.anchor)}createNode(e,t,n){let r;if(typeof t==`function`)e=t.call({"":e},``,e),r=t;else if(Array.isArray(t)){let e=t.filter(e=>typeof e==`number`||e instanceof String||e instanceof Number).map(String);e.length>0&&(t=t.concat(e)),r=t}else n===void 0&&t&&(n=t,t=void 0);let{aliasDuplicateObjects:i,anchorPrefix:a,flow:o,keepUndefined:s,onTagObj:c,tag:l}=n??{},{onAnchor:u,setAnchors:d,sourceObjects:f}=rt(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=dt(e,l,p);return o&&N(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new B(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return Qn(this.contents)?this.contents.delete(e):!1}deleteIn(e){return pt(e)?this.contents!=null&&(this.contents=null,!0):Qn(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return N(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return pt(e)?!t&&M(this.contents)?this.contents.value:this.contents:N(this.contents)?this.contents.getIn(e,t):void 0}has(e){return N(this.contents)?this.contents.has(e):!1}hasIn(e){return pt(e)?this.contents!==void 0:N(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=ft(this.schema,[e],t):Qn(this.contents)&&this.contents.set(e,t)}setIn(e,t){pt(e)?this.contents=t:this.contents==null?this.contents=ft(this.schema,Array.from(e),t):Qn(this.contents)&&this.contents.setIn(e,t)}setSchema(e,t={}){typeof e==`number`&&(e=String(e));let n;switch(e){case`1.1`:this.directives?this.directives.yaml.version=`1.1`:this.directives=new $e({version:`1.1`}),n={resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new $e({version:e}),n={resolveKnownTags:!0,schema:`core`};break;case null:this.directives&&delete this.directives,n=null;break;default:{let t=JSON.stringify(e);throw Error(`Expected '1.1', '1.2' or null as first argument, but found: ${t}`)}}if(t.schema instanceof Object)this.schema=t.schema;else if(n)this.schema=new Yn(Object.assign(n,t));else throw Error(`With a null YAML version, the { schema: Schema } option is required`)}toJS({json:e,jsonArg:t,mapAsMap:n,maxAliasCount:r,onAnchor:i,reviver:a}={}){let o={anchors:new Map,doc:this,keep:!e,mapAsMap:n===!0,mapKeyWarned:!1,maxAliasCount:typeof r==`number`?r:100},s=I(this.contents,t??``,o);if(typeof i==`function`)for(let{count:e,res:t}of o.anchors.values())i(t,e);return typeof a==`function`?it(a,{"":s},``,s):s}toJSON(e,t){return this.toJS({json:!0,jsonArg:e,mapAsMap:!1,onAnchor:t})}toString(e={}){if(this.errors.length>0)throw Error(`Document with errors cannot be stringified`);if(`indent`in e&&(!Number.isInteger(e.indent)||Number(e.indent)<=0)){let t=JSON.stringify(e.indent);throw Error(`"indent" option must be a positive integer, not ${t}`)}return Xn(this,e)}};function Qn(e){if(N(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var $n=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},er=class extends $n{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},tr=class extends $n{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},nr=(e,t)=>n=>{if(n.pos[0]===-1)return;n.linePos=n.pos.map(e=>t.linePos(e));let{line:r,col:i}=n.linePos[0];n.message+=` at line ${r}, column ${i}`;let a=i-1,o=e.substring(t.lineStarts[r-1],t.lineStarts[r]).replace(/[\n\r]+$/,``);if(a>=60&&o.length>80){let e=Math.min(a-39,o.length-79);o=`…`+o.substring(e),a-=e-1}if(o.length>80&&(o=o.substring(0,79)+`…`),r>1&&/^ *$/.test(o.substring(0,a))){let n=e.substring(t.lineStarts[r-2],t.lineStarts[r-1]);n.length>80&&(n=n.substring(0,79)+`…
|
|
55
|
+
`),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t?.line===r&&t.col>i&&(e=Math.max(1,Math.min(t.col-i,80-a)));let s=` `.repeat(a)+`^`.repeat(e);n.message+=`:\n\n${o}\n${s}\n`}};function rr(e,{flow:t,indicator:n,next:r,offset:i,onError:a,parentIndent:o,startOnNewline:s}){let c=!1,l=s,u=s,d=``,f=``,p=!1,m=!1,h=null,g=null,_=null,v=null,y=null,b=null,x=null;for(let i of e)switch(m&&=(i.type!==`space`&&i.type!==`newline`&&i.type!==`comma`&&a(i.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),!1),h&&=(l&&i.type!==`comment`&&i.type!==`newline`&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),null),i.type){case`space`:!t&&(n!==`doc-start`||r?.type!==`flow-collection`)&&i.source.includes(` `)&&(h=i),u=!0;break;case`comment`:{u||a(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let e=i.source.substring(1)||` `;d?d+=f+e:d=e,f=``,l=!1;break}case`newline`:l?d?d+=i.source:(!b||n!==`seq-item-ind`)&&(c=!0):f+=i.source,l=!0,p=!0,(g||_)&&(v=i),u=!0;break;case`anchor`:g&&a(i,`MULTIPLE_ANCHORS`,`A node can have at most one anchor`),i.source.endsWith(`:`)&&a(i.offset+i.source.length-1,`BAD_ALIAS`,`Anchor ending in : is ambiguous`,!0),g=i,x??=i.offset,l=!1,u=!1,m=!0;break;case`tag`:_&&a(i,`MULTIPLE_TAGS`,`A node can have at most one tag`),_=i,x??=i.offset,l=!1,u=!1,m=!0;break;case n:(g||_)&&a(i,`BAD_PROP_ORDER`,`Anchors and tags must be after the ${i.source} indicator`),b&&a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.source} in ${t??`collection`}`),b=i,l=n===`seq-item-ind`||n===`explicit-key-ind`,u=!1;break;case`comma`:if(t){y&&a(i,`UNEXPECTED_TOKEN`,`Unexpected , in ${t}`),y=i,l=!1,u=!1;break}default:a(i,`UNEXPECTED_TOKEN`,`Unexpected ${i.type} token`),l=!1,u=!1}let S=e[e.length-1],ee=S?S.offset+S.source.length:i;return m&&r&&r.type!==`space`&&r.type!==`newline`&&r.type!==`comma`&&(r.type!==`scalar`||r.source!==``)&&a(r.offset,`MISSING_CHAR`,`Tags and anchors must be separated from the next token by white space`),h&&(l&&h.indent<=o||r?.type===`block-map`||r?.type===`block-seq`)&&a(h,`TAB_AS_INDENT`,`Tabs are not allowed as indentation`),{comma:y,found:b,spaceBefore:c,comment:d,hasNewline:p,anchor:g,tag:_,newlineAfterProp:v,end:ee,start:x??ee}}function ir(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(`
|
|
56
|
+
`))return!0;if(e.end){for(let t of e.end)if(t.type===`newline`)return!0}return!1;case`flow-collection`:for(let t of e.items){for(let e of t.start)if(e.type===`newline`)return!0;if(t.sep){for(let e of t.sep)if(e.type===`newline`)return!0}if(ir(t.key)||ir(t.value))return!0}return!1;default:return!0}}function ar(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&ir(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function or(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(e,t)=>e===t||M(e)&&M(t)&&e.value===t.value;return t.some(e=>i(e.key,n))}var sr=`All mapping items must start at the same column`;function cr({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??H)(n.schema);n.atRoot&&=!1;let s=r.offset,c=null;for(let a of r.items){let{start:l,key:u,sep:d,value:f}=a,p=rr(l,{indicator:`explicit-key-ind`,next:u??d?.[0],offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0}),m=!p.found;if(m){if(u&&(u.type===`block-seq`?i(s,`BLOCK_AS_IMPLICIT_KEY`,`A block sequence may not be used as an implicit map key`):`indent`in u&&u.indent!==r.indent&&i(s,`BAD_INDENT`,sr)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
|
|
57
|
+
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||ir(u))&&i(u??l[l.length-1],`MULTILINE_IMPLICIT_KEY`,`Implicit keys need to be on a single line`)}else p.found?.indent!==r.indent&&i(s,`BAD_INDENT`,sr);n.atKey=!0;let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&ar(r.indent,u,i),n.atKey=!1,or(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=rr(d??[],{indicator:`map-value-ind`,next:f,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!u||u.type===`block-scalar`});if(s=_.end,_.found){m&&(f?.type===`block-map`&&!_.hasNewline&&i(s,`BLOCK_AS_IMPLICIT_KEY`,`Nested mappings are not allowed in compact mappings`),n.options.strict&&p.start<_.found.offset-1024&&i(g.range,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit block mapping key`));let c=f?e(n,f,_,i):t(n,s,d,null,_,i);n.schema.compat&&ar(r.indent,f,i),s=c.range[2];let l=new B(g,c);n.options.keepSourceTokens&&(l.srcToken=a),o.items.push(l)}else{m&&i(g.range,`MISSING_CHAR`,`Implicit map keys need to be followed by map values`),_.comment&&(g.comment?g.comment+=`
|
|
58
|
+
`+_.comment:g.comment=_.comment);let e=new B(g);n.options.keepSourceTokens&&(e.srcToken=a),o.items.push(e)}}return c&&c<s&&i(c,`IMPOSSIBLE`,`Map comment with trailing content`),o.range=[r.offset,s,c??s],o}function lr({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??U)(n.schema);n.atRoot&&=!1,n.atKey&&=!1;let s=r.offset,c=null;for(let{start:a,value:l}of r.items){let u=rr(a,{indicator:`seq-item-ind`,next:l,offset:s,onError:i,parentIndent:r.indent,startOnNewline:!0});if(!u.found){if(u.anchor||u.tag||l)l?.type===`block-seq`?i(u.end,`BAD_INDENT`,`All sequence items must start at the same column`):i(s,`MISSING_CHAR`,`Sequence item without - indicator`);else{c=u.end,u.comment&&(o.comment=u.comment);continue}}let d=l?e(n,l,u,i):t(n,u.end,a,null,u,i);n.schema.compat&&ar(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function ur(e,t,n,r){let i=``;if(e){let a=!1,o=``;for(let s of e){let{source:e,type:c}=s;switch(c){case`space`:a=!0;break;case`comment`:{n&&!a&&r(s,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`);let t=e.substring(1)||` `;i?i+=o+t:i=t,o=``;break}case`newline`:i&&(o+=e),a=!0;break;default:r(s,`UNEXPECTED_TOKEN`,`Unexpected ${c} at node end`)}t+=e.length}}return{comment:i,offset:t}}var dr=`Block collections are not allowed within flow collections`,fr=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function pr({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?H:U))(n.schema);c.flow=!0;let l=n.atRoot;l&&(n.atRoot=!1),n.atKey&&=!1;let u=r.offset+r.start.source.length;for(let a=0;a<r.items.length;++a){let l=r.items[a],{start:d,key:f,sep:p,value:m}=l,h=rr(d,{flow:s,indicator:`explicit-key-ind`,next:f??p?.[0],offset:u,onError:i,parentIndent:r.indent,startOnNewline:!1});if(!h.found){if(!h.anchor&&!h.tag&&!p&&!m){a===0&&h.comma?i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`):a<r.items.length-1&&i(h.start,`UNEXPECTED_TOKEN`,`Unexpected empty item in ${s}`),h.comment&&(c.comment?c.comment+=`
|
|
59
|
+
`+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&ir(f)&&i(f,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`)}if(a===0)h.comma&&i(h.comma,`UNEXPECTED_TOKEN`,`Unexpected , in ${s}`);else if(h.comma||i(h.start,`MISSING_CHAR`,`Missing , between ${s} items`),h.comment){let e=``;loop:for(let t of d)switch(t.type){case`comma`:case`space`:break;case`comment`:e=t.source.substring(1);break loop;default:break loop}if(e){let t=c.items[c.items.length-1];j(t)&&(t=t.value??t.key),t.comment?t.comment+=`
|
|
60
|
+
`+e:t.comment=e,h.comment=h.comment.substring(e.length+1)}}if(!o&&!p&&!h.found){let r=m?e(n,m,h,i):t(n,h.end,p,null,h,i);c.items.push(r),u=r.range[2],fr(m)&&i(r.range,`BLOCK_IN_FLOW`,dr)}else{n.atKey=!0;let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);fr(f)&&i(g.range,`BLOCK_IN_FLOW`,dr),n.atKey=!1;let _=rr(p??[],{flow:s,indicator:`map-value-ind`,next:m,offset:g.range[2],onError:i,parentIndent:r.indent,startOnNewline:!1});if(_.found){if(!o&&!h.found&&n.options.strict){if(p)for(let e of p){if(e===_.found)break;if(e.type===`newline`){i(e,`MULTILINE_IMPLICIT_KEY`,`Implicit keys of flow sequence pairs need to be on a single line`);break}}h.start<_.found.offset-1024&&i(_.found,`KEY_OVER_1024_CHARS`,`The : indicator must be at most 1024 chars after the start of an implicit flow sequence key`)}}else m&&(`source`in m&&m.source?.[0]===`:`?i(m,`MISSING_CHAR`,`Missing space after : in ${s}`):i(_.start,`MISSING_CHAR`,`Missing , or : between ${s} items`));let v=m?e(n,m,_,i):_.found?t(n,_.end,p,null,_,i):null;v?fr(m)&&i(v.range,`BLOCK_IN_FLOW`,dr):_.comment&&(g.comment?g.comment+=`
|
|
61
|
+
`+_.comment:g.comment=_.comment);let y=new B(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;or(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new H(n.schema);e.flow=!0,e.items.push(y);let t=(v??g).range;e.range=[g.range[0],t[1],t[2]],c.items.push(e)}u=v?v.range[2]:_.end}}let d=o?`}`:`]`,[f,...p]=r.end,m=u;if(f?.source===d)m=f.offset+f.source.length;else{let e=s[0].toUpperCase()+s.substring(1),t=l?`${e} must end with a ${d}`:`${e} in block collection must be sufficiently indented and end with a ${d}`;i(u,l?`MISSING_CHAR`:`BAD_INDENT`,t),f&&f.source.length!==1&&p.unshift(f)}if(p.length>0){let e=ur(p,m,n.options.strict,i);e.comment&&(c.comment?c.comment+=`
|
|
62
|
+
`+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function mr(e,t,n,r,i,a){let o=n.type===`block-map`?cr(e,t,n,r,a):n.type===`block-seq`?lr(e,t,n,r,a):pr(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function hr(e,t,n,r,i){let a=r.tag,o=a?t.directives.tagName(a.source,e=>i(a,`TAG_RESOLVE_FAILED`,e)):null;if(n.type===`block-seq`){let{anchor:e,newlineAfterProp:t}=r,n=e&&a?e.offset>a.offset?e:a:e??a;n&&(!t||t.offset<n.offset)&&i(n,`MISSING_CHAR`,`Missing newline after block sequence props`)}let s=n.type===`block-map`?`map`:n.type===`block-seq`?`seq`:n.start.source===`{`?`map`:`seq`;if(!a||!o||o===`!`||o===H.tagName&&s===`map`||o===U.tagName&&s===`seq`)return mr(e,t,n,i,o);let c=t.schema.tags.find(e=>e.tag===o&&e.collection===s);if(!c){let r=t.schema.knownTags[o];if(r?.collection===s)t.schema.tags.push(Object.assign({},r,{default:!1})),c=r;else return r?i(a,`BAD_COLLECTION_TYPE`,`${r.tag} used for ${s} collection, but expects ${r.collection??`scalar`}`,!0):i(a,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${o}`,!0),mr(e,t,n,i,o)}let l=mr(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=P(u)?u:new L(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function gr(e,t,n){let r=t.offset,i=_r(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?L.BLOCK_FOLDED:L.BLOCK_LITERAL,o=t.source?vr(t.source):[],s=o.length;for(let e=o.length-1;e>=0;--e){let t=o[e][1];if(t===``||t===`\r`)s=e;else break}if(s===0){let e=i.chomp===`+`&&o.length>0?`
|
|
63
63
|
`.repeat(Math.max(1,o.length-1)):``,n=r+i.length;return t.source&&(n+=t.source.length),{value:e,type:a,comment:i.comment,range:[r,n,n]}}let c=t.indent+i.indent,l=t.offset+i.length,u=0;for(let t=0;t<s;++t){let[r,a]=o[t];if(a===``||a===`\r`)i.indent===0&&r.length>c&&(c=r.length);else{r.length<c&&n(l+r.length,`MISSING_CHAR`,`Block scalars with more-indented leading empty lines must use an explicit indentation indicator`),i.indent===0&&(c=r.length),u=t,c===0&&!e.atRoot&&n(l,`BAD_INDENT`,`Block scalar values in collections must be indented`);break}l+=r.length+a.length+1}for(let e=o.length-1;e>=s;--e)o[e][0].length>c&&(s=e+1);let d=``,f=``,p=!1;for(let e=0;e<u;++e)d+=o[e][0].slice(c)+`
|
|
64
|
-
`;for(let e=u;e<s;++e){let[t,r]=o[e];l+=t.length+r.length+1;let s=r[r.length-1]===`\r`;if(s&&(r=r.slice(0,-1)),r&&t.length<c){let e=`Block scalar lines must not be less indented than their ${i.indent?`explicit indentation indicator`:`first line`}`;n(l-r.length-(s?2:1),`BAD_INDENT`,e),t=``}a===
|
|
64
|
+
`;for(let e=u;e<s;++e){let[t,r]=o[e];l+=t.length+r.length+1;let s=r[r.length-1]===`\r`;if(s&&(r=r.slice(0,-1)),r&&t.length<c){let e=`Block scalar lines must not be less indented than their ${i.indent?`explicit indentation indicator`:`first line`}`;n(l-r.length-(s?2:1),`BAD_INDENT`,e),t=``}a===L.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
|
|
65
65
|
`):t.length>c||r[0]===` `?(f===` `?f=`
|
|
66
66
|
`:!p&&f===`
|
|
67
67
|
`&&(f=`
|
|
@@ -74,61 +74,61 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
74
74
|
`+o[e][0].slice(c);d[d.length-1]!==`
|
|
75
75
|
`&&(d+=`
|
|
76
76
|
`);break;default:d+=`
|
|
77
|
-
`}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function
|
|
77
|
+
`}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function _r({offset:e,props:t},n,r){if(t[0].type!==`block-scalar-header`)return r(t[0],`IMPOSSIBLE`,`Block scalar header not found`),null;let{source:i}=t[0],a=i[0],o=0,s=``,c=-1;for(let t=1;t<i.length;++t){let n=i[t];if(!s&&(n===`-`||n===`+`))s=n;else{let r=Number(n);!o&&r?o=r:c===-1&&(c=e+t)}}c!==-1&&r(c,`UNEXPECTED_TOKEN`,`Block scalar header includes extra characters: ${i}`);let l=!1,u=``,d=i.length;for(let e=1;e<t.length;++e){let i=t[e];switch(i.type){case`space`:l=!0;case`newline`:d+=i.source.length;break;case`comment`:n&&!l&&r(i,`MISSING_CHAR`,`Comments must be separated from other tokens by white space characters`),d+=i.source.length,u=i.source.substring(1);break;case`error`:r(i,`UNEXPECTED_TOKEN`,i.message),d+=i.source.length;break;default:{r(i,`UNEXPECTED_TOKEN`,`Unexpected token in block scalar header: ${i.type}`);let e=i.source;e&&typeof e==`string`&&(d+=e.length)}}}return{mode:a,indent:o,chomp:s,comment:u,length:d}}function vr(e){let t=e.split(/\n( *)/),n=t[0],r=n.match(/^( *)/),i=[r?.[1]?[r[1],n.slice(r[1].length)]:[``,n]];for(let e=1;e<t.length;e+=2)i.push([t[e],t[e+1]]);return i}function yr(e,t,n){let{offset:r,type:i,source:a,end:o}=e,s,c,l=(e,t,i)=>n(r+e,t,i);switch(i){case`scalar`:s=L.PLAIN,c=br(a,l);break;case`single-quoted-scalar`:s=L.QUOTE_SINGLE,c=xr(a,l);break;case`double-quoted-scalar`:s=L.QUOTE_DOUBLE,c=Cr(a,l);break;default:return n(e,`UNEXPECTED_TOKEN`,`Expected a flow scalar value, but found: ${i}`),{value:``,type:null,comment:``,range:[r,r+a.length,r+a.length]}}let u=r+a.length,d=ur(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function br(e,t){let n=``;switch(e[0]){case` `:n=`a tab character`;break;case`,`:n=`flow indicator character ,`;break;case`%`:n=`directive indicator character %`;break;case`|`:case`>`:n=`block scalar indicator ${e[0]}`;break;case`@`:case"`":n=`reserved character ${e[0]}`}return n&&t(0,`BAD_SCALAR_START`,`Plain value cannot start with ${n}`),Sr(e)}function xr(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),Sr(e.slice(1,-1)).replace(/''/g,`'`)}function Sr(e){let t=/(.*?)\r?\n/sy,n=t.exec(e);if(!n)return e;let r,i;try{r=RegExp(`(?<![ ])[ ]+$`),i=RegExp(`^[ ]+|(?<![ ])[ ]+$`,`g`)}catch{r=/[ \t]+$/,i=/^[ \t]+|[ \t]+$/g}let a=n[1].replace(r,``),o=` `,s=t.lastIndex;for(;n=t.exec(e);){let e=n[1].replace(i,``);e===``?o===`
|
|
78
78
|
`?a+=o:o=`
|
|
79
|
-
`:(a+=o+e,o=` `),s=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=s,n=c.exec(e),a+o+(n?.[1]??``)}function
|
|
79
|
+
`:(a+=o+e,o=` `),s=t.lastIndex}let c=/[ \t]*(.*)/sy;return c.lastIndex=s,n=c.exec(e),a+o+(n?.[1]??``)}function Cr(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(i!==`\r`||e[r+1]!==`
|
|
80
80
|
`){if(i===`
|
|
81
|
-
`){let{fold:t,offset:i}=
|
|
81
|
+
`){let{fold:t,offset:i}=wr(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=Tr[i];if(a)n+=a;else if(i===`
|
|
82
82
|
`)for(i=e[r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`\r`&&e[r+1]===`
|
|
83
|
-
`)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a=i===`x`?2:i===`u`?4:8;n+=
|
|
83
|
+
`)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a=i===`x`?2:i===`u`?4:8;n+=Er(e,r+1,a,t),r+=a}else{let i=e.substr(r-1,2);t(r-1,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),n+=i}}else if(i===` `||i===` `){let t=r,a=e[r+1];for(;a===` `||a===` `;)a=e[++r+1];a!==`
|
|
84
84
|
`&&(a!==`\r`||e[r+2]!==`
|
|
85
|
-
`)&&(n+=r>t?e.slice(t,r+1):i)}else n+=i}}return(e[e.length-1]!==`"`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing "quote`),n}function
|
|
85
|
+
`)&&(n+=r>t?e.slice(t,r+1):i)}else n+=i}}return(e[e.length-1]!==`"`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing "quote`),n}function wr(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
|
|
86
86
|
`||r===`\r`)&&(r!==`\r`||e[t+2]===`
|
|
87
87
|
`);)r===`
|
|
88
88
|
`&&(n+=`
|
|
89
|
-
`),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var
|
|
90
|
-
`,r:`\r`,t:` `,v:`\v`,N:`
`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function
|
|
89
|
+
`),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var Tr={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
|
|
90
|
+
`,r:`\r`,t:` `,v:`\v`,N:`
`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function Er(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;try{return String.fromCodePoint(a)}catch{let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}}function Dr(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?gr(e,t,r):yr(t,e.options.strict,r),c=n?e.directives.tagName(n.source,e=>r(n,`TAG_RESOLVE_FAILED`,e)):null,l;l=e.options.stringKeys&&e.atKey?e.schema[k]:c?Or(e.schema,i,c,n,r):t.type===`scalar`?kr(e,i,t,r):e.schema[k];let u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=M(a)?a:new L(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new L(i)}return u.range=s,u.source=i,a&&(u.type=a),c&&(u.tag=c),l.format&&(u.format=l.format),o&&(u.comment=o),u}function Or(e,t,n,r,i){if(n===`!`)return e[k];let a=[];for(let t of e.tags)if(!t.collection&&t.tag===n){if(t.default&&t.test)a.push(t);else return t}for(let e of a)if(e.test?.test(t))return e;let o=e.knownTags[n];return o&&!o.collection?(e.tags.push(Object.assign({},o,{default:!1,test:void 0})),o):(i(r,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${n}`,n!==`tag:yaml.org,2002:str`),e[k])}function kr({atKey:e,directives:t,schema:n},r,i,a){let o=n.tags.find(t=>(t.default===!0||e&&t.default===`key`)&&t.test?.test(r))||n[k];if(n.compat){let e=n.compat.find(e=>e.default&&e.test?.test(r))??n[k];o.tag!==e.tag&&a(i,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${t.tagString(o.tag)} or ${t.tagString(e.tag)}`,!0)}return o}function Ar(e,t,n){if(t){n??=t.length;for(let r=n-1;r>=0;--r){let n=t[r];switch(n.type){case`space`:case`comment`:case`newline`:e-=n.source.length;continue}for(n=t[++r];n?.type===`space`;)e+=n.source.length,n=t[++r];break}}return e}var jr={composeNode:Mr,composeEmptyNode:Nr};function Mr(e,t,n,r){let i=e.atKey,{spaceBefore:a,comment:o,anchor:s,tag:c}=n,l,u=!0;switch(t.type){case`alias`:l=Pr(e,t,r),(s||c)&&r(t,`ALIAS_PROPS`,`An alias node must not specify any properties`);break;case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`block-scalar`:l=Dr(e,t,c,r),s&&(l.anchor=s.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:try{l=hr(jr,e,t,n,r),s&&(l.anchor=s.source.substring(1))}catch(e){r(t,`RESOURCE_EXHAUSTION`,e instanceof Error?e.message:String(e))}break;default:r(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),u=!1}return l??=Nr(e,t.offset,void 0,null,n,r),s&&l.anchor===``&&r(s,`BAD_ALIAS`,`Anchor cannot be an empty string`),i&&e.options.stringKeys&&(!M(l)||typeof l.value!=`string`||l.tag&&l.tag!==`tag:yaml.org,2002:str`)&&r(c??t,`NON_STRING_KEY`,`With stringKeys, all keys must be strings`),a&&(l.spaceBefore=!0),o&&(t.type===`scalar`&&t.source===``?l.comment=o:l.commentBefore=o),e.options.keepSourceTokens&&u&&(l.srcToken=t),l}function Nr(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=Dr(e,{type:`scalar`,offset:Ar(t,n,r),indent:-1,source:``},s,l);return o&&(u.anchor=o.source.substring(1),u.anchor===``&&l(o,`BAD_ALIAS`,`Anchor cannot be an empty string`)),i&&(u.spaceBefore=!0),a&&(u.comment=a,u.range[2]=c),u}function Pr({options:e},{offset:t,source:n,end:r},i){let a=new ot(n.substring(1));a.source===``&&i(t,`BAD_ALIAS`,`Alias cannot be an empty string`),a.source.endsWith(`:`)&&i(t+n.length-1,`BAD_ALIAS`,`Alias ending in : is ambiguous`,!0);let o=t+n.length,s=ur(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function Fr(e,t,{offset:n,start:r,value:i,end:a},o){let s=new Zn(void 0,Object.assign({_directives:t},e)),c={atKey:!1,atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=rr(r,{indicator:`doc-start`,next:i??a?.[0],offset:n,onError:o,parentIndent:0,startOnNewline:!0});l.found&&(s.directives.docStart=!0,i&&(i.type===`block-map`||i.type===`block-seq`)&&!l.hasNewline&&o(l.end,`MISSING_CHAR`,`Block collection cannot start on same line with directives-end marker`)),s.contents=i?Mr(c,i,l,o):Nr(c,l.end,r,null,l,o);let u=s.contents.range[2],d=ur(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function Ir(e){if(typeof e==`number`)return[e,e+1];if(Array.isArray(e))return e.length===2?e:[e[0],e[1]];let{offset:t,source:n}=e;return[t,t+(typeof n==`string`?n.length:1)]}function Lr(e){let t=``,n=!1,r=!1;for(let i=0;i<e.length;++i){let a=e[i];switch(a[0]){case`#`:t+=(t===``?``:r?`
|
|
91
91
|
|
|
92
92
|
`:`
|
|
93
|
-
`)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var
|
|
93
|
+
`)+(a.substring(1)||` `),n=!0,r=!1;break;case`%`:e[i+1]?.[0]!==`#`&&(i+=1),n=!1;break;default:n||(r=!0),n=!1}}return{comment:t,afterEmptyLine:r}}var Rr=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=Ir(e);r?this.warnings.push(new tr(i,t,n)):this.errors.push(new er(i,t,n))},this.directives=new $e({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=Lr(this.prelude);if(n){let i=e.contents;if(t)e.comment=e.comment?`${e.comment}\n${n}`:n;else if(r||e.directives.docStart||!i)e.commentBefore=n;else if(N(i)&&!i.flow&&i.items.length>0){let e=i.items[0];j(e)&&(e=e.key);let t=e.commentBefore;e.commentBefore=t?`${n}\n${t}`:n}else{let e=i.commentBefore;i.commentBefore=e?`${n}\n${e}`:n}}if(t){for(let t=0;t<this.errors.length;++t)e.errors.push(this.errors[t]);for(let t=0;t<this.warnings.length;++t)e.warnings.push(this.warnings[t])}else e.errors=this.errors,e.warnings=this.warnings;this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:Lr(this.prelude).comment,directives:this.directives,errors:this.errors,warnings:this.warnings}}*compose(e,t=!1,n=-1){for(let t of e)yield*this.next(t);yield*this.end(t,n)}*next(e){switch(e.type){case`directive`:this.directives.add(e.source,(t,n,r)=>{let i=Ir(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=Fr(this.options,this.directives,e,this.onError);this.atDirectives&&!t.directives.docStart&&this.onError(e,`MISSING_CHAR`,`Missing directives-end/doc-start indicator line`),this.decorate(t,!1),this.doc&&(yield this.doc),this.doc=t,this.atDirectives=!1;break}case`byte-order-mark`:case`space`:break;case`comment`:case`newline`:this.prelude.push(e.source);break;case`error`:{let t=e.source?`${e.message}: ${JSON.stringify(e.source)}`:e.message,n=new er(Ir(e),`UNEXPECTED_TOKEN`,t);this.atDirectives||!this.doc?this.errors.push(n):this.doc.errors.push(n);break}case`doc-end`:{if(!this.doc){this.errors.push(new er(Ir(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=ur(e.end,e.offset+e.source.length,this.doc.options.strict,this.onError);if(this.decorate(this.doc,!0),t.comment){let e=this.doc.comment;this.doc.comment=e?`${e}\n${t.comment}`:t.comment}this.doc.range[2]=t.offset;break}default:this.errors.push(new er(Ir(e),`UNEXPECTED_TOKEN`,`Unsupported token ${e.type}`))}}*end(e=!1,t=-1){if(this.doc)this.decorate(this.doc,!0),yield this.doc,this.doc=null;else if(e){let e=new Zn(void 0,Object.assign({_directives:this.directives},this.options));this.atDirectives&&this.onError(t,`MISSING_CHAR`,`Missing directives-end indicator line`),e.range=[0,t,t],this.decorate(e,!1),yield e}}},zr=Symbol(`break visit`),Br=Symbol(`skip children`),Vr=Symbol(`remove item`);function Hr(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),Ur(Object.freeze([]),e,t)}Hr.BREAK=zr,Hr.SKIP=Br,Hr.REMOVE=Vr,Hr.itemAtPath=(e,t)=>{let n=e;for(let[e,r]of t){let t=n?.[e];if(t&&`items`in t)n=t.items[r];else return}return n},Hr.parentCollection=(e,t)=>{let n=Hr.itemAtPath(e,t.slice(0,-1)),r=t[t.length-1][0],i=n?.[r];if(i&&`items`in i)return i;throw Error(`Parent collection not found`)};function Ur(e,t,n){let r=n(t,e);if(typeof r==`symbol`)return r;for(let i of[`key`,`value`]){let a=t[i];if(a&&`items`in a){for(let t=0;t<a.items.length;++t){let r=Ur(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===zr)return zr;else r===Vr&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function Wr(e){switch(e){case``:return`byte-order-mark`;case``:return`doc-mode`;case``:return`flow-error-end`;case``:return`scalar`;case`---`:return`doc-start`;case`...`:return`doc-end`;case``:case`
|
|
94
94
|
`:case`\r
|
|
95
95
|
`:return`newline`;case`-`:return`seq-item-ind`;case`?`:return`explicit-key-ind`;case`:`:return`map-value-ind`;case`{`:return`flow-map-start`;case`}`:return`flow-map-end`;case`[`:return`flow-seq-start`;case`]`:return`flow-seq-end`;case`,`:return`comma`}switch(e[0]){case` `:case` `:return`space`;case`#`:return`comment`;case`%`:return`directive-line`;case`*`:return`alias`;case`&`:return`anchor`;case`!`:return`tag`;case`'`:return`single-quoted-scalar`;case`"`:return`double-quoted-scalar`;case`|`:case`>`:return`block-scalar-header`}return null}function G(e){switch(e){case void 0:case` `:case`
|
|
96
|
-
`:case`\r`:case` `:return!0;default:return!1}}var
|
|
97
|
-
\r `),
|
|
96
|
+
`:case`\r`:case` `:return!0;default:return!1}}var Gr=new Set(`0123456789ABCDEFabcdef`),Kr=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),qr=new Set(`,[]{}`),Jr=new Set(` ,[]{}
|
|
97
|
+
\r `),Yr=e=>!e||Jr.has(e),Xr=class{constructor(){this.atEnd=!1,this.blockScalarIndent=-1,this.blockScalarKeep=!1,this.buffer=``,this.flowKey=!1,this.flowLevel=0,this.indentNext=0,this.indentValue=0,this.lineEndPos=null,this.next=null,this.pos=0}*lex(e,t=!1){if(e){if(typeof e!=`string`)throw TypeError(`source is not a string`);this.buffer=this.buffer?this.buffer+e:e,this.lineEndPos=null}this.atEnd=!t;let n=this.next??`stream`;for(;n&&(t||this.hasChars(1));)n=yield*this.parseNext(n)}atLineEnd(){let e=this.pos,t=this.buffer[e];for(;t===` `||t===` `;)t=this.buffer[++e];return!t||t===`#`||t===`
|
|
98
98
|
`||t===`\r`&&this.buffer[e+1]===`
|
|
99
99
|
`}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===` `;)t=this.buffer[++n+e];if(t===`\r`){let t=this.buffer[n+e+1];if(t===`
|
|
100
100
|
`||!t&&!this.atEnd)return e+n+1}return t===`
|
|
101
101
|
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&G(this.buffer[e+3]))return-1}return e}getLine(){let e=this.lineEndPos;return(typeof e!=`number`||e!==-1&&e<this.pos)&&(e=this.buffer.indexOf(`
|
|
102
|
-
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]===`\r`&&--e,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]===``&&(yield*this.pushCount(1),e=e.substring(1)),e[0]===`%`){let t=e.length,n=e.indexOf(`#`);for(;n!==-1;){let r=e[n-1];if(r===` `||r===` `){t=n-1;break}n=e.indexOf(`#`,n+1)}for(;;){let n=e[t-1];if(n===` `||n===` `)--t;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),`stream`}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),`stream`}return yield``,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext(`line-start`);if(e===`-`||e===`.`){if(!this.atEnd&&!this.hasChars(4))return this.setNext(`line-start`);let e=this.peek(3);if((e===`---`||e===`...`)&&G(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,e===`---`?`doc`:`stream`}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!G(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext(`block-start`);if((e===`-`||e===`?`||e===`:`)&&G(t)){let e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,`block-start`}return`doc`}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext(`doc`);let t=yield*this.pushIndicators();switch(e[t]){case`#`:yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),`doc`;case`*`:return yield*this.pushUntil(
|
|
102
|
+
`,this.pos),this.lineEndPos=e),e===-1?this.atEnd?this.buffer.substring(this.pos):null:(this.buffer[e-1]===`\r`&&--e,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]===``&&(yield*this.pushCount(1),e=e.substring(1)),e[0]===`%`){let t=e.length,n=e.indexOf(`#`);for(;n!==-1;){let r=e[n-1];if(r===` `||r===` `){t=n-1;break}n=e.indexOf(`#`,n+1)}for(;;){let n=e[t-1];if(n===` `||n===` `)--t;else break}let r=(yield*this.pushCount(t))+(yield*this.pushSpaces(!0));return yield*this.pushCount(e.length-r),this.pushNewline(),`stream`}if(this.atLineEnd()){let t=yield*this.pushSpaces(!0);return yield*this.pushCount(e.length-t),yield*this.pushNewline(),`stream`}return yield``,yield*this.parseLineStart()}*parseLineStart(){let e=this.charAt(0);if(!e&&!this.atEnd)return this.setNext(`line-start`);if(e===`-`||e===`.`){if(!this.atEnd&&!this.hasChars(4))return this.setNext(`line-start`);let e=this.peek(3);if((e===`---`||e===`...`)&&G(this.charAt(3)))return yield*this.pushCount(3),this.indentValue=0,this.indentNext=0,e===`---`?`doc`:`stream`}return this.indentValue=yield*this.pushSpaces(!1),this.indentNext>this.indentValue&&!G(this.charAt(1))&&(this.indentNext=this.indentValue),yield*this.parseBlockStart()}*parseBlockStart(){let[e,t]=this.peek(2);if(!t&&!this.atEnd)return this.setNext(`block-start`);if((e===`-`||e===`?`||e===`:`)&&G(t)){let e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,`block-start`}return`doc`}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext(`doc`);let t=yield*this.pushIndicators();switch(e[t]){case`#`:yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),`doc`;case`*`:return yield*this.pushUntil(Yr),`doc`;case`"`:case`'`:return yield*this.parseQuotedScalar();case`|`:case`>`:return t+=yield*this.parseBlockScalarHeader(),t+=yield*this.pushSpaces(!0),yield*this.pushCount(e.length-t),yield*this.pushNewline(),yield*this.parseBlockScalar();default:return yield*this.parsePlainScalar()}}*parseFlowCollection(){let e,t,n=-1;do e=yield*this.pushNewline(),e>0?(t=yield*this.pushSpaces(!1),this.indentValue=n=t):t=0,t+=yield*this.pushSpaces(!0);while(e+t>0);let r=this.getLine();if(r===null)return this.setNext(`flow`);if((n!==-1&&n<this.indentNext&&r[0]!==`#`||n===0&&(r.startsWith(`---`)||r.startsWith(`...`))&&G(r[3]))&&(n!==this.indentNext-1||this.flowLevel!==1||r[0]!==`]`&&r[0]!==`}`))return this.flowLevel=0,yield``,yield*this.parseLineStart();let i=0;for(;r[i]===`,`;)i+=yield*this.pushCount(1),i+=yield*this.pushSpaces(!0),this.flowKey=!1;switch(i+=yield*this.pushIndicators(),r[i]){case void 0:return`flow`;case`#`:return yield*this.pushCount(r.length-i),`flow`;case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel+=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),this.flowKey=!0,--this.flowLevel,this.flowLevel?`flow`:`doc`;case`*`:return yield*this.pushUntil(Yr),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||G(e)||e===`,`)return this.flowKey=!1,yield*this.pushCount(1),yield*this.pushSpaces(!0),`flow`}default:return this.flowKey=!1,yield*this.parsePlainScalar()}}*parseQuotedScalar(){let e=this.charAt(0),t=this.buffer.indexOf(e,this.pos+1);if(e===`'`)for(;t!==-1&&this.buffer[t+1]===`'`;)t=this.buffer.indexOf(`'`,t+2);else for(;t!==-1;){let e=0;for(;this.buffer[t-1-e]===`\\`;)e+=1;if(e%2==0)break;t=this.buffer.indexOf(`"`,t+1)}let n=this.buffer.substring(0,t),r=n.indexOf(`
|
|
103
103
|
`,this.pos);if(r!==-1){for(;r!==-1;){let e=this.continueScalar(r+1);if(e===-1)break;r=n.indexOf(`
|
|
104
104
|
`,e)}r!==-1&&(t=r-(n[r-1]===`\r`?2:1))}if(t===-1){if(!this.atEnd)return this.setNext(`quoted-scalar`);t=this.buffer.length}return yield*this.pushToIndex(t+1,!1),this.flowLevel?`flow`:`doc`}*parseBlockScalarHeader(){this.blockScalarIndent=-1,this.blockScalarKeep=!1;let e=this.pos;for(;;){let t=this.buffer[++e];if(t===`+`)this.blockScalarKeep=!0;else if(t>`0`&&t<=`9`)this.blockScalarIndent=Number(t)-1;else if(t!==`-`)break}return yield*this.pushUntil(e=>G(e)||e===`#`)}*parseBlockScalar(){let e=this.pos-1,t=0,n;loop:for(let r=this.pos;n=this.buffer[r];++r)switch(n){case` `:t+=1;break;case`
|
|
105
105
|
`:e=r,t=0;break;case`\r`:{let e=this.buffer[r+1];if(!e&&!this.atEnd)return this.setNext(`block-scalar`);if(e===`
|
|
106
106
|
`)break}default:break loop}if(!n&&!this.atEnd)return this.setNext(`block-scalar`);if(t>=this.indentNext){this.indentNext=this.blockScalarIndent===-1?t:this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let t=this.continueScalar(e+1);if(t===-1)break;e=this.buffer.indexOf(`
|
|
107
107
|
`,t)}while(e!==-1);if(e===-1){if(!this.atEnd)return this.setNext(`block-scalar`);e=this.buffer.length}}let r=e+1;for(n=this.buffer[r];n===` `;)n=this.buffer[++r];if(n===` `){for(;n===` `||n===` `||n===`\r`||n===`
|
|
108
108
|
`;)n=this.buffer[++r];e=r-1}else if(!this.blockScalarKeep)do{let n=e-1,r=this.buffer[n];r===`\r`&&(r=this.buffer[--n]);let i=n;for(;r===` `;)r=this.buffer[--n];if(r===`
|
|
109
|
-
`&&n>=this.pos&&n+1+t>i)e=n;else break}while(1);return yield``,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===`:`){let r=this.buffer[n+1];if(G(r)||e&&
|
|
109
|
+
`&&n>=this.pos&&n+1+t>i)e=n;else break}while(1);return yield``,yield*this.pushToIndex(e+1,!0),yield*this.parseLineStart()}*parsePlainScalar(){let e=this.flowLevel>0,t=this.pos-1,n=this.pos-1,r;for(;r=this.buffer[++n];)if(r===`:`){let r=this.buffer[n+1];if(G(r)||e&&qr.has(r))break;t=n}else if(G(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
|
|
110
110
|
`?(n+=1,r=`
|
|
111
|
-
`,i=this.buffer[n+1]):t=n),i===`#`||e&&
|
|
112
|
-
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&
|
|
111
|
+
`,i=this.buffer[n+1]):t=n),i===`#`||e&&qr.has(i))break;if(r===`
|
|
112
|
+
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&qr.has(r))break;t=n}return!r&&!this.atEnd?this.setNext(`plain-scalar`):(yield``,yield*this.pushToIndex(t+1,!0),e?`flow`:`doc`)}*pushCount(e){return e>0?(yield this.buffer.substr(this.pos,e),this.pos+=e,e):0}*pushToIndex(e,t){let n=this.buffer.slice(this.pos,e);return n?(yield n,this.pos+=n.length,n.length):(t&&(yield``),0)}*pushIndicators(){let e=0;loop:for(;;){switch(this.charAt(0)){case`!`:e+=yield*this.pushTag(),e+=yield*this.pushSpaces(!0);continue loop;case`&`:e+=yield*this.pushUntil(Yr),e+=yield*this.pushSpaces(!0);continue loop;case`-`:case`?`:case`:`:{let t=this.flowLevel>0,n=this.charAt(1);if(G(n)||t&&qr.has(n)){t?this.flowKey&&=!1:this.indentNext=this.indentValue+1,e+=yield*this.pushCount(1),e+=yield*this.pushSpaces(!0);continue loop}}}break loop}return e}*pushTag(){if(this.charAt(1)===`<`){let e=this.pos+2,t=this.buffer[e];for(;!G(t)&&t!==`>`;)t=this.buffer[++e];return yield*this.pushToIndex(t===`>`?e+1:e,!1)}{let e=this.pos+1,t=this.buffer[e];for(;t;)if(Kr.has(t))t=this.buffer[++e];else if(t===`%`&&Gr.has(this.buffer[e+1])&&Gr.has(this.buffer[e+2]))t=this.buffer[e+=3];else break;return yield*this.pushToIndex(e,!1)}}*pushNewline(){let e=this.buffer[this.pos];return e===`
|
|
113
113
|
`?yield*this.pushCount(1):e===`\r`&&this.charAt(1)===`
|
|
114
|
-
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},
|
|
114
|
+
`?yield*this.pushCount(2):0}*pushSpaces(e){let t=this.pos-1,n;do n=this.buffer[++t];while(n===` `||e&&n===` `);let r=t-this.pos;return r>0&&(yield this.buffer.substr(this.pos,r),this.pos=t),r}*pushUntil(e){let t=this.pos,n=this.buffer[t];for(;!e(n);)n=this.buffer[++t];return yield*this.pushToIndex(t,!1)}},Zr=class{constructor(){this.lineStarts=[],this.addNewLine=e=>this.lineStarts.push(e),this.linePos=e=>{let t=0,n=this.lineStarts.length;for(;t<n;){let r=t+n>>1;this.lineStarts[r]<e?t=r+1:n=r}if(this.lineStarts[t]===e)return{line:t+1,col:1};if(t===0)return{line:0,col:e};let r=this.lineStarts[t-1];return{line:t,col:e-r+1}}}};function K(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function Qr(e){for(let t=0;t<e.length;++t)switch(e[t].type){case`space`:case`comment`:case`newline`:break;default:return t}return-1}function $r(e){switch(e?.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:case`flow-collection`:return!0;default:return!1}}function ei(e){switch(e.type){case`document`:return e.start;case`block-map`:{let t=e.items[e.items.length-1];return t.sep??t.start}case`block-seq`:return e.items[e.items.length-1].start;default:return[]}}function ti(e){if(e.length===0)return[];let t=e.length;loop:for(;--t>=0;)switch(e[t].type){case`doc-start`:case`explicit-key-ind`:case`map-value-ind`:case`seq-item-ind`:case`newline`:break loop}for(;e[++t]?.type===`space`;);return e.splice(t,e.length)}function ni(e,t){if(t.length<1e5)Array.prototype.push.apply(e,t);else for(let n=0;n<t.length;++n)e.push(t[n])}function ri(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!K(t.start,`explicit-key-ind`)&&!K(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,$r(t.value)?t.value.end?ni(t.value.end,t.sep):t.value.end=t.sep:ni(t.start,t.sep),delete t.sep)}var ii=class{constructor(e){this.atNewLine=!0,this.atScalar=!1,this.indent=0,this.offset=0,this.onKeyLine=!1,this.stack=[],this.source=``,this.type=``,this.lexer=new Xr,this.onNewLine=e}*parse(e,t=!1){this.onNewLine&&this.offset===0&&this.onNewLine(0);for(let n of this.lexer.lex(e,t))yield*this.next(n);t||(yield*this.end())}*next(e){if(this.source=e,this.atScalar){this.atScalar=!1,yield*this.step(),this.offset+=e.length;return}let t=Wr(e);if(!t){let t=`Not a YAML token: ${e}`;yield*this.pop({type:`error`,offset:this.offset,message:t,source:e}),this.offset+=e.length}else 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}}*end(){for(;this.stack.length>0;)yield*this.pop()}get sourceToken(){return{type:this.type,offset:this.offset,indent:this.indent,source:this.source}}*step(){let e=this.peek(1);if(this.type===`doc-end`&&e?.type!==`doc-end`){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:`doc-end`,offset:this.offset,source:this.source})}else{if(!e)return yield*this.stream();switch(e.type){case`document`:return yield*this.document(e);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(e);case`block-scalar`:return yield*this.blockScalar(e);case`block-map`:return yield*this.blockMap(e);case`block-seq`:return yield*this.blockSequence(e);case`flow-collection`:return yield*this.flowCollection(e);case`doc-end`:return yield*this.documentEnd(e)}yield*this.pop()}}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:`error`,offset:this.offset,source:``,message:`Tried to pop an empty stack`};else if(this.stack.length===0)yield t;else{let e=this.peek(1);switch(t.type===`block-scalar`?t.indent=`indent`in e?e.indent:0:t.type===`flow-collection`&&e.type===`document`&&(t.indent=0),t.type===`flow-collection`&&ri(t),e.type){case`document`:e.value=t;break;case`block-scalar`:e.props.push(t);break;case`block-map`:{let n=e.items[e.items.length-1];if(n.value){e.items.push({start:[],key:t,sep:[]}),this.onKeyLine=!0;return}if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case`block-seq`:{let n=e.items[e.items.length-1];n.value?e.items.push({start:[],value:t}):n.value=t;break}case`flow-collection`:{let n=e.items[e.items.length-1];!n||n.value?e.items.push({start:[],key:t,sep:[]}):n.sep?n.value=t:Object.assign(n,{key:t,sep:[]});return}default:yield*this.pop(),yield*this.pop(t)}if((e.type===`document`||e.type===`block-map`||e.type===`block-seq`)&&(t.type===`block-map`||t.type===`block-seq`)){let n=t.items[t.items.length-1];n&&!n.sep&&!n.value&&n.start.length>0&&Qr(n.start)===-1&&(t.indent===0||n.start.every(e=>e.type!==`comment`||e.indent<t.indent))&&(e.type===`document`?e.end=n.start:e.items.push({start:n.start}),t.items.splice(-1,1))}}}*stream(){switch(this.type){case`directive-line`:yield{type:`directive`,offset:this.offset,source:this.source};return;case`byte-order-mark`:case`space`:case`comment`:case`newline`:yield this.sourceToken;return;case`doc-mode`:case`doc-start`:{let e={type:`document`,offset:this.offset,start:[]};this.type===`doc-start`&&e.start.push(this.sourceToken),this.stack.push(e);return}}yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML stream`,source:this.source}}*document(e){if(e.value)return yield*this.lineEnd(e);switch(this.type){case`doc-start`:Qr(e.start)===-1?e.start.push(this.sourceToken):(yield*this.pop(),yield*this.step());return;case`anchor`:case`tag`:case`space`:case`comment`:case`newline`:e.start.push(this.sourceToken);return}let t=this.startBlockValue(e);t?this.stack.push(t):yield{type:`error`,offset:this.offset,message:`Unexpected ${this.type} token in YAML document`,source:this.source}}*scalar(e){if(this.type===`map-value-ind`){let t=ti(ei(this.peek(2))),n;e.end?(n=e.end,n.push(this.sourceToken),delete e.end):n=[this.sourceToken];let r={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:t,key:e,sep:n}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=r}else yield*this.lineEnd(e)}*blockScalar(e){switch(this.type){case`space`:case`comment`:case`newline`:e.props.push(this.sourceToken);return;case`scalar`:if(e.source=this.source,this.atNewLine=!0,this.indent=0,this.onNewLine){let e=this.source.indexOf(`
|
|
115
115
|
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
116
|
-
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){
|
|
116
|
+
`,e)+1}yield*this.pop();break;default:yield*this.pop(),yield*this.step()}}*blockMap(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(this.onKeyLine=!1,t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else if(t.sep)t.sep.push(this.sourceToken);else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){ni(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let n=!this.onKeyLine&&this.indent===e.indent,r=n&&(t.sep||t.explicitKey)&&this.type!==`seq-item-ind`,i=[];if(r&&t.sep&&!t.value){let n=[];for(let r=0;r<t.sep.length;++r){let i=t.sep[r];switch(i.type){case`newline`:n.push(r);break;case`space`:break;case`comment`:i.indent>e.indent&&(n.length=0);break;default:n.length=0}}n.length>=2&&(i=t.sep.splice(n[1]))}switch(this.type){case`anchor`:case`tag`:r||t.value?(i.push(this.sourceToken),e.items.push({start:i}),this.onKeyLine=!0):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`explicit-key-ind`:!t.sep&&!t.explicitKey?(t.start.push(this.sourceToken),t.explicitKey=!0):r||t.value?(i.push(this.sourceToken),e.items.push({start:i,explicitKey:!0})):this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken],explicitKey:!0}]}),this.onKeyLine=!0;return;case`map-value-ind`:if(t.explicitKey){if(!t.sep){if(K(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=ti(t.start);this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:null,sep:[this.sourceToken]}]})}}else if(t.value)e.items.push({start:[],key:null,sep:[this.sourceToken]});else if(K(t.sep,`map-value-ind`))this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:i,key:null,sep:[this.sourceToken]}]});else if($r(t.key)&&!K(t.sep,`newline`)){let e=ti(t.start),n=t.key,r=t.sep;r.push(this.sourceToken),delete t.key,delete t.sep,this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:e,key:n,sep:r}]})}else i.length>0?t.sep=t.sep.concat(i,this.sourceToken):t.sep.push(this.sourceToken)}else t.sep?t.value||r?e.items.push({start:i,key:null,sep:[this.sourceToken]}):K(t.sep,`map-value-ind`)?this.stack.push({type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:[],key:null,sep:[this.sourceToken]}]}):t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});this.onKeyLine=!0;return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);r||t.value?(e.items.push({start:i,key:n,sep:[]}),this.onKeyLine=!0):t.sep?this.stack.push(n):(Object.assign(t,{key:n,sep:[]}),this.onKeyLine=!0);return}default:{let r=this.startBlockValue(e);if(r){if(r.type===`block-seq`){if(!t.explicitKey&&t.sep&&!K(t.sep,`newline`)){yield*this.pop({type:`error`,offset:this.offset,message:`Unexpected block-seq-ind on same line with key`,source:this.source});return}}else n&&e.items.push({start:i});this.stack.push(r);return}}}}yield*this.pop(),yield*this.step()}*blockSequence(e){let t=e.items[e.items.length-1];switch(this.type){case`newline`:if(t.value){let n=`end`in t.value?t.value.end:void 0;(Array.isArray(n)?n[n.length-1]:void 0)?.type===`comment`?n?.push(this.sourceToken):e.items.push({start:[this.sourceToken]})}else t.start.push(this.sourceToken);return;case`space`:case`comment`:if(t.value)e.items.push({start:[this.sourceToken]});else{if(this.atIndentedComment(t.start,e.indent)){let n=e.items[e.items.length-2]?.value?.end;if(Array.isArray(n)){ni(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||K(t.start,`seq-item-ind`)?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return}if(this.indent>e.indent){let t=this.startBlockValue(e);if(t){this.stack.push(t);return}}yield*this.pop(),yield*this.step()}*flowCollection(e){let t=e.items[e.items.length-1];if(this.type===`flow-error-end`){let e;do yield*this.pop(),e=this.peek(1);while(e?.type===`flow-collection`)}else if(e.end.length===0){switch(this.type){case`comma`:case`explicit-key-ind`:!t||t.sep?e.items.push({start:[this.sourceToken]}):t.start.push(this.sourceToken);return;case`map-value-ind`:!t||t.value?e.items.push({start:[],key:null,sep:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):Object.assign(t,{key:null,sep:[this.sourceToken]});return;case`space`:case`comment`:case`newline`:case`anchor`:case`tag`:!t||t.value?e.items.push({start:[this.sourceToken]}):t.sep?t.sep.push(this.sourceToken):t.start.push(this.sourceToken);return;case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:{let n=this.flowScalar(this.type);!t||t.value?e.items.push({start:[],key:n,sep:[]}):t.sep?this.stack.push(n):Object.assign(t,{key:n,sep:[]});return}case`flow-map-end`:case`flow-seq-end`:e.end.push(this.sourceToken);return}let n=this.startBlockValue(e);n?this.stack.push(n):(yield*this.pop(),yield*this.step())}else{let t=this.peek(2);if(t.type===`block-map`&&(this.type===`map-value-ind`&&t.indent===e.indent||this.type===`newline`&&!t.items[t.items.length-1].sep))yield*this.pop(),yield*this.step();else if(this.type===`map-value-ind`&&t.type!==`flow-collection`){let n=ti(ei(t));ri(e);let r=e.end.splice(1,e.end.length);r.push(this.sourceToken);let i={type:`block-map`,offset:e.offset,indent:e.indent,items:[{start:n,key:e,sep:r}]};this.onKeyLine=!0,this.stack[this.stack.length-1]=i}else yield*this.lineEnd(e)}}flowScalar(e){if(this.onNewLine){let e=this.source.indexOf(`
|
|
117
117
|
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
118
|
-
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=
|
|
119
|
-
`).filter(e=>e.trim()!==``);if(t.length===0)throw Error(`a mindmap needs an indented list`);let n=[],r;for(let e of t){let t=
|
|
120
|
-
`).entries()){let e=a.replace(/[ \t]+$/,``);if(e===``)continue;let o=i+1,s=/^[ \t]*/.exec(e)?.[0];if(s.includes(` `))throw Error(`line ${o}: indent with two spaces, not tabs`);if(s.length%2!=0)throw Error(`line ${o}: indent by two spaces per level`);let c=s.length/2;if(n===void 0&&c>0)throw Error(`line ${o}: the root line is not indented`);if(c>t.length)throw Error(`line ${o}: indented more than one level below the line above`);if(++r>
|
|
121
|
-
`)[0].replace(/:$/,``);function
|
|
122
|
-
`).trim();return{tone:n.tone,title:t[2].trim()||n.label,body:r}}var
|
|
123
|
-
`)}function
|
|
118
|
+
`,e)+1}return{type:e,offset:this.offset,indent:this.indent,source:this.source}}startBlockValue(e){switch(this.type){case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return this.flowScalar(this.type);case`block-scalar-header`:return{type:`block-scalar`,offset:this.offset,indent:this.indent,props:[this.sourceToken],source:``};case`flow-map-start`:case`flow-seq-start`:return{type:`flow-collection`,offset:this.offset,indent:this.indent,start:this.sourceToken,items:[],end:[]};case`seq-item-ind`:return{type:`block-seq`,offset:this.offset,indent:this.indent,items:[{start:[this.sourceToken]}]};case`explicit-key-ind`:{this.onKeyLine=!0;let t=ti(ei(e));return t.push(this.sourceToken),{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,explicitKey:!0}]}}case`map-value-ind`:{this.onKeyLine=!0;let t=ti(ei(e));return{type:`block-map`,offset:this.offset,indent:this.indent,items:[{start:t,key:null,sep:[this.sourceToken]}]}}}return null}atIndentedComment(e,t){return this.type!==`comment`||this.indent<=t?!1:e.every(e=>e.type===`newline`||e.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 ai(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new Zr||null,prettyErrors:t}}function oi(e,t={}){let{lineCounter:n,prettyErrors:r}=ai(t),i=new ii(n?.addNewLine),a=new Rr(t),o=null;for(let t of a.compose(i.parse(e),!0,e.length))if(!o)o=t;else if(o.options.logLevel!==`silent`){o.errors.push(new er(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(nr(e,n)),o.warnings.forEach(nr(e,n))),o}function si(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=oi(e,n);if(!i)return null;if(i.warnings.forEach(e=>Lt(i.options.logLevel,e)),i.errors.length>0){if(i.options.logLevel!==`silent`)throw i.errors[0];i.errors=[]}return i.toJS(Object.assign({reviver:r},n))}var ci=/^([ \t]*)(?:[-*+]|\d+[.)])[ \t]+(.*)$/;function li(e){let t=e.split(`
|
|
119
|
+
`).filter(e=>e.trim()!==``);if(t.length===0)throw Error(`a mindmap needs an indented list`);let n=[],r;for(let e of t){let t=ci.exec(e);if(!t)throw Error(`not a list item: ${e.trim()}`);let i=t[2].trim();if(i===``)throw Error(`a list item has no text`);let a=t[1].replace(/\t/g,` `).length,o={text:i,children:[]};for(;n.length>0&&n[n.length-1].indent>=a;)n.pop();let s=n[n.length-1];if(s)s.node.children.push(o);else if(r)throw Error(`a mindmap has one root: indent the other top-level items under it`);else r=o;n.push({indent:a,node:o})}return{root:r}}function ui(e){return{items:E(e,`items`).map(e=>{let t=le(e,`label`,`suggestion`),n=D(t.label??t.text,`label`);if(n===void 0)throw Error(`each suggestion needs a label or a text`);return{label:n,text:D(t.text,`text`)??n}})}}function di(e){let t=ne(e);return{title:D(t.title,`title`),submit:D(t.submit,`submit`),items:E(e,`items`).map(e=>{let t=le(e,`label`,`item`),n=D(t.label??t.name,`label`);if(n===void 0)throw Error(`each checklist item needs a label or a name`);let r=D(t.name,`name`)??n;if(r===`pi-note`)throw Error(`the item name "pi-note" is reserved for the other-comments box`);return{name:r,label:n,checked:oe(t.checked,`checked`)??!1,note:D(t.note,`note`)}})}}var fi=[`text`,`number`,`date`],pi=[`left`,`center`,`right`];function mi(e){let t=le(e,`name`,`column`),n=D(t.name??t.label,`name`);if(n===void 0)throw Error(`each column needs a name or a label`);let r=ce(t.type,fi,`type`)??`text`;return{name:n,label:D(t.label,`label`)??n,align:ce(t.align,pi,`align`)??(r===`number`?`right`:`left`),type:r}}function hi(e){if(e==null)return null;if(typeof e==`object`)throw Error(`a table cell must be text, a number, or a boolean`);return e}function gi(e,t){if(e==null)return;let n=typeof e==`object`?T(e,`sort`):{column:e},r=D(n.column??n.by,`sort column`)??``,i=ce(n.direction??n.dir,[`asc`,`desc`],`sort direction`);typeof e!=`object`&&r.startsWith(`-`)&&(r=r.slice(1),i=`desc`);let a=t.findIndex(e=>e.name===r||e.label===r);if(a<0)throw Error(`sort names no column: ${r}`);return{column:a,direction:i??`asc`}}function _i(e){let t=T(e,`table`),n=E(t,`rows`),r=t.columns===void 0?void 0:E(t,`columns`),i=n.filter(e=>typeof e==`object`&&!!e&&!Array.isArray(e)),a=(r??[...new Set(i.flatMap(e=>Object.keys(e)))]).map(mi);if(a.length===0)throw Error("a table needs `columns`, or rows written as mappings");return{columns:a,rows:n.map(e=>{if(Array.isArray(e)){if(e.length>a.length)throw Error(`a row has ${e.length} cells for ${a.length} columns`);return a.map((t,n)=>hi(e[n]))}let t=T(e,`row`);return a.map(e=>hi(t[e.name]??t[e.label]))}),sort:gi(t.sort,a),filter:oe(t.filter,`filter`)??!1}}var vi=[`done`,`doing`,`todo`,`blocked`];function yi(e){return{items:E(e,`items`).map(e=>{let t=le(e,`title`,`step`);return{title:re(t.title,`a step's title`),status:ce(t.status,vi,`status`)??`todo`,when:D(t.when,`when`),body:D(t.body,`body`)}})}}function bi(e){return{items:E(e,`items`).map(e=>{let t=T(e,`stat`);return{label:re(t.label,`a stat's label`),value:re(t.value,`a stat's value`),delta:D(t.delta,`delta`),tone:D(t.tone,`tone`),note:D(t.note,`note`)}})}}var xi=[`alert`,`mermaid`,`diff`,`cards`,`options`,`form`,`review`,`mindmap`,`suggest`,`checklist`,`table`,`steps`,`stats`,`tree`],Si=[`new`,`changed`,`removed`,`focus`,`risk`],Ci={nodes:2e3,depth:32},wi=[`options`,`suggest`,`form`,`checklist`,`review`],Ti=/^… (\d+) more$/,Ei=` # `,Di=/^(?:(.*?) )?\{([^{}]*)\}$/,Oi=new Set(Si),ki=e=>e.replace(/^[ \t]+|[ \t]+$/g,``);function Ai(e,t){let n=[];for(let r of e.split(/[\s,]+/).filter(Boolean)){if(!Oi.has(r))throw Error(`line ${t}: unknown tag "${r}" (use ${Si.join(`, `)})`);n.includes(r)||n.push(r)}return n}function ji(e,t){let n=e.indexOf(Ei),r=ki(n<0?e:e.slice(0,n)),i=n<0?``:ki(e.slice(n+3)),a=Di.exec(r),o=a?a[1]??``:r,s=o.endsWith(`/`),c=ki(s?o.slice(0,-1):o);if(c===``)throw Error(`line ${t}: a line has no name`);let l=a?Ai(a[2],t):[],u=s?null:Ti.exec(c);return{name:c,dir:s,tags:l,...i===``?{}:{note:i},children:[],...u?{more:Number(u[1])}:{}}}function Mi(e){let t=[],n,r=0;for(let[i,a]of e.split(`
|
|
120
|
+
`).entries()){let e=a.replace(/[ \t]+$/,``);if(e===``)continue;let o=i+1,s=/^[ \t]*/.exec(e)?.[0];if(s.includes(` `))throw Error(`line ${o}: indent with two spaces, not tabs`);if(s.length%2!=0)throw Error(`line ${o}: indent by two spaces per level`);let c=s.length/2;if(n===void 0&&c>0)throw Error(`line ${o}: the root line is not indented`);if(c>t.length)throw Error(`line ${o}: indented more than one level below the line above`);if(++r>Ci.nodes)throw Error(`a tree holds at most ${Ci.nodes} nodes`);if(c+1>Ci.depth)throw Error(`a tree is at most ${Ci.depth} levels deep`);if(c===0&&n!==void 0)throw Error(`a tree has one root: indent the other top-level lines under it`);let l=ji(e.slice(s.length),o);t.length=c;let u=t[c-1];if(u){if(!u.dir)throw Error(`line ${o}: "${u.name}" is a file and cannot hold entries (end a folder's name with /)`);u.children.push(l)}else n=l;t.push(l)}if(n===void 0)throw Error(`a tree needs a root line`);return{root:n}}var Ni={NOTE:{tone:`note`,label:`Note`},TIP:{tone:`ok`,label:`Tip`},IMPORTANT:{tone:`note`,label:`Important`},WARNING:{tone:`warn`,label:`Warning`},CAUTION:{tone:`risk`,label:`Caution`}},Pi=/^\[!(NOTE|TIP|IMPORTANT|WARNING|CAUTION)\][ \t]*(.*)$/i,Fi=/^ {0,3}> ?/,Ii=/^( {0,3})(`{3,})[ \t]*([^`]*)$/,Li=/^( {0,3})(~{3,})[ \t]*(.*)$/,Ri=new Set(xi.filter(e=>e!==`alert`)),q=e=>t=>{try{return e(si(t))}catch(e){if(!(e instanceof te))throw e;let n=new Zr,r=oi(t,{lineCounter:n});for(let t=e.path.length;t>0;t--){let i=r.getIn(e.path.slice(0,t),!0);if(P(i)&&i.range)throw Error(`line ${n.linePos(i.range[0]).line}: ${e.message}`)}throw e}},zi={mermaid:e=>{if(e.trim()===``)throw Error(`the diagram is empty`);return{source:e}},diff:e=>({source:e}),cards:q(ue),options:q(de),form:q(ge),review:q(Te),mindmap:li,suggest:q(ui),checklist:q(di),table:q(_i),steps:q(yi),stats:q(bi),tree:Mi},Bi=e=>(e instanceof Error?e.message:String(e)).split(`
|
|
121
|
+
`)[0].replace(/:$/,``);function Vi(e,t,n,r){try{return{type:`block`,kind:e,data:zi[e](t),raw:r,index:n}}catch(n){return{type:`invalid`,kind:e,source:t,raw:r,error:Bi(n)}}}function Hi(e){let t=Pi.exec(e[0].replace(Fi,``));if(!t)return;let n=Ni[t[1].toUpperCase()],r=e.slice(1).map(e=>e.replace(Fi,``)).join(`
|
|
122
|
+
`).trim();return{tone:n.tone,title:t[2].trim()||n.label,body:r}}var Ui=(e,t)=>{let n=t[0]==="`"?/^ {0,3}(`{3,})[ \t]*$/.exec(e):/^ {0,3}(~{3,})[ \t]*$/.exec(e);return n!==null&&t[0]===n[1][0]&&n[1].length>=t.length};function Wi(e){let t=0,n=e.length;for(;t<n&&e[t].trim()===``;)t++;for(;n>t&&e[n-1].trim()===``;)n--;return e.slice(t,n).join(`
|
|
123
|
+
`)}function Gi(e){return Ki(e).map(e=>e.segment)}function Ki(e){let t=e.replace(/\r\n?/g,`
|
|
124
124
|
`).split(`
|
|
125
|
-
`),n=[],r=[],i=1,a=0,o=()=>{let e=
|
|
125
|
+
`),n=[],r=[],i=1,a=0,o=()=>{let e=Wi(r);e!==``&&n.push({segment:{type:`markdown`,text:e},line:i,closed:!0,source:``}),r=[]},s=(e,t)=>{r.length===0&&(i=e+1),r.push(...t)},c=0;for(;c<t.length;){let e=t[c],r=Ii.exec(e)??Li.exec(e);if(r){let[,e,i,l]=r,u=[],d=c+1;for(;d<t.length&&!Ui(t[d],i);)u.push(t[d].replace(RegExp(`^ {0,${e.length}}`),``)),d++;let f=d<t.length,p=Math.min(d+1,t.length),m=l.trim().split(/\s+/)[0].toLowerCase();if(Ri.has(m)){o();let e=Vi(m,u.join(`
|
|
126
126
|
`),a,t.slice(c,p).join(`
|
|
127
127
|
`));e.type===`block`&&a++,n.push({segment:e,line:c+1,closed:f,source:u.join(`
|
|
128
|
-
`)})}else s(c,t.slice(c,p));c=p}else if(
|
|
129
|
-
`),index:a++},line:c+1,closed:!0,source:``})):s(c,r),c=e}else s(c,[e]),c++}return o(),n}var J=(e,t,n)=>({noun:e,item:{keys:t},...n?{names:n}:{}});J(`card`,[`title`,`tone`,`body`]),J(`option`,[`title`,`recommended`,`body`,`pros`,`cons`]),J(`choice`,[`value`,`label`,`note`,`recommended`]),J(`item`,[`name`,`label`,`image`,`page`,`height`,`body`],[`name`,`label`]),J(`suggestion`,[`label`,`text`]),J(`item`,[`name`,`label`,`checked`,`note`],[`name`,`label`]),J(`column`,[`name`,`label`,`type`,`align`],[`name`,`label`]),J(`step`,[`title`,`status`,`when`,`body`]),J(`stat`,[`label`,`value`,`delta`,`tone`,`note`]);var
|
|
128
|
+
`)})}else s(c,t.slice(c,p));c=p}else if(Fi.test(e)){let e=c;for(;e<t.length&&Fi.test(t[e]);)e++;let r=t.slice(c,e),i=Hi(r);i?(o(),n.push({segment:{type:`block`,kind:`alert`,data:i,raw:r.join(`
|
|
129
|
+
`),index:a++},line:c+1,closed:!0,source:``})):s(c,r),c=e}else s(c,[e]),c++}return o(),n}var J=(e,t,n)=>({noun:e,item:{keys:t},...n?{names:n}:{}});J(`card`,[`title`,`tone`,`body`]),J(`option`,[`title`,`recommended`,`body`,`pros`,`cons`]),J(`choice`,[`value`,`label`,`note`,`recommended`]),J(`item`,[`name`,`label`,`group`,`image`,`page`,`height`,`body`],[`name`,`label`]),J(`suggestion`,[`label`,`text`]),J(`item`,[`name`,`label`,`checked`,`note`],[`name`,`label`]),J(`column`,[`name`,`label`,`type`,`align`],[`name`,`label`]),J(`step`,[`title`,`status`,`when`,`body`]),J(`stat`,[`label`,`value`,`delta`,`tone`,`note`]);var qi=/^(?:https?:\/\/|data:image\/(?:png|jpe?g|gif|webp);base64,)/i,Ji=e=>qi.test(e)?e:void 0,Yi=Zi(),Xi=new Set;function Zi(){return{strings:{},diagramUrl:void 0,diagramMap:void 0,imageUrl:Ji,pageUrl:void 0}}var Qi=()=>Yi;function $i(e){return Xi.add(e),()=>Xi.delete(e)}function ea(e){let t={...Yi.strings};for(let n of Object.keys(e.strings??{}))t[n]={...t[n],...e.strings?.[n]};Yi={strings:t,diagramUrl:`diagramUrl`in e?e.diagramUrl:Yi.diagramUrl,diagramMap:`diagramMap`in e?e.diagramMap:Yi.diagramMap,imageUrl:`imageUrl`in e?e.imageUrl??Ji:Yi.imageUrl,pageUrl:`pageUrl`in e?e.pageUrl:Yi.pageUrl};for(let e of Xi)e()}var ta=new Set([`value`,`checked`,`selected`,`indeterminate`]);function Y(e,t,...n){let r=document.createElement(e);for(let[e,n]of Object.entries(t??{}))n!=null&&n!==!1&&(ta.has(e)?r[e]=n:r.setAttribute(e,n===!0?``:String(n)));return ia(r,n),r}var na=`http://www.w3.org/2000/svg`;function ra(e,t,...n){let r=document.createElementNS(na,e);for(let[e,n]of Object.entries(t??{}))n!=null&&n!==!1&&r.setAttribute(e,n===!0?``:String(n));for(let e of n)e&&r.append(e);return r}function ia(e,t){for(let n of t)n!=null&&n!==!1&&(Array.isArray(n)?ia(e,n):e.append(typeof n==`object`?n:document.createTextNode(String(n))))}var aa=/^https?:\/\/[^\s<>]+$/i;function oa(e){switch(e.type){case`text`:return document.createTextNode(e.text);case`code`:return Y(`code`,null,e.text);case`br`:return document.createElement(`br`);case`strong`:return Y(`strong`,null,e.children.map(oa));case`em`:return Y(`em`,null,e.children.map(oa));case`link`:{let t=e.children.map(oa);return aa.test(e.href)?Y(`a`,{href:e.href,target:`_blank`,rel:`noopener noreferrer`},t):Y(`span`,null,t)}}}var X=e=>f(e).map(oa),sa=/^\s*(?:[-*+]|\d+[.)])\s+/,ca=/^\s*\d+[.)]\s+/;function la(e,t=`body`){return e.replace(/\r\n?/g,`
|
|
130
130
|
`).trim().split(/\n{2,}/).filter(e=>e.trim()!==``).map(e=>{let n=e.split(`
|
|
131
|
-
`);if(n.every(e=>
|
|
131
|
+
`);if(n.every(e=>sa.test(e))){let e=n.map(e=>Y(`li`,null,X(e.replace(sa,``))));return Y(ca.test(n[0])?`ol`:`ul`,{part:t},e)}return Y(`p`,{part:t},X(e))})}var ua=0,Z=(e=`pbs`)=>`${e}-${++ua}`,da=e=>e==null?``:String(e),fa={en:{send:`Send`,sent:`Sent.`,submitted:`Sent`,pick:`Pick this`,picked:`Picked`,recommended:`Recommended`,required:`required`,unanswered:`Not answered yet: `,other:`Other (type your own)`,feedbackNote:`Feedback (leave blank for none)`,otherComments:`Other comments`,noFeedback:`No feedback`,reviewFallback:`Review`,enlarge:`Enlarge`,close:`Close`,previousImage:`Previous`,nextImage:`Next`,imagePosition:`{n} of {total}`,imageUnavailable:`Image not available`,pageUnavailable:`Prototype page, not shown here: `,filter:`Filter rows`,rowCount:`{n} of {total} rows`,noRows:`No matching rows`,sortBy:`Sort by {label}`,yes:`Yes`,no:`No`,statusDone:`Done`,statusDoing:`In progress`,statusTodo:`To do`,statusBlocked:`Blocked`,toneNote:`Note`,toneOk:`Tip`,toneWarn:`Warning`,toneRisk:`Caution`,diagram:`Diagram`,diagramSource:`Source`,diagramFallback:`The diagram is not available here; its source is shown instead.`,diagramComment:`Comment on {kind}: {text}`,diagramNode:`node`,diagramEdge:`edge`,diagramGroup:`group`,diagramKeys:`Arrow keys move between its elements; Enter or Space comments on one.`,diagramKindFlow:`Flowchart`,diagramKindState:`State diagram`,diagramKindSequence:`Sequence diagram`,diagramKindClass:`Class diagram`,diagramKindEr:`Entity-relationship diagram`,diagramKindChart:`Chart`,diagramNodes:`{n} nodes`,diagramAlt:`{title}, {desc}`,diagramDesc:`{nodes}: {path}`,diff:`Diff`,table:`Table`,mindmap:`Mind map`,tree:`Directory tree`,treeExpandAll:`Expand all`,treeCollapseAll:`Collapse all`,treeEntries:`entries: {n}`,suggestions:`Suggested replies`,checklistProgress:`{done} of {total} done`,stats:`Metrics`,steps:`Steps`,options:`Options`,cards:`Cards`,blockError:`This block cannot be shown`},"zh-Hant":{send:`送出`,sent:`已送出。`,submitted:`已送出`,pick:`選這個`,picked:`已選`,recommended:`推薦`,required:`必填`,unanswered:`還沒回答:`,other:`其他(自行填寫)`,feedbackNote:`回饋(留白代表沒意見)`,otherComments:`其他意見`,noFeedback:`沒有意見`,reviewFallback:`回饋`,enlarge:`放大`,close:`關閉`,previousImage:`上一張`,nextImage:`下一張`,imagePosition:`第 {n} / {total} 張`,imageUnavailable:`無法顯示圖片`,pageUnavailable:`原型頁面(此處不顯示):`,filter:`篩選列`,rowCount:`{n} / {total} 列`,noRows:`沒有符合的列`,sortBy:`依「{label}」排序`,yes:`是`,no:`否`,statusDone:`完成`,statusDoing:`進行中`,statusTodo:`待辦`,statusBlocked:`受阻`,toneNote:`備註`,toneOk:`提示`,toneWarn:`警告`,toneRisk:`注意`,diagram:`圖表`,diagramSource:`原始碼`,diagramFallback:`這裡無法顯示圖表,改為顯示原始碼。`,diagramComment:`針對{kind}留言:{text}`,diagramNode:`節點`,diagramEdge:`連線`,diagramGroup:`群組`,diagramKeys:`用方向鍵在元素之間移動,按 Enter 或空白鍵針對它留言。`,diagramKindFlow:`流程圖`,diagramKindState:`狀態圖`,diagramKindSequence:`循序圖`,diagramKindClass:`類別圖`,diagramKindEr:`實體關聯圖`,diagramKindChart:`XY 圖表`,diagramNodes:`{n} 個節點`,diagramAlt:`{title},{desc}`,diagramDesc:`{nodes}:{path}`,diff:`差異`,table:`表格`,mindmap:`心智圖`,tree:`目錄樹`,treeExpandAll:`全部展開`,treeCollapseAll:`全部收合`,treeEntries:`{n} 項`,suggestions:`建議回覆`,checklistProgress:`已完成 {done} / {total}`,stats:`指標`,steps:`步驟`,options:`選項`,cards:`卡片`,blockError:`無法顯示這個區塊`}},pa=e=>/^zh/i.test(e??``)?`zh-Hant`:`en`,ma=(e,t)=>e.replace(/\{(\w+)\}/g,(e,n)=>n in t?String(t[n]):e),ha=`
|
|
132
132
|
:host {
|
|
133
133
|
display: block;
|
|
134
134
|
--_fg: var(--pbs-fg, light-dark(#1f2328, #e6edf3));
|
|
@@ -264,7 +264,7 @@ div.error { padding: var(--_pad); border: 1px solid color-mix(in srgb, var(--_ri
|
|
|
264
264
|
@media (prefers-reduced-motion: no-preference) {
|
|
265
265
|
.btn, .badge { transition: background-color 0.12s, border-color 0.12s; }
|
|
266
266
|
}
|
|
267
|
-
`,
|
|
267
|
+
`,ga=typeof HTMLElement>`u`?class{}:HTMLElement,_a=new Map;function va(e){let t=_a.get(e);return t||(t=new CSSStyleSheet,t.replaceSync(e),_a.set(e,t)),t}var ya=e=>typeof ShadowRoot<`u`&&e instanceof ShadowRoot,Q=class extends ga{static observedAttributes=[`data-json`,`data-answered`,`density`,`lang`,`scheme`,`doc`,`block`];static css=``;#e;#t;#n;#r;#i;#a=()=>this.refresh();constructor(){super();let e=this.attachShadow({mode:`open`}),t=this.constructor.css;e.adoptedStyleSheets=t?[va(ha),va(t)]:[va(ha)]}get data(){return this.#e}set data(e){this.#e=e,this.reset(),this.refresh()}get answered(){return this.#t}set answered(e){this.#t=e,this.settled(),this.refresh()}get ref(){if(this.#n)return this.#n;let e=this.getAttribute(`block`);if(e===null||!/^\d+$/.test(e))return;let t=this.getAttribute(`doc`);return t===null?{block:Number(e)}:{doc:t,block:Number(e)}}set ref(e){this.#n=e}get density(){return this.getAttribute(`density`)===`compact`?`compact`:`comfortable`}set density(e){this.setAttribute(`density`,e)}get scheme(){let e=this.getAttribute(`scheme`);if(e===`light`||e===`dark`)return e;let t=getComputedStyle(this).colorScheme;return t===`dark`||t===`light`?t:matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}set scheme(e){this.setAttribute(`scheme`,e)}get locale(){let e=this;for(;e;){let t=e.getAttribute(`lang`);if(t)return pa(t);let n=e.getRootNode();e=e.parentElement??(ya(n)?n.host:null)}return pa(document.documentElement.lang||navigator.language)}get strings(){let e=this.locale;return{...fa[e],...Qi().strings[e]}}t(e,t){let n=this.strings[e];return t?ma(n,t):n}connectedCallback(){this.#r=$i(()=>this.refresh()),this.#i=matchMedia(`(prefers-color-scheme: dark)`),this.#i.addEventListener(`change`,this.#a),this.refresh()}disconnectedCallback(){this.#r?.(),this.#i?.removeEventListener(`change`,this.#a)}attributeChangedCallback(e,t,n){if(e===`data-json`||e===`data-answered`)try{let t=n===null?void 0:JSON.parse(n);e===`data-json`?(this.#e=t,this.reset()):(this.#t=t,this.settled())}catch(e){this.fail(e);return}this.refresh()}refresh(){if(!this.isConnected)return;let e=this.shadowRoot;if(this.#e===void 0)e.replaceChildren();else try{let t=this.view(this.#e);e.replaceChildren(...Array.isArray(t)?t:[t])}catch(e){this.fail(e)}}fail(e){let t=e instanceof Error?e.message:String(e);this.shadowRoot.replaceChildren(Y(`div`,{part:`error`,class:`error`,role:`alert`},`${this.t(`blockError`)}: ${t}`)),this.dispatchEvent(new CustomEvent(`pbs-error`,{bubbles:!0,composed:!0,detail:e}))}answer(e){let t=this.ref,n=t?{...e,ref:t}:e;return this.dispatchEvent(new CustomEvent(`pbs-answer`,{bubbles:!0,composed:!0,cancelable:!0,detail:n}))}status(e){let t=this.shadowRoot?.querySelector(`[part="status"]`);t&&(t.textContent=e)}focusIn(e){this.shadowRoot?.querySelector(e)?.focus()}reset(){}settled(){}};function $(e,t){typeof customElements<`u`&&!customElements.get(e)&&customElements.define(e,t)}var ba=`
|
|
268
268
|
.choices { display: flex; flex-direction: column; gap: 0.4rem; }
|
|
269
269
|
.check {
|
|
270
270
|
display: flex; gap: 0.6rem; align-items: flex-start; cursor: pointer;
|
|
@@ -312,8 +312,8 @@ fieldset.question { border: 0; min-width: 0; display: flex; flex-direction: colu
|
|
|
312
312
|
.note-field { display: flex; flex-direction: column; gap: 0.3rem; }
|
|
313
313
|
.note-field .label { font-weight: 600; }
|
|
314
314
|
.sent-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; }
|
|
315
|
-
`;function
|
|
316
|
-
`).map(e=>e.trim()).filter(e=>e!==``&&!e.startsWith(`%%`)),r=n.find(e=>!/^\w+:/.test(e)||/^(?:graph|flowchart|stateDiagram)/i.test(e))??``,i=
|
|
315
|
+
`;function xa(e){let t=Y(`button`,{type:`submit`,part:`submit`,class:`btn`},e),n=Y(`span`,{part:`status`,class:`status`,role:`status`,"aria-live":`polite`});return{row:Y(`div`,{part:`actions`,class:`row`},t,n),button:t,status:n}}function Sa(e,t,n){let r=Y(`textarea`,{part:`note`,class:`note-box`,maxlength:1024,rows:2,value:t});return r.addEventListener(`input`,()=>n(r.value)),Y(`label`,{part:`note-field`,class:`note-field`},Y(`span`,{class:`label`},e),r)}var Ca=e=>e.trim()?[[fe,e.trim()]]:[];function wa(e,t,...n){let r=Y(`form`,{novalidate:!0,...t},...n);return r.addEventListener(`submit`,t=>{t.preventDefault(),e()}),r.addEventListener(`keydown`,t=>{t.key===`Enter`&&(t.ctrlKey||t.metaKey)&&!t.isComposing&&(t.preventDefault(),e())}),r}var Ta=(e,t)=>e?.find(([e])=>e===t)?.[1],Ea=e=>Y(`span`,{part:`badge`,class:`badge`,"data-tone":`ok`},`✓ ${e}`),Da=class extends Q{static css=ba;#e;#t=``;reset(){this.#e=void 0,this.#t=``}settled(){this.#e=void 0}view(e){let t=Ta(this.answered,`picked`),n=this.#e??(t===void 0?void 0:e.options.findIndex((e,n)=>we(e,n)===t)),r=this.answered!==void 0||this.#e!==void 0,i=Ta(this.answered,`pi-note`)??(this.#e===void 0?``:this.#t.trim()),a=t=>{r||this.answer({kind:`pick`,fields:[[`picked`,we(e.options[t],t)],...Ca(this.#t)]})&&(this.#e=t,this.refresh(),this.focusIn(`[data-selected] button`))};return[...r?i?[Y(`p`,{part:`sent-note`,class:`status`},`${this.t(`otherComments`)}: ${i}`)]:[]:[Sa(this.t(`otherComments`),this.#t,e=>{this.#t=e})],Y(`div`,{part:`grid`,class:`grid`,role:`list`,"aria-label":this.t(`options`)},e.options.map((e,t)=>{let i=n===t,o=we(e,t),s=Y(`button`,{type:`button`,part:`pick`,class:`btn`,"aria-disabled":r?`true`:null,"aria-label":`${this.t(`pick`)}: ${o}`},i?`✓ ${this.t(`picked`)}`:this.t(`pick`));return s.addEventListener(`click`,()=>a(t)),Y(`article`,{part:`option`,class:`panel option`,role:`listitem`,"data-selected":i,"data-dim":r&&!i},Y(`div`,{part:`title`,class:`heading`},e.title?X(e.title):o,e.recommended!==void 0&&Y(`span`,{part:`badge`,class:`badge`,"data-tone":`ok`},e.recommended===!0?this.t(`recommended`):e.recommended)),e.body&&la(e.body),e.pros.length>0&&Y(`ul`,{part:`pros`,class:`pros`},e.pros.map(e=>Y(`li`,null,X(e)))),e.cons.length>0&&Y(`ul`,{part:`cons`,class:`cons`},e.cons.map(e=>Y(`li`,null,X(e)))),Y(`div`,{part:`actions`,class:`row`},s))})),Y(`p`,{part:`status`,class:`status`,role:`status`,"aria-live":`polite`},r?this.t(`sent`):``)]}},Oa=class extends Q{static css=ba;#e;reset(){this.#e=void 0}settled(){this.#e=void 0}view(e){let t=Ta(this.answered,`text`),n=this.#e??(t===void 0?void 0:e.items.findIndex(e=>e.text===t)),r=this.answered!==void 0||this.#e!==void 0,i=e.items.map((e,t)=>{let i=n===t,a=Y(`button`,{type:`button`,part:`chip`,class:`chip`,"aria-disabled":r?`true`:null,"aria-pressed":r?String(i):null,"data-selected":i},X(e.label));return a.addEventListener(`click`,()=>{r||this.answer({kind:`suggest`,fields:[[`text`,e.text]]})&&(this.#e=t,this.refresh(),this.focusIn(`[data-selected]`))}),a});return Y(`div`,{part:`suggest`,class:`suggest`},Y(`div`,{part:`chips`,class:`chips`,role:`group`,"aria-label":this.t(`suggestions`)},i),t!==void 0&&n===-1&&Y(`p`,{part:`status`,class:`status`},`${this.t(`submitted`)}: ${t}`))}},ka=class extends Q{static css=ba;#e;#t=``;reset(){this.#e=void 0,this.#t=``}view(e){let t=this.answered;this.#e??=e.items.map(e=>e.checked);let n=this.#e,r=r=>{let i=e.items[r];return t?Ta(t,i.name)===`checked`:n[r]},i=Y(`span`,{part:`progress`,class:`status`}),a=()=>i.textContent=this.t(`checklistProgress`,{done:e.items.filter((e,t)=>r(t)).length,total:e.items.length}),o=e.items.map((e,i)=>{let o=Z(`pbs-check`),s=Y(`input`,{type:`checkbox`,id:o,checked:r(i),disabled:t!==void 0});return s.addEventListener(`change`,()=>{n[i]=s.checked,a()}),Y(`label`,{part:`item`,class:`check`,for:o},s,Y(`span`,{class:`text`},X(e.label),e.note&&Y(`span`,{class:`note`},X(e.note))))});a();let s=e.title&&Y(`div`,{part:`title`,class:`heading`},X(e.title)),c=Y(`div`,{part:`items`,class:`choices`,role:`group`,"aria-label":e.title?w(e.title):void 0},o),l=Ta(t,fe);if(t)return Y(`section`,{part:`checklist`,class:`panel form-panel`},Y(`div`,{class:`sent-head`},s,Ea(this.t(`submitted`))),c,i,l&&Y(`p`,{part:`sent-note`,class:`status`},`${this.t(`otherComments`)}: ${l}`));let{row:u,status:d}=xa(e.submit?w(e.submit):this.t(`send`));return wa(()=>{let t=e.items.map((e,t)=>[e.name,n[t]?`checked`:`unchecked`]);t.push(...Ca(this.#t)),this.answer({kind:`checklist`,...e.title?{title:w(e.title)}:{},fields:t})&&(d.textContent=this.t(`sent`))},{part:`checklist`,class:`panel form-panel`},s,c,i,Sa(this.t(`otherComments`),this.#t,e=>{this.#t=e}),u)}};function Aa(){$(`pbs-options`,Da),$(`pbs-suggest`,Oa),$(`pbs-checklist`,ka)}var ja=[[/^(?:graph|flowchart)\b/i,`diagramKindFlow`],[/^stateDiagram/i,`diagramKindState`],[/^sequenceDiagram\b/i,`diagramKindSequence`],[/^classDiagram\b/i,`diagramKindClass`],[/^erDiagram\b/i,`diagramKindEr`],[/^xychart/i,`diagramKindChart`]],Ma=4,Na=/\s*(?:<?-{2,}>|<?={2,}>|-\.+->|-{3,})\s*(?:\|[^|]*\|\s*)?/,Pa=/^([^\s[\](){}"<>|:;&]+)(?::::\w+)?\s*(?:[[({]+\s*"?([^"\]})]*?)"?\s*[\])}]+)?/,Fa=e=>e.trim().replace(/^["']|["']$/g,``);function Ia(e,t){let n=e.filter(e=>!Na.test(e)),r=/^title:\s*(.+)$/i.exec(n.find(e=>/^title:/i.test(e))??``);if(r)return Fa(r[1]);if(!t)return;let i=/^title\s+(.+)$/i.exec(n.find(e=>/^title\s/i.test(e))??``);return i?Fa(i[1]):void 0}function La(e){let t=new Map,n=[];for(let r of e){if(!Na.test(r))continue;let e=[];for(let n of r.replace(/:[^>]*$/,``).split(Na)){let r=[];for(let e of n.split(/\s+&\s+/)){let n=Pa.exec(e.trim());if(!n||n[1]===`[*]`)continue;let i=n[1],a=n[2]?.trim();(!t.has(i)||a&&t.get(i)===i)&&t.set(i,a||i),r.push(i)}r.length>0&&e.push(r)}for(let t=1;t<e.length;t++)for(let r of e[t-1])for(let i of e[t])n.push([r,i])}let r=[],i=0,a=0;for(let[e,t]of n){let n=r.at(-1),o=n?.at(-1)===e;if(i+(o?1:2)>Ma)break;o?n?.push(t):r.push([e,t]),i+=o?1:2,a++}let o=r.map(e=>e.map(e=>t.get(e)??e).join(` → `));return{count:t.size,path:o,more:a<n.length}}function Ra(e,t){let n=e.replace(/^\s*---\n([\s\S]*?)\n---\s*\n/,(e,t)=>`${t}\n`).split(`
|
|
316
|
+
`).map(e=>e.trim()).filter(e=>e!==``&&!e.startsWith(`%%`)),r=n.find(e=>!/^\w+:/.test(e)||/^(?:graph|flowchart|stateDiagram)/i.test(e))??``,i=ja.find(([e])=>e.test(r))?.[1],a=i?t[i]:t.diagram,o=Ia(n,i===`diagramKindChart`),s=o?`${a} “${o}”`:a,c=``;if(i===`diagramKindFlow`||i===`diagramKindState`){let{count:e,path:r,more:i}=La(n);if(e>0){let n=ma(t.diagramNodes,{n:e});c=r.length>0?ma(t.diagramDesc,{nodes:n,path:r.join(`; `)+(i?` …`:``)}):n}}return{title:s,desc:c,alt:c?ma(t.diagramAlt,{title:s,desc:c}):s}}var za=`
|
|
317
317
|
|
|
318
318
|
.callout > .callout-head { display: flex; align-items: baseline; color: color-mix(in srgb, var(--_t) 78%, var(--_fg)); }
|
|
319
319
|
|
|
@@ -371,9 +371,9 @@ fieldset.question { border: 0; min-width: 0; display: flex; flex-direction: colu
|
|
|
371
371
|
.diagram summary { cursor: pointer; color: var(--_muted); font-size: 0.9em; }
|
|
372
372
|
.diagram pre { margin-top: 0.4rem; padding: var(--_pad); background: var(--_surface); border-radius: var(--_radius); }
|
|
373
373
|
.diagram .note { margin-bottom: 0.5rem; text-align: left; }
|
|
374
|
-
`,
|
|
374
|
+
`,Ba=[`note`,`ok`,`warn`,`risk`],Va={note:`ⓘ`,ok:`✓`,warn:`⚠`,risk:`✕`},Ha={note:`toneNote`,ok:`toneOk`,warn:`toneWarn`,risk:`toneRisk`},Ua=e=>Ba.find(t=>t===e),Wa=class extends Q{static css=za;view(e){let t=Ua(e.tone)??`note`,n=this.t(Ha[t]);return Y(`section`,{part:`callout`,class:`panel callout`,"data-tone":t,role:`note`},Y(`div`,{part:`header`,class:`heading callout-head`},Y(`span`,{part:`icon`,class:`icon`,role:`img`,"aria-label":n},Va[t]),Y(`span`,{part:`title`},X(e.title||n))),la(e.body??``))}},Ga=class extends Q{static css=za;view(e){return Y(`div`,{part:`grid`,class:`grid`,role:`list`,"aria-label":this.t(`cards`)},e.cards.map(e=>{let t=Ua(e.tone);return Y(`article`,{part:`card`,class:`panel card`,role:`listitem`,"data-tone":t},e.title&&Y(`div`,{part:`title`,class:`heading`},t&&Y(`span`,{part:`icon`,class:`icon`,"aria-hidden":`true`},Va[t]),X(e.title)),e.body&&la(e.body))}))}},Ka={done:`ok`,doing:`note`,todo:void 0,blocked:`risk`},qa={done:`✓`,doing:`●`,todo:`○`,blocked:`✕`},Ja={done:`statusDone`,doing:`statusDoing`,todo:`statusTodo`,blocked:`statusBlocked`},Ya=class extends Q{static css=za;view(e){return Y(`ol`,{part:`steps`,class:`steps`,"aria-label":this.t(`steps`)},e.items.map(e=>Y(`li`,{part:`step`,"data-status":e.status,"data-tone":Ka[e.status]},Y(`div`,{class:`rail`,part:`rail`},Y(`span`,{part:`marker`,class:`marker`,"aria-hidden":`true`},qa[e.status]),Y(`span`,{class:`line`,"aria-hidden":`true`})),Y(`div`,{class:`content`,part:`content`},Y(`div`,{class:`head`},Y(`span`,{part:`title`,class:`heading`},X(e.title)),Y(`span`,{part:`badge`,class:`badge`},this.t(Ja[e.status])),e.when&&Y(`span`,{part:`when`,class:`when`},e.when)),e.body&&Y(`div`,{part:`body`,class:`body`},la(e.body))))))}},Xa=e=>/^\+/.test(e)?`▲ `:/^[-−–]/.test(e)?`▼ `:``,Za=class extends Q{static css=za;view(e){return Y(`div`,{part:`grid`,class:`grid`,role:`list`,"aria-label":this.t(`stats`)},e.items.map(e=>Y(`div`,{part:`stat`,class:`panel stat`,role:`listitem`,"data-tone":Ua(e.tone)},Y(`div`,{part:`label`,class:`label`},X(e.label)),Y(`div`,{part:`value`,class:`value`},e.value),e.delta&&Y(`div`,null,Y(`span`,{part:`delta`,class:`badge`,"data-tone":Ua(e.tone)},Xa(e.delta),e.delta)),e.note&&Y(`div`,{part:`note`,class:`label`},X(e.note)))))}};function Qa(e){let t=[];for(let n=0;n<e.length;n++){let r=e[n];r.startsWith(`--- `)&&(e[n+1]??``).startsWith(`+++ `)?(t.push(`meta`,`meta`),n++):r.startsWith(`@@`)?t.push(`hunk`):/^(diff |index |new file|deleted file|similarity |rename |old mode|new mode|\\)/.test(r)?t.push(`meta`):r.startsWith(`+`)?t.push(`add`):r.startsWith(`-`)?t.push(`del`):t.push(`context`)}return t}var $a=class extends Q{static css=za;view(e){let t=e.source.replace(/\r\n?/g,`
|
|
375
375
|
`).replace(/\n$/,``).split(`
|
|
376
|
-
`),n=
|
|
376
|
+
`),n=Qa(t);return Y(`figure`,{part:`diff`,class:`diff`},Y(`div`,{class:`scroll`,part:`scroll`,tabindex:`0`,role:`region`,"aria-label":this.t(`diff`)},Y(`pre`,null,Y(`code`,null,t.map((e,t)=>Y(`span`,{part:`line`,class:`line`,"data-kind":n[t]},e))))))}},eo=1.25,to=class extends Q{static css=za;#e;#t;disconnectedCallback(){super.disconnectedCallback(),this.#t?.disconnect(),this.#t=void 0}reset(){this.#e=void 0}view(e){let t=Qi().diagramUrl?.(e.source,this.scheme),n=t!==void 0&&t!==this.#e,r=Y(`pre`,null,Y(`code`,null,e.source)),i=Y(`figure`,{part:`diagram`,class:`panel diagram`});if(n){let n=Y(`img`,{part:`image`,src:t,alt:Ra(e.source,this.strings).alt,loading:`lazy`}),a=()=>{let e=i.clientWidth>0&&n.naturalWidth>i.clientWidth*eo;i.toggleAttribute(`data-wide`,e)};n.addEventListener(`load`,()=>{a(),typeof ResizeObserver<`u`&&(this.#t?.disconnect(),this.#t=new ResizeObserver(a),this.#t.observe(i))}),n.addEventListener(`error`,()=>{this.#e=t,this.refresh()});let o=Y(`div`,{class:`frame`},n);this.#r(o,t),i.append(o,Y(`details`,{part:`source`},Y(`summary`,null,this.t(`diagramSource`)),r))}else i.append(Y(`p`,{part:`note`,class:`muted note`},this.t(`diagramFallback`)),r);return i}#n(){return Ra(this.data?.source??``,this.strings).alt}#r(e,t){let n=Qi().diagramMap;n&&Promise.resolve().then(()=>n(t)).then(t=>{t&&e.isConnected&&e.append(this.#i(t))},e=>console.warn(`pbs-diagram: the diagram's elements cannot be commented on:`,e))}#i(e){let t={node:this.t(`diagramNode`),edge:this.t(`diagramEdge`),group:this.t(`diagramGroup`)},n=(e,t)=>{e.dispatchEvent(new CustomEvent(`pbs-diagram-target`,{bubbles:!0,composed:!0,detail:{kind:t.kind,text:t.text}}))},r=e.targets.map((e,n)=>ra(`g`,{class:`hit`,role:`button`,tabindex:n===0?0:-1,"data-kind":e.kind,"aria-label":this.t(`diagramComment`,{kind:t[e.kind],text:e.text})},...e.shapes.map(e=>ra(e.tag,e.attrs)))),i={ArrowDown:e=>e+1,ArrowRight:e=>e+1,ArrowUp:e=>e-1,ArrowLeft:e=>e-1,Home:()=>0,End:()=>r.length-1};for(let[t,a]of r.entries()){let o=e.targets[t];a.addEventListener(`focus`,()=>{for(let e of r)e.setAttribute(`tabindex`,e===a?`0`:`-1`)}),a.addEventListener(`click`,()=>n(a,o)),a.addEventListener(`keydown`,e=>{let s=i[e.key];s?(e.preventDefault(),r[Math.min(r.length-1,Math.max(0,s(t)))]?.focus()):(e.key===`Enter`||e.key===` `)&&(e.preventDefault(),n(a,o))})}let a=[`group`,`edge`,`node`],o=ra(`desc`,{id:`diagram-keys`});return o.textContent=this.t(`diagramKeys`),ra(`svg`,{class:`targets`,viewBox:e.viewBox,role:`group`,"aria-label":this.#n(),"aria-describedby":`diagram-keys`},o,...a.flatMap(t=>r.filter((n,r)=>e.targets[r]?.kind===t)))}};function no(){$(`pbs-callout`,Wa),$(`pbs-cards`,Ga),$(`pbs-steps`,Ya),$(`pbs-stats`,Za),$(`pbs-diff`,$a),$(`pbs-diagram`,to)}var ro=`(no answer)`,io=()=>({picks:[],otherOn:!1,other:``,text:``}),ao=(e,t)=>e.other===!1?void 0:e.other===!0?t:e.other;function oo(e,t){if(e.type===`text`)return t.text.trim();let n=t.otherOn?t.other.trim():``;return[...t.picks,n].filter(Boolean).join(`, `)}var so=class extends Q{static css=ba;#e;#t=``;reset(){this.#e=void 0,this.#t=``}view(e){this.#e??=e.questions.map(io);let t=this.#e,n=e.title&&Y(`div`,{part:`title`,class:`title`},X(e.title));if(this.answered)return this.sentView(e,n);let r=[],i=e.questions.map((e,n)=>{let i=this.question(e,t[n]);return r.push(i),i}),a=Y(`p`,{part:`error`,class:`error`,role:`alert`}),{row:o,status:s}=xa(e.submit?w(e.submit):this.t(`send`));return wa(()=>{let n=e.questions.flatMap((e,n)=>e.required&&oo(e,t[n])===``?[n]:[]);if(r.forEach((e,t)=>{n.includes(t)?e.setAttribute(`aria-invalid`,`true`):e.removeAttribute(`aria-invalid`)}),n.length>0){s.textContent=``,a.textContent=this.t(`unanswered`)+n.map(t=>w(e.questions[t].label??e.questions[t].name)).join(`, `),r[n[0]]?.querySelector(`input, textarea`)?.focus();return}a.textContent=``;let i=e.questions.map((e,n)=>[e.name,oo(e,t[n])||ro]);i.push(...Ca(this.#t)),e.title&&i.unshift([`form`,w(e.title)]),this.answer({kind:`form`,...e.title?{title:w(e.title)}:{},fields:i})&&(s.textContent=this.t(`sent`))},{part:`form`,class:`panel form-panel`,...e.title?{"aria-label":w(e.title)}:{}},n,i,Sa(this.t(`otherComments`),this.#t,e=>{this.#t=e}),a,o)}question(e,t){let n=Z(`pbs-label`),r=Z(`pbs-hint`),i=Z(`pbs-q`),a=Y(`legend`,{part:`label`,class:`label`,id:n},X(e.label??e.name),e.required&&[` `,Y(`span`,{class:`req`,"aria-hidden":`true`},`*`),Y(`span`,{class:`sr`},` (${this.t(`required`)})`)]),o=e.hint&&Y(`p`,{part:`hint`,class:`hint`,id:r},X(e.hint)),s=[];if(e.type===`text`){let e=Y(`textarea`,{part:`textarea`,"aria-labelledby":n,"aria-describedby":o?r:null,value:t.text});e.addEventListener(`input`,()=>{t.text=e.value}),s.push(e)}else{let n=e.type===`multi`?`checkbox`:`radio`,r=e.choices.map(r=>{let a=Y(`input`,{type:n,name:i,value:r.value,checked:t.picks.includes(r.value)});return a.addEventListener(`change`,()=>{e.type===`single`?(t.picks=[r.value],t.otherOn=!1):t.picks=a.checked?[...t.picks,r.value]:t.picks.filter(e=>e!==r.value)}),Y(`label`,{part:`choice`,class:`check`},a,Y(`span`,{class:`text`},X(r.label),r.recommended!==void 0&&Y(`span`,{part:`badge`,class:`badge`,"data-tone":`ok`},r.recommended===!0?this.t(`recommended`):r.recommended),r.note&&Y(`span`,{class:`note`},X(r.note))))}),a=ao(e,this.t(`other`));a!==void 0&&r.push(this.otherRow(e,t,n,i,a,r)),s.push(Y(`div`,{part:`choices`,class:`choices`},r))}return Y(`fieldset`,{part:`question`,class:`question`,"aria-describedby":o?r:null},a,o,s)}otherRow(e,t,n,r,i,a){let o=Y(`input`,{type:n,name:r,class:`other-pick`,"aria-label":i,checked:t.otherOn}),s=Y(`input`,{type:`text`,part:`other`,class:`other`,placeholder:i,"aria-label":i,value:t.other}),c=e.type===`single`;return o.addEventListener(`change`,()=>{t.otherOn=o.checked,c&&o.checked&&(t.picks=[]),o.checked&&s.focus()}),s.addEventListener(`input`,()=>{if(t.other=s.value,t.otherOn=s.value!==``,o.checked=t.otherOn,c&&t.otherOn){t.picks=[];for(let e of a){let t=e.querySelector(`input`);t&&t!==o&&(t.checked=!1)}}}),Y(`div`,{part:`choice`,class:`check`},o,Y(`span`,{class:`text`},s))}sentView(e,t){let n=this.answered??[],r=new Set(e.questions.map(e=>e.name)),i=[...e.questions.flatMap(e=>{let t=Ta(n,e.name);return t===void 0?[]:[[w(e.label??e.name),t]]}),...n.filter(([e])=>e!==`form`&&!r.has(e)).map(([e,t])=>[e===`pi-note`?this.t(`otherComments`):e,t])];return Y(`section`,{part:`form`,class:`panel form-panel`},Y(`div`,{class:`sent-head`},t,Ea(this.t(`submitted`))),Y(`dl`,{part:`sent`,class:`sent`},i.map(([e,t])=>Y(`div`,null,Y(`dt`,null,e),Y(`dd`,null,t)))))}};function co(){$(`pbs-form`,so)}var lo=`
|
|
377
377
|
.mindmap { padding: var(--_pad-s) var(--_pad); }
|
|
378
378
|
.mindmap ul { list-style: none; margin: 0; padding: 0; }
|
|
379
379
|
.mindmap ul ul { padding-left: 1.4rem; }
|
|
@@ -386,7 +386,7 @@ fieldset.question { border: 0; min-width: 0; display: flex; flex-direction: colu
|
|
|
386
386
|
.mindmap .toggle { flex: none; width: 1em; color: var(--_muted); text-align: center; font-size: 0.85em; }
|
|
387
387
|
.mindmap [data-level="0"] > .node .label { font-weight: 700; font-size: 1.08em; }
|
|
388
388
|
.mindmap [data-level="1"] > .node .label { font-weight: 600; }
|
|
389
|
-
`,
|
|
389
|
+
`,uo=30,fo=e=>1+e.children.reduce((e,t)=>e+fo(t),0),po=class extends Q{static css=lo;view(e){let t=fo(e.root)<=uo,n=[],r,i=(e,r,o,s,c)=>{let l=Z(`pbs-node`),u=Y(`span`,{part:`toggle`,class:`toggle`,"aria-hidden":`true`}),d=Y(`span`,{part:`label`,class:`label`,id:l},X(e.text)),f=Y(`li`,{role:`treeitem`,part:`item`,tabindex:`-1`,"aria-labelledby":l,"aria-level":r+1,"aria-setsize":c,"aria-posinset":s+1,"data-level":r},Y(`div`,{part:`node`,class:`node`},u,d)),p={node:e,element:f,group:void 0,toggle:u,parent:o,children:[],expanded:t||r<1};return n.push(p),e.children.length>0&&(p.children=e.children.map((t,n)=>i(t,r+1,p,n,e.children.length)),p.group=Y(`ul`,{role:`group`,part:`group`},p.children.map(e=>e.element)),f.append(p.group)),a(p),p},a=e=>{let t=e.children.length>0;t&&e.element.setAttribute(`aria-expanded`,String(e.expanded)),e.group&&(e.group.hidden=!e.expanded),e.toggle.textContent=t?e.expanded?`▾`:`▸`:`•`},o=()=>{let e=[],t=n=>{e.push(n),n.expanded&&n.children.forEach(t)};return t(l),e},s=e=>{for(let t of n)t.element.tabIndex=t===e?0:-1;r=e,e.element.focus()},c=(e,t=!e.expanded)=>{e.children.length!==0&&(e.expanded=t,a(e))},l=i(e.root,0,void 0,0,1);l.element.tabIndex=0,r=l;let u=Y(`ul`,{role:`tree`,part:`tree`,"aria-label":this.t(`mindmap`)},l.element);return u.addEventListener(`focusin`,e=>{let t=n.find(t=>t.element===e.target);if(t){for(let e of n)e.element.tabIndex=e===t?0:-1;r=t}}),u.addEventListener(`click`,e=>{let t=e.target.closest(`.node`),r=n.find(e=>e.element.firstElementChild===t);r&&(c(r),s(r))}),u.addEventListener(`keydown`,e=>{let t=r;if(!t||e.altKey||e.ctrlKey||e.metaKey||e.target!==t.element)return;let n=o(),i=n.indexOf(t),a=!0;switch(e.key){case`ArrowDown`:s(n[Math.min(n.length-1,i+1)]);break;case`ArrowUp`:s(n[Math.max(0,i-1)]);break;case`Home`:s(n[0]);break;case`End`:s(n[n.length-1]);break;case`ArrowRight`:t.children.length>0&&!t.expanded?c(t,!0):t.children.length>0&&s(t.children[0]);break;case`ArrowLeft`:t.children.length>0&&t.expanded?c(t,!1):t.parent&&s(t.parent);break;case`Enter`:case` `:c(t);break;default:a=!1}a&&e.preventDefault()}),Y(`div`,{part:`mindmap`,class:`panel mindmap`},u)}};function mo(){$(`pbs-mindmap`,po)}var ho=`${ba}
|
|
390
390
|
.review { container-type: inline-size; }
|
|
391
391
|
.review-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 18rem), 1fr)); gap: var(--_gap); }
|
|
392
392
|
.review-grid[data-columns="1"] { grid-template-columns: minmax(0, 1fr); }
|
|
@@ -398,19 +398,29 @@ fieldset.question { border: 0; min-width: 0; display: flex; flex-direction: colu
|
|
|
398
398
|
@container (max-width: 40rem) { .review-grid[data-columns] { grid-template-columns: minmax(0, 1fr); } }
|
|
399
399
|
.item { display: flex; flex-direction: column; gap: 0.6rem; }
|
|
400
400
|
.item .head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.2rem 0.75rem; }
|
|
401
|
-
.
|
|
402
|
-
.
|
|
401
|
+
.pick { display: inline-flex; gap: 0.4rem; align-items: center; cursor: pointer; font-size: 0.92em; white-space: nowrap; }
|
|
402
|
+
.pick input { margin: 0; }
|
|
403
403
|
.item .media { min-width: 0; display: flex; flex-direction: column; gap: 0.4rem; align-items: flex-start; }
|
|
404
404
|
.item .media img { display: block; max-width: 100%; height: auto; border-radius: 4px; }
|
|
405
405
|
.item .media iframe { width: 100%; border: 1px solid var(--_line); border-radius: 4px; background: #fff; }
|
|
406
406
|
.item .media .btn { padding: 0.1em 0.7em; font-size: 0.85em; }
|
|
407
407
|
.item .copy { min-width: 0; overflow-x: auto; }
|
|
408
408
|
.item textarea { min-height: 4rem; }
|
|
409
|
-
dialog { max-width: 96vw; max-height: 96vh; padding: 0; border: 0; background: transparent; color: var(--_fg); }
|
|
409
|
+
dialog { width: min(96vw, 110rem); max-width: 96vw; max-height: 96vh; overflow: auto; padding: 0; border: 0; background: transparent; color: var(--_fg); }
|
|
410
410
|
dialog::backdrop { background: rgb(0 0 0 / 0.82); }
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
411
|
+
.lightbox { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem); gap: var(--_gap); align-items: start; }
|
|
412
|
+
.lightbox .stage { min-width: 0; display: flex; justify-content: center; }
|
|
413
|
+
.lightbox .stage img { display: block; max-width: 100%; max-height: 92vh; object-fit: contain; border-radius: var(--_radius); background: var(--_bg); }
|
|
414
|
+
.lightbox .side { display: flex; flex-direction: column; gap: 0.6rem; padding: 0.9rem; border: 1px solid var(--_line); border-radius: var(--_radius); background: var(--_bg); }
|
|
415
|
+
.lightbox .head { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 0.2rem 0.75rem; }
|
|
416
|
+
.lightbox .nav { display: flex; gap: 0.5rem; }
|
|
417
|
+
.lightbox .nav .btn { flex: 1; }
|
|
418
|
+
.lightbox textarea { min-height: 8rem; }
|
|
419
|
+
@media (max-width: 48rem) {
|
|
420
|
+
.lightbox { grid-template-columns: minmax(0, 1fr); }
|
|
421
|
+
.lightbox .stage img { max-height: 60vh; }
|
|
422
|
+
}
|
|
423
|
+
`,go=class extends Q{static css=ho;#e=new Set;#t;#n=``;#r=[];#i=[];#a=new Map;reset(){this.#e.clear(),this.#t=void 0,this.#n=``}view(e){let t=e.title&&Y(`div`,{part:`title`,class:`title`},X(e.title));if(this.answered)return this.sentView(t);this.#t??=e.items.map(()=>``);let n=this.#t;this.#r=[],this.#i=[],this.#a.clear();let r=typeof e.pick==`string`?e.pick:e.pick||e.pickMode?this.t(`pick`):void 0,i=ye(e),a=new Map,o=[...i].map(([t,i])=>{let o=Z(`pbs-pick`),s=i.map(s=>{let c=e.items[s],l=r===void 0?void 0:Y(`input`,{type:e.pickMode===`multi`?`checkbox`:`radio`,name:o,value:c.name,checked:this.#e.has(s),required:t!==void 0,"aria-label":`${r}: ${ve(c)}`});return l&&r!==void 0&&this.#a.set(s,{control:l,label:t===void 0?r:`${r}: ${t}`}),t!==void 0&&l&&!a.has(t)&&a.set(t,l),l?.addEventListener(`change`,()=>{if(e.pickMode!==`multi`)for(let e of i)this.#e.delete(e);l.checked?this.#e.add(s):this.#e.delete(s)}),this.item(c,s,l&&Y(`label`,{part:`pick`,class:`pick`},l,r),n)}),c=Y(`div`,{part:`items`,class:`review-grid`,"data-columns":e.columns?Math.min(6,Math.max(1,Math.floor(e.columns))):null},s);return t===void 0?c:Y(`fieldset`,{part:`group`,class:`question`},Y(`legend`,{class:`heading`},t),c)}),{row:s,status:c}=xa(e.submit?w(e.submit):this.t(`send`));return wa(()=>{let t=e.items.map(ve),r=[[`title`,e.title?w(e.title):this.t(`reviewFallback`)]];for(let[e,n]of i){let i=n.filter(e=>this.#e.has(e));if(e!==void 0&&i.length===0){c.textContent=this.t(`unanswered`)+e,a.get(e)?.focus();return}for(let n of i)r.push([xe(e),t[n]])}n.forEach((e,n)=>{e.trim()&&r.push([`item`,t[n]],[`comment`,e.trim()])});let o=t.filter((e,t)=>!n[t].trim());o.length>0&&r.push([`silent`,o.join(`, `)]),r.push(...Ca(this.#n)),this.answer({kind:`review`,...e.title?{title:w(e.title)}:{},fields:r})&&(c.textContent=this.t(`sent`))},{part:`review`,class:`panel form-panel review`},t,o,Sa(this.t(`otherComments`),this.#n,e=>{this.#n=e}),s)}item(e,t,n,r){let i=ve(e),a=Y(`div`,{class:`head`},Y(`span`,{part:`item-title`,class:`heading`},X(i)));n&&a.append(n);let o=[],s=Qi();if(e.image&&o.push(this.image(e.image,i,t,s.imageUrl(e.image),r)),e.page){let t=s.pageUrl?.(e.page);o.push(t?Y(`iframe`,{part:`frame`,src:t,title:i,sandbox:`allow-scripts`,height:e.height??480,loading:`lazy`}):Y(`p`,{class:`muted`},this.t(`pageUnavailable`),Y(`code`,null,e.page)))}let c=Y(`textarea`,{part:`comment`,"aria-label":`${i}: ${this.t(`feedbackNote`)}`,placeholder:this.t(`feedbackNote`),value:r[t]});return c.addEventListener(`input`,()=>{r[t]=c.value}),this.#i[t]=c,Y(`article`,{part:`item`,class:`panel item`,"data-picked":this.#e.has(t)},a,o.length>0&&Y(`div`,{part:`media`,class:`media`},o),e.body&&Y(`div`,{part:`body`,class:`copy`},la(e.body)),c)}image(e,t,n,r,i){let a=()=>Y(`p`,{part:`unavailable`,class:`muted`},`${this.t(`imageUnavailable`)}: `,Y(`code`,null,e));if(r===void 0)return a();let o=Y(`div`,{class:`media`}),s=Y(`img`,{part:`image`,src:r,alt:t,loading:`lazy`}),c=Y(`button`,{type:`button`,part:`enlarge`,class:`btn quiet`},this.t(`enlarge`)),l={index:n,url:r,name:t,opener:c};return this.#r.push(l),c.addEventListener(`click`,()=>this.lightbox(l,i)),s.addEventListener(`error`,()=>{this.#r=this.#r.filter(e=>e!==l),o.replaceChildren(a())}),o.append(s,c),o}lightbox(e,t){let n=e,r=Y(`img`,{part:`lightbox-image`}),i=Y(`span`,{part:`lightbox-title`,class:`heading`}),a=Y(`span`,{part:`position`,class:`muted`}),o=Y(`button`,{type:`button`,part:`previous`,class:`btn quiet`},`‹ ${this.t(`previousImage`)}`),s=Y(`button`,{type:`button`,part:`next`,class:`btn quiet`},`${this.t(`nextImage`)} ›`),c=Y(`textarea`,{part:`lightbox-comment`,placeholder:this.t(`feedbackNote`)}),l=()=>this.#a.get(n.index),u=l(),d=u&&Y(`input`,{type:u.control.type}),f=document.createTextNode(``),p=()=>{let e=l();d&&e&&(d.checked=e.control.checked,f.data=e.label,d.setAttribute(`aria-label`,`${e.label}: ${n.name}`))};d?.addEventListener(`change`,()=>{let e=l();e&&e.control.checked!==d.checked&&e.control.click()});let m=Y(`button`,{type:`button`,part:`close`,class:`btn`},this.t(`close`)),h=Y(`dialog`,{part:`lightbox`},Y(`div`,{class:`lightbox`},Y(`div`,{class:`stage`},r),Y(`div`,{class:`side`},Y(`div`,{class:`head`},i,a),Y(`div`,{part:`nav`,class:`nav`},o,s),d&&Y(`label`,{part:`lightbox-pick`,class:`pick`},d,f),c,m))),g=e=>{n=e,p();let l=this.#r;r.src=e.url,r.alt=e.name,h.setAttribute(`aria-label`,e.name),i.replaceChildren(...X(e.name)),a.textContent=this.t(`imagePosition`,{n:l.indexOf(e)+1,total:l.length}),o.hidden=s.hidden=l.length<2,c.value=t[e.index]??``,c.setAttribute(`aria-label`,`${e.name}: ${this.t(`feedbackNote`)}`)},_=e=>{let t=this.#r;if(t.length===0)return;let r=Math.max(0,t.indexOf(n));g(t[(r+e+t.length)%t.length])},v=()=>h.close();c.addEventListener(`input`,()=>{t[n.index]=c.value;let e=this.#i[n.index];e&&(e.value=c.value)}),o.addEventListener(`click`,()=>_(-1)),s.addEventListener(`click`,()=>_(1)),m.addEventListener(`click`,v),h.addEventListener(`keydown`,e=>{e.target===c||e.altKey||e.ctrlKey||e.metaKey||(d&&e.target===d?e.key===`Enter`&&(e.preventDefault(),e.repeat||d.click()):(e.key===`ArrowLeft`||e.key===`ArrowRight`)&&(e.preventDefault(),_(e.key===`ArrowLeft`?-1:1)))}),h.addEventListener(`click`,e=>{e.target===h&&v()});let y=e.opener.closest(`.review`);d&&y?.addEventListener(`change`,p),h.addEventListener(`close`,()=>{y?.removeEventListener(`change`,p),h.remove(),(n.opener.isConnected?n.opener:e.opener).focus()}),g(e),(y??e.opener.parentNode)?.append(h),h.showModal(),(s.hidden?c:s).focus()}sentView(e){let t=this.answered??[],n=e=>t.filter(([t])=>t===e).map(([,e])=>e),r=n(`item`),i=n(`comment`),[a]=n(`silent`),[o]=n(fe),s=(e,t)=>Y(`div`,null,Y(`dt`,null,e),Y(`dd`,null,t));return Y(`section`,{part:`review`,class:`panel form-panel review`},Y(`div`,{class:`sent-head`},e,Ea(this.t(`submitted`))),Y(`dl`,{part:`sent`,class:`sent`},Ce(t).map(({group:e,value:t})=>s(e??this.t(`picked`),t)),r.map((e,t)=>s(e,i[t]??``)),a&&s(this.t(`noFeedback`),a),o&&s(this.t(`otherComments`),o)))}};function _o(){$(`pbs-review`,go)}var vo=`
|
|
414
424
|
.table { padding: 0; overflow: hidden; }
|
|
415
425
|
.table .bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 1rem; padding: var(--_pad-s) var(--_pad); }
|
|
416
426
|
.table .bar input { max-width: 20rem; flex: 1 1 10rem; }
|
|
@@ -427,7 +437,7 @@ th .sort:focus-visible { outline: 2px solid var(--_accent); outline-offset: 2px;
|
|
|
427
437
|
th .arrow { color: var(--_muted); font-size: 0.75em; }
|
|
428
438
|
th[aria-sort="ascending"] .arrow, th[aria-sort="descending"] .arrow { color: var(--_accent); }
|
|
429
439
|
td.empty { text-align: center; color: var(--_muted); }
|
|
430
|
-
`,
|
|
440
|
+
`,yo=e=>{if(typeof e==`number`)return e;let t=String(e).replace(/[,\s%$€£¥]/g,``);return t===``?NaN:Number(t)},bo=new Intl.Collator(void 0,{numeric:!0,sensitivity:`base`});function xo(e,t,n){if(n===`number`){let[n,r]=[yo(e),yo(t)];if(!Number.isNaN(n)&&!Number.isNaN(r))return n-r}else if(n===`date`){let[n,r]=[Date.parse(String(e)),Date.parse(String(t))];if(!Number.isNaN(n)&&!Number.isNaN(r))return n-r}return bo.compare(String(e),String(t))}var So=e=>e===null||e===``;function Co(e,t){let n=t.filter.trim().toLowerCase(),r=n?e.rows.filter(e=>e.some(e=>da(e).toLowerCase().includes(n))):[...e.rows],i=t.sort;if(!i)return r;let a=e.columns[i.column].type,o=i.direction===`asc`?1:-1;return r.map((e,t)=>({row:e,index:t})).sort((e,t)=>{let[n,r]=[e.row[i.column]??null,t.row[i.column]??null];return So(n)||So(r)?Number(So(n))-Number(So(r))||e.index-t.index:o*xo(n,r,a)||e.index-t.index}).map(({row:e})=>e)}var wo=class extends Q{static css=vo;#e;reset(){this.#e=void 0}view(e){this.#e??={sort:e.sort?{...e.sort}:void 0,filter:``};let t=this.#e,n=Y(`span`,{part:`count`,class:`status`,role:`status`,"aria-live":`polite`}),r=Y(`tbody`,{part:`body`}),i=e.columns.map((e,n)=>{let r=Y(`span`,{class:`arrow`,"aria-hidden":`true`}),i=Y(`button`,{type:`button`,part:`sort`,class:`sort`,"aria-label":this.t(`sortBy`,{label:e.label})},e.label,r),o=Y(`th`,{part:`head`,scope:`col`,"data-align":e.align},i);return i.addEventListener(`click`,()=>{let e=t.sort?.column===n?t.sort.direction:void 0;t.sort=e===void 0?{column:n,direction:`asc`}:e===`asc`?{column:n,direction:`desc`}:void 0,a(),i.focus()}),{head:o,arrow:r}}),a=()=>{i.forEach(({head:e,arrow:n},r)=>{let i=t.sort?.column===r?t.sort.direction:void 0;e.setAttribute(`aria-sort`,i===`asc`?`ascending`:i===`desc`?`descending`:`none`),n.textContent=i===`asc`?`▲`:i===`desc`?`▼`:`↕`});let a=Co(e,t);r.replaceChildren(...a.length===0?[Y(`tr`,null,Y(`td`,{part:`empty`,class:`empty`,colspan:e.columns.length},this.t(`noRows`)))]:a.map(t=>Y(`tr`,{part:`row`},e.columns.map((e,n)=>Y(`td`,{part:`cell`,"data-align":e.align},this.cellText(t[n]??null)))))),n.textContent=this.t(`rowCount`,{n:a.length,total:e.rows.length})},o;if(e.filter){let e=Y(`input`,{type:`search`,part:`filter`,id:Z(`pbs-filter`),"aria-label":this.t(`filter`),placeholder:this.t(`filter`),value:t.filter});e.addEventListener(`input`,()=>{t.filter=e.value,a()}),o=e}return a(),Y(`section`,{part:`table`,class:`panel table`},(o||e.rows.length>0)&&Y(`div`,{part:`bar`,class:`bar`},o,n),Y(`div`,{part:`scroll`,class:`scroll`,tabindex:`0`,role:`region`,"aria-label":this.t(`table`)},Y(`table`,null,Y(`thead`,{part:`header`},Y(`tr`,null,i.map(({head:e})=>e))),r)))}cellText(e){return typeof e==`boolean`?this.t(e?`yes`:`no`):da(e)}};function To(){$(`pbs-table`,wo)}var Eo=`
|
|
431
441
|
.treeview { padding: 0; overflow: hidden; }
|
|
432
442
|
.treeview .bar { display: flex; flex-wrap: wrap; gap: 0.25rem 0.5rem; padding: var(--_pad-s) var(--_pad); border-bottom: 1px solid var(--_line); background: var(--_surface); }
|
|
433
443
|
.treeview .bar .btn { padding: 0.15em 0.7em; font-size: 0.9em; }
|
|
@@ -454,5 +464,5 @@ td.empty { text-align: center; color: var(--_muted); }
|
|
|
454
464
|
.treeview li[data-tags~="removed"] > .node .name { color: var(--_muted); text-decoration: line-through; }
|
|
455
465
|
.treeview li[data-tags~="focus"] > .node { background: color-mix(in srgb, var(--_accent) 10%, transparent); }
|
|
456
466
|
.treeview li[data-tags~="risk"] > .node .name { color: var(--_risk); }
|
|
457
|
-
`,
|
|
458
|
-
`;if(e.type===`code`){let t="`".repeat(Math.max(0,...(e.text.match(/`+/g)??[]).map(e=>e.length))+1);return`${t}${/^`|`$/.test(e.text)?` ${e.text} `:e.text}${t}`}let t=
|
|
467
|
+
`,Do=2,Oo=e=>e.children.reduce((e,t)=>e+(t.more??1),0),ko=class extends Q{static css=Eo;#e=new Map;reset(){this.#e=new Map}view(e){let t=[],n,r=(e,n,a,s,c,u)=>{let d={name:Z(`pbs-tree`),note:Z(`pbs-tree`)},f=Y(`span`,{part:`toggle`,class:`toggle`,"aria-hidden":`true`}),p=[],m=[f];e.more===void 0?(m.push(Y(`span`,{part:`name`,class:`name`,id:d.name},e.name+(e.dir?`/`:``))),e.children.length>0&&m.push(Y(`span`,{part:`count`,class:`count`},this.t(`treeEntries`,{n:Oo(e)}))),e.tags.length>0&&m.push(Y(`span`,{part:`tags`,class:`tags`},e.tags.map(e=>{let t=Z(`pbs-tree`);return p.push(t),Y(`span`,{part:`tag`,class:`badge tag`,id:t,"data-tag":e},e)}))),e.note!==void 0&&m.push(Y(`span`,{part:`note`,class:`note`,id:d.note},X(e.note)))):m.push(Y(`span`,{part:`more`,class:`more`,id:d.name},e.name));let h=Y(`li`,{role:`treeitem`,part:`item`,tabindex:`-1`,"aria-labelledby":[d.name,...p,...e.note!==void 0&&e.more===void 0?[d.note]:[]].join(` `),"aria-level":a+1,"aria-setsize":u,"aria-posinset":c+1,"data-tags":e.tags.length>0?e.tags.join(` `):null},Y(`div`,{part:`node`,class:`node`},m)),g={node:e,path:n,element:h,group:void 0,toggle:f,parent:s,children:[],expanded:!1,tagged:e.tags.length>0};if(t.push(g),e.children.length>0){g.children=e.children.map((t,i)=>r(t,`${n}.${i}`,a+1,g,i,e.children.length)),g.group=Y(`ul`,{role:`group`,part:`group`},g.children.map(e=>e.element)),h.append(g.group);let t=g.children.some(e=>e.tagged);g.tagged||=t,g.expanded=this.#e.get(n)??(a<=Do||t)}return i(g),h.firstElementChild.addEventListener(`click`,()=>{o(g),l(g)}),g},i=e=>{let t=e.children.length>0;t&&e.element.setAttribute(`aria-expanded`,String(e.expanded)),e.group&&(e.group.hidden=!e.expanded),e.toggle.textContent=t?e.expanded?`▾`:`▸`:``},a=(e,t)=>{e.children.length!==0&&e.expanded!==t&&(e.expanded=t,this.#e.set(e.path,t),i(e))},o=e=>a(e,!e.expanded),s=()=>{let e=[],t=n=>{e.push(n),n.expanded&&n.children.forEach(t)};return t(f),e},c=e=>{for(let n of t)n.element.tabIndex=n===e?0:-1;n=e},l=e=>{c(e),e.element.focus()},u=()=>{let e=new Set(s()),t=n;for(;t&&!e.has(t);)t=t.parent;c(t??f)},d=e=>{for(let n of t)a(n,n===f||e);u()},f=r(e.root,`0`,0,void 0,0,1);c(f);let p=Y(`ul`,{role:`tree`,part:`tree`,"aria-label":this.t(`tree`)},f.element);p.addEventListener(`focusin`,e=>{let n=t.find(t=>t.element===e.target);n&&c(n)}),p.addEventListener(`keydown`,e=>{let n=t.find(t=>t.element===e.target);if(!n||e.altKey||e.ctrlKey||e.metaKey)return;let r=s(),i=r.indexOf(n),c=!0;switch(e.key){case`ArrowDown`:l(r[Math.min(r.length-1,i+1)]);break;case`ArrowUp`:l(r[Math.max(0,i-1)]);break;case`Home`:l(r[0]);break;case`End`:l(r[r.length-1]);break;case`ArrowRight`:n.children.length>0&&!n.expanded?a(n,!0):n.children.length>0&&l(n.children[0]);break;case`ArrowLeft`:n.children.length>0&&n.expanded?a(n,!1):n.parent&&l(n.parent);break;case`Enter`:case` `:o(n);break;default:c=!1}c&&e.preventDefault()});let m=(e,t,n)=>{let r=Y(`button`,{type:`button`,part:e,class:`btn quiet`},t);return r.addEventListener(`click`,n),r};return Y(`div`,{part:`treeview`,class:`panel treeview`},e.root.children.length>0?Y(`div`,{part:`bar`,class:`bar`},m(`expand-all`,this.t(`treeExpandAll`),()=>d(!0)),m(`collapse-all`,this.t(`treeCollapseAll`),()=>d(!1))):null,Y(`div`,{class:`body`},p))}};function Ao(){$(`pbs-tree`,ko)}var jo={alert:`pbs-callout`,cards:`pbs-cards`,options:`pbs-options`,form:`pbs-form`,review:`pbs-review`,mindmap:`pbs-mindmap`,suggest:`pbs-suggest`,checklist:`pbs-checklist`,table:`pbs-table`,steps:`pbs-steps`,stats:`pbs-stats`,diff:`pbs-diff`,mermaid:`pbs-diagram`,tree:`pbs-tree`};function Mo(){no(),Aa(),co(),_o(),mo(),To(),Ao()}Mo();var No=new Set;ea({imageUrl:e=>No.has(e)?e:void 0});var Po=e=>e.replace(/[!-/:-@[-`{-~]/g,`\\$&`),Fo=e=>e.some(e=>e.type===`link`||`children`in e&&Fo(e.children)),Io=e=>e.map(e=>{if(e.type===`text`)return Po(e.text);if(e.type===`br`)return`
|
|
468
|
+
`;if(e.type===`code`){let t="`".repeat(Math.max(0,...(e.text.match(/`+/g)??[]).map(e=>e.length))+1);return`${t}${/^`|`$/.test(e.text)?` ${e.text} `:e.text}${t}`}let t=Io(e.children);return e.type===`strong`?`**${t}**`:e.type===`em`?`*${t}*`:t}).join(``),Lo=e=>{let t=e.note===void 0?[]:f(e.note);return{...e,...Fo(t)?{note:Io(t)}:{},children:e.children.map(Lo)}};function Ro(e,t){return e.kind===`tree`?{root:Lo(e.data.root)}:e.kind===`suggest`?{...e.data,items:e.data.items.map(e=>w(e.label)===e.text?e:{...e,label:Po(e.text)})}:e.kind===`review`?{...e.data,items:e.data.items.map(({image:e,...n})=>{let r=e===void 0?void 0:t.image?.(e);return r!==void 0&&No.add(r),r===void 0?n:{...n,image:r}})}:e.data}var zo=/^[A-Za-z0-9_.-]{1,40}$/;function Bo(e,t){let n=(e,t=e)=>w(t)!==e;return e.kind===`review`?e.data.items.some(e=>n(ve(e))):e.kind===`checklist`?e.data.items.some(e=>n(e.name,e.label)):e.kind===`form`&&e.data.questions.some(e=>n(e.name,e.label)&&!zo.test(e.name)||e.choices.some(r=>n(r.value,r.label)&&t.some(([t,n])=>t===e.name&&n.includes(r.value))))}var Vo=new Set(wi);function Ho(e,r,i){let f=document.createElement(jo[e.kind]),p=n(...r.scope??[]),m=e.index,h=a(`p`,{class:`pbs-note`,role:`status`,"aria-live":`polite`}),g=a(`div`,{class:`pbs-block`,"data-kind":e.kind},f,h);f.setAttribute(`density`,r.density),f.ref=r.doc===void 0?{block:m}:{doc:r.doc,block:m},f.data=Ro(e,r);let _=!1,v,y=()=>(v?.remove(),v=void 0),b=(e,t)=>(h.textContent=e,t?h.dataset.tone=t:delete h.dataset.tone),x=()=>Vo.has(e.kind)&&p.get(m).state===`open`?r.away?.why():void 0,S=()=>i||!Vo.has(e.kind)?``:d(),ee,C={show(e){g.toggleAttribute(`inert`,e.state===`pending`),e.state!==`open`&&y(),e.state===`done`&&(f.answered=e.fields),e.state===`pending`?b(u()):!_&&(e.state===`done`||h.textContent===u())&&b(e.state===`open`&&!i?d():``),C.refresh()},gate:x,refresh(){let e=x();o(g,()=>f.toggleAttribute(`inert`,e!==void 0)),g.toggleAttribute(`data-away`,e!==void 0),e===void 0?ee!==void 0&&p.get(m).state===`open`&&b(S()):(y(),b(e)),ee=e}};p.watch(m,C),r.away?.watch(C),b(S()),C.show(p.get(m));let w=(e,n)=>{_=!0,p.pend(m),r.send(e,n).catch(()=>({ok:!1,reason:t()})).then(t=>{if(_=!1,t.ok)return p.done(m,e.fields);t.answered?p.done(m,t.answered):p.cancel(m),b(t.reason,t.answered?void 0:`error`)})},te=(e,t)=>{y(),b(``);let n=a(`button`,{type:`button`,class:`pbs-confirm-send`},c()),r=a(`button`,{type:`button`,class:`pbs-confirm-back`},s()),i=v=a(`div`,{class:`pbs-confirm`,role:`group`,"aria-label":l()},a(`p`,{class:`pbs-confirm-title`},l()),a(`pre`,{class:`pbs-confirm-text`},t),a(`div`,{class:`pbs-confirm-row`},n,r));n.addEventListener(`click`,()=>{v===i&&(y(),w(e,t))}),r.addEventListener(`click`,()=>v===i&&y()),i.addEventListener(`keydown`,e=>e.key===`Escape`&&v===i&&y()),g.insertBefore(i,h),n.focus()};return f.addEventListener(`pbs-answer`,t=>{if(!Vo.has(e.kind))return;let n=t.detail,r={...n,ref:{...n.ref,block:m}};if(t.preventDefault(),_||p.get(m).state!==`open`||C.gate())return;let i=Ne(r);Bo(e,r.fields)?te(r,i):w(r,i)}),g}var Uo=e=>a(`pre`,{class:`pbs-invalid`,title:`${e.kind}: ${e.error}`},a(`code`,{"data-lang":e.kind},e.source));function Wo(e,t,n,a=!0){e.replaceChildren(...Gi(t).map(e=>e.type===`markdown`?r(i(e.text)):e.type===`invalid`?Uo(e):Ho(e,n,a)))}export{Wo as drawBlocks};
|