living-ai-documentation 3.63.0 → 3.64.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/dist/frontend-svelte/assets/{index-D2wjvyol.js → index-UxlGnaKR.js} +78 -78
- package/dist/frontend-svelte/assets/index-yzafamUK.css +1 -0
- package/dist/frontend-svelte/assets/{main-BC6pYW7Q.js → main-CRJRAz1a.js} +1 -1
- package/dist/frontend-svelte/i18n/en.json +11 -0
- package/dist/frontend-svelte/i18n/fr.json +11 -0
- package/dist/frontend-svelte/index.html +2 -2
- package/dist/src/lib/folderManifest.d.ts +2 -0
- package/dist/src/lib/folderManifest.d.ts.map +1 -1
- package/dist/src/lib/folderManifest.js +8 -0
- package/dist/src/lib/folderManifest.js.map +1 -1
- package/dist/src/lib/folderTree.d.ts +2 -0
- package/dist/src/lib/folderTree.d.ts.map +1 -1
- package/dist/src/lib/folderTree.js +18 -3
- package/dist/src/lib/folderTree.js.map +1 -1
- package/dist/src/lib/linkRewrite.d.ts +23 -0
- package/dist/src/lib/linkRewrite.d.ts.map +1 -0
- package/dist/src/lib/linkRewrite.js +206 -0
- package/dist/src/lib/linkRewrite.js.map +1 -0
- package/dist/src/lib/prefixMigration.d.ts +0 -5
- package/dist/src/lib/prefixMigration.d.ts.map +1 -1
- package/dist/src/lib/prefixMigration.js +4 -141
- package/dist/src/lib/prefixMigration.js.map +1 -1
- package/dist/src/lib/treeMove.d.ts +8 -0
- package/dist/src/lib/treeMove.d.ts.map +1 -1
- package/dist/src/lib/treeMove.js +85 -10
- package/dist/src/lib/treeMove.js.map +1 -1
- package/dist/src/routes/documents.d.ts.map +1 -1
- package/dist/src/routes/documents.js +26 -1
- package/dist/src/routes/documents.js.map +1 -1
- package/dist/src/routes/tree.d.ts.map +1 -1
- package/dist/src/routes/tree.js +16 -0
- package/dist/src/routes/tree.js.map +1 -1
- package/package.json +1 -1
- package/dist/frontend-svelte/assets/index-DULs2DiT.css +0 -1
|
@@ -88,7 +88,7 @@ Texte`};case`link`:return{text:ut(`snip-link-text`),textFallback:Y(`snippet.link
|
|
|
88
88
|
|
|
89
89
|
`,t+1);return n>=0?n:e.length}s=s.previousElementSibling}let c=a.nextElementSibling;for(;c;){let t=Pf(e,c,r);if(t!==null){let n=e.lastIndexOf(`
|
|
90
90
|
|
|
91
|
-
`,t);return n>=0?n:0}c=c.nextElementSibling}return e.length}function If(e,t,n){if(!e||typeof t!=`string`)return()=>{};let r=Tf(t);Df(e,r);let i=i=>{let a=i.target?.closest(`[data-inline-snippet-index]`);if(a&&e.contains(a)){let e=r[Number(a.dataset.inlineSnippetIndex)];if(!e)return;i.preventDefault();let t=mf(e.type),o=gf(e.type);kf(i,[{iconClass:t.iconClass,labelKey:t.labelKey,dataAction:`edit`,dataType:e.type,onActivate:()=>n.onEdit(e)},{iconClass:o.iconClass,labelKey:o.labelKey,dataAction:`delete`,dataType:e.type,onActivate:()=>n.onDelete(e)}]);return}if(!e.contains(i.target))return;let o=Ff(t,e,i.target,r,i.clientY);o!==null&&(i.preventDefault(),kf(i,{iconClass:`fa-solid fa-plus`,labelKey:`snippet.inline_insert_btn`,dataAction:`insert`,onActivate:()=>n.onInsert(o)}))};e.addEventListener(`contextmenu`,i);let a=t=>{let i=t.target?.closest(`[data-inline-snippet-index]`);if(!i||!e.contains(i))return;let a=r[Number(i.dataset.inlineSnippetIndex)];a?.type===`table`&&(t.preventDefault(),t.stopPropagation(),Of(),n.onEdit({...a,tableFocusCell:jf(t.target,i)||void 0}))};e.addEventListener(`dblclick`,a);let o=e.closest(`#home-content-area`)||e.closest(`main`),s=null;o&&(s=r=>{r.defaultPrevented||e.offsetParent!==null&&(r.target?.closest(`textarea, input, [data-inline-snippet-index]`)||e.contains(r.target)||(r.preventDefault(),kf(r,{iconClass:`fa-solid fa-plus`,labelKey:`snippet.inline_insert_btn`,dataAction:`insert`,onActivate:()=>n.onInsert(t.length)})))},o.addEventListener(`contextmenu`,s));let c=e=>{vf&&!vf.contains(e.target)&&Of()},l=e=>{e.key===`Escape`&&Of()};return document.addEventListener(`click`,c),document.addEventListener(`keydown`,l),()=>{e.removeEventListener(`contextmenu`,i),e.removeEventListener(`dblclick`,a),o&&s&&o.removeEventListener(`contextmenu`,s),document.removeEventListener(`click`,c),document.removeEventListener(`keydown`,l),Of(),e.querySelectorAll(`[data-inline-snippet-index]`).forEach(e=>{e.removeAttribute(`data-inline-snippet-index`),e.classList.remove(`ld-inline-snippet-target`)})}}var Lf=200*1024*1024,Rf=Math.round(Lf/1024/1024);Math.ceil(Lf*1.4);var zf=U(`<textarea id="doc-editor" data-testid="doc-editor" spellcheck="false" class="w-full min-h-[70vh] px-4 py-3 text-sm font-mono leading-relaxed rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-y"></textarea>`),Bf=U(`<div id="doc-content" data-testid="doc-content"></div>`),Vf=U(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50"><div class="bg-white dark:bg-gray-900 rounded-xl shadow-xl w-full max-w-sm mx-4 p-6 space-y-5"><h3 class="text-base font-semibold text-gray-900 dark:text-gray-50"> </h3> <div class="space-y-1.5"><label for="img-paste-name" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> <span class="font-normal text-gray-400"> </span></label> <div class="flex items-center gap-2"><input id="img-paste-name" type="text" class="flex-1 px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono focus:outline-none focus:ring-2 focus:ring-blue-500"/> <span class="text-xs text-gray-400 shrink-0"> </span></div></div> <div class="flex justify-end gap-3 pt-1"><button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div></div></div>`),Hf=U(`<div data-testid="content-lightbox" class="fixed inset-0 z-50 bg-white flex items-center justify-center cursor-pointer p-4"><img data-testid="lightbox-image" class="max-w-full max-h-full object-contain select-none"/> <button class="absolute top-4 right-4 text-gray-500 hover:text-gray-950 text-2xl leading-none">×</button></div>`),Uf=U(`<!> <!> <!> <!>`,1);function Wf(e,t){qe(t,!0);let n=qi(t,`onopen`,3,()=>{}),r=qi(t,`onanchor`,3,D),i=qi(t,`onconfirmdelete`,3,void 0),a=qi(t,`oncontentwired`,3,void 0),o=qi(t,`rewireSignal`,3,void 0),s=qi(t,`editing`,15,!1),c=qi(t,`saveMsg`,15,null),l=P(null),u=P(null),d=P(``),f=null,p=P(!1),m=P(`insert`),h=P(null),g=P(0),_=P(!1),v=P(``),y=P(`png`),b=null,x=0,S=0,C=P(null),w=P(``),T=/[̀-ͯ]/g;function E(e){return(e||``).normalize(`NFD`).replace(T,``).toLowerCase().replace(/[^a-z0-9]/g,`_`)}function D(e){document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`start`})}Ji(()=>{let e=window;return e.openSnippetsModal=()=>{F(m,`insert`),F(p,!0)},e.openSnippetsModalForInlineInsert=e=>{F(m,`inline-insert`),F(g,Math.max(0,Number(e)||0),!0),F(p,!0)},()=>{delete e.openSnippetsModal,delete e.openSnippetsModalForInlineInsert}}),kn(()=>{if(o(),t.html,t.content,f?.(),f=null,!(s()||!V(l)))return yd(V(l),t.html,{content:t.content,codeBlockMaxHeight:X.codeBlockMaxHeight,t:Y,onDocLink:(e,t)=>n()(e,t),onAnchor:r(),docId:t.docId,docs:X.allDocs,docsFolder:X.docsFolder,folderPaths:X.allFolderPaths,onKanbanDocsChange:e=>{X.allDocs=e},onKanbanFolderPathsChange:e=>{X.allFolderPaths=e}})||(f=If(V(l),t.content,{onEdit:e=>{F(m,`inline-edit`),F(h,e,!0),F(p,!0)},onInsert:e=>{F(m,`inline-insert`),F(g,e,!0),F(p,!0)},onDelete:async e=>{(i()?await i()():confirm(Y(`snippet.inline_delete_message`)))&&await t.onsave(t.content.slice(0,e.start)+t.content.slice(e.end))}})),a()?.(V(l)),()=>{f?.(),f=null}});function ee(){F(d,t.content,!0),s(!0),c(null),requestAnimationFrame(()=>V(u)?.focus())}function te(){s(!1),c(null)}async function O(){c({text:Y(`doc.saving`),cls:`text-gray-400`});try{await t.onsave(V(d)),s(!1),c(null)}catch(e){c({text:Y(`error.save`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`})}}function ne(){F(m,`insert`),F(p,!0)}function k(){let e=Gu(t.content);e&&(F(m,`inline-edit`),F(h,e,!0),F(p,!0))}function A(){return s()}function re(e){let t=Array.from(e.clipboardData?.items??[]).find(e=>e.type.startsWith(`image/`));if(t){e.preventDefault(),x=V(u).selectionStart,S=V(u).selectionEnd,F(y,t.type.split(`/`)[1].replace(`jpeg`,`jpg`)||`png`,!0);let n=t.getAsFile();if(!n)return;b=n,F(v,E(Date.now().toString()),!0),F(_,!0);return}let n=Array.from(e.clipboardData?.files??[]).filter(e=>!e.type.startsWith(`image/`));if(n.length){e.preventDefault();let t=V(u).selectionStart,r=V(u).selectionEnd;(async()=>{for(let e of n)await le(e,t,r)})()}}function ie(e){let t=Array.from(e.dataTransfer?.files??[]).filter(e=>!e.type.startsWith(`image/`));if(!t.length)return;e.preventDefault(),e.stopPropagation();let n=V(u).selectionStart,r=V(u).selectionEnd;(async()=>{for(let e of t)await le(e,n,r)})()}function ae(e){e.dataTransfer?.types?.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)}function oe(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=n,r.readAsDataURL(e)})}function se(e,t,n){let r=V(d).slice(0,t),i=V(d).slice(n);F(d,r+e+i),requestAnimationFrame(()=>{V(u).selectionStart=V(u).selectionEnd=t+e.length,V(u).focus()})}let ce=Lf;async function le(e,n,r){if(e.size>ce){c({text:Y(`doc.file_too_large`)+` (${(e.size/1024/1024).toFixed(1)} MB, max ${Rf} MB)`,cls:`text-red-500 dark:text-red-400`});return}c({text:Y(`doc.uploading_file`),cls:`text-gray-400`});try{let i=await oe(e),a=await fetch(`/api/files/upload`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:i,name:e.name,documentId:t.docId})});if(!a.ok){let e=``;try{e=(await a.json()).error||``}catch{e=await a.text()}throw Error(e||`HTTP ${a.status}`)}let{url:o,originalName:s}=await a.json();se(`[📎 ${s||e.name}](${o})`,n,r),c(null)}catch(e){c({text:Y(`doc.file_upload_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`})}}function ue(){F(_,!1),b=null}async function de(){let e=E(V(v))||Date.now().toString();if(F(_,!1),b){c({text:Y(`doc.uploading_image`),cls:`text-gray-400`});try{let t=await oe(b),n=await fetch(`/api/images/upload`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:t,ext:V(y),name:e})});if(!n.ok)throw Error(await n.text());let{filename:r}=await n.json();se(``,x,S),c(null)}catch(e){c({text:Y(`doc.image_upload_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`})}finally{b=null}}}function fe(){F(C,null),F(w,``)}function pe(e){if(!e.shiftKey&&!e.metaKey)return;let t=e.target,n=t.closest(`img`),r=t.closest(`.mermaid`)?.querySelector(`svg`);if(!n&&!r)return;if(e.preventDefault(),e.stopPropagation(),n){F(C,n.src,!0),F(w,n.alt||``,!0);return}let i=new XMLSerializer().serializeToString(r);F(C,`data:image/svg+xml;charset=utf-8,${encodeURIComponent(i)}`),F(w,Y(`doc.mermaid_diagram_alt`),!0)}function me(e){e.key===`Escape`&&V(C)&&fe()}var he={enterEdit:ee,cancelEdit:te,save:O,openSnippets:ne,openKanbanColumnsEditor:k,isEditing:A},ge=Uf();Nr(`keydown`,on,me);var _e=R(ge),ve=e=>{var t=zf();yn(t),Ui(t,e=>F(u,e),()=>V(u)),Nr(`paste`,t,re),Nr(`drop`,t,ie),Nr(`dragover`,t,ae),Fi(t,()=>V(d),e=>F(d,e)),W(e,t)},ye=e=>{var t=Bf();Ui(t,e=>F(l,e),()=>V(l)),B(()=>vi(t,1,`prose prose-gray dark:prose-invert max-w-none prose-headings:scroll-mt-4 prose-headings:font-semibold prose-h1:text-[2.1875rem] prose-h2:text-[1.8125rem] prose-h3:text-[1.5rem] prose-h4:text-[1.25rem] prose-a:text-blue-600 dark:prose-a:text-blue-400 prose-code:before:content-none prose-code:after:content-none ${X.codeBlockLightTheme?`prose-pre:bg-[#f6f8fa] prose-pre:text-gray-800 prose-pre:border prose-pre:border-gray-200 prose-pre:rounded-lg dark:prose-pre:bg-[#0d1117] dark:prose-pre:text-gray-100 dark:prose-pre:border-gray-700`:`prose-pre:bg-[#0d1117] prose-pre:border prose-pre:border-gray-700`} ${X.imageRoundedCorners?`[&_img]:rounded-xl`:``} ${X.imageCentered?`[&_img]:mx-auto [&_img]:block`:``} ${X.imageBorder?`[&_img]:[box-shadow:0_0_0_1px_rgba(0,0,0,0.10),0_4px_12px_rgba(0,0,0,0.04)] dark:[&_img]:[box-shadow:0_0_0_1px_rgba(255,255,255,0.08),0_4px_12px_rgba(255,255,255,0.25)]`:``}`)),H(`click`,t,pe),W(e,t)};K(_e,e=>{s()?e(ve):e(ye,-1)});var be=z(_e,2);df(be,{get open(){return V(p)},get editor(){return V(u)},get mode(){return V(m)},get docId(){return t.docId},get content(){return t.content},get range(){return V(h)},get insertPos(){return V(g)},get onsave(){return t.onsave},onclose:()=>F(p,!1)});var xe=z(be,2),Se=e=>{var t=Vf(),n=L(t),r=L(n),i=L(r);j(r);var a=z(r,2),o=L(a),s=L(o),c=z(s),l=L(c,!0);j(c),j(o);var u=z(o,2),d=L(u);ki(d);var f=z(d,2),p=L(f);j(f),j(u),j(a);var m=z(a,2),h=L(m),g=L(h,!0);j(h);var _=z(h,2),b=L(_,!0);j(_),j(m),j(n),j(t),B((e,t,n,r,a)=>{G(i,`🖼️ ${e??``}`),G(s,`${t??``} `),G(l,n),Ai(d,V(v)),G(p,`.${V(y)??``}`),G(g,r),G(b,a)},[()=>Y(`modal.img_paste.title`),()=>Y(`modal.img_paste.filename_label`),()=>Y(`modal.img_paste.saved_hint`),()=>Y(`common.cancel`),()=>Y(`modal.img_paste.paste_btn`)]),H(`input`,d,e=>F(v,E(e.target.value),!0)),H(`click`,h,ue),H(`click`,_,de),W(e,t)};K(xe,e=>{V(_)&&e(Se)});var Ce=z(xe,2),we=e=>{var t=Hf(),n=L(t),r=z(n,2);j(t),B(()=>{J(n,`src`,V(C)),J(n,`alt`,V(w))}),H(`click`,t,fe),H(`click`,n,e=>e.stopPropagation()),H(`click`,r,fe),W(e,t)};return K(Ce,e=>{V(C)&&e(we)}),W(e,ge),Je(he)}Pr([`click`,`input`]);var Gf=U(`<span> </span> <code> </code>`,1),Kf=U(`<button type="button" data-testid="bp-copy-doc-id"><i aria-hidden="true"></i></button>`),qf=U(`<button class="bpadr-icon-btn" data-testid="bp-edit" type="button">✏️</button> <button class="bpadr-icon-btn" data-testid="bp-delete" type="button">🗑️</button>`,1),Jf=U(`<span> </span>`),Yf=U(`<footer class="bpadr-footer bpadr-doc-footer"><!> <button type="button" class="bpadr-btn-ghost" data-testid="bp-cancel"> </button> <button type="button" class="bpadr-btn-ghost" data-testid="bp-snippets"> </button> <button type="button" class="bpadr-btn-primary" data-testid="bp-save"> </button></footer>`),Xf=U(`<div class="bpadr-read"><!></div> <!>`,1),Zf=U(`<form class="bpadr-form"><input type="hidden" name="folder"/> <div class="bpadr-field"><label for="adr-title"> </label> <input id="adr-title" type="text" class="bpadr-input"/></div> <div class="bpadr-field bpadr-field-grow"><label for="adr-content"> </label> <textarea id="adr-content" class="bpadr-textarea"></textarea></div> <footer class="bpadr-footer"><button type="button" class="bpadr-btn-ghost"> </button> <button type="button" data-testid="bp-form-snippets" class="bpadr-btn-ghost"> </button> <button type="submit" class="bpadr-btn-primary"> </button></footer></form> <!>`,1),Qf=U(`<div class="bpadr-folder-confirm"><p></p> <p class="bpadr-muted"> </p> <footer class="bpadr-footer"><button type="button" class="bpadr-btn-ghost"> </button> <button type="button" class="bpadr-btn-primary"> </button></footer></div>`),$f=U(`<div class="bpadr-overlay"><div class="bpadr-modal"><header class="bpadr-header"><div class="bpadr-title-row"><h2 class="bpadr-title"><!></h2> <!></div> <div class="bpadr-header-actions"><!> <button class="bpadr-icon-btn" type="button" title="Close">×</button></div></header> <!></div></div>`),ep=U(`<div class="fixed inset-0 z-[60] flex items-center justify-center bg-black/50 p-4"><div class="w-full max-w-sm bg-white dark:bg-gray-900 border border-red-200 dark:border-red-700 rounded-xl shadow-2xl p-5 flex flex-col gap-3"><p class="text-sm text-gray-700 dark:text-gray-200"> </p> <p class="text-xs text-gray-500 dark:text-gray-400 italic truncate"> </p> <div class="flex justify-end gap-2 mt-2"><button type="button" data-testid="bp-delete-cancel" class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button type="button" data-testid="bp-delete-confirm" class="text-sm px-4 py-1.5 rounded-lg bg-red-500 hover:bg-red-600 text-white font-semibold transition-colors"> </button></div></div></div>`),tp=U(`<!> <!>`,1);function np(e,t){qe(t,!0);let n=qi(t,`onchanged`,3,()=>{}),r=`BLUEPRINT`;function i(e){return`/${(e.folder.path||e.folder.name).replace(/^\/+|\/+$/g,``)||e.folder.name}`}let a=P(`closed`),o=P(``),s=P(``),c=P(``),l=P(``),u=P(``),d=P(``),f=P(``),p=P(null),m=P(null),h=P(null),g=P(!1),_=P(null),v=P(null),y=P(!1),b=P(!1),x=P(!1);async function S(e){if(F(m,e,!0),F(p,null),F(g,!1),F(_,null),F(s,e.folder.name,!0),F(c,``),F(l,``),F(u,``),F(f,i(e),!0),F(o,Y(`blueprint.adr.new_title`,{folder:e.folder.name}),!0),F(a,`form`),!(await fetch(`/api/blueprint/blueprint-folder`).then(e=>e.json())).exists){F(d,r),F(a,`folder-confirm`);return}await w(e)}async function C(e){return fetch(`/api/documents/${encodeURIComponent(e)}`).then(e=>e.json())}async function w(e){let t=await fetch(`/api/blueprint/blueprint-adr?folder=${encodeURIComponent(e.folder.name)}`).then(e=>e.json());if(t.found&&t.doc){F(p,t.doc.id,!0);let e=await C(t.doc.id);F(s,e.title,!0),F(l,e.content,!0),F(u,e.html,!0),F(o,e.title,!0),F(g,!1),F(a,`doc`)}else F(s,e.folder.name,!0),F(c,``),F(a,`form`)}function T(){F(a,`closed`),F(g,!1),F(p,null),F(m,null),F(f,``),F(x,!1)}async function E(){if(V(p))try{await navigator.clipboard.writeText(decodeURIComponent(V(p))),F(x,!0),setTimeout(()=>F(x,!1),1800)}catch{}}async function D(){await fetch(`/api/blueprint/blueprint-folder`,{method:`POST`}),V(m)&&await w(V(m))}async function ee(e){if(!V(p))return;await fetch(`/api/documents/${encodeURIComponent(V(p))}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:V(s).trim()||V(m)?.folder.name||Y(`common.untitled`),folder:r,content:e})});let t=await C(V(p));F(o,t.title,!0),F(l,t.content,!0),F(u,t.html,!0)}async function te(e){e.preventDefault();let t={title:V(s).trim()||V(m)?.folder.name||Y(`common.untitled`),name:V(m)?.folder.name,folder:r},i=await fetch(`/api/documents/`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}).then(e=>e.json());F(p,i.id,!0);let c=await C(i.id);F(o,c.title,!0),F(l,c.content,!0),F(u,c.html,!0),F(g,!1),F(a,`doc`),n()()}async function O(){F(b,!1),V(p)&&(await fetch(`/api/documents/${encodeURIComponent(V(p))}`,{method:`DELETE`}),T(),n()())}var ne={open:S},k=tp(),A=R(k),re=e=>{var t=$f(),n=L(t),i=L(n),m=L(i),S=L(m),C=L(S),w=e=>{var t=Gf(),n=R(t),r=L(n,!0);j(n);var i=z(n,2),a=L(i,!0);j(i),B(e=>{G(r,e),G(a,V(f))},[()=>Y(`blueprint.adr.folder_title`)]),W(e,t)},O=e=>{var t=Ur();B(()=>G(t,V(o))),W(e,t)};K(C,e=>{V(f)?e(w):e(O,-1)}),j(S);var ne=z(S,2),k=e=>{var t=Kf(),n=L(t);j(t),B(e=>{J(t,`title`,e),vi(t,1,`bpadr-copy-btn ${V(x)?`copied`:``}`),vi(n,1,`fa-${V(x)?`solid fa-check`:`regular fa-copy`}`)},[()=>Y(`doc.copy_mcp_id`)]),H(`click`,t,E),W(e,t)};K(ne,e=>{V(p)&&e(k)}),j(m);var A=z(m,2),re=L(A),ie=e=>{var t=qf(),n=R(t),r=z(n,2);B((e,t)=>{J(n,`title`,e),J(r,`title`,t)},[()=>Y(`doc.edit`),()=>Y(`doc.delete`)]),H(`click`,n,()=>V(h).enterEdit()),H(`click`,r,()=>F(b,!0)),W(e,t)};K(re,e=>{V(a)===`doc`&&!V(g)&&e(ie)});var ae=z(re,2);j(A),j(i);var oe=z(i,2),se=e=>{var t=Xf(),n=R(t),r=L(n);{let e=N(()=>V(p)??``);Ui(Wf(r,{get docId(){return V(e)},get content(){return V(l)},get html(){return V(u)},onsave:ee,get editing(){return V(g)},set editing(e){F(g,e,!0)},get saveMsg(){return V(_)},set saveMsg(e){F(_,e,!0)}}),e=>F(h,e,!0),()=>V(h))}j(n);var i=z(n,2),a=e=>{var t=Yf(),n=L(t),r=e=>{var t=Jf(),n=L(t,!0);j(t),B(()=>{vi(t,1,`text-xs ${V(_).cls??``}`),G(n,V(_).text)}),W(e,t)};K(n,e=>{V(_)&&e(r)});var i=z(n,2),a=L(i,!0);j(i);var o=z(i,2),s=L(o,!0);j(o);var c=z(o,2),l=L(c,!0);j(c),j(t),B((e,t,n)=>{G(a,e),G(s,t),G(l,n)},[()=>Y(`common.cancel`),()=>Y(`doc.snippets_btn`),()=>Y(`common.save`)]),H(`click`,i,()=>V(h).cancelEdit()),H(`click`,o,()=>V(h).openSnippets()),H(`click`,c,()=>V(h).save()),W(e,t)};K(i,e=>{V(g)&&e(a)}),W(e,t)},ce=e=>{var t=Zf(),n=R(t),i=L(n);ki(i),Ai(i,r);var o=z(i,2),l=L(o),u=L(l,!0);j(l);var d=z(l,2);ki(d),j(o);var f=z(o,2),m=L(f),h=L(m,!0);j(m);var g=z(m,2);yn(g),Ui(g,e=>F(v,e),()=>V(v)),j(f);var _=z(f,2),b=L(_),x=L(b,!0);j(b);var S=z(b,2),C=L(S,!0);j(S);var w=z(S,2),E=L(w,!0);j(w),j(_),j(n),df(z(n,2),{get open(){return V(y)},get editor(){return V(v)},mode:`insert`,get content(){return V(c)},onclose:()=>F(y,!1)}),B((e,t,n,r,i)=>{G(u,e),G(h,t),G(x,n),G(C,r),G(E,i)},[()=>Y(`blueprint.adr.title_label`),()=>Y(`blueprint.adr.content_label`),()=>Y(`common.cancel`),()=>Y(`doc.snippets_btn`),()=>Y(`common.save`)]),Nr(`submit`,n,te),Fi(d,()=>V(s),e=>F(s,e)),Fi(g,()=>V(c),e=>F(c,e)),H(`click`,b,()=>{V(p)?F(a,`doc`):T()}),H(`click`,S,()=>F(y,!0)),W(e,t)},le=e=>{var t=Qf(),n=L(t);si(n,()=>Y(`blueprint.adr.folder_missing`,{name:V(d)}),!0),j(n);var r=z(n,2),i=L(r,!0);j(r);var a=z(r,2),o=L(a),s=L(o,!0);j(o);var c=z(o,2),l=L(c,!0);j(c),j(a),j(t),B((e,t,n)=>{G(i,e),G(s,t),G(l,n)},[()=>Y(`blueprint.adr.folder_create_prompt`),()=>Y(`common.cancel`),()=>Y(`blueprint.adr.create_folder_btn`)]),H(`click`,o,T),H(`click`,c,D),W(e,t)};K(oe,e=>{V(a)===`doc`?e(se):V(a)===`form`?e(ce,1):V(a)===`folder-confirm`&&e(le,2)}),j(n),j(t),H(`click`,t,e=>{e.target===e.currentTarget&&T()}),H(`click`,ae,T),W(e,t)};K(A,e=>{V(a)!==`closed`&&e(re)});var ie=z(A,2),ae=e=>{var t=ep(),n=L(t),r=L(n),i=L(r,!0);j(r);var a=z(r,2),s=L(a,!0);j(a);var c=z(a,2),l=L(c),u=L(l,!0);j(l);var d=z(l,2),f=L(d,!0);j(d),j(c),j(n),j(t),B((e,t,n)=>{G(i,e),G(s,V(o)),G(u,t),G(f,n)},[()=>Y(`doc.confirm_delete`),()=>Y(`common.cancel`),()=>Y(`doc.confirm_delete_btn`)]),H(`click`,t,e=>{e.target===e.currentTarget&&F(b,!1)}),H(`click`,l,()=>F(b,!1)),H(`click`,d,O),W(e,t)};return K(ie,e=>{V(b)&&e(ae)}),W(e,k),Je(ne)}Pr([`click`]);var rp=U(`<span class="breadcrumb-sep">›</span>`),ip=U(`<span class="breadcrumb-item current"> </span>`),ap=U(`<button class="breadcrumb-item" type="button"> </button>`),op=U(`<!> <!>`,1),sp=U(`<nav class="breadcrumb"></nav>`),cp=U(`<div class="app-shell"><!> <section class="workspace-shell"><!> <!></section></div> <!>`,1);function lp(e,t){qe(t,!0),Ji(async()=>{try{await Ca((await fetch(`/api/config`).then(e=>e.json())).language||`en`)}catch{}});let n=P(I([])),r=P(null),i=P(null),a=P(null),o=P(null);function s(e){l(),V(i).loadPath(e,!0)}async function c(e){F(r,e.folder.path,!0),await xr(),await V(a).open(e.folder.path)}function l(){F(r,null)}async function u(e){await V(i).navigateToFolder(e)}var d=cp(),f=R(d),p=L(f);{let e=N(()=>Y(`blueprint.subtitle`));es(p,{title:`Blueprint`,get subtitle(){return V(e)},children:(e,t)=>{var r=sp();q(r,21,()=>V(n),Qr,(e,t,r)=>{var i=op(),a=R(i),o=e=>{W(e,rp())};K(a,e=>{r>0&&e(o)});var c=z(a,2),l=e=>{var n=ip(),r=L(n,!0);j(n),B(()=>G(r,V(t).name)),W(e,n)},u=e=>{var n=ap(),r=L(n,!0);j(n),B(()=>G(r,V(t).name)),H(`click`,n,()=>s(V(t).path)),W(e,n)};K(c,e=>{r===V(n).length-1?e(l):e(u,-1)}),W(e,i)}),j(r),W(e,r)},$$slots:{default:!0}})}var m=z(p,2),h=L(m);Ui(Ms(h,{get activeExplorerPath(){return V(r)},onbreadcrumbchange:e=>F(n,e,!0),onopenexplorer:c,onclosefilerexplorer:l,onopenAdr:e=>V(o).open(e)}),e=>F(i,e,!0),()=>V(i));var g=z(h,2),_=e=>{Ui(Qs(e,{onclose:l,onnavigate:u}),e=>F(a,e,!0),()=>V(a))};K(g,e=>{V(r)!==null&&e(_)}),j(m),j(f),Ui(np(z(f,2),{onchanged:()=>V(i).loadPath(V(n).at(-1)?.path??``,!1)}),e=>F(o,e,!0),()=>V(o)),W(e,d),Je()}Pr([`click`]);var up=164,dp=64,fp=132,pp=78,mp=6,hp=24,gp=96,_p=540,vp=780,yp=1/2,bp=9999,xp=44,Sp=255,Cp=178,wp=Math.PI*.7,Tp=Math.PI*1.1,Ep=Math.PI*1.45,Dp=Math.PI*1.75,Op=14,kp=260,Ap=56,jp=32,Mp=[`pointerdown`,`mousedown`,`click`,`dblclick`,`touchstart`,`wheel`],Np=.35,Pp=2.2,Fp=.0018,Ip=4,Lp=46,Rp=4,zp=44,Bp=360,Vp=300,Hp=44,Up=48,Wp=7,Gp=875,Kp=450,qp=600*1e3,Jp,Z,Yp,Xp,Zp,Qp,$p,em=[],tm=new Map,nm=[],rm=-1,im,am,om,sm,cm,lm,um,dm,fm,pm,mm,hm,gm,_m,vm,ym,bm,xm,Sm,Cm,wm,Tm=null,Em=null,Dm=null,Q,$,Om,km=!1;function Am(){return Jp=document.getElementById(`workspaceCanvas`),Z=Jp.getContext(`2d`),Yp=document.getElementById(`apiStatus`),Xp=document.getElementById(`addButton`),Zp=document.getElementById(`fitButton`),Qp=document.getElementById(`testNodeButton`),$p=document.getElementById(`loadModelsButton`),im=document.getElementById(`closePanelButton`),am=document.getElementById(`deleteNodeButton`),om=document.getElementById(`renameConfirmOverlay`),sm=document.getElementById(`renameConfirmMessage`),cm=document.getElementById(`cancelRenameButton`),lm=document.getElementById(`confirmRenameButton`),um=document.getElementById(`deleteConfirmOverlay`),dm=document.getElementById(`deleteConfirmMessage`),fm=document.getElementById(`cancelDeleteButton`),pm=document.getElementById(`confirmDeleteButton`),mm=document.getElementById(`agentRunOverlay`),hm=document.getElementById(`agentRunTitle`),gm=document.getElementById(`agentRunHint`),_m=document.getElementById(`agentRunInputField`),vm=document.getElementById(`agentRunInput`),ym=document.getElementById(`agentRunResult`),bm=document.getElementById(`cancelAgentRunButton`),xm=document.getElementById(`executeAgentRunButton`),Sm=document.getElementById(`fallbackPanelHost`),Cm=document.getElementById(`configSurface`),wm=Cm,Tm=null,Em=null,Dm=null,Q={name:document.getElementById(`nodeName`),kind:document.getElementById(`nodeKind`),providerIdField:document.getElementById(`providerIdField`),providerId:document.getElementById(`nodeProviderId`),copyProviderId:document.getElementById(`copyProviderIdButton`),endpoint:document.getElementById(`nodeEndpoint`),token:document.getElementById(`nodeToken`),model:document.getElementById(`nodeModel`),modelFilter:document.getElementById(`nodeModelFilter`),modelResults:document.getElementById(`nodeModelResults`),providerTypeChat:document.getElementById(`nodeProviderTypeChat`),providerTypeImage:document.getElementById(`nodeProviderTypeImage`),toolModeField:document.getElementById(`toolModeField`),toolModeTools:document.getElementById(`nodeToolModeTools`),toolModeChat:document.getElementById(`nodeToolModeChat`),workspaceField:document.getElementById(`agentWorkspaceField`),workspaceFolder:document.getElementById(`nodeWorkspaceFolder`),timeout:document.getElementById(`nodeTimeout`),description:document.getElementById(`nodeDescription`),typeBadge:document.getElementById(`nodeTypeBadge`),llmFields:document.getElementById(`llmFields`),mcpInventory:document.getElementById(`mcpInventory`),mcpInventoryStatus:document.getElementById(`mcpInventoryStatus`),mcpToolsList:document.getElementById(`mcpToolsList`),mcpPromptsList:document.getElementById(`mcpPromptsList`),agentSection:document.getElementById(`agentSection`),agentProvider:document.getElementById(`nodeAgentProvider`),systemPrompt:document.getElementById(`nodeSystemPrompt`),requiresUserInput:document.getElementById(`nodeRequiresUserInput`),userInputDescriptionField:document.getElementById(`agentUserInputDescriptionField`),userInputDescription:document.getElementById(`nodeUserInputDescription`),expectedOutputMarker:document.getElementById(`nodeExpectedOutputMarker`)},$={entities:Xm([Ym(`root`,`Living AI Documentation`,`system`,null),Ym(`mcp`,`MCP`,`mcp`,`root`)]),selectedId:null,cameraX:0,cameraY:0,zoom:1,isPanning:!1,panStartX:0,panStartY:0,panStartCameraX:0,panStartCameraY:0,didPan:!1,viewAnimationId:null,dpr:window.devicePixelRatio||1,apiMode:`fallback`,lastSaveAt:null,pendingDeleteId:null,panelShiftX:0,saveTimerId:null,panelDirty:!1,isHydrated:!1},km=!!Jp.requestPaint&&typeof Z.drawElementImage==`function`,km?($.apiMode=`html-in-canvas`,Yp.textContent=`HTML-in-Canvas active`,Yp.classList.add(`is-live`),Jp.onpaint=ag):(Sm.appendChild(Cm),Yp.textContent=`DOM fallback`,Yp.classList.add(`is-fallback`)),Om=new ResizeObserver(([e])=>{let t=e.devicePixelContentBoxSize?.[0],n=e.contentRect.width,r=e.contentRect.height;$.dpr=t?t.inlineSize/n:window.devicePixelRatio||1,Jp.width=t?t.inlineSize:Math.floor(n*$.dpr),Jp.height=t?t.blockSize:Math.floor(r*$.dpr),ih(),hg(!1,!$.cameraX&&!$.cameraY),ig()}),Om.observe(Jp,{box:`device-pixel-content-box`}),jm(),Mm(),Xp.addEventListener(`click`,()=>{th()}),Zp.addEventListener(`click`,()=>{ih(),hg(!0,!0),Lm(),ig()}),Jp.addEventListener(`pointerdown`,e=>{if(e.target!==Jp)return;let t=Rg(e),n=Tg(t),r=[...$.entities].reverse().find(e=>jg(e,n));if(r){r.id!==`root`&&gh(r.id);return}$.isPanning=!0,$.didPan=!1,$.panStartX=t.x,$.panStartY=t.y,$.panStartCameraX=$.cameraX,$.panStartCameraY=$.cameraY,Jp.classList.add(`is-panning`),Jp.setPointerCapture?.(e.pointerId)}),Jp.addEventListener(`pointermove`,e=>{if(!$.isPanning)return;let t=Rg(e),n=t.x-$.panStartX,r=t.y-$.panStartY;Math.hypot(n,r)>Ip&&($.didPan=!0),$.cameraX=$.panStartCameraX+n,$.cameraY=$.panStartCameraY+r,ig()}),Jp.addEventListener(`pointerup`,e=>{$.isPanning&&($.isPanning=!1,Jp.classList.remove(`is-panning`),Jp.releasePointerCapture?.(e.pointerId),!$.didPan&&$.selectedId?gh(null):$.didPan&&Lm())}),Jp.addEventListener(`pointercancel`,e=>{$.isPanning=!1,Jp.classList.remove(`is-panning`),Jp.releasePointerCapture?.(e.pointerId)}),Jp.addEventListener(`wheel`,e=>{e.target===Jp&&(e.preventDefault(),wg(Rg(e),Math.exp(-e.deltaY*Fp)),Lm())},{passive:!1}),wm.addEventListener(`submit`,e=>{e.preventDefault(),wh(),$.lastSaveAt=new Date,ih(),zm(!0),ig()}),wm.addEventListener(`input`,()=>{wh(),ih(),$.panelDirty=!0,ig()}),im.addEventListener(`click`,()=>{gh(null)}),am.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation();let t=$.selectedId,n=t?eg(t):null;!n||tg(t)||_h(n)}),fm.addEventListener(`click`,vh),um.addEventListener(`click`,e=>{e.target===um&&vh()}),pm.addEventListener(`click`,()=>{$.pendingDeleteId&&yh($.pendingDeleteId),vh()}),Qp.addEventListener(`click`,()=>{if($h()?.kind===`agent`){Ah();return}Jh()}),$p.addEventListener(`click`,()=>{qh()}),Q.copyProviderId.addEventListener(`click`,()=>{Xh()}),Q.name.addEventListener(`blur`,()=>{if($h()?.kind!==`agent`)return;let e=Q.name.value.trim();if(!e||!Tm||!Em||e===Tm)return;let t=Qm(e);t!==Em&&(sm.textContent=`Renommer le dossier "${Em}" en "${t}" ?`,om.hidden=!1,cm.focus())}),cm.addEventListener(`click`,()=>{om.hidden=!0;let e=$h();e&&Tm&&(e.label=Tm,Q.name.value=Tm,ih(),ig())}),lm.addEventListener(`click`,()=>{om.hidden=!0;let e=$h();if(!e||!Em)return;e.config.workspaceFolder=Em,Q.workspaceFolder.value=Em;let t=Q.name.value.trim();t&&(Tm=t),Em=Qm(t),Lm()}),Q.modelFilter.addEventListener(`input`,e=>{e.stopPropagation(),rm=-1,Wh()}),Q.modelFilter.addEventListener(`focus`,()=>{Wh()}),Q.modelFilter.addEventListener(`blur`,()=>{Gh()}),Q.modelFilter.addEventListener(`keydown`,e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(nm.length===0)return;e.preventDefault();let t=nm.length;rm=e.key===`ArrowDown`?(rm+1)%t:rm<=0?t-1:rm-1,Wh()}else if(e.key===`Enter`){e.preventDefault();let t=nm[rm]??(nm.length===1?nm[0]:void 0);t&&Kh(t)}else e.key===`Escape`&&Q.modelFilter.value&&(e.preventDefault(),e.stopPropagation(),Q.modelFilter.value=``,Gh())}),Q.modelResults.addEventListener(`mousedown`,e=>{e.preventDefault()}),Q.modelResults.addEventListener(`click`,e=>{let t=e.target.closest(`[data-model]`);t?.dataset.model&&Kh(t.dataset.model)}),Q.model.addEventListener(`change`,()=>{Qp.disabled=!Q.model.value;let e=$h();e&&(e.config.model=Q.model.value)}),Q.agentProvider.addEventListener(`change`,()=>{Eh(Q.agentProvider.value)}),bm.addEventListener(`click`,()=>{jh()}),xm.addEventListener(`click`,()=>{Mh()}),mm.addEventListener(`click`,e=>{e.target===mm&&jh()}),Pm(),()=>{Rm(),Om.disconnect(),$?.saveTimerId&&clearTimeout($.saveTimerId)}}function jm(){for(let e of Mp)Cm.addEventListener(e,Nm),Sm.addEventListener(e,Nm)}function Mm(){for(let e of Mp)um.addEventListener(e,Nm),om.addEventListener(e,Nm),mm.addEventListener(e,Nm)}function Nm(e){e.stopPropagation()}async function Pm(){let e=await Eo();e?.entities?.length&&($.entities=Fm(e.entities),$.cameraX=Jm(e.camera?.x,$.cameraX),$.cameraY=Jm(e.camera?.y,$.cameraY),$.zoom=Eg(Jm(e.camera?.zoom,$.zoom),Np,Pp),$.lastSaveAt=e.updatedAt?new Date(e.updatedAt):null),$.isHydrated=!0,ih(),e?.entities?.length||hg(!1,!0),Ch(),ig()}function Fm(e){let t=e.map(Im).filter(e=>!!e),n=t.some(e=>e.id===`root`),r=t.some(e=>e.id===`mcp`),i=[...n?[]:[Ym(`root`,`Living AI Documentation`,`system`,null)],...t,...r?[]:[Ym(`mcp`,`MCP`,`mcp`,`root`)]],a=new Set(i.map(e=>e.id));return i.map(e=>{let t=e.id===`root`?`system`:e.id===`mcp`?`mcp`:e.kind,n=e.id===`root`?null:e.id===`mcp`?`root`:e.parentId&&a.has(e.parentId)?e.parentId:null;return{...e,kind:t,parentId:n,config:{...Ym(e.id,e.label,t,n).config,...e.config}}})}function Im(e){if(!Um(e))return null;let t=Wm(e.id),n=Wm(e.label),r=Gm(e.kind);if(!t||!n||!r)return null;let i=e.parentId===null?null:Wm(e.parentId),a=Um(e.config)?e.config:{};return{id:t,label:n,kind:r,parentId:i,x:Jm(e.x,0),y:Jm(e.y,0),angle:Jm(e.angle,0),config:{endpoint:Wm(a.endpoint)||Zm(t,r),token:Wm(a.token),model:Wm(a.model),providerType:qm(a.providerType),toolMode:Km(a.toolMode),timeout:Jm(a.timeout,180),description:Wm(a.description)||eh(r),workspaceFolder:Wm(a.workspaceFolder)||(r===`agent`?Qm(n):``),systemPrompt:Wm(a.systemPrompt),requiresUserInput:a.requiresUserInput===!0,userInputDescription:Wm(a.userInputDescription),expectedOutputMarker:Wm(a.expectedOutputMarker)}}}function Lm(){$.isHydrated&&($.saveTimerId&&clearTimeout($.saveTimerId),$.saveTimerId=window.setTimeout(()=>{$.saveTimerId=null,zm(!1)},Kp))}function Rm(){$.panelDirty&&zm(!1)}async function zm(e=!1){if(!$.isHydrated)return;$.panelDirty=!1,$.saveTimerId&&(clearTimeout($.saveTimerId),$.saveTimerId=null);let t=$.selectedId&&document.activeElement===Q.token&&zh(Q.token.value)?{entityId:$.selectedId,value:Q.token.value,selectionStart:Q.token.selectionStart,selectionEnd:Q.token.selectionEnd}:null,n=await Do(Hm());if(n){if($.entities=Fm(n.entities),t&&$.selectedId===t.entityId){let e=$h();e?.kind===`llm`&&(e.config.token=t.value)}$.lastSaveAt=new Date(n.updatedAt),$h()&&!wm.contains(document.activeElement)&&Ch(),t&&$.selectedId===t.entityId&&(Q.token.value=t.value,Q.token.setSelectionRange(t.selectionStart,t.selectionEnd)),e&&Vm(`Workspace saved`)}else e&&Vm(`Save failed`)}function Bm(e,t){return Co(e,t)}function Vm(e,t=`success`,n,r){return wo(e,t,n,r)}function Hm(){return{version:1,updatedAt:new Date().toISOString(),entities:$.entities.map(e=>{let t={...e.config,token:Bh(e.config.token)};return{id:e.id,label:e.label,kind:e.kind,parentId:e.parentId,x:e.x,y:e.y,angle:e.angle,config:t}}),camera:{x:$.cameraX,y:$.cameraY,zoom:$.zoom}}}function Um(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Wm(e){return typeof e==`string`?e:``}function Gm(e){return e===`system`||e===`llm`||e===`agent`||e===`mcp`?e:null}function Km(e){return e===`chat`?`chat`:`tools`}function qm(e){return e===`image`?`image`:`chat`}function Jm(e,t){return typeof e==`number`&&Number.isFinite(e)?e:t}function Ym(e,t,n,r){return{id:e,label:t,kind:n,parentId:r,x:0,y:0,angle:0,config:{endpoint:Zm(e,n),token:``,model:``,providerType:`chat`,toolMode:`tools`,timeout:180,description:eh(n),workspaceFolder:n===`agent`?Qm(t):``,systemPrompt:``,requiresUserInput:!1,userInputDescription:``,expectedOutputMarker:``}}}function Xm(e){return e.map(e=>({...e,config:{...e.config}}))}function Zm(e,t){return t===`llm`?`http://localhost:11434`:t===`mcp`?`http://localhost:4321/mcp`:``}function Qm(e){return`AI/WORKSPACE/${$m(e)}`}function $m(e){return e.normalize(`NFKD`).replace(/[\u0300-\u036f]/g,``).toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``)||`llm_provider`}function eh(e){let t={system:`Owns the documentation workspace, MCP access, providers, and agent topology.`,llm:`Routes model calls and hosts the agents assigned to this provider.`,agent:`Runs focused automation against documentation, source, or quality signals.`,mcp:`Exposes the local Living Documentation MCP consultation panel to agents.`};return t[e]||t.agent}function th(){let e=$h(),t=e?.kind===`llm`?e:eg(e?.parentId);if(t?.kind===`llm`&&t.config.providerType!==`image`){rh(t.id);return}nh()}function nh(){let e=!!$.selectedId,t=ng(`root`).filter(e=>e.kind===`llm`).length+1,n=Ym(`provider-${Date.now().toString(36)}`,`LLM Provider ${t}`,`llm`,`root`);$.entities=[...$.entities,n],$.selectedId=n.id,ih(),gg(e,!0,!0),Ch(),Lm(),ig()}function rh(e){let t=!!$.selectedId,n=ng(e).filter(e=>e.kind===`agent`).length+1,r=Ym(`agent-${Date.now().toString(36)}`,`Agent ${n}`,`agent`,e);$.entities=[...$.entities,r],$.selectedId=r.id,ih(),gg(t,!0,!0),Ch(),Lm(),ig()}function ih(){let e=eg(`root`);e.x=0,e.y=0,e.angle=0,ah(e)}function ah(e){let t=ng(e.id),n=dh(t,fp,Sp,{spread:Math.PI*2,includeSubtree:!1}),r=new Map(t.map(e=>[e.id,lh(e,n)]));for(let n=0;n<=Wp;n+=1)if(oh(e,t,r),sh(),!ch(t,r))return;oh(e,t,r),sh()}function oh(e,t,n){let r=Math.max(1,t.length);t.forEach((t,i)=>{let a=-Math.PI/2+i/r*Math.PI*2,o=n.get(t.id)||Sp;t.angle=a,t.x=e.x+Math.cos(a)*o,t.y=e.y+Math.sin(a)*o})}function sh(){for(let e of $.entities.filter(e=>e.kind===`llm`))uh(e)}function ch(e,t){let n=!1;for(let r=0;r<e.length;r+=1)for(let i=r+1;i<e.length;i+=1){let a=e[r],o=e[i];Lg(Pg(a),Pg(o),Hp)&&(t.set(a.id,Math.min(Gp,t.get(a.id)+Up)),t.set(o.id,Math.min(Gp,t.get(o.id)+Up)),n=!0)}return n}function lh(e,t){if(e.kind!==`llm`)return t;let n=ng(e.id).length;if(n<=Rp)return t;let r=(n-Rp)*zp,i=Math.max(0,mh(e)-Vp)*.65;return t+Math.min(Bp,Math.max(r,i))}function uh(e){let t=ng(e.id);if(!t.length)return;let n=Math.atan2(e.y,e.x),r=fh(t.length),i=dh(t,pp,Cp,{spread:r,includeSubtree:!1});t.forEach((a,o)=>{let s=ph(n,r,o,t.length);a.angle=s,a.x=e.x+Math.cos(s)*i,a.y=e.y+Math.sin(s)*i})}function dh(e,t,n,r={}){if(!e.length)return n;let i=!!r.includeSubtree,a=r.spread||Math.PI*2,o=Math.max(...e.map(e=>i?mh(e):hh(e))),s=t+o+Lp;if(e.length===1)return Math.max(n,s);let c=o*2+Lp,l=a>=Math.PI*2-.001?Math.PI*2/e.length:a/(e.length-1),u=c/(2*Math.sin(l/2));return Math.max(n,s,u)}function fh(e){return e<=1?0:e<=2?wp:e<=4?Tp:e<=7?Ep:Dp}function ph(e,t,n,r){return r<=1||t===0?e:e-t/2+n/(r-1)*t}function mh(e){if(e.kind!==`llm`)return hh(e);let t=ng(e.id);return t.length?dh(t,pp,Cp,{spread:fh(t.length),includeSubtree:!1})+Math.max(...t.map(e=>hh(e))):pp}function hh(e){if(e.kind===`system`)return fp;if(e.kind===`llm`)return pp;let{width:t,height:n}=Ng(e);return Math.hypot(t/2,n/2)}function gh(e){e!==$.selectedId&&Rm();let t=!!$.selectedId;$.selectedId=e;let n=e?eg(e):null;Tm=n?.kind===`agent`?n.label:null,Em=n?.kind===`agent`?n.config.workspaceFolder||Qm(n.label):null,ih(),gg(t,!!e,!0),Ch(),ig()}function _h(e){let t=rg(e.id),n=ng(e.id).length,r=t.length?` This node has ${n} direct child${n===1?``:`ren`} and ${t.length} total descendant${t.length===1?``:`s`}; they will also be deleted.`:` This node has no children.`;$.pendingDeleteId=e.id,dm.textContent=`You are about to delete "${e.label}".${r} This action cannot be undone.`,um.hidden=!1,pm.focus()}function vh(){$.pendingDeleteId=null,um.hidden=!0}function yh(e){let t=eg(e);if(!t||tg(e))return;let n=t.parentId||`root`,r=!!$.selectedId,i=new Set([e,...rg(e)]);$.entities=$.entities.filter(e=>!i.has(e.id)),$.selectedId=eg(n)?n:null,ih(),gg(r,!!$.selectedId,!0),Ch(),Lm(),ig()}var bh=0;async function xh(e){let t=++bh,n=e.config.endpoint.trim(),r=Q.mcpInventoryStatus;if(Q.mcpToolsList.replaceChildren(),Q.mcpPromptsList.replaceChildren(),!n){r.hidden=!1,r.textContent=`Set an endpoint to load the MCP tools and prompts.`;return}r.hidden=!1,r.textContent=`Loading MCP tools and prompts…`;let i=await ko({endpoint:n});if(t===bh){if(!i.ok){r.hidden=!1,r.textContent=i.error?`Failed to load MCP inventory: ${i.error}`:`Failed to load MCP inventory.`;return}r.hidden=!0,Sh(Q.mcpToolsList,i.tools??[],`No tools exposed.`),Sh(Q.mcpPromptsList,i.prompts??[],`No prompts exposed.`)}}function Sh(e,t,n){if(e.replaceChildren(),t.length===0){let t=document.createElement(`li`);t.className=`inventory-empty`,t.textContent=n,e.appendChild(t);return}for(let n of t){let t=document.createElement(`li`);t.textContent=n,e.appendChild(t)}}function Ch(){let e=$h(),t=!!e;if(Cm.hidden=!t,Sm.hidden=!t||km,!e){Xp.title=`Add LLM provider`,Qp.textContent=`Test`,Qp.hidden=!0,Qp.disabled=!0;return}Q.name.value=e.label,Q.kind.value=e.kind,Q.providerId.value=e.kind===`llm`?e.id:``,Q.endpoint.value=e.config.endpoint,Q.token.value=e.config.token,kh(e.config.model),Q.providerTypeChat.checked=e.config.providerType!==`image`,Q.providerTypeImage.checked=e.config.providerType===`image`,Q.toolModeTools.checked=e.config.toolMode!==`chat`,Q.toolModeChat.checked=e.config.toolMode===`chat`,Q.workspaceFolder.value=e.config.workspaceFolder,Q.workspaceField.hidden=e.kind!==`agent`,Q.timeout.value=String(e.config.timeout),Q.description.value=e.config.description,Q.typeBadge.textContent=Qh(e),Q.kind.disabled=!0,Q.llmFields.hidden=e.kind===`mcp`||e.kind===`agent`,Oh(e),Q.mcpInventory.hidden=e.kind!==`mcp`,e.kind===`mcp`?xh(e):bh+=1,Q.agentSection.hidden=e.kind!==`agent`,e.kind===`agent`&&Th(e),Q.systemPrompt.value=e.config.systemPrompt,Q.requiresUserInput.checked=e.config.requiresUserInput,Dh(),Q.userInputDescription.value=e.config.userInputDescription,Q.expectedOutputMarker.value=e.config.expectedOutputMarker,am.hidden=tg(e.id),Qp.textContent=`Test`,Qp.hidden=e.kind!==`llm`&&e.kind!==`agent`,Qp.disabled=e.kind===`llm`?!e.config.model:e.kind!==`agent`;let n=e.kind===`llm`?e:eg(e.parentId);Xp.title=n?.kind===`llm`&&n.config.providerType!==`image`?`Add agent`:`Add LLM provider`}function wh(){let e=$h();if(e&&(e.label=Q.name.value.trim()||`Untitled node`,e.kind=Q.kind.value,e.config.endpoint=Q.endpoint.value,e.config.token=Q.token.value,e.config.model=Q.model.value,e.config.providerType=Q.providerTypeImage.checked?`image`:`chat`,e.config.toolMode=Q.toolModeChat.checked?`chat`:`tools`,e.config.timeout=Number(Q.timeout.value||30),e.config.description=Q.description.value,e.config.systemPrompt=Q.systemPrompt.value,e.config.requiresUserInput=Q.requiresUserInput.checked,e.config.userInputDescription=Q.userInputDescription.value,e.config.expectedOutputMarker=Q.expectedOutputMarker.value,Dh(),Oh(e),Q.typeBadge.textContent=Qh(e),e.kind===`llm`))for(let t of $.entities)t.parentId===e.id&&t.kind===`agent`&&(t.config.model=e.config.model,t.config.timeout=e.config.timeout)}function Th(e){let t=Q.agentProvider;t.innerHTML=``;let n=$.entities.filter(e=>e.kind===`llm`&&e.config.providerType!==`image`);for(let e of n){let n=document.createElement(`option`);n.value=e.id,n.textContent=e.label,t.appendChild(n)}t.value=e.parentId??``}function Eh(e){let t=$h();if(t?.kind!==`agent`)return;let n=eg(e);n?.kind===`llm`&&t.parentId!==e&&(t.parentId=e,t.config.model=n.config.model,t.config.timeout=n.config.timeout,ih(),Lm(),ig())}function Dh(){let e=$h()?.kind===`agent`&&Q.requiresUserInput.checked;Q.userInputDescriptionField.hidden=!e,Q.userInputDescription.required=e}function Oh(e){let t=e.kind===`llm`,n=e.config.providerType===`image`;Q.providerIdField.hidden=!t,Q.toolModeField.hidden=!t||n,$p.title=Y(n?`workspace.model.load_image`:`workspace.model.load_chat`),Qp.title=n?`Test image provider configuration`:`Test chat provider configuration`}function kh(e){let t=$h(),n=t?.kind===`llm`?tm.get(Hh(t)):void 0;if(n){let t=e&&!n.includes(e)?[e,...n]:n;t!==em&&Uh(t),Q.model.value=e||t[0];return}em.length>0&&(Uh([]),Q.model.innerHTML=``);let r=Array.from(Q.model.options).map(e=>e.value);if(e&&!r.includes(e)){Q.model.innerHTML=``;let t=document.createElement(`option`);t.value=e,t.textContent=e,Q.model.appendChild(t)}Q.model.value=e||(r[0]??``)}function Ah(){let e=$h();if(e?.kind!==`agent`)return;wh();let t=eg(e.parentId??``);if(t?.kind!==`llm`){Vm(`No parent LLM found for this agent.`,`error`);return}if(!t.config.model){Vm(`Parent LLM has no model selected.`,`error`);return}if(!e.config.systemPrompt.trim()){Vm(`Write a system prompt first.`,`error`);return}if(e.config.requiresUserInput&&!e.config.userInputDescription.trim()){Vm(`Describe the required user input first.`,`error`);return}Dm=e.id,hm.textContent=`Test ${e.label}`,gm.textContent=e.config.requiresUserInput?e.config.userInputDescription:`Run this agent with its configured system prompt.`,_m.hidden=!e.config.requiresUserInput,vm.required=e.config.requiresUserInput,vm.value=``,ym.hidden=!0,ym.textContent=``,xm.disabled=!1,xm.textContent=`Run`,mm.hidden=!1,e.config.requiresUserInput?window.setTimeout(()=>vm.focus(),0):window.setTimeout(()=>xm.focus(),0)}function jh(){mm.hidden=!0,Dm=null}async function Mh(){if(vm.required&&!vm.value.trim()){vm.reportValidity();return}let e=Dm?eg(Dm):null;if(e?.kind!==`agent`){Lh(`error`,`The selected agent is no longer available.`);return}let t=eg(e.parentId??``);if(t?.kind!==`llm`){Lh(`error`,`No parent LLM found for this agent.`);return}xm.disabled=!0,xm.textContent=`Running…`;let n=Bm(`Running agent…`);Ph();let r=$.entities.find(e=>e.kind===`mcp`),i=!1,a=await Ao({providerId:t.id,endpoint:t.config.endpoint,model:t.config.model,systemPrompt:e.config.systemPrompt,userInput:vm.value.trim()||void 0,timeout:t.config.timeout,mcpEndpoint:t.config.toolMode===`chat`?void 0:r?.config.endpoint||void 0,toolMode:t.config.toolMode,expectedOutputMarker:e.config.expectedOutputMarker||void 0},e=>{e.type===`error`&&(i=!0),e.type!==`final`&&e.type!==`error`&&Bm(Nh(e),n),Fh(e)});xm.disabled=!1,xm.textContent=`Run`,a.ok&&a.content?(Ih(a.content),Vm(`Agent responded. Result saved in AI/WORKSPACE.`,`success`,qp,n)):(i||Fh({type:`error`,message:a.error??`Agent failed.`}),ym.dataset.state=`error`,Vm(a.error??`Agent failed.`,`error`,qp,n))}function Nh(e){return e.type===`tool_call`&&e.toolName?`Agent tool call: ${e.toolName}`:e.type===`tool_result`&&e.toolName?`Agent tool result: ${e.toolName}`:`Agent: ${e.message}`}function Ph(){ym.hidden=!1,ym.dataset.state=`loading`,ym.textContent=``,Fh({type:`status`,message:`Preparing agent request`})}function Fh(e){ym.hidden=!1,e.type===`error`&&(ym.dataset.state=`error`);let t=document.createElement(`div`);t.className=`agent-run-event agent-run-event-${e.type.replace(`_`,`-`)}`;let n=document.createElement(`span`);n.className=`agent-run-event-dot`,n.setAttribute(`aria-hidden`,`true`);let r=document.createElement(`div`);r.className=`agent-run-event-body`;let i=document.createElement(`p`);i.className=`agent-run-event-title`,i.textContent=e.message,r.appendChild(i);let a=[];if(e.turn&&a.push(`Turn ${e.turn}`),e.toolName&&a.push(e.toolName),e.detail&&a.push(e.detail),a.length){let e=document.createElement(`p`);e.className=`agent-run-event-meta`,e.textContent=a.join(` · `),r.appendChild(e)}t.append(n,r),ym.appendChild(t),ym.scrollTop=ym.scrollHeight}function Ih(e){ym.dataset.state=`success`;let t=document.createElement(`section`);t.className=`agent-run-final`;let n=document.createElement(`h3`);n.textContent=`Final response`;let r=document.createElement(`pre`);r.textContent=e,t.append(n,r),ym.appendChild(t),ym.scrollTop=ym.scrollHeight}function Lh(e,t){ym.hidden=!1,ym.dataset.state=e,ym.textContent=t}var Rh=/^(?:env:[A-Za-z_][A-Za-z0-9_]*|\$\{[A-Za-z_][A-Za-z0-9_]*\})$/;function zh(e){let t=e.trim();return t!==``&&!Rh.test(t)}function Bh(e){let t=e.trim();return zh(t)?``:t}var Vh=`API token must reference an environment variable, e.g. env:LLM_API_KEY`;function Hh(e){return`${e.config.providerType}|${e.config.endpoint}`}function Uh(e){if(em=e,e.length>0){Q.model.innerHTML=``;for(let t of e){let e=document.createElement(`option`);e.value=t,e.textContent=t,Q.model.appendChild(e)}}Q.modelFilter.value=``,Q.modelFilter.hidden=e.length===0,Gh()}function Wh(){let e=Q.modelFilter.value.toLowerCase().split(/\s+/).filter(Boolean);if(e.length===0||em.length===0){Gh();return}if(nm=em.filter(t=>{let n=t.toLowerCase();return e.every(e=>n.includes(e))}),rm>=nm.length&&(rm=-1),Q.modelResults.innerHTML=``,nm.forEach((e,t)=>{let n=document.createElement(`li`);n.id=`nodeModelResult-${t}`,n.role=`option`,n.dataset.model=e,n.textContent=e,n.classList.toggle(`active`,t===rm),n.setAttribute(`aria-selected`,String(e===Q.model.value)),Q.modelResults.appendChild(n)}),nm.length===0){let e=document.createElement(`li`);e.className=`empty`,e.textContent=Y(`workspace.model.no_match`),Q.modelResults.appendChild(e)}let t=Y(`workspace.model.filter_count`,{shown:String(nm.length),total:String(em.length)});Q.modelResults.setAttribute(`aria-label`,t),Q.modelFilter.title=t,Q.modelResults.hidden=!1,Q.modelFilter.setAttribute(`aria-expanded`,`true`),rm>=0?(Q.modelFilter.setAttribute(`aria-activedescendant`,`nodeModelResult-${rm}`),Q.modelResults.children[rm]?.scrollIntoView({block:`nearest`})):Q.modelFilter.removeAttribute(`aria-activedescendant`)}function Gh(){nm=[],rm=-1,Q.modelResults.hidden=!0,Q.modelResults.innerHTML=``,Q.modelFilter.setAttribute(`aria-expanded`,`false`),Q.modelFilter.removeAttribute(`aria-activedescendant`)}function Kh(e){Q.model.value=e,Q.model.dispatchEvent(new Event(`input`,{bubbles:!0})),Q.model.dispatchEvent(new Event(`change`,{bubbles:!0})),Q.modelFilter.value=``,Gh()}async function qh(){let e=$h();if(e?.kind!==`llm`)return;wh();let t=e.config.endpoint;if(!t){Vm(Y(`workspace.model.endpoint_required`));return}if(zh(e.config.token)){Vm(Vh);return}$p.classList.add(`loading`),$p.disabled=!0,Q.model.disabled=!0;let n=await Oo({endpoint:t,token:e.config.token,providerType:e.config.providerType});if($p.classList.remove(`loading`),$p.disabled=!1,Q.model.disabled=!1,!n.ok||!n.models?.length){Vm(n.error??Y(`workspace.model.none_found`));return}let r=Q.model.value;tm.set(Hh(e),n.models),Uh(n.models),Q.model.value=n.models.includes(r)?r:n.models[0],e.config.model=Q.model.value,Qp.disabled=!Q.model.value,Vm(n.models.length===1?Y(`workspace.model.loaded_one`):Y(`workspace.model.loaded_many`,{count:String(n.models.length)})),ig()}async function Jh(){let e=$h();if(e?.kind!==`llm`)return;if(wh(),zh(e.config.token)){Vm(Vh);return}Qp.disabled=!0,Bm(`Testing ${e.config.model}…`),ig();let t=e.config.providerType===`image`?await Yh(e):await Mo({endpoint:e.config.endpoint,token:e.config.token,model:e.config.model,timeout:e.config.timeout});Qp.disabled=!1,t.ok?Vm(t.detail??`Connection OK`,`success`):Vm(t.error||`Connection failed (${t.status||`no status`})`,`error`),ig()}async function Yh(e){let t=await Oo({endpoint:e.config.endpoint,token:e.config.token,providerType:`image`});if(!t.ok)return{ok:!1,error:t.error??`Image provider test failed`};let n=e.config.model.trim();return n&&t.models?.length&&!t.models.includes(n)?{ok:!1,error:`Image models loaded, but "${n}" was not found.`}:{ok:!0,detail:`${t.models?.length??0} image model${t.models?.length===1?``:`s`} available`}}async function Xh(){let e=$h();if(e?.kind===`llm`)try{await navigator.clipboard.writeText(e.id),Vm(`Provider ID copied`,`success`)}catch{Q.providerId.select(),Vm(`Provider ID selected`,`success`)}}function Zh(e){return{system:`System`,llm:`LLM provider`,agent:`Agent`,mcp:`MCP`}[e]||`Node`}function Qh(e){return e.kind===`llm`&&e.config.providerType===`image`?`Image provider`:Zh(e.kind)}function $h(){return $.selectedId?eg($.selectedId):null}function eg(e){return $.entities.find(t=>t.id===e)}function tg(e){return e===`root`||e===`mcp`}function ng(e){return $.entities.filter(t=>t.parentId===e)}function rg(e){let t=[];for(let n of ng(e))t.push(n.id,...rg(n.id));return t}function ig(){km?Jp.requestPaint():requestAnimationFrame(ag)}function ag(){let e=Jp.width/$.dpr,t=Jp.height/$.dpr;Z.reset(),Z.setTransform($.dpr,0,0,$.dpr,0,0),Z.clearRect(0,0,e,t),Z.save(),Z.translate($.cameraX,$.cameraY),Z.scale($.zoom,$.zoom),og(e,t),sg(),Z.restore(),km&&mg(e,t)}function og(e,t){Z.save(),Z.lineWidth=1/$.zoom;let n=Tg({x:0,y:0}),r=Tg({x:e,y:t}),i=Math.floor(n.x/hp)*hp,a=Math.ceil(r.x/hp)*hp,o=Math.floor(n.y/hp)*hp,s=Math.ceil(r.y/hp)*hp;for(let e=i;e<=a;e+=hp)Z.strokeStyle=e%gp===0?`#d7dce5`:`#edf0f4`,Hg(e,o,e,s);for(let e=o;e<=s;e+=hp)Z.strokeStyle=e%gp===0?`#d7dce5`:`#edf0f4`,Hg(i,e,a,e);Z.restore()}function sg(){cg();for(let e of $.entities)lg(e)}function cg(){Z.save(),Z.lineWidth=2/$.zoom;for(let e of $.entities){let t=eg(e.parentId);if(!t)continue;let n=Math.atan2(e.y-t.y,e.x-t.x),r=Dg(t,n),i=Dg(e,n+Math.PI);Z.strokeStyle=fg(e).connection,Z.beginPath(),Z.moveTo(r.x,r.y),Z.lineTo(i.x,i.y),Z.stroke()}Z.restore()}function lg(e){if(e.kind===`system`||e.kind===`llm`){ug(e);return}dg(e)}function ug(e){let t=e.id===$.selectedId,n=fg(e),r=e.kind===`system`?fp:pp,i=ng(e.id),a=Math.max(mp,i.length),o=zg(e.x,e.y,r,a);Z.save(),Z.beginPath(),o.forEach((e,t)=>{t===0?Z.moveTo(e.x,e.y):Z.lineTo(e.x,e.y)}),Z.closePath(),Z.fillStyle=t?n.selectedFill:n.fill,Z.strokeStyle=t?n.selectedStroke:n.stroke,Z.lineWidth=(t?3:2)/$.zoom,Z.shadowColor=n.shadow,Z.shadowBlur=e.kind===`system`?20:14,Z.shadowOffsetY=e.kind===`system`?8:5,Z.fill(),Z.shadowColor=`transparent`,Z.stroke(),Z.fillStyle=t?n.selectedText:n.text,Z.textAlign=`center`,Z.textBaseline=`middle`,Z.font=e.kind===`system`?`800 21px Inter, system-ui, sans-serif`:`800 16px Inter, system-ui, sans-serif`,Vg(e.label,e.x,e.y-8,r*1.32,e.kind===`system`?26:20),pg(e,t,r),Z.restore()}function dg(e){let t=e.id===$.selectedId,n=fg(e),r=e.kind===`mcp`?116:up,i=e.kind===`mcp`?58:dp;Z.save(),Bg(e.x-r/2,e.y-i/2,r,i,20),Z.fillStyle=t?n.selectedFill:n.fill,Z.strokeStyle=t?n.selectedStroke:n.stroke,Z.lineWidth=(t?3:2)/$.zoom,Z.shadowColor=n.shadow,Z.shadowBlur=10,Z.shadowOffsetY=4,Z.fill(),Z.shadowColor=`transparent`,Z.stroke(),Z.fillStyle=t?n.selectedText:n.text,Z.font=`760 15px Inter, system-ui, sans-serif`,Z.textAlign=`center`,Z.textBaseline=`middle`,Vg(e.label,e.x,e.y,r*.78,18),pg(e,t,Math.max(r,i)/2),Z.restore()}function fg(e){if(e.kind===`system`)return{fill:`#111827`,stroke:`#111827`,selectedFill:`#111827`,selectedStroke:`#111827`,text:`#ffffff`,selectedText:`#ffffff`,shadow:`rgb(17 24 39 / 18%)`,connection:`#475569`};if(e.kind===`llm`&&e.config.providerType===`image`)return{fill:`#facc15`,stroke:`#ca8a04`,selectedFill:`#eab308`,selectedStroke:`#a16207`,text:`#111827`,selectedText:`#111827`,shadow:`rgb(250 204 21 / 22%)`,connection:`#ca8a04`};if(e.kind===`llm`&&e.config.toolMode===`chat`)return{fill:`#f472b6`,stroke:`#db2777`,selectedFill:`#ec4899`,selectedStroke:`#be185d`,text:`#500724`,selectedText:`#500724`,shadow:`rgb(244 114 182 / 20%)`,connection:`#db2777`};if(e.kind===`llm`)return{fill:`#f97316`,stroke:`#ea580c`,selectedFill:`#fb923c`,selectedStroke:`#c2410c`,text:`#431407`,selectedText:`#431407`,shadow:`rgb(249 115 22 / 20%)`,connection:`#ea580c`};if(e.kind===`mcp`)return{fill:`#64748b`,stroke:`#475569`,selectedFill:`#475569`,selectedStroke:`#334155`,text:`#ffffff`,selectedText:`#ffffff`,shadow:`rgb(100 116 139 / 18%)`,connection:`#64748b`};if(e.kind===`agent`){let t=eg(e.parentId);return t?.kind===`llm`&&t.config.toolMode===`chat`?{fill:`#f9a8d4`,stroke:`#f472b6`,selectedFill:`#ec4899`,selectedStroke:`#db2777`,text:`#111827`,selectedText:`#111827`,shadow:`rgb(244 114 182 / 18%)`,connection:`#f472b6`}:{fill:`#fdba74`,stroke:`#f97316`,selectedFill:`#fb923c`,selectedStroke:`#ea580c`,text:`#111827`,selectedText:`#111827`,shadow:`rgb(249 115 22 / 18%)`,connection:`#f97316`}}return{fill:`#ffffff`,stroke:`#0f172a`,selectedFill:`#111827`,selectedStroke:`#0f172a`,text:`#111827`,selectedText:`#ffffff`,shadow:`rgb(15 23 42 / 8%)`,connection:`#111827`}}function pg(e,t,n){t&&(Z.beginPath(),Z.arc(e.x+n*.62,e.y-n*.66,5,0,Math.PI*2),Z.fillStyle=`#34d399`,Z.fill())}function mg(e,t){if(!$h())return;let n=Mg(e),r=Math.min(bp,t-118),i=e-n-24,a=Math.max(24,(t-r)/2);try{let e=Z.drawElementImage(Cm,i,a,n,r);Cm.style.transform=e.toString()}catch{Yp.textContent=`Waiting for HTML snapshot`}}function hg(e,t){let n=Jp.clientWidth,r=Jp.clientHeight,i=$h()?Mg(n)+xp:0,a=Math.max(360,n-i),o=xg(),s=Sg(o,a,r),c=t?s:Math.min($.zoom,s),l=(o.minX+o.maxX)/2,u=(o.minY+o.maxY)/2,d=a*.5-l*c,f=r*.5-u*c;if(!e||!$.cameraX||!$.cameraY){Cg(),$.cameraX=d,$.cameraY=f,$.zoom=c,$.panelShiftX=i;return}$.panelShiftX=i,bg(d,f,c)}function gg(e,t,n){if(t){if(e){let e=_g();$.panelShiftX+=Math.max(0,-e),yg(e,n)}else{let e=$h();if(e){let t=Mg(Jp.clientWidth)+xp,n=(Jp.clientWidth-t)/2-e.x*$.zoom,r=n-$.cameraX;$.panelShiftX=-r,bg(n,$.cameraY,$.zoom)}}return}if(!e)return;let r=$.panelShiftX;$.panelShiftX=0,yg(r,n)}function _g(){let e=$h();if(!e)return 0;let t=Jp.clientWidth-Mg(Jp.clientWidth)-24-jp,n=vg(e);return n.right<=t?0:t-n.right}function vg(e){let t=Fg(e);return{left:t.left*$.zoom+$.cameraX,top:t.top*$.zoom+$.cameraY,right:t.right*$.zoom+$.cameraX,bottom:t.bottom*$.zoom+$.cameraY}}function yg(e,t){if(Cg(),!e)return;let n=$.cameraX+e;if(!t){$.cameraX=n;return}bg(n,$.cameraY,$.zoom)}function bg(e,t,n){Cg();let r=$.cameraX,i=$.cameraY,a=$.zoom,o=performance.now();function s(c){let l=Math.min(1,(c-o)/kp),u=1-(1-l)**3;$.cameraX=r+(e-r)*u,$.cameraY=i+(t-i)*u,$.zoom=a+(n-a)*u,ih(),ig(),l<1?$.viewAnimationId=requestAnimationFrame(s):$.viewAnimationId=null}$.viewAnimationId=requestAnimationFrame(s)}function xg(){return $.entities.reduce((e,t)=>{let n=hh(t);return{minX:Math.min(e.minX,t.x-n),minY:Math.min(e.minY,t.y-n),maxX:Math.max(e.maxX,t.x+n),maxY:Math.max(e.maxY,t.y+n)}},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0})}function Sg(e,t,n){let r=e.maxX-e.minX,i=e.maxY-e.minY;if(!Number.isFinite(r)||!Number.isFinite(i)||r<=0||i<=0)return 1;let a=Math.max(1,t-Ap*2),o=Math.max(1,n-Ap*2);return Eg(Math.min(1,a/r,o/i),Np,1)}function Cg(){$.viewAnimationId&&(cancelAnimationFrame($.viewAnimationId),$.viewAnimationId=null)}function wg(e,t){Cg();let n=Tg(e);$.zoom=Eg($.zoom*t,Np,Pp),$.cameraX=e.x-n.x*$.zoom,$.cameraY=e.y-n.y*$.zoom,ig()}function Tg(e){return{x:(e.x-$.cameraX)/$.zoom,y:(e.y-$.cameraY)/$.zoom}}function Eg(e,t,n){return Math.min(n,Math.max(t,e))}function Dg(e,t){if(e.kind!==`system`&&e.kind!==`llm`)return Ag(e,t);let n=e.kind===`system`?fp:pp,r=ng(e.id);return Og(e,n,Math.max(mp,r.length),t)||{x:e.x+Math.cos(t)*n,y:e.y+Math.sin(t)*n}}function Og(e,t,n,r){let i={x:Math.cos(r),y:Math.sin(r)},a=zg(e.x,e.y,t,n),o=null;for(let t=0;t<a.length;t+=1){let n=a[t],r=a[(t+1)%a.length],s={x:r.x-n.x,y:r.y-n.y},c={x:n.x-e.x,y:n.y-e.y},l=kg(i,s);if(Math.abs(l)<1e-4)continue;let u=kg(c,s)/l,d=kg(c,i)/l;if(u>=0&&d>=0&&d<=1){let t={x:e.x+i.x*u,y:e.y+i.y*u};(!o||u<o.rayDistance)&&(o={...t,rayDistance:u})}}return o?{x:o.x,y:o.y}:null}function kg(e,t){return e.x*t.y-e.y*t.x}function Ag(e,t){let n=Ng(e),r=n.width/2,i=n.height/2,a=Math.cos(t),o=Math.sin(t),s=Math.min(Math.abs(r/(a||2**-52)),Math.abs(i/(o||2**-52)));return{x:e.x+a*s,y:e.y+o*s}}function jg(e,t){if(e.kind===`system`||e.kind===`llm`){let n=e.kind===`system`?fp:pp;return Math.hypot(t.x-e.x,t.y-e.y)<=n+Op}let{width:n,height:r}=Ng(e);return Math.abs(t.x-e.x)<=n/2+Op&&Math.abs(t.y-e.y)<=r/2+Op}function Mg(e){return Math.min(vp,Math.max(_p,Math.floor(e*yp)))}function Ng(e){return e.kind===`mcp`?{width:116,height:58}:{width:up,height:dp}}function Pg(e){return[e,...rg(e.id).map(eg)].filter(Boolean).map(Fg).reduce(Ig)}function Fg(e){if(e.kind===`system`||e.kind===`llm`){let t=e.kind===`system`?fp:pp;return{left:e.x-t,top:e.y-t,right:e.x+t,bottom:e.y+t}}let{width:t,height:n}=Ng(e);return{left:e.x-t/2,top:e.y-n/2,right:e.x+t/2,bottom:e.y+n/2}}function Ig(e,t){return{left:Math.min(e.left,t.left),top:Math.min(e.top,t.top),right:Math.max(e.right,t.right),bottom:Math.max(e.bottom,t.bottom)}}function Lg(e,t,n){return!(e.right+n<t.left||e.left-n>t.right||e.bottom+n<t.top||e.top-n>t.bottom)}function Rg(e){let t=Jp.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}function zg(e,t,n,r){return Array.from({length:r},(i,a)=>{let o=-Math.PI/2+a/r*Math.PI*2;return{x:e+Math.cos(o)*n,y:t+Math.sin(o)*n}})}function Bg(e,t,n,r,i){let a=e+n,o=t+r;Z.beginPath(),Z.moveTo(e+i,t),Z.lineTo(a-i,t),Z.quadraticCurveTo(a,t,a,t+i),Z.lineTo(a,o-i),Z.quadraticCurveTo(a,o,a-i,o),Z.lineTo(e+i,o),Z.quadraticCurveTo(e,o,e,o-i),Z.lineTo(e,t+i),Z.quadraticCurveTo(e,t,e+i,t),Z.closePath()}function Vg(e,t,n,r,i){let a=e.split(/\s+/),o=[],s=``;for(let e of a){let t=s?`${s} ${e}`:e;Z.measureText(t).width>r&&s?(o.push(s),s=e):s=t}o.push(s);let c=n-(o.length-1)*i/2;o.forEach((e,n)=>{Z.fillText(e,t,c+n*i)})}function Hg(e,t,n,r){Z.beginPath(),Z.moveTo(e,t),Z.lineTo(n,r),Z.stroke()}var Ug=U(`<div class="status-row"><span id="apiStatus"></span></div>`),Wg=U('<div class="app-shell"><!> <section class="workspace-shell" aria-label="Configuration graph workspace"><nav class="rail" aria-label="Workspace tools"><button id="addButton" class="tool-button primary" type="button" title="Add node">+</button> <button id="fitButton" class="tool-button" type="button" title="Fit view">⌖</button></nav> <canvas id="workspaceCanvas" class="workspace-canvas" layoutsubtree=""><form id="configSurface" class="config-surface" autocomplete="off"><div class="panel-kicker"><span id="nodeTypeBadge">Provider</span> <button id="closePanelButton" class="icon-button close" type="button" title="Close panel">×</button></div> <div class="panel-title-row"><label class="eyebrow" for="nodeName">Node name</label> <input id="nodeName" name="nodeName" class="title-input" type="text"/></div> <div class="form-grid"><label class="field"><span>Kind</span> <select id="nodeKind" name="nodeKind"><option>System</option><option>LLM provider</option><option>Agent</option><option>MCP</option></select></label> <div id="llmFields" class="contents"><div id="providerIdField" class="field wide"><span>Provider ID</span> <div class="model-select-wrap"><input id="nodeProviderId" name="nodeProviderId" type="text" readonly=""/> <button id="copyProviderIdButton" class="icon-button" type="button" title="Copy provider ID">⧉</button></div> <small class="field-note">Technical node id. Use it when a tool or agent workflow needs to reference this provider, for example as <code>imageProviderId</code> with <code>generate_image</code>.</small></div> <label class="field wide"><span>Endpoint</span> <input id="nodeEndpoint" name="nodeEndpoint" type="url" placeholder="http://localhost:11434"/></label> <label class="field wide"><span>API token</span> <input id="nodeToken" name="nodeToken" type="text" autocomplete="off" spellcheck="false" placeholder="env:LLM_API_KEY"/> <small class="field-note">Reference an environment variable only — <code>env:VAR_NAME</code> (or <code>{VAR_NAME}</code>). The secret is read from the server environment at request time; literal tokens are not stored (the workspace file is tracked by git).</small></label> <div class="field wide model-field-row"><span> </span> <input id="nodeModelFilter" class="model-filter" type="search" role="combobox" aria-autocomplete="list" aria-controls="nodeModelResults" aria-expanded="false" autocomplete="off" spellcheck="false" hidden=""/> <ul id="nodeModelResults" class="model-results" role="listbox" hidden=""></ul> <div class="model-select-wrap"><select id="nodeModel" name="nodeModel"><option disabled="" selected=""> </option></select> <button id="loadModelsButton" class="icon-button" type="button">↻</button></div></div> <fieldset class="field wide tool-mode-field"><legend>Provider type</legend> <label class="radio-card"><input id="nodeProviderTypeChat" name="nodeProviderType" type="radio" value="chat"/> <span><strong>Chat completion</strong> <small>Uses OpenAI-compatible <code>/chat/completions</code>.</small></span></label> <label class="radio-card"><input id="nodeProviderTypeImage" name="nodeProviderType" type="radio" value="image"/> <span><strong>Image generation</strong> <small>Used by <code>generate_image</code> with the provider id above.</small></span></label></fieldset> <fieldset id="toolModeField" class="field wide tool-mode-field"><legend>Tool calling</legend> <label class="radio-card"><input id="nodeToolModeTools" name="nodeToolMode" type="radio" value="tools"/> <span><strong>Allow MCP tools</strong> <small>Agents can send OpenAI-compatible <code>tools</code> payloads.</small></span></label> <label class="radio-card"><input id="nodeToolModeChat" name="nodeToolMode" type="radio" value="chat"/> <span><strong>Chat only</strong> <small>Agents never send tools, even when an MCP endpoint exists.</small></span></label></fieldset> <label class="field"><span>Timeout</span> <input id="nodeTimeout" name="nodeTimeout" type="number" min="1" max="600" step="1"/></label></div> <label class="field wide"><span>Description</span> <textarea id="nodeDescription" name="nodeDescription" rows="3"></textarea></label></div> <section id="agentSection" class="agent-section" hidden=""><label id="agentProviderField" class="field wide"><span>LLM provider</span> <select id="nodeAgentProvider" name="nodeAgentProvider"></select> <small class="field-note">Move this agent to another LLM provider. It inherits the target provider\'s model and timeout.</small></label> <label id="agentWorkspaceField" class="field wide"><span>Workspace folder</span> <input id="nodeWorkspaceFolder" name="nodeWorkspaceFolder" type="text" readonly=""/></label> <label class="field wide"><span>System prompt</span> <textarea id="nodeSystemPrompt" name="nodeSystemPrompt" rows="5" placeholder="You are a helpful assistant…"></textarea></label> <label class="field wide checkbox-field"><input id="nodeRequiresUserInput" name="nodeRequiresUserInput" type="checkbox"/> <span>Require a user input</span></label> <label id="agentUserInputDescriptionField" class="field wide" hidden=""><span>Describe User input</span> <textarea id="nodeUserInputDescription" name="nodeUserInputDescription" rows="3" placeholder="Describe exactly what the user must provide before running this agent."></textarea></label> <label class="field wide"><span>Required output marker</span> <input id="nodeExpectedOutputMarker" name="nodeExpectedOutputMarker" type="text" placeholder="Optional, e.g. ```mermaid"/></label></section> <section id="mcpInventory" class="mcp-inventory" hidden=""><div class="inventory-header"><span>MCP consultation surface</span> <strong>Streamable HTTP</strong></div> <p id="mcpInventoryStatus" class="inventory-status" hidden=""></p> <div class="inventory-grid"><article><h2>Tools</h2> <ul id="mcpToolsList"></ul></article> <article><h2>Prompts</h2> <ul id="mcpPromptsList"></ul></article></div></section> <footer class="panel-actions"><div class="panel-actions-left"><button id="testNodeButton" class="secondary-button" type="button">Test</button></div> <div class="panel-actions-right"><button id="deleteNodeButton" class="danger-button" type="button">Delete</button></div></footer></form></canvas> <div id="fallbackPanelHost" class="fallback-panel-host" hidden=""></div></section> <div id="deleteConfirmOverlay" class="confirm-overlay" hidden=""><section class="confirm-dialog" role="dialog" aria-modal="true" aria-labelledby="deleteConfirmTitle"><div><p class="confirm-kicker">Destructive change</p> <h2 id="deleteConfirmTitle">Delete node?</h2> <p id="deleteConfirmMessage" class="confirm-message"></p></div> <footer class="confirm-actions"><button id="cancelDeleteButton" class="secondary-button" type="button">Cancel</button> <button id="confirmDeleteButton" class="danger-button" type="button">Delete</button></footer></section></div> <div id="renameConfirmOverlay" class="confirm-overlay" hidden=""><section class="confirm-dialog" role="dialog" aria-modal="true" aria-labelledby="renameConfirmTitle"><div><p class="confirm-kicker">Renommage de dossier</p> <h2 id="renameConfirmTitle">Renommer le dossier ?</h2> <p id="renameConfirmMessage" class="confirm-message"></p></div> <footer class="confirm-actions"><button id="cancelRenameButton" class="secondary-button" type="button">Annuler</button> <button id="confirmRenameButton" class="primary-button" type="button">Renommer</button></footer></section></div> <div id="agentRunOverlay" class="confirm-overlay" hidden=""><section class="agent-run-dialog" role="dialog" aria-modal="true" aria-labelledby="agentRunTitle"><div><p class="confirm-kicker">Agent test</p> <h2 id="agentRunTitle">Run agent</h2> <p id="agentRunHint" class="confirm-message"></p></div> <label id="agentRunInputField" class="field wide agent-run-input-field"><span>User input</span> <textarea id="agentRunInput" name="agentRunInput" rows="6" placeholder="Document ID, question, or any input for the agent…"></textarea></label> <div id="agentRunResult" class="agent-run-result" hidden=""></div> <footer class="confirm-actions"><button id="cancelAgentRunButton" class="secondary-button" type="button">Close</button> <button id="executeAgentRunButton" class="primary-button" type="button">Run</button></footer></section></div></div>');function Gg(e,t){qe(t,!0),Ji(async()=>{try{await Ca((await fetch(`/api/config`).then(e=>e.json())).language||`en`)}catch{}return Am()});var n=Wg(),r=L(n);es(r,{title:`Living AI Documentation`,subtitle:`Graph-native configuration workspace`,children:(e,t)=>{var n=Ug(),r=L(n);vi(r,1,`status-pill `),r.textContent=`Detecting canvas API`,j(n),W(e,n)},$$slots:{default:!0}});var i=z(r,2),a=z(L(i),2),o=L(a),s=z(L(o),4),c=L(s),l=z(L(c),2),u=L(l);u.value=u.__value=`system`;var d=z(u);d.value=d.__value=`llm`;var f=z(d);f.value=f.__value=`agent`;var p=z(f);p.value=p.__value=`mcp`,j(l),j(c);var m=z(c,2),h=z(L(m),6),g=L(h),_=L(g,!0);j(g);var v=z(g,2),y=z(v,4),b=L(y),x=L(b),S=L(x,!0);j(x),x.value=x.__value=``,j(b);var C=z(b,2);j(y),j(h),Ie(6),j(m),Ie(2),j(s),Ie(6),j(o),j(a),Ie(2),j(i),Ie(6),j(n),B((e,t,n,r)=>{G(_,e),J(v,`placeholder`,t),G(S,n),J(C,`title`,r)},[()=>Y(`workspace.model.label`),()=>Y(`workspace.model.filter_placeholder`),()=>Y(`workspace.model.placeholder`),()=>Y(`workspace.model.load`)]),W(e,n),Je()}var Kg=U(`<p class="files-msg svelte-4q2lov"> </p>`),qg=U(`<p class="files-msg files-msg--error svelte-4q2lov"> </p>`),Jg=U(`<p class="files-msg files-msg--empty svelte-4q2lov"> </p>`),Yg=U(`<option> </option>`),Xg=U(`<div class="files-toolbar svelte-4q2lov"><label for="files-folder-filter" class="svelte-4q2lov"> </label> <select id="files-folder-filter" data-testid="files-folder-filter" class="svelte-4q2lov"><option> </option><!></select></div>`),Zg=U(`<span class="files-folder svelte-4q2lov"> </span> ·`,1),Qg=U(`<p class="files-row-error svelte-4q2lov"> </p>`),$g=U(`<li class="files-row svelte-4q2lov"><span class="files-icon svelte-4q2lov">📎</span> <div class="files-info svelte-4q2lov"><a target="_blank" rel="noopener" class="files-name svelte-4q2lov"> </a> <div class="files-meta svelte-4q2lov"><!><!> </div> <!></div> <div class="files-actions svelte-4q2lov"><button type="button" class="files-btn svelte-4q2lov"> </button> <button type="button" class="files-btn files-btn--danger svelte-4q2lov"> </button></div></li>`),e_=U(`<ul class="files-list svelte-4q2lov"></ul>`),t_=U(`<!> <!>`,1),n_=U(`<!> <div class="app-shell"><!> <div class="files-page svelte-4q2lov"><!></div></div>`,1);function r_(e,t){qe(t,!0);let n=P(null),r=P(I([])),i=P(I([])),a=P(``),o=P(!0),s=P(``),c=P(I({})),l=P(I({})),u=P(I({})),d=Lf,f=N(()=>V(a)?V(r).filter(e=>e.folder===V(a)||e.folder.startsWith(V(a)+`/`)):V(r));function p(e){return e<1024?Y(`files.size_bytes`).replace(`{n}`,String(e)):e<1024*1024?Y(`files.size_kb`).replace(`{n}`,(e/1024).toFixed(1)):Y(`files.size_mb`).replace(`{n}`,(e/1024/1024).toFixed(2))}function m(e){if(!e)return``;let t=new Date(e);if(isNaN(t.getTime()))return``;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}async function h(){F(o,!0),F(s,``);try{let e=await fetch(`/api/files`);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();F(r,Array.isArray(t.files)?t.files:[],!0),F(i,Array.isArray(t.folders)?t.folders:[],!0),V(a)&&!V(i).includes(V(a))&&F(a,``)}catch(e){F(s,Y(`files.error_load`)+(e instanceof Error?e.message:String(e)))}finally{F(o,!1)}}function g(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=n,r.readAsDataURL(e)})}function _(e){let t=document.createElement(`input`);t.type=`file`,t.style.display=`none`,document.body.appendChild(t),t.addEventListener(`change`,async()=>{let r=t.files?.[0];if(t.remove(),r&&await V(n).show({kicker:Y(`files.confirm_replace_title`),title:Y(`files.confirm_replace_message`).replace(`{name}`,e.displayName||e.filename).replace(`{newName}`,r.name),message:Y(`files.confirm_replace_detail`),confirmLabel:Y(`files.replace`),cancelLabel:Y(`common.cancel`),danger:!0})){if(r.size>d){F(c,{...V(c),[e.filename]:Y(`files.error_replace`)+`${(r.size/1024/1024).toFixed(1)} MB (max ${Rf} MB)`},!0);return}F(l,{...V(l),[e.filename]:!0},!0),F(c,{...V(c),[e.filename]:``},!0);try{let t=await g(r),n=await fetch(`/api/files/${encodeURIComponent(e.filename)}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:t})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error||`HTTP ${n.status}`)}await h()}catch(t){F(c,{...V(c),[e.filename]:Y(`files.error_replace`)+(t instanceof Error?t.message:String(t))},!0)}finally{F(l,{...V(l),[e.filename]:!1},!0)}}}),t.click()}async function v(e){if(await V(n).show({kicker:Y(`files.confirm_delete_title`),title:Y(`files.confirm_delete_message`).replace(`{name}`,e.displayName||e.filename),message:Y(`files.confirm_delete_detail`),confirmLabel:Y(`files.delete`),cancelLabel:Y(`common.cancel`),danger:!0})){F(u,{...V(u),[e.filename]:!0},!0),F(c,{...V(c),[e.filename]:``},!0);try{let t=await fetch(`/api/files/${encodeURIComponent(e.filename)}`,{method:`DELETE`});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error||`HTTP ${t.status}`)}await h()}catch(t){F(c,{...V(c),[e.filename]:Y(`files.error_delete`)+(t instanceof Error?t.message:String(t))},!0)}finally{F(u,{...V(u),[e.filename]:!1},!0)}}}Ji(async()=>{try{await Ca((await fetch(`/api/config`).then(e=>e.json())).language||`en`)}catch{}await h()});var y=n_(),b=R(y);Ui($d(b,{}),e=>F(n,e,!0),()=>V(n));var x=z(b,2),S=L(x);{let e=N(()=>Y(`files.title`));es(S,{get title(){return V(e)},subtitle:``})}var C=z(S,2),w=L(C),T=e=>{var t=Kg(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`common.loading`)]),W(e,t)},E=e=>{var t=qg(),n=L(t,!0);j(t),B(()=>G(n,V(s))),W(e,t)},D=e=>{var t=Jg(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`files.empty`)]),W(e,t)},ee=e=>{var t=t_(),n=R(t),r=e=>{var t=Xg(),n=L(t),r=L(n,!0);j(n);var o=z(n,2),s=L(o),c=L(s,!0);j(s),s.value=s.__value=``,q(z(s),16,()=>V(i),e=>e,(e,t)=>{var n=Yg(),r=L(n,!0);j(n);var i={};B(()=>{G(r,t),i!==(i=t)&&(n.value=(n.__value=t)??``)}),W(e,n)}),j(o);var l;Si(o),j(t),B((e,t)=>{G(r,e),G(c,t),l!==(l=V(a))&&(o.value=(o.__value=V(a))??``,xi(o,V(a)))},[()=>Y(`files.filter_label`),()=>Y(`files.filter_all`)]),H(`change`,o,e=>F(a,e.target.value,!0)),W(e,t)};K(n,e=>{V(i).length>0&&e(r)});var o=z(n,2),s=e=>{var t=Jg(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`files.empty_filter`)]),W(e,t)},d=e=>{var t=e_();q(t,21,()=>V(f),Qr,(e,t)=>{var n=$g(),r=z(L(n),2),i=L(r),a=L(i,!0);j(i);var o=z(i,2),s=L(o),d=e=>{var n=Zg(),r=R(n),i=L(r,!0);j(r),Ie(),B(()=>G(i,V(t).folder)),W(e,n)};K(s,e=>{V(t).folder&&e(d)});var f=z(s),h=e=>{var n=Ur();B(e=>G(n,`${e??``} ·`),[()=>m(V(t).uploadedAt)]),W(e,n)};K(f,e=>{V(t).uploadedAt&&e(h)});var g=z(f,1,!0);j(o);var y=z(o,2),b=e=>{var n=Qg(),r=L(n,!0);j(n),B(()=>G(r,V(c)[V(t).filename])),W(e,n)};K(y,e=>{V(c)[V(t).filename]&&e(b)}),j(r);var x=z(r,2),S=L(x),C=L(S,!0);j(S);var w=z(S,2),T=L(w,!0);j(w),j(x),j(n),B((e,n,r)=>{J(i,`href`,V(t).url),G(a,V(t).displayName||V(t).filename),G(g,e),S.disabled=V(l)[V(t).filename]||V(u)[V(t).filename],G(C,n),w.disabled=V(l)[V(t).filename]||V(u)[V(t).filename],G(T,r)},[()=>p(V(t).size||0),()=>V(l)[V(t).filename]?Y(`files.replacing`):Y(`files.replace`),()=>V(u)[V(t).filename]?Y(`files.deleting`):Y(`files.delete`)]),H(`click`,S,()=>_(V(t))),H(`click`,w,()=>v(V(t))),W(e,n)}),j(t),W(e,t)};K(o,e=>{V(f).length===0?e(s):e(d,-1)}),W(e,t)};K(w,e=>{V(o)?e(T):V(s)?e(E,1):V(r).length===0?e(D,2):e(ee,-1)}),j(C),j(x),W(e,y),Je()}Pr([`change`,`click`]);var i_=U(`<p class="browser-msg"> </p>`),a_=U(`<p class="browser-msg browser-msg--error"> </p>`),o_=U(`<button class="browser-row browser-row--dir"><span class="browser-row-name"> </span></button>`),s_=U(`<span class="badge-added"> </span>`),c_=U(`<button class="link-btn"> </button>`),l_=U(`<div class="browser-row browser-row--file"><span class="browser-row-name"> </span> <!></div>`),u_=U(`<!> <!>`,1),d_=U(`<div class="file-browser"><div class="file-browser-toolbar"><button class="link-btn"> </button> <span class="file-browser-path"> </span></div> <div class="file-browser-list" data-testid="instruction-browse-list"><!></div></div>`),f_=U(`<p class="empty-msg svelte-e5jhdq"> </p>`),p_=U(`<button class="remove-btn"> </button>`),m_=U(`<div class="instruction-row svelte-e5jhdq"><div class="instruction-info svelte-e5jhdq"><a class="instruction-path svelte-e5jhdq"> </a> <div class="instruction-meta svelte-e5jhdq"> <!></div></div> <div class="instruction-actions svelte-e5jhdq"><span> </span> <!></div></div>`),h_=U(`<div class="section-card svelte-e5jhdq"><div class="section-header svelte-e5jhdq"><span class="section-title svelte-e5jhdq"> </span> <div class="header-actions svelte-e5jhdq"><span class="count-label svelte-e5jhdq"> </span> <button class="secondary-button btn-sm"> </button></div></div> <!> <div class="instruction-list svelte-e5jhdq" data-testid="instruction-list"><!></div></div>`);function g_(e,t){qe(t,!0);let n=qi(t,`items`,27,()=>I([])),r=P(!1),i=P(``),a=P(``),o=P(I([])),s=P(I([])),c=P(!1),l=P(!1),u=N(()=>new Set(n().map(e=>d(e.path))));function d(e){return String(e||``).split(/[/\\]/).pop()||``}function f(e){let t=encodeURIComponent(String(e||``).replace(/\.md$/i,``));return`/?doc=`+encodeURIComponent(t)}function p(e){return Y(`context.root.${e}`)}function m(e){return Y(`context.type.${e}`)}async function h(e){F(c,!0),F(l,!1);try{let t=await fetch(`/api/browse?path=`+encodeURIComponent(e)).then(e=>e.json());F(i,t.current,!0),F(a,t.parent||``,!0),F(o,t.dirs||[],!0),F(s,t.files||[],!0)}catch{F(l,!0)}finally{F(c,!1)}}async function g(){F(r,!V(r)),V(r)&&!V(i)&&await h((await fetch(`/api/context/orientation`).then(e=>e.json()).catch(()=>({}))).sourceRoot||``)}async function _(e){await t.onAdd(e),V(r)&&V(i)&&await h(V(i))}var v=h_(),y=L(v),b=L(y),x=L(b,!0);j(b);var S=z(b,2),C=L(S),w=L(C);j(C);var T=z(C,2),E=L(T,!0);j(T),j(S),j(y);var D=z(y,2),ee=e=>{var t=d_(),n=L(t),r=L(n),d=L(r,!0);j(r);var f=z(r,2),p=L(f,!0);j(f),j(n);var m=z(n,2),g=L(m),v=e=>{var t=i_(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`common.loading`)]),W(e,t)},y=e=>{var t=a_(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`common.cannot_read_dir`)]),W(e,t)},b=e=>{var t=i_(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`common.empty_dir`)]),W(e,t)},x=e=>{var t=u_(),n=R(t);q(n,17,()=>V(o),Qr,(e,t)=>{var n=o_(),r=L(n),i=L(r);j(r),j(n),B(()=>G(i,`📁 ${V(t).name??``}`)),H(`click`,n,()=>h(V(t).path)),W(e,n)}),q(z(n,2),17,()=>V(s),Qr,(e,t)=>{var n=l_(),r=L(n),i=L(r);j(r);var a=z(r,2),o=e=>{var t=s_(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`context.added`)]),W(e,t)},s=N(()=>V(u).has(V(t).name)),c=e=>{var n=c_(),r=L(n,!0);j(n),B(e=>G(r,e),[()=>Y(`context.add_file_action`)]),H(`click`,n,()=>_(V(t).path)),W(e,n)};K(a,e=>{V(s)?e(o):e(c,-1)}),j(n),B(()=>G(i,`📄 ${V(t).name??``}`)),W(e,n)}),W(e,t)};K(g,e=>{V(c)?e(v):V(l)?e(y,1):!V(o).length&&!V(s).length?e(b,2):e(x,-1)}),j(m),j(t),B(e=>{r.disabled=!V(a),G(d,e),G(p,V(i))},[()=>Y(`common.up`)]),H(`click`,r,()=>V(a)&&h(V(a))),W(e,t)};K(D,e=>{V(r)&&e(ee)});var te=z(D,2),O=L(te),ne=e=>{var t=f_(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`context.no_instructions`)]),W(e,t)},k=e=>{var r=Wr();q(R(r),17,n,Qr,(e,n)=>{var r=m_(),i=L(r),a=L(i),o=L(a,!0);j(a);var s=z(a,2),c=L(s),l=z(c),u=e=>{var t=Ur();B(e=>G(t,`· ${e??``} KB`),[()=>Math.round(V(n).size/1024)]),W(e,t)};K(l,e=>{V(n).size!==null&&e(u)}),j(s),j(i);var h=z(i,2),g=L(h),_=L(g,!0);j(g);var v=z(g,2),y=e=>{var r=p_(),i=L(r,!0);j(r),B(e=>G(i,e),[()=>Y(`common.remove`)]),H(`click`,r,()=>t.onRemove(d(V(n).path))),W(e,r)};K(v,e=>{V(n).exists&&e(y)}),j(h),j(r),B((e,t,r,i)=>{J(a,`href`,e),G(o,V(n).path),G(c,`${t??``} · ${r??``} `),vi(g,1,fi(V(n).exists?`status-ok`:`status-missing`),`svelte-e5jhdq`),G(_,i)},[()=>f(V(n).path),()=>p(V(n).root),()=>m(V(n).type),()=>V(n).exists?Y(`context.exists`):Y(`context.missing`)]),W(e,r)}),W(e,r)};K(O,e=>{n().length?e(k,-1):e(ne)}),j(te),j(v),B((e,t,r)=>{G(x,e),G(w,`${t??``}/${n().length??``}`),G(E,r)},[()=>Y(`context.instructions_title`),()=>n().filter(e=>e.exists).length,()=>V(r)?Y(`context.hide_instruction_browser`):Y(`context.add_instruction_file`)]),H(`click`,T,g),W(e,v),Je()}Pr([`click`]);var __=U(`<span class="rules-folder svelte-1r3tey2"> </span>`),v_=U(`<p class="empty-msg svelte-1r3tey2"> </p>`),y_=U(`<span class="tag svelte-1r3tey2"> </span>`),b_=U(`<div class="rule-tags svelte-1r3tey2"></div>`),x_=U(`<div class="rule-applies svelte-1r3tey2"> </div>`),S_=U(`<article class="rule-row svelte-1r3tey2"><div class="rule-top svelte-1r3tey2"><div class="rule-title-wrap svelte-1r3tey2"><h3 class="rule-title svelte-1r3tey2"><a class="rule-link svelte-1r3tey2"> </a></h3> <a class="rule-path svelte-1r3tey2"> </a></div> <span class="severity-badge svelte-1r3tey2"> </span></div> <p class="rule-desc svelte-1r3tey2"> </p> <!> <!></article>`),C_=U(`<div class="rules-layout svelte-1r3tey2"><div class="section-card svelte-1r3tey2"><div class="section-header svelte-1r3tey2"><span class="section-title svelte-1r3tey2" data-testid="rules-title"> </span> <!></div> <div class="rule-list svelte-1r3tey2" data-testid="rule-list"><!></div></div> <div class="section-card aside-card svelte-1r3tey2"><span class="section-title svelte-1r3tey2" data-testid="add-rule-title"> </span> <div class="field-group"><label class="field-label" for="ruleTitle"> </label> <input id="ruleTitle" class="field-input"/></div> <div class="field-group"><label class="field-label" for="ruleSeverity"> </label> <select id="ruleSeverity" class="field-input"><option> </option><option> </option><option> </option></select></div> <div class="field-group"><label class="field-label" for="ruleDescription"> </label> <input id="ruleDescription" class="field-input"/></div> <div class="field-group"><label class="field-label" for="ruleTags"> </label> <input id="ruleTags" class="field-input"/></div> <div class="field-group"><label class="field-label" for="ruleAppliesTo"> </label> <input id="ruleAppliesTo" class="field-input"/></div> <div class="field-group"><label class="field-label" for="ruleBody"> </label> <textarea id="ruleBody" rows="7" class="field-input"></textarea></div> <button class="btn-primary" style="width:100%"> </button></div></div>`);function w_(e,t){qe(t,!0);let n=qi(t,`rules`,19,()=>[]),r=qi(t,`rulesFolder`,3,``),i=P(``),a=P(`guideline`),o=P(``),s=P(``),c=P(``),l=P(``),u=P(!1);function d(e){let t=encodeURIComponent(String(e||``).replace(/\.md$/i,``));return`/?doc=`+encodeURIComponent(t)}function f(e){let t=`context.rule_severity_${e}`,n=Y(t);return n===t?e:n}function p(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}async function m(){if(V(i).trim()){F(u,!0);try{await t.onAdd({title:V(i).trim(),severity:V(a),description:V(o).trim(),tags:p(V(s)),appliesTo:p(V(c)),body:V(l).trim()}),F(i,``),F(o,``),F(s,``),F(c,``),F(l,``)}finally{F(u,!1)}}}var h=C_(),g=L(h),_=L(g),v=L(_),y=L(v,!0);j(v);var b=z(v,2),x=e=>{var t=__(),n=L(t,!0);j(t),B(()=>G(n,r())),W(e,t)};K(b,e=>{r()&&e(x)}),j(_);var S=z(_,2),C=L(S),w=e=>{var t=v_(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`context.no_rules`)]),W(e,t)},T=e=>{var t=Wr();q(R(t),17,n,Qr,(e,t)=>{var n=S_(),r=L(n),i=L(r),a=L(i),o=L(a),s=L(o,!0);j(o),j(a);var c=z(a,2),l=L(c,!0);j(c),j(i);var u=z(i,2),p=L(u,!0);j(u),j(r);var m=z(r,2),h=L(m,!0);j(m);var g=z(m,2),_=e=>{var n=b_();q(n,21,()=>V(t).tags,Qr,(e,t)=>{var n=y_(),r=L(n,!0);j(n),B(()=>G(r,V(t))),W(e,n)}),j(n),W(e,n)};K(g,e=>{V(t).tags?.length&&e(_)});var v=z(g,2),y=e=>{var n=x_(),r=L(n,!0);j(n),B(e=>G(r,e),[()=>V(t).appliesTo.join(`, `)]),W(e,n)};K(v,e=>{V(t).appliesTo?.length&&e(y)}),j(n),B((e,n,r)=>{J(o,`href`,e),G(s,V(t).title),J(c,`href`,n),G(l,V(t).path),G(p,r),G(h,V(t).description)},[()=>d(V(t).path),()=>d(V(t).path),()=>f(V(t).severity)]),W(e,n)}),W(e,t)};K(C,e=>{n().length?e(T,-1):e(w)}),j(S),j(g);var E=z(g,2),D=L(E),ee=L(D,!0);j(D);var te=z(D,2),O=L(te),ne=L(O,!0);j(O);var k=z(O,2);ki(k),j(te);var A=z(te,2),re=L(A),ie=L(re,!0);j(re);var ae=z(re,2),oe=L(ae),se=L(oe,!0);j(oe),oe.value=oe.__value=`guideline`;var ce=z(oe),le=L(ce,!0);j(ce),ce.value=ce.__value=`warning`;var ue=z(ce),de=L(ue,!0);j(ue),ue.value=ue.__value=`required`,j(ae),j(A);var fe=z(A,2),pe=L(fe),me=L(pe,!0);j(pe);var he=z(pe,2);ki(he),j(fe);var ge=z(fe,2),_e=L(ge),ve=L(_e,!0);j(_e);var ye=z(_e,2);ki(ye),j(ge);var be=z(ge,2),xe=L(be),Se=L(xe,!0);j(xe);var Ce=z(xe,2);ki(Ce),j(be);var we=z(be,2),Te=L(we),Ee=L(Te,!0);j(Te);var De=z(Te,2);yn(De),j(we);var Oe=z(we,2),ke=L(Oe,!0);j(Oe),j(E),j(h),B((e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_)=>{G(y,e),G(ee,t),G(ne,n),J(k,`placeholder`,r),G(ie,i),G(se,a),G(le,o),G(de,s),G(me,c),J(he,`placeholder`,l),G(ve,u),J(ye,`placeholder`,d),G(Se,f),J(Ce,`placeholder`,p),G(Ee,m),J(De,`placeholder`,h),Oe.disabled=g,G(ke,_)},[()=>Y(`context.rules_title`),()=>Y(`context.add_rule_title`),()=>Y(`context.rule_title_label`),()=>Y(`context.rule_title_placeholder`),()=>Y(`context.rule_severity_label`),()=>Y(`context.rule_severity_guideline`),()=>Y(`context.rule_severity_warning`),()=>Y(`context.rule_severity_required`),()=>Y(`context.rule_description_label`),()=>Y(`context.rule_description_placeholder`),()=>Y(`context.rule_tags_label`),()=>Y(`context.rule_tags_placeholder`),()=>Y(`context.rule_applies_to_label`),()=>Y(`context.rule_applies_to_placeholder`),()=>Y(`context.rule_body_label`),()=>Y(`context.rule_body_placeholder`),()=>V(u)||!V(i).trim(),()=>Y(`context.add_rule_button`)]),Fi(k,()=>V(i),e=>F(i,e)),Ci(ae,()=>V(a),e=>F(a,e)),Fi(he,()=>V(o),e=>F(o,e)),Fi(ye,()=>V(s),e=>F(s,e)),Fi(Ce,()=>V(c),e=>F(c,e)),Fi(De,()=>V(l),e=>F(l,e)),H(`click`,Oe,m),W(e,h),Je()}Pr([`click`]);var T_=U(`<p class="empty-msg svelte-1ui2b6s"> </p>`),E_=U(`<p class="mcp-desc svelte-1ui2b6s"> </p>`),D_=U(`<div class="mcp-schema-wrap svelte-1ui2b6s"><h4 class="mcp-schema-title svelte-1ui2b6s"> </h4> <pre class="mcp-schema-pre svelte-1ui2b6s"> </pre></div>`),O_=U(`<div class="mcp-result svelte-1ui2b6s" data-testid="mcp-result"></div>`),k_=U(`<details class="mcp-detail svelte-1ui2b6s"><summary class="mcp-summary svelte-1ui2b6s"> </summary> <!> <!> <div class="mcp-run-area svelte-1ui2b6s"><label class="mcp-run-label svelte-1ui2b6s"> </label> <textarea rows="4" spellcheck="false" class="field-input mcp-textarea svelte-1ui2b6s" data-testid="mcp-args"></textarea> <div class="mcp-run-footer svelte-1ui2b6s"><span class="mcp-error-text svelte-1ui2b6s" data-testid="mcp-error"> </span> <button class="btn-primary btn-sm"> </button></div> <!></div></details>`),A_=U(`<p class="mcp-arg-desc svelte-1ui2b6s"> </p>`),j_=U(`<li class="mcp-arg-item svelte-1ui2b6s"><div class="mcp-arg-name-row svelte-1ui2b6s"><span class="mcp-arg-name svelte-1ui2b6s"> </span> <span class="mcp-arg-req svelte-1ui2b6s"> </span></div> <!></li>`),M_=U(`<div class="mcp-schema-wrap svelte-1ui2b6s"><h4 class="mcp-schema-title svelte-1ui2b6s"> </h4> <ul class="mcp-args-list svelte-1ui2b6s"></ul></div>`),N_=U(`<div class="section-card svelte-1ui2b6s"><div class="section-header svelte-1ui2b6s"><span class="section-title svelte-1ui2b6s" data-testid="mcp-title"> </span> <button class="secondary-button btn-sm"> </button></div> <p class="section-desc svelte-1ui2b6s"> </p> <div class="mcp-info-grid svelte-1ui2b6s"><div class="mcp-info-cell svelte-1ui2b6s"><div class="mcp-info-label svelte-1ui2b6s"> </div> <div> </div></div> <div class="mcp-info-cell svelte-1ui2b6s"><div class="mcp-info-label svelte-1ui2b6s"> </div> <div class="mcp-info-value mono svelte-1ui2b6s"> </div></div> <div class="mcp-info-cell wide svelte-1ui2b6s"><div class="mcp-info-label svelte-1ui2b6s"> </div> <div class="mcp-info-value mono break svelte-1ui2b6s" data-testid="mcp-endpoint"> </div></div></div> <div><div class="subsection-header svelte-1ui2b6s"><span class="subsection-title svelte-1ui2b6s"> </span> <div class="subsection-actions svelte-1ui2b6s"><span class="count-label svelte-1ui2b6s"> </span> <button class="secondary-button btn-sm"> </button></div></div> <div class="mcp-items svelte-1ui2b6s" data-testid="mcp-tool-list"><!></div></div> <div><div class="subsection-header svelte-1ui2b6s"><span class="subsection-title svelte-1ui2b6s"> </span> <div class="subsection-actions svelte-1ui2b6s"><span class="count-label svelte-1ui2b6s"> </span> <button class="secondary-button btn-sm"> </button></div></div> <div class="mcp-items svelte-1ui2b6s" data-testid="mcp-prompt-list"><!></div></div></div>`);function P_(e,t){qe(t,!0);let n=P(`-`),r=P(!1),i=P(`-`),a=P(`-`),o=P(I([])),s=P(I([])),c=P(!1),l=P(I(new Map)),u=P(I(new Map));function d(e,t){let n=V(e===`tool`?l:u);return n.has(t)||n.set(t,{argsJson:`{}`,running:!1,error:``,resultHtml:``}),n.get(t)}function f(e,t,n){let r=V(e===`tool`?l:u).get(t)??{argsJson:`{}`,running:!1,error:``,resultHtml:``};e===`tool`?F(l,new Map(V(l)).set(t,{...r,...n}),!0):F(u,new Map(V(u)).set(t,{...r,...n}),!0)}function p(e){if(!e||typeof e!=`object`)return null;if(e.type===`string`)return``;if(e.type===`number`||e.type===`integer`)return 0;if(e.type===`boolean`)return!1;if(e.type===`array`)return[];if(e.type===`object`||e.properties){let t={},n=e.properties||{};return(Array.isArray(e.required)?e.required:[]).forEach(e=>{t[e]=p(n[e])??``}),t}return null}function m(e){let t=p(e.inputSchema)??{},n=JSON.stringify(t,null,2);F(l,new Map(V(l)).set(e.name,{argsJson:n,running:!1,error:``,resultHtml:``}),!0)}function h(e){let t={};(e.arguments||[]).forEach(e=>{e.required&&(t[e.name]=``)});let n=JSON.stringify(t,null,2);F(u,new Map(V(u)).set(e.name,{argsJson:n,running:!1,error:``,resultHtml:``}),!0)}function g(e){let t=e.match(/^data:\s*(\{.*\})\s*$/m);if(!t)throw Error(e.slice(0,300)||`No MCP response body`);return JSON.parse(t[1])}async function _(e,t,n){let r=await fetch(`/mcp`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json, text/event-stream`},body:JSON.stringify({jsonrpc:`2.0`,id:e,method:t,params:n})}),i=await r.text();if(!r.ok)throw Error(i||`HTTP ${r.status}`);return g(i)}async function v(){await _(1,`initialize`,{protocolVersion:`2025-03-26`,capabilities:{},clientInfo:{name:`living-ai-documentation-context`,version:`1.0.0`}})}function y(e){return"```json\n"+JSON.stringify(e,null,2).replaceAll("```","`\\`\\`")+"\n```"}function b(e){if(typeof e!=`string`)return y(e);try{return y(JSON.parse(e))}catch{return e}}function x(e){if(typeof e==`string`)return e;if(!e||typeof e!=`object`)return String(e??``);if(e.error)return y(e.error);let t=e.result;return!t||typeof t!=`object`?y(e):Array.isArray(t.messages)?t.messages.map(e=>`${e.role?`[${e.role}]`:``}\n${b(e.content?.text??e.content??e)}`.trim()).join(`
|
|
91
|
+
`,t);return n>=0?n:0}c=c.nextElementSibling}return e.length}function If(e,t,n){if(!e||typeof t!=`string`)return()=>{};let r=Tf(t);Df(e,r);let i=i=>{let a=i.target?.closest(`[data-inline-snippet-index]`);if(a&&e.contains(a)){let e=r[Number(a.dataset.inlineSnippetIndex)];if(!e)return;i.preventDefault();let t=mf(e.type),o=gf(e.type);kf(i,[{iconClass:t.iconClass,labelKey:t.labelKey,dataAction:`edit`,dataType:e.type,onActivate:()=>n.onEdit(e)},{iconClass:o.iconClass,labelKey:o.labelKey,dataAction:`delete`,dataType:e.type,onActivate:()=>n.onDelete(e)}]);return}if(!e.contains(i.target))return;let o=Ff(t,e,i.target,r,i.clientY);o!==null&&(i.preventDefault(),kf(i,{iconClass:`fa-solid fa-plus`,labelKey:`snippet.inline_insert_btn`,dataAction:`insert`,onActivate:()=>n.onInsert(o)}))};e.addEventListener(`contextmenu`,i);let a=t=>{let i=t.target?.closest(`[data-inline-snippet-index]`);if(!i||!e.contains(i))return;let a=r[Number(i.dataset.inlineSnippetIndex)];a?.type===`table`&&(t.preventDefault(),t.stopPropagation(),Of(),n.onEdit({...a,tableFocusCell:jf(t.target,i)||void 0}))};e.addEventListener(`dblclick`,a);let o=e.closest(`#home-content-area`)||e.closest(`main`),s=null;o&&(s=r=>{r.defaultPrevented||e.offsetParent!==null&&(r.target?.closest(`textarea, input, [data-inline-snippet-index]`)||e.contains(r.target)||(r.preventDefault(),kf(r,{iconClass:`fa-solid fa-plus`,labelKey:`snippet.inline_insert_btn`,dataAction:`insert`,onActivate:()=>n.onInsert(t.length)})))},o.addEventListener(`contextmenu`,s));let c=e=>{vf&&!vf.contains(e.target)&&Of()},l=e=>{e.key===`Escape`&&Of()};return document.addEventListener(`click`,c),document.addEventListener(`keydown`,l),()=>{e.removeEventListener(`contextmenu`,i),e.removeEventListener(`dblclick`,a),o&&s&&o.removeEventListener(`contextmenu`,s),document.removeEventListener(`click`,c),document.removeEventListener(`keydown`,l),Of(),e.querySelectorAll(`[data-inline-snippet-index]`).forEach(e=>{e.removeAttribute(`data-inline-snippet-index`),e.classList.remove(`ld-inline-snippet-target`)})}}var Lf=200*1024*1024,Rf=Math.round(Lf/1024/1024);Math.ceil(Lf*1.4);var zf=U(`<textarea id="doc-editor" data-testid="doc-editor" spellcheck="false" class="w-full min-h-[70vh] px-4 py-3 text-sm font-mono leading-relaxed rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500 resize-y"></textarea>`),Bf=U(`<div id="doc-content" data-testid="doc-content"></div>`),Vf=U(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50"><div class="bg-white dark:bg-gray-900 rounded-xl shadow-xl w-full max-w-sm mx-4 p-6 space-y-5"><h3 class="text-base font-semibold text-gray-900 dark:text-gray-50"> </h3> <div class="space-y-1.5"><label for="img-paste-name" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> <span class="font-normal text-gray-400"> </span></label> <div class="flex items-center gap-2"><input id="img-paste-name" type="text" class="flex-1 px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono focus:outline-none focus:ring-2 focus:ring-blue-500"/> <span class="text-xs text-gray-400 shrink-0"> </span></div></div> <div class="flex justify-end gap-3 pt-1"><button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div></div></div>`),Hf=U(`<div data-testid="content-lightbox" class="fixed inset-0 z-50 bg-white flex items-center justify-center cursor-pointer p-4"><img data-testid="lightbox-image" class="max-w-full max-h-full object-contain select-none"/> <button class="absolute top-4 right-4 text-gray-500 hover:text-gray-950 text-2xl leading-none">×</button></div>`),Uf=U(`<!> <!> <!> <!>`,1);function Wf(e,t){qe(t,!0);let n=qi(t,`onopen`,3,()=>{}),r=qi(t,`onanchor`,3,ee),i=qi(t,`onconfirmdelete`,3,void 0),a=qi(t,`oncontentwired`,3,void 0),o=qi(t,`rewireSignal`,3,void 0),s=qi(t,`readonly`,3,!1),c=qi(t,`editing`,15,!1),l=qi(t,`saveMsg`,15,null),u=P(null),d=P(null),f=P(``),p=null,m=P(!1),h=P(`insert`),g=P(null),_=P(0),v=P(!1),y=P(``),b=P(`png`),x=null,S=0,C=0,w=P(null),T=P(``),E=/[̀-ͯ]/g;function D(e){return(e||``).normalize(`NFD`).replace(E,``).toLowerCase().replace(/[^a-z0-9]/g,`_`)}function ee(e){document.getElementById(e)?.scrollIntoView({behavior:`smooth`,block:`start`})}Ji(()=>{let e=window;return e.openSnippetsModal=()=>{F(h,`insert`),F(m,!0)},e.openSnippetsModalForInlineInsert=e=>{F(h,`inline-insert`),F(_,Math.max(0,Number(e)||0),!0),F(m,!0)},()=>{delete e.openSnippetsModal,delete e.openSnippetsModalForInlineInsert}}),kn(()=>{if(o(),t.html,t.content,p?.(),p=null,!(c()||!V(u)))return!yd(V(u),t.html,{content:t.content,codeBlockMaxHeight:X.codeBlockMaxHeight,t:Y,onDocLink:(e,t)=>n()(e,t),onAnchor:r(),docId:t.docId,docs:X.allDocs,docsFolder:X.docsFolder,folderPaths:X.allFolderPaths,onKanbanDocsChange:e=>{X.allDocs=e},onKanbanFolderPathsChange:e=>{X.allFolderPaths=e}})&&!s()&&(p=If(V(u),t.content,{onEdit:e=>{F(h,`inline-edit`),F(g,e,!0),F(m,!0)},onInsert:e=>{F(h,`inline-insert`),F(_,e,!0),F(m,!0)},onDelete:async e=>{(i()?await i()():confirm(Y(`snippet.inline_delete_message`)))&&await t.onsave(t.content.slice(0,e.start)+t.content.slice(e.end))}})),a()?.(V(u)),()=>{p?.(),p=null}});function te(){F(f,t.content,!0),c(!0),l(null),requestAnimationFrame(()=>V(d)?.focus())}function O(){c(!1),l(null)}async function ne(){l({text:Y(`doc.saving`),cls:`text-gray-400`});try{await t.onsave(V(f)),c(!1),l(null)}catch(e){l({text:Y(`error.save`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`})}}function k(){F(h,`insert`),F(m,!0)}function A(){let e=Gu(t.content);e&&(F(h,`inline-edit`),F(g,e,!0),F(m,!0))}function re(){return c()}function ie(e){let t=Array.from(e.clipboardData?.items??[]).find(e=>e.type.startsWith(`image/`));if(t){e.preventDefault(),S=V(d).selectionStart,C=V(d).selectionEnd,F(b,t.type.split(`/`)[1].replace(`jpeg`,`jpg`)||`png`,!0);let n=t.getAsFile();if(!n)return;x=n,F(y,D(Date.now().toString()),!0),F(v,!0);return}let n=Array.from(e.clipboardData?.files??[]).filter(e=>!e.type.startsWith(`image/`));if(n.length){e.preventDefault();let t=V(d).selectionStart,r=V(d).selectionEnd;(async()=>{for(let e of n)await ue(e,t,r)})()}}function ae(e){let t=Array.from(e.dataTransfer?.files??[]).filter(e=>!e.type.startsWith(`image/`));if(!t.length)return;e.preventDefault(),e.stopPropagation();let n=V(d).selectionStart,r=V(d).selectionEnd;(async()=>{for(let e of t)await ue(e,n,r)})()}function oe(e){e.dataTransfer?.types?.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)}function se(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=n,r.readAsDataURL(e)})}function ce(e,t,n){let r=V(f).slice(0,t),i=V(f).slice(n);F(f,r+e+i),requestAnimationFrame(()=>{V(d).selectionStart=V(d).selectionEnd=t+e.length,V(d).focus()})}let le=Lf;async function ue(e,n,r){if(e.size>le){l({text:Y(`doc.file_too_large`)+` (${(e.size/1024/1024).toFixed(1)} MB, max ${Rf} MB)`,cls:`text-red-500 dark:text-red-400`});return}l({text:Y(`doc.uploading_file`),cls:`text-gray-400`});try{let i=await se(e),a=await fetch(`/api/files/upload`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:i,name:e.name,documentId:t.docId})});if(!a.ok){let e=``;try{e=(await a.json()).error||``}catch{e=await a.text()}throw Error(e||`HTTP ${a.status}`)}let{url:o,originalName:s}=await a.json();ce(`[📎 ${s||e.name}](${o})`,n,r),l(null)}catch(e){l({text:Y(`doc.file_upload_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`})}}function de(){F(v,!1),x=null}async function fe(){let e=D(V(y))||Date.now().toString();if(F(v,!1),x){l({text:Y(`doc.uploading_image`),cls:`text-gray-400`});try{let t=await se(x),n=await fetch(`/api/images/upload`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:t,ext:V(b),name:e})});if(!n.ok)throw Error(await n.text());let{filename:r}=await n.json();ce(``,S,C),l(null)}catch(e){l({text:Y(`doc.image_upload_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`})}finally{x=null}}}function pe(){F(w,null),F(T,``)}function me(e){if(!e.shiftKey&&!e.metaKey)return;let t=e.target,n=t.closest(`img`),r=t.closest(`.mermaid`)?.querySelector(`svg`);if(!n&&!r)return;if(e.preventDefault(),e.stopPropagation(),n){F(w,n.src,!0),F(T,n.alt||``,!0);return}let i=new XMLSerializer().serializeToString(r);F(w,`data:image/svg+xml;charset=utf-8,${encodeURIComponent(i)}`),F(T,Y(`doc.mermaid_diagram_alt`),!0)}function he(e){e.key===`Escape`&&V(w)&&pe()}var ge={enterEdit:te,cancelEdit:O,save:ne,openSnippets:k,openKanbanColumnsEditor:A,isEditing:re},_e=Uf();Nr(`keydown`,on,he);var ve=R(_e),ye=e=>{var t=zf();yn(t),Ui(t,e=>F(d,e),()=>V(d)),Nr(`paste`,t,ie),Nr(`drop`,t,ae),Nr(`dragover`,t,oe),Fi(t,()=>V(f),e=>F(f,e)),W(e,t)},be=e=>{var t=Bf();Ui(t,e=>F(u,e),()=>V(u)),B(()=>vi(t,1,`prose prose-gray dark:prose-invert max-w-none prose-headings:scroll-mt-4 prose-headings:font-semibold prose-h1:text-[2.1875rem] prose-h2:text-[1.8125rem] prose-h3:text-[1.5rem] prose-h4:text-[1.25rem] prose-a:text-blue-600 dark:prose-a:text-blue-400 prose-code:before:content-none prose-code:after:content-none ${X.codeBlockLightTheme?`prose-pre:bg-[#f6f8fa] prose-pre:text-gray-800 prose-pre:border prose-pre:border-gray-200 prose-pre:rounded-lg dark:prose-pre:bg-[#0d1117] dark:prose-pre:text-gray-100 dark:prose-pre:border-gray-700`:`prose-pre:bg-[#0d1117] prose-pre:border prose-pre:border-gray-700`} ${X.imageRoundedCorners?`[&_img]:rounded-xl`:``} ${X.imageCentered?`[&_img]:mx-auto [&_img]:block`:``} ${X.imageBorder?`[&_img]:[box-shadow:0_0_0_1px_rgba(0,0,0,0.10),0_4px_12px_rgba(0,0,0,0.04)] dark:[&_img]:[box-shadow:0_0_0_1px_rgba(255,255,255,0.08),0_4px_12px_rgba(255,255,255,0.25)]`:``}`)),H(`click`,t,me),W(e,t)};K(ve,e=>{c()?e(ye):e(be,-1)});var xe=z(ve,2);df(xe,{get open(){return V(m)},get editor(){return V(d)},get mode(){return V(h)},get docId(){return t.docId},get content(){return t.content},get range(){return V(g)},get insertPos(){return V(_)},get onsave(){return t.onsave},onclose:()=>F(m,!1)});var Se=z(xe,2),Ce=e=>{var t=Vf(),n=L(t),r=L(n),i=L(r);j(r);var a=z(r,2),o=L(a),s=L(o),c=z(s),l=L(c,!0);j(c),j(o);var u=z(o,2),d=L(u);ki(d);var f=z(d,2),p=L(f);j(f),j(u),j(a);var m=z(a,2),h=L(m),g=L(h,!0);j(h);var _=z(h,2),v=L(_,!0);j(_),j(m),j(n),j(t),B((e,t,n,r,a)=>{G(i,`🖼️ ${e??``}`),G(s,`${t??``} `),G(l,n),Ai(d,V(y)),G(p,`.${V(b)??``}`),G(g,r),G(v,a)},[()=>Y(`modal.img_paste.title`),()=>Y(`modal.img_paste.filename_label`),()=>Y(`modal.img_paste.saved_hint`),()=>Y(`common.cancel`),()=>Y(`modal.img_paste.paste_btn`)]),H(`input`,d,e=>F(y,D(e.target.value),!0)),H(`click`,h,de),H(`click`,_,fe),W(e,t)};K(Se,e=>{V(v)&&e(Ce)});var we=z(Se,2),Te=e=>{var t=Hf(),n=L(t),r=z(n,2);j(t),B(()=>{J(n,`src`,V(w)),J(n,`alt`,V(T))}),H(`click`,t,pe),H(`click`,n,e=>e.stopPropagation()),H(`click`,r,pe),W(e,t)};return K(we,e=>{V(w)&&e(Te)}),W(e,_e),Je(ge)}Pr([`click`,`input`]);var Gf=U(`<span> </span> <code> </code>`,1),Kf=U(`<button type="button" data-testid="bp-copy-doc-id"><i aria-hidden="true"></i></button>`),qf=U(`<button class="bpadr-icon-btn" data-testid="bp-edit" type="button">✏️</button> <button class="bpadr-icon-btn" data-testid="bp-delete" type="button">🗑️</button>`,1),Jf=U(`<span> </span>`),Yf=U(`<footer class="bpadr-footer bpadr-doc-footer"><!> <button type="button" class="bpadr-btn-ghost" data-testid="bp-cancel"> </button> <button type="button" class="bpadr-btn-ghost" data-testid="bp-snippets"> </button> <button type="button" class="bpadr-btn-primary" data-testid="bp-save"> </button></footer>`),Xf=U(`<div class="bpadr-read"><!></div> <!>`,1),Zf=U(`<form class="bpadr-form"><input type="hidden" name="folder"/> <div class="bpadr-field"><label for="adr-title"> </label> <input id="adr-title" type="text" class="bpadr-input"/></div> <div class="bpadr-field bpadr-field-grow"><label for="adr-content"> </label> <textarea id="adr-content" class="bpadr-textarea"></textarea></div> <footer class="bpadr-footer"><button type="button" class="bpadr-btn-ghost"> </button> <button type="button" data-testid="bp-form-snippets" class="bpadr-btn-ghost"> </button> <button type="submit" class="bpadr-btn-primary"> </button></footer></form> <!>`,1),Qf=U(`<div class="bpadr-folder-confirm"><p></p> <p class="bpadr-muted"> </p> <footer class="bpadr-footer"><button type="button" class="bpadr-btn-ghost"> </button> <button type="button" class="bpadr-btn-primary"> </button></footer></div>`),$f=U(`<div class="bpadr-overlay"><div class="bpadr-modal"><header class="bpadr-header"><div class="bpadr-title-row"><h2 class="bpadr-title"><!></h2> <!></div> <div class="bpadr-header-actions"><!> <button class="bpadr-icon-btn" type="button" title="Close">×</button></div></header> <!></div></div>`),ep=U(`<div class="fixed inset-0 z-[60] flex items-center justify-center bg-black/50 p-4"><div class="w-full max-w-sm bg-white dark:bg-gray-900 border border-red-200 dark:border-red-700 rounded-xl shadow-2xl p-5 flex flex-col gap-3"><p class="text-sm text-gray-700 dark:text-gray-200"> </p> <p class="text-xs text-gray-500 dark:text-gray-400 italic truncate"> </p> <div class="flex justify-end gap-2 mt-2"><button type="button" data-testid="bp-delete-cancel" class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button type="button" data-testid="bp-delete-confirm" class="text-sm px-4 py-1.5 rounded-lg bg-red-500 hover:bg-red-600 text-white font-semibold transition-colors"> </button></div></div></div>`),tp=U(`<!> <!>`,1);function np(e,t){qe(t,!0);let n=qi(t,`onchanged`,3,()=>{}),r=`BLUEPRINT`;function i(e){return`/${(e.folder.path||e.folder.name).replace(/^\/+|\/+$/g,``)||e.folder.name}`}let a=P(`closed`),o=P(``),s=P(``),c=P(``),l=P(``),u=P(``),d=P(``),f=P(``),p=P(null),m=P(null),h=P(null),g=P(!1),_=P(null),v=P(null),y=P(!1),b=P(!1),x=P(!1);async function S(e){if(F(m,e,!0),F(p,null),F(g,!1),F(_,null),F(s,e.folder.name,!0),F(c,``),F(l,``),F(u,``),F(f,i(e),!0),F(o,Y(`blueprint.adr.new_title`,{folder:e.folder.name}),!0),F(a,`form`),!(await fetch(`/api/blueprint/blueprint-folder`).then(e=>e.json())).exists){F(d,r),F(a,`folder-confirm`);return}await w(e)}async function C(e){return fetch(`/api/documents/${encodeURIComponent(e)}`).then(e=>e.json())}async function w(e){let t=await fetch(`/api/blueprint/blueprint-adr?folder=${encodeURIComponent(e.folder.name)}`).then(e=>e.json());if(t.found&&t.doc){F(p,t.doc.id,!0);let e=await C(t.doc.id);F(s,e.title,!0),F(l,e.content,!0),F(u,e.html,!0),F(o,e.title,!0),F(g,!1),F(a,`doc`)}else F(s,e.folder.name,!0),F(c,``),F(a,`form`)}function T(){F(a,`closed`),F(g,!1),F(p,null),F(m,null),F(f,``),F(x,!1)}async function E(){if(V(p))try{await navigator.clipboard.writeText(decodeURIComponent(V(p))),F(x,!0),setTimeout(()=>F(x,!1),1800)}catch{}}async function D(){await fetch(`/api/blueprint/blueprint-folder`,{method:`POST`}),V(m)&&await w(V(m))}async function ee(e){if(!V(p))return;await fetch(`/api/documents/${encodeURIComponent(V(p))}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:V(s).trim()||V(m)?.folder.name||Y(`common.untitled`),folder:r,content:e})});let t=await C(V(p));F(o,t.title,!0),F(l,t.content,!0),F(u,t.html,!0)}async function te(e){e.preventDefault();let t={title:V(s).trim()||V(m)?.folder.name||Y(`common.untitled`),name:V(m)?.folder.name,folder:r},i=await fetch(`/api/documents/`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)}).then(e=>e.json());F(p,i.id,!0);let c=await C(i.id);F(o,c.title,!0),F(l,c.content,!0),F(u,c.html,!0),F(g,!1),F(a,`doc`),n()()}async function O(){F(b,!1),V(p)&&(await fetch(`/api/documents/${encodeURIComponent(V(p))}`,{method:`DELETE`}),T(),n()())}var ne={open:S},k=tp(),A=R(k),re=e=>{var t=$f(),n=L(t),i=L(n),m=L(i),S=L(m),C=L(S),w=e=>{var t=Gf(),n=R(t),r=L(n,!0);j(n);var i=z(n,2),a=L(i,!0);j(i),B(e=>{G(r,e),G(a,V(f))},[()=>Y(`blueprint.adr.folder_title`)]),W(e,t)},O=e=>{var t=Ur();B(()=>G(t,V(o))),W(e,t)};K(C,e=>{V(f)?e(w):e(O,-1)}),j(S);var ne=z(S,2),k=e=>{var t=Kf(),n=L(t);j(t),B(e=>{J(t,`title`,e),vi(t,1,`bpadr-copy-btn ${V(x)?`copied`:``}`),vi(n,1,`fa-${V(x)?`solid fa-check`:`regular fa-copy`}`)},[()=>Y(`doc.copy_mcp_id`)]),H(`click`,t,E),W(e,t)};K(ne,e=>{V(p)&&e(k)}),j(m);var A=z(m,2),re=L(A),ie=e=>{var t=qf(),n=R(t),r=z(n,2);B((e,t)=>{J(n,`title`,e),J(r,`title`,t)},[()=>Y(`doc.edit`),()=>Y(`doc.delete`)]),H(`click`,n,()=>V(h).enterEdit()),H(`click`,r,()=>F(b,!0)),W(e,t)};K(re,e=>{V(a)===`doc`&&!V(g)&&e(ie)});var ae=z(re,2);j(A),j(i);var oe=z(i,2),se=e=>{var t=Xf(),n=R(t),r=L(n);{let e=N(()=>V(p)??``);Ui(Wf(r,{get docId(){return V(e)},get content(){return V(l)},get html(){return V(u)},onsave:ee,get editing(){return V(g)},set editing(e){F(g,e,!0)},get saveMsg(){return V(_)},set saveMsg(e){F(_,e,!0)}}),e=>F(h,e,!0),()=>V(h))}j(n);var i=z(n,2),a=e=>{var t=Yf(),n=L(t),r=e=>{var t=Jf(),n=L(t,!0);j(t),B(()=>{vi(t,1,`text-xs ${V(_).cls??``}`),G(n,V(_).text)}),W(e,t)};K(n,e=>{V(_)&&e(r)});var i=z(n,2),a=L(i,!0);j(i);var o=z(i,2),s=L(o,!0);j(o);var c=z(o,2),l=L(c,!0);j(c),j(t),B((e,t,n)=>{G(a,e),G(s,t),G(l,n)},[()=>Y(`common.cancel`),()=>Y(`doc.snippets_btn`),()=>Y(`common.save`)]),H(`click`,i,()=>V(h).cancelEdit()),H(`click`,o,()=>V(h).openSnippets()),H(`click`,c,()=>V(h).save()),W(e,t)};K(i,e=>{V(g)&&e(a)}),W(e,t)},ce=e=>{var t=Zf(),n=R(t),i=L(n);ki(i),Ai(i,r);var o=z(i,2),l=L(o),u=L(l,!0);j(l);var d=z(l,2);ki(d),j(o);var f=z(o,2),m=L(f),h=L(m,!0);j(m);var g=z(m,2);yn(g),Ui(g,e=>F(v,e),()=>V(v)),j(f);var _=z(f,2),b=L(_),x=L(b,!0);j(b);var S=z(b,2),C=L(S,!0);j(S);var w=z(S,2),E=L(w,!0);j(w),j(_),j(n),df(z(n,2),{get open(){return V(y)},get editor(){return V(v)},mode:`insert`,get content(){return V(c)},onclose:()=>F(y,!1)}),B((e,t,n,r,i)=>{G(u,e),G(h,t),G(x,n),G(C,r),G(E,i)},[()=>Y(`blueprint.adr.title_label`),()=>Y(`blueprint.adr.content_label`),()=>Y(`common.cancel`),()=>Y(`doc.snippets_btn`),()=>Y(`common.save`)]),Nr(`submit`,n,te),Fi(d,()=>V(s),e=>F(s,e)),Fi(g,()=>V(c),e=>F(c,e)),H(`click`,b,()=>{V(p)?F(a,`doc`):T()}),H(`click`,S,()=>F(y,!0)),W(e,t)},le=e=>{var t=Qf(),n=L(t);si(n,()=>Y(`blueprint.adr.folder_missing`,{name:V(d)}),!0),j(n);var r=z(n,2),i=L(r,!0);j(r);var a=z(r,2),o=L(a),s=L(o,!0);j(o);var c=z(o,2),l=L(c,!0);j(c),j(a),j(t),B((e,t,n)=>{G(i,e),G(s,t),G(l,n)},[()=>Y(`blueprint.adr.folder_create_prompt`),()=>Y(`common.cancel`),()=>Y(`blueprint.adr.create_folder_btn`)]),H(`click`,o,T),H(`click`,c,D),W(e,t)};K(oe,e=>{V(a)===`doc`?e(se):V(a)===`form`?e(ce,1):V(a)===`folder-confirm`&&e(le,2)}),j(n),j(t),H(`click`,t,e=>{e.target===e.currentTarget&&T()}),H(`click`,ae,T),W(e,t)};K(A,e=>{V(a)!==`closed`&&e(re)});var ie=z(A,2),ae=e=>{var t=ep(),n=L(t),r=L(n),i=L(r,!0);j(r);var a=z(r,2),s=L(a,!0);j(a);var c=z(a,2),l=L(c),u=L(l,!0);j(l);var d=z(l,2),f=L(d,!0);j(d),j(c),j(n),j(t),B((e,t,n)=>{G(i,e),G(s,V(o)),G(u,t),G(f,n)},[()=>Y(`doc.confirm_delete`),()=>Y(`common.cancel`),()=>Y(`doc.confirm_delete_btn`)]),H(`click`,t,e=>{e.target===e.currentTarget&&F(b,!1)}),H(`click`,l,()=>F(b,!1)),H(`click`,d,O),W(e,t)};return K(ie,e=>{V(b)&&e(ae)}),W(e,k),Je(ne)}Pr([`click`]);var rp=U(`<span class="breadcrumb-sep">›</span>`),ip=U(`<span class="breadcrumb-item current"> </span>`),ap=U(`<button class="breadcrumb-item" type="button"> </button>`),op=U(`<!> <!>`,1),sp=U(`<nav class="breadcrumb"></nav>`),cp=U(`<div class="app-shell"><!> <section class="workspace-shell"><!> <!></section></div> <!>`,1);function lp(e,t){qe(t,!0),Ji(async()=>{try{await Ca((await fetch(`/api/config`).then(e=>e.json())).language||`en`)}catch{}});let n=P(I([])),r=P(null),i=P(null),a=P(null),o=P(null);function s(e){l(),V(i).loadPath(e,!0)}async function c(e){F(r,e.folder.path,!0),await xr(),await V(a).open(e.folder.path)}function l(){F(r,null)}async function u(e){await V(i).navigateToFolder(e)}var d=cp(),f=R(d),p=L(f);{let e=N(()=>Y(`blueprint.subtitle`));es(p,{title:`Blueprint`,get subtitle(){return V(e)},children:(e,t)=>{var r=sp();q(r,21,()=>V(n),Qr,(e,t,r)=>{var i=op(),a=R(i),o=e=>{W(e,rp())};K(a,e=>{r>0&&e(o)});var c=z(a,2),l=e=>{var n=ip(),r=L(n,!0);j(n),B(()=>G(r,V(t).name)),W(e,n)},u=e=>{var n=ap(),r=L(n,!0);j(n),B(()=>G(r,V(t).name)),H(`click`,n,()=>s(V(t).path)),W(e,n)};K(c,e=>{r===V(n).length-1?e(l):e(u,-1)}),W(e,i)}),j(r),W(e,r)},$$slots:{default:!0}})}var m=z(p,2),h=L(m);Ui(Ms(h,{get activeExplorerPath(){return V(r)},onbreadcrumbchange:e=>F(n,e,!0),onopenexplorer:c,onclosefilerexplorer:l,onopenAdr:e=>V(o).open(e)}),e=>F(i,e,!0),()=>V(i));var g=z(h,2),_=e=>{Ui(Qs(e,{onclose:l,onnavigate:u}),e=>F(a,e,!0),()=>V(a))};K(g,e=>{V(r)!==null&&e(_)}),j(m),j(f),Ui(np(z(f,2),{onchanged:()=>V(i).loadPath(V(n).at(-1)?.path??``,!1)}),e=>F(o,e,!0),()=>V(o)),W(e,d),Je()}Pr([`click`]);var up=164,dp=64,fp=132,pp=78,mp=6,hp=24,gp=96,_p=540,vp=780,yp=1/2,bp=9999,xp=44,Sp=255,Cp=178,wp=Math.PI*.7,Tp=Math.PI*1.1,Ep=Math.PI*1.45,Dp=Math.PI*1.75,Op=14,kp=260,Ap=56,jp=32,Mp=[`pointerdown`,`mousedown`,`click`,`dblclick`,`touchstart`,`wheel`],Np=.35,Pp=2.2,Fp=.0018,Ip=4,Lp=46,Rp=4,zp=44,Bp=360,Vp=300,Hp=44,Up=48,Wp=7,Gp=875,Kp=450,qp=600*1e3,Jp,Z,Yp,Xp,Zp,Qp,$p,em=[],tm=new Map,nm=[],rm=-1,im,am,om,sm,cm,lm,um,dm,fm,pm,mm,hm,gm,_m,vm,ym,bm,xm,Sm,Cm,wm,Tm=null,Em=null,Dm=null,Q,$,Om,km=!1;function Am(){return Jp=document.getElementById(`workspaceCanvas`),Z=Jp.getContext(`2d`),Yp=document.getElementById(`apiStatus`),Xp=document.getElementById(`addButton`),Zp=document.getElementById(`fitButton`),Qp=document.getElementById(`testNodeButton`),$p=document.getElementById(`loadModelsButton`),im=document.getElementById(`closePanelButton`),am=document.getElementById(`deleteNodeButton`),om=document.getElementById(`renameConfirmOverlay`),sm=document.getElementById(`renameConfirmMessage`),cm=document.getElementById(`cancelRenameButton`),lm=document.getElementById(`confirmRenameButton`),um=document.getElementById(`deleteConfirmOverlay`),dm=document.getElementById(`deleteConfirmMessage`),fm=document.getElementById(`cancelDeleteButton`),pm=document.getElementById(`confirmDeleteButton`),mm=document.getElementById(`agentRunOverlay`),hm=document.getElementById(`agentRunTitle`),gm=document.getElementById(`agentRunHint`),_m=document.getElementById(`agentRunInputField`),vm=document.getElementById(`agentRunInput`),ym=document.getElementById(`agentRunResult`),bm=document.getElementById(`cancelAgentRunButton`),xm=document.getElementById(`executeAgentRunButton`),Sm=document.getElementById(`fallbackPanelHost`),Cm=document.getElementById(`configSurface`),wm=Cm,Tm=null,Em=null,Dm=null,Q={name:document.getElementById(`nodeName`),kind:document.getElementById(`nodeKind`),providerIdField:document.getElementById(`providerIdField`),providerId:document.getElementById(`nodeProviderId`),copyProviderId:document.getElementById(`copyProviderIdButton`),endpoint:document.getElementById(`nodeEndpoint`),token:document.getElementById(`nodeToken`),model:document.getElementById(`nodeModel`),modelFilter:document.getElementById(`nodeModelFilter`),modelResults:document.getElementById(`nodeModelResults`),providerTypeChat:document.getElementById(`nodeProviderTypeChat`),providerTypeImage:document.getElementById(`nodeProviderTypeImage`),toolModeField:document.getElementById(`toolModeField`),toolModeTools:document.getElementById(`nodeToolModeTools`),toolModeChat:document.getElementById(`nodeToolModeChat`),workspaceField:document.getElementById(`agentWorkspaceField`),workspaceFolder:document.getElementById(`nodeWorkspaceFolder`),timeout:document.getElementById(`nodeTimeout`),description:document.getElementById(`nodeDescription`),typeBadge:document.getElementById(`nodeTypeBadge`),llmFields:document.getElementById(`llmFields`),mcpInventory:document.getElementById(`mcpInventory`),mcpInventoryStatus:document.getElementById(`mcpInventoryStatus`),mcpToolsList:document.getElementById(`mcpToolsList`),mcpPromptsList:document.getElementById(`mcpPromptsList`),agentSection:document.getElementById(`agentSection`),agentProvider:document.getElementById(`nodeAgentProvider`),systemPrompt:document.getElementById(`nodeSystemPrompt`),requiresUserInput:document.getElementById(`nodeRequiresUserInput`),userInputDescriptionField:document.getElementById(`agentUserInputDescriptionField`),userInputDescription:document.getElementById(`nodeUserInputDescription`),expectedOutputMarker:document.getElementById(`nodeExpectedOutputMarker`)},$={entities:Xm([Ym(`root`,`Living AI Documentation`,`system`,null),Ym(`mcp`,`MCP`,`mcp`,`root`)]),selectedId:null,cameraX:0,cameraY:0,zoom:1,isPanning:!1,panStartX:0,panStartY:0,panStartCameraX:0,panStartCameraY:0,didPan:!1,viewAnimationId:null,dpr:window.devicePixelRatio||1,apiMode:`fallback`,lastSaveAt:null,pendingDeleteId:null,panelShiftX:0,saveTimerId:null,panelDirty:!1,isHydrated:!1},km=!!Jp.requestPaint&&typeof Z.drawElementImage==`function`,km?($.apiMode=`html-in-canvas`,Yp.textContent=`HTML-in-Canvas active`,Yp.classList.add(`is-live`),Jp.onpaint=ag):(Sm.appendChild(Cm),Yp.textContent=`DOM fallback`,Yp.classList.add(`is-fallback`)),Om=new ResizeObserver(([e])=>{let t=e.devicePixelContentBoxSize?.[0],n=e.contentRect.width,r=e.contentRect.height;$.dpr=t?t.inlineSize/n:window.devicePixelRatio||1,Jp.width=t?t.inlineSize:Math.floor(n*$.dpr),Jp.height=t?t.blockSize:Math.floor(r*$.dpr),ih(),hg(!1,!$.cameraX&&!$.cameraY),ig()}),Om.observe(Jp,{box:`device-pixel-content-box`}),jm(),Mm(),Xp.addEventListener(`click`,()=>{th()}),Zp.addEventListener(`click`,()=>{ih(),hg(!0,!0),Lm(),ig()}),Jp.addEventListener(`pointerdown`,e=>{if(e.target!==Jp)return;let t=Rg(e),n=Tg(t),r=[...$.entities].reverse().find(e=>jg(e,n));if(r){r.id!==`root`&&gh(r.id);return}$.isPanning=!0,$.didPan=!1,$.panStartX=t.x,$.panStartY=t.y,$.panStartCameraX=$.cameraX,$.panStartCameraY=$.cameraY,Jp.classList.add(`is-panning`),Jp.setPointerCapture?.(e.pointerId)}),Jp.addEventListener(`pointermove`,e=>{if(!$.isPanning)return;let t=Rg(e),n=t.x-$.panStartX,r=t.y-$.panStartY;Math.hypot(n,r)>Ip&&($.didPan=!0),$.cameraX=$.panStartCameraX+n,$.cameraY=$.panStartCameraY+r,ig()}),Jp.addEventListener(`pointerup`,e=>{$.isPanning&&($.isPanning=!1,Jp.classList.remove(`is-panning`),Jp.releasePointerCapture?.(e.pointerId),!$.didPan&&$.selectedId?gh(null):$.didPan&&Lm())}),Jp.addEventListener(`pointercancel`,e=>{$.isPanning=!1,Jp.classList.remove(`is-panning`),Jp.releasePointerCapture?.(e.pointerId)}),Jp.addEventListener(`wheel`,e=>{e.target===Jp&&(e.preventDefault(),wg(Rg(e),Math.exp(-e.deltaY*Fp)),Lm())},{passive:!1}),wm.addEventListener(`submit`,e=>{e.preventDefault(),wh(),$.lastSaveAt=new Date,ih(),zm(!0),ig()}),wm.addEventListener(`input`,()=>{wh(),ih(),$.panelDirty=!0,ig()}),im.addEventListener(`click`,()=>{gh(null)}),am.addEventListener(`click`,e=>{e.preventDefault(),e.stopPropagation();let t=$.selectedId,n=t?eg(t):null;!n||tg(t)||_h(n)}),fm.addEventListener(`click`,vh),um.addEventListener(`click`,e=>{e.target===um&&vh()}),pm.addEventListener(`click`,()=>{$.pendingDeleteId&&yh($.pendingDeleteId),vh()}),Qp.addEventListener(`click`,()=>{if($h()?.kind===`agent`){Ah();return}Jh()}),$p.addEventListener(`click`,()=>{qh()}),Q.copyProviderId.addEventListener(`click`,()=>{Xh()}),Q.name.addEventListener(`blur`,()=>{if($h()?.kind!==`agent`)return;let e=Q.name.value.trim();if(!e||!Tm||!Em||e===Tm)return;let t=Qm(e);t!==Em&&(sm.textContent=`Renommer le dossier "${Em}" en "${t}" ?`,om.hidden=!1,cm.focus())}),cm.addEventListener(`click`,()=>{om.hidden=!0;let e=$h();e&&Tm&&(e.label=Tm,Q.name.value=Tm,ih(),ig())}),lm.addEventListener(`click`,()=>{om.hidden=!0;let e=$h();if(!e||!Em)return;e.config.workspaceFolder=Em,Q.workspaceFolder.value=Em;let t=Q.name.value.trim();t&&(Tm=t),Em=Qm(t),Lm()}),Q.modelFilter.addEventListener(`input`,e=>{e.stopPropagation(),rm=-1,Wh()}),Q.modelFilter.addEventListener(`focus`,()=>{Wh()}),Q.modelFilter.addEventListener(`blur`,()=>{Gh()}),Q.modelFilter.addEventListener(`keydown`,e=>{if(e.key===`ArrowDown`||e.key===`ArrowUp`){if(nm.length===0)return;e.preventDefault();let t=nm.length;rm=e.key===`ArrowDown`?(rm+1)%t:rm<=0?t-1:rm-1,Wh()}else if(e.key===`Enter`){e.preventDefault();let t=nm[rm]??(nm.length===1?nm[0]:void 0);t&&Kh(t)}else e.key===`Escape`&&Q.modelFilter.value&&(e.preventDefault(),e.stopPropagation(),Q.modelFilter.value=``,Gh())}),Q.modelResults.addEventListener(`mousedown`,e=>{e.preventDefault()}),Q.modelResults.addEventListener(`click`,e=>{let t=e.target.closest(`[data-model]`);t?.dataset.model&&Kh(t.dataset.model)}),Q.model.addEventListener(`change`,()=>{Qp.disabled=!Q.model.value;let e=$h();e&&(e.config.model=Q.model.value)}),Q.agentProvider.addEventListener(`change`,()=>{Eh(Q.agentProvider.value)}),bm.addEventListener(`click`,()=>{jh()}),xm.addEventListener(`click`,()=>{Mh()}),mm.addEventListener(`click`,e=>{e.target===mm&&jh()}),Pm(),()=>{Rm(),Om.disconnect(),$?.saveTimerId&&clearTimeout($.saveTimerId)}}function jm(){for(let e of Mp)Cm.addEventListener(e,Nm),Sm.addEventListener(e,Nm)}function Mm(){for(let e of Mp)um.addEventListener(e,Nm),om.addEventListener(e,Nm),mm.addEventListener(e,Nm)}function Nm(e){e.stopPropagation()}async function Pm(){let e=await Eo();e?.entities?.length&&($.entities=Fm(e.entities),$.cameraX=Jm(e.camera?.x,$.cameraX),$.cameraY=Jm(e.camera?.y,$.cameraY),$.zoom=Eg(Jm(e.camera?.zoom,$.zoom),Np,Pp),$.lastSaveAt=e.updatedAt?new Date(e.updatedAt):null),$.isHydrated=!0,ih(),e?.entities?.length||hg(!1,!0),Ch(),ig()}function Fm(e){let t=e.map(Im).filter(e=>!!e),n=t.some(e=>e.id===`root`),r=t.some(e=>e.id===`mcp`),i=[...n?[]:[Ym(`root`,`Living AI Documentation`,`system`,null)],...t,...r?[]:[Ym(`mcp`,`MCP`,`mcp`,`root`)]],a=new Set(i.map(e=>e.id));return i.map(e=>{let t=e.id===`root`?`system`:e.id===`mcp`?`mcp`:e.kind,n=e.id===`root`?null:e.id===`mcp`?`root`:e.parentId&&a.has(e.parentId)?e.parentId:null;return{...e,kind:t,parentId:n,config:{...Ym(e.id,e.label,t,n).config,...e.config}}})}function Im(e){if(!Um(e))return null;let t=Wm(e.id),n=Wm(e.label),r=Gm(e.kind);if(!t||!n||!r)return null;let i=e.parentId===null?null:Wm(e.parentId),a=Um(e.config)?e.config:{};return{id:t,label:n,kind:r,parentId:i,x:Jm(e.x,0),y:Jm(e.y,0),angle:Jm(e.angle,0),config:{endpoint:Wm(a.endpoint)||Zm(t,r),token:Wm(a.token),model:Wm(a.model),providerType:qm(a.providerType),toolMode:Km(a.toolMode),timeout:Jm(a.timeout,180),description:Wm(a.description)||eh(r),workspaceFolder:Wm(a.workspaceFolder)||(r===`agent`?Qm(n):``),systemPrompt:Wm(a.systemPrompt),requiresUserInput:a.requiresUserInput===!0,userInputDescription:Wm(a.userInputDescription),expectedOutputMarker:Wm(a.expectedOutputMarker)}}}function Lm(){$.isHydrated&&($.saveTimerId&&clearTimeout($.saveTimerId),$.saveTimerId=window.setTimeout(()=>{$.saveTimerId=null,zm(!1)},Kp))}function Rm(){$.panelDirty&&zm(!1)}async function zm(e=!1){if(!$.isHydrated)return;$.panelDirty=!1,$.saveTimerId&&(clearTimeout($.saveTimerId),$.saveTimerId=null);let t=$.selectedId&&document.activeElement===Q.token&&zh(Q.token.value)?{entityId:$.selectedId,value:Q.token.value,selectionStart:Q.token.selectionStart,selectionEnd:Q.token.selectionEnd}:null,n=await Do(Hm());if(n){if($.entities=Fm(n.entities),t&&$.selectedId===t.entityId){let e=$h();e?.kind===`llm`&&(e.config.token=t.value)}$.lastSaveAt=new Date(n.updatedAt),$h()&&!wm.contains(document.activeElement)&&Ch(),t&&$.selectedId===t.entityId&&(Q.token.value=t.value,Q.token.setSelectionRange(t.selectionStart,t.selectionEnd)),e&&Vm(`Workspace saved`)}else e&&Vm(`Save failed`)}function Bm(e,t){return Co(e,t)}function Vm(e,t=`success`,n,r){return wo(e,t,n,r)}function Hm(){return{version:1,updatedAt:new Date().toISOString(),entities:$.entities.map(e=>{let t={...e.config,token:Bh(e.config.token)};return{id:e.id,label:e.label,kind:e.kind,parentId:e.parentId,x:e.x,y:e.y,angle:e.angle,config:t}}),camera:{x:$.cameraX,y:$.cameraY,zoom:$.zoom}}}function Um(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function Wm(e){return typeof e==`string`?e:``}function Gm(e){return e===`system`||e===`llm`||e===`agent`||e===`mcp`?e:null}function Km(e){return e===`chat`?`chat`:`tools`}function qm(e){return e===`image`?`image`:`chat`}function Jm(e,t){return typeof e==`number`&&Number.isFinite(e)?e:t}function Ym(e,t,n,r){return{id:e,label:t,kind:n,parentId:r,x:0,y:0,angle:0,config:{endpoint:Zm(e,n),token:``,model:``,providerType:`chat`,toolMode:`tools`,timeout:180,description:eh(n),workspaceFolder:n===`agent`?Qm(t):``,systemPrompt:``,requiresUserInput:!1,userInputDescription:``,expectedOutputMarker:``}}}function Xm(e){return e.map(e=>({...e,config:{...e.config}}))}function Zm(e,t){return t===`llm`?`http://localhost:11434`:t===`mcp`?`http://localhost:4321/mcp`:``}function Qm(e){return`AI/WORKSPACE/${$m(e)}`}function $m(e){return e.normalize(`NFKD`).replace(/[\u0300-\u036f]/g,``).toLowerCase().replace(/[^a-z0-9]+/g,`_`).replace(/^_+|_+$/g,``)||`llm_provider`}function eh(e){let t={system:`Owns the documentation workspace, MCP access, providers, and agent topology.`,llm:`Routes model calls and hosts the agents assigned to this provider.`,agent:`Runs focused automation against documentation, source, or quality signals.`,mcp:`Exposes the local Living Documentation MCP consultation panel to agents.`};return t[e]||t.agent}function th(){let e=$h(),t=e?.kind===`llm`?e:eg(e?.parentId);if(t?.kind===`llm`&&t.config.providerType!==`image`){rh(t.id);return}nh()}function nh(){let e=!!$.selectedId,t=ng(`root`).filter(e=>e.kind===`llm`).length+1,n=Ym(`provider-${Date.now().toString(36)}`,`LLM Provider ${t}`,`llm`,`root`);$.entities=[...$.entities,n],$.selectedId=n.id,ih(),gg(e,!0,!0),Ch(),Lm(),ig()}function rh(e){let t=!!$.selectedId,n=ng(e).filter(e=>e.kind===`agent`).length+1,r=Ym(`agent-${Date.now().toString(36)}`,`Agent ${n}`,`agent`,e);$.entities=[...$.entities,r],$.selectedId=r.id,ih(),gg(t,!0,!0),Ch(),Lm(),ig()}function ih(){let e=eg(`root`);e.x=0,e.y=0,e.angle=0,ah(e)}function ah(e){let t=ng(e.id),n=dh(t,fp,Sp,{spread:Math.PI*2,includeSubtree:!1}),r=new Map(t.map(e=>[e.id,lh(e,n)]));for(let n=0;n<=Wp;n+=1)if(oh(e,t,r),sh(),!ch(t,r))return;oh(e,t,r),sh()}function oh(e,t,n){let r=Math.max(1,t.length);t.forEach((t,i)=>{let a=-Math.PI/2+i/r*Math.PI*2,o=n.get(t.id)||Sp;t.angle=a,t.x=e.x+Math.cos(a)*o,t.y=e.y+Math.sin(a)*o})}function sh(){for(let e of $.entities.filter(e=>e.kind===`llm`))uh(e)}function ch(e,t){let n=!1;for(let r=0;r<e.length;r+=1)for(let i=r+1;i<e.length;i+=1){let a=e[r],o=e[i];Lg(Pg(a),Pg(o),Hp)&&(t.set(a.id,Math.min(Gp,t.get(a.id)+Up)),t.set(o.id,Math.min(Gp,t.get(o.id)+Up)),n=!0)}return n}function lh(e,t){if(e.kind!==`llm`)return t;let n=ng(e.id).length;if(n<=Rp)return t;let r=(n-Rp)*zp,i=Math.max(0,mh(e)-Vp)*.65;return t+Math.min(Bp,Math.max(r,i))}function uh(e){let t=ng(e.id);if(!t.length)return;let n=Math.atan2(e.y,e.x),r=fh(t.length),i=dh(t,pp,Cp,{spread:r,includeSubtree:!1});t.forEach((a,o)=>{let s=ph(n,r,o,t.length);a.angle=s,a.x=e.x+Math.cos(s)*i,a.y=e.y+Math.sin(s)*i})}function dh(e,t,n,r={}){if(!e.length)return n;let i=!!r.includeSubtree,a=r.spread||Math.PI*2,o=Math.max(...e.map(e=>i?mh(e):hh(e))),s=t+o+Lp;if(e.length===1)return Math.max(n,s);let c=o*2+Lp,l=a>=Math.PI*2-.001?Math.PI*2/e.length:a/(e.length-1),u=c/(2*Math.sin(l/2));return Math.max(n,s,u)}function fh(e){return e<=1?0:e<=2?wp:e<=4?Tp:e<=7?Ep:Dp}function ph(e,t,n,r){return r<=1||t===0?e:e-t/2+n/(r-1)*t}function mh(e){if(e.kind!==`llm`)return hh(e);let t=ng(e.id);return t.length?dh(t,pp,Cp,{spread:fh(t.length),includeSubtree:!1})+Math.max(...t.map(e=>hh(e))):pp}function hh(e){if(e.kind===`system`)return fp;if(e.kind===`llm`)return pp;let{width:t,height:n}=Ng(e);return Math.hypot(t/2,n/2)}function gh(e){e!==$.selectedId&&Rm();let t=!!$.selectedId;$.selectedId=e;let n=e?eg(e):null;Tm=n?.kind===`agent`?n.label:null,Em=n?.kind===`agent`?n.config.workspaceFolder||Qm(n.label):null,ih(),gg(t,!!e,!0),Ch(),ig()}function _h(e){let t=rg(e.id),n=ng(e.id).length,r=t.length?` This node has ${n} direct child${n===1?``:`ren`} and ${t.length} total descendant${t.length===1?``:`s`}; they will also be deleted.`:` This node has no children.`;$.pendingDeleteId=e.id,dm.textContent=`You are about to delete "${e.label}".${r} This action cannot be undone.`,um.hidden=!1,pm.focus()}function vh(){$.pendingDeleteId=null,um.hidden=!0}function yh(e){let t=eg(e);if(!t||tg(e))return;let n=t.parentId||`root`,r=!!$.selectedId,i=new Set([e,...rg(e)]);$.entities=$.entities.filter(e=>!i.has(e.id)),$.selectedId=eg(n)?n:null,ih(),gg(r,!!$.selectedId,!0),Ch(),Lm(),ig()}var bh=0;async function xh(e){let t=++bh,n=e.config.endpoint.trim(),r=Q.mcpInventoryStatus;if(Q.mcpToolsList.replaceChildren(),Q.mcpPromptsList.replaceChildren(),!n){r.hidden=!1,r.textContent=`Set an endpoint to load the MCP tools and prompts.`;return}r.hidden=!1,r.textContent=`Loading MCP tools and prompts…`;let i=await ko({endpoint:n});if(t===bh){if(!i.ok){r.hidden=!1,r.textContent=i.error?`Failed to load MCP inventory: ${i.error}`:`Failed to load MCP inventory.`;return}r.hidden=!0,Sh(Q.mcpToolsList,i.tools??[],`No tools exposed.`),Sh(Q.mcpPromptsList,i.prompts??[],`No prompts exposed.`)}}function Sh(e,t,n){if(e.replaceChildren(),t.length===0){let t=document.createElement(`li`);t.className=`inventory-empty`,t.textContent=n,e.appendChild(t);return}for(let n of t){let t=document.createElement(`li`);t.textContent=n,e.appendChild(t)}}function Ch(){let e=$h(),t=!!e;if(Cm.hidden=!t,Sm.hidden=!t||km,!e){Xp.title=`Add LLM provider`,Qp.textContent=`Test`,Qp.hidden=!0,Qp.disabled=!0;return}Q.name.value=e.label,Q.kind.value=e.kind,Q.providerId.value=e.kind===`llm`?e.id:``,Q.endpoint.value=e.config.endpoint,Q.token.value=e.config.token,kh(e.config.model),Q.providerTypeChat.checked=e.config.providerType!==`image`,Q.providerTypeImage.checked=e.config.providerType===`image`,Q.toolModeTools.checked=e.config.toolMode!==`chat`,Q.toolModeChat.checked=e.config.toolMode===`chat`,Q.workspaceFolder.value=e.config.workspaceFolder,Q.workspaceField.hidden=e.kind!==`agent`,Q.timeout.value=String(e.config.timeout),Q.description.value=e.config.description,Q.typeBadge.textContent=Qh(e),Q.kind.disabled=!0,Q.llmFields.hidden=e.kind===`mcp`||e.kind===`agent`,Oh(e),Q.mcpInventory.hidden=e.kind!==`mcp`,e.kind===`mcp`?xh(e):bh+=1,Q.agentSection.hidden=e.kind!==`agent`,e.kind===`agent`&&Th(e),Q.systemPrompt.value=e.config.systemPrompt,Q.requiresUserInput.checked=e.config.requiresUserInput,Dh(),Q.userInputDescription.value=e.config.userInputDescription,Q.expectedOutputMarker.value=e.config.expectedOutputMarker,am.hidden=tg(e.id),Qp.textContent=`Test`,Qp.hidden=e.kind!==`llm`&&e.kind!==`agent`,Qp.disabled=e.kind===`llm`?!e.config.model:e.kind!==`agent`;let n=e.kind===`llm`?e:eg(e.parentId);Xp.title=n?.kind===`llm`&&n.config.providerType!==`image`?`Add agent`:`Add LLM provider`}function wh(){let e=$h();if(e&&(e.label=Q.name.value.trim()||`Untitled node`,e.kind=Q.kind.value,e.config.endpoint=Q.endpoint.value,e.config.token=Q.token.value,e.config.model=Q.model.value,e.config.providerType=Q.providerTypeImage.checked?`image`:`chat`,e.config.toolMode=Q.toolModeChat.checked?`chat`:`tools`,e.config.timeout=Number(Q.timeout.value||30),e.config.description=Q.description.value,e.config.systemPrompt=Q.systemPrompt.value,e.config.requiresUserInput=Q.requiresUserInput.checked,e.config.userInputDescription=Q.userInputDescription.value,e.config.expectedOutputMarker=Q.expectedOutputMarker.value,Dh(),Oh(e),Q.typeBadge.textContent=Qh(e),e.kind===`llm`))for(let t of $.entities)t.parentId===e.id&&t.kind===`agent`&&(t.config.model=e.config.model,t.config.timeout=e.config.timeout)}function Th(e){let t=Q.agentProvider;t.innerHTML=``;let n=$.entities.filter(e=>e.kind===`llm`&&e.config.providerType!==`image`);for(let e of n){let n=document.createElement(`option`);n.value=e.id,n.textContent=e.label,t.appendChild(n)}t.value=e.parentId??``}function Eh(e){let t=$h();if(t?.kind!==`agent`)return;let n=eg(e);n?.kind===`llm`&&t.parentId!==e&&(t.parentId=e,t.config.model=n.config.model,t.config.timeout=n.config.timeout,ih(),Lm(),ig())}function Dh(){let e=$h()?.kind===`agent`&&Q.requiresUserInput.checked;Q.userInputDescriptionField.hidden=!e,Q.userInputDescription.required=e}function Oh(e){let t=e.kind===`llm`,n=e.config.providerType===`image`;Q.providerIdField.hidden=!t,Q.toolModeField.hidden=!t||n,$p.title=Y(n?`workspace.model.load_image`:`workspace.model.load_chat`),Qp.title=n?`Test image provider configuration`:`Test chat provider configuration`}function kh(e){let t=$h(),n=t?.kind===`llm`?tm.get(Hh(t)):void 0;if(n){let t=e&&!n.includes(e)?[e,...n]:n;t!==em&&Uh(t),Q.model.value=e||t[0];return}em.length>0&&(Uh([]),Q.model.innerHTML=``);let r=Array.from(Q.model.options).map(e=>e.value);if(e&&!r.includes(e)){Q.model.innerHTML=``;let t=document.createElement(`option`);t.value=e,t.textContent=e,Q.model.appendChild(t)}Q.model.value=e||(r[0]??``)}function Ah(){let e=$h();if(e?.kind!==`agent`)return;wh();let t=eg(e.parentId??``);if(t?.kind!==`llm`){Vm(`No parent LLM found for this agent.`,`error`);return}if(!t.config.model){Vm(`Parent LLM has no model selected.`,`error`);return}if(!e.config.systemPrompt.trim()){Vm(`Write a system prompt first.`,`error`);return}if(e.config.requiresUserInput&&!e.config.userInputDescription.trim()){Vm(`Describe the required user input first.`,`error`);return}Dm=e.id,hm.textContent=`Test ${e.label}`,gm.textContent=e.config.requiresUserInput?e.config.userInputDescription:`Run this agent with its configured system prompt.`,_m.hidden=!e.config.requiresUserInput,vm.required=e.config.requiresUserInput,vm.value=``,ym.hidden=!0,ym.textContent=``,xm.disabled=!1,xm.textContent=`Run`,mm.hidden=!1,e.config.requiresUserInput?window.setTimeout(()=>vm.focus(),0):window.setTimeout(()=>xm.focus(),0)}function jh(){mm.hidden=!0,Dm=null}async function Mh(){if(vm.required&&!vm.value.trim()){vm.reportValidity();return}let e=Dm?eg(Dm):null;if(e?.kind!==`agent`){Lh(`error`,`The selected agent is no longer available.`);return}let t=eg(e.parentId??``);if(t?.kind!==`llm`){Lh(`error`,`No parent LLM found for this agent.`);return}xm.disabled=!0,xm.textContent=`Running…`;let n=Bm(`Running agent…`);Ph();let r=$.entities.find(e=>e.kind===`mcp`),i=!1,a=await Ao({providerId:t.id,endpoint:t.config.endpoint,model:t.config.model,systemPrompt:e.config.systemPrompt,userInput:vm.value.trim()||void 0,timeout:t.config.timeout,mcpEndpoint:t.config.toolMode===`chat`?void 0:r?.config.endpoint||void 0,toolMode:t.config.toolMode,expectedOutputMarker:e.config.expectedOutputMarker||void 0},e=>{e.type===`error`&&(i=!0),e.type!==`final`&&e.type!==`error`&&Bm(Nh(e),n),Fh(e)});xm.disabled=!1,xm.textContent=`Run`,a.ok&&a.content?(Ih(a.content),Vm(`Agent responded. Result saved in AI/WORKSPACE.`,`success`,qp,n)):(i||Fh({type:`error`,message:a.error??`Agent failed.`}),ym.dataset.state=`error`,Vm(a.error??`Agent failed.`,`error`,qp,n))}function Nh(e){return e.type===`tool_call`&&e.toolName?`Agent tool call: ${e.toolName}`:e.type===`tool_result`&&e.toolName?`Agent tool result: ${e.toolName}`:`Agent: ${e.message}`}function Ph(){ym.hidden=!1,ym.dataset.state=`loading`,ym.textContent=``,Fh({type:`status`,message:`Preparing agent request`})}function Fh(e){ym.hidden=!1,e.type===`error`&&(ym.dataset.state=`error`);let t=document.createElement(`div`);t.className=`agent-run-event agent-run-event-${e.type.replace(`_`,`-`)}`;let n=document.createElement(`span`);n.className=`agent-run-event-dot`,n.setAttribute(`aria-hidden`,`true`);let r=document.createElement(`div`);r.className=`agent-run-event-body`;let i=document.createElement(`p`);i.className=`agent-run-event-title`,i.textContent=e.message,r.appendChild(i);let a=[];if(e.turn&&a.push(`Turn ${e.turn}`),e.toolName&&a.push(e.toolName),e.detail&&a.push(e.detail),a.length){let e=document.createElement(`p`);e.className=`agent-run-event-meta`,e.textContent=a.join(` · `),r.appendChild(e)}t.append(n,r),ym.appendChild(t),ym.scrollTop=ym.scrollHeight}function Ih(e){ym.dataset.state=`success`;let t=document.createElement(`section`);t.className=`agent-run-final`;let n=document.createElement(`h3`);n.textContent=`Final response`;let r=document.createElement(`pre`);r.textContent=e,t.append(n,r),ym.appendChild(t),ym.scrollTop=ym.scrollHeight}function Lh(e,t){ym.hidden=!1,ym.dataset.state=e,ym.textContent=t}var Rh=/^(?:env:[A-Za-z_][A-Za-z0-9_]*|\$\{[A-Za-z_][A-Za-z0-9_]*\})$/;function zh(e){let t=e.trim();return t!==``&&!Rh.test(t)}function Bh(e){let t=e.trim();return zh(t)?``:t}var Vh=`API token must reference an environment variable, e.g. env:LLM_API_KEY`;function Hh(e){return`${e.config.providerType}|${e.config.endpoint}`}function Uh(e){if(em=e,e.length>0){Q.model.innerHTML=``;for(let t of e){let e=document.createElement(`option`);e.value=t,e.textContent=t,Q.model.appendChild(e)}}Q.modelFilter.value=``,Q.modelFilter.hidden=e.length===0,Gh()}function Wh(){let e=Q.modelFilter.value.toLowerCase().split(/\s+/).filter(Boolean);if(e.length===0||em.length===0){Gh();return}if(nm=em.filter(t=>{let n=t.toLowerCase();return e.every(e=>n.includes(e))}),rm>=nm.length&&(rm=-1),Q.modelResults.innerHTML=``,nm.forEach((e,t)=>{let n=document.createElement(`li`);n.id=`nodeModelResult-${t}`,n.role=`option`,n.dataset.model=e,n.textContent=e,n.classList.toggle(`active`,t===rm),n.setAttribute(`aria-selected`,String(e===Q.model.value)),Q.modelResults.appendChild(n)}),nm.length===0){let e=document.createElement(`li`);e.className=`empty`,e.textContent=Y(`workspace.model.no_match`),Q.modelResults.appendChild(e)}let t=Y(`workspace.model.filter_count`,{shown:String(nm.length),total:String(em.length)});Q.modelResults.setAttribute(`aria-label`,t),Q.modelFilter.title=t,Q.modelResults.hidden=!1,Q.modelFilter.setAttribute(`aria-expanded`,`true`),rm>=0?(Q.modelFilter.setAttribute(`aria-activedescendant`,`nodeModelResult-${rm}`),Q.modelResults.children[rm]?.scrollIntoView({block:`nearest`})):Q.modelFilter.removeAttribute(`aria-activedescendant`)}function Gh(){nm=[],rm=-1,Q.modelResults.hidden=!0,Q.modelResults.innerHTML=``,Q.modelFilter.setAttribute(`aria-expanded`,`false`),Q.modelFilter.removeAttribute(`aria-activedescendant`)}function Kh(e){Q.model.value=e,Q.model.dispatchEvent(new Event(`input`,{bubbles:!0})),Q.model.dispatchEvent(new Event(`change`,{bubbles:!0})),Q.modelFilter.value=``,Gh()}async function qh(){let e=$h();if(e?.kind!==`llm`)return;wh();let t=e.config.endpoint;if(!t){Vm(Y(`workspace.model.endpoint_required`));return}if(zh(e.config.token)){Vm(Vh);return}$p.classList.add(`loading`),$p.disabled=!0,Q.model.disabled=!0;let n=await Oo({endpoint:t,token:e.config.token,providerType:e.config.providerType});if($p.classList.remove(`loading`),$p.disabled=!1,Q.model.disabled=!1,!n.ok||!n.models?.length){Vm(n.error??Y(`workspace.model.none_found`));return}let r=Q.model.value;tm.set(Hh(e),n.models),Uh(n.models),Q.model.value=n.models.includes(r)?r:n.models[0],e.config.model=Q.model.value,Qp.disabled=!Q.model.value,Vm(n.models.length===1?Y(`workspace.model.loaded_one`):Y(`workspace.model.loaded_many`,{count:String(n.models.length)})),ig()}async function Jh(){let e=$h();if(e?.kind!==`llm`)return;if(wh(),zh(e.config.token)){Vm(Vh);return}Qp.disabled=!0,Bm(`Testing ${e.config.model}…`),ig();let t=e.config.providerType===`image`?await Yh(e):await Mo({endpoint:e.config.endpoint,token:e.config.token,model:e.config.model,timeout:e.config.timeout});Qp.disabled=!1,t.ok?Vm(t.detail??`Connection OK`,`success`):Vm(t.error||`Connection failed (${t.status||`no status`})`,`error`),ig()}async function Yh(e){let t=await Oo({endpoint:e.config.endpoint,token:e.config.token,providerType:`image`});if(!t.ok)return{ok:!1,error:t.error??`Image provider test failed`};let n=e.config.model.trim();return n&&t.models?.length&&!t.models.includes(n)?{ok:!1,error:`Image models loaded, but "${n}" was not found.`}:{ok:!0,detail:`${t.models?.length??0} image model${t.models?.length===1?``:`s`} available`}}async function Xh(){let e=$h();if(e?.kind===`llm`)try{await navigator.clipboard.writeText(e.id),Vm(`Provider ID copied`,`success`)}catch{Q.providerId.select(),Vm(`Provider ID selected`,`success`)}}function Zh(e){return{system:`System`,llm:`LLM provider`,agent:`Agent`,mcp:`MCP`}[e]||`Node`}function Qh(e){return e.kind===`llm`&&e.config.providerType===`image`?`Image provider`:Zh(e.kind)}function $h(){return $.selectedId?eg($.selectedId):null}function eg(e){return $.entities.find(t=>t.id===e)}function tg(e){return e===`root`||e===`mcp`}function ng(e){return $.entities.filter(t=>t.parentId===e)}function rg(e){let t=[];for(let n of ng(e))t.push(n.id,...rg(n.id));return t}function ig(){km?Jp.requestPaint():requestAnimationFrame(ag)}function ag(){let e=Jp.width/$.dpr,t=Jp.height/$.dpr;Z.reset(),Z.setTransform($.dpr,0,0,$.dpr,0,0),Z.clearRect(0,0,e,t),Z.save(),Z.translate($.cameraX,$.cameraY),Z.scale($.zoom,$.zoom),og(e,t),sg(),Z.restore(),km&&mg(e,t)}function og(e,t){Z.save(),Z.lineWidth=1/$.zoom;let n=Tg({x:0,y:0}),r=Tg({x:e,y:t}),i=Math.floor(n.x/hp)*hp,a=Math.ceil(r.x/hp)*hp,o=Math.floor(n.y/hp)*hp,s=Math.ceil(r.y/hp)*hp;for(let e=i;e<=a;e+=hp)Z.strokeStyle=e%gp===0?`#d7dce5`:`#edf0f4`,Hg(e,o,e,s);for(let e=o;e<=s;e+=hp)Z.strokeStyle=e%gp===0?`#d7dce5`:`#edf0f4`,Hg(i,e,a,e);Z.restore()}function sg(){cg();for(let e of $.entities)lg(e)}function cg(){Z.save(),Z.lineWidth=2/$.zoom;for(let e of $.entities){let t=eg(e.parentId);if(!t)continue;let n=Math.atan2(e.y-t.y,e.x-t.x),r=Dg(t,n),i=Dg(e,n+Math.PI);Z.strokeStyle=fg(e).connection,Z.beginPath(),Z.moveTo(r.x,r.y),Z.lineTo(i.x,i.y),Z.stroke()}Z.restore()}function lg(e){if(e.kind===`system`||e.kind===`llm`){ug(e);return}dg(e)}function ug(e){let t=e.id===$.selectedId,n=fg(e),r=e.kind===`system`?fp:pp,i=ng(e.id),a=Math.max(mp,i.length),o=zg(e.x,e.y,r,a);Z.save(),Z.beginPath(),o.forEach((e,t)=>{t===0?Z.moveTo(e.x,e.y):Z.lineTo(e.x,e.y)}),Z.closePath(),Z.fillStyle=t?n.selectedFill:n.fill,Z.strokeStyle=t?n.selectedStroke:n.stroke,Z.lineWidth=(t?3:2)/$.zoom,Z.shadowColor=n.shadow,Z.shadowBlur=e.kind===`system`?20:14,Z.shadowOffsetY=e.kind===`system`?8:5,Z.fill(),Z.shadowColor=`transparent`,Z.stroke(),Z.fillStyle=t?n.selectedText:n.text,Z.textAlign=`center`,Z.textBaseline=`middle`,Z.font=e.kind===`system`?`800 21px Inter, system-ui, sans-serif`:`800 16px Inter, system-ui, sans-serif`,Vg(e.label,e.x,e.y-8,r*1.32,e.kind===`system`?26:20),pg(e,t,r),Z.restore()}function dg(e){let t=e.id===$.selectedId,n=fg(e),r=e.kind===`mcp`?116:up,i=e.kind===`mcp`?58:dp;Z.save(),Bg(e.x-r/2,e.y-i/2,r,i,20),Z.fillStyle=t?n.selectedFill:n.fill,Z.strokeStyle=t?n.selectedStroke:n.stroke,Z.lineWidth=(t?3:2)/$.zoom,Z.shadowColor=n.shadow,Z.shadowBlur=10,Z.shadowOffsetY=4,Z.fill(),Z.shadowColor=`transparent`,Z.stroke(),Z.fillStyle=t?n.selectedText:n.text,Z.font=`760 15px Inter, system-ui, sans-serif`,Z.textAlign=`center`,Z.textBaseline=`middle`,Vg(e.label,e.x,e.y,r*.78,18),pg(e,t,Math.max(r,i)/2),Z.restore()}function fg(e){if(e.kind===`system`)return{fill:`#111827`,stroke:`#111827`,selectedFill:`#111827`,selectedStroke:`#111827`,text:`#ffffff`,selectedText:`#ffffff`,shadow:`rgb(17 24 39 / 18%)`,connection:`#475569`};if(e.kind===`llm`&&e.config.providerType===`image`)return{fill:`#facc15`,stroke:`#ca8a04`,selectedFill:`#eab308`,selectedStroke:`#a16207`,text:`#111827`,selectedText:`#111827`,shadow:`rgb(250 204 21 / 22%)`,connection:`#ca8a04`};if(e.kind===`llm`&&e.config.toolMode===`chat`)return{fill:`#f472b6`,stroke:`#db2777`,selectedFill:`#ec4899`,selectedStroke:`#be185d`,text:`#500724`,selectedText:`#500724`,shadow:`rgb(244 114 182 / 20%)`,connection:`#db2777`};if(e.kind===`llm`)return{fill:`#f97316`,stroke:`#ea580c`,selectedFill:`#fb923c`,selectedStroke:`#c2410c`,text:`#431407`,selectedText:`#431407`,shadow:`rgb(249 115 22 / 20%)`,connection:`#ea580c`};if(e.kind===`mcp`)return{fill:`#64748b`,stroke:`#475569`,selectedFill:`#475569`,selectedStroke:`#334155`,text:`#ffffff`,selectedText:`#ffffff`,shadow:`rgb(100 116 139 / 18%)`,connection:`#64748b`};if(e.kind===`agent`){let t=eg(e.parentId);return t?.kind===`llm`&&t.config.toolMode===`chat`?{fill:`#f9a8d4`,stroke:`#f472b6`,selectedFill:`#ec4899`,selectedStroke:`#db2777`,text:`#111827`,selectedText:`#111827`,shadow:`rgb(244 114 182 / 18%)`,connection:`#f472b6`}:{fill:`#fdba74`,stroke:`#f97316`,selectedFill:`#fb923c`,selectedStroke:`#ea580c`,text:`#111827`,selectedText:`#111827`,shadow:`rgb(249 115 22 / 18%)`,connection:`#f97316`}}return{fill:`#ffffff`,stroke:`#0f172a`,selectedFill:`#111827`,selectedStroke:`#0f172a`,text:`#111827`,selectedText:`#ffffff`,shadow:`rgb(15 23 42 / 8%)`,connection:`#111827`}}function pg(e,t,n){t&&(Z.beginPath(),Z.arc(e.x+n*.62,e.y-n*.66,5,0,Math.PI*2),Z.fillStyle=`#34d399`,Z.fill())}function mg(e,t){if(!$h())return;let n=Mg(e),r=Math.min(bp,t-118),i=e-n-24,a=Math.max(24,(t-r)/2);try{let e=Z.drawElementImage(Cm,i,a,n,r);Cm.style.transform=e.toString()}catch{Yp.textContent=`Waiting for HTML snapshot`}}function hg(e,t){let n=Jp.clientWidth,r=Jp.clientHeight,i=$h()?Mg(n)+xp:0,a=Math.max(360,n-i),o=xg(),s=Sg(o,a,r),c=t?s:Math.min($.zoom,s),l=(o.minX+o.maxX)/2,u=(o.minY+o.maxY)/2,d=a*.5-l*c,f=r*.5-u*c;if(!e||!$.cameraX||!$.cameraY){Cg(),$.cameraX=d,$.cameraY=f,$.zoom=c,$.panelShiftX=i;return}$.panelShiftX=i,bg(d,f,c)}function gg(e,t,n){if(t){if(e){let e=_g();$.panelShiftX+=Math.max(0,-e),yg(e,n)}else{let e=$h();if(e){let t=Mg(Jp.clientWidth)+xp,n=(Jp.clientWidth-t)/2-e.x*$.zoom,r=n-$.cameraX;$.panelShiftX=-r,bg(n,$.cameraY,$.zoom)}}return}if(!e)return;let r=$.panelShiftX;$.panelShiftX=0,yg(r,n)}function _g(){let e=$h();if(!e)return 0;let t=Jp.clientWidth-Mg(Jp.clientWidth)-24-jp,n=vg(e);return n.right<=t?0:t-n.right}function vg(e){let t=Fg(e);return{left:t.left*$.zoom+$.cameraX,top:t.top*$.zoom+$.cameraY,right:t.right*$.zoom+$.cameraX,bottom:t.bottom*$.zoom+$.cameraY}}function yg(e,t){if(Cg(),!e)return;let n=$.cameraX+e;if(!t){$.cameraX=n;return}bg(n,$.cameraY,$.zoom)}function bg(e,t,n){Cg();let r=$.cameraX,i=$.cameraY,a=$.zoom,o=performance.now();function s(c){let l=Math.min(1,(c-o)/kp),u=1-(1-l)**3;$.cameraX=r+(e-r)*u,$.cameraY=i+(t-i)*u,$.zoom=a+(n-a)*u,ih(),ig(),l<1?$.viewAnimationId=requestAnimationFrame(s):$.viewAnimationId=null}$.viewAnimationId=requestAnimationFrame(s)}function xg(){return $.entities.reduce((e,t)=>{let n=hh(t);return{minX:Math.min(e.minX,t.x-n),minY:Math.min(e.minY,t.y-n),maxX:Math.max(e.maxX,t.x+n),maxY:Math.max(e.maxY,t.y+n)}},{minX:1/0,minY:1/0,maxX:-1/0,maxY:-1/0})}function Sg(e,t,n){let r=e.maxX-e.minX,i=e.maxY-e.minY;if(!Number.isFinite(r)||!Number.isFinite(i)||r<=0||i<=0)return 1;let a=Math.max(1,t-Ap*2),o=Math.max(1,n-Ap*2);return Eg(Math.min(1,a/r,o/i),Np,1)}function Cg(){$.viewAnimationId&&(cancelAnimationFrame($.viewAnimationId),$.viewAnimationId=null)}function wg(e,t){Cg();let n=Tg(e);$.zoom=Eg($.zoom*t,Np,Pp),$.cameraX=e.x-n.x*$.zoom,$.cameraY=e.y-n.y*$.zoom,ig()}function Tg(e){return{x:(e.x-$.cameraX)/$.zoom,y:(e.y-$.cameraY)/$.zoom}}function Eg(e,t,n){return Math.min(n,Math.max(t,e))}function Dg(e,t){if(e.kind!==`system`&&e.kind!==`llm`)return Ag(e,t);let n=e.kind===`system`?fp:pp,r=ng(e.id);return Og(e,n,Math.max(mp,r.length),t)||{x:e.x+Math.cos(t)*n,y:e.y+Math.sin(t)*n}}function Og(e,t,n,r){let i={x:Math.cos(r),y:Math.sin(r)},a=zg(e.x,e.y,t,n),o=null;for(let t=0;t<a.length;t+=1){let n=a[t],r=a[(t+1)%a.length],s={x:r.x-n.x,y:r.y-n.y},c={x:n.x-e.x,y:n.y-e.y},l=kg(i,s);if(Math.abs(l)<1e-4)continue;let u=kg(c,s)/l,d=kg(c,i)/l;if(u>=0&&d>=0&&d<=1){let t={x:e.x+i.x*u,y:e.y+i.y*u};(!o||u<o.rayDistance)&&(o={...t,rayDistance:u})}}return o?{x:o.x,y:o.y}:null}function kg(e,t){return e.x*t.y-e.y*t.x}function Ag(e,t){let n=Ng(e),r=n.width/2,i=n.height/2,a=Math.cos(t),o=Math.sin(t),s=Math.min(Math.abs(r/(a||2**-52)),Math.abs(i/(o||2**-52)));return{x:e.x+a*s,y:e.y+o*s}}function jg(e,t){if(e.kind===`system`||e.kind===`llm`){let n=e.kind===`system`?fp:pp;return Math.hypot(t.x-e.x,t.y-e.y)<=n+Op}let{width:n,height:r}=Ng(e);return Math.abs(t.x-e.x)<=n/2+Op&&Math.abs(t.y-e.y)<=r/2+Op}function Mg(e){return Math.min(vp,Math.max(_p,Math.floor(e*yp)))}function Ng(e){return e.kind===`mcp`?{width:116,height:58}:{width:up,height:dp}}function Pg(e){return[e,...rg(e.id).map(eg)].filter(Boolean).map(Fg).reduce(Ig)}function Fg(e){if(e.kind===`system`||e.kind===`llm`){let t=e.kind===`system`?fp:pp;return{left:e.x-t,top:e.y-t,right:e.x+t,bottom:e.y+t}}let{width:t,height:n}=Ng(e);return{left:e.x-t/2,top:e.y-n/2,right:e.x+t/2,bottom:e.y+n/2}}function Ig(e,t){return{left:Math.min(e.left,t.left),top:Math.min(e.top,t.top),right:Math.max(e.right,t.right),bottom:Math.max(e.bottom,t.bottom)}}function Lg(e,t,n){return!(e.right+n<t.left||e.left-n>t.right||e.bottom+n<t.top||e.top-n>t.bottom)}function Rg(e){let t=Jp.getBoundingClientRect();return{x:e.clientX-t.left,y:e.clientY-t.top}}function zg(e,t,n,r){return Array.from({length:r},(i,a)=>{let o=-Math.PI/2+a/r*Math.PI*2;return{x:e+Math.cos(o)*n,y:t+Math.sin(o)*n}})}function Bg(e,t,n,r,i){let a=e+n,o=t+r;Z.beginPath(),Z.moveTo(e+i,t),Z.lineTo(a-i,t),Z.quadraticCurveTo(a,t,a,t+i),Z.lineTo(a,o-i),Z.quadraticCurveTo(a,o,a-i,o),Z.lineTo(e+i,o),Z.quadraticCurveTo(e,o,e,o-i),Z.lineTo(e,t+i),Z.quadraticCurveTo(e,t,e+i,t),Z.closePath()}function Vg(e,t,n,r,i){let a=e.split(/\s+/),o=[],s=``;for(let e of a){let t=s?`${s} ${e}`:e;Z.measureText(t).width>r&&s?(o.push(s),s=e):s=t}o.push(s);let c=n-(o.length-1)*i/2;o.forEach((e,n)=>{Z.fillText(e,t,c+n*i)})}function Hg(e,t,n,r){Z.beginPath(),Z.moveTo(e,t),Z.lineTo(n,r),Z.stroke()}var Ug=U(`<div class="status-row"><span id="apiStatus"></span></div>`),Wg=U('<div class="app-shell"><!> <section class="workspace-shell" aria-label="Configuration graph workspace"><nav class="rail" aria-label="Workspace tools"><button id="addButton" class="tool-button primary" type="button" title="Add node">+</button> <button id="fitButton" class="tool-button" type="button" title="Fit view">⌖</button></nav> <canvas id="workspaceCanvas" class="workspace-canvas" layoutsubtree=""><form id="configSurface" class="config-surface" autocomplete="off"><div class="panel-kicker"><span id="nodeTypeBadge">Provider</span> <button id="closePanelButton" class="icon-button close" type="button" title="Close panel">×</button></div> <div class="panel-title-row"><label class="eyebrow" for="nodeName">Node name</label> <input id="nodeName" name="nodeName" class="title-input" type="text"/></div> <div class="form-grid"><label class="field"><span>Kind</span> <select id="nodeKind" name="nodeKind"><option>System</option><option>LLM provider</option><option>Agent</option><option>MCP</option></select></label> <div id="llmFields" class="contents"><div id="providerIdField" class="field wide"><span>Provider ID</span> <div class="model-select-wrap"><input id="nodeProviderId" name="nodeProviderId" type="text" readonly=""/> <button id="copyProviderIdButton" class="icon-button" type="button" title="Copy provider ID">⧉</button></div> <small class="field-note">Technical node id. Use it when a tool or agent workflow needs to reference this provider, for example as <code>imageProviderId</code> with <code>generate_image</code>.</small></div> <label class="field wide"><span>Endpoint</span> <input id="nodeEndpoint" name="nodeEndpoint" type="url" placeholder="http://localhost:11434"/></label> <label class="field wide"><span>API token</span> <input id="nodeToken" name="nodeToken" type="text" autocomplete="off" spellcheck="false" placeholder="env:LLM_API_KEY"/> <small class="field-note">Reference an environment variable only — <code>env:VAR_NAME</code> (or <code>{VAR_NAME}</code>). The secret is read from the server environment at request time; literal tokens are not stored (the workspace file is tracked by git).</small></label> <div class="field wide model-field-row"><span> </span> <input id="nodeModelFilter" class="model-filter" type="search" role="combobox" aria-autocomplete="list" aria-controls="nodeModelResults" aria-expanded="false" autocomplete="off" spellcheck="false" hidden=""/> <ul id="nodeModelResults" class="model-results" role="listbox" hidden=""></ul> <div class="model-select-wrap"><select id="nodeModel" name="nodeModel"><option disabled="" selected=""> </option></select> <button id="loadModelsButton" class="icon-button" type="button">↻</button></div></div> <fieldset class="field wide tool-mode-field"><legend>Provider type</legend> <label class="radio-card"><input id="nodeProviderTypeChat" name="nodeProviderType" type="radio" value="chat"/> <span><strong>Chat completion</strong> <small>Uses OpenAI-compatible <code>/chat/completions</code>.</small></span></label> <label class="radio-card"><input id="nodeProviderTypeImage" name="nodeProviderType" type="radio" value="image"/> <span><strong>Image generation</strong> <small>Used by <code>generate_image</code> with the provider id above.</small></span></label></fieldset> <fieldset id="toolModeField" class="field wide tool-mode-field"><legend>Tool calling</legend> <label class="radio-card"><input id="nodeToolModeTools" name="nodeToolMode" type="radio" value="tools"/> <span><strong>Allow MCP tools</strong> <small>Agents can send OpenAI-compatible <code>tools</code> payloads.</small></span></label> <label class="radio-card"><input id="nodeToolModeChat" name="nodeToolMode" type="radio" value="chat"/> <span><strong>Chat only</strong> <small>Agents never send tools, even when an MCP endpoint exists.</small></span></label></fieldset> <label class="field"><span>Timeout</span> <input id="nodeTimeout" name="nodeTimeout" type="number" min="1" max="600" step="1"/></label></div> <label class="field wide"><span>Description</span> <textarea id="nodeDescription" name="nodeDescription" rows="3"></textarea></label></div> <section id="agentSection" class="agent-section" hidden=""><label id="agentProviderField" class="field wide"><span>LLM provider</span> <select id="nodeAgentProvider" name="nodeAgentProvider"></select> <small class="field-note">Move this agent to another LLM provider. It inherits the target provider\'s model and timeout.</small></label> <label id="agentWorkspaceField" class="field wide"><span>Workspace folder</span> <input id="nodeWorkspaceFolder" name="nodeWorkspaceFolder" type="text" readonly=""/></label> <label class="field wide"><span>System prompt</span> <textarea id="nodeSystemPrompt" name="nodeSystemPrompt" rows="5" placeholder="You are a helpful assistant…"></textarea></label> <label class="field wide checkbox-field"><input id="nodeRequiresUserInput" name="nodeRequiresUserInput" type="checkbox"/> <span>Require a user input</span></label> <label id="agentUserInputDescriptionField" class="field wide" hidden=""><span>Describe User input</span> <textarea id="nodeUserInputDescription" name="nodeUserInputDescription" rows="3" placeholder="Describe exactly what the user must provide before running this agent."></textarea></label> <label class="field wide"><span>Required output marker</span> <input id="nodeExpectedOutputMarker" name="nodeExpectedOutputMarker" type="text" placeholder="Optional, e.g. ```mermaid"/></label></section> <section id="mcpInventory" class="mcp-inventory" hidden=""><div class="inventory-header"><span>MCP consultation surface</span> <strong>Streamable HTTP</strong></div> <p id="mcpInventoryStatus" class="inventory-status" hidden=""></p> <div class="inventory-grid"><article><h2>Tools</h2> <ul id="mcpToolsList"></ul></article> <article><h2>Prompts</h2> <ul id="mcpPromptsList"></ul></article></div></section> <footer class="panel-actions"><div class="panel-actions-left"><button id="testNodeButton" class="secondary-button" type="button">Test</button></div> <div class="panel-actions-right"><button id="deleteNodeButton" class="danger-button" type="button">Delete</button></div></footer></form></canvas> <div id="fallbackPanelHost" class="fallback-panel-host" hidden=""></div></section> <div id="deleteConfirmOverlay" class="confirm-overlay" hidden=""><section class="confirm-dialog" role="dialog" aria-modal="true" aria-labelledby="deleteConfirmTitle"><div><p class="confirm-kicker">Destructive change</p> <h2 id="deleteConfirmTitle">Delete node?</h2> <p id="deleteConfirmMessage" class="confirm-message"></p></div> <footer class="confirm-actions"><button id="cancelDeleteButton" class="secondary-button" type="button">Cancel</button> <button id="confirmDeleteButton" class="danger-button" type="button">Delete</button></footer></section></div> <div id="renameConfirmOverlay" class="confirm-overlay" hidden=""><section class="confirm-dialog" role="dialog" aria-modal="true" aria-labelledby="renameConfirmTitle"><div><p class="confirm-kicker">Renommage de dossier</p> <h2 id="renameConfirmTitle">Renommer le dossier ?</h2> <p id="renameConfirmMessage" class="confirm-message"></p></div> <footer class="confirm-actions"><button id="cancelRenameButton" class="secondary-button" type="button">Annuler</button> <button id="confirmRenameButton" class="primary-button" type="button">Renommer</button></footer></section></div> <div id="agentRunOverlay" class="confirm-overlay" hidden=""><section class="agent-run-dialog" role="dialog" aria-modal="true" aria-labelledby="agentRunTitle"><div><p class="confirm-kicker">Agent test</p> <h2 id="agentRunTitle">Run agent</h2> <p id="agentRunHint" class="confirm-message"></p></div> <label id="agentRunInputField" class="field wide agent-run-input-field"><span>User input</span> <textarea id="agentRunInput" name="agentRunInput" rows="6" placeholder="Document ID, question, or any input for the agent…"></textarea></label> <div id="agentRunResult" class="agent-run-result" hidden=""></div> <footer class="confirm-actions"><button id="cancelAgentRunButton" class="secondary-button" type="button">Close</button> <button id="executeAgentRunButton" class="primary-button" type="button">Run</button></footer></section></div></div>');function Gg(e,t){qe(t,!0),Ji(async()=>{try{await Ca((await fetch(`/api/config`).then(e=>e.json())).language||`en`)}catch{}return Am()});var n=Wg(),r=L(n);es(r,{title:`Living AI Documentation`,subtitle:`Graph-native configuration workspace`,children:(e,t)=>{var n=Ug(),r=L(n);vi(r,1,`status-pill `),r.textContent=`Detecting canvas API`,j(n),W(e,n)},$$slots:{default:!0}});var i=z(r,2),a=z(L(i),2),o=L(a),s=z(L(o),4),c=L(s),l=z(L(c),2),u=L(l);u.value=u.__value=`system`;var d=z(u);d.value=d.__value=`llm`;var f=z(d);f.value=f.__value=`agent`;var p=z(f);p.value=p.__value=`mcp`,j(l),j(c);var m=z(c,2),h=z(L(m),6),g=L(h),_=L(g,!0);j(g);var v=z(g,2),y=z(v,4),b=L(y),x=L(b),S=L(x,!0);j(x),x.value=x.__value=``,j(b);var C=z(b,2);j(y),j(h),Ie(6),j(m),Ie(2),j(s),Ie(6),j(o),j(a),Ie(2),j(i),Ie(6),j(n),B((e,t,n,r)=>{G(_,e),J(v,`placeholder`,t),G(S,n),J(C,`title`,r)},[()=>Y(`workspace.model.label`),()=>Y(`workspace.model.filter_placeholder`),()=>Y(`workspace.model.placeholder`),()=>Y(`workspace.model.load`)]),W(e,n),Je()}var Kg=U(`<p class="files-msg svelte-4q2lov"> </p>`),qg=U(`<p class="files-msg files-msg--error svelte-4q2lov"> </p>`),Jg=U(`<p class="files-msg files-msg--empty svelte-4q2lov"> </p>`),Yg=U(`<option> </option>`),Xg=U(`<div class="files-toolbar svelte-4q2lov"><label for="files-folder-filter" class="svelte-4q2lov"> </label> <select id="files-folder-filter" data-testid="files-folder-filter" class="svelte-4q2lov"><option> </option><!></select></div>`),Zg=U(`<span class="files-folder svelte-4q2lov"> </span> ·`,1),Qg=U(`<p class="files-row-error svelte-4q2lov"> </p>`),$g=U(`<li class="files-row svelte-4q2lov"><span class="files-icon svelte-4q2lov">📎</span> <div class="files-info svelte-4q2lov"><a target="_blank" rel="noopener" class="files-name svelte-4q2lov"> </a> <div class="files-meta svelte-4q2lov"><!><!> </div> <!></div> <div class="files-actions svelte-4q2lov"><button type="button" class="files-btn svelte-4q2lov"> </button> <button type="button" class="files-btn files-btn--danger svelte-4q2lov"> </button></div></li>`),e_=U(`<ul class="files-list svelte-4q2lov"></ul>`),t_=U(`<!> <!>`,1),n_=U(`<!> <div class="app-shell"><!> <div class="files-page svelte-4q2lov"><!></div></div>`,1);function r_(e,t){qe(t,!0);let n=P(null),r=P(I([])),i=P(I([])),a=P(``),o=P(!0),s=P(``),c=P(I({})),l=P(I({})),u=P(I({})),d=Lf,f=N(()=>V(a)?V(r).filter(e=>e.folder===V(a)||e.folder.startsWith(V(a)+`/`)):V(r));function p(e){return e<1024?Y(`files.size_bytes`).replace(`{n}`,String(e)):e<1024*1024?Y(`files.size_kb`).replace(`{n}`,(e/1024).toFixed(1)):Y(`files.size_mb`).replace(`{n}`,(e/1024/1024).toFixed(2))}function m(e){if(!e)return``;let t=new Date(e);if(isNaN(t.getTime()))return``;let n=e=>String(e).padStart(2,`0`);return`${t.getFullYear()}-${n(t.getMonth()+1)}-${n(t.getDate())} ${n(t.getHours())}:${n(t.getMinutes())}`}async function h(){F(o,!0),F(s,``);try{let e=await fetch(`/api/files`);if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json();F(r,Array.isArray(t.files)?t.files:[],!0),F(i,Array.isArray(t.folders)?t.folders:[],!0),V(a)&&!V(i).includes(V(a))&&F(a,``)}catch(e){F(s,Y(`files.error_load`)+(e instanceof Error?e.message:String(e)))}finally{F(o,!1)}}function g(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=n,r.readAsDataURL(e)})}function _(e){let t=document.createElement(`input`);t.type=`file`,t.style.display=`none`,document.body.appendChild(t),t.addEventListener(`change`,async()=>{let r=t.files?.[0];if(t.remove(),r&&await V(n).show({kicker:Y(`files.confirm_replace_title`),title:Y(`files.confirm_replace_message`).replace(`{name}`,e.displayName||e.filename).replace(`{newName}`,r.name),message:Y(`files.confirm_replace_detail`),confirmLabel:Y(`files.replace`),cancelLabel:Y(`common.cancel`),danger:!0})){if(r.size>d){F(c,{...V(c),[e.filename]:Y(`files.error_replace`)+`${(r.size/1024/1024).toFixed(1)} MB (max ${Rf} MB)`},!0);return}F(l,{...V(l),[e.filename]:!0},!0),F(c,{...V(c),[e.filename]:``},!0);try{let t=await g(r),n=await fetch(`/api/files/${encodeURIComponent(e.filename)}`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:t})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error||`HTTP ${n.status}`)}await h()}catch(t){F(c,{...V(c),[e.filename]:Y(`files.error_replace`)+(t instanceof Error?t.message:String(t))},!0)}finally{F(l,{...V(l),[e.filename]:!1},!0)}}}),t.click()}async function v(e){if(await V(n).show({kicker:Y(`files.confirm_delete_title`),title:Y(`files.confirm_delete_message`).replace(`{name}`,e.displayName||e.filename),message:Y(`files.confirm_delete_detail`),confirmLabel:Y(`files.delete`),cancelLabel:Y(`common.cancel`),danger:!0})){F(u,{...V(u),[e.filename]:!0},!0),F(c,{...V(c),[e.filename]:``},!0);try{let t=await fetch(`/api/files/${encodeURIComponent(e.filename)}`,{method:`DELETE`});if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error||`HTTP ${t.status}`)}await h()}catch(t){F(c,{...V(c),[e.filename]:Y(`files.error_delete`)+(t instanceof Error?t.message:String(t))},!0)}finally{F(u,{...V(u),[e.filename]:!1},!0)}}}Ji(async()=>{try{await Ca((await fetch(`/api/config`).then(e=>e.json())).language||`en`)}catch{}await h()});var y=n_(),b=R(y);Ui($d(b,{}),e=>F(n,e,!0),()=>V(n));var x=z(b,2),S=L(x);{let e=N(()=>Y(`files.title`));es(S,{get title(){return V(e)},subtitle:``})}var C=z(S,2),w=L(C),T=e=>{var t=Kg(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`common.loading`)]),W(e,t)},E=e=>{var t=qg(),n=L(t,!0);j(t),B(()=>G(n,V(s))),W(e,t)},D=e=>{var t=Jg(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`files.empty`)]),W(e,t)},ee=e=>{var t=t_(),n=R(t),r=e=>{var t=Xg(),n=L(t),r=L(n,!0);j(n);var o=z(n,2),s=L(o),c=L(s,!0);j(s),s.value=s.__value=``,q(z(s),16,()=>V(i),e=>e,(e,t)=>{var n=Yg(),r=L(n,!0);j(n);var i={};B(()=>{G(r,t),i!==(i=t)&&(n.value=(n.__value=t)??``)}),W(e,n)}),j(o);var l;Si(o),j(t),B((e,t)=>{G(r,e),G(c,t),l!==(l=V(a))&&(o.value=(o.__value=V(a))??``,xi(o,V(a)))},[()=>Y(`files.filter_label`),()=>Y(`files.filter_all`)]),H(`change`,o,e=>F(a,e.target.value,!0)),W(e,t)};K(n,e=>{V(i).length>0&&e(r)});var o=z(n,2),s=e=>{var t=Jg(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`files.empty_filter`)]),W(e,t)},d=e=>{var t=e_();q(t,21,()=>V(f),Qr,(e,t)=>{var n=$g(),r=z(L(n),2),i=L(r),a=L(i,!0);j(i);var o=z(i,2),s=L(o),d=e=>{var n=Zg(),r=R(n),i=L(r,!0);j(r),Ie(),B(()=>G(i,V(t).folder)),W(e,n)};K(s,e=>{V(t).folder&&e(d)});var f=z(s),h=e=>{var n=Ur();B(e=>G(n,`${e??``} ·`),[()=>m(V(t).uploadedAt)]),W(e,n)};K(f,e=>{V(t).uploadedAt&&e(h)});var g=z(f,1,!0);j(o);var y=z(o,2),b=e=>{var n=Qg(),r=L(n,!0);j(n),B(()=>G(r,V(c)[V(t).filename])),W(e,n)};K(y,e=>{V(c)[V(t).filename]&&e(b)}),j(r);var x=z(r,2),S=L(x),C=L(S,!0);j(S);var w=z(S,2),T=L(w,!0);j(w),j(x),j(n),B((e,n,r)=>{J(i,`href`,V(t).url),G(a,V(t).displayName||V(t).filename),G(g,e),S.disabled=V(l)[V(t).filename]||V(u)[V(t).filename],G(C,n),w.disabled=V(l)[V(t).filename]||V(u)[V(t).filename],G(T,r)},[()=>p(V(t).size||0),()=>V(l)[V(t).filename]?Y(`files.replacing`):Y(`files.replace`),()=>V(u)[V(t).filename]?Y(`files.deleting`):Y(`files.delete`)]),H(`click`,S,()=>_(V(t))),H(`click`,w,()=>v(V(t))),W(e,n)}),j(t),W(e,t)};K(o,e=>{V(f).length===0?e(s):e(d,-1)}),W(e,t)};K(w,e=>{V(o)?e(T):V(s)?e(E,1):V(r).length===0?e(D,2):e(ee,-1)}),j(C),j(x),W(e,y),Je()}Pr([`change`,`click`]);var i_=U(`<p class="browser-msg"> </p>`),a_=U(`<p class="browser-msg browser-msg--error"> </p>`),o_=U(`<button class="browser-row browser-row--dir"><span class="browser-row-name"> </span></button>`),s_=U(`<span class="badge-added"> </span>`),c_=U(`<button class="link-btn"> </button>`),l_=U(`<div class="browser-row browser-row--file"><span class="browser-row-name"> </span> <!></div>`),u_=U(`<!> <!>`,1),d_=U(`<div class="file-browser"><div class="file-browser-toolbar"><button class="link-btn"> </button> <span class="file-browser-path"> </span></div> <div class="file-browser-list" data-testid="instruction-browse-list"><!></div></div>`),f_=U(`<p class="empty-msg svelte-e5jhdq"> </p>`),p_=U(`<button class="remove-btn"> </button>`),m_=U(`<div class="instruction-row svelte-e5jhdq"><div class="instruction-info svelte-e5jhdq"><a class="instruction-path svelte-e5jhdq"> </a> <div class="instruction-meta svelte-e5jhdq"> <!></div></div> <div class="instruction-actions svelte-e5jhdq"><span> </span> <!></div></div>`),h_=U(`<div class="section-card svelte-e5jhdq"><div class="section-header svelte-e5jhdq"><span class="section-title svelte-e5jhdq"> </span> <div class="header-actions svelte-e5jhdq"><span class="count-label svelte-e5jhdq"> </span> <button class="secondary-button btn-sm"> </button></div></div> <!> <div class="instruction-list svelte-e5jhdq" data-testid="instruction-list"><!></div></div>`);function g_(e,t){qe(t,!0);let n=qi(t,`items`,27,()=>I([])),r=P(!1),i=P(``),a=P(``),o=P(I([])),s=P(I([])),c=P(!1),l=P(!1),u=N(()=>new Set(n().map(e=>d(e.path))));function d(e){return String(e||``).split(/[/\\]/).pop()||``}function f(e){let t=encodeURIComponent(String(e||``).replace(/\.md$/i,``));return`/?doc=`+encodeURIComponent(t)}function p(e){return Y(`context.root.${e}`)}function m(e){return Y(`context.type.${e}`)}async function h(e){F(c,!0),F(l,!1);try{let t=await fetch(`/api/browse?path=`+encodeURIComponent(e)).then(e=>e.json());F(i,t.current,!0),F(a,t.parent||``,!0),F(o,t.dirs||[],!0),F(s,t.files||[],!0)}catch{F(l,!0)}finally{F(c,!1)}}async function g(){F(r,!V(r)),V(r)&&!V(i)&&await h((await fetch(`/api/context/orientation`).then(e=>e.json()).catch(()=>({}))).sourceRoot||``)}async function _(e){await t.onAdd(e),V(r)&&V(i)&&await h(V(i))}var v=h_(),y=L(v),b=L(y),x=L(b,!0);j(b);var S=z(b,2),C=L(S),w=L(C);j(C);var T=z(C,2),E=L(T,!0);j(T),j(S),j(y);var D=z(y,2),ee=e=>{var t=d_(),n=L(t),r=L(n),d=L(r,!0);j(r);var f=z(r,2),p=L(f,!0);j(f),j(n);var m=z(n,2),g=L(m),v=e=>{var t=i_(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`common.loading`)]),W(e,t)},y=e=>{var t=a_(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`common.cannot_read_dir`)]),W(e,t)},b=e=>{var t=i_(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`common.empty_dir`)]),W(e,t)},x=e=>{var t=u_(),n=R(t);q(n,17,()=>V(o),Qr,(e,t)=>{var n=o_(),r=L(n),i=L(r);j(r),j(n),B(()=>G(i,`📁 ${V(t).name??``}`)),H(`click`,n,()=>h(V(t).path)),W(e,n)}),q(z(n,2),17,()=>V(s),Qr,(e,t)=>{var n=l_(),r=L(n),i=L(r);j(r);var a=z(r,2),o=e=>{var t=s_(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`context.added`)]),W(e,t)},s=N(()=>V(u).has(V(t).name)),c=e=>{var n=c_(),r=L(n,!0);j(n),B(e=>G(r,e),[()=>Y(`context.add_file_action`)]),H(`click`,n,()=>_(V(t).path)),W(e,n)};K(a,e=>{V(s)?e(o):e(c,-1)}),j(n),B(()=>G(i,`📄 ${V(t).name??``}`)),W(e,n)}),W(e,t)};K(g,e=>{V(c)?e(v):V(l)?e(y,1):!V(o).length&&!V(s).length?e(b,2):e(x,-1)}),j(m),j(t),B(e=>{r.disabled=!V(a),G(d,e),G(p,V(i))},[()=>Y(`common.up`)]),H(`click`,r,()=>V(a)&&h(V(a))),W(e,t)};K(D,e=>{V(r)&&e(ee)});var te=z(D,2),O=L(te),ne=e=>{var t=f_(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`context.no_instructions`)]),W(e,t)},k=e=>{var r=Wr();q(R(r),17,n,Qr,(e,n)=>{var r=m_(),i=L(r),a=L(i),o=L(a,!0);j(a);var s=z(a,2),c=L(s),l=z(c),u=e=>{var t=Ur();B(e=>G(t,`· ${e??``} KB`),[()=>Math.round(V(n).size/1024)]),W(e,t)};K(l,e=>{V(n).size!==null&&e(u)}),j(s),j(i);var h=z(i,2),g=L(h),_=L(g,!0);j(g);var v=z(g,2),y=e=>{var r=p_(),i=L(r,!0);j(r),B(e=>G(i,e),[()=>Y(`common.remove`)]),H(`click`,r,()=>t.onRemove(d(V(n).path))),W(e,r)};K(v,e=>{V(n).exists&&e(y)}),j(h),j(r),B((e,t,r,i)=>{J(a,`href`,e),G(o,V(n).path),G(c,`${t??``} · ${r??``} `),vi(g,1,fi(V(n).exists?`status-ok`:`status-missing`),`svelte-e5jhdq`),G(_,i)},[()=>f(V(n).path),()=>p(V(n).root),()=>m(V(n).type),()=>V(n).exists?Y(`context.exists`):Y(`context.missing`)]),W(e,r)}),W(e,r)};K(O,e=>{n().length?e(k,-1):e(ne)}),j(te),j(v),B((e,t,r)=>{G(x,e),G(w,`${t??``}/${n().length??``}`),G(E,r)},[()=>Y(`context.instructions_title`),()=>n().filter(e=>e.exists).length,()=>V(r)?Y(`context.hide_instruction_browser`):Y(`context.add_instruction_file`)]),H(`click`,T,g),W(e,v),Je()}Pr([`click`]);var __=U(`<span class="rules-folder svelte-1r3tey2"> </span>`),v_=U(`<p class="empty-msg svelte-1r3tey2"> </p>`),y_=U(`<span class="tag svelte-1r3tey2"> </span>`),b_=U(`<div class="rule-tags svelte-1r3tey2"></div>`),x_=U(`<div class="rule-applies svelte-1r3tey2"> </div>`),S_=U(`<article class="rule-row svelte-1r3tey2"><div class="rule-top svelte-1r3tey2"><div class="rule-title-wrap svelte-1r3tey2"><h3 class="rule-title svelte-1r3tey2"><a class="rule-link svelte-1r3tey2"> </a></h3> <a class="rule-path svelte-1r3tey2"> </a></div> <span class="severity-badge svelte-1r3tey2"> </span></div> <p class="rule-desc svelte-1r3tey2"> </p> <!> <!></article>`),C_=U(`<div class="rules-layout svelte-1r3tey2"><div class="section-card svelte-1r3tey2"><div class="section-header svelte-1r3tey2"><span class="section-title svelte-1r3tey2" data-testid="rules-title"> </span> <!></div> <div class="rule-list svelte-1r3tey2" data-testid="rule-list"><!></div></div> <div class="section-card aside-card svelte-1r3tey2"><span class="section-title svelte-1r3tey2" data-testid="add-rule-title"> </span> <div class="field-group"><label class="field-label" for="ruleTitle"> </label> <input id="ruleTitle" class="field-input"/></div> <div class="field-group"><label class="field-label" for="ruleSeverity"> </label> <select id="ruleSeverity" class="field-input"><option> </option><option> </option><option> </option></select></div> <div class="field-group"><label class="field-label" for="ruleDescription"> </label> <input id="ruleDescription" class="field-input"/></div> <div class="field-group"><label class="field-label" for="ruleTags"> </label> <input id="ruleTags" class="field-input"/></div> <div class="field-group"><label class="field-label" for="ruleAppliesTo"> </label> <input id="ruleAppliesTo" class="field-input"/></div> <div class="field-group"><label class="field-label" for="ruleBody"> </label> <textarea id="ruleBody" rows="7" class="field-input"></textarea></div> <button class="btn-primary" style="width:100%"> </button></div></div>`);function w_(e,t){qe(t,!0);let n=qi(t,`rules`,19,()=>[]),r=qi(t,`rulesFolder`,3,``),i=P(``),a=P(`guideline`),o=P(``),s=P(``),c=P(``),l=P(``),u=P(!1);function d(e){let t=encodeURIComponent(String(e||``).replace(/\.md$/i,``));return`/?doc=`+encodeURIComponent(t)}function f(e){let t=`context.rule_severity_${e}`,n=Y(t);return n===t?e:n}function p(e){return e.split(`,`).map(e=>e.trim()).filter(Boolean)}async function m(){if(V(i).trim()){F(u,!0);try{await t.onAdd({title:V(i).trim(),severity:V(a),description:V(o).trim(),tags:p(V(s)),appliesTo:p(V(c)),body:V(l).trim()}),F(i,``),F(o,``),F(s,``),F(c,``),F(l,``)}finally{F(u,!1)}}}var h=C_(),g=L(h),_=L(g),v=L(_),y=L(v,!0);j(v);var b=z(v,2),x=e=>{var t=__(),n=L(t,!0);j(t),B(()=>G(n,r())),W(e,t)};K(b,e=>{r()&&e(x)}),j(_);var S=z(_,2),C=L(S),w=e=>{var t=v_(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`context.no_rules`)]),W(e,t)},T=e=>{var t=Wr();q(R(t),17,n,Qr,(e,t)=>{var n=S_(),r=L(n),i=L(r),a=L(i),o=L(a),s=L(o,!0);j(o),j(a);var c=z(a,2),l=L(c,!0);j(c),j(i);var u=z(i,2),p=L(u,!0);j(u),j(r);var m=z(r,2),h=L(m,!0);j(m);var g=z(m,2),_=e=>{var n=b_();q(n,21,()=>V(t).tags,Qr,(e,t)=>{var n=y_(),r=L(n,!0);j(n),B(()=>G(r,V(t))),W(e,n)}),j(n),W(e,n)};K(g,e=>{V(t).tags?.length&&e(_)});var v=z(g,2),y=e=>{var n=x_(),r=L(n,!0);j(n),B(e=>G(r,e),[()=>V(t).appliesTo.join(`, `)]),W(e,n)};K(v,e=>{V(t).appliesTo?.length&&e(y)}),j(n),B((e,n,r)=>{J(o,`href`,e),G(s,V(t).title),J(c,`href`,n),G(l,V(t).path),G(p,r),G(h,V(t).description)},[()=>d(V(t).path),()=>d(V(t).path),()=>f(V(t).severity)]),W(e,n)}),W(e,t)};K(C,e=>{n().length?e(T,-1):e(w)}),j(S),j(g);var E=z(g,2),D=L(E),ee=L(D,!0);j(D);var te=z(D,2),O=L(te),ne=L(O,!0);j(O);var k=z(O,2);ki(k),j(te);var A=z(te,2),re=L(A),ie=L(re,!0);j(re);var ae=z(re,2),oe=L(ae),se=L(oe,!0);j(oe),oe.value=oe.__value=`guideline`;var ce=z(oe),le=L(ce,!0);j(ce),ce.value=ce.__value=`warning`;var ue=z(ce),de=L(ue,!0);j(ue),ue.value=ue.__value=`required`,j(ae),j(A);var fe=z(A,2),pe=L(fe),me=L(pe,!0);j(pe);var he=z(pe,2);ki(he),j(fe);var ge=z(fe,2),_e=L(ge),ve=L(_e,!0);j(_e);var ye=z(_e,2);ki(ye),j(ge);var be=z(ge,2),xe=L(be),Se=L(xe,!0);j(xe);var Ce=z(xe,2);ki(Ce),j(be);var we=z(be,2),Te=L(we),Ee=L(Te,!0);j(Te);var De=z(Te,2);yn(De),j(we);var Oe=z(we,2),ke=L(Oe,!0);j(Oe),j(E),j(h),B((e,t,n,r,i,a,o,s,c,l,u,d,f,p,m,h,g,_)=>{G(y,e),G(ee,t),G(ne,n),J(k,`placeholder`,r),G(ie,i),G(se,a),G(le,o),G(de,s),G(me,c),J(he,`placeholder`,l),G(ve,u),J(ye,`placeholder`,d),G(Se,f),J(Ce,`placeholder`,p),G(Ee,m),J(De,`placeholder`,h),Oe.disabled=g,G(ke,_)},[()=>Y(`context.rules_title`),()=>Y(`context.add_rule_title`),()=>Y(`context.rule_title_label`),()=>Y(`context.rule_title_placeholder`),()=>Y(`context.rule_severity_label`),()=>Y(`context.rule_severity_guideline`),()=>Y(`context.rule_severity_warning`),()=>Y(`context.rule_severity_required`),()=>Y(`context.rule_description_label`),()=>Y(`context.rule_description_placeholder`),()=>Y(`context.rule_tags_label`),()=>Y(`context.rule_tags_placeholder`),()=>Y(`context.rule_applies_to_label`),()=>Y(`context.rule_applies_to_placeholder`),()=>Y(`context.rule_body_label`),()=>Y(`context.rule_body_placeholder`),()=>V(u)||!V(i).trim(),()=>Y(`context.add_rule_button`)]),Fi(k,()=>V(i),e=>F(i,e)),Ci(ae,()=>V(a),e=>F(a,e)),Fi(he,()=>V(o),e=>F(o,e)),Fi(ye,()=>V(s),e=>F(s,e)),Fi(Ce,()=>V(c),e=>F(c,e)),Fi(De,()=>V(l),e=>F(l,e)),H(`click`,Oe,m),W(e,h),Je()}Pr([`click`]);var T_=U(`<p class="empty-msg svelte-1ui2b6s"> </p>`),E_=U(`<p class="mcp-desc svelte-1ui2b6s"> </p>`),D_=U(`<div class="mcp-schema-wrap svelte-1ui2b6s"><h4 class="mcp-schema-title svelte-1ui2b6s"> </h4> <pre class="mcp-schema-pre svelte-1ui2b6s"> </pre></div>`),O_=U(`<div class="mcp-result svelte-1ui2b6s" data-testid="mcp-result"></div>`),k_=U(`<details class="mcp-detail svelte-1ui2b6s"><summary class="mcp-summary svelte-1ui2b6s"> </summary> <!> <!> <div class="mcp-run-area svelte-1ui2b6s"><label class="mcp-run-label svelte-1ui2b6s"> </label> <textarea rows="4" spellcheck="false" class="field-input mcp-textarea svelte-1ui2b6s" data-testid="mcp-args"></textarea> <div class="mcp-run-footer svelte-1ui2b6s"><span class="mcp-error-text svelte-1ui2b6s" data-testid="mcp-error"> </span> <button class="btn-primary btn-sm"> </button></div> <!></div></details>`),A_=U(`<p class="mcp-arg-desc svelte-1ui2b6s"> </p>`),j_=U(`<li class="mcp-arg-item svelte-1ui2b6s"><div class="mcp-arg-name-row svelte-1ui2b6s"><span class="mcp-arg-name svelte-1ui2b6s"> </span> <span class="mcp-arg-req svelte-1ui2b6s"> </span></div> <!></li>`),M_=U(`<div class="mcp-schema-wrap svelte-1ui2b6s"><h4 class="mcp-schema-title svelte-1ui2b6s"> </h4> <ul class="mcp-args-list svelte-1ui2b6s"></ul></div>`),N_=U(`<div class="section-card svelte-1ui2b6s"><div class="section-header svelte-1ui2b6s"><span class="section-title svelte-1ui2b6s" data-testid="mcp-title"> </span> <button class="secondary-button btn-sm"> </button></div> <p class="section-desc svelte-1ui2b6s"> </p> <div class="mcp-info-grid svelte-1ui2b6s"><div class="mcp-info-cell svelte-1ui2b6s"><div class="mcp-info-label svelte-1ui2b6s"> </div> <div> </div></div> <div class="mcp-info-cell svelte-1ui2b6s"><div class="mcp-info-label svelte-1ui2b6s"> </div> <div class="mcp-info-value mono svelte-1ui2b6s"> </div></div> <div class="mcp-info-cell wide svelte-1ui2b6s"><div class="mcp-info-label svelte-1ui2b6s"> </div> <div class="mcp-info-value mono break svelte-1ui2b6s" data-testid="mcp-endpoint"> </div></div></div> <div><div class="subsection-header svelte-1ui2b6s"><span class="subsection-title svelte-1ui2b6s"> </span> <div class="subsection-actions svelte-1ui2b6s"><span class="count-label svelte-1ui2b6s"> </span> <button class="secondary-button btn-sm"> </button></div></div> <div class="mcp-items svelte-1ui2b6s" data-testid="mcp-tool-list"><!></div></div> <div><div class="subsection-header svelte-1ui2b6s"><span class="subsection-title svelte-1ui2b6s"> </span> <div class="subsection-actions svelte-1ui2b6s"><span class="count-label svelte-1ui2b6s"> </span> <button class="secondary-button btn-sm"> </button></div></div> <div class="mcp-items svelte-1ui2b6s" data-testid="mcp-prompt-list"><!></div></div></div>`);function P_(e,t){qe(t,!0);let n=P(`-`),r=P(!1),i=P(`-`),a=P(`-`),o=P(I([])),s=P(I([])),c=P(!1),l=P(I(new Map)),u=P(I(new Map));function d(e,t){let n=V(e===`tool`?l:u);return n.has(t)||n.set(t,{argsJson:`{}`,running:!1,error:``,resultHtml:``}),n.get(t)}function f(e,t,n){let r=V(e===`tool`?l:u).get(t)??{argsJson:`{}`,running:!1,error:``,resultHtml:``};e===`tool`?F(l,new Map(V(l)).set(t,{...r,...n}),!0):F(u,new Map(V(u)).set(t,{...r,...n}),!0)}function p(e){if(!e||typeof e!=`object`)return null;if(e.type===`string`)return``;if(e.type===`number`||e.type===`integer`)return 0;if(e.type===`boolean`)return!1;if(e.type===`array`)return[];if(e.type===`object`||e.properties){let t={},n=e.properties||{};return(Array.isArray(e.required)?e.required:[]).forEach(e=>{t[e]=p(n[e])??``}),t}return null}function m(e){let t=p(e.inputSchema)??{},n=JSON.stringify(t,null,2);F(l,new Map(V(l)).set(e.name,{argsJson:n,running:!1,error:``,resultHtml:``}),!0)}function h(e){let t={};(e.arguments||[]).forEach(e=>{e.required&&(t[e.name]=``)});let n=JSON.stringify(t,null,2);F(u,new Map(V(u)).set(e.name,{argsJson:n,running:!1,error:``,resultHtml:``}),!0)}function g(e){let t=e.match(/^data:\s*(\{.*\})\s*$/m);if(!t)throw Error(e.slice(0,300)||`No MCP response body`);return JSON.parse(t[1])}async function _(e,t,n){let r=await fetch(`/mcp`,{method:`POST`,headers:{"Content-Type":`application/json`,Accept:`application/json, text/event-stream`},body:JSON.stringify({jsonrpc:`2.0`,id:e,method:t,params:n})}),i=await r.text();if(!r.ok)throw Error(i||`HTTP ${r.status}`);return g(i)}async function v(){await _(1,`initialize`,{protocolVersion:`2025-03-26`,capabilities:{},clientInfo:{name:`living-ai-documentation-context`,version:`1.0.0`}})}function y(e){return"```json\n"+JSON.stringify(e,null,2).replaceAll("```","`\\`\\`")+"\n```"}function b(e){if(typeof e!=`string`)return y(e);try{return y(JSON.parse(e))}catch{return e}}function x(e){if(typeof e==`string`)return e;if(!e||typeof e!=`object`)return String(e??``);if(e.error)return y(e.error);let t=e.result;return!t||typeof t!=`object`?y(e):Array.isArray(t.messages)?t.messages.map(e=>`${e.role?`[${e.role}]`:``}\n${b(e.content?.text??e.content??e)}`.trim()).join(`
|
|
92
92
|
|
|
93
93
|
`):Array.isArray(t.content)?t.content.map(e=>e&&e.type===`text`&&typeof e.text==`string`?b(e.text):y(e)).join(`
|
|
94
94
|
|
|
@@ -96,75 +96,75 @@ Texte`};case`link`:return{text:ut(`snip-link-text`),textFallback:Y(`snippet.link
|
|
|
96
96
|
`)}function T(e){if(typeof e==`string`)return e;if(!e||typeof e!=`object`)return String(e??``);if(e.error)return JSON.stringify(e.error,null,2);let t=e.result;return t?.isError?(Array.isArray(t.content)?t.content.map(e=>e&&e.type===`text`&&typeof e.text==`string`?e.text:JSON.stringify(e,null,2)).filter(Boolean):[]).join(`
|
|
97
97
|
|
|
98
98
|
`)||JSON.stringify(t,null,2):JSON.stringify(e,null,2)}async function E(e,t,n){let r=await fetch(`/api/context/mcp-result`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:e,content:t,kind:n})});if(!r.ok)throw Error(await r.text()||`HTTP ${r.status}`);return r.json()}function D(e){let t=encodeURIComponent(String(e||``).replace(/\.md$/i,``));return`/?doc=`+encodeURIComponent(t)}async function ee(e,t){let n=d(e,t),r={};try{r=n.argsJson.trim()?JSON.parse(n.argsJson):{}}catch{f(e,t,{error:Y(`context.mcp_invalid_json`)});return}f(e,t,{running:!0,error:``,resultHtml:`<span class="mcp-running">${Y(`context.mcp_running`)}</span>`});try{await v();let n=e===`tool`?await _(2,`tools/call`,{name:t,arguments:r}):await _(2,`prompts/get`,{name:t,arguments:r});if(n.error||n.result?.isError){let r=T(n);f(e,t,{running:!1,error:Y(`context.mcp_error`),resultHtml:r?`<pre class="mcp-error-pre">${O(r)}</pre>`:``});return}let i=e===`tool`?V(o).find(e=>e.name===t):null,{path:a}=await E(t,e===`tool`&&i?w(i,r,n):x(n),e),s=D(a);f(e,t,{running:!1,error:``,resultHtml:`<div class="mcp-saved-label">${O(Y(`context.mcp_saved_to`))}</div>
|
|
99
|
-
<a href="${O(s)}" target="_blank" rel="noopener" class="mcp-saved-link">📄 ${O(a)}</a>`})}catch(n){f(e,t,{running:!1,error:n.message||String(n),resultHtml:``})}}async function te(e){let n=V(e===`tool`?o:s);if(!n.length)return;F(c,!0);let r=n.length;try{for(let i=0;i<n.length;i++)t.onStatus(Y(`context.mcp_running_all`).replace(`{current}`,String(i+1)).replace(`{total}`,String(r))),await ee(e,n[i].name);t.onStatus(Y(`context.mcp_done_all`).replace(`{total}`,String(r)))}finally{F(c,!1)}}function O(e){return String(e??``).replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e])}async function ne(){try{let e=await fetch(`/mcp`);if(!e.ok)throw Error(await e.text());let t=await e.json(),c=Array.isArray(t.tools)?t.tools:[],l=Array.isArray(t.prompts)?t.prompts:[];F(n,Y(`context.mcp_available`),!0),F(r,!0),F(i,t.transport||`-`,!0),F(a,t.endpoint||`POST /mcp`,!0),F(o,c,!0),F(s,l,!0),c.forEach(m),l.forEach(h)}catch{F(n,Y(`context.mcp_unavailable`),!0),F(r,!1),F(i,`-`),F(a,`/mcp`),F(o,[],!0),F(s,[],!0)}}var k={load:ne},A=N_(),re=L(A),ie=L(re),ae=L(ie,!0);j(ie);var oe=z(ie,2),se=L(oe,!0);j(oe),j(re);var ce=z(re,2),le=L(ce,!0);j(ce);var ue=z(ce,2),de=L(ue),fe=L(de),pe=L(fe,!0);j(fe);var me=z(fe,2),he=L(me,!0);j(me),j(de);var ge=z(de,2),_e=L(ge),ve=L(_e,!0);j(_e);var ye=z(_e,2),be=L(ye,!0);j(ye),j(ge);var xe=z(ge,2),Se=L(xe),Ce=L(Se,!0);j(Se);var we=z(Se,2),Te=L(we,!0);j(we),j(xe),j(ue);var Ee=z(ue,2),De=L(Ee),Oe=L(De),ke=L(Oe,!0);j(Oe);var Ae=z(Oe,2),je=L(Ae),Me=L(je,!0);j(je);var Ne=z(je,2),Pe=L(Ne,!0);j(Ne),j(Ae),j(De);var Fe=z(De,2),Ie=L(Fe),Le=e=>{var t=T_(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`context.mcp_no_tools`)]),W(e,t)},Re=e=>{var t=Wr();q(R(t),17,()=>V(o),Qr,(e,t)=>{let n=N(()=>V(l).get(V(t).name)??{argsJson:`{}`,running:!1,error:``,resultHtml:``});var r=k_(),i=L(r),a=L(i,!0);j(i);var o=z(i,2),s=e=>{var n=E_(),r=L(n,!0);j(n),B(()=>G(r,V(t).description)),W(e,n)};K(o,e=>{V(t).description&&e(s)});var c=z(o,2),u=e=>{var n=D_(),r=L(n),i=L(r,!0);j(r);var a=z(r,2),o=L(a,!0);j(a),j(n),B((e,t)=>{G(i,e),G(o,t)},[()=>Y(`context.mcp_input_schema`),()=>JSON.stringify(V(t).inputSchema,null,2)]),W(e,n)};K(c,e=>{V(t).inputSchema&&e(u)});var d=z(c,2),p=L(d),m=L(p,!0);j(p);var h=z(p,2);yn(h);var g=z(h,2),_=L(g),v=L(_,!0);j(_);var y=z(_,2),b=L(y,!0);j(y),j(g);var x=z(g,2),S=e=>{var t=O_();si(t,()=>V(n).resultHtml,!0),j(t),W(e,t)};K(x,e=>{V(n).resultHtml&&e(S)}),j(d),j(r),B((e,r)=>{G(a,V(t).name),G(m,e),Ai(h,V(n).argsJson),G(v,V(n).error),y.disabled=V(n).running,G(b,r)},[()=>Y(`context.mcp_request_json`),()=>Y(`context.mcp_run_tool`)]),H(`input`,h,e=>f(`tool`,V(t).name,{argsJson:e.target.value})),H(`click`,y,()=>ee(`tool`,V(t).name)),W(e,r)}),W(e,t)};K(Ie,e=>{V(o).length?e(Re,-1):e(Le)}),j(Fe),j(Ee);var ze=z(Ee,2),Be=L(ze),Ve=L(Be),He=L(Ve,!0);j(Ve);var Ue=z(Ve,2),We=L(Ue),Ge=L(We,!0);j(We);var Ke=z(We,2),Ye=L(Ke,!0);j(Ke),j(Ue),j(Be);var Xe=z(Be,2),Ze=L(Xe),Qe=e=>{var t=T_(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`context.mcp_no_prompts`)]),W(e,t)},$e=e=>{var t=Wr();q(R(t),17,()=>V(s),Qr,(e,t)=>{let n=N(()=>V(u).get(V(t).name)??{argsJson:`{}`,running:!1,error:``,resultHtml:``});var r=k_(),i=L(r),a=L(i,!0);j(i);var o=z(i,2),s=e=>{var n=E_(),r=L(n,!0);j(n),B(()=>G(r,V(t).description)),W(e,n)};K(o,e=>{V(t).description&&e(s)});var c=z(o,2),l=e=>{var n=M_(),r=L(n),i=L(r,!0);j(r);var a=z(r,2);q(a,21,()=>V(t).arguments,Qr,(e,t)=>{var n=j_(),r=L(n),i=L(r),a=L(i,!0);j(i);var o=z(i,2),s=L(o,!0);j(o),j(r);var c=z(r,2),l=e=>{var n=A_(),r=L(n,!0);j(n),B(()=>G(r,V(t).description)),W(e,n)};K(c,e=>{V(t).description&&e(l)}),j(n),B(e=>{G(a,V(t).name),G(s,e)},[()=>V(t).required?Y(`context.mcp_required`):Y(`context.mcp_optional`)]),W(e,n)}),j(a),j(n),B(e=>G(i,e),[()=>Y(`context.mcp_arguments`)]),W(e,n)};K(c,e=>{V(t).arguments?.length&&e(l)});var d=z(c,2),p=L(d),m=L(p,!0);j(p);var h=z(p,2);yn(h);var g=z(h,2),_=L(g),v=L(_,!0);j(_);var y=z(_,2),b=L(y,!0);j(y),j(g);var x=z(g,2),S=e=>{var t=O_();si(t,()=>V(n).resultHtml,!0),j(t),W(e,t)};K(x,e=>{V(n).resultHtml&&e(S)}),j(d),j(r),B((e,r)=>{G(a,V(t).name),G(m,e),Ai(h,V(n).argsJson),G(v,V(n).error),y.disabled=V(n).running,G(b,r)},[()=>Y(`context.mcp_request_json`),()=>Y(`context.mcp_get_prompt`)]),H(`input`,h,e=>f(`prompt`,V(t).name,{argsJson:e.target.value})),H(`click`,y,()=>ee(`prompt`,V(t).name)),W(e,r)}),W(e,t)};return K(Ze,e=>{V(s).length?e($e,-1):e(Qe)}),j(Xe),j(ze),j(A),B((e,t,l,u,d,f,p,m,h,g)=>{G(ae,e),G(se,t),G(le,l),G(pe,u),vi(me,1,fi(V(r)?`mcp-info-value ok`:`mcp-info-value err`),`svelte-1ui2b6s`),G(he,V(n)),G(ve,d),G(be,V(i)),G(Ce,f),G(Te,V(a)),G(ke,p),G(Me,V(o).length),Ne.disabled=V(c)||!V(o).length,G(Pe,m),G(He,h),G(Ge,V(s).length),Ke.disabled=V(c)||!V(s).length,G(Ye,g)},[()=>Y(`context.mcp_title`),()=>Y(`context.mcp_refresh`),()=>Y(`context.mcp_intro`),()=>Y(`context.mcp_status`),()=>Y(`context.mcp_transport`),()=>Y(`context.mcp_endpoint`),()=>Y(`context.mcp_tools`),()=>Y(`context.mcp_run_all_tools`),()=>Y(`context.mcp_prompts`),()=>Y(`context.mcp_get_all_prompts`)]),H(`click`,oe,ne),H(`click`,Ne,()=>te(`tool`)),H(`click`,Ke,()=>te(`prompt`)),W(e,A),Je(k)}Pr([`click`,`input`]);var F_=U(`<p class="status-text svelte-rpj1e5"> </p>`),I_=U(`<div class="app-shell"><!> <main class="context-scroll svelte-rpj1e5"><div class="context-inner svelte-rpj1e5"><section class="page-intro svelte-rpj1e5"><h2 class="page-title svelte-rpj1e5"> </h2> <p class="page-desc svelte-rpj1e5"> </p> <!></section> <!> <!> <!></div></main></div> <!>`,1);function L_(e,t){qe(t,!0);let n=P(``),r=P(I([])),i=P(I([])),a=P(``),o=P(null),s=P(null),c=P(null);function l(e){F(n,e,!0)}async function u(){l(Y(`context.loading`));let e=await fetch(`/api/context/orientation`);if(!e.ok)throw Error(await e.text());let t=await e.json();F(o,t,!0),F(r,t.instructions||[],!0),F(i,t.rules||[],!0),F(a,t.rulesFolder||``,!0),l(``)}async function d(e){l(Y(`context.adding_instruction_file`));let t=await fetch(`/api/context/instructions`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})});if(!t.ok)throw Error(await t.text());await u()}async function f(e){if(!await V(s).show({kicker:Y(`context.remove_instruction_title`),title:Y(`context.remove_instruction_title`),message:Y(`context.remove_instruction_message`).replace(`{name}`,e),confirmLabel:Y(`common.remove`),cancelLabel:Y(`common.cancel`)||`Cancel`,danger:!0}))return;l(Y(`context.removing_instruction_file`));let t=await fetch(`/api/context/instructions/`+encodeURIComponent(e),{method:`DELETE`});if(!t.ok)throw Error(await t.text());await u()}async function p(e){l(Y(`context.saving_rule`));let t=await fetch(`/api/context/rules`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());await u()}Ji(async()=>{try{let e=await fetch(`/api/config`);await Ca((e.ok?await e.json():{}).language||`en`)}catch{await Ca(`en`)}document.title=Y(`context.title`),await u().catch(e=>l(e.message)),await V(c).load().catch(()=>{})});var m=I_(),h=R(m),g=L(h);es(g,{get navigate(){return t.navigate}});var _=z(g,2),v=L(_),y=L(v),b=L(y),x=L(b,!0);j(b);var S=z(b,2),C=L(S,!0);j(S);var w=z(S,2),T=e=>{var t=F_(),r=L(t,!0);j(t),B(()=>G(r,V(n))),W(e,t)};K(w,e=>{V(n)&&e(T)}),j(y);var E=z(y,2);g_(E,{onAdd:d,onRemove:f,get items(){return V(r)},set items(e){F(r,e,!0)}});var D=z(E,2);w_(D,{get rules(){return V(i)},get rulesFolder(){return V(a)},onAdd:p}),Ui(P_(z(D,2),{onStatus:l}),e=>F(c,e,!0),()=>V(c)),j(v),j(_),j(h),Ui($d(z(h,2),{}),e=>F(s,e,!0),()=>V(s)),B((e,t)=>{G(x,e),G(C,t)},[()=>Y(`context.orientation_title`),()=>Y(`context.orientation_intro`)]),W(e,m),Je()}async function R_(){return fetch(`/api/config`).then(e=>e.json())}async function z_(){return fetch(`/api/documents`).then(e=>e.json())}async function B_(){return fetch(`/api/tree`).then(e=>e.json())}async function V_(e,t){return(await fetch(`/api/tree/hidden`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e,hidden:t})})).ok}async function H_(e){let t=await fetch(`/api/tree/move`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,status:t.status};let{path:n}=await t.json();return{ok:!0,path:n}}async function U_(e){return fetch(`/api/browse/alldirs?path=${encodeURIComponent(e)}`).then(e=>e.json())}async function W_(e){let t=await fetch(`/api/documents/${e}`);if(!t.ok)throw Error(t.statusText);return t.json()}async function G_(){try{let e=await fetch(`/api/annotations`).then(e=>e.json()),t={};for(let[n,r]of Object.entries(e||{})){t[n]=r;try{t[encodeURIComponent(n)]=r}catch{}}return t}catch{return{}}}async function K_(){try{return await fetch(`/api/documents/file-counts`).then(e=>e.json())}catch{return{}}}async function q_(){try{return await fetch(`/api/documents/statuses`).then(e=>e.json())}catch{return{}}}async function J_(e){return fetch(`/api/documents/search?q=${encodeURIComponent(e)}`).then(e=>e.json())}function Y_(e){return e.replace(/^\d+_/,``).replace(/[_-]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function X_(e,t){let n=[];for(let r of e)if(r.kind===`doc`)r.id&&t.has(r.id)&&n.push(r);else{let e=X_(r.children??[],t);e.length&&n.push({...r,children:e})}return n}function Z_(e){return e.filter(e=>!e.hidden).map(e=>e.kind===`folder`?{...e,children:Z_(e.children??[])}:e)}function Q_(e,t=()=>!0){return e.kind===`doc`?e.id&&t(e.id)?1:0:(e.children??[]).reduce((e,n)=>e+Q_(n,t),0)}var $_=.25;function ev(e,t,n){let r=n>0?t/n:0;return e===`doc`?r<.5?`before`:`after`:r<$_?`before`:r>1-$_?`after`:`inside`}function tv(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function nv(e,t){if(!t)return e;for(let n of e)if(n.kind===`folder`){if(n.path===t)return n.children??[];if(t.startsWith(`${n.path}/`))return nv(n.children??[],t)}return[]}function rv(e,t,n,r){if(t===n)return null;let i=r===`inside`?n:tv(n),a=nv(e,i).filter(e=>e.path!==t),o=a.length;if(r!==`inside`){let e=a.findIndex(e=>e.path===n);if(e===-1)return null;o=r===`before`?e:e+1}return i===tv(t)&&nv(e,i).findIndex(e=>e.path===t)===o?null:{source:t,targetFolder:i,index:o}}function iv(e,t,n){let r=`${decodeURIComponent(e)}.md`;return r===t?encodeURIComponent(n.slice(0,-3)):r.startsWith(`${t}/`)?encodeURIComponent(`${n}${r.slice(t.length)}`.slice(0,-3)):null}var av=U(`<span class="inline-flex items-center justify-center w-5 h-5 rounded-full bg-green-500 text-[10px] font-bold text-white border border-green-600 shadow-sm">V</span>`),ov=U(`<span class="inline-flex items-center justify-center w-5 h-5 rounded-full bg-orange-500 text-[10px] font-bold text-white border border-orange-600 shadow-sm">S</span>`),sv=U(`<span class="inline-flex items-center justify-center min-w-[1.25rem] h-5 px-1.5 rounded-full bg-yellow-300 dark:bg-yellow-400 text-[10px] font-bold text-yellow-900 border border-yellow-500 shadow-sm"> </span>`),cv=U(`<span class="inline-flex items-center justify-center min-w-[1.25rem] h-5 px-1.5 rounded-full bg-sky-200 dark:bg-sky-300 text-[10px] font-bold text-sky-900 border border-sky-500 shadow-sm"> </span>`),lv=U(`<div class="text-xs text-gray-400 dark:text-gray-500 mt-0.5"> </div>`),uv=U(`<button><div class="leading-snug flex items-center justify-between gap-2"><span class="truncate"> </span> <span class="flex items-center gap-1 shrink-0"><!> <!> <!></span></div> <!></button>`),dv=U(`<span class="inline-flex items-center justify-center min-w-[1.25rem] h-5 px-1.5 rounded-full bg-orange-400 dark:bg-orange-500 text-[10px] font-bold text-white border border-orange-600 shadow-sm"> </span>`),fv=U(`<span class="inline-flex items-center justify-center min-w-[1.25rem] h-5 px-1.5 rounded-full bg-slate-400 dark:bg-slate-500 text-[10px] font-bold text-white border border-slate-600 shadow-sm"> </span>`),pv=U(`<div class="pl-3"><!></div>`),mv=U(`<div class="mb-1"><button><span class="flex items-center gap-2 min-w-0"><span class="truncate"> </span> <!> <!></span> <span class="flex items-center gap-1.5"><span class="font-normal normal-case text-gray-400"> </span> <span>▸</span></span></button> <!></div>`);function hv(e,t){qe(t,!0);let n=(e,n=f,r=f)=>{let i=N(()=>X.annotationCounts[n().id]||0),d=N(()=>X.fileAttachmentCounts[n().id]||0),m=N(()=>p(n()));var h=uv(),g=L(h),_=L(g),v=L(_,!0);j(_);var y=z(_,2),b=L(y),x=e=>{var t=av();B(e=>J(t,`title`,e),[()=>Y(`sidebar.status_to_validate`)]),W(e,t)},S=e=>{var t=ov();B(e=>J(t,`title`,e),[()=>Y(`sidebar.status_superseeded`)]),W(e,t)};K(b,e=>{V(m)===`V`?e(x):V(m)===`S`&&e(S,1)});var C=z(b,2),w=e=>{var t=sv(),n=L(t,!0);j(t),B(e=>{J(t,`title`,e),G(n,V(i))},[()=>u(V(i),`sidebar.annotation_badge`)]),W(e,t)};K(C,e=>{V(i)>0&&!X.markerHidden&&e(w)});var T=z(C,2),E=e=>{var t=cv(),n=L(t,!0);j(t),B(e=>{J(t,`title`,e),G(n,V(d))},[()=>u(V(d),`sidebar.file_attachment_badge`)]),W(e,t)};K(T,e=>{V(d)>0&&!X.hideAttachments&&e(E)}),j(y),j(g);var D=z(g,2),ee=e=>{var t=lv(),r=L(t,!0);j(t),B(()=>G(r,n().formattedDate)),W(e,t)};K(D,e=>{n().formattedDate&&e(ee)}),j(h),B(e=>{J(h,`id`,`item-${n().id??``}`),J(h,`draggable`,V(a)),J(h,`data-drop`,e),J(h,`data-hidden`,r().hidden?`true`:void 0),vi(h,1,`${r().hidden?`opacity-50 italic`:``} doc-item w-full text-left px-3 py-1.5 rounded-md text-sm transition-colors text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800/60 ${n().id===X.currentDocId?`active`:``}`),G(v,n().title)},[()=>o(r())]),H(`click`,h,()=>t.onopen(n().id)),H(`contextmenu`,h,e=>t.onentrymenu(e,r())),Nr(`dragstart`,h,e=>s(e,r())),Nr(`dragover`,h,e=>c(e,r())),Nr(`drop`,h,e=>l(e,r())),Nr(`dragend`,h,()=>X.endDrag()),W(e,h)},r=(e,n=f)=>{let r=N(()=>i(n().name)),d=N(()=>X.expandedFolders.has(V(r))),p=N(()=>Q_(n())),m=N(()=>Q_(n(),e=>X.annotationCounts[e]>0)),h=N(()=>Q_(n(),e=>X.fileAttachmentCounts[e]>0));var g=mv(),_=L(g),v=L(_),y=L(v),b=L(y);j(y);var x=z(y,2),S=e=>{var t=dv(),n=L(t,!0);j(t),B(e=>{J(t,`title`,e),G(n,V(m))},[()=>u(V(m),`sidebar.annotated_docs_badge`)]),W(e,t)};K(x,e=>{V(m)>0&&!X.markerHidden&&e(S)});var C=z(x,2),w=e=>{var t=fv(),n=L(t,!0);j(t),B(e=>{J(t,`title`,e),G(n,V(h))},[()=>u(V(h),`sidebar.file_attached_docs_badge`)]),W(e,t)};K(C,e=>{V(h)>0&&!X.hideAttachments&&e(w)}),j(v);var T=z(v,2),E=L(T),D=L(E,!0);j(E);var ee=z(E,2);j(T),j(_);var te=z(_,2),O=e=>{var r=pv(),i=L(r);{let e=N(()=>n().children??[]),r=N(()=>[...t.folderPath,n().name]);hv(i,{get nodes(){return V(e)},get folderPath(){return V(r)},get onopen(){return t.onopen},get onentrymenu(){return t.onentrymenu},get onmove(){return t.onmove}})}j(r),W(e,r)};K(te,e=>{V(d)&&e(O)}),j(g),B((e,t)=>{J(_,`draggable`,V(a)),J(_,`data-drop`,e),J(_,`data-hidden`,n().hidden?`true`:void 0),vi(_,1,`${n().hidden?`opacity-50 italic`:``} w-full flex items-center justify-between px-3 py-1.5 text-xs font-semibold text-violet-600 dark:text-violet-400 uppercase tracking-wider hover:bg-gray-50 dark:hover:bg-gray-800/60 rounded-md transition-colors`),J(y,`title`,n().name),G(b,`📁 ${t??``}`),G(D,V(p)),vi(ee,1,`transition-transform duration-200 ${V(d)?`rotate-90`:``}`)},[()=>o(n()),()=>Y_(n().name)]),H(`click`,_,()=>X.toggleFolder(V(r))),H(`contextmenu`,_,e=>t.onentrymenu(e,n())),Nr(`dragstart`,_,e=>s(e,n())),Nr(`dragover`,_,e=>c(e,n())),Nr(`drop`,_,e=>l(e,n())),Nr(`dragend`,_,()=>X.endDrag()),W(e,g)};function i(e){return[...t.folderPath,e].join(`|`)}let a=N(()=>!X.searchQuery);function o(e){return X.dropTarget?.path===e.path?X.dropTarget.position:void 0}function s(e,t){X.dragSourcePath=t.path,e.dataTransfer&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t.path))}function c(e,t){if(!X.dragSourcePath||!V(a))return;e.preventDefault(),e.stopPropagation();let n=e.currentTarget.getBoundingClientRect(),r=ev(t.kind,e.clientY-n.top,n.height);X.setDropTarget(t.path,r,t.kind===`folder`?i(t.name):null)}function l(e,n){e.preventDefault(),e.stopPropagation();let r=X.dragSourcePath,i=o(n);X.endDrag(),r&&i&&t.onmove(r,n.path,i)}function u(e,t){return`${e} ${Y(t)}${e>1?`s`:``}`}function d(e){let t=e.id??``;return X.docsById.get(t)??{id:t,title:e.name.replace(/\.md$/i,``)}}function p(e){if(!X.highlightStatusState)return null;let t=String(X.docStatuses[e.id]||``).trim().toLowerCase();return t===`to be validated`?`V`:X.highlightStatusState===2&&t===`superseeded`?`S`:null}var m=Wr();q(R(m),17,()=>t.nodes,e=>e.path,(e,t)=>{var i=Wr(),a=R(i),o=e=>{r(e,()=>V(t))},s=e=>{{let r=N(()=>d(V(t)));n(e,()=>V(r),()=>V(t))}};K(a,e=>{V(t).kind===`folder`?e(o):e(s,-1)}),W(e,i)}),W(e,m),Je()}Pr([`click`,`contextmenu`]);var gv=U(`<p class="px-4 py-8 text-sm text-gray-400 text-center"> </p>`),_v=U(`<div class="fixed inset-0 z-40"></div> <div role="menu" class="fixed z-50 min-w-[8rem] py-1 rounded-md border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 shadow-lg text-sm"><button role="menuitem" data-testid="tree-menu-toggle-hidden" class="w-full text-left px-3 py-1.5 text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700"><i></i> </button></div>`,1),vv=U(`<aside><div class="sticky top-0 z-10 bg-white dark:bg-gray-900 p-3 border-b border-gray-100 dark:border-gray-800"><div class="relative sm:hidden"><input type="search" class="w-full pl-8 pr-3 py-1.5 text-sm rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500"/> <span class="absolute left-2.5 top-2 text-gray-400 text-sm pointer-events-none">🔍</span></div> <div class="flex items-center justify-between mt-2 sm:mt-0"><p class="text-xs text-gray-400 dark:text-gray-500"> </p> <div class="flex items-center gap-2"><button><i class="fa-solid fa-certificate"></i></button> <button><i class="fa-solid fa-paperclip"></i></button> <button data-testid="toggle-show-hidden"><i></i></button> <button class="text-gray-400 hover:text-blue-500 dark:text-gray-500 dark:hover:text-blue-400 transition-colors leading-none"><i class="fa-solid fa-file-export"></i></button> <button class="text-gray-400 hover:text-blue-500 dark:text-gray-500 dark:hover:text-blue-400 transition-colors leading-none"><i class="fa-solid fa-folder-plus"></i></button> <button class="text-gray-400 hover:text-blue-500 dark:text-gray-500 dark:hover:text-blue-400 transition-colors leading-none"><i class="fa-solid fa-file-circle-plus"></i></button></div></div></div> <nav data-testid="category-tree" class="flex-1 py-2 space-y-0.5"><!></nav> <!> <div aria-hidden="true"></div></aside>`);function yv(e,t){qe(t,!0);let n=N(()=>X.showHiddenEntries?X.explorerTree:Z_(X.explorerTree)),r=N(()=>X.searchQuery?X_(V(n),new Set(X.filteredDocs.map(e=>e.id))):V(n)),i=P(null);function a(e,t){e.preventDefault(),F(i,{x:e.clientX,y:e.clientY,node:t},!0)}async function o(){if(!V(i))return;let{node:e}=V(i);F(i,null),await V_(e.path,!e.hidden)&&(X.explorerTree=await B_())}async function s(e,n,r){let i=rv(X.explorerTree,e,n,r);if(!i)return;let a=await H_(i);if(a.ok)return t.onmoved(e,a.path);let o=e.split(`/`).pop()??e;wo(Y(a.status===409?`sidebar.move_conflict`:`sidebar.move_failed`,{name:o}),`error`),X.explorerTree=await B_()}let c=N(()=>X.filteredDocs.length),l=N(()=>V(r).length===0),u=`ld-sidebar-w`,d=P(null),f=P(!1),p=P(null);kn(()=>{let e=parseInt(localStorage.getItem(u)||``,10);Number.isFinite(e)&&F(d,Math.max(200,Math.min(600,e)),!0)});function m(e){e.preventDefault();let t=e.clientX,n=V(p).getBoundingClientRect().width;F(f,!0),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let r=e=>{F(d,Math.max(200,Math.min(600,n+e.clientX-t)),!0)},i=()=>{if(document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i),document.body.style.cursor=``,document.body.style.userSelect=``,F(f,!1),V(d)!=null)try{localStorage.setItem(u,String(V(d)))}catch{}};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)}var h=vv(),g=L(h),_=L(g),v=L(_);ki(v),Ie(2),j(_);var y=z(_,2),b=L(y),x=L(b);j(b);var S=z(b,2),C=L(S),w=z(C,2),T=z(w,2),E=L(T);j(T);var D=z(T,2),ee=z(D,2),te=z(ee,2);j(S),j(y),j(g);var O=z(g,2),ne=L(O),k=e=>{var t=gv(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`sidebar.no_docs`)]),W(e,t)},A=e=>{hv(e,{get nodes(){return V(r)},folderPath:[],get onopen(){return t.onopen},onentrymenu:a,onmove:s})};K(ne,e=>{V(l)?e(k):e(A,-1)}),j(O);var re=z(O,2),ie=e=>{var t=_v(),n=R(t),r=z(n,2),a=L(r),s=L(a),c=z(s,1,!0);j(a),j(r),B(e=>{bi(r,`left:${V(i).x??``}px; top:${V(i).y??``}px`),vi(s,1,`fa-solid ${V(i).node.hidden?`fa-eye`:`fa-eye-slash`} mr-2`),G(c,e)},[()=>Y(V(i).node.hidden?`sidebar.show_entry`:`sidebar.hide_entry`)]),H(`click`,n,()=>F(i,null)),H(`contextmenu`,n,e=>{e.preventDefault(),F(i,null)}),H(`click`,a,o),W(e,t)};K(re,e=>{V(i)&&e(ie)});var ae=z(re,2);j(h),Ui(h,e=>F(p,e),()=>V(p)),B((e,t,n,r,i,a,o)=>{vi(h,1,`no-print ${V(d)==null?`w-72`:``} shrink-0 flex flex-col border-r border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 overflow-y-auto relative`),bi(h,V(d)==null?``:`width:${V(d)}px`),J(v,`placeholder`,e),Ai(v,X.searchQuery),G(x,`${V(c)??``} document${V(c)===1?``:`s`}`),J(C,`title`,t),vi(C,1,`hover:opacity-80 transition-colors leading-none ${X.highlightStatusState===0?`text-gray-400 dark:text-gray-500`:X.highlightStatusState===1?`text-green-500 dark:text-green-400`:`text-orange-500 dark:text-orange-400`}`),J(w,`title`,n),vi(w,1,`transition-colors leading-none ${X.hideAttachments?`text-gray-400 dark:text-gray-500`:`text-blue-500 dark:text-blue-400`}`),J(T,`title`,r),vi(T,1,`transition-colors leading-none ${X.showHiddenEntries?`text-blue-500 dark:text-blue-400`:`text-gray-400 dark:text-gray-500`}`),vi(E,1,`fa-solid ${X.showHiddenEntries?`fa-eye`:`fa-eye-slash`}`),J(D,`title`,i),J(ee,`title`,a),J(te,`title`,o),vi(ae,1,`absolute top-0 right-[-2px] w-1.5 h-full cursor-col-resize z-20 select-none transition-colors ${V(f)?`bg-blue-500/55`:`hover:bg-blue-500/35`}`)},[()=>Y(`nav.search_mobile_placeholder`),()=>Y(`nav.toggle_status_highlight`),()=>Y(`nav.toggle_attachments`),()=>Y(`nav.toggle_hidden_entries`),()=>Y(`nav.export`),()=>Y(`nav.new_folder`),()=>Y(`nav.new_document`)]),H(`input`,v,e=>t.onsearch(e.target.value)),H(`click`,C,()=>X.cycleHighlightStatus()),H(`click`,w,()=>X.toggleHideAttachments()),H(`click`,T,()=>X.toggleShowHiddenEntries()),H(`click`,D,function(...e){t.onexport?.apply(this,e)}),H(`click`,ee,function(...e){t.onnewfolder?.apply(this,e)}),H(`click`,te,function(...e){t.onnewdoc?.apply(this,e)}),H(`mousedown`,ae,m),W(e,h),Je()}Pr([`input`,`click`,`contextmenu`,`mousedown`]);var bv=`background:rgba(250,204,21,0.5);border-radius:2px;cursor:pointer;padding:0 1px;`;function xv(e,t,n){e.querySelectorAll(`mark[data-annotation-id]`).forEach(e=>{let t=e.parentNode;t&&(t.replaceChild(document.createTextNode(e.textContent||``),e),t.normalize())});for(let n of t)Cv(e,n);e.querySelectorAll(`mark[data-annotation-id]`).forEach(e=>{(e.textContent||``).trim()||e.remove()}),n&&Sv(e,!1)}function Sv(e,t){e.querySelectorAll(`mark[data-annotation-id]`).forEach(e=>{let n=e;n.style.background=t?`rgba(250,204,21,0.5)`:`transparent`,n.style.cursor=t?`pointer`:`default`,n.style.pointerEvents=t?`auto`:`none`})}function Cv(e,t){let n=(t.selectedText||``).replace(/\s+/g,` `).trim(),r=(t.contextBefore||``).replace(/\s+/g,` `).trim(),i=(t.contextAfter||``).replace(/\s+/g,` `).trim();if(!n)return;let a=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),o=e=>e.split(/\s+/).filter(Boolean).map(a).join(`\\s+`),s=e.textContent||``,c=o(n),l=null;if(r||i){let e=(r?`${o(r)}\\s*`:``)+`(`+c+`)`+(i?`\\s*${o(i)}`:``);try{l=new RegExp(e,`d`).exec(s)}catch{}}if(!l)try{l=RegExp(`(${c})`,`d`).exec(s)}catch{return}let u=l&&l.indices;if(!l||!u?.[1])return;let[d,f]=u[1],p=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),m=[],h=0;for(;p.nextNode();){let e=p.currentNode,t=e.nodeValue?.length,n=h,r=h+t;if(h=r,r<=d)continue;if(n>=f)break;let i=Math.max(0,d-n),a=Math.min(t,f-n);i<a&&m.push({node:e,start:i,end:a})}for(let{node:e,start:n,end:r}of m){let i=e;n>0&&n<i.nodeValue?.length&&(i=i.splitText(n));let a=r-n;a>0&&a<i.nodeValue?.length&&i.splitText(a);let o=document.createElement(`mark`);o.setAttribute(`data-annotation-id`,t.id),o.setAttribute(`style`,bv),i.parentNode?.insertBefore(o,i),o.appendChild(i)}}var wv=U(`<div class="fixed z-50 w-80 bg-yellow-50 dark:bg-yellow-900/80 border-2 border-yellow-300 dark:border-yellow-600 rounded-xl shadow-2xl p-4 flex flex-col gap-3"><div class="text-xs font-semibold text-yellow-700 dark:text-yellow-300 flex items-center gap-2"><span>✎</span><span> </span></div> <div class="text-xs text-yellow-800 dark:text-yellow-200 bg-yellow-100 dark:bg-yellow-800/50 rounded px-2 py-1 italic max-h-16 overflow-y-auto border border-yellow-200 dark:border-yellow-700"> </div> <textarea rows="4" class="w-full text-sm rounded-lg border border-yellow-300 dark:border-yellow-600 bg-white dark:bg-yellow-950 text-gray-900 dark:text-gray-100 px-3 py-2 focus:outline-none focus:ring-2 focus:ring-yellow-400 resize-none"></textarea> <div class="flex justify-end gap-2"><button class="text-sm px-3 py-1.5 rounded-lg border border-yellow-300 dark:border-yellow-600 text-yellow-700 dark:text-yellow-300 hover:bg-yellow-100 dark:hover:bg-yellow-800 transition-colors"> </button> <button class="text-sm px-4 py-1.5 rounded-lg bg-yellow-400 hover:bg-yellow-500 dark:bg-yellow-600 dark:hover:bg-yellow-500 text-yellow-900 dark:text-white font-semibold transition-colors"> </button></div></div>`),Tv=U(`<div class="text-xs font-semibold text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-700 rounded px-2 py-1"> </div>`),Ev=U(`<div class="fixed z-50 w-80 bg-yellow-50 dark:bg-yellow-900/80 border-2 border-yellow-300 dark:border-yellow-600 rounded-xl shadow-2xl p-4 flex flex-col gap-2"><div class="text-xs font-semibold text-yellow-700 dark:text-yellow-300 flex items-center gap-2"><span>✎</span><span class="font-normal text-yellow-600 dark:text-yellow-400"> </span></div> <!> <div class="text-sm text-gray-800 dark:text-gray-100 whitespace-pre-wrap max-h-48 overflow-y-auto"> </div> <div class="flex justify-end pt-1 border-t border-yellow-200 dark:border-yellow-700"><button class="text-xs px-3 py-1.5 rounded-lg border border-red-200 dark:border-red-700 text-red-500 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/40 transition-colors flex items-center gap-1"> </button></div></div>`),Dv=U(`<div class="fixed z-50 w-72 bg-white dark:bg-gray-900 border border-red-200 dark:border-red-700 rounded-xl shadow-2xl p-4 flex flex-col gap-3"><p class="text-sm text-gray-700 dark:text-gray-200"> </p> <div class="flex justify-end gap-2"><button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-1.5 rounded-lg bg-red-500 hover:bg-red-600 text-white font-semibold transition-colors"> </button></div></div>`),Ov=U(`<button> </button>`),kv=U(`<div class="fixed top-14 right-0 w-10 flex flex-col items-center py-2 gap-2 z-40 overflow-y-auto" style="max-height: calc(100vh - 3.5rem)"></div>`),Av=U(`<!> <!> <!> <!>`,1);function jv(e,t){qe(t,!0);let n=P(I([])),r=P(null),i=P(``),a=P(null),o=P(null),s=P(I([])),c=null;Ji(()=>{let e=document.getElementById(`home-content-area`);if(!e)return;let t=()=>{c&&clearTimeout(c),F(a,null)};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)});function l(e,t,n=320,r=260){let i=window.innerWidth,a=window.innerHeight,o=e;return o+n>i-16&&(o=i-n-16),o<8&&(o=8),{x:o,y:Math.min(t,a-r)}}async function u(e){F(n,[],!0);try{F(n,await fetch(`/api/annotations/`+encodeURIComponent(e)).then(e=>e.json()),!0)}catch{F(n,[],!0)}d()}function d(){t.contentEl&&(xv(t.contentEl,V(n),X.markerHidden),f())}kn(()=>{t.contentEl&&Sv(t.contentEl,!X.markerHidden)});function f(){if(!t.contentEl){F(s,[],!0);return}F(s,V(n).map(e=>({id:e.id,note:e.note.length>60?e.note.slice(0,60)+`…`:e.note,orphan:!t.contentEl.querySelector(`mark[data-annotation-id="${e.id}"]`)})),!0)}function p(){if(!X.markerActive||V(r)||!t.contentEl)return;let e=window.getSelection();if(!e||e.isCollapsed||!e.toString().trim()||!t.contentEl.contains(e.anchorNode))return;let n=e.getRangeAt(0),a=document.createRange();a.selectNodeContents(t.contentEl),a.setEnd(n.startContainer,n.startOffset);let o=a.toString().length,s=n.toString(),c=t.contentEl.textContent||``,u=e=>e.replace(/\s+/g,` `).trim(),d=u(s),f=u(c.slice(Math.max(0,o-30),o)),p=u(c.slice(o+s.length,o+s.length+30)),m=n.getBoundingClientRect(),h=l(m.left,m.bottom+8);F(r,{x:h.x,y:h.y,preview:d.length>120?d.slice(0,120)+`…`:d,selectedText:d,contextBefore:f,contextAfter:p},!0),F(i,``)}function m(){F(r,null),window.getSelection()?.removeAllRanges()}async function h(){if(!V(r)||!t.docId)return;let e=V(i).trim();if(e)try{let i=await fetch(`/api/annotations/`+encodeURIComponent(t.docId),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({selectedText:V(r).selectedText,contextBefore:V(r).contextBefore,contextAfter:V(r).contextAfter,note:e})}).then(e=>e.json());F(n,[...V(n),i],!0),m(),d(),X.annotationCounts={...X.annotationCounts,[t.docId]:(X.annotationCounts[t.docId]||0)+1}}catch{}}kn(()=>{if(!t.contentEl)return;let e=t.contentEl,r=e=>{let t=e.target.closest(`mark[data-annotation-id]`);if(!t)return;let r=V(n).find(e=>e.id===t.dataset.annotationId);r&&g(r,t)},i=e=>{let t=e;t.target.closest(`mark[data-annotation-id]`)&&(t.relatedTarget&&t.relatedTarget.closest?.(`mark[data-annotation-id]`)||_())};return e.addEventListener(`mouseover`,r),e.addEventListener(`mouseout`,i),()=>{e.removeEventListener(`mouseover`,r),e.removeEventListener(`mouseout`,i)}});function g(e,n){c&&clearTimeout(c);let r=!t.contentEl?.querySelector(`mark[data-annotation-id="${e.id}"]`),i=n.getBoundingClientRect(),o=l(i.left,i.bottom+8);F(a,{ann:e,x:o.x,y:o.y,orphan:r},!0)}function _(){c=window.setTimeout(()=>{F(a,null)},1500)}function v(){V(a)&&(F(o,{id:V(a).ann.id,x:V(a).x,y:V(a).y},!0),F(a,null))}async function y(){if(!V(o)||!t.docId)return;let e=V(o).id;try{await fetch(`/api/annotations/${encodeURIComponent(t.docId)}/${e}`,{method:`DELETE`}),F(n,V(n).filter(t=>t.id!==e),!0),F(o,null),d();let r=(X.annotationCounts[t.docId]||0)-1,i={...X.annotationCounts};r<=0?delete i[t.docId]:i[t.docId]=r,X.annotationCounts=i}catch{}}function b(e,t){return e.getBoundingClientRect().top+t.scrollTop-t.getBoundingClientRect().top}function x(e,t){let n=e.parentElement;for(;n&&n!==t;)n.tagName===`DETAILS`&&(n.open=!0),n=n.parentElement}function S(e,r){let i=t.contentEl?.querySelector(`mark[data-annotation-id="${e}"]`),o=document.getElementById(`home-content-area`);if(i&&o){if(V(a)?.ann.id===e){c&&clearTimeout(c);return}x(i,o),o.scrollTo({top:b(i,o)-o.clientHeight/2,behavior:`smooth`})}else{let t=V(n).find(t=>t.id===e);t&&g(t,r.currentTarget)}}function C(e,r){c&&clearTimeout(c);let i=V(n).find(t=>t.id===e);if(!i)return;let a=t.contentEl?.querySelector(`mark[data-annotation-id="${e}"]`),o=document.getElementById(`home-content-area`);if(!a||!o){g(i,r.currentTarget);return}x(a,o),o.scrollTo({top:b(a,o)-o.clientHeight/2,behavior:`smooth`});let s,l=()=>{clearTimeout(s),s=window.setTimeout(()=>{o.removeEventListener(`scroll`,l),g(i,a)},80)};o.addEventListener(`scroll`,l),s=window.setTimeout(()=>{o.removeEventListener(`scroll`,l),g(i,a)},600)}function w(e){let t=V(a)?.ann.id===e.id;return e.orphan?t?`#b91c1c`:`#ef4444`:t?`#f97316`:`#facc15`}function T(e){return new Date(e).toLocaleDateString(`fr-FR`,{day:`2-digit`,month:`short`,year:`numeric`})}var E={load:u,apply:d},D=Av();Nr(`mouseup`,on,p);var ee=R(D),te=e=>{var t=wv(),n=L(t),a=z(L(n)),o=L(a,!0);j(a),j(n);var s=z(n,2),c=L(s,!0);j(s);var l=z(s,2);yn(l),vn(l,!0);var u=z(l,2),d=L(u),f=L(d,!0);j(d);var p=z(d,2),g=L(p,!0);j(p),j(u),j(t),B((e,n,i,a)=>{bi(t,`left:${V(r).x??``}px;top:${V(r).y??``}px`),G(o,e),G(c,V(r).preview),J(l,`placeholder`,n),G(f,i),G(g,a)},[()=>Y(`annotation.title`),()=>Y(`annotation.placeholder`),()=>Y(`common.cancel`),()=>Y(`annotation.save_btn`)]),Fi(l,()=>V(i),e=>F(i,e)),H(`click`,d,m),H(`click`,p,h),W(e,t)};K(ee,e=>{V(r)&&e(te)});var O=z(ee,2),ne=e=>{var t=Ev(),n=L(t),r=z(L(n)),i=L(r,!0);j(r),j(n);var o=z(n,2),s=e=>{var t=Tv(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`annotation.orphan`)]),W(e,t)};K(o,e=>{V(a).orphan&&e(s)});var l=z(o,2),u=L(l,!0);j(l);var d=z(l,2),f=L(d),p=L(f,!0);j(f),j(d),j(t),B((e,n)=>{bi(t,`left:${V(a).x??``}px;top:${V(a).y??``}px`),G(i,e),G(u,V(a).ann.note),G(p,n)},[()=>T(V(a).ann.createdAt),()=>Y(`annotation.delete_btn`)]),Nr(`mouseenter`,t,()=>{c&&clearTimeout(c)}),Nr(`mouseleave`,t,_),H(`click`,f,v),W(e,t)};K(O,e=>{V(a)&&e(ne)});var k=z(O,2),A=e=>{var t=Dv(),n=L(t),r=L(n,!0);j(n);var i=z(n,2),a=L(i),s=L(a,!0);j(a);var c=z(a,2),l=L(c,!0);j(c),j(i),j(t),B((e,n,i)=>{bi(t,`left:${V(o).x??``}px;top:${V(o).y??``}px`),G(r,e),G(s,n),G(l,i)},[()=>Y(`annotation.confirm_delete`),()=>Y(`common.cancel`),()=>Y(`annotation.confirm_btn`)]),H(`click`,a,()=>F(o,null)),H(`click`,c,y),W(e,t)};K(k,e=>{V(o)&&e(A)});var re=z(k,2),ie=e=>{var t=kv();q(t,21,()=>V(s),e=>e.id,(e,t)=>{var n=Ov(),r=L(n,!0);j(n),B((e,i)=>{J(n,`title`,e),vi(n,1,`w-8 h-8 rounded border-2 shadow text-xs flex items-center justify-center transition-colors shrink-0 ${V(t).orphan?`border-red-600 text-white`:`border-yellow-500`}`),bi(n,`background:${i??``}`),G(r,V(t).orphan?`⚠`:`✎`)},[()=>V(t).orphan?`${Y(`annotation.orphan`)}\n\n${V(t).note}`:V(t).note,()=>w(V(t))]),H(`click`,n,e=>S(V(t).id,e)),Nr(`mouseenter`,n,e=>C(V(t).id,e)),Nr(`mouseleave`,n,_),W(e,n)}),j(t),W(e,t)};return K(re,e=>{V(s).length>0&&!X.markerHidden&&e(ie)}),W(e,D),Je(E)}Pr([`click`]);var Mv=`#dc2626`,Nv=`#eab308`,Pv=`#16a34a`;function Fv(e){let t=Math.max(0,Math.min(1,e))*100;return t>80?Pv:t>=60?Nv:t>=40?`#f97316`:Mv}function Iv(e){let t=Math.max(0,Math.min(1,e))*100;return t>=100?Pv:t<30?Mv:t<60?`linear-gradient(to right, ${Mv} 0%, ${Mv} 60%, ${Nv} 100%)`:t<80?`linear-gradient(to right, ${Mv} 0%, ${Nv} 40%, ${Nv} 100%)`:`linear-gradient(to right, ${Nv} 0%, ${Pv} 40%, ${Pv} 100%)`}var Lv=new class{#e=P(null);get report(){return V(this.#e)}set report(e){F(this.#e,e,!0)}async load(e){if(!e)return this.report=null,null;try{let t=await fetch(`/api/metadata/${encodeURIComponent(e)}`);if(!t.ok)throw Error(t.statusText);this.report=await t.json()}catch{this.report=null}return this.report}async refresh(e){let t=await fetch(`/api/metadata/${encodeURIComponent(e)}/refresh`,{method:`POST`});if(!t.ok)throw Error(t.statusText);this.report=await t.json()}async addPath(e,t){let n=await fetch(`/api/metadata/${encodeURIComponent(e)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error||n.statusText)}this.report=await n.json()}async removePath(e,t){let n=await fetch(`/api/metadata/${encodeURIComponent(e)}`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t})});if(!n.ok)throw Error(n.statusText);this.report=await n.json()}},Rv=U(`<div data-testid="accuracy-gauge" class="no-print mt-5 flex items-center gap-3 mr-auto w-full sm:w-80 cursor-pointer select-none"><span class="text-xs text-gray-500 dark:text-gray-400 shrink-0"> </span> <div class="flex-1 h-4 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden"><div class="h-full w-full transition-all"></div></div> <span data-testid="accuracy-gauge-value" class="text-xs font-semibold shrink-0 tabular-nums"> </span></div>`);function zv(e,t){qe(t,!0);let n=N(()=>Lv.report),r=N(()=>V(n)?Math.round(V(n).accuracy*100):0),i=N(()=>V(n)?Y(`accuracy.tooltip`).replace(`{unchanged}`,String(V(n).unchanged)).replace(`{modified}`,String(V(n).modified)).replace(`{missing}`,String(V(n).missing)).replace(`{total}`,String(V(n).total)):``);var a=Wr(),o=R(a),s=e=>{var a=Rv(),o=L(a),s=L(o,!0);j(o);var c=z(o,2),l=L(c);j(c);var u=z(c,2),d=L(u);j(u),j(a),B((e,t,n)=>{J(a,`title`,V(i)),G(s,e),bi(l,`background:${t??``}`),bi(u,`color:${n??``}`),G(d,`${V(r)??``}%`)},[()=>Y(`accuracy.label`),()=>Iv(V(n).accuracy),()=>Fv(V(n).accuracy)]),H(`click`,a,function(...e){t.onopen?.apply(this,e)}),W(e,a)};K(o,e=>{V(n)&&V(n).total>0&&e(s)}),W(e,a),Je()}Pr([`click`]);var Bv=/^(\s*(?:\*\*status:\*\*|status:)\s*).+?\s*$/im;function Vv(e){if(typeof e!=`string`)return null;let t=e.match(/^---\s*\n([\s\S]*?)\n---/);if(!t)return null;let n=t[1].match(/^\s*(?:\*\*status:\*\*|status:)\s*(.+?)\s*$/im);return n?n[1].trim():null}function Hv(e,t){return e.replace(Bv,`$1${t}`)}function Uv(e){return/%5BWORKLOG%5D/i.test(e)}var Wv=U(`<div data-testid="metadata-readonly-banner" class="text-xs text-amber-800 dark:text-amber-200 bg-amber-50 dark:bg-amber-900/30 border-l-4 border-amber-500 rounded-r px-3 py-2"> </div>`),Gv=U(`<div class="px-3 py-4 text-center text-xs text-gray-400"> </div>`),Kv=U(`<span class="inline-flex items-center gap-1 text-xs font-semibold px-2 py-0.5 rounded-full bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300"><i class="fa-solid fa-check"></i> </span>`),qv=U(`<span class="inline-flex items-center gap-1 text-xs font-semibold px-2 py-0.5 rounded-full bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300"><i class="fa-solid fa-triangle-exclamation"></i> </span>`),Jv=U(`<span class="inline-flex items-center gap-1 text-xs font-semibold px-2 py-0.5 rounded-full bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300"><i class="fa-solid fa-circle-xmark"></i> </span>`),Yv=U(`<button class="metadata-row-remove text-xs px-2 py-1 rounded-lg border border-red-200 dark:border-red-700 text-red-500 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/40 transition-colors"><i class="fa-solid fa-trash"></i></button>`),Xv=U(`<div class="flex items-center gap-2 px-3 py-2 border-b border-gray-100 dark:border-gray-800"><div class="flex-1 min-w-0"><div class="text-sm font-mono truncate text-gray-800 dark:text-gray-200"> </div></div> <!> <!></div>`),Zv=U(`<div class="flex items-center gap-2 flex-wrap"><button data-testid="metadata-add-btn" class="text-sm px-3 py-1.5 rounded-lg border border-blue-200 dark:border-blue-700 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/30 transition-colors"><i class="fa-solid fa-plus"></i> </button> <button data-testid="metadata-refresh-btn" class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"><i class="fa-solid fa-arrows-rotate"></i> </button></div>`),Qv=U(`<div class="px-3 py-2 text-xs text-gray-400"> </div>`),$v=U(`<div class="px-3 py-2 text-xs text-red-500"> </div>`),ey=U(`<button class="w-full text-left px-3 py-1.5 text-sm hover:bg-gray-50 dark:hover:bg-gray-800 flex items-center gap-2"><i class="fa-solid fa-folder text-yellow-500"></i> <span class="truncate"> </span></button>`),ty=U(`<button class="w-full text-left px-3 py-1.5 text-sm hover:bg-blue-50 dark:hover:bg-blue-900/30 flex items-center gap-2"><i class="fa-solid fa-file text-gray-400"></i> <span class="truncate"> </span> <i class="fa-solid fa-plus ml-auto text-blue-500 text-xs"></i></button>`),ny=U(`<!> <!>`,1),ry=U(`<div class="border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden text-sm"><div class="flex items-center gap-2 px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700"><button class="text-xs text-blue-600 dark:text-blue-400 hover:underline disabled:opacity-30 disabled:pointer-events-none shrink-0"> </button> <span class="text-xs text-gray-500 dark:text-gray-400 font-mono truncate flex-1"> </span></div> <div class="max-h-56 overflow-y-auto divide-y divide-gray-100 dark:divide-gray-800"><!></div></div>`),iy=U(`<p class="text-xs text-red-500"> </p>`),ay=U(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50"><div data-testid="metadata-modal" class="bg-white dark:bg-gray-900 rounded-xl shadow-xl w-full max-w-2xl mx-4 p-6 space-y-4"><div class="flex items-start justify-between gap-4"><div><h3 class="text-base font-semibold text-gray-900 dark:text-gray-50"><i class="fa-solid fa-code-compare mr-1"></i> </h3> <p class="text-xs text-gray-500 dark:text-gray-400 mt-1"> </p></div> <button class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 transition-colors"><i class="fa-solid fa-xmark text-lg"></i></button></div> <div class="text-xs text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-800 rounded-lg px-3 py-2"></div> <!> <div data-testid="metadata-list" class="border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden"><div class="max-h-64 overflow-y-auto"><!></div></div> <!> <!> <!> <div class="flex justify-end"><button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button></div></div></div>`);function oy(e,t){qe(t,!0);let n=N(()=>Lv.report),r=N(()=>Vv(t.content)===`SuperSeeded`),i=P(``),a=P(!1),o=P(!1),s=P(``),c=P(null),l=P(I([])),u=P(I([])),d=P(!1),f=P(``);kn(()=>{t.open||(F(o,!1),F(s,``),F(i,``))});function p(e){F(i,Y(`common.error_prefix`)+e),setTimeout(()=>{F(i,``)},5e3)}function m(){return!V(n)||V(n).total===0?``:`<span class="font-semibold">${Math.round(V(n).accuracy*100)}%</span> · ${V(n).unchanged}/${V(n).total} ${Y(`metadata.status.unchanged`)} · ${V(n).modified} ${Y(`metadata.status.modified`)} · ${V(n).missing} ${Y(`metadata.status.missing`)}`}async function h(){F(a,!0);try{await Lv.refresh(t.docId)}catch(e){p(e instanceof Error?e.message:String(e))}finally{F(a,!1)}}async function g(e){try{await Lv.removePath(t.docId,e),V(o)&&y(V(s))}catch(e){p(e instanceof Error?e.message:String(e))}}async function _(e){try{await Lv.addPath(t.docId,e),V(o)&&y(V(s))}catch(e){p(e instanceof Error?e.message:String(e))}}function v(){F(o,!V(o)),V(o)&&y(``)}async function y(e){F(d,!0),F(f,``);try{let t=await fetch(`/api/browse-source?path=`+encodeURIComponent(e||``));if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error||t.statusText)}let r=await t.json();F(s,r.current||``,!0),F(c,r.parent,!0),F(l,r.dirs||[],!0);let i=new Set((V(n)?.items||[]).map(e=>e.path));F(u,(r.files||[]).filter(e=>!i.has(e.path)),!0)}catch(e){F(f,e instanceof Error?e.message:String(e),!0)}finally{F(d,!1)}}function b(){V(c)!==null&&y(V(c))}var x=Wr(),S=R(x),C=e=>{var p=ay(),x=L(p),S=L(x),C=L(S),w=L(C),T=z(L(w));j(w);var E=z(w,2),D=L(E,!0);j(E),j(C);var ee=z(C,2);j(S);var te=z(S,2);si(te,m,!0),j(te);var O=z(te,2),ne=e=>{var t=Wv(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`metadata.readonly_banner`)]),W(e,t)};K(O,e=>{V(r)&&e(ne)});var k=z(O,2),A=L(k),re=L(A),ie=e=>{var t=Gv(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`metadata.empty`)]),W(e,t)},ae=e=>{var t=Wr();q(R(t),17,()=>V(n).items,e=>e.path,(e,t)=>{var n=Xv(),i=L(n),a=L(i),o=L(a,!0);j(a),j(i);var s=z(i,2),c=e=>{var t=Kv(),n=z(L(t));j(t),B(e=>G(n,` ${e??``}`),[()=>Y(`metadata.status.unchanged`)]),W(e,t)},l=e=>{var t=qv(),n=z(L(t));j(t),B(e=>G(n,` ${e??``}`),[()=>Y(`metadata.status.modified`)]),W(e,t)},u=e=>{var t=Jv(),n=z(L(t));j(t),B(e=>G(n,` ${e??``}`),[()=>Y(`metadata.status.missing`)]),W(e,t)};K(s,e=>{V(t).status===`unchanged`?e(c):V(t).status===`modified`?e(l,1):e(u,-1)});var d=z(s,2),f=e=>{var n=Yv();B(e=>J(n,`title`,e),[()=>Y(`metadata.remove`)]),H(`click`,n,()=>g(V(t).path)),W(e,n)};K(d,e=>{V(r)||e(f)}),j(n),B(()=>{J(a,`title`,V(t).path),G(o,V(t).path)}),W(e,n)}),W(e,t)};K(re,e=>{!V(n)||V(n).items.length===0?e(ie):e(ae,-1)}),j(A),j(k);var oe=z(k,2),se=e=>{var t=Zv(),n=L(t),r=z(L(n));j(n);var i=z(n,2),o=z(L(i));j(i),j(t),B((e,t)=>{G(r,` ${e??``}`),i.disabled=V(a),G(o,` ${t??``}`)},[()=>Y(`metadata.add`),()=>Y(`metadata.refresh`)]),H(`click`,n,v),H(`click`,i,h),W(e,t)};K(oe,e=>{V(r)||e(se)});var ce=z(oe,2),le=e=>{var t=ry(),n=L(t),r=L(n),i=L(r,!0);j(r);var a=z(r,2),o=L(a,!0);j(a),j(n);var p=z(n,2),m=L(p),h=e=>{var t=Qv(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`common.loading`)]),W(e,t)},g=e=>{var t=$v(),n=L(t,!0);j(t),B(()=>G(n,V(f))),W(e,t)},v=e=>{var t=Qv(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`common.empty_dir`)]),W(e,t)},x=e=>{var t=ny(),n=R(t);q(n,17,()=>V(l),e=>e.path,(e,t)=>{var n=ey(),r=z(L(n),2),i=L(r,!0);j(r),j(n),B(()=>G(i,V(t).name)),H(`click`,n,()=>y(V(t).path)),W(e,n)}),q(z(n,2),17,()=>V(u),e=>e.path,(e,t)=>{var n=ty(),r=z(L(n),2),i=L(r,!0);j(r),Ie(2),j(n),B(()=>G(i,V(t).name)),H(`click`,n,()=>_(V(t).path)),W(e,n)}),W(e,t)};K(m,e=>{V(d)?e(h):V(f)?e(g,1):V(l).length===0&&V(u).length===0?e(v,2):e(x,-1)}),j(p),j(t),B(e=>{r.disabled=V(c)===null,G(i,e),G(o,V(s)?`/`+V(s):`/ (sourceRoot)`)},[()=>Y(`common.up`)]),H(`click`,r,b),W(e,t)};K(ce,e=>{V(o)&&e(le)});var ue=z(ce,2),de=e=>{var t=iy(),n=L(t,!0);j(t),B(()=>G(n,V(i))),W(e,t)};K(ue,e=>{V(i)&&e(de)});var fe=z(ue,2),pe=L(fe),me=L(pe,!0);j(pe),j(fe),j(x),j(p),B((e,t,n,r)=>{G(T,` ${e??``}`),G(D,t),J(ee,`title`,n),G(me,r)},[()=>Y(`metadata.title`),()=>Y(`metadata.subtitle`),()=>Y(`common.close`),()=>Y(`common.close`)]),H(`click`,p,e=>{e.target===e.currentTarget&&t.onclose()}),H(`click`,ee,function(...e){t.onclose?.apply(this,e)}),H(`click`,pe,function(...e){t.onclose?.apply(this,e)}),W(e,p)};K(S,e=>{t.open&&e(C)}),W(e,x),Je()}Pr([`click`]);var sy=U(`<div class="text-xs font-medium text-amber-700 dark:text-amber-300"> </div>`),cy=U(`<div> </div>`),ly=U(`<button type="button"><div class="flex items-center gap-2 font-semibold text-gray-800 dark:text-gray-100"><span class="font-mono text-blue-600 dark:text-blue-400"> </span> <span class="truncate"> </span></div> <div class="mt-1 text-gray-500 dark:text-gray-400"> </div></button>`),uy=U(`<div class="mt-3 flex gap-2 overflow-x-auto pb-1"></div>`),dy=U(`<p class="mt-3 text-sm text-gray-500 dark:text-gray-400"> </p>`),fy=U(`<div class="flex h-full items-center justify-center text-sm text-gray-500 dark:text-gray-400"> </div>`),py=U(`<div class="m-5 rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-800 dark:bg-red-950/30 dark:text-red-300"> </div>`),my=U(`<div class="mx-5 mt-4 rounded-lg border border-amber-200 bg-amber-50 px-4 py-2 text-sm text-amber-800 dark:border-amber-800 dark:bg-amber-950/30 dark:text-amber-200"> </div>`),hy=U(`<button type="button" class="mt-0.5 inline-flex h-7 w-8 items-center justify-center rounded-md border border-blue-200 bg-white font-mono text-sm font-bold text-blue-600 transition-colors hover:bg-blue-50 disabled:cursor-wait disabled:opacity-50 dark:border-blue-800 dark:bg-gray-950 dark:text-blue-300 dark:hover:bg-blue-950/40"> </button>`),gy=U(`<div><span> </span> <pre class="m-0 whitespace-pre-wrap break-words px-2 py-0.5 font-mono"> </pre></div> <div class="flex items-start justify-center border-r border-gray-200 bg-gray-50 px-1 py-0.5 dark:border-gray-800 dark:bg-gray-900/70"><!></div> <div><span> </span> <pre class="m-0 whitespace-pre-wrap break-words px-2 py-0.5 font-mono"> </pre></div>`,1),_y=U(`<!> <div class="h-full overflow-auto p-5"><div class="grid min-w-[980px] grid-cols-[minmax(0,1fr)_3.25rem_minmax(0,1fr)] overflow-hidden rounded-lg border border-gray-200 text-xs dark:border-gray-800"><div class="border-b border-r border-gray-200 bg-gray-100 px-3 py-2 font-semibold text-gray-700 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-200"> </div> <div class="border-b border-r border-gray-200 bg-gray-100 px-2 py-2 text-center font-semibold text-gray-400 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-500"></div> <div class="border-b border-gray-200 bg-gray-100 px-3 py-2 font-semibold text-gray-700 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-200"> </div> <!></div></div>`,1),vy=U(`<div data-testid="versions-modal" class="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4"><div class="flex h-[90vh] w-full max-w-7xl flex-col overflow-hidden rounded-xl border border-gray-200 bg-white shadow-2xl dark:border-gray-700 dark:bg-gray-950"><header class="flex shrink-0 items-start justify-between gap-4 border-b border-gray-200 px-5 py-4 dark:border-gray-800"><div><h2 class="text-lg font-semibold text-gray-900 dark:text-gray-50"><i class="fa-solid fa-code-branch mr-2"></i> </h2> <p class="mt-1 text-xs text-gray-500 dark:text-gray-400"> </p></div> <button type="button" class="rounded-lg border border-gray-200 px-3 py-1.5 text-sm text-gray-600 transition-colors hover:bg-gray-50 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800"><i class="fa-solid fa-xmark"></i></button></header> <div class="shrink-0 border-b border-gray-200 px-5 py-3 dark:border-gray-800"><div class="flex flex-wrap items-end gap-3"><label class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400"> <input type="number" class="mt-1 block w-28 rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm text-gray-800 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100"/></label> <button type="button" class="rounded-lg bg-blue-600 px-3 py-1.5 text-sm font-semibold text-white transition-colors hover:bg-blue-700 disabled:opacity-50"><i class="fa-solid fa-arrows-rotate mr-1"></i> </button> <button type="button" class="rounded-lg bg-green-600 px-3 py-1.5 text-sm font-semibold text-white transition-colors hover:bg-green-700 disabled:cursor-not-allowed disabled:opacity-50"><i class="fa-solid fa-floppy-disk mr-1"></i> </button> <div class="text-xs text-gray-500 dark:text-gray-400"> </div> <!> <!></div> <!></div> <section class="min-h-0 flex-1 overflow-hidden"><!></section></div></div>`);function yy(e,t){qe(t,!0);let n=3650,r=P(30),i=P(30),a=P(!1),o=P(``),s=P(null),c=P(null),l=P(null),u=P(``),d=``,f=P(``),p=P(!1),m=N(()=>V(l)?.headContent??t.content),h=N(()=>V(f)),g=N(()=>V(f)!==V(m)),_=N(()=>T(V(l)?.baseContent??``,V(h))),v=N(()=>V(_).rows),y=N(()=>V(l)?.baseContent!==null&&V(l)?.baseContent!==void 0);kn(()=>{t.docId,F(f,t.content,!0)});function b(e){return Number.isFinite(e)?Math.max(1,Math.min(n,Math.floor(e))):30}function x(e){return e.length?e.replace(/\r\n/g,`
|
|
99
|
+
<a href="${O(s)}" target="_blank" rel="noopener" class="mcp-saved-link">📄 ${O(a)}</a>`})}catch(n){f(e,t,{running:!1,error:n.message||String(n),resultHtml:``})}}async function te(e){let n=V(e===`tool`?o:s);if(!n.length)return;F(c,!0);let r=n.length;try{for(let i=0;i<n.length;i++)t.onStatus(Y(`context.mcp_running_all`).replace(`{current}`,String(i+1)).replace(`{total}`,String(r))),await ee(e,n[i].name);t.onStatus(Y(`context.mcp_done_all`).replace(`{total}`,String(r)))}finally{F(c,!1)}}function O(e){return String(e??``).replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e])}async function ne(){try{let e=await fetch(`/mcp`);if(!e.ok)throw Error(await e.text());let t=await e.json(),c=Array.isArray(t.tools)?t.tools:[],l=Array.isArray(t.prompts)?t.prompts:[];F(n,Y(`context.mcp_available`),!0),F(r,!0),F(i,t.transport||`-`,!0),F(a,t.endpoint||`POST /mcp`,!0),F(o,c,!0),F(s,l,!0),c.forEach(m),l.forEach(h)}catch{F(n,Y(`context.mcp_unavailable`),!0),F(r,!1),F(i,`-`),F(a,`/mcp`),F(o,[],!0),F(s,[],!0)}}var k={load:ne},A=N_(),re=L(A),ie=L(re),ae=L(ie,!0);j(ie);var oe=z(ie,2),se=L(oe,!0);j(oe),j(re);var ce=z(re,2),le=L(ce,!0);j(ce);var ue=z(ce,2),de=L(ue),fe=L(de),pe=L(fe,!0);j(fe);var me=z(fe,2),he=L(me,!0);j(me),j(de);var ge=z(de,2),_e=L(ge),ve=L(_e,!0);j(_e);var ye=z(_e,2),be=L(ye,!0);j(ye),j(ge);var xe=z(ge,2),Se=L(xe),Ce=L(Se,!0);j(Se);var we=z(Se,2),Te=L(we,!0);j(we),j(xe),j(ue);var Ee=z(ue,2),De=L(Ee),Oe=L(De),ke=L(Oe,!0);j(Oe);var Ae=z(Oe,2),je=L(Ae),Me=L(je,!0);j(je);var Ne=z(je,2),Pe=L(Ne,!0);j(Ne),j(Ae),j(De);var Fe=z(De,2),Ie=L(Fe),Le=e=>{var t=T_(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`context.mcp_no_tools`)]),W(e,t)},Re=e=>{var t=Wr();q(R(t),17,()=>V(o),Qr,(e,t)=>{let n=N(()=>V(l).get(V(t).name)??{argsJson:`{}`,running:!1,error:``,resultHtml:``});var r=k_(),i=L(r),a=L(i,!0);j(i);var o=z(i,2),s=e=>{var n=E_(),r=L(n,!0);j(n),B(()=>G(r,V(t).description)),W(e,n)};K(o,e=>{V(t).description&&e(s)});var c=z(o,2),u=e=>{var n=D_(),r=L(n),i=L(r,!0);j(r);var a=z(r,2),o=L(a,!0);j(a),j(n),B((e,t)=>{G(i,e),G(o,t)},[()=>Y(`context.mcp_input_schema`),()=>JSON.stringify(V(t).inputSchema,null,2)]),W(e,n)};K(c,e=>{V(t).inputSchema&&e(u)});var d=z(c,2),p=L(d),m=L(p,!0);j(p);var h=z(p,2);yn(h);var g=z(h,2),_=L(g),v=L(_,!0);j(_);var y=z(_,2),b=L(y,!0);j(y),j(g);var x=z(g,2),S=e=>{var t=O_();si(t,()=>V(n).resultHtml,!0),j(t),W(e,t)};K(x,e=>{V(n).resultHtml&&e(S)}),j(d),j(r),B((e,r)=>{G(a,V(t).name),G(m,e),Ai(h,V(n).argsJson),G(v,V(n).error),y.disabled=V(n).running,G(b,r)},[()=>Y(`context.mcp_request_json`),()=>Y(`context.mcp_run_tool`)]),H(`input`,h,e=>f(`tool`,V(t).name,{argsJson:e.target.value})),H(`click`,y,()=>ee(`tool`,V(t).name)),W(e,r)}),W(e,t)};K(Ie,e=>{V(o).length?e(Re,-1):e(Le)}),j(Fe),j(Ee);var ze=z(Ee,2),Be=L(ze),Ve=L(Be),He=L(Ve,!0);j(Ve);var Ue=z(Ve,2),We=L(Ue),Ge=L(We,!0);j(We);var Ke=z(We,2),Ye=L(Ke,!0);j(Ke),j(Ue),j(Be);var Xe=z(Be,2),Ze=L(Xe),Qe=e=>{var t=T_(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`context.mcp_no_prompts`)]),W(e,t)},$e=e=>{var t=Wr();q(R(t),17,()=>V(s),Qr,(e,t)=>{let n=N(()=>V(u).get(V(t).name)??{argsJson:`{}`,running:!1,error:``,resultHtml:``});var r=k_(),i=L(r),a=L(i,!0);j(i);var o=z(i,2),s=e=>{var n=E_(),r=L(n,!0);j(n),B(()=>G(r,V(t).description)),W(e,n)};K(o,e=>{V(t).description&&e(s)});var c=z(o,2),l=e=>{var n=M_(),r=L(n),i=L(r,!0);j(r);var a=z(r,2);q(a,21,()=>V(t).arguments,Qr,(e,t)=>{var n=j_(),r=L(n),i=L(r),a=L(i,!0);j(i);var o=z(i,2),s=L(o,!0);j(o),j(r);var c=z(r,2),l=e=>{var n=A_(),r=L(n,!0);j(n),B(()=>G(r,V(t).description)),W(e,n)};K(c,e=>{V(t).description&&e(l)}),j(n),B(e=>{G(a,V(t).name),G(s,e)},[()=>V(t).required?Y(`context.mcp_required`):Y(`context.mcp_optional`)]),W(e,n)}),j(a),j(n),B(e=>G(i,e),[()=>Y(`context.mcp_arguments`)]),W(e,n)};K(c,e=>{V(t).arguments?.length&&e(l)});var d=z(c,2),p=L(d),m=L(p,!0);j(p);var h=z(p,2);yn(h);var g=z(h,2),_=L(g),v=L(_,!0);j(_);var y=z(_,2),b=L(y,!0);j(y),j(g);var x=z(g,2),S=e=>{var t=O_();si(t,()=>V(n).resultHtml,!0),j(t),W(e,t)};K(x,e=>{V(n).resultHtml&&e(S)}),j(d),j(r),B((e,r)=>{G(a,V(t).name),G(m,e),Ai(h,V(n).argsJson),G(v,V(n).error),y.disabled=V(n).running,G(b,r)},[()=>Y(`context.mcp_request_json`),()=>Y(`context.mcp_get_prompt`)]),H(`input`,h,e=>f(`prompt`,V(t).name,{argsJson:e.target.value})),H(`click`,y,()=>ee(`prompt`,V(t).name)),W(e,r)}),W(e,t)};return K(Ze,e=>{V(s).length?e($e,-1):e(Qe)}),j(Xe),j(ze),j(A),B((e,t,l,u,d,f,p,m,h,g)=>{G(ae,e),G(se,t),G(le,l),G(pe,u),vi(me,1,fi(V(r)?`mcp-info-value ok`:`mcp-info-value err`),`svelte-1ui2b6s`),G(he,V(n)),G(ve,d),G(be,V(i)),G(Ce,f),G(Te,V(a)),G(ke,p),G(Me,V(o).length),Ne.disabled=V(c)||!V(o).length,G(Pe,m),G(He,h),G(Ge,V(s).length),Ke.disabled=V(c)||!V(s).length,G(Ye,g)},[()=>Y(`context.mcp_title`),()=>Y(`context.mcp_refresh`),()=>Y(`context.mcp_intro`),()=>Y(`context.mcp_status`),()=>Y(`context.mcp_transport`),()=>Y(`context.mcp_endpoint`),()=>Y(`context.mcp_tools`),()=>Y(`context.mcp_run_all_tools`),()=>Y(`context.mcp_prompts`),()=>Y(`context.mcp_get_all_prompts`)]),H(`click`,oe,ne),H(`click`,Ne,()=>te(`tool`)),H(`click`,Ke,()=>te(`prompt`)),W(e,A),Je(k)}Pr([`click`,`input`]);var F_=U(`<p class="status-text svelte-rpj1e5"> </p>`),I_=U(`<div class="app-shell"><!> <main class="context-scroll svelte-rpj1e5"><div class="context-inner svelte-rpj1e5"><section class="page-intro svelte-rpj1e5"><h2 class="page-title svelte-rpj1e5"> </h2> <p class="page-desc svelte-rpj1e5"> </p> <!></section> <!> <!> <!></div></main></div> <!>`,1);function L_(e,t){qe(t,!0);let n=P(``),r=P(I([])),i=P(I([])),a=P(``),o=P(null),s=P(null),c=P(null);function l(e){F(n,e,!0)}async function u(){l(Y(`context.loading`));let e=await fetch(`/api/context/orientation`);if(!e.ok)throw Error(await e.text());let t=await e.json();F(o,t,!0),F(r,t.instructions||[],!0),F(i,t.rules||[],!0),F(a,t.rulesFolder||``,!0),l(``)}async function d(e){l(Y(`context.adding_instruction_file`));let t=await fetch(`/api/context/instructions`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})});if(!t.ok)throw Error(await t.text());await u()}async function f(e){if(!await V(s).show({kicker:Y(`context.remove_instruction_title`),title:Y(`context.remove_instruction_title`),message:Y(`context.remove_instruction_message`).replace(`{name}`,e),confirmLabel:Y(`common.remove`),cancelLabel:Y(`common.cancel`)||`Cancel`,danger:!0}))return;l(Y(`context.removing_instruction_file`));let t=await fetch(`/api/context/instructions/`+encodeURIComponent(e),{method:`DELETE`});if(!t.ok)throw Error(await t.text());await u()}async function p(e){l(Y(`context.saving_rule`));let t=await fetch(`/api/context/rules`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());await u()}Ji(async()=>{try{let e=await fetch(`/api/config`);await Ca((e.ok?await e.json():{}).language||`en`)}catch{await Ca(`en`)}document.title=Y(`context.title`),await u().catch(e=>l(e.message)),await V(c).load().catch(()=>{})});var m=I_(),h=R(m),g=L(h);es(g,{get navigate(){return t.navigate}});var _=z(g,2),v=L(_),y=L(v),b=L(y),x=L(b,!0);j(b);var S=z(b,2),C=L(S,!0);j(S);var w=z(S,2),T=e=>{var t=F_(),r=L(t,!0);j(t),B(()=>G(r,V(n))),W(e,t)};K(w,e=>{V(n)&&e(T)}),j(y);var E=z(y,2);g_(E,{onAdd:d,onRemove:f,get items(){return V(r)},set items(e){F(r,e,!0)}});var D=z(E,2);w_(D,{get rules(){return V(i)},get rulesFolder(){return V(a)},onAdd:p}),Ui(P_(z(D,2),{onStatus:l}),e=>F(c,e,!0),()=>V(c)),j(v),j(_),j(h),Ui($d(z(h,2),{}),e=>F(s,e,!0),()=>V(s)),B((e,t)=>{G(x,e),G(C,t)},[()=>Y(`context.orientation_title`),()=>Y(`context.orientation_intro`)]),W(e,m),Je()}async function R_(){return fetch(`/api/config`).then(e=>e.json())}async function z_(){return fetch(`/api/documents`).then(e=>e.json())}async function B_(){return fetch(`/api/tree`).then(e=>e.json())}async function V_(e,t){return(await fetch(`/api/tree/hidden`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e,hidden:t})})).ok}async function H_(e){let t=await fetch(`/api/tree/move`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)return{ok:!1,status:t.status};let{path:n}=await t.json();return{ok:!0,path:n}}async function U_(e,t){let n=await fetch(`/api/tree/rename`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e,newName:t})});if(!n.ok)return{ok:!1,status:n.status};let{path:r}=await n.json();return{ok:!0,path:r}}async function W_(e){return fetch(`/api/browse/alldirs?path=${encodeURIComponent(e)}`).then(e=>e.json())}async function G_(e){let t=await fetch(`/api/documents/${e}`);if(!t.ok)throw Error(t.statusText);return t.json()}async function K_(){try{let e=await fetch(`/api/annotations`).then(e=>e.json()),t={};for(let[n,r]of Object.entries(e||{})){t[n]=r;try{t[encodeURIComponent(n)]=r}catch{}}return t}catch{return{}}}async function q_(){try{return await fetch(`/api/documents/file-counts`).then(e=>e.json())}catch{return{}}}async function J_(){try{return await fetch(`/api/documents/statuses`).then(e=>e.json())}catch{return{}}}async function Y_(e){return fetch(`/api/documents/search?q=${encodeURIComponent(e)}`).then(e=>e.json())}function X_(e){return e.replace(/^\d+_/,``).replace(/[_-]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function Z_(e,t){let n=[];for(let r of e)if(r.kind===`doc`)r.id&&t.has(r.id)&&n.push(r);else{let e=Z_(r.children??[],t);e.length&&n.push({...r,children:e})}return n}function Q_(e){return e.filter(e=>!e.hidden&&!e.reserved).map(e=>e.kind===`folder`?{...e,children:Q_(e.children??[])}:e)}var $_=new Set([`files`,`images`]);function ev(e){return e.hidden||e.reserved?!1:!(e.kind===`folder`&&$_.has(e.path))}function tv(e,t=()=>!0){return e.kind===`doc`?e.id&&!e.reserved&&t(e.id)?1:0:(e.children??[]).reduce((e,n)=>e+tv(n,t),0)}var nv=.25;function rv(e,t,n){let r=n>0?t/n:0;return e===`doc`?r<.5?`before`:`after`:r<nv?`before`:r>1-nv?`after`:`inside`}function iv(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function av(e,t){return ov(e,t).filter(e=>!e.reserved)}function ov(e,t){if(!t)return e;for(let n of e)if(n.kind===`folder`){if(n.path===t)return n.children??[];if(t.startsWith(`${n.path}/`))return ov(n.children??[],t)}return[]}function sv(e,t,n,r){if(t===n)return null;let i=r===`inside`?n:iv(n),a=av(e,i).filter(e=>e.path!==t),o=a.length;if(r!==`inside`){let e=a.findIndex(e=>e.path===n);if(e===-1)return null;o=r===`before`?e:e+1}return i===iv(t)&&av(e,i).findIndex(e=>e.path===t)===o?null:{source:t,targetFolder:i,index:o}}function cv(e,t,n){let r=`${decodeURIComponent(e)}.md`;return r===t?encodeURIComponent(n.slice(0,-3)):r.startsWith(`${t}/`)?encodeURIComponent(`${n}${r.slice(t.length)}`.slice(0,-3)):null}var lv=U(`<button data-reserved="true"><span class="truncate"><i class="fa-solid fa-lock text-[10px] mr-1.5"></i> </span></button>`),uv=U(`<span class="inline-flex items-center justify-center w-5 h-5 rounded-full bg-green-500 text-[10px] font-bold text-white border border-green-600 shadow-sm">V</span>`),dv=U(`<span class="inline-flex items-center justify-center w-5 h-5 rounded-full bg-orange-500 text-[10px] font-bold text-white border border-orange-600 shadow-sm">S</span>`),fv=U(`<span class="inline-flex items-center justify-center min-w-[1.25rem] h-5 px-1.5 rounded-full bg-yellow-300 dark:bg-yellow-400 text-[10px] font-bold text-yellow-900 border border-yellow-500 shadow-sm"> </span>`),pv=U(`<span class="inline-flex items-center justify-center min-w-[1.25rem] h-5 px-1.5 rounded-full bg-sky-200 dark:bg-sky-300 text-[10px] font-bold text-sky-900 border border-sky-500 shadow-sm"> </span>`),mv=U(`<div class="text-xs text-gray-400 dark:text-gray-500 mt-0.5"> </div>`),hv=U(`<button><div class="leading-snug flex items-center justify-between gap-2"><span class="truncate"> </span> <span class="flex items-center gap-1 shrink-0"><!> <!> <!></span></div> <!></button>`),gv=U(`<span class="inline-flex items-center justify-center min-w-[1.25rem] h-5 px-1.5 rounded-full bg-orange-400 dark:bg-orange-500 text-[10px] font-bold text-white border border-orange-600 shadow-sm"> </span>`),_v=U(`<span class="inline-flex items-center justify-center min-w-[1.25rem] h-5 px-1.5 rounded-full bg-slate-400 dark:bg-slate-500 text-[10px] font-bold text-white border border-slate-600 shadow-sm"> </span>`),vv=U(`<div class="pl-3"><!></div>`),yv=U(`<div class="mb-1"><button><span class="flex items-center gap-2 min-w-0"><span class="truncate"> </span> <!> <!></span> <span class="flex items-center gap-1.5"><span class="font-normal normal-case text-gray-400"> </span> <span>▸</span></span></button> <!></div>`);function bv(e,t){qe(t,!0);let n=(e,n=f,r=f)=>{let i=N(()=>X.annotationCounts[n().id]||0),d=N(()=>X.fileAttachmentCounts[n().id]||0),m=N(()=>p(n()));var h=Wr(),g=R(h),_=e=>{var i=lv(),a=L(i),o=z(L(a),1,!0);j(a),j(i),B(()=>{J(i,`id`,`item-${n().id??``}`),vi(i,1,`opacity-50 italic doc-item w-full text-left px-3 py-1.5 rounded-md text-sm transition-colors text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800/60 ${n().id===X.currentDocId?`active`:``}`),G(o,r().name)}),H(`click`,i,()=>t.onopen(n().id)),H(`contextmenu`,i,e=>e.preventDefault()),W(e,i)},v=e=>{var f=hv(),p=L(f),h=L(p),g=L(h,!0);j(h);var _=z(h,2),v=L(_),y=e=>{var t=uv();B(e=>J(t,`title`,e),[()=>Y(`sidebar.status_to_validate`)]),W(e,t)},b=e=>{var t=dv();B(e=>J(t,`title`,e),[()=>Y(`sidebar.status_superseeded`)]),W(e,t)};K(v,e=>{V(m)===`V`?e(y):V(m)===`S`&&e(b,1)});var x=z(v,2),S=e=>{var t=fv(),n=L(t,!0);j(t),B(e=>{J(t,`title`,e),G(n,V(i))},[()=>u(V(i),`sidebar.annotation_badge`)]),W(e,t)};K(x,e=>{V(i)>0&&!X.markerHidden&&e(S)});var C=z(x,2),w=e=>{var t=pv(),n=L(t,!0);j(t),B(e=>{J(t,`title`,e),G(n,V(d))},[()=>u(V(d),`sidebar.file_attachment_badge`)]),W(e,t)};K(C,e=>{V(d)>0&&!X.hideAttachments&&e(w)}),j(_),j(p);var T=z(p,2),E=e=>{var t=mv(),r=L(t,!0);j(t),B(()=>G(r,n().formattedDate)),W(e,t)};K(T,e=>{n().formattedDate&&e(E)}),j(f),B(e=>{J(f,`id`,`item-${n().id??``}`),J(f,`draggable`,V(a)),J(f,`data-drop`,e),J(f,`data-hidden`,r().hidden?`true`:void 0),vi(f,1,`${r().hidden?`opacity-50 italic`:``} doc-item w-full text-left px-3 py-1.5 rounded-md text-sm transition-colors text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800/60 ${n().id===X.currentDocId?`active`:``}`),G(g,n().title)},[()=>o(r())]),H(`click`,f,()=>t.onopen(n().id)),H(`contextmenu`,f,e=>t.onentrymenu(e,r())),Nr(`dragstart`,f,e=>s(e,r())),Nr(`dragover`,f,e=>c(e,r())),Nr(`drop`,f,e=>l(e,r())),Nr(`dragend`,f,()=>X.endDrag()),W(e,f)};K(g,e=>{r().reserved?e(_):e(v,-1)}),W(e,h)},r=(e,n=f)=>{let r=N(()=>i(n().name)),d=N(()=>X.expandedFolders.has(V(r))),p=N(()=>tv(n())),m=N(()=>tv(n(),e=>X.annotationCounts[e]>0)),h=N(()=>tv(n(),e=>X.fileAttachmentCounts[e]>0));var g=yv(),_=L(g),v=L(_),y=L(v),b=L(y);j(y);var x=z(y,2),S=e=>{var t=gv(),n=L(t,!0);j(t),B(e=>{J(t,`title`,e),G(n,V(m))},[()=>u(V(m),`sidebar.annotated_docs_badge`)]),W(e,t)};K(x,e=>{V(m)>0&&!X.markerHidden&&e(S)});var C=z(x,2),w=e=>{var t=_v(),n=L(t,!0);j(t),B(e=>{J(t,`title`,e),G(n,V(h))},[()=>u(V(h),`sidebar.file_attached_docs_badge`)]),W(e,t)};K(C,e=>{V(h)>0&&!X.hideAttachments&&e(w)}),j(v);var T=z(v,2),E=L(T),D=L(E,!0);j(E);var ee=z(E,2);j(T),j(_);var te=z(_,2),O=e=>{var r=vv(),i=L(r);{let e=N(()=>n().children??[]),r=N(()=>[...t.folderPath,n().name]);bv(i,{get nodes(){return V(e)},get folderPath(){return V(r)},get onopen(){return t.onopen},get onentrymenu(){return t.onentrymenu},get onmove(){return t.onmove}})}j(r),W(e,r)};K(te,e=>{V(d)&&e(O)}),j(g),B((e,t)=>{J(_,`draggable`,V(a)),J(_,`data-drop`,e),J(_,`data-hidden`,n().hidden?`true`:void 0),vi(_,1,`${n().hidden?`opacity-50 italic`:``} w-full flex items-center justify-between px-3 py-1.5 text-xs font-semibold text-violet-600 dark:text-violet-400 uppercase tracking-wider hover:bg-gray-50 dark:hover:bg-gray-800/60 rounded-md transition-colors`),J(y,`title`,n().name),G(b,`📁 ${t??``}`),G(D,V(p)),vi(ee,1,`transition-transform duration-200 ${V(d)?`rotate-90`:``}`)},[()=>o(n()),()=>X_(n().name)]),H(`click`,_,()=>X.toggleFolder(V(r))),H(`contextmenu`,_,e=>t.onentrymenu(e,n())),Nr(`dragstart`,_,e=>s(e,n())),Nr(`dragover`,_,e=>c(e,n())),Nr(`drop`,_,e=>l(e,n())),Nr(`dragend`,_,()=>X.endDrag()),W(e,g)};function i(e){return[...t.folderPath,e].join(`|`)}let a=N(()=>!X.searchQuery);function o(e){return X.dropTarget?.path===e.path?X.dropTarget.position:void 0}function s(e,t){X.dragSourcePath=t.path,e.dataTransfer&&(e.dataTransfer.effectAllowed=`move`,e.dataTransfer.setData(`text/plain`,t.path))}function c(e,t){if(!X.dragSourcePath||!V(a))return;e.preventDefault(),e.stopPropagation();let n=e.currentTarget.getBoundingClientRect(),r=rv(t.kind,e.clientY-n.top,n.height);X.setDropTarget(t.path,r,t.kind===`folder`?i(t.name):null)}function l(e,n){e.preventDefault(),e.stopPropagation();let r=X.dragSourcePath,i=o(n);X.endDrag(),r&&i&&t.onmove(r,n.path,i)}function u(e,t){return`${e} ${Y(t)}${e>1?`s`:``}`}function d(e){let t=e.id??``;return X.docsById.get(t)??{id:t,title:e.name.replace(/\.md$/i,``)}}function p(e){if(!X.highlightStatusState)return null;let t=String(X.docStatuses[e.id]||``).trim().toLowerCase();return t===`to be validated`?`V`:X.highlightStatusState===2&&t===`superseeded`?`S`:null}var m=Wr();q(R(m),17,()=>t.nodes,e=>e.path,(e,t)=>{var i=Wr(),a=R(i),o=e=>{r(e,()=>V(t))},s=e=>{{let r=N(()=>d(V(t)));n(e,()=>V(r),()=>V(t))}};K(a,e=>{V(t).kind===`folder`?e(o):e(s,-1)}),W(e,i)}),W(e,m),Je()}Pr([`click`,`contextmenu`]);var xv=U(`<p data-testid="rename-entry-error" class="text-xs text-red-500"> </p>`),Sv=U(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50"><div class="bg-white dark:bg-gray-900 rounded-xl shadow-xl w-full max-w-md mx-4 p-6 space-y-4"><h3 class="text-base font-semibold text-gray-900 dark:text-gray-50"><i class="fa-solid fa-pen mr-1"></i> <span> </span></h3> <div class="space-y-1.5"><label for="rename-entry-name" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="rename-entry-name" data-testid="rename-entry-input" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/> <p class="text-xs text-gray-400 dark:text-gray-500"> </p></div> <!> <div class="flex justify-end gap-3 pt-1"><button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button data-testid="rename-entry-submit" class="text-sm px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div></div></div>`);function Cv(e,t){qe(t,!0);let n=P(``),r=P(``),i=P(!1),a=P(null);kn(()=>{t.node&&(F(n,t.node.kind===`doc`?t.node.name.replace(/\.md$/i,``):t.node.name,!0),F(r,``),F(i,!1),queueMicrotask(()=>V(a)?.select()))});async function o(){if(!t.node||V(i))return;if(!V(n).trim()){F(r,Y(`modal.rename_entry.invalid`),!0);return}F(i,!0);let e=await U_(t.node.path,V(n));if(F(i,!1),e.ok)return t.onrenamed(t.node.path,e.path);F(r,Y(e.status===409?`modal.rename_entry.conflict`:e.status===400?`modal.rename_entry.invalid`:`modal.rename_entry.failed`),!0)}function s(e){e.key===`Enter`?(e.preventDefault(),o()):e.key===`Escape`&&(e.preventDefault(),t.onclose())}var c=Wr(),l=R(c),u=e=>{var c=Sv(),l=L(c),u=L(l),d=z(L(u),2),f=L(d,!0);j(d),j(u);var p=z(u,2),m=L(p),h=L(m,!0);j(m);var g=z(m,2);ki(g),Ui(g,e=>F(a,e),()=>V(a));var _=z(g,2),v=L(_,!0);j(_),j(p);var y=z(p,2),b=e=>{var t=xv(),n=L(t,!0);j(t),B(()=>G(n,V(r))),W(e,t)};K(y,e=>{V(r)&&e(b)});var x=z(y,2),S=L(x),C=L(S,!0);j(S);var w=z(S,2),T=L(w,!0);j(w),j(x),j(l),j(c),B((e,t,n,r,a)=>{G(f,e),G(h,t),G(v,n),G(C,r),w.disabled=V(i),G(T,a)},[()=>Y(t.node.kind===`folder`?`modal.rename_entry.title_folder`:`modal.rename_entry.title_doc`),()=>Y(`modal.rename_entry.name_label`),()=>Y(`modal.rename_entry.links_hint`),()=>Y(`common.cancel`),()=>V(i)?Y(`modal.rename_entry.saving_btn`):Y(`modal.rename_entry.submit_btn`)]),H(`click`,c,e=>{e.target===e.currentTarget&&t.onclose()}),H(`input`,g,()=>F(r,``)),H(`keydown`,g,s),Fi(g,()=>V(n),e=>F(n,e)),H(`click`,S,function(...e){t.onclose?.apply(this,e)}),H(`click`,w,o),W(e,c)};K(l,e=>{t.node&&e(u)}),W(e,c),Je()}Pr([`click`,`input`,`keydown`]);var wv=U(`<p class="px-4 py-8 text-sm text-gray-400 text-center"> </p>`),Tv=U(`<button role="menuitem" data-testid="tree-menu-rename" class="w-full text-left px-3 py-1.5 text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700"><i class="fa-solid fa-pen mr-2"></i> </button>`),Ev=U(`<div class="fixed inset-0 z-40"></div> <div role="menu" class="fixed z-50 min-w-[8rem] py-1 rounded-md border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-800 shadow-lg text-sm"><button role="menuitem" data-testid="tree-menu-toggle-hidden" class="w-full text-left px-3 py-1.5 text-gray-700 dark:text-gray-200 hover:bg-gray-100 dark:hover:bg-gray-700"><i></i> </button> <!></div>`,1),Dv=U(`<aside><div class="sticky top-0 z-10 bg-white dark:bg-gray-900 p-3 border-b border-gray-100 dark:border-gray-800"><div class="relative sm:hidden"><input type="search" class="w-full pl-8 pr-3 py-1.5 text-sm rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500"/> <span class="absolute left-2.5 top-2 text-gray-400 text-sm pointer-events-none">🔍</span></div> <div class="flex items-center justify-between mt-2 sm:mt-0"><p class="text-xs text-gray-400 dark:text-gray-500"> </p> <div class="flex items-center gap-2"><button><i class="fa-solid fa-certificate"></i></button> <button><i class="fa-solid fa-paperclip"></i></button> <button data-testid="toggle-show-hidden"><i></i></button> <button class="text-gray-400 hover:text-blue-500 dark:text-gray-500 dark:hover:text-blue-400 transition-colors leading-none"><i class="fa-solid fa-file-export"></i></button> <button class="text-gray-400 hover:text-blue-500 dark:text-gray-500 dark:hover:text-blue-400 transition-colors leading-none"><i class="fa-solid fa-folder-plus"></i></button> <button class="text-gray-400 hover:text-blue-500 dark:text-gray-500 dark:hover:text-blue-400 transition-colors leading-none"><i class="fa-solid fa-file-circle-plus"></i></button></div></div></div> <nav data-testid="category-tree" class="flex-1 py-2 space-y-0.5"><!></nav> <!> <!> <div aria-hidden="true"></div></aside>`);function Ov(e,t){qe(t,!0);let n=N(()=>X.showHiddenEntries?X.explorerTree:Q_(X.explorerTree)),r=N(()=>X.searchQuery?Z_(V(n),new Set(X.filteredDocs.map(e=>e.id))):V(n)),i=P(null);function a(e,t){e.preventDefault(),F(i,{x:e.clientX,y:e.clientY,node:t},!0)}async function o(){if(!V(i))return;let{node:e}=V(i);F(i,null),await V_(e.path,!e.hidden)&&(X.explorerTree=await B_())}let s=P(null);function c(){F(s,V(i)?.node??null,!0),F(i,null)}function l(e,n){F(s,null),t.onmoved(e,n)}async function u(e,n,r){let i=sv(X.explorerTree,e,n,r);if(!i)return;let a=await H_(i);if(a.ok)return t.onmoved(e,a.path);let o=e.split(`/`).pop()??e;wo(Y(a.status===409?`sidebar.move_conflict`:`sidebar.move_failed`,{name:o}),`error`),X.explorerTree=await B_()}let d=N(()=>X.filteredDocs.length),f=N(()=>V(r).length===0),p=`ld-sidebar-w`,m=P(null),h=P(!1),g=P(null);kn(()=>{let e=parseInt(localStorage.getItem(p)||``,10);Number.isFinite(e)&&F(m,Math.max(200,Math.min(600,e)),!0)});function _(e){e.preventDefault();let t=e.clientX,n=V(g).getBoundingClientRect().width;F(h,!0),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let r=e=>{F(m,Math.max(200,Math.min(600,n+e.clientX-t)),!0)},i=()=>{if(document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i),document.body.style.cursor=``,document.body.style.userSelect=``,F(h,!1),V(m)!=null)try{localStorage.setItem(p,String(V(m)))}catch{}};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)}var v=Dv(),y=L(v),b=L(y),x=L(b);ki(x),Ie(2),j(b);var S=z(b,2),C=L(S),w=L(C);j(C);var T=z(C,2),E=L(T),D=z(E,2),ee=z(D,2),te=L(ee);j(ee);var O=z(ee,2),ne=z(O,2),k=z(ne,2);j(T),j(S),j(y);var A=z(y,2),re=L(A),ie=e=>{var t=wv(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`sidebar.no_docs`)]),W(e,t)},ae=e=>{bv(e,{get nodes(){return V(r)},folderPath:[],get onopen(){return t.onopen},onentrymenu:a,onmove:u})};K(re,e=>{V(f)?e(ie):e(ae,-1)}),j(A);var oe=z(A,2),se=e=>{var t=Ev(),n=R(t),r=z(n,2),a=L(r),s=L(a),l=z(s,1,!0);j(a);var u=z(a,2),d=e=>{var t=Tv(),n=z(L(t),1,!0);j(t),B(e=>G(n,e),[()=>Y(`sidebar.rename_entry`)]),H(`click`,t,c),W(e,t)},f=N(()=>ev(V(i).node));K(u,e=>{V(f)&&e(d)}),j(r),B(e=>{bi(r,`left:${V(i).x??``}px; top:${V(i).y??``}px`),vi(s,1,`fa-solid ${V(i).node.hidden?`fa-eye`:`fa-eye-slash`} mr-2`),G(l,e)},[()=>Y(V(i).node.hidden?`sidebar.show_entry`:`sidebar.hide_entry`)]),H(`click`,n,()=>F(i,null)),H(`contextmenu`,n,e=>{e.preventDefault(),F(i,null)}),H(`click`,a,o),W(e,t)};K(oe,e=>{V(i)&&e(se)});var ce=z(oe,2);Cv(ce,{get node(){return V(s)},onclose:()=>F(s,null),onrenamed:l});var le=z(ce,2);j(v),Ui(v,e=>F(g,e),()=>V(g)),B((e,t,n,r,i,a,o)=>{vi(v,1,`no-print ${V(m)==null?`w-72`:``} shrink-0 flex flex-col border-r border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 overflow-y-auto relative`),bi(v,V(m)==null?``:`width:${V(m)}px`),J(x,`placeholder`,e),Ai(x,X.searchQuery),G(w,`${V(d)??``} document${V(d)===1?``:`s`}`),J(E,`title`,t),vi(E,1,`hover:opacity-80 transition-colors leading-none ${X.highlightStatusState===0?`text-gray-400 dark:text-gray-500`:X.highlightStatusState===1?`text-green-500 dark:text-green-400`:`text-orange-500 dark:text-orange-400`}`),J(D,`title`,n),vi(D,1,`transition-colors leading-none ${X.hideAttachments?`text-gray-400 dark:text-gray-500`:`text-blue-500 dark:text-blue-400`}`),J(ee,`title`,r),vi(ee,1,`transition-colors leading-none ${X.showHiddenEntries?`text-blue-500 dark:text-blue-400`:`text-gray-400 dark:text-gray-500`}`),vi(te,1,`fa-solid ${X.showHiddenEntries?`fa-eye`:`fa-eye-slash`}`),J(O,`title`,i),J(ne,`title`,a),J(k,`title`,o),vi(le,1,`absolute top-0 right-[-2px] w-1.5 h-full cursor-col-resize z-20 select-none transition-colors ${V(h)?`bg-blue-500/55`:`hover:bg-blue-500/35`}`)},[()=>Y(`nav.search_mobile_placeholder`),()=>Y(`nav.toggle_status_highlight`),()=>Y(`nav.toggle_attachments`),()=>Y(`nav.toggle_hidden_entries`),()=>Y(`nav.export`),()=>Y(`nav.new_folder`),()=>Y(`nav.new_document`)]),H(`input`,x,e=>t.onsearch(e.target.value)),H(`click`,E,()=>X.cycleHighlightStatus()),H(`click`,D,()=>X.toggleHideAttachments()),H(`click`,ee,()=>X.toggleShowHiddenEntries()),H(`click`,O,function(...e){t.onexport?.apply(this,e)}),H(`click`,ne,function(...e){t.onnewfolder?.apply(this,e)}),H(`click`,k,function(...e){t.onnewdoc?.apply(this,e)}),H(`mousedown`,le,_),W(e,v),Je()}Pr([`input`,`click`,`contextmenu`,`mousedown`]);var kv=`background:rgba(250,204,21,0.5);border-radius:2px;cursor:pointer;padding:0 1px;`;function Av(e,t,n){e.querySelectorAll(`mark[data-annotation-id]`).forEach(e=>{let t=e.parentNode;t&&(t.replaceChild(document.createTextNode(e.textContent||``),e),t.normalize())});for(let n of t)Mv(e,n);e.querySelectorAll(`mark[data-annotation-id]`).forEach(e=>{(e.textContent||``).trim()||e.remove()}),n&&jv(e,!1)}function jv(e,t){e.querySelectorAll(`mark[data-annotation-id]`).forEach(e=>{let n=e;n.style.background=t?`rgba(250,204,21,0.5)`:`transparent`,n.style.cursor=t?`pointer`:`default`,n.style.pointerEvents=t?`auto`:`none`})}function Mv(e,t){let n=(t.selectedText||``).replace(/\s+/g,` `).trim(),r=(t.contextBefore||``).replace(/\s+/g,` `).trim(),i=(t.contextAfter||``).replace(/\s+/g,` `).trim();if(!n)return;let a=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),o=e=>e.split(/\s+/).filter(Boolean).map(a).join(`\\s+`),s=e.textContent||``,c=o(n),l=null;if(r||i){let e=(r?`${o(r)}\\s*`:``)+`(`+c+`)`+(i?`\\s*${o(i)}`:``);try{l=new RegExp(e,`d`).exec(s)}catch{}}if(!l)try{l=RegExp(`(${c})`,`d`).exec(s)}catch{return}let u=l&&l.indices;if(!l||!u?.[1])return;let[d,f]=u[1],p=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),m=[],h=0;for(;p.nextNode();){let e=p.currentNode,t=e.nodeValue?.length,n=h,r=h+t;if(h=r,r<=d)continue;if(n>=f)break;let i=Math.max(0,d-n),a=Math.min(t,f-n);i<a&&m.push({node:e,start:i,end:a})}for(let{node:e,start:n,end:r}of m){let i=e;n>0&&n<i.nodeValue?.length&&(i=i.splitText(n));let a=r-n;a>0&&a<i.nodeValue?.length&&i.splitText(a);let o=document.createElement(`mark`);o.setAttribute(`data-annotation-id`,t.id),o.setAttribute(`style`,kv),i.parentNode?.insertBefore(o,i),o.appendChild(i)}}var Nv=U(`<div class="fixed z-50 w-80 bg-yellow-50 dark:bg-yellow-900/80 border-2 border-yellow-300 dark:border-yellow-600 rounded-xl shadow-2xl p-4 flex flex-col gap-3"><div class="text-xs font-semibold text-yellow-700 dark:text-yellow-300 flex items-center gap-2"><span>✎</span><span> </span></div> <div class="text-xs text-yellow-800 dark:text-yellow-200 bg-yellow-100 dark:bg-yellow-800/50 rounded px-2 py-1 italic max-h-16 overflow-y-auto border border-yellow-200 dark:border-yellow-700"> </div> <textarea rows="4" class="w-full text-sm rounded-lg border border-yellow-300 dark:border-yellow-600 bg-white dark:bg-yellow-950 text-gray-900 dark:text-gray-100 px-3 py-2 focus:outline-none focus:ring-2 focus:ring-yellow-400 resize-none"></textarea> <div class="flex justify-end gap-2"><button class="text-sm px-3 py-1.5 rounded-lg border border-yellow-300 dark:border-yellow-600 text-yellow-700 dark:text-yellow-300 hover:bg-yellow-100 dark:hover:bg-yellow-800 transition-colors"> </button> <button class="text-sm px-4 py-1.5 rounded-lg bg-yellow-400 hover:bg-yellow-500 dark:bg-yellow-600 dark:hover:bg-yellow-500 text-yellow-900 dark:text-white font-semibold transition-colors"> </button></div></div>`),Pv=U(`<div class="text-xs font-semibold text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-700 rounded px-2 py-1"> </div>`),Fv=U(`<div class="fixed z-50 w-80 bg-yellow-50 dark:bg-yellow-900/80 border-2 border-yellow-300 dark:border-yellow-600 rounded-xl shadow-2xl p-4 flex flex-col gap-2"><div class="text-xs font-semibold text-yellow-700 dark:text-yellow-300 flex items-center gap-2"><span>✎</span><span class="font-normal text-yellow-600 dark:text-yellow-400"> </span></div> <!> <div class="text-sm text-gray-800 dark:text-gray-100 whitespace-pre-wrap max-h-48 overflow-y-auto"> </div> <div class="flex justify-end pt-1 border-t border-yellow-200 dark:border-yellow-700"><button class="text-xs px-3 py-1.5 rounded-lg border border-red-200 dark:border-red-700 text-red-500 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/40 transition-colors flex items-center gap-1"> </button></div></div>`),Iv=U(`<div class="fixed z-50 w-72 bg-white dark:bg-gray-900 border border-red-200 dark:border-red-700 rounded-xl shadow-2xl p-4 flex flex-col gap-3"><p class="text-sm text-gray-700 dark:text-gray-200"> </p> <div class="flex justify-end gap-2"><button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-1.5 rounded-lg bg-red-500 hover:bg-red-600 text-white font-semibold transition-colors"> </button></div></div>`),Lv=U(`<button> </button>`),Rv=U(`<div class="fixed top-14 right-0 w-10 flex flex-col items-center py-2 gap-2 z-40 overflow-y-auto" style="max-height: calc(100vh - 3.5rem)"></div>`),zv=U(`<!> <!> <!> <!>`,1);function Bv(e,t){qe(t,!0);let n=P(I([])),r=P(null),i=P(``),a=P(null),o=P(null),s=P(I([])),c=null;Ji(()=>{let e=document.getElementById(`home-content-area`);if(!e)return;let t=()=>{c&&clearTimeout(c),F(a,null)};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)});function l(e,t,n=320,r=260){let i=window.innerWidth,a=window.innerHeight,o=e;return o+n>i-16&&(o=i-n-16),o<8&&(o=8),{x:o,y:Math.min(t,a-r)}}async function u(e){F(n,[],!0);try{F(n,await fetch(`/api/annotations/`+encodeURIComponent(e)).then(e=>e.json()),!0)}catch{F(n,[],!0)}d()}function d(){t.contentEl&&(Av(t.contentEl,V(n),X.markerHidden),f())}kn(()=>{t.contentEl&&jv(t.contentEl,!X.markerHidden)});function f(){if(!t.contentEl){F(s,[],!0);return}F(s,V(n).map(e=>({id:e.id,note:e.note.length>60?e.note.slice(0,60)+`…`:e.note,orphan:!t.contentEl.querySelector(`mark[data-annotation-id="${e.id}"]`)})),!0)}function p(){if(!X.markerActive||V(r)||!t.contentEl)return;let e=window.getSelection();if(!e||e.isCollapsed||!e.toString().trim()||!t.contentEl.contains(e.anchorNode))return;let n=e.getRangeAt(0),a=document.createRange();a.selectNodeContents(t.contentEl),a.setEnd(n.startContainer,n.startOffset);let o=a.toString().length,s=n.toString(),c=t.contentEl.textContent||``,u=e=>e.replace(/\s+/g,` `).trim(),d=u(s),f=u(c.slice(Math.max(0,o-30),o)),p=u(c.slice(o+s.length,o+s.length+30)),m=n.getBoundingClientRect(),h=l(m.left,m.bottom+8);F(r,{x:h.x,y:h.y,preview:d.length>120?d.slice(0,120)+`…`:d,selectedText:d,contextBefore:f,contextAfter:p},!0),F(i,``)}function m(){F(r,null),window.getSelection()?.removeAllRanges()}async function h(){if(!V(r)||!t.docId)return;let e=V(i).trim();if(e)try{let i=await fetch(`/api/annotations/`+encodeURIComponent(t.docId),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({selectedText:V(r).selectedText,contextBefore:V(r).contextBefore,contextAfter:V(r).contextAfter,note:e})}).then(e=>e.json());F(n,[...V(n),i],!0),m(),d(),X.annotationCounts={...X.annotationCounts,[t.docId]:(X.annotationCounts[t.docId]||0)+1}}catch{}}kn(()=>{if(!t.contentEl)return;let e=t.contentEl,r=e=>{let t=e.target.closest(`mark[data-annotation-id]`);if(!t)return;let r=V(n).find(e=>e.id===t.dataset.annotationId);r&&g(r,t)},i=e=>{let t=e;t.target.closest(`mark[data-annotation-id]`)&&(t.relatedTarget&&t.relatedTarget.closest?.(`mark[data-annotation-id]`)||_())};return e.addEventListener(`mouseover`,r),e.addEventListener(`mouseout`,i),()=>{e.removeEventListener(`mouseover`,r),e.removeEventListener(`mouseout`,i)}});function g(e,n){c&&clearTimeout(c);let r=!t.contentEl?.querySelector(`mark[data-annotation-id="${e.id}"]`),i=n.getBoundingClientRect(),o=l(i.left,i.bottom+8);F(a,{ann:e,x:o.x,y:o.y,orphan:r},!0)}function _(){c=window.setTimeout(()=>{F(a,null)},1500)}function v(){V(a)&&(F(o,{id:V(a).ann.id,x:V(a).x,y:V(a).y},!0),F(a,null))}async function y(){if(!V(o)||!t.docId)return;let e=V(o).id;try{await fetch(`/api/annotations/${encodeURIComponent(t.docId)}/${e}`,{method:`DELETE`}),F(n,V(n).filter(t=>t.id!==e),!0),F(o,null),d();let r=(X.annotationCounts[t.docId]||0)-1,i={...X.annotationCounts};r<=0?delete i[t.docId]:i[t.docId]=r,X.annotationCounts=i}catch{}}function b(e,t){return e.getBoundingClientRect().top+t.scrollTop-t.getBoundingClientRect().top}function x(e,t){let n=e.parentElement;for(;n&&n!==t;)n.tagName===`DETAILS`&&(n.open=!0),n=n.parentElement}function S(e,r){let i=t.contentEl?.querySelector(`mark[data-annotation-id="${e}"]`),o=document.getElementById(`home-content-area`);if(i&&o){if(V(a)?.ann.id===e){c&&clearTimeout(c);return}x(i,o),o.scrollTo({top:b(i,o)-o.clientHeight/2,behavior:`smooth`})}else{let t=V(n).find(t=>t.id===e);t&&g(t,r.currentTarget)}}function C(e,r){c&&clearTimeout(c);let i=V(n).find(t=>t.id===e);if(!i)return;let a=t.contentEl?.querySelector(`mark[data-annotation-id="${e}"]`),o=document.getElementById(`home-content-area`);if(!a||!o){g(i,r.currentTarget);return}x(a,o),o.scrollTo({top:b(a,o)-o.clientHeight/2,behavior:`smooth`});let s,l=()=>{clearTimeout(s),s=window.setTimeout(()=>{o.removeEventListener(`scroll`,l),g(i,a)},80)};o.addEventListener(`scroll`,l),s=window.setTimeout(()=>{o.removeEventListener(`scroll`,l),g(i,a)},600)}function w(e){let t=V(a)?.ann.id===e.id;return e.orphan?t?`#b91c1c`:`#ef4444`:t?`#f97316`:`#facc15`}function T(e){return new Date(e).toLocaleDateString(`fr-FR`,{day:`2-digit`,month:`short`,year:`numeric`})}var E={load:u,apply:d},D=zv();Nr(`mouseup`,on,p);var ee=R(D),te=e=>{var t=Nv(),n=L(t),a=z(L(n)),o=L(a,!0);j(a),j(n);var s=z(n,2),c=L(s,!0);j(s);var l=z(s,2);yn(l),vn(l,!0);var u=z(l,2),d=L(u),f=L(d,!0);j(d);var p=z(d,2),g=L(p,!0);j(p),j(u),j(t),B((e,n,i,a)=>{bi(t,`left:${V(r).x??``}px;top:${V(r).y??``}px`),G(o,e),G(c,V(r).preview),J(l,`placeholder`,n),G(f,i),G(g,a)},[()=>Y(`annotation.title`),()=>Y(`annotation.placeholder`),()=>Y(`common.cancel`),()=>Y(`annotation.save_btn`)]),Fi(l,()=>V(i),e=>F(i,e)),H(`click`,d,m),H(`click`,p,h),W(e,t)};K(ee,e=>{V(r)&&e(te)});var O=z(ee,2),ne=e=>{var t=Fv(),n=L(t),r=z(L(n)),i=L(r,!0);j(r),j(n);var o=z(n,2),s=e=>{var t=Pv(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`annotation.orphan`)]),W(e,t)};K(o,e=>{V(a).orphan&&e(s)});var l=z(o,2),u=L(l,!0);j(l);var d=z(l,2),f=L(d),p=L(f,!0);j(f),j(d),j(t),B((e,n)=>{bi(t,`left:${V(a).x??``}px;top:${V(a).y??``}px`),G(i,e),G(u,V(a).ann.note),G(p,n)},[()=>T(V(a).ann.createdAt),()=>Y(`annotation.delete_btn`)]),Nr(`mouseenter`,t,()=>{c&&clearTimeout(c)}),Nr(`mouseleave`,t,_),H(`click`,f,v),W(e,t)};K(O,e=>{V(a)&&e(ne)});var k=z(O,2),A=e=>{var t=Iv(),n=L(t),r=L(n,!0);j(n);var i=z(n,2),a=L(i),s=L(a,!0);j(a);var c=z(a,2),l=L(c,!0);j(c),j(i),j(t),B((e,n,i)=>{bi(t,`left:${V(o).x??``}px;top:${V(o).y??``}px`),G(r,e),G(s,n),G(l,i)},[()=>Y(`annotation.confirm_delete`),()=>Y(`common.cancel`),()=>Y(`annotation.confirm_btn`)]),H(`click`,a,()=>F(o,null)),H(`click`,c,y),W(e,t)};K(k,e=>{V(o)&&e(A)});var re=z(k,2),ie=e=>{var t=Rv();q(t,21,()=>V(s),e=>e.id,(e,t)=>{var n=Lv(),r=L(n,!0);j(n),B((e,i)=>{J(n,`title`,e),vi(n,1,`w-8 h-8 rounded border-2 shadow text-xs flex items-center justify-center transition-colors shrink-0 ${V(t).orphan?`border-red-600 text-white`:`border-yellow-500`}`),bi(n,`background:${i??``}`),G(r,V(t).orphan?`⚠`:`✎`)},[()=>V(t).orphan?`${Y(`annotation.orphan`)}\n\n${V(t).note}`:V(t).note,()=>w(V(t))]),H(`click`,n,e=>S(V(t).id,e)),Nr(`mouseenter`,n,e=>C(V(t).id,e)),Nr(`mouseleave`,n,_),W(e,n)}),j(t),W(e,t)};return K(re,e=>{V(s).length>0&&!X.markerHidden&&e(ie)}),W(e,D),Je(E)}Pr([`click`]);var Vv=`#dc2626`,Hv=`#eab308`,Uv=`#16a34a`;function Wv(e){let t=Math.max(0,Math.min(1,e))*100;return t>80?Uv:t>=60?Hv:t>=40?`#f97316`:Vv}function Gv(e){let t=Math.max(0,Math.min(1,e))*100;return t>=100?Uv:t<30?Vv:t<60?`linear-gradient(to right, ${Vv} 0%, ${Vv} 60%, ${Hv} 100%)`:t<80?`linear-gradient(to right, ${Vv} 0%, ${Hv} 40%, ${Hv} 100%)`:`linear-gradient(to right, ${Hv} 0%, ${Uv} 40%, ${Uv} 100%)`}var Kv=new class{#e=P(null);get report(){return V(this.#e)}set report(e){F(this.#e,e,!0)}async load(e){if(!e)return this.report=null,null;try{let t=await fetch(`/api/metadata/${encodeURIComponent(e)}`);if(!t.ok)throw Error(t.statusText);this.report=await t.json()}catch{this.report=null}return this.report}async refresh(e){let t=await fetch(`/api/metadata/${encodeURIComponent(e)}/refresh`,{method:`POST`});if(!t.ok)throw Error(t.statusText);this.report=await t.json()}async addPath(e,t){let n=await fetch(`/api/metadata/${encodeURIComponent(e)}`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error||n.statusText)}this.report=await n.json()}async removePath(e,t){let n=await fetch(`/api/metadata/${encodeURIComponent(e)}`,{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t})});if(!n.ok)throw Error(n.statusText);this.report=await n.json()}},qv=U(`<div data-testid="accuracy-gauge" class="no-print mt-5 flex items-center gap-3 mr-auto w-full sm:w-80 cursor-pointer select-none"><span class="text-xs text-gray-500 dark:text-gray-400 shrink-0"> </span> <div class="flex-1 h-4 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden"><div class="h-full w-full transition-all"></div></div> <span data-testid="accuracy-gauge-value" class="text-xs font-semibold shrink-0 tabular-nums"> </span></div>`);function Jv(e,t){qe(t,!0);let n=N(()=>Kv.report),r=N(()=>V(n)?Math.round(V(n).accuracy*100):0),i=N(()=>V(n)?Y(`accuracy.tooltip`).replace(`{unchanged}`,String(V(n).unchanged)).replace(`{modified}`,String(V(n).modified)).replace(`{missing}`,String(V(n).missing)).replace(`{total}`,String(V(n).total)):``);var a=Wr(),o=R(a),s=e=>{var a=qv(),o=L(a),s=L(o,!0);j(o);var c=z(o,2),l=L(c);j(c);var u=z(c,2),d=L(u);j(u),j(a),B((e,t,n)=>{J(a,`title`,V(i)),G(s,e),bi(l,`background:${t??``}`),bi(u,`color:${n??``}`),G(d,`${V(r)??``}%`)},[()=>Y(`accuracy.label`),()=>Gv(V(n).accuracy),()=>Wv(V(n).accuracy)]),H(`click`,a,function(...e){t.onopen?.apply(this,e)}),W(e,a)};K(o,e=>{V(n)&&V(n).total>0&&e(s)}),W(e,a),Je()}Pr([`click`]);var Yv=/^(\s*(?:\*\*status:\*\*|status:)\s*).+?\s*$/im;function Xv(e){if(typeof e!=`string`)return null;let t=e.match(/^---\s*\n([\s\S]*?)\n---/);if(!t)return null;let n=t[1].match(/^\s*(?:\*\*status:\*\*|status:)\s*(.+?)\s*$/im);return n?n[1].trim():null}function Zv(e,t){return e.replace(Yv,`$1${t}`)}function Qv(e){return/%5BWORKLOG%5D/i.test(e)}var $v=U(`<div data-testid="metadata-readonly-banner" class="text-xs text-amber-800 dark:text-amber-200 bg-amber-50 dark:bg-amber-900/30 border-l-4 border-amber-500 rounded-r px-3 py-2"> </div>`),ey=U(`<div class="px-3 py-4 text-center text-xs text-gray-400"> </div>`),ty=U(`<span class="inline-flex items-center gap-1 text-xs font-semibold px-2 py-0.5 rounded-full bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300"><i class="fa-solid fa-check"></i> </span>`),ny=U(`<span class="inline-flex items-center gap-1 text-xs font-semibold px-2 py-0.5 rounded-full bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300"><i class="fa-solid fa-triangle-exclamation"></i> </span>`),ry=U(`<span class="inline-flex items-center gap-1 text-xs font-semibold px-2 py-0.5 rounded-full bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300"><i class="fa-solid fa-circle-xmark"></i> </span>`),iy=U(`<button class="metadata-row-remove text-xs px-2 py-1 rounded-lg border border-red-200 dark:border-red-700 text-red-500 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/40 transition-colors"><i class="fa-solid fa-trash"></i></button>`),ay=U(`<div class="flex items-center gap-2 px-3 py-2 border-b border-gray-100 dark:border-gray-800"><div class="flex-1 min-w-0"><div class="text-sm font-mono truncate text-gray-800 dark:text-gray-200"> </div></div> <!> <!></div>`),oy=U(`<div class="flex items-center gap-2 flex-wrap"><button data-testid="metadata-add-btn" class="text-sm px-3 py-1.5 rounded-lg border border-blue-200 dark:border-blue-700 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/30 transition-colors"><i class="fa-solid fa-plus"></i> </button> <button data-testid="metadata-refresh-btn" class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"><i class="fa-solid fa-arrows-rotate"></i> </button></div>`),sy=U(`<div class="px-3 py-2 text-xs text-gray-400"> </div>`),cy=U(`<div class="px-3 py-2 text-xs text-red-500"> </div>`),ly=U(`<button class="w-full text-left px-3 py-1.5 text-sm hover:bg-gray-50 dark:hover:bg-gray-800 flex items-center gap-2"><i class="fa-solid fa-folder text-yellow-500"></i> <span class="truncate"> </span></button>`),uy=U(`<button class="w-full text-left px-3 py-1.5 text-sm hover:bg-blue-50 dark:hover:bg-blue-900/30 flex items-center gap-2"><i class="fa-solid fa-file text-gray-400"></i> <span class="truncate"> </span> <i class="fa-solid fa-plus ml-auto text-blue-500 text-xs"></i></button>`),dy=U(`<!> <!>`,1),fy=U(`<div class="border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden text-sm"><div class="flex items-center gap-2 px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700"><button class="text-xs text-blue-600 dark:text-blue-400 hover:underline disabled:opacity-30 disabled:pointer-events-none shrink-0"> </button> <span class="text-xs text-gray-500 dark:text-gray-400 font-mono truncate flex-1"> </span></div> <div class="max-h-56 overflow-y-auto divide-y divide-gray-100 dark:divide-gray-800"><!></div></div>`),py=U(`<p class="text-xs text-red-500"> </p>`),my=U(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50"><div data-testid="metadata-modal" class="bg-white dark:bg-gray-900 rounded-xl shadow-xl w-full max-w-2xl mx-4 p-6 space-y-4"><div class="flex items-start justify-between gap-4"><div><h3 class="text-base font-semibold text-gray-900 dark:text-gray-50"><i class="fa-solid fa-code-compare mr-1"></i> </h3> <p class="text-xs text-gray-500 dark:text-gray-400 mt-1"> </p></div> <button class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 transition-colors"><i class="fa-solid fa-xmark text-lg"></i></button></div> <div class="text-xs text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-800 rounded-lg px-3 py-2"></div> <!> <div data-testid="metadata-list" class="border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden"><div class="max-h-64 overflow-y-auto"><!></div></div> <!> <!> <!> <div class="flex justify-end"><button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button></div></div></div>`);function hy(e,t){qe(t,!0);let n=N(()=>Kv.report),r=N(()=>Xv(t.content)===`SuperSeeded`),i=P(``),a=P(!1),o=P(!1),s=P(``),c=P(null),l=P(I([])),u=P(I([])),d=P(!1),f=P(``);kn(()=>{t.open||(F(o,!1),F(s,``),F(i,``))});function p(e){F(i,Y(`common.error_prefix`)+e),setTimeout(()=>{F(i,``)},5e3)}function m(){return!V(n)||V(n).total===0?``:`<span class="font-semibold">${Math.round(V(n).accuracy*100)}%</span> · ${V(n).unchanged}/${V(n).total} ${Y(`metadata.status.unchanged`)} · ${V(n).modified} ${Y(`metadata.status.modified`)} · ${V(n).missing} ${Y(`metadata.status.missing`)}`}async function h(){F(a,!0);try{await Kv.refresh(t.docId)}catch(e){p(e instanceof Error?e.message:String(e))}finally{F(a,!1)}}async function g(e){try{await Kv.removePath(t.docId,e),V(o)&&y(V(s))}catch(e){p(e instanceof Error?e.message:String(e))}}async function _(e){try{await Kv.addPath(t.docId,e),V(o)&&y(V(s))}catch(e){p(e instanceof Error?e.message:String(e))}}function v(){F(o,!V(o)),V(o)&&y(``)}async function y(e){F(d,!0),F(f,``);try{let t=await fetch(`/api/browse-source?path=`+encodeURIComponent(e||``));if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error||t.statusText)}let r=await t.json();F(s,r.current||``,!0),F(c,r.parent,!0),F(l,r.dirs||[],!0);let i=new Set((V(n)?.items||[]).map(e=>e.path));F(u,(r.files||[]).filter(e=>!i.has(e.path)),!0)}catch(e){F(f,e instanceof Error?e.message:String(e),!0)}finally{F(d,!1)}}function b(){V(c)!==null&&y(V(c))}var x=Wr(),S=R(x),C=e=>{var p=my(),x=L(p),S=L(x),C=L(S),w=L(C),T=z(L(w));j(w);var E=z(w,2),D=L(E,!0);j(E),j(C);var ee=z(C,2);j(S);var te=z(S,2);si(te,m,!0),j(te);var O=z(te,2),ne=e=>{var t=$v(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`metadata.readonly_banner`)]),W(e,t)};K(O,e=>{V(r)&&e(ne)});var k=z(O,2),A=L(k),re=L(A),ie=e=>{var t=ey(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`metadata.empty`)]),W(e,t)},ae=e=>{var t=Wr();q(R(t),17,()=>V(n).items,e=>e.path,(e,t)=>{var n=ay(),i=L(n),a=L(i),o=L(a,!0);j(a),j(i);var s=z(i,2),c=e=>{var t=ty(),n=z(L(t));j(t),B(e=>G(n,` ${e??``}`),[()=>Y(`metadata.status.unchanged`)]),W(e,t)},l=e=>{var t=ny(),n=z(L(t));j(t),B(e=>G(n,` ${e??``}`),[()=>Y(`metadata.status.modified`)]),W(e,t)},u=e=>{var t=ry(),n=z(L(t));j(t),B(e=>G(n,` ${e??``}`),[()=>Y(`metadata.status.missing`)]),W(e,t)};K(s,e=>{V(t).status===`unchanged`?e(c):V(t).status===`modified`?e(l,1):e(u,-1)});var d=z(s,2),f=e=>{var n=iy();B(e=>J(n,`title`,e),[()=>Y(`metadata.remove`)]),H(`click`,n,()=>g(V(t).path)),W(e,n)};K(d,e=>{V(r)||e(f)}),j(n),B(()=>{J(a,`title`,V(t).path),G(o,V(t).path)}),W(e,n)}),W(e,t)};K(re,e=>{!V(n)||V(n).items.length===0?e(ie):e(ae,-1)}),j(A),j(k);var oe=z(k,2),se=e=>{var t=oy(),n=L(t),r=z(L(n));j(n);var i=z(n,2),o=z(L(i));j(i),j(t),B((e,t)=>{G(r,` ${e??``}`),i.disabled=V(a),G(o,` ${t??``}`)},[()=>Y(`metadata.add`),()=>Y(`metadata.refresh`)]),H(`click`,n,v),H(`click`,i,h),W(e,t)};K(oe,e=>{V(r)||e(se)});var ce=z(oe,2),le=e=>{var t=fy(),n=L(t),r=L(n),i=L(r,!0);j(r);var a=z(r,2),o=L(a,!0);j(a),j(n);var p=z(n,2),m=L(p),h=e=>{var t=sy(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`common.loading`)]),W(e,t)},g=e=>{var t=cy(),n=L(t,!0);j(t),B(()=>G(n,V(f))),W(e,t)},v=e=>{var t=sy(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`common.empty_dir`)]),W(e,t)},x=e=>{var t=dy(),n=R(t);q(n,17,()=>V(l),e=>e.path,(e,t)=>{var n=ly(),r=z(L(n),2),i=L(r,!0);j(r),j(n),B(()=>G(i,V(t).name)),H(`click`,n,()=>y(V(t).path)),W(e,n)}),q(z(n,2),17,()=>V(u),e=>e.path,(e,t)=>{var n=uy(),r=z(L(n),2),i=L(r,!0);j(r),Ie(2),j(n),B(()=>G(i,V(t).name)),H(`click`,n,()=>_(V(t).path)),W(e,n)}),W(e,t)};K(m,e=>{V(d)?e(h):V(f)?e(g,1):V(l).length===0&&V(u).length===0?e(v,2):e(x,-1)}),j(p),j(t),B(e=>{r.disabled=V(c)===null,G(i,e),G(o,V(s)?`/`+V(s):`/ (sourceRoot)`)},[()=>Y(`common.up`)]),H(`click`,r,b),W(e,t)};K(ce,e=>{V(o)&&e(le)});var ue=z(ce,2),de=e=>{var t=py(),n=L(t,!0);j(t),B(()=>G(n,V(i))),W(e,t)};K(ue,e=>{V(i)&&e(de)});var fe=z(ue,2),pe=L(fe),me=L(pe,!0);j(pe),j(fe),j(x),j(p),B((e,t,n,r)=>{G(T,` ${e??``}`),G(D,t),J(ee,`title`,n),G(me,r)},[()=>Y(`metadata.title`),()=>Y(`metadata.subtitle`),()=>Y(`common.close`),()=>Y(`common.close`)]),H(`click`,p,e=>{e.target===e.currentTarget&&t.onclose()}),H(`click`,ee,function(...e){t.onclose?.apply(this,e)}),H(`click`,pe,function(...e){t.onclose?.apply(this,e)}),W(e,p)};K(S,e=>{t.open&&e(C)}),W(e,x),Je()}Pr([`click`]);var gy=U(`<div class="text-xs font-medium text-amber-700 dark:text-amber-300"> </div>`),_y=U(`<div> </div>`),vy=U(`<button type="button"><div class="flex items-center gap-2 font-semibold text-gray-800 dark:text-gray-100"><span class="font-mono text-blue-600 dark:text-blue-400"> </span> <span class="truncate"> </span></div> <div class="mt-1 text-gray-500 dark:text-gray-400"> </div></button>`),yy=U(`<div class="mt-3 flex gap-2 overflow-x-auto pb-1"></div>`),by=U(`<p class="mt-3 text-sm text-gray-500 dark:text-gray-400"> </p>`),xy=U(`<div class="flex h-full items-center justify-center text-sm text-gray-500 dark:text-gray-400"> </div>`),Sy=U(`<div class="m-5 rounded-lg border border-red-200 bg-red-50 px-4 py-3 text-sm text-red-700 dark:border-red-800 dark:bg-red-950/30 dark:text-red-300"> </div>`),Cy=U(`<div class="mx-5 mt-4 rounded-lg border border-amber-200 bg-amber-50 px-4 py-2 text-sm text-amber-800 dark:border-amber-800 dark:bg-amber-950/30 dark:text-amber-200"> </div>`),wy=U(`<button type="button" class="mt-0.5 inline-flex h-7 w-8 items-center justify-center rounded-md border border-blue-200 bg-white font-mono text-sm font-bold text-blue-600 transition-colors hover:bg-blue-50 disabled:cursor-wait disabled:opacity-50 dark:border-blue-800 dark:bg-gray-950 dark:text-blue-300 dark:hover:bg-blue-950/40"> </button>`),Ty=U(`<div><span> </span> <pre class="m-0 whitespace-pre-wrap break-words px-2 py-0.5 font-mono"> </pre></div> <div class="flex items-start justify-center border-r border-gray-200 bg-gray-50 px-1 py-0.5 dark:border-gray-800 dark:bg-gray-900/70"><!></div> <div><span> </span> <pre class="m-0 whitespace-pre-wrap break-words px-2 py-0.5 font-mono"> </pre></div>`,1),Ey=U(`<!> <div class="h-full overflow-auto p-5"><div class="grid min-w-[980px] grid-cols-[minmax(0,1fr)_3.25rem_minmax(0,1fr)] overflow-hidden rounded-lg border border-gray-200 text-xs dark:border-gray-800"><div class="border-b border-r border-gray-200 bg-gray-100 px-3 py-2 font-semibold text-gray-700 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-200"> </div> <div class="border-b border-r border-gray-200 bg-gray-100 px-2 py-2 text-center font-semibold text-gray-400 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-500"></div> <div class="border-b border-gray-200 bg-gray-100 px-3 py-2 font-semibold text-gray-700 dark:border-gray-800 dark:bg-gray-900 dark:text-gray-200"> </div> <!></div></div>`,1),Dy=U(`<div data-testid="versions-modal" class="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4"><div class="flex h-[90vh] w-full max-w-7xl flex-col overflow-hidden rounded-xl border border-gray-200 bg-white shadow-2xl dark:border-gray-700 dark:bg-gray-950"><header class="flex shrink-0 items-start justify-between gap-4 border-b border-gray-200 px-5 py-4 dark:border-gray-800"><div><h2 class="text-lg font-semibold text-gray-900 dark:text-gray-50"><i class="fa-solid fa-code-branch mr-2"></i> </h2> <p class="mt-1 text-xs text-gray-500 dark:text-gray-400"> </p></div> <button type="button" class="rounded-lg border border-gray-200 px-3 py-1.5 text-sm text-gray-600 transition-colors hover:bg-gray-50 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800"><i class="fa-solid fa-xmark"></i></button></header> <div class="shrink-0 border-b border-gray-200 px-5 py-3 dark:border-gray-800"><div class="flex flex-wrap items-end gap-3"><label class="text-xs font-semibold uppercase tracking-wide text-gray-500 dark:text-gray-400"> <input type="number" class="mt-1 block w-28 rounded-lg border border-gray-200 bg-white px-3 py-1.5 text-sm text-gray-800 dark:border-gray-700 dark:bg-gray-900 dark:text-gray-100"/></label> <button type="button" class="rounded-lg bg-blue-600 px-3 py-1.5 text-sm font-semibold text-white transition-colors hover:bg-blue-700 disabled:opacity-50"><i class="fa-solid fa-arrows-rotate mr-1"></i> </button> <button type="button" class="rounded-lg bg-green-600 px-3 py-1.5 text-sm font-semibold text-white transition-colors hover:bg-green-700 disabled:cursor-not-allowed disabled:opacity-50"><i class="fa-solid fa-floppy-disk mr-1"></i> </button> <div class="text-xs text-gray-500 dark:text-gray-400"> </div> <!> <!></div> <!></div> <section class="min-h-0 flex-1 overflow-hidden"><!></section></div></div>`);function Oy(e,t){qe(t,!0);let n=3650,r=P(30),i=P(30),a=P(!1),o=P(``),s=P(null),c=P(null),l=P(null),u=P(``),d=``,f=P(``),p=P(!1),m=N(()=>V(l)?.headContent??t.content),h=N(()=>V(f)),g=N(()=>V(f)!==V(m)),_=N(()=>T(V(l)?.baseContent??``,V(h))),v=N(()=>V(_).rows),y=N(()=>V(l)?.baseContent!==null&&V(l)?.baseContent!==void 0);kn(()=>{t.docId,F(f,t.content,!0)});function b(e){return Number.isFinite(e)?Math.max(1,Math.min(n,Math.floor(e))):30}function x(e){return e.length?e.replace(/\r\n/g,`
|
|
100
100
|
`).split(`
|
|
101
101
|
`):[]}function S(){return{text:``,lineNumber:null,kind:`empty`}}function C(e,t){let n=[],r=[],i=Math.max(e.length,t.length);for(let a=0;a<i;a+=1){let i=e[a],o=t[a];if(i===o)n.push({left:{text:i??``,lineNumber:i===void 0?null:a+1,kind:i===void 0?`empty`:`context`},right:{text:o??``,lineNumber:o===void 0?null:a+1,kind:o===void 0?`empty`:`context`},hunkId:null,showApply:!1});else{let e={id:r.length,oldStart:a,oldDeleteCount:i===void 0?0:1,newStart:a,newDeleteCount:o===void 0?0:1,oldLines:i===void 0?[]:[i],newLines:o===void 0?[]:[o]};r.push(e),n.push({left:i===void 0?S():{text:i,lineNumber:a+1,kind:`removed`},right:o===void 0?S():{text:o,lineNumber:a+1,kind:`added`},hunkId:e.id,showApply:!0})}}return{rows:n,hunks:r}}function w(e,t,n){let r=n.filter(e=>e.kind===`removed`),i=n.filter(e=>e.kind===`added`),a={id:t.length,oldStart:r[0]?r[0].oldLine-1:i[0]?.oldIndex??0,oldDeleteCount:r.length,newStart:i[0]?i[0].newLine-1:r[0]?.newIndex??0,newDeleteCount:i.length,oldLines:r.map(e=>e.text),newLines:i.map(e=>e.text)};t.push(a);let o=Math.max(r.length,i.length);for(let t=0;t<o;t+=1){let n=r[t],o=i[t];e.push({left:n?{text:n.text,lineNumber:n.oldLine,kind:`removed`}:S(),right:o?{text:o.text,lineNumber:o.newLine,kind:`added`}:S(),hunkId:a.id,showApply:t===0})}}function T(e,t){let n=x(e),r=x(t);if(n.length*r.length>4e6)return C(n,r);let i=r.length+1,a=new Uint32Array((n.length+1)*i);for(let e=n.length-1;e>=0;--e)for(let t=r.length-1;t>=0;--t){let o=e*i+t;a[o]=n[e]===r[t]?a[(e+1)*i+t+1]+1:Math.max(a[(e+1)*i+t],a[e*i+t+1])}let o=[],s=0,c=0;for(;s<n.length||c<r.length;)s<n.length&&c<r.length&&n[s]===r[c]?(o.push({kind:`context`,oldText:n[s],newText:r[c],oldLine:s+1,newLine:c+1}),s+=1,c+=1):c<r.length&&(s===n.length||a[s*i+c+1]>=a[(s+1)*i+c])?(o.push({kind:`added`,text:r[c],newLine:c+1,oldIndex:s}),c+=1):s<n.length&&(o.push({kind:`removed`,text:n[s],oldLine:s+1,newIndex:c}),s+=1);let l=[],u=[],d=[];for(let e of o)e.kind===`context`?(d.length&&(w(l,u,d),d=[]),l.push({left:{text:e.oldText,lineNumber:e.oldLine,kind:`context`},right:{text:e.newText,lineNumber:e.newLine,kind:`context`},hunkId:null,showApply:!1})):d.push(e);return d.length&&w(l,u,d),{rows:l,hunks:u}}function E(e){return e===`added`?`bg-green-50 text-green-900 dark:bg-green-950/40 dark:text-green-100`:e===`removed`?`bg-red-50 text-red-900 dark:bg-red-950/40 dark:text-red-100`:e===`empty`?`bg-gray-50 dark:bg-gray-900/60`:`bg-white text-gray-800 dark:bg-gray-950 dark:text-gray-200`}function D(e){return e===`added`?`bg-green-100 text-green-700 dark:bg-green-950 dark:text-green-300`:e===`removed`?`bg-red-100 text-red-700 dark:bg-red-950 dark:text-red-300`:`bg-gray-100 text-gray-400 dark:bg-gray-900 dark:text-gray-500`}function ee(e){if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString()}function te(e){return V(u)===e||V(l)?.baseRef===e}function O(e){return e===null?null:V(_).hunks.find(t=>t.id===e)||null}async function ne(e){if(V(c)!==null)return;let n=x(V(f)||t.content);if(n.slice(e.newStart,e.newStart+e.newDeleteCount).join(`
|
|
102
102
|
`)!==e.newLines.join(`
|
|
103
103
|
`)){F(s,{text:Y(`versions.apply_stale`),cls:`text-red-600 dark:text-red-400`},!0);return}F(c,e.id,!0),F(s,null);try{F(f,[...n.slice(0,e.newStart),...e.oldLines,...n.slice(e.newStart+e.newDeleteCount)].join(`
|
|
104
|
-
`),!0),F(s,{text:Y(`versions.apply_success`),cls:`text-green-600 dark:text-green-400`},!0)}catch(e){F(s,{text:Y(`versions.apply_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-600 dark:text-red-400`},!0)}finally{F(c,null)}}async function k(){if(!(!V(g)||V(p))){F(p,!0),F(s,null);try{await t.onsave(V(f)),d=``,await ie(V(u)),F(s,{text:Y(`versions.save_success`),cls:`text-green-600 dark:text-green-400`},!0)}catch(e){F(s,{text:Y(`versions.save_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-600 dark:text-red-400`},!0)}finally{F(p,!1)}}}function A(){F(f,t.content,!0),F(s,null),F(c,null),F(p,!1)}function re(){A(),t.onclose()}async function ie(e=V(u)){let n=b(V(i)),r=`${t.docId}:${n}:${e||`default`}`;if(!t.open||V(a)||r===d)return;F(a,!0),F(o,``);let c=V(g);c||F(s,null);try{let i=new URLSearchParams({documentId:t.docId,sinceDays:String(n)});e&&i.set(`baseRef`,e);let a=await fetch(`/api/git/document-versions?${i.toString()}`),o=await a.json();if(!a.ok||!o.ok)throw Error(o.message||o.error||Y(`versions.load_failed`));let s=o;F(l,s,!0),F(u,s.baseRef,!0),c||F(f,s.headContent??t.content,!0),d=r}catch(e){F(o,e instanceof Error?e.message:String(e),!0),F(l,null),d=``}finally{F(a,!1)}}function ae(){F(i,b(Number(V(r))),!0),F(r,V(i),!0),F(u,``),d=``,ie(``)}function oe(e){F(u,e,!0),d=``,ie(e)}kn(()=>{if(!t.open){A(),d=``,F(u,``);return}t.docId,V(i),ie()});var se=Wr(),ce=R(se),le=e=>{var t=
|
|
104
|
+
`),!0),F(s,{text:Y(`versions.apply_success`),cls:`text-green-600 dark:text-green-400`},!0)}catch(e){F(s,{text:Y(`versions.apply_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-600 dark:text-red-400`},!0)}finally{F(c,null)}}async function k(){if(!(!V(g)||V(p))){F(p,!0),F(s,null);try{await t.onsave(V(f)),d=``,await ie(V(u)),F(s,{text:Y(`versions.save_success`),cls:`text-green-600 dark:text-green-400`},!0)}catch(e){F(s,{text:Y(`versions.save_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-600 dark:text-red-400`},!0)}finally{F(p,!1)}}}function A(){F(f,t.content,!0),F(s,null),F(c,null),F(p,!1)}function re(){A(),t.onclose()}async function ie(e=V(u)){let n=b(V(i)),r=`${t.docId}:${n}:${e||`default`}`;if(!t.open||V(a)||r===d)return;F(a,!0),F(o,``);let c=V(g);c||F(s,null);try{let i=new URLSearchParams({documentId:t.docId,sinceDays:String(n)});e&&i.set(`baseRef`,e);let a=await fetch(`/api/git/document-versions?${i.toString()}`),o=await a.json();if(!a.ok||!o.ok)throw Error(o.message||o.error||Y(`versions.load_failed`));let s=o;F(l,s,!0),F(u,s.baseRef,!0),c||F(f,s.headContent??t.content,!0),d=r}catch(e){F(o,e instanceof Error?e.message:String(e),!0),F(l,null),d=``}finally{F(a,!1)}}function ae(){F(i,b(Number(V(r))),!0),F(r,V(i),!0),F(u,``),d=``,ie(``)}function oe(e){F(u,e,!0),d=``,ie(e)}kn(()=>{if(!t.open){A(),d=``,F(u,``);return}t.docId,V(i),ie()});var se=Wr(),ce=R(se),le=e=>{var t=Dy(),i=L(t),u=L(i),d=L(u),f=L(d),m=z(L(f),1,!0);j(f);var h=z(f,2),_=L(h,!0);j(h),j(d);var b=z(d,2);j(u);var x=z(u,2),S=L(x),C=L(S),w=L(C),T=z(w);ki(T),J(T,`min`,1),J(T,`max`,n),j(C);var A=z(C,2),ie=z(L(A),1,!0);j(A);var se=z(A,2),ce=z(L(se),1,!0);j(se);var le=z(se,2),ue=L(le,!0);j(le);var de=z(le,2),fe=e=>{var t=gy(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`versions.unsaved_changes`)]),W(e,t)};K(de,e=>{V(g)&&e(fe)});var pe=z(de,2),me=e=>{var t=_y(),n=L(t,!0);j(t),B(()=>{vi(t,1,`text-xs font-medium ${V(s).cls??``}`),G(n,V(s).text)}),W(e,t)};K(pe,e=>{V(s)&&e(me)}),j(S);var he=z(S,2),ge=e=>{var t=yy();q(t,21,()=>V(l).commits,e=>e.hash,(e,t)=>{var n=vy(),r=L(n),i=L(r),a=L(i,!0);j(i);var o=z(i,2),s=L(o,!0);j(o),j(r);var c=z(r,2),l=L(c);j(c),j(n),B((e,r,i)=>{J(n,`title`,e),vi(n,1,`min-w-64 rounded-lg border px-3 py-2 text-left text-xs transition-colors ${r??``}`),G(a,V(t).shortHash),G(s,V(t).subject),G(l,`${i??``} · ${V(t).author??``}`)},[()=>Y(`versions.select_commit`).replace(`{hash}`,V(t).shortHash),()=>te(V(t).hash)?`border-blue-500 bg-blue-50 ring-2 ring-blue-500/30 dark:border-blue-400 dark:bg-blue-950/40`:`border-gray-200 bg-gray-50 hover:border-blue-300 hover:bg-blue-50/70 dark:border-gray-700 dark:bg-gray-900 dark:hover:border-blue-700 dark:hover:bg-blue-950/30`,()=>ee(V(t).date)]),H(`click`,n,()=>oe(V(t).hash)),W(e,n)}),j(t),W(e,t)},_e=e=>{var t=by(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`versions.no_commits`)]),W(e,t)};K(he,e=>{V(l)?.commits?.length?e(ge):V(l)&&!V(a)&&e(_e,1)}),j(x);var ve=z(x,2),ye=L(ve),be=e=>{var t=xy(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`common.loading`)]),W(e,t)},xe=e=>{var t=Sy(),n=L(t,!0);j(t),B(()=>G(n,V(o))),W(e,t)},Se=e=>{var t=Ey(),n=R(t),r=e=>{var t=Cy(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`versions.no_head_content`)]),W(e,t)};K(n,e=>{V(y)||e(r)});var i=z(n,2),a=L(i),o=L(a),s=L(o,!0);j(o);var u=z(o,4),d=L(u,!0);j(u),q(z(u,2),17,()=>V(v),Qr,(e,t)=>{var n=Ty(),r=R(n),i=L(r),a=L(i,!0);j(i);var o=z(i,2),s=L(o,!0);j(o),j(r);var l=z(r,2),u=L(l),d=e=>{let n=N(()=>O(V(t).hunkId));var r=Wr(),i=R(r),a=e=>{var t=wy(),r=L(t,!0);j(t),B(e=>{t.disabled=V(c)!==null,J(t,`title`,e),G(r,V(c)===V(n).id?`...`:`<`)},[()=>Y(`versions.apply_hunk`)]),H(`click`,t,()=>ne(V(n))),W(e,t)};K(i,e=>{V(n)&&e(a)}),W(e,r)};K(u,e=>{V(t).showApply&&e(d)}),j(l);var f=z(l,2),p=L(f),m=L(p,!0);j(p);var h=z(p,2),g=L(h,!0);j(h),j(f),B((e,n,o,c)=>{vi(r,1,`grid grid-cols-[4rem_1fr] border-r border-gray-200 font-mono leading-5 dark:border-gray-800 ${e??``}`),vi(i,1,`select-none px-2 py-0.5 text-right ${n??``}`),G(a,V(t).right.lineNumber??``),G(s,V(t).right.text),vi(f,1,`grid grid-cols-[4rem_1fr] font-mono leading-5 ${o??``}`),vi(p,1,`select-none px-2 py-0.5 text-right ${c??``}`),G(m,V(t).left.lineNumber??``),G(g,V(t).left.text)},[()=>E(V(t).right.kind),()=>D(V(t).right.kind),()=>E(V(t).left.kind),()=>D(V(t).left.kind)]),W(e,n)}),j(a),j(i),B((e,t)=>{G(s,e),G(d,t)},[()=>Y(V(g)?`versions.right_title_draft`:`versions.right_title`),()=>Y(`versions.left_title`).replace(`{ref}`,V(l).baseRef)]),W(e,t)},Ce=e=>{var t=xy(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`versions.path_pending`)]),W(e,t)};K(ye,e=>{V(a)?e(be):V(o)?e(xe,1):V(l)?e(Se,2):e(Ce,-1)}),j(ve),j(i),j(t),B((e,t,n,r,i,o,s)=>{G(m,e),G(_,t),J(b,`title`,n),G(w,`${r??``} `),A.disabled=V(a),G(ie,i),se.disabled=!V(g)||V(p)||V(a),G(ce,o),G(ue,s)},[()=>Y(`versions.title`),()=>V(l)?.relativePath||Y(`versions.path_pending`),()=>Y(`common.close`),()=>Y(`versions.period_label`),()=>Y(`versions.refresh`),()=>V(p)?Y(`versions.saving`):Y(`common.save`),()=>Y(`versions.base_ref`).replace(`{ref}`,V(l)?.baseRef||`HEAD`)]),H(`click`,t,e=>{e.target===e.currentTarget&&re()}),H(`click`,b,re),Fi(T,()=>V(r),e=>F(r,e)),H(`click`,A,ae),H(`click`,se,k),W(e,t)};K(ce,e=>{t.open&&e(le)}),W(e,se),Je()}Pr([`click`]);function ky(e){let t=``,n=[],r=!0;for(let i=0;i<e.length;i++){let a=e[i].normalize(`NFD`);for(let e=0;e<a.length;e++){let o=a.charCodeAt(e);if(!(o>=768&&o<=879))if(o>=48&&o<=57||o>=65&&o<=90||o>=97&&o<=122){let e=o>=65&&o<=90?o+32:o;t+=String.fromCharCode(e),n.push(i),r=!1}else r||=(t+=` `,n.push(i),!0)}}return n.push(e.length),t.endsWith(` `)&&(t=t.slice(0,-1),n.splice(n.length-2,1)),{normalized:t,map:n}}function Ay(e){return ky(e).normalized}function jy(e,t,n){if(e===t)return 0;let r=e.length,i=t.length;if(Math.abs(r-i)>n)return n+1;let a=null,o=Array(i+1),s=Array(i+1);for(let e=0;e<=i;e++)o[e]=e;for(let c=1;c<=r;c++){s[0]=c;let r=c;for(let n=1;n<=i;n++){let i=e.charCodeAt(c-1)===t.charCodeAt(n-1)?0:1,l=Math.min(o[n]+1,s[n-1]+1,o[n-1]+i);c>1&&n>1&&e.charCodeAt(c-1)===t.charCodeAt(n-2)&&e.charCodeAt(c-2)===t.charCodeAt(n-1)&&(l=Math.min(l,a?.[n-2]+1)),s[n]=l,l<r&&(r=l)}if(r>n)return n+1;a=o,o=s,s=Array(i+1)}return o[i]}function My(e){return e>=7?2:+(e>=4)}function Ny(e){return String(e).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function Py(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Fy(e,t,n){t.innerHTML=``,t.classList.add(`hidden`);let r=e.querySelectorAll(`[data-ld-local-search]`);if(!r.length)return;r.forEach(e=>{e.remove()});let i=(()=>{let t=new Set;return Ay(e.textContent||``).split(` `).forEach(e=>{e.length>=3&&t.add(e)}),Array.from(t)})(),a=n(`local_search.placeholder`)||`Search in this document…`,o=n(`local_search.clear`)||`Clear`,s=document.createElement(`div`);s.className=`no-print mt-4 rounded-lg border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 overflow-hidden`,s.innerHTML=`
|
|
105
105
|
<div class="flex items-center gap-2 px-3 py-2 border-b border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800/50">
|
|
106
106
|
<span class="text-gray-400 select-none" aria-hidden="true">🔎</span>
|
|
107
107
|
<input type="text" id="ld-local-search-input" autocomplete="off"
|
|
108
108
|
class="flex-1 bg-transparent border-0 text-sm text-gray-700 dark:text-gray-300 placeholder:text-gray-400 focus:outline-none focus:ring-0"
|
|
109
|
-
placeholder="${
|
|
109
|
+
placeholder="${Ny(a)}" />
|
|
110
110
|
<button type="button" id="ld-local-search-clear"
|
|
111
111
|
class="hidden text-xs text-gray-400 hover:text-gray-600 dark:hover:text-gray-300 shrink-0 px-1"
|
|
112
|
-
title="${
|
|
112
|
+
title="${Ny(o)}" aria-label="${Ny(o)}">✕</button>
|
|
113
113
|
</div>
|
|
114
114
|
<div id="ld-local-search-results" class="hidden">
|
|
115
115
|
<div id="ld-local-search-title" class="px-3 py-1.5 text-xs font-medium text-gray-500 dark:text-gray-400 border-b border-gray-100 dark:border-gray-800"></div>
|
|
116
116
|
<ol id="ld-local-search-list" class="max-h-40 overflow-y-auto divide-y divide-gray-100 dark:divide-gray-800 list-none m-0 p-0"></ol>
|
|
117
|
-
</div>`,t.appendChild(s),t.classList.remove(`hidden`);let c=s.querySelector(`#ld-local-search-input`),l=s.querySelector(`#ld-local-search-clear`),u=s.querySelector(`#ld-local-search-results`),d=s.querySelector(`#ld-local-search-title`),f=s.querySelector(`#ld-local-search-list`),p=null;function m(){e.querySelectorAll(`mark.ld-local-mark`).forEach(e=>{let t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}),e.normalize()}function h(e,t){let n=new Set;t.includes(e)&&n.add(e);let r=Cy(e.length);if(r===0)return n;let a=e[0];for(let t of i)t!==e&&(Math.abs(t.length-e.length)>r||e.length>=3&&t[0]!==a||Sy(e,t,r)<=r&&n.add(t));return n}function g(t){if(m(),!t){u.classList.add(`hidden`),l.classList.add(`hidden`),f.innerHTML=``;return}l.classList.remove(`hidden`);let r=xy(t),i=r.split(` `).filter(Boolean);if(!i.length){u.classList.add(`hidden`);return}let a=xy(e.textContent||``),o=i.map(e=>h(e,a));if(!o.some(e=>e.size>0)){d.textContent=n(`local_search.no_results`)||`No matches found.`,f.innerHTML=``,u.classList.remove(`hidden`);return}let s=new Set;o.forEach((e,t)=>{e.forEach(e=>{let n=e===i[t];s.add(n?e:`\\b${Ty(e)}\\b`)})});let c=Array.from(s).sort((e,t)=>t.length-e.length),p=RegExp(`(${c.map(e=>e.startsWith(`\\b`)?e:Ty(e)).join(`|`)})`,`g`),g=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){return e.parentElement?.closest(`mark`)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),v=[];for(;g.nextNode();)v.push(g.currentNode);let y=0,b=new Map;v.forEach(e=>{let t=e.textContent||``,{normalized:n,map:r}=by(t);if(!n)return;let i=[];p.lastIndex=0;for(let e=p.exec(n);e!==null;e=p.exec(n)){if(e[0].length===0){p.lastIndex++;continue}i.push({start:e.index,end:e.index+e[0].length,term:e[0]})}if(!i.length)return;let a=e.parentElement?.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre, blockquote`)||e.parentElement,s=``,c=0;i.forEach(e=>{let n=r[e.start],i=r[e.end];if(!(n<c)&&(s+=wy(t.slice(c,n)),s+=`<mark class="ld-local-mark" id="ld-local-match-${y++}">${wy(t.slice(n,i))}</mark>`,c=i,a)){let t=b.get(a);t||(t=new Set,b.set(a,t)),o.forEach((n,r)=>{n.has(e.term)&&t.add(r)})}}),s+=wy(t.slice(c));let l=document.createElement(`span`);l.innerHTML=s,e.parentNode?.replaceChild(l,e)});let x=i.length,S=[];for(let[e,t]of b.entries())t.size===x&&S.push(e);let C;if(S.length>0){let t=new Set(S);C=Array.from(e.querySelectorAll(`mark.ld-local-mark`)).filter(e=>{let n=e.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre, blockquote`)||e.parentElement;return t.has(n)})}else C=Array.from(e.querySelectorAll(`mark.ld-local-mark`));if(!C.length){d.textContent=n(`local_search.no_results`)||`No matches found.`,f.innerHTML=``,u.classList.remove(`hidden`);return}d.textContent=(C.length===1?n(`local_search.count_singular`)||`{count} match`:n(`local_search.count_plural`)||`{count} matches`).replace(`{count}`,String(C.length)),f.innerHTML=C.map((e,t)=>{let n=e.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre, blockquote`)||e.parentElement,i=(n?n.textContent||``:e.textContent||``).trim(),a=xy(i),s=-1;for(let e of o)for(let t of e){let e=a.indexOf(t);e>=0&&(s<0||e<s)&&(s=e)}s<0&&(s=a.indexOf(r.split(` `)[0])),s<0&&(s=0);let c=Math.max(0,s-40),l=Math.min(i.length,s+80),u=(c>0?`…`:``)+i.slice(c,l)+(l<i.length?`…`:``);return`<li><button type="button" data-target="${e.id}" class="ld-local-item w-full text-left px-3 py-1.5 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors text-xs"><span class="text-gray-400 font-mono mr-2">${t+1}.</span>${wy(u)}</button></li>`}).join(``),u.classList.remove(`hidden`),f.querySelectorAll(`.ld-local-item`).forEach(e=>{let t=e.dataset.target;t&&e.addEventListener(`click`,()=>_(t))})}function _(t){let n=document.getElementById(t),r=document.getElementById(`home-content-area`);if(!n||!r)return;let i=n.parentElement;for(;i&&i!==r;)i.tagName===`DETAILS`&&!i.open&&(i.open=!0),i=i.parentElement;e.querySelectorAll(`mark.ld-local-mark.ld-local-active`).forEach(e=>{e.classList.remove(`ld-local-active`)}),n.classList.add(`ld-local-active`),f.querySelectorAll(`.ld-local-item`).forEach(e=>{e.classList.toggle(`ld-local-item-active`,e.dataset.target===t)});let a=document.querySelector(`#home-doc-view header`),o=a?a.getBoundingClientRect().height:0,s=n.getBoundingClientRect().top,c=r.getBoundingClientRect().top,l=o+(r.clientHeight-o)/3;r.scrollTop+=s-c-l}c.addEventListener(`input`,()=>{p&&clearTimeout(p),p=window.setTimeout(()=>g(c.value.trim()),250)}),l.addEventListener(`click`,()=>{c.value=``,g(``),c.focus()}),c.addEventListener(`keydown`,e=>{e.key===`Escape`&&(c.value=``,g(``),c.blur())})}var Dy={codeLabel:`Code block.`,imageLabel:`Image: {alt}.`,diagramLabel:`Diagram.`,tableLabel:`Table.`,readCode:!1},Oy=new Set([`H1`,`H2`,`H3`,`H4`,`H5`,`H6`]);function ky(e){return e.classList.contains(`mermaid`)||e.querySelector(`.mermaid`)!==null}function Ay(e){let t=[];for(let n of e.matchAll(/[^.!?…\n]*(?:[.!?…]+|\n+|$)/g)){let e=n[0];if(e.length===0)continue;let r=e.length-e.trimStart().length,i=e.trim();if(i){let e=n.index+r;t.push({text:i,start:e,end:e+i.length})}}return t}function jy(e,t){let n=(e.textContent??``).replace(/\s+/g,` `).trim();if(!n)return null;let r=Ay(n);return{type:t,el:e,spokenText:n,sentences:r.length?r:[{text:n,start:0,end:n.length}],highlightWhole:!1}}function My(e,t,n){let r=n.trim();return r?{type:t,el:e,spokenText:r,sentences:[{text:r,start:0,end:r.length}],highlightWhole:!0}:null}function Ny(e,t,n){for(let r of Array.from(e.children)){let e=r.tagName;if(ky(r)){Py(n,My(r,`diagram`,t.diagramLabel));continue}if(e===`PRE`||e===`DIV`&&r.querySelector(`:scope > pre`)){Py(n,t.readCode?jy(r,`code`):My(r,`code`,t.codeLabel));continue}if(e===`TABLE`){Py(n,My(r,`table`,t.tableLabel));continue}if(e===`IMG`||e===`FIGURE`&&r.querySelector(`img`)){let i=(e===`IMG`?r:r.querySelector(`img`))?.getAttribute(`alt`)?.trim()??``;Py(n,My(r,`image`,t.imageLabel.includes(`{alt}`)?i?t.imageLabel.replace(`{alt}`,i):t.imageLabel.replace(/:?\s*\{alt\}/,``).trim()||`Image.`:t.imageLabel));continue}if(Oy.has(e)){Py(n,jy(r,`heading`));continue}if(e===`P`){Py(n,jy(r,`paragraph`));continue}if(e===`LI`){Py(n,jy(r,`list-item`));continue}if(e===`BLOCKQUOTE`){r.querySelector(`:scope > p, :scope > ul, :scope > ol`)?Ny(r,t,n):Py(n,jy(r,`quote`));continue}if(e===`UL`||e===`OL`||e===`DIV`||e===`SECTION`||e===`DETAILS`){Ny(r,t,n);continue}}}function Py(e,t){t&&e.push(t)}function Fy(e,t={}){let n={...Dy,...t},r=[];return Ny(e,n,r),r}var Iy=`tts-sentence`;function Ly(){if(typeof document>`u`||document.getElementById(`tts-highlight-style`))return;let e=document.createElement(`style`);e.id=`tts-highlight-style`,e.textContent=`::highlight(${Iy}){background-color:rgba(250,204,21,0.45);color:inherit;}.dark ::highlight(${Iy}){background-color:rgba(250,204,21,0.35);}`,document.head.appendChild(e)}function Ry(e,t,n){let r=[],i=!0,a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),o=a.nextNode();for(;o;){let e=o.data;for(let t=0;t<e.length;t++)/\s/.test(e[t])?i||=(r.push({node:o,offset:t}),!0):(r.push({node:o,offset:t}),i=!1);o=a.nextNode()}if(t>=r.length)return null;let s=r[t],c=document.createRange();if(c.setStart(s.node,s.offset),n<r.length){let e=r[n];c.setEnd(e.node,e.offset)}else{let e=r[r.length-1];c.setEnd(e.node,e.offset+1)}return c}var zy=new class{#e=P(`idle`);get status(){return V(this.#e)}set status(e){F(this.#e,e,!0)}#t=P(-1);get index(){return V(this.#t)}set index(e){F(this.#t,e,!0)}#n=P(0);get total(){return V(this.#n)}set total(e){F(this.#n,e,!0)}#r=P(null);get error(){return V(this.#r)}set error(e){F(this.#r,e,!0)}units=[];ctx=null;source=null;cache=new Map;token=0;voice;speed;language=`en`;fallbackEl=null;get active(){return this.status===`playing`||this.status===`paused`||this.status===`loading`}async start(e,t={}){this.stop();let{voice:n,speed:r,language:i,...a}=t;this.voice=n,this.speed=r,this.language=i??`en`;let o=Fy(e,a);if(this.units=o.flatMap(e=>e.highlightWhole?[{seg:e,text:e.spokenText,start:0,end:e.spokenText.length,whole:!0}]:e.sentences.map(t=>({seg:e,text:t.text,start:t.start,end:t.end,whole:!1}))),this.total=this.units.length,this.units.length===0)return;this.ctx=new AudioContext,this.error=null;let s=++this.token;this.status=`loading`,await this.playFrom(0,s)}async playFrom(e,t){if(t!==this.token)return;if(e>=this.units.length){this.stop();return}this.index=e,this.highlight(this.units[e]);let n;try{n=await this.audioFor(e)}catch(e){if(t!==this.token)return;this.error=e instanceof Error?e.message:String(e),this.stop(!1);return}if(t!==this.token||!this.ctx)return;this.prefetch(e+1);let r=this.ctx.createBufferSource();r.buffer=n,r.connect(this.ctx.destination),r.onended=()=>{t===this.token&&(this.source=null,this.playFrom(e+1,t))},this.source=r,this.status=`playing`,r.start()}audioFor(e){let t=this.cache.get(e);return t||(t=this.fetchAudio(this.units[e].text),this.cache.set(e,t)),t}prefetch(e){e<this.units.length&&!this.cache.has(e)&&this.cache.set(e,this.fetchAudio(this.units[e].text).catch(e=>Promise.reject(e)))}async fetchAudio(e){let t=await fetch(`/api/tts`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:e,voice:this.voice,speed:this.speed,language:this.language})});if(!t.ok){let e=`HTTP ${t.status}`;try{e=(await t.json()).error||e}catch{}throw Error(e)}let n=await t.arrayBuffer();return this.ctx?.decodeAudioData(n)}pause(){this.status===`playing`&&this.ctx&&(this.ctx.suspend(),this.status=`paused`)}resume(){this.status===`paused`&&this.ctx&&(this.ctx.resume(),this.status=`playing`)}toggle(){this.status===`playing`?this.pause():this.status===`paused`&&this.resume()}stop(e=!0){if(this.token++,this.source){try{this.source.onended=null,this.source.stop()}catch{}this.source=null}this.ctx&&=(this.ctx.close(),null),this.cache.clear(),this.clearHighlight(),this.status=`idle`,this.index=-1,this.total=0,e&&(this.error=null)}highlight(e){Ly(),this.clearHighlight();let t=typeof CSS<`u`&&`highlights`in CSS&&typeof Highlight<`u`;if(t&&!e.whole){let t=Ry(e.seg.el,e.start,e.end);t?CSS.highlights.set(Iy,new Highlight(t)):this.fallbackHighlight(e.seg.el)}else if(t){let t=document.createRange();t.selectNodeContents(e.seg.el),CSS.highlights.set(Iy,new Highlight(t))}else this.fallbackHighlight(e.seg.el);e.seg.el.scrollIntoView({block:`center`,behavior:`smooth`})}fallbackHighlight(e){e.classList.add(`tts-active`),this.fallbackEl=e}clearHighlight(){typeof CSS<`u`&&`highlights`in CSS&&CSS.highlights.delete(Iy),this.fallbackEl&&=(this.fallbackEl.classList.remove(`tts-active`),null)}},By=Symbol.for(`yaml.alias`),Vy=Symbol.for(`yaml.document`),Hy=Symbol.for(`yaml.map`),Uy=Symbol.for(`yaml.pair`),Wy=Symbol.for(`yaml.scalar`),Gy=Symbol.for(`yaml.seq`),Ky=Symbol.for(`yaml.node.type`),qy=e=>!!e&&typeof e==`object`&&e[Ky]===By,Jy=e=>!!e&&typeof e==`object`&&e[Ky]===Vy,Yy=e=>!!e&&typeof e==`object`&&e[Ky]===Hy,Xy=e=>!!e&&typeof e==`object`&&e[Ky]===Uy,Zy=e=>!!e&&typeof e==`object`&&e[Ky]===Wy,Qy=e=>!!e&&typeof e==`object`&&e[Ky]===Gy;function $y(e){if(e&&typeof e==`object`)switch(e[Ky]){case Hy:case Gy:return!0}return!1}function eb(e){if(e&&typeof e==`object`)switch(e[Ky]){case By:case Hy:case Wy:case Gy:return!0}return!1}var tb=e=>(Zy(e)||$y(e))&&!!e.anchor,nb=Symbol(`break visit`),rb=Symbol(`skip children`),ib=Symbol(`remove node`);function ab(e,t){let n=lb(t);Jy(e)?ob(null,e.contents,n,Object.freeze([e]))===ib&&(e.contents=null):ob(null,e,n,Object.freeze([]))}ab.BREAK=nb,ab.SKIP=rb,ab.REMOVE=ib;function ob(e,t,n,r){let i=ub(e,t,n,r);if(eb(i)||Xy(i))return db(e,r,i),ob(e,i,n,r);if(typeof i!=`symbol`){if($y(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=ob(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===nb)return nb;else i===ib&&(t.items.splice(e,1),--e)}}else if(Xy(t)){r=Object.freeze(r.concat(t));let e=ob(`key`,t.key,n,r);if(e===nb)return nb;e===ib&&(t.key=null);let i=ob(`value`,t.value,n,r);if(i===nb)return nb;i===ib&&(t.value=null)}}return i}async function sb(e,t){let n=lb(t);Jy(e)?await cb(null,e.contents,n,Object.freeze([e]))===ib&&(e.contents=null):await cb(null,e,n,Object.freeze([]))}sb.BREAK=nb,sb.SKIP=rb,sb.REMOVE=ib;async function cb(e,t,n,r){let i=await ub(e,t,n,r);if(eb(i)||Xy(i))return db(e,r,i),cb(e,i,n,r);if(typeof i!=`symbol`){if($y(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=await cb(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===nb)return nb;else i===ib&&(t.items.splice(e,1),--e)}}else if(Xy(t)){r=Object.freeze(r.concat(t));let e=await cb(`key`,t.key,n,r);if(e===nb)return nb;e===ib&&(t.key=null);let i=await cb(`value`,t.value,n,r);if(i===nb)return nb;i===ib&&(t.value=null)}}return i}function lb(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 ub(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(Yy(t))return n.Map?.(e,t,r);if(Qy(t))return n.Seq?.(e,t,r);if(Xy(t))return n.Pair?.(e,t,r);if(Zy(t))return n.Scalar?.(e,t,r);if(qy(t))return n.Alias?.(e,t,r)}function db(e,t,n){let r=t[t.length-1];if($y(r))r.items[e]=n;else if(Xy(r))e===`key`?r.key=n:r.value=n;else if(Jy(r))r.contents=n;else{let e=qy(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var fb={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},pb=e=>e.replace(/[!,[\]{}]/g,e=>fb[e]),mb=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);break}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+pb(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&&eb(e.contents)){let t={};ab(e.contents,(e,n)=>{eb(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(`
|
|
118
|
-
`)}};
|
|
119
|
-
`)?
|
|
117
|
+
</div>`,t.appendChild(s),t.classList.remove(`hidden`);let c=s.querySelector(`#ld-local-search-input`),l=s.querySelector(`#ld-local-search-clear`),u=s.querySelector(`#ld-local-search-results`),d=s.querySelector(`#ld-local-search-title`),f=s.querySelector(`#ld-local-search-list`),p=null;function m(){e.querySelectorAll(`mark.ld-local-mark`).forEach(e=>{let t=e.parentNode;if(t){for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}}),e.normalize()}function h(e,t){let n=new Set;t.includes(e)&&n.add(e);let r=My(e.length);if(r===0)return n;let a=e[0];for(let t of i)t!==e&&(Math.abs(t.length-e.length)>r||e.length>=3&&t[0]!==a||jy(e,t,r)<=r&&n.add(t));return n}function g(t){if(m(),!t){u.classList.add(`hidden`),l.classList.add(`hidden`),f.innerHTML=``;return}l.classList.remove(`hidden`);let r=Ay(t),i=r.split(` `).filter(Boolean);if(!i.length){u.classList.add(`hidden`);return}let a=Ay(e.textContent||``),o=i.map(e=>h(e,a));if(!o.some(e=>e.size>0)){d.textContent=n(`local_search.no_results`)||`No matches found.`,f.innerHTML=``,u.classList.remove(`hidden`);return}let s=new Set;o.forEach((e,t)=>{e.forEach(e=>{let n=e===i[t];s.add(n?e:`\\b${Py(e)}\\b`)})});let c=Array.from(s).sort((e,t)=>t.length-e.length),p=RegExp(`(${c.map(e=>e.startsWith(`\\b`)?e:Py(e)).join(`|`)})`,`g`),g=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){return e.parentElement?.closest(`mark`)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),v=[];for(;g.nextNode();)v.push(g.currentNode);let y=0,b=new Map;v.forEach(e=>{let t=e.textContent||``,{normalized:n,map:r}=ky(t);if(!n)return;let i=[];p.lastIndex=0;for(let e=p.exec(n);e!==null;e=p.exec(n)){if(e[0].length===0){p.lastIndex++;continue}i.push({start:e.index,end:e.index+e[0].length,term:e[0]})}if(!i.length)return;let a=e.parentElement?.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre, blockquote`)||e.parentElement,s=``,c=0;i.forEach(e=>{let n=r[e.start],i=r[e.end];if(!(n<c)&&(s+=Ny(t.slice(c,n)),s+=`<mark class="ld-local-mark" id="ld-local-match-${y++}">${Ny(t.slice(n,i))}</mark>`,c=i,a)){let t=b.get(a);t||(t=new Set,b.set(a,t)),o.forEach((n,r)=>{n.has(e.term)&&t.add(r)})}}),s+=Ny(t.slice(c));let l=document.createElement(`span`);l.innerHTML=s,e.parentNode?.replaceChild(l,e)});let x=i.length,S=[];for(let[e,t]of b.entries())t.size===x&&S.push(e);let C;if(S.length>0){let t=new Set(S);C=Array.from(e.querySelectorAll(`mark.ld-local-mark`)).filter(e=>{let n=e.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre, blockquote`)||e.parentElement;return t.has(n)})}else C=Array.from(e.querySelectorAll(`mark.ld-local-mark`));if(!C.length){d.textContent=n(`local_search.no_results`)||`No matches found.`,f.innerHTML=``,u.classList.remove(`hidden`);return}d.textContent=(C.length===1?n(`local_search.count_singular`)||`{count} match`:n(`local_search.count_plural`)||`{count} matches`).replace(`{count}`,String(C.length)),f.innerHTML=C.map((e,t)=>{let n=e.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre, blockquote`)||e.parentElement,i=(n?n.textContent||``:e.textContent||``).trim(),a=Ay(i),s=-1;for(let e of o)for(let t of e){let e=a.indexOf(t);e>=0&&(s<0||e<s)&&(s=e)}s<0&&(s=a.indexOf(r.split(` `)[0])),s<0&&(s=0);let c=Math.max(0,s-40),l=Math.min(i.length,s+80),u=(c>0?`…`:``)+i.slice(c,l)+(l<i.length?`…`:``);return`<li><button type="button" data-target="${e.id}" class="ld-local-item w-full text-left px-3 py-1.5 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors text-xs"><span class="text-gray-400 font-mono mr-2">${t+1}.</span>${Ny(u)}</button></li>`}).join(``),u.classList.remove(`hidden`),f.querySelectorAll(`.ld-local-item`).forEach(e=>{let t=e.dataset.target;t&&e.addEventListener(`click`,()=>_(t))})}function _(t){let n=document.getElementById(t),r=document.getElementById(`home-content-area`);if(!n||!r)return;let i=n.parentElement;for(;i&&i!==r;)i.tagName===`DETAILS`&&!i.open&&(i.open=!0),i=i.parentElement;e.querySelectorAll(`mark.ld-local-mark.ld-local-active`).forEach(e=>{e.classList.remove(`ld-local-active`)}),n.classList.add(`ld-local-active`),f.querySelectorAll(`.ld-local-item`).forEach(e=>{e.classList.toggle(`ld-local-item-active`,e.dataset.target===t)});let a=document.querySelector(`#home-doc-view header`),o=a?a.getBoundingClientRect().height:0,s=n.getBoundingClientRect().top,c=r.getBoundingClientRect().top,l=o+(r.clientHeight-o)/3;r.scrollTop+=s-c-l}c.addEventListener(`input`,()=>{p&&clearTimeout(p),p=window.setTimeout(()=>g(c.value.trim()),250)}),l.addEventListener(`click`,()=>{c.value=``,g(``),c.focus()}),c.addEventListener(`keydown`,e=>{e.key===`Escape`&&(c.value=``,g(``),c.blur())})}var Iy={codeLabel:`Code block.`,imageLabel:`Image: {alt}.`,diagramLabel:`Diagram.`,tableLabel:`Table.`,readCode:!1},Ly=new Set([`H1`,`H2`,`H3`,`H4`,`H5`,`H6`]);function Ry(e){return e.classList.contains(`mermaid`)||e.querySelector(`.mermaid`)!==null}function zy(e){let t=[];for(let n of e.matchAll(/[^.!?…\n]*(?:[.!?…]+|\n+|$)/g)){let e=n[0];if(e.length===0)continue;let r=e.length-e.trimStart().length,i=e.trim();if(i){let e=n.index+r;t.push({text:i,start:e,end:e+i.length})}}return t}function By(e,t){let n=(e.textContent??``).replace(/\s+/g,` `).trim();if(!n)return null;let r=zy(n);return{type:t,el:e,spokenText:n,sentences:r.length?r:[{text:n,start:0,end:n.length}],highlightWhole:!1}}function Vy(e,t,n){let r=n.trim();return r?{type:t,el:e,spokenText:r,sentences:[{text:r,start:0,end:r.length}],highlightWhole:!0}:null}function Hy(e,t,n){for(let r of Array.from(e.children)){let e=r.tagName;if(Ry(r)){Uy(n,Vy(r,`diagram`,t.diagramLabel));continue}if(e===`PRE`||e===`DIV`&&r.querySelector(`:scope > pre`)){Uy(n,t.readCode?By(r,`code`):Vy(r,`code`,t.codeLabel));continue}if(e===`TABLE`){Uy(n,Vy(r,`table`,t.tableLabel));continue}if(e===`IMG`||e===`FIGURE`&&r.querySelector(`img`)){let i=(e===`IMG`?r:r.querySelector(`img`))?.getAttribute(`alt`)?.trim()??``;Uy(n,Vy(r,`image`,t.imageLabel.includes(`{alt}`)?i?t.imageLabel.replace(`{alt}`,i):t.imageLabel.replace(/:?\s*\{alt\}/,``).trim()||`Image.`:t.imageLabel));continue}if(Ly.has(e)){Uy(n,By(r,`heading`));continue}if(e===`P`){Uy(n,By(r,`paragraph`));continue}if(e===`LI`){Uy(n,By(r,`list-item`));continue}if(e===`BLOCKQUOTE`){r.querySelector(`:scope > p, :scope > ul, :scope > ol`)?Hy(r,t,n):Uy(n,By(r,`quote`));continue}if(e===`UL`||e===`OL`||e===`DIV`||e===`SECTION`||e===`DETAILS`){Hy(r,t,n);continue}}}function Uy(e,t){t&&e.push(t)}function Wy(e,t={}){let n={...Iy,...t},r=[];return Hy(e,n,r),r}var Gy=`tts-sentence`;function Ky(){if(typeof document>`u`||document.getElementById(`tts-highlight-style`))return;let e=document.createElement(`style`);e.id=`tts-highlight-style`,e.textContent=`::highlight(${Gy}){background-color:rgba(250,204,21,0.45);color:inherit;}.dark ::highlight(${Gy}){background-color:rgba(250,204,21,0.35);}`,document.head.appendChild(e)}function qy(e,t,n){let r=[],i=!0,a=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),o=a.nextNode();for(;o;){let e=o.data;for(let t=0;t<e.length;t++)/\s/.test(e[t])?i||=(r.push({node:o,offset:t}),!0):(r.push({node:o,offset:t}),i=!1);o=a.nextNode()}if(t>=r.length)return null;let s=r[t],c=document.createRange();if(c.setStart(s.node,s.offset),n<r.length){let e=r[n];c.setEnd(e.node,e.offset)}else{let e=r[r.length-1];c.setEnd(e.node,e.offset+1)}return c}var Jy=new class{#e=P(`idle`);get status(){return V(this.#e)}set status(e){F(this.#e,e,!0)}#t=P(-1);get index(){return V(this.#t)}set index(e){F(this.#t,e,!0)}#n=P(0);get total(){return V(this.#n)}set total(e){F(this.#n,e,!0)}#r=P(null);get error(){return V(this.#r)}set error(e){F(this.#r,e,!0)}units=[];ctx=null;source=null;cache=new Map;token=0;voice;speed;language=`en`;fallbackEl=null;get active(){return this.status===`playing`||this.status===`paused`||this.status===`loading`}async start(e,t={}){this.stop();let{voice:n,speed:r,language:i,...a}=t;this.voice=n,this.speed=r,this.language=i??`en`;let o=Wy(e,a);if(this.units=o.flatMap(e=>e.highlightWhole?[{seg:e,text:e.spokenText,start:0,end:e.spokenText.length,whole:!0}]:e.sentences.map(t=>({seg:e,text:t.text,start:t.start,end:t.end,whole:!1}))),this.total=this.units.length,this.units.length===0)return;this.ctx=new AudioContext,this.error=null;let s=++this.token;this.status=`loading`,await this.playFrom(0,s)}async playFrom(e,t){if(t!==this.token)return;if(e>=this.units.length){this.stop();return}this.index=e,this.highlight(this.units[e]);let n;try{n=await this.audioFor(e)}catch(e){if(t!==this.token)return;this.error=e instanceof Error?e.message:String(e),this.stop(!1);return}if(t!==this.token||!this.ctx)return;this.prefetch(e+1);let r=this.ctx.createBufferSource();r.buffer=n,r.connect(this.ctx.destination),r.onended=()=>{t===this.token&&(this.source=null,this.playFrom(e+1,t))},this.source=r,this.status=`playing`,r.start()}audioFor(e){let t=this.cache.get(e);return t||(t=this.fetchAudio(this.units[e].text),this.cache.set(e,t)),t}prefetch(e){e<this.units.length&&!this.cache.has(e)&&this.cache.set(e,this.fetchAudio(this.units[e].text).catch(e=>Promise.reject(e)))}async fetchAudio(e){let t=await fetch(`/api/tts`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({text:e,voice:this.voice,speed:this.speed,language:this.language})});if(!t.ok){let e=`HTTP ${t.status}`;try{e=(await t.json()).error||e}catch{}throw Error(e)}let n=await t.arrayBuffer();return this.ctx?.decodeAudioData(n)}pause(){this.status===`playing`&&this.ctx&&(this.ctx.suspend(),this.status=`paused`)}resume(){this.status===`paused`&&this.ctx&&(this.ctx.resume(),this.status=`playing`)}toggle(){this.status===`playing`?this.pause():this.status===`paused`&&this.resume()}stop(e=!0){if(this.token++,this.source){try{this.source.onended=null,this.source.stop()}catch{}this.source=null}this.ctx&&=(this.ctx.close(),null),this.cache.clear(),this.clearHighlight(),this.status=`idle`,this.index=-1,this.total=0,e&&(this.error=null)}highlight(e){Ky(),this.clearHighlight();let t=typeof CSS<`u`&&`highlights`in CSS&&typeof Highlight<`u`;if(t&&!e.whole){let t=qy(e.seg.el,e.start,e.end);t?CSS.highlights.set(Gy,new Highlight(t)):this.fallbackHighlight(e.seg.el)}else if(t){let t=document.createRange();t.selectNodeContents(e.seg.el),CSS.highlights.set(Gy,new Highlight(t))}else this.fallbackHighlight(e.seg.el);e.seg.el.scrollIntoView({block:`center`,behavior:`smooth`})}fallbackHighlight(e){e.classList.add(`tts-active`),this.fallbackEl=e}clearHighlight(){typeof CSS<`u`&&`highlights`in CSS&&CSS.highlights.delete(Gy),this.fallbackEl&&=(this.fallbackEl.classList.remove(`tts-active`),null)}},Yy=Symbol.for(`yaml.alias`),Xy=Symbol.for(`yaml.document`),Zy=Symbol.for(`yaml.map`),Qy=Symbol.for(`yaml.pair`),$y=Symbol.for(`yaml.scalar`),eb=Symbol.for(`yaml.seq`),tb=Symbol.for(`yaml.node.type`),nb=e=>!!e&&typeof e==`object`&&e[tb]===Yy,rb=e=>!!e&&typeof e==`object`&&e[tb]===Xy,ib=e=>!!e&&typeof e==`object`&&e[tb]===Zy,ab=e=>!!e&&typeof e==`object`&&e[tb]===Qy,ob=e=>!!e&&typeof e==`object`&&e[tb]===$y,sb=e=>!!e&&typeof e==`object`&&e[tb]===eb;function cb(e){if(e&&typeof e==`object`)switch(e[tb]){case Zy:case eb:return!0}return!1}function lb(e){if(e&&typeof e==`object`)switch(e[tb]){case Yy:case Zy:case $y:case eb:return!0}return!1}var ub=e=>(ob(e)||cb(e))&&!!e.anchor,db=Symbol(`break visit`),fb=Symbol(`skip children`),pb=Symbol(`remove node`);function mb(e,t){let n=vb(t);rb(e)?hb(null,e.contents,n,Object.freeze([e]))===pb&&(e.contents=null):hb(null,e,n,Object.freeze([]))}mb.BREAK=db,mb.SKIP=fb,mb.REMOVE=pb;function hb(e,t,n,r){let i=yb(e,t,n,r);if(lb(i)||ab(i))return bb(e,r,i),hb(e,i,n,r);if(typeof i!=`symbol`){if(cb(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=hb(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===db)return db;else i===pb&&(t.items.splice(e,1),--e)}}else if(ab(t)){r=Object.freeze(r.concat(t));let e=hb(`key`,t.key,n,r);if(e===db)return db;e===pb&&(t.key=null);let i=hb(`value`,t.value,n,r);if(i===db)return db;i===pb&&(t.value=null)}}return i}async function gb(e,t){let n=vb(t);rb(e)?await _b(null,e.contents,n,Object.freeze([e]))===pb&&(e.contents=null):await _b(null,e,n,Object.freeze([]))}gb.BREAK=db,gb.SKIP=fb,gb.REMOVE=pb;async function _b(e,t,n,r){let i=await yb(e,t,n,r);if(lb(i)||ab(i))return bb(e,r,i),_b(e,i,n,r);if(typeof i!=`symbol`){if(cb(t)){r=Object.freeze(r.concat(t));for(let e=0;e<t.items.length;++e){let i=await _b(e,t.items[e],n,r);if(typeof i==`number`)e=i-1;else if(i===db)return db;else i===pb&&(t.items.splice(e,1),--e)}}else if(ab(t)){r=Object.freeze(r.concat(t));let e=await _b(`key`,t.key,n,r);if(e===db)return db;e===pb&&(t.key=null);let i=await _b(`value`,t.value,n,r);if(i===db)return db;i===pb&&(t.value=null)}}return i}function vb(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 yb(e,t,n,r){if(typeof n==`function`)return n(e,t,r);if(ib(t))return n.Map?.(e,t,r);if(sb(t))return n.Seq?.(e,t,r);if(ab(t))return n.Pair?.(e,t,r);if(ob(t))return n.Scalar?.(e,t,r);if(nb(t))return n.Alias?.(e,t,r)}function bb(e,t,n){let r=t[t.length-1];if(cb(r))r.items[e]=n;else if(ab(r))e===`key`?r.key=n:r.value=n;else if(rb(r))r.contents=n;else{let e=nb(r)?`alias`:`scalar`;throw Error(`Cannot replace node with ${e} parent`)}}var xb={"!":`%21`,",":`%2C`,"[":`%5B`,"]":`%5D`,"{":`%7B`,"}":`%7D`},Sb=e=>e.replace(/[!,[\]{}]/g,e=>xb[e]),Cb=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);break}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+Sb(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&&lb(e.contents)){let t={};mb(e.contents,(e,n)=>{lb(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(`
|
|
118
|
+
`)}};Cb.defaultYaml={explicit:!1,version:`1.2`},Cb.defaultTags={"!!":`tag:yaml.org,2002:`};function wb(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 Tb(e){let t=new Set;return mb(e,{Value(e,n){n.anchor&&t.add(n.anchor)}}),t}function Eb(e,t){for(let n=1;;++n){let r=`${e}${n}`;if(!t.has(r))return r}}function Db(e,t){let n=[],r=new Map,i=null;return{onAnchor:r=>{n.push(r),i||=Tb(e);let a=Eb(t,i);return i.add(a),a},setAnchors:()=>{for(let e of n){let t=r.get(e);if(typeof t==`object`&&t.anchor&&(ob(t.node)||cb(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 Ob(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=Ob(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=Ob(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=Ob(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=Ob(e,r,t,n);i===void 0?delete r[t]:i!==n&&(r[t]=i)}return e.call(t,n,r)}function kb(e,t,n){if(Array.isArray(e))return e.map((e,t)=>kb(e,String(t),n));if(e&&typeof e.toJSON==`function`){if(!n||!ub(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 Ab=class{constructor(e){Object.defineProperty(this,tb,{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(!rb(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=kb(this,``,a);if(typeof r==`function`)for(let{count:e,res:t}of a.anchors.values())r(t,e);return typeof i==`function`?Ob(i,{"":o},``,o):o}},jb=class extends Ab{constructor(e){super(Yy),this.source=e,Object.defineProperty(this,"tag",{set(){throw Error(`Alias nodes cannot have tags`)}})}resolve(e){let t;return mb(e,{Node:(e,n)=>{if(n===this)return mb.BREAK;n.anchor===this.source&&(t=n)}}),t}toJSON(e,t){if(!t)return{source:this.source};let{anchors:n,doc:r,maxAliasCount:i}=t,a=this.resolve(r);if(!a){let e=`Unresolved alias (the anchor must be set before the alias): ${this.source}`;throw ReferenceError(e)}let o=n.get(a);if(o||=(kb(a,null,t),n.get(a)),!o||o.res===void 0)throw ReferenceError(`This should not happen: Alias anchor was not resolved?`);if(i>=0&&(o.count+=1,o.aliasCount===0&&(o.aliasCount=Mb(r,a,n)),o.count*o.aliasCount>i))throw ReferenceError(`Excessive alias count indicates a resource exhaustion attack`);return o.res}toString(e,t,n){let r=`*${this.source}`;if(e){if(wb(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 Mb(e,t,n){if(nb(t)){let r=t.resolve(e),i=n&&r&&n.get(r);return i?i.count*i.aliasCount:0}else if(cb(t)){let r=0;for(let i of t.items){let t=Mb(e,i,n);t>r&&(r=t)}return r}else if(ab(t)){let r=Mb(e,t.key,n),i=Mb(e,t.value,n);return Math.max(r,i)}return 1}var Nb=e=>!e||typeof e!=`function`&&typeof e!=`object`,Pb=class extends Ab{constructor(e){super($y),this.value=e}toJSON(e,t){return t?.keep?this.value:kb(this.value,e,t)}toString(){return String(this.value)}};Pb.BLOCK_FOLDED=`BLOCK_FOLDED`,Pb.BLOCK_LITERAL=`BLOCK_LITERAL`,Pb.PLAIN=`PLAIN`,Pb.QUOTE_DOUBLE=`QUOTE_DOUBLE`,Pb.QUOTE_SINGLE=`QUOTE_SINGLE`;var Fb=`tag:yaml.org,2002:`;function Ib(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 Lb(e,t,n){if(rb(e)&&(e=e.contents),lb(e))return e;if(ab(e)){let t=n.schema[Zy].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||=i(e),new jb(c.anchor);c={anchor:null,node:null},s.set(e,c)}t?.startsWith(`!!`)&&(t=Fb+t.slice(2));let l=Ib(e,t,o.tags);if(!l){if(e&&typeof e.toJSON==`function`&&(e=e.toJSON()),!e||typeof e!=`object`){let t=new Pb(e);return c&&(c.node=t),t}l=e instanceof Map?o[Zy]:Symbol.iterator in Object(e)?o[eb]:o[Zy]}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 Pb(e);return t?u.tag=t:l.default||(u.tag=l.tag),c&&(c.node=u),u}function Rb(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 Lb(r,void 0,{aliasDuplicateObjects:!1,keepUndefined:!1,onAnchor:()=>{throw Error(`This should not happen, please report a bug.`)},schema:e,sourceObjects:new Map})}var zb=e=>e==null||typeof e==`object`&&!!e[Symbol.iterator]().next().done,Bb=class extends Ab{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=>lb(t)||ab(t)?t.clone(e):t),this.range&&(t.range=this.range.slice()),t}addIn(e,t){if(zb(e))this.add(t);else{let[n,...r]=e,i=this.get(n,!0);if(cb(i))i.addIn(r,t);else if(i===void 0&&this.schema)this.set(n,Rb(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(cb(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&&ob(i)?i.value:i:cb(i)?i.getIn(r,t):void 0}hasAllNullValues(e){return this.items.every(t=>{if(!ab(t))return!1;let n=t.value;return n==null||e&&ob(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 cb(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(cb(e))e.setIn(r,t);else if(e===void 0&&this.schema)this.set(n,Rb(this.schema,r,t));else throw Error(`Expected YAML collection at ${n}. Remaining path: ${r}`)}}},Vb=e=>e.replace(/^(?!$)(?: $)?/gm,`#`);function Hb(e,t){return/^\n+$/.test(e)?e.substring(1):t?e.replace(/^(?! *$)/gm,t):e}var Ub=(e,t,n)=>e.endsWith(`
|
|
119
|
+
`)?Hb(n,t):n.includes(`
|
|
120
120
|
`)?`
|
|
121
|
-
`+
|
|
122
|
-
`)n===`block`&&(h=
|
|
121
|
+
`+Hb(n,t):(e.endsWith(` `)?``:` `)+n,Wb=`flow`,Gb=`block`,Kb=`quoted`;function qb(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=Jb(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===`
|
|
122
|
+
`)n===`block`&&(h=Jb(e,h,t.length)),d=h+t.length+c,f=void 0;else{if(r===` `&&p&&p!==` `&&p!==`
|
|
123
123
|
`&&p!==` `){let t=e[h+1];t&&t!==` `&&t!==`
|
|
124
|
-
`&&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
|
|
125
|
-
`);r=t,i=t+1,a=e[i]}return r}var
|
|
126
|
-
`){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function
|
|
124
|
+
`&&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 Jb(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!==`
|
|
125
|
+
`);r=t,i=t+1,a=e[i]}return r}var Yb=(e,t)=>({indentAtStart:t?e.indent.length:e.indentAtStart,lineWidth:e.options.lineWidth,minContentWidth:e.options.minContentWidth}),Xb=e=>/^(%|---|\.\.\.)/m.test(e);function Zb(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]===`
|
|
126
|
+
`){if(t-n>r)return!0;if(n=t+1,i-n<=r)return!1}return!0}function Qb(e,t){let n=JSON.stringify(e);if(t.options.doubleQuotedAsJSON)return n;let{implicitKey:r}=t,i=t.options.doubleQuotedMinMultiLineLength,a=t.indent||(Xb(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)+`
|
|
127
127
|
|
|
128
128
|
`;n[e+2]===`\\`&&n[e+3]===`n`&&n[e+4]!==`"`;)o+=`
|
|
129
|
-
`,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:
|
|
130
|
-
`)||/[ \t]\n|\n[ \t]/.test(e))return
|
|
129
|
+
`,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:qb(o,a,Kb,Yb(t,!1))}function $b(e,t){if(t.options.singleQuote===!1||t.implicitKey&&e.includes(`
|
|
130
|
+
`)||/[ \t]\n|\n[ \t]/.test(e))return Qb(e,t);let n=t.indent||(Xb(e)?` `:``),r=`'`+e.replace(/'/g,`''`).replace(/\n+/g,`$&\n${n}`)+`'`;return t.implicitKey?r:qb(r,n,Wb,Yb(t,!1))}function ex(e,t){let{singleQuote:n}=t.options,r;if(n===!1)r=Qb;else{let t=e.includes(`"`),i=e.includes(`'`);r=t&&!i?$b:i&&!t?Qb:n?$b:Qb}return r(e,t)}var tx;try{tx=RegExp(`(^|(?<!
|
|
131
131
|
))
|
|
132
132
|
+(?!
|
|
133
|
-
|$)`,`g`)}catch{
|
|
133
|
+
|$)`,`g`)}catch{tx=/\n+(?!\n|$)/g}function nx({comment:e,type:t,value:n},r,i,a){let{blockQuote:o,commentString:s,lineWidth:c}=r.options;if(!o||/\n[\t ]+$/.test(n)||/^\s*$/.test(n))return ex(n,r);let l=r.indent||(r.forceBlockIndent||Xb(n)?` `:``),u=o===`literal`?!0:o===`folded`||t===Pb.BLOCK_FOLDED?!1:t===Pb.BLOCK_LITERAL?!0:!Zb(n,c,l.length);if(!n)return u?`|
|
|
134
134
|
`:`>
|
|
135
135
|
`;let d,f;for(f=n.length;f>0;--f){let e=n[f-1];if(e!==`
|
|
136
136
|
`&&e!==` `&&e!==` `)break}let p=n.substring(f),m=p.indexOf(`
|
|
137
137
|
`);m===-1?d=`-`:n===p||m!==p.length-1?(d=`+`,a&&a()):d=``,p&&=(n=n.slice(0,-p.length),p[p.length-1]===`
|
|
138
|
-
`&&(p=p.slice(0,-1)),p.replace(
|
|
138
|
+
`&&(p=p.slice(0,-1)),p.replace(tx,`$&${l}`));let h=!1,g,_=-1;for(g=0;g<n.length;++g){let e=n[g];if(e===` `)h=!0;else if(e===`
|
|
139
139
|
`)_=g;else break}let v=n.substring(0,_<g?_+1:g);v&&=(n=n.substring(v.length),v.replace(/\n+/g,`$&${l}`));let y=(u?`|`:`>`)+(h?l?`2`:`1`:``)+d;if(e&&(y+=` `+s(e.replace(/ ?[\r\n]+/g,` `)),i&&i()),u)return n=n.replace(/\n+/g,`$&${l}`),`${y}\n${l}${v}${n}${p}`;n=n.replace(/\n+/g,`
|
|
140
|
-
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`);let b=
|
|
141
|
-
`)||u&&/[[\]{},]/.test(a))return
|
|
142
|
-
`)?
|
|
143
|
-
`))return
|
|
144
|
-
`:``,v){let e=l(v);S+=`\n${
|
|
140
|
+
$&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\n+/g,`$&${l}`);let b=qb(`${v}${n}${p}`,l,Gb,Yb(r,!0));return`${y}\n${l}${b}`}function rx(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(`
|
|
141
|
+
`)||u&&/[[\]{},]/.test(a))return ex(a,t);if(!a||/^[\n\t ,[\]{}#&*!|>'"%@`]|^[?-]$|^[?-][ \t]|[\n:][ \t]|[ \t]\n|[\n\t ]#|[\n\t :]$/.test(a))return s||u||!a.includes(`
|
|
142
|
+
`)?ex(a,t):nx(e,t,n,r);if(!s&&!u&&i!==Pb.PLAIN&&a.includes(`
|
|
143
|
+
`))return nx(e,t,n,r);if(Xb(a)){if(c===``)return t.forceBlockIndent=!0,nx(e,t,n,r);if(s&&c===l)return ex(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 ex(a,t)}return s?d:qb(d,c,Wb,Yb(t,!1))}function ix(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!==Pb.QUOTE_DOUBLE&&/[\x00-\x08\x0b-\x1f\x7f-\x9f\u{D800}-\u{DFFF}]/u.test(o.value)&&(s=Pb.QUOTE_DOUBLE);let c=e=>{switch(e){case Pb.BLOCK_FOLDED:case Pb.BLOCK_LITERAL:return i||a?ex(o.value,t):nx(o,t,n,r);case Pb.QUOTE_DOUBLE:return Qb(o.value,t);case Pb.QUOTE_SINGLE:return $b(o.value,t);case Pb.PLAIN:return rx(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 ax(e,t){let n=Object.assign({blockQuote:!0,commentString:Vb,defaultKeyType:null,defaultStringType:`PLAIN`,directives:null,doubleQuotedAsJSON:!1,doubleQuotedMinMultiLineLength:40,falseStr:`false`,flowCollectionPadding:!0,indentSeq:!0,lineWidth:80,minContentWidth:20,nullStr:`null`,simpleKeys:!1,singleQuote:null,trueStr:`true`,verifyAliasOrder:!0},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 ox(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(ob(t)){r=t.value;let i=e.filter(e=>e.identify?.(r));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??typeof r;throw Error(`Tag not resolved for ${e} value`)}return n}function sx(e,t,{anchors:n,doc:r}){if(!r.directives)return``;let i=[],a=(ob(e)||cb(e))&&e.anchor;a&&wb(a)&&(n.add(a),i.push(`&${a}`));let o=e.tag?e.tag:t.default?null:t.tag;return o&&i.push(r.directives.tagString(o)),i.join(` `)}function cx(e,t,n,r){if(ab(e))return e.toString(t,n,r);if(nb(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=lb(e)?e:t.doc.createNode(e,{onTagObj:e=>i=e});i||=ox(t.doc.schema.tags,a);let o=sx(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):ob(a)?ix(a,t,n,r):a.toString(t,n,r);return o?ob(a)||s[0]===`{`||s[0]===`[`?`${o} ${s}`:`${o}\n${t.indent}${s}`:s}function lx({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=lb(e)&&e.comment||null;if(d){if(f)throw Error(`With simple keys, key nodes cannot have comments`);if(cb(e)||!lb(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||cb(e)||(ob(e)?e.type===Pb.BLOCK_FOLDED||e.type===Pb.BLOCK_LITERAL:typeof e==`object`));n=Object.assign({},n,{allNullValues:!1,implicitKey:!p&&(d||!a),indent:s+c});let m=!1,h=!1,g=cx(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+=Ub(g,n.indent,l(f)):h&&i&&i(),g;m&&(f=null),p?(f&&(g+=Ub(g,n.indent,l(f))),g=`? ${g}\n${s}:`):(g=`${g}:`,f&&(g+=Ub(g,n.indent,l(f))));let _,v,y;lb(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&&ob(t)&&(n.indentAtStart=g.length+1),h=!1,!u&&c.length>=2&&!n.inFlow&&!p&&sb(t)&&!t.flow&&!t.tag&&!t.anchor&&(n.indent=n.indent.substring(2));let b=!1,x=cx(t,n,()=>b=!0,()=>h=!0),S=` `;if(f||_||v){if(S=_?`
|
|
144
|
+
`:``,v){let e=l(v);S+=`\n${Hb(e,n.indent)}`}x===``&&!n.inFlow?S===`
|
|
145
145
|
`&&(S=`
|
|
146
146
|
|
|
147
|
-
`):S+=`\n${n.indent}`}else if(!p
|
|
147
|
+
`):S+=`\n${n.indent}`}else if(!p&&cb(t)){let e=x[0],r=x.indexOf(`
|
|
148
148
|
`),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]===`
|
|
149
|
-
`)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=
|
|
149
|
+
`)&&(S=``);return g+=S+x,n.inFlow?b&&r&&r():y&&!b?g+=Ub(g,n.indent,l(y)):h&&i&&i(),g}function ux(e,t){(e===`debug`||e===`warn`)&&(typeof process<`u`&&process.emitWarning?process.emitWarning(t):console.warn(t))}var dx=`<<`;function fx(e,t,{key:n,value:r}){if(e?.doc.schema.merge&&px(n))if(r=nb(r)?r.resolve(e.doc):r,sb(r))for(let n of r.items)mx(e,t,n);else if(Array.isArray(r))for(let n of r)mx(e,t,n);else mx(e,t,r);else{let i=kb(n,``,e);if(t instanceof Map)t.set(i,kb(r,i,e));else if(t instanceof Set)t.add(i);else{let a=hx(n,i,e),o=kb(r,a,e);a in t?Object.defineProperty(t,a,{value:o,writable:!0,enumerable:!0,configurable:!0}):t[a]=o}}return t}var px=e=>e===dx||ob(e)&&e.value===dx&&(!e.type||e.type===Pb.PLAIN);function mx(e,t,n){let r=e&&nb(n)?n.resolve(e.doc):n;if(!ib(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 hx(e,t,n){if(t===null)return``;if(typeof t!=`object`)return String(t);if(lb(e)&&n?.doc){let t=ax(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)+`..."`),ux(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 gx(e,t,n){return new _x(Lb(e,void 0,n),Lb(t,void 0,n))}var _x=class e{constructor(e,t=null){Object.defineProperty(this,tb,{value:Qy}),this.key=e,this.value=t}clone(t){let{key:n,value:r}=this;return lb(n)&&(n=n.clone(t)),lb(r)&&(r=r.clone(t)),new e(n,r)}toJSON(e,t){return fx(t,t?.mapAsMap?new Map:{},this)}toString(e,t,n){return e?.doc?lx(this,e,t,n):JSON.stringify(this)}};function vx(e,t,n){return(t.inFlow??e.flow?bx:yx)(e,t,n)}function yx({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(lb(i))!d&&i.spaceBefore&&f.push(``),xx(n,f,i.commentBefore,d),i.comment&&(o=i.comment);else if(ab(i)){let e=lb(i.key)?i.key:null;e&&(!d&&e.spaceBefore&&f.push(``),xx(n,f,e.commentBefore,d))}d=!1;let s=cx(i,u,()=>o=null,()=>d=!0);o&&(s+=Ub(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}`:`
|
|
150
150
|
`}}return e?(p+=`
|
|
151
|
-
`+
|
|
151
|
+
`+Hb(l(e),c),s&&s()):d&&o&&o(),p}function bx({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(lb(i))i.spaceBefore&&d.push(``),xx(t,d,i.commentBefore,!1),i.comment&&(a=i.comment);else if(ab(i)){let e=lb(i.key)?i.key:null;e&&(e.spaceBefore&&d.push(``),xx(t,d,e.commentBefore,!1),e.comment&&(l=!0));let n=lb(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=cx(i,c,()=>a=null);n<e.length-1&&(o+=`,`),a&&(o+=Ub(o,r,s(a))),!l&&(d.length>u||o.includes(`
|
|
152
152
|
`))&&(l=!0),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}`:`
|
|
153
|
-
`;return`${e}\n${i}${p}`}else return`${f}${o}${d.join(` `)}${o}${p}`}function
|
|
154
|
-
`:` `)}return
|
|
155
|
-
`)?(n.push(`...`),n.push(
|
|
153
|
+
`;return`${e}\n${i}${p}`}else return`${f}${o}${d.join(` `)}${o}${p}`}function xx({indent:e,options:{commentString:t}},n,r,i){if(r&&i&&(r=r.replace(/^\n+/,``)),r){let i=Hb(t(r),e);n.push(i.trimStart())}}function Sx(e,t){let n=ob(t)?t.value:t;for(let r of e)if(ab(r)&&(r.key===t||r.key===n||ob(r.key)&&r.key.value===n))return r}var Cx=class extends Bb{static get tagName(){return`tag:yaml.org,2002:map`}constructor(e){super(Zy,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(gx(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=ab(e)?e:!e||typeof e!=`object`||!(`key`in e)?new _x(e,e?.value):new _x(e.key,e.value);let r=Sx(this.items,n.key),i=this.schema?.sortMapEntries;if(r){if(!t)throw Error(`Key ${n.key} already set`);ob(r.value)&&Nb(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=Sx(this.items,e);return t?this.items.splice(this.items.indexOf(t),1).length>0:!1}get(e,t){let n=Sx(this.items,e)?.value;return(!t&&ob(n)?n.value:n)??void 0}has(e){return!!Sx(this.items,e)}set(e,t){this.add(new _x(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)fx(t,r,e);return r}toString(e,t,n){if(!e)return JSON.stringify(this);for(let e of this.items)if(!ab(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})),vx(this,e,{blockItemPrefix:``,flowChars:{start:`{`,end:`}`},itemIndent:e.indent||``,onChompKeep:n,onComment:t})}},wx={collection:`map`,default:!0,nodeClass:Cx,tag:`tag:yaml.org,2002:map`,resolve(e,t){return ib(e)||t(`Expected a mapping for this tag`),e},createNode:(e,t,n)=>Cx.from(e,t,n)},Tx=class extends Bb{static get tagName(){return`tag:yaml.org,2002:seq`}constructor(e){super(eb,e),this.items=[]}add(e){this.items.push(e)}delete(e){let t=Ex(e);return typeof t==`number`?this.items.splice(t,1).length>0:!1}get(e,t){let n=Ex(e);if(typeof n!=`number`)return;let r=this.items[n];return!t&&ob(r)?r.value:r}has(e){let t=Ex(e);return typeof t==`number`&&t<this.items.length}set(e,t){let n=Ex(e);if(typeof n!=`number`)throw Error(`Expected a valid index, not ${e}.`);let r=this.items[n];ob(r)&&Nb(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(kb(e,String(r++),t));return n}toString(e,t,n){return e?vx(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(Lb(a,void 0,n))}}return i}};function Ex(e){let t=ob(e)?e.value:e;return t&&typeof t==`string`&&(t=Number(t)),typeof t==`number`&&Number.isInteger(t)&&t>=0?t:null}var Dx={collection:`seq`,default:!0,nodeClass:Tx,tag:`tag:yaml.org,2002:seq`,resolve(e,t){return sb(e)||t(`Expected a sequence for this tag`),e},createNode:(e,t,n)=>Tx.from(e,t,n)},Ox={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),ix(e,t,n,r)}},kx={identify:e=>e==null,createNode:()=>new Pb(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^(?:~|[Nn]ull|NULL)?$/,resolve:()=>new Pb(null),stringify:({source:e},t)=>typeof e==`string`&&kx.test.test(e)?e:t.options.nullStr},Ax={identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^(?:[Tt]rue|TRUE|[Ff]alse|FALSE)$/,resolve:e=>new Pb(e[0]===`t`||e[0]===`T`),stringify({source:e,value:t},n){return e&&Ax.test.test(e)&&t===(e[0]===`t`||e[0]===`T`)?e:t?n.options.trueStr:n.options.falseStr}};function jx({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=JSON.stringify(r);if(!e&&t&&(!n||n===`tag:yaml.org,2002:float`)&&/^\d/.test(a)){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 Mx={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:jx},Nx={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():jx(e)}},Px={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 Pb(parseFloat(e)),n=e.indexOf(`.`);return n!==-1&&e[e.length-1]===`0`&&(t.minFractionDigits=e.length-n-1),t},stringify:jx},Fx=e=>typeof e==`bigint`||Number.isInteger(e),Ix=(e,t,n,{intAsBigInt:r})=>r?BigInt(e):parseInt(e.substring(t),n);function Lx(e,t,n){let{value:r}=e;return Fx(r)&&r>=0?n+r.toString(t):jx(e)}var Rx={identify:e=>Fx(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^0o[0-7]+$/,resolve:(e,t,n)=>Ix(e,2,8,n),stringify:e=>Lx(e,8,`0o`)},zx={identify:Fx,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9]+$/,resolve:(e,t,n)=>Ix(e,0,10,n),stringify:jx},Bx={identify:e=>Fx(e)&&e>=0,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^0x[0-9a-fA-F]+$/,resolve:(e,t,n)=>Ix(e,2,16,n),stringify:e=>Lx(e,16,`0x`)},Vx=[wx,Dx,Ox,kx,Ax,Rx,zx,Bx,Mx,Nx,Px];function Hx(e){return typeof e==`bigint`||Number.isInteger(e)}var Ux=({value:e})=>JSON.stringify(e),Wx=[{identify:e=>typeof e==`string`,default:!0,tag:`tag:yaml.org,2002:str`,resolve:e=>e,stringify:Ux},{identify:e=>e==null,createNode:()=>new Pb(null),default:!0,tag:`tag:yaml.org,2002:null`,test:/^null$/,resolve:()=>null,stringify:Ux},{identify:e=>typeof e==`boolean`,default:!0,tag:`tag:yaml.org,2002:bool`,test:/^true|false$/,resolve:e=>e===`true`,stringify:Ux},{identify:Hx,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})=>Hx(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:Ux}],Gx=[wx,Dx].concat(Wx,{default:!0,tag:``,test:/^/,resolve(e,t){return t(`Unresolved plain scalar ${JSON.stringify(e)}`),e}}),Kx={identify:e=>e instanceof Uint8Array,default:!1,tag:`tag:yaml.org,2002:binary`,resolve(e,t){if(typeof Buffer==`function`)return Buffer.from(e,`base64`);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}else 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){let o=n,s;if(typeof Buffer==`function`)s=o instanceof Buffer?o.toString(`base64`):Buffer.from(o.buffer).toString(`base64`);else 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||=Pb.BLOCK_LITERAL,t!==Pb.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===Pb.BLOCK_LITERAL?`
|
|
154
|
+
`:` `)}return ix({comment:e,type:t,value:s},r,i,a)}};function qx(e,t){if(sb(e))for(let n=0;n<e.items.length;++n){let r=e.items[n];if(!ab(r)){if(ib(r)){r.items.length>1&&t(`Each pair must have its own sequence indicator`);let e=r.items[0]||new _x(new Pb(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]=ab(r)?r:new _x(r)}}else t(`Expected a sequence for this tag`);return e}function Jx(e,t,n){let{replacer:r}=n,i=new Tx(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(gx(o,s,n))}return i}var Yx={collection:`seq`,default:!1,tag:`tag:yaml.org,2002:pairs`,resolve:qx,createNode:Jx},Xx=class e extends Tx{constructor(){super(),this.add=Cx.prototype.add.bind(this),this.delete=Cx.prototype.delete.bind(this),this.get=Cx.prototype.get.bind(this),this.has=Cx.prototype.has.bind(this),this.set=Cx.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(ab(e)?(r=kb(e.key,``,t),i=kb(e.value,r,t)):r=kb(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=Jx(e,t,n),i=new this;return i.items=r.items,i}};Xx.tag=`tag:yaml.org,2002:omap`;var Zx={collection:`seq`,identify:e=>e instanceof Map,nodeClass:Xx,default:!1,tag:`tag:yaml.org,2002:omap`,resolve(e,t){let n=qx(e,t),r=[];for(let{key:e}of n.items)ob(e)&&(r.includes(e.value)?t(`Ordered maps must not include duplicate keys: ${e.value}`):r.push(e.value));return Object.assign(new Xx,n)},createNode:(e,t,n)=>Xx.from(e,t,n)};function Qx({value:e,source:t},n){return t&&(e?$x:eS).test.test(t)?t:e?n.options.trueStr:n.options.falseStr}var $x={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 Pb(!0),stringify:Qx},eS={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 Pb(!1),stringify:Qx},tS={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:jx},nS={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():jx(e)}},rS={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 Pb(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:jx},iS=e=>typeof e==`bigint`||Number.isInteger(e);function aS(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}`;break}let t=BigInt(e);return i===`-`?BigInt(-1)*t:t}let a=parseInt(e,n);return i===`-`?-1*a:a}function oS(e,t,n){let{value:r}=e;if(iS(r)){let e=r.toString(t);return r<0?`-`+n+e.substr(1):n+e}return jx(e)}var sS={identify:iS,default:!0,tag:`tag:yaml.org,2002:int`,format:`BIN`,test:/^[-+]?0b[0-1_]+$/,resolve:(e,t,n)=>aS(e,2,2,n),stringify:e=>oS(e,2,`0b`)},cS={identify:iS,default:!0,tag:`tag:yaml.org,2002:int`,format:`OCT`,test:/^[-+]?0[0-7_]+$/,resolve:(e,t,n)=>aS(e,1,8,n),stringify:e=>oS(e,8,`0`)},lS={identify:iS,default:!0,tag:`tag:yaml.org,2002:int`,test:/^[-+]?[0-9][0-9_]*$/,resolve:(e,t,n)=>aS(e,0,10,n),stringify:jx},uS={identify:iS,default:!0,tag:`tag:yaml.org,2002:int`,format:`HEX`,test:/^[-+]?0x[0-9a-fA-F_]+$/,resolve:(e,t,n)=>aS(e,2,16,n),stringify:e=>oS(e,16,`0x`)},dS=class e extends Cx{constructor(t){super(t),this.tag=e.tag}add(e){let t;t=ab(e)?e:e&&typeof e==`object`&&`key`in e&&`value`in e&&e.value===null?new _x(e.key,null):new _x(e,null),Sx(this.items,t.key)||this.items.push(t)}get(e,t){let n=Sx(this.items,e);return!t&&ab(n)?ob(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=Sx(this.items,e);n&&!t?this.items.splice(this.items.indexOf(n),1):!n&&t&&this.items.push(new _x(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(gx(e,null,n));return i}};dS.tag=`tag:yaml.org,2002:set`;var fS={collection:`map`,identify:e=>e instanceof Set,nodeClass:dS,default:!1,tag:`tag:yaml.org,2002:set`,createNode:(e,t,n)=>dS.from(e,t,n),resolve(e,t){if(ib(e)){if(e.hasAllNullValues(!0))return Object.assign(new dS,e);t(`Set items must all have null values`)}else t(`Expected a mapping for this tag`);return e}};function pS(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 mS(e){let{value:t}=e,n=e=>e;if(typeof t==`bigint`)n=e=>BigInt(e);else if(isNaN(t)||!isFinite(t))return jx(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 hS={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})=>pS(e,n),stringify:mS},gS={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=>pS(e,!1),stringify:mS},_S={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(_S.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=pS(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$/,``)},vS=[wx,Dx,Ox,kx,$x,eS,sS,cS,lS,uS,tS,nS,rS,Kx,Zx,Yx,fS,hS,gS,_S],yS=new Map([[`core`,Vx],[`failsafe`,[wx,Dx,Ox]],[`json`,Gx],[`yaml11`,vS],[`yaml-1.1`,vS]]),bS={binary:Kx,bool:Ax,float:Px,floatExp:Nx,floatNaN:Mx,floatTime:gS,int:zx,intHex:Bx,intOct:Rx,intTime:hS,map:wx,null:kx,omap:Zx,pairs:Yx,seq:Dx,set:fS,timestamp:_S},xS={"tag:yaml.org,2002:binary":Kx,"tag:yaml.org,2002:omap":Zx,"tag:yaml.org,2002:pairs":Yx,"tag:yaml.org,2002:set":fS,"tag:yaml.org,2002:timestamp":_S};function SS(e,t){let n=yS.get(t);if(!n)if(Array.isArray(e))n=[];else{let e=Array.from(yS.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)n=n.concat(t);else typeof e==`function`&&(n=e(n.slice()));return n.map(e=>{if(typeof e!=`string`)return e;let t=bS[e];if(t)return t;let n=Object.keys(bS).map(e=>JSON.stringify(e)).join(`, `);throw Error(`Unknown custom tag "${e}"; use one of ${n}`)})}var CS=(e,t)=>e.key<t.key?-1:+(e.key>t.key),wS=class e{constructor({compat:e,customTags:t,merge:n,resolveKnownTags:r,schema:i,sortMapEntries:a,toStringDefaults:o}){this.compat=Array.isArray(e)?SS(e,`compat`):e?SS(null,e):null,this.merge=!!n,this.name=typeof i==`string`&&i||`core`,this.knownTags=r?xS:{},this.tags=SS(t,this.name),this.toStringOptions=o??null,Object.defineProperty(this,Zy,{value:wx}),Object.defineProperty(this,$y,{value:Ox}),Object.defineProperty(this,eb,{value:Dx}),this.sortMapEntries=typeof a==`function`?a:a===!0?CS:null}clone(){let t=Object.create(e.prototype,Object.getOwnPropertyDescriptors(this));return t.tags=this.tags.slice(),t}};function TS(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=ax(e,t),{commentString:a}=i.options;if(e.commentBefore){n.length!==1&&n.unshift(``);let t=a(e.commentBefore);n.unshift(Hb(t,``))}let o=!1,s=null;if(e.contents){if(lb(e.contents)){if(e.contents.spaceBefore&&r&&n.push(``),e.contents.commentBefore){let t=a(e.contents.commentBefore);n.push(Hb(t,``))}i.forceBlockIndent=!!e.comment,s=e.contents.comment}let t=s?void 0:()=>o=!0,c=cx(e.contents,i,()=>s=null,t);s&&(c+=Ub(c,``,a(s))),(c[0]===`|`||c[0]===`>`)&&n[n.length-1]===`---`?n[n.length-1]=`--- ${c}`:n.push(c)}else n.push(cx(e.contents,i));if(e.directives?.docEnd)if(e.comment){let t=a(e.comment);t.includes(`
|
|
155
|
+
`)?(n.push(`...`),n.push(Hb(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(Hb(a(t),``)))}return n.join(`
|
|
156
156
|
`)+`
|
|
157
|
-
`}var
|
|
158
|
-
`),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t&&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
|
|
159
|
-
`))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(
|
|
160
|
-
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||
|
|
161
|
-
`+_.comment:g.comment=_.comment);let e=new
|
|
162
|
-
`+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&
|
|
163
|
-
`+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],
|
|
164
|
-
`+_.comment:g.comment=_.comment);let y=new
|
|
165
|
-
`+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function
|
|
157
|
+
`}var ES=class e{constructor(e,t,n){this.commentBefore=null,this.comment=null,this.errors=[],this.warnings=[],Object.defineProperty(this,tb,{value:Xy});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,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 Cb({version:a}),this.setSchema(a,n),this.contents=e===void 0?null:this.createNode(e,r,n)}clone(){let t=Object.create(e.prototype,{[tb]:{value:Xy}});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=lb(this.contents)?this.contents.clone(t.schema):this.contents,this.range&&(t.range=this.range.slice()),t}add(e){DS(this.contents)&&this.contents.add(e)}addIn(e,t){DS(this.contents)&&this.contents.addIn(e,t)}createAlias(e,t){if(!e.anchor){let n=Tb(this);e.anchor=!t||n.has(t)?Eb(t||`a`,n):t}return new jb(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}=Db(this,a||`a`),p={aliasDuplicateObjects:i??!0,keepUndefined:s??!1,onAnchor:u,onTagObj:c,replacer:r,schema:this.schema,sourceObjects:f},m=Lb(e,l,p);return o&&cb(m)&&(m.flow=!0),d(),m}createPair(e,t,n={}){return new _x(this.createNode(e,null,n),this.createNode(t,null,n))}delete(e){return DS(this.contents)?this.contents.delete(e):!1}deleteIn(e){return zb(e)?this.contents==null?!1:(this.contents=null,!0):DS(this.contents)?this.contents.deleteIn(e):!1}get(e,t){return cb(this.contents)?this.contents.get(e,t):void 0}getIn(e,t){return zb(e)?!t&&ob(this.contents)?this.contents.value:this.contents:cb(this.contents)?this.contents.getIn(e,t):void 0}has(e){return cb(this.contents)?this.contents.has(e):!1}hasIn(e){return zb(e)?this.contents!==void 0:cb(this.contents)?this.contents.hasIn(e):!1}set(e,t){this.contents==null?this.contents=Rb(this.schema,[e],t):DS(this.contents)&&this.contents.set(e,t)}setIn(e,t){zb(e)?this.contents=t:this.contents==null?this.contents=Rb(this.schema,Array.from(e),t):DS(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 Cb({version:`1.1`}),n={merge:!0,resolveKnownTags:!1,schema:`yaml-1.1`};break;case`1.2`:case`next`:this.directives?this.directives.yaml.version=e:this.directives=new Cb({version:e}),n={merge:!1,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 wS(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=kb(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`?Ob(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 TS(this,e)}};function DS(e){if(cb(e))return!0;throw Error(`Expected a YAML collection as document contents`)}var OS=class extends Error{constructor(e,t,n,r){super(),this.name=e,this.code=n,this.message=r,this.pos=t}},kS=class extends OS{constructor(e,t,n){super(`YAMLParseError`,e,t,n)}},AS=class extends OS{constructor(e,t,n){super(`YAMLWarning`,e,t,n)}},jS=(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)+`…
|
|
158
|
+
`),o=n+o}if(/[^ ]/.test(o)){let e=1,t=n.linePos[1];t&&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 MS(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: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===null&&(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===null&&(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],C=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:C,start:x??C}}function NS(e){if(!e)return null;switch(e.type){case`alias`:case`scalar`:case`double-quoted-scalar`:case`single-quoted-scalar`:if(e.source.includes(`
|
|
159
|
+
`))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(NS(t.key)||NS(t.value))return!0}return!1;default:return!0}}function PS(e,t,n){if(t?.type===`flow-collection`){let r=t.end[0];r.indent===e&&(r.source===`]`||r.source===`}`)&&NS(t)&&n(r,`BAD_INDENT`,`Flow end indicator should be more indented than parent`,!0)}}function FS(e,t,n){let{uniqueKeys:r}=e.options;if(r===!1)return!1;let i=typeof r==`function`?r:(t,n)=>t===n||ob(t)&&ob(n)&&t.value===n.value&&!(t.value===`<<`&&e.schema.merge);return t.some(e=>i(e.key,n))}var IS=`All mapping items must start at the same column`;function LS({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??Cx)(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=MS(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`,IS)),!p.anchor&&!p.tag&&!d){c=p.end,p.comment&&(o.comment?o.comment+=`
|
|
160
|
+
`+p.comment:o.comment=p.comment);continue}(p.newlineAfterProp||NS(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`,IS);let h=p.end,g=u?e(n,u,p,i):t(n,h,l,null,p,i);n.schema.compat&&PS(r.indent,u,i),FS(n,o.items,g)&&i(h,`DUPLICATE_KEY`,`Map keys must be unique`);let _=MS(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&&PS(r.indent,f,i),s=c.range[2];let l=new _x(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+=`
|
|
161
|
+
`+_.comment:g.comment=_.comment);let e=new _x(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 RS({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=new((a?.nodeClass)??Tx)(n.schema);n.atRoot&&=!1;let s=r.offset,c=null;for(let{start:a,value:l}of r.items){let u=MS(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&&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&&PS(r.indent,l,i),s=d.range[2],o.items.push(d)}return o.range=[r.offset,s,c??s],o}function zS(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 BS=`Block collections are not allowed within flow collections`,VS=e=>e&&(e.type===`block-map`||e.type===`block-seq`);function HS({composeNode:e,composeEmptyNode:t},n,r,i,a){let o=r.start.source===`{`,s=o?`flow map`:`flow sequence`,c=new((a?.nodeClass)??(o?Cx:Tx))(n.schema);c.flow=!0;let l=n.atRoot;l&&(n.atRoot=!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=MS(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+=`
|
|
162
|
+
`+h.comment:c.comment=h.comment),u=h.end;continue}!o&&n.options.strict&&NS(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];ab(t)&&(t=t.value??t.key),t.comment?t.comment+=`
|
|
163
|
+
`+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],VS(m)&&i(r.range,`BLOCK_IN_FLOW`,BS)}else{let a=h.end,g=f?e(n,f,h,i):t(n,a,d,null,h,i);VS(f)&&i(g.range,`BLOCK_IN_FLOW`,BS);let _=MS(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&&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?VS(m)&&i(v.range,`BLOCK_IN_FLOW`,BS):_.comment&&(g.comment?g.comment+=`
|
|
164
|
+
`+_.comment:g.comment=_.comment);let y=new _x(g,v);if(n.options.keepSourceTokens&&(y.srcToken=l),o){let e=c;FS(n,e.items,g)&&i(a,`DUPLICATE_KEY`,`Map keys must be unique`),e.items.push(y)}else{let e=new Cx(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&&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=zS(p,m,n.options.strict,i);e.comment&&(c.comment?c.comment+=`
|
|
165
|
+
`+e.comment:c.comment=e.comment),c.range=[r.offset,m,e.offset]}else c.range=[r.offset,m,m];return c}function US(e,t,n,r,i,a){let o=n.type===`block-map`?LS(e,t,n,r,a):n.type===`block-seq`?RS(e,t,n,r,a):HS(e,t,n,r,a),s=o.constructor;return i===`!`||i===s.tagName?(o.tag=s.tagName,o):(i&&(o.tag=i),o)}function WS(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===Cx.tagName&&s===`map`||o===Tx.tagName&&s===`seq`)return US(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&&r.collection===s)t.schema.tags.push(Object.assign({},r,{default:!1})),c=r;else return r?.collection?i(a,`BAD_COLLECTION_TYPE`,`${r.tag} used for ${s} collection, but expects ${r.collection}`,!0):i(a,`TAG_RESOLVE_FAILED`,`Unresolved tag: ${o}`,!0),US(e,t,n,i,o)}let l=US(e,t,n,i,o,c),u=c.resolve?.(l,e=>i(a,`TAG_RESOLVE_FAILED`,e),t.options)??l,d=lb(u)?u:new Pb(u);return d.range=l.range,d.tag=o,c?.format&&(d.format=c.format),d}function GS(e,t,n){let r=t.offset,i=KS(t,e.options.strict,n);if(!i)return{value:``,type:null,comment:``,range:[r,r,r]};let a=i.mode===`>`?Pb.BLOCK_FOLDED:Pb.BLOCK_LITERAL,o=t.source?qS(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?`
|
|
166
166
|
`.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)+`
|
|
167
|
-
`;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===
|
|
167
|
+
`;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===Pb.BLOCK_LITERAL?(d+=f+t.slice(c)+r,f=`
|
|
168
168
|
`):t.length>c||r[0]===` `?(f===` `?f=`
|
|
169
169
|
`:!p&&f===`
|
|
170
170
|
`&&(f=`
|
|
@@ -177,51 +177,51 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
177
177
|
`+o[e][0].slice(c);d[d.length-1]!==`
|
|
178
178
|
`&&(d+=`
|
|
179
179
|
`);break;default:d+=`
|
|
180
|
-
`}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function
|
|
180
|
+
`}let m=r+i.length+t.source.length;return{value:d,type:a,comment:i.comment,range:[r,m,m]}}function KS({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 qS(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 JS(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=Pb.PLAIN,c=YS(a,l);break;case`single-quoted-scalar`:s=Pb.QUOTE_SINGLE,c=XS(a,l);break;case`double-quoted-scalar`:s=Pb.QUOTE_DOUBLE,c=QS(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=zS(o,u,t,n);return{value:c,type:s,comment:d.comment,range:[r,u,d.offset]}}function YS(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]}`;break}return n&&t(0,`BAD_SCALAR_START`,`Plain value cannot start with ${n}`),ZS(e)}function XS(e,t){return(e[e.length-1]!==`'`||e.length===1)&&t(e.length,`MISSING_CHAR`,`Missing closing 'quote`),ZS(e.slice(1,-1)).replace(/''/g,`'`)}function ZS(e){let t,n;try{t=RegExp(`(.*?)(?<![ ])[ ]*\r?
|
|
181
181
|
`,`sy`),n=RegExp(`[ ]*(.*?)(?:(?<![ ])[ ]*)?\r?
|
|
182
182
|
`,`sy`)}catch{t=/(.*?)[ \t]*\r?\n/sy,n=/[ \t]*(.*?)[ \t]*\r?\n/sy}let r=t.exec(e);if(!r)return e;let i=r[1],a=` `,o=t.lastIndex;for(n.lastIndex=o;r=n.exec(e);)r[1]===``?a===`
|
|
183
183
|
`?i+=a:a=`
|
|
184
|
-
`:(i+=a+r[1],a=` `),o=n.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,r=s.exec(e),i+a+(r?.[1]??``)}function
|
|
184
|
+
`:(i+=a+r[1],a=` `),o=n.lastIndex;let s=/[ \t]*(.*)/sy;return s.lastIndex=o,r=s.exec(e),i+a+(r?.[1]??``)}function QS(e,t){let n=``;for(let r=1;r<e.length-1;++r){let i=e[r];if(!(i===`\r`&&e[r+1]===`
|
|
185
185
|
`))if(i===`
|
|
186
|
-
`){let{fold:t,offset:i}
|
|
186
|
+
`){let{fold:t,offset:i}=$S(e,r);n+=t,r=i}else if(i===`\\`){let i=e[++r],a=eC[i];if(a)n+=a;else if(i===`
|
|
187
187
|
`)for(i=e[r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`\r`&&e[r+1]===`
|
|
188
|
-
`)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a={x:2,u:4,U:8}[i];n+=
|
|
188
|
+
`)for(i=e[++r+1];i===` `||i===` `;)i=e[++r+1];else if(i===`x`||i===`u`||i===`U`){let a={x:2,u:4,U:8}[i];n+=tC(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!==`
|
|
189
189
|
`&&!(a===`\r`&&e[r+2]===`
|
|
190
|
-
`)&&(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
|
|
190
|
+
`)&&(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 $S(e,t){let n=``,r=e[t+1];for(;(r===` `||r===` `||r===`
|
|
191
191
|
`||r===`\r`)&&!(r===`\r`&&e[t+2]!==`
|
|
192
192
|
`);)r===`
|
|
193
193
|
`&&(n+=`
|
|
194
|
-
`),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var
|
|
195
|
-
`,r:`\r`,t:` `,v:`\v`,N:`
`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function
|
|
194
|
+
`),t+=1,r=e[t+1];return n||=` `,{fold:n,offset:t}}var eC={0:`\0`,a:`\x07`,b:`\b`,e:`\x1B`,f:`\f`,n:`
|
|
195
|
+
`,r:`\r`,t:` `,v:`\v`,N:`
`,_:`\xA0`,L:`\u2028`,P:`\u2029`," ":` `,'"':`"`,"/":`/`,"\\":`\\`," ":` `};function tC(e,t,n,r){let i=e.substr(t,n),a=i.length===n&&/^[0-9a-fA-F]+$/.test(i)?parseInt(i,16):NaN;if(isNaN(a)){let i=e.substr(t-2,n+2);return r(t-2,`BAD_DQ_ESCAPE`,`Invalid escape sequence ${i}`),i}return String.fromCodePoint(a)}function nC(e,t,n,r){let{value:i,type:a,comment:o,range:s}=t.type===`block-scalar`?GS(e,t,r):JS(t,e.options.strict,r),c=n?e.directives.tagName(n.source,e=>r(n,`TAG_RESOLVE_FAILED`,e)):null,l=n&&c?rC(e.schema,i,c,n,r):t.type===`scalar`?iC(e,i,t,r):e.schema[$y],u;try{let a=l.resolve(i,e=>r(n??t,`TAG_RESOLVE_FAILED`,e),e.options);u=ob(a)?a:new Pb(a)}catch(e){let a=e instanceof Error?e.message:String(e);r(n??t,`TAG_RESOLVE_FAILED`,a),u=new Pb(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 rC(e,t,n,r,i){if(n===`!`)return e[$y];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[$y])}function iC({directives:e,schema:t},n,r,i){let a=t.tags.find(e=>e.default&&e.test?.test(n))||t[$y];if(t.compat){let o=t.compat.find(e=>e.default&&e.test?.test(n))??t[$y];a.tag!==o.tag&&i(r,`TAG_RESOLVE_FAILED`,`Value may be parsed as either ${e.tagString(a.tag)} or ${e.tagString(o.tag)}`,!0)}return a}function aC(e,t,n){if(t){n===null&&(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 oC={composeNode:sC,composeEmptyNode:cC};function sC(e,t,n,r){let{spaceBefore:i,comment:a,anchor:o,tag:s}=n,c,l=!0;switch(t.type){case`alias`:c=lC(e,t,r),(o||s)&&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`:c=nC(e,t,s,r),o&&(c.anchor=o.source.substring(1));break;case`block-map`:case`block-seq`:case`flow-collection`:c=WS(oC,e,t,n,r),o&&(c.anchor=o.source.substring(1));break;default:r(t,`UNEXPECTED_TOKEN`,t.type===`error`?t.message:`Unsupported token (type: ${t.type})`),c=cC(e,t.offset,void 0,null,n,r),l=!1}return o&&c.anchor===``&&r(o,`BAD_ALIAS`,`Anchor cannot be an empty string`),i&&(c.spaceBefore=!0),a&&(t.type===`scalar`&&t.source===``?c.comment=a:c.commentBefore=a),e.options.keepSourceTokens&&l&&(c.srcToken=t),c}function cC(e,t,n,r,{spaceBefore:i,comment:a,anchor:o,tag:s,end:c},l){let u=nC(e,{type:`scalar`,offset:aC(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 lC({options:e},{offset:t,source:n,end:r},i){let a=new jb(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=zS(r,o,e.strict,i);return a.range=[t,o,s.offset],s.comment&&(a.comment=s.comment),a}function uC(e,t,{offset:n,start:r,value:i,end:a},o){let s=new ES(void 0,Object.assign({_directives:t},e)),c={atRoot:!0,directives:s.directives,options:s.options,schema:s.schema},l=MS(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?sC(c,i,l,o):cC(c,l.end,r,null,l,o);let u=s.contents.range[2],d=zS(a,u,!1,o);return d.comment&&(s.comment=d.comment),s.range=[n,u,d.offset],s}function dC(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 fC(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?`
|
|
196
196
|
|
|
197
197
|
`:`
|
|
198
|
-
`)+(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
|
|
198
|
+
`)+(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 pC=class{constructor(e={}){this.doc=null,this.atDirectives=!1,this.prelude=[],this.errors=[],this.warnings=[],this.onError=(e,t,n,r)=>{let i=dC(e);r?this.warnings.push(new AS(i,t,n)):this.errors.push(new kS(i,t,n))},this.directives=new Cb({version:e.version||`1.2`}),this.options=e}decorate(e,t){let{comment:n,afterEmptyLine:r}=fC(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(cb(i)&&!i.flow&&i.items.length>0){let e=i.items[0];ab(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}}t?(Array.prototype.push.apply(e.errors,this.errors),Array.prototype.push.apply(e.warnings,this.warnings)):(e.errors=this.errors,e.warnings=this.warnings),this.prelude=[],this.errors=[],this.warnings=[]}streamInfo(){return{comment:fC(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=dC(e);i[0]+=t,this.onError(i,`BAD_DIRECTIVE`,n,r)}),this.prelude.push(e.source),this.atDirectives=!0;break;case`document`:{let t=uC(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 kS(dC(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 kS(dC(e),`UNEXPECTED_TOKEN`,`Unexpected doc-end without preceding document`));break}this.doc.directives.docEnd=!0;let t=zS(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 kS(dC(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 ES(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}}},mC=Symbol(`break visit`),hC=Symbol(`skip children`),gC=Symbol(`remove item`);function _C(e,t){`type`in e&&e.type===`document`&&(e={start:e.start,value:e.value}),vC(Object.freeze([]),e,t)}_C.BREAK=mC,_C.SKIP=hC,_C.REMOVE=gC,_C.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},_C.parentCollection=(e,t)=>{let n=_C.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 vC(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=vC(Object.freeze(e.concat([[i,t]])),a.items[t],n);if(typeof r==`number`)t=r-1;else if(r===mC)return mC;else r===gC&&(a.items.splice(t,1),--t)}typeof r==`function`&&i===`key`&&(r=r(t,e))}}return typeof r==`function`?r(t,e):r}function yC(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`
|
|
199
199
|
`:case`\r
|
|
200
|
-
`: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
|
|
201
|
-
`:case`\r`:case` `:return!0;default:return!1}}var
|
|
202
|
-
\r `),
|
|
200
|
+
`: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 bC(e){switch(e){case void 0:case` `:case`
|
|
201
|
+
`:case`\r`:case` `:return!0;default:return!1}}var xC=new Set(`0123456789ABCDEFabcdef`),SC=new Set(`0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz-#;/?:@&=+$_.!~*'()`),CC=new Set(`,[]{}`),wC=new Set(` ,[]{}
|
|
202
|
+
\r `),TC=e=>!e||wC.has(e),EC=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===`
|
|
203
203
|
`?!0:t===`\r`?this.buffer[e+1]===`
|
|
204
204
|
`:!1}charAt(e){return this.buffer[this.pos+e]}continueScalar(e){let t=this.buffer[e];if(this.indentNext>0){let n=0;for(;t===` `;)t=this.buffer[++n+e];if(t===`\r`){let t=this.buffer[n+e+1];if(t===`
|
|
205
205
|
`||!t&&!this.atEnd)return e+n+1}return t===`
|
|
206
|
-
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&
|
|
207
|
-
`,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}else 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===`...`)&&
|
|
206
|
+
`||n>=this.indentNext||!t&&!this.atEnd?e+n:-1}if(t===`-`||t===`.`){let t=this.buffer.substr(e,3);if((t===`---`||t===`...`)&&bC(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(`
|
|
207
|
+
`,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}else 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===`...`)&&bC(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&&!bC(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===`:`)&&bC(t)){let e=(yield*this.pushCount(1))+(yield*this.pushSpaces(!0));return this.indentNext=this.indentValue+1,this.indentValue+=e,yield*this.parseBlockStart()}return`doc`}*parseDocument(){yield*this.pushSpaces(!0);let e=this.getLine();if(e===null)return this.setNext(`doc`);let t=yield*this.pushIndicators();switch(e[t]){case`#`:yield*this.pushCount(e.length-t);case void 0:return yield*this.pushNewline(),yield*this.parseLineStart();case`{`:case`[`:return yield*this.pushCount(1),this.flowKey=!1,this.flowLevel=1,`flow`;case`}`:case`]`:return yield*this.pushCount(1),`doc`;case`*`:return yield*this.pushUntil(TC),`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(`...`))&&bC(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(TC),`flow`;case`"`:case`'`:return this.flowKey=!0,yield*this.parseQuotedScalar();case`:`:{let e=this.charAt(1);if(this.flowKey||bC(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(`
|
|
208
208
|
`,this.pos);if(r!==-1){for(;r!==-1;){let e=this.continueScalar(r+1);if(e===-1)break;r=n.indexOf(`
|
|
209
|
-
`,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=>
|
|
209
|
+
`,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=>bC(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`
|
|
210
210
|
`:e=r,t=0;break;case`\r`:{let e=this.buffer[r+1];if(!e&&!this.atEnd)return this.setNext(`block-scalar`);if(e===`
|
|
211
211
|
`)break}default:break loop}if(!n&&!this.atEnd)return this.setNext(`block-scalar`);if(t>=this.indentNext){this.blockScalarIndent===-1?this.indentNext=t:this.indentNext=this.blockScalarIndent+(this.indentNext===0?1:this.indentNext);do{let t=this.continueScalar(e+1);if(t===-1)break;e=this.buffer.indexOf(`
|
|
212
212
|
`,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===`
|
|
213
213
|
`;)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===`
|
|
214
|
-
`&&n>=this.pos&&n+1+t>i)e=n;else break}while(!0);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(
|
|
214
|
+
`&&n>=this.pos&&n+1+t>i)e=n;else break}while(!0);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(bC(r)||e&&CC.has(r))break;t=n}else if(bC(r)){let i=this.buffer[n+1];if(r===`\r`&&(i===`
|
|
215
215
|
`?(n+=1,r=`
|
|
216
|
-
`,i=this.buffer[n+1]):t=n),i===`#`||e&&
|
|
217
|
-
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&
|
|
216
|
+
`,i=this.buffer[n+1]):t=n),i===`#`||e&&CC.has(i))break;if(r===`
|
|
217
|
+
`){let e=this.continueScalar(n+1);if(e===-1)break;n=Math.max(n,e-2)}}else{if(e&&CC.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(){switch(this.charAt(0)){case`!`:return(yield*this.pushTag())+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case`&`:return(yield*this.pushUntil(TC))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators());case`-`:case`?`:case`:`:{let e=this.flowLevel>0,t=this.charAt(1);if(bC(t)||e&&CC.has(t))return e?this.flowKey&&=!1:this.indentNext=this.indentValue+1,(yield*this.pushCount(1))+(yield*this.pushSpaces(!0))+(yield*this.pushIndicators())}}return 0}*pushTag(){if(this.charAt(1)===`<`){let e=this.pos+2,t=this.buffer[e];for(;!bC(t)&&t!==`>`;)t=this.buffer[++e];return yield*this.pushToIndex(t===`>`?e+1:e,!1)}else{let e=this.pos+1,t=this.buffer[e];for(;t;)if(SC.has(t))t=this.buffer[++e];else if(t===`%`&&xC.has(this.buffer[e+1])&&xC.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===`
|
|
218
218
|
`?yield*this.pushCount(1):e===`\r`&&this.charAt(1)===`
|
|
219
|
-
`?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)}},
|
|
219
|
+
`?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)}},DC=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 OC(e,t){for(let n=0;n<e.length;++n)if(e[n].type===t)return!0;return!1}function kC(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 AC(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 jC(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 MC(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 NC(e){if(e.start.type===`flow-seq-start`)for(let t of e.items)t.sep&&!t.value&&!OC(t.start,`explicit-key-ind`)&&!OC(t.sep,`map-value-ind`)&&(t.key&&(t.value=t.key),delete t.key,AC(t.value)?t.value.end?Array.prototype.push.apply(t.value.end,t.sep):t.value.end=t.sep:Array.prototype.push.apply(t.start,t.sep),delete t.sep)}var PC=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 EC,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=yC(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||e.type!==`doc-end`)){for(;this.stack.length>0;)yield*this.pop();this.stack.push({type:`doc-end`,offset:this.offset,source:this.source});return}if(!e)return yield*this.stream();switch(e.type){case`document`:return yield*this.document(e);case`alias`:case`scalar`:case`single-quoted-scalar`:case`double-quoted-scalar`:return yield*this.scalar(e);case`block-scalar`:return yield*this.blockScalar(e);case`block-map`:return yield*this.blockMap(e);case`block-seq`:return yield*this.blockSequence(e);case`flow-collection`:return yield*this.flowCollection(e);case`doc-end`:return yield*this.documentEnd(e)}yield*this.pop()}peek(e){return this.stack[this.stack.length-e]}*pop(e){let t=e??this.stack.pop();if(!t)yield{type:`error`,offset:this.offset,source:``,message:`Tried to pop an empty stack`};else if(this.stack.length===0)yield t;else{let 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`&&NC(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}else if(n.sep)n.value=t;else{Object.assign(n,{key:t,sep:[]}),this.onKeyLine=!n.explicitKey;return}break}case`block-seq`:{let n=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&&kC(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`:kC(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=MC(jC(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(`
|
|
220
220
|
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
221
|
-
`,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)){Array.prototype.push.apply(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let 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(
|
|
221
|
+
`,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)){Array.prototype.push.apply(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return}if(this.indent>=e.indent){let 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(OC(t.start,`newline`))Object.assign(t,{key:null,sep:[this.sourceToken]});else{let e=MC(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(OC(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(AC(t.key)&&!OC(t.sep,`newline`)){let e=MC(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]}):OC(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 t=this.startBlockValue(e);if(t){n&&t.type!==`block-seq`&&e.items.push({start:i}),this.stack.push(t);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)){Array.prototype.push.apply(n,t.start),n.push(this.sourceToken),e.items.pop();return}}t.start.push(this.sourceToken)}return;case`anchor`:case`tag`:if(t.value||this.indent<=e.indent)break;t.start.push(this.sourceToken);return;case`seq-item-ind`:if(this.indent!==e.indent)break;t.value||OC(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&&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=MC(jC(t));NC(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(`
|
|
222
222
|
`)+1;for(;e!==0;)this.onNewLine(this.offset+e),e=this.source.indexOf(`
|
|
223
|
-
`,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=
|
|
224
|
-
`)}\n---\n`+e.slice(r.length)}var HC=e=>e.normalize(`NFC`).normalize(`NFD`).replace(/[̀-ͯ]/g,``).toLowerCase();function UC(e,t){let n=HC(t);if(!n)return[];let r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),i=[];for(;r.nextNode();)i.push(r.currentNode);let a=0;i.forEach(e=>{let t=(e.textContent||``).normalize(`NFC`),r=HC(t);if(!r.includes(n))return;let i=``,o=0;for(;o<=r.length;){let e=r.indexOf(n,o);if(e===-1){i+=t.slice(o);break}i+=t.slice(o,e),i+=`<mark id="match-${a++}">${t.slice(e,e+n.length)}</mark>`,o=e+n.length}let s=document.createElement(`span`);s.innerHTML=i,e.parentNode?.replaceChild(s,e)});let o=[];return e.querySelectorAll(`mark[id^='match-']`).forEach(e=>{let r=((e.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre`)||e.parentElement).textContent||``).trim(),i=HC(r).indexOf(n),a=Math.max(0,i-40),s=Math.min(r.length,i+t.length+40),c=(a>0?`…`:``)+r.slice(a,s)+(s<r.length?`…`:``);o.push({id:e.id,snippet:c})}),o}function WC(e){let t=document.getElementById(e),n=document.getElementById(`home-content-area`);if(!t||!n)return;let r=t.parentElement;for(;r&&r!==n;)r.tagName===`DETAILS`&&!r.open&&(r.open=!0),r=r.parentElement;document.querySelectorAll(`mark.match-active`).forEach(e=>{e.classList.remove(`match-active`)}),t.classList.add(`match-active`);let i=document.querySelector(`#home-doc-view header`),a=i?i.getBoundingClientRect().height:0,o=t.getBoundingClientRect().top,s=n.getBoundingClientRect().top,c=a+(n.clientHeight-a)/3;n.scrollTop+=o-s-c}var GC=U(`<span class="inline-block text-xs font-semibold px-2.5 py-0.5 rounded-full bg-violet-100 text-violet-700 dark:bg-violet-900/40 dark:text-violet-300"> </span>`),KC=U(`<span class="text-xs text-gray-400 dark:text-gray-500"> </span>`),qC=U(`<button type="button" data-testid="copy-doc-id-btn"><i aria-hidden="true"></i></button>`),JC=U(`<span class="inline-block text-[11px] px-2 py-0.5 rounded-full bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400 border border-gray-200 dark:border-gray-700"> </span>`),YC=U(`<div class="mt-1.5 flex items-center gap-1.5 flex-wrap" data-testid="doc-tags"></div>`),XC=U(`<span> </span>`),ZC=U(`<div data-testid="edit-actions" class="flex items-center gap-2"><!> <button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-1.5 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div>`),QC=U(`<button data-testid="validate-btn" class="no-print text-sm px-3 py-1.5 rounded-lg border border-green-700 bg-green-600 text-white font-semibold hover:bg-green-700 transition-colors"><i class="fa-solid fa-check" style="margin-right:4px"></i> </button>`),$C=U(`<button data-testid="tts-toggle" class="no-print text-sm px-3 py-1.5 rounded-lg border border-blue-300 dark:border-blue-700 bg-blue-50 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400 hover:bg-blue-100 dark:hover:bg-blue-900/50 transition-colors"><i></i></button> <button data-testid="tts-stop" class="no-print text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors"><i class="fa-solid fa-stop"></i></button>`,1),ew=U(`<button data-testid="tts-play" class="no-print text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors"><i class="fa-solid fa-headphones" style="margin-right:4px"></i> </button>`),tw=Hr(`<g><line x1="8" y1="8" x2="92" y2="92" stroke="currentColor" stroke-width="8" stroke-linecap="round"></line><line x1="92" y1="8" x2="8" y2="92" stroke="currentColor" stroke-width="8" stroke-linecap="round"></line></g>`),nw=U(`<button data-testid="versions-btn" class="no-print text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors"><i class="fa-solid fa-code-branch"></i> </button>`),rw=U(`<!> <button data-testid="marker-doc-btn"><svg width="18" height="18" viewBox="0 0 100 100" fill="none" style="display:inline-block;vertical-align:middle;margin-right:4px"><rect x="28" y="10" width="44" height="52" rx="6" transform="rotate(40 50 50)" stroke="currentColor" stroke-width="6"></rect><rect x="52" y="8" width="22" height="30" rx="6" transform="rotate(40 50 50)" stroke="currentColor" stroke-width="6"></rect><polygon points="28,60 10,80 30,80 38,72" stroke="currentColor" stroke-width="5" stroke-linejoin="round"></polygon><polygon points="28,48 19,70 36,75 55,70" stroke="currentColor" stroke-width="5" stroke-linejoin="round"></polygon><line x1="10" y1="90" x2="72" y2="90" stroke="currentColor" stroke-width="6" stroke-linecap="round"></line><!></svg> </button> <button data-testid="export-pdf-btn" class="no-print text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors"> </button> <button data-testid="metadata-btn" class="no-print text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors"><i class="fa-solid fa-code-compare"></i> </button> <!> <button data-testid="edit-doc-btn" class="no-print text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors"><i class="fa-solid fa-file-pen"></i> </button>`,1),iw=U(`<button data-testid="kanban-edit-columns" class="no-print text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors"><i class="fa-solid fa-gear"></i> </button>`),aw=U(`<button data-testid="toc-toggle-btn"><i class="fa-solid fa-list-ul"></i></button>`),ow=U(`<div data-testid="view-actions" class="flex items-center gap-2"><button data-testid="favorite-doc-btn"><i style="margin-right:4px"></i> </button> <!> <!> <!> <button data-testid="delete-doc-btn" class="no-print text-sm px-3 py-1.5 rounded-lg border border-red-200 dark:border-red-700 text-red-500 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/40 transition-colors"><i class="fa-solid fa-trash"></i> </button> <!></div>`),sw=U(`<span class="text-gray-300 dark:text-gray-600 mx-1">·</span>`),cw=U(`<!> <button class="text-blue-600 dark:text-blue-400 hover:underline"> </button>`,1),lw=U(`<div class="no-print mt-2 flex flex-wrap gap-1 text-xs"></div>`),uw=U(`<li><button class="w-full text-left px-3 py-1.5 hover:bg-yellow-100 dark:hover:bg-yellow-900/30 transition-colors"><span class="text-yellow-600 dark:text-yellow-500 font-mono text-xs mr-2"> </span><span class="text-xs"> </span></button></li>`),dw=U(`<div class="mt-4 rounded-lg bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 text-sm text-yellow-800 dark:text-yellow-300 overflow-hidden"><div class="px-3 py-2 font-medium border-b border-yellow-200 dark:border-yellow-800"> </div> <ol class="max-h-40 overflow-y-auto divide-y divide-yellow-100 dark:divide-yellow-900/40 list-none m-0 p-0"></ol></div>`),fw=U(`<div data-testid="tts-error" class="mt-4 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-800 dark:bg-red-900/20 dark:text-red-300"> </div>`),pw=U(`<div class="hidden no-print"></div>`),mw=U(`<li class="m-0 p-0"><button type="button" class="block w-full text-left bg-transparent border-0 cursor-pointer text-xs text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 hover:underline py-0.5 leading-snug transition-colors truncate"> </button></li>`),hw=U(`<div></div> <aside class="no-print shrink-0 sticky self-start overflow-y-auto py-8 pr-4 pl-3 ld-toc-aside"><p class="text-xs font-semibold uppercase tracking-wider text-gray-400 dark:text-gray-500 mb-3"> </p> <nav><ul class="space-y-1 list-none m-0 p-0"></ul></nav></aside>`,1),gw=U(`<div data-testid="tts-language-modal" class="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4"><div class="w-full max-w-sm rounded-xl border border-gray-200 bg-white p-5 shadow-2xl dark:border-gray-700 dark:bg-gray-900"><h2 class="text-base font-semibold text-gray-900 dark:text-gray-50"> </h2> <p class="mt-2 text-sm text-gray-600 dark:text-gray-300"> </p> <div class="mt-4 grid grid-cols-2 gap-2"><button type="button" data-testid="tts-language-en" class="rounded-lg border border-gray-200 px-3 py-2 text-sm font-semibold text-gray-700 transition-colors hover:bg-gray-50 disabled:opacity-50 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-800"> </button> <button type="button" data-testid="tts-language-fr" class="rounded-lg border border-gray-200 px-3 py-2 text-sm font-semibold text-gray-700 transition-colors hover:bg-gray-50 disabled:opacity-50 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-800"> </button></div> <div class="mt-3 flex justify-end"><button type="button" class="rounded-lg border border-gray-200 px-3 py-1.5 text-sm text-gray-600 transition-colors hover:bg-gray-50 disabled:opacity-50 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800"> </button></div></div></div>`),_w=U(`<div class="fixed inset-0 z-50 bg-black/50 flex items-center justify-center p-4"><div class="w-full max-w-sm bg-white dark:bg-gray-900 border border-red-200 dark:border-red-700 rounded-xl shadow-2xl p-5 flex flex-col gap-3"><p class="text-sm text-gray-700 dark:text-gray-200"> </p> <p class="text-xs text-gray-500 dark:text-gray-400 italic truncate"> </p> <div class="flex justify-end gap-2 mt-2"><button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-1.5 rounded-lg bg-red-500 hover:bg-red-600 text-white font-semibold transition-colors"> </button></div></div></div>`),vw=U(`<header id="home-doc-header" class="sticky top-0 z-10 bg-gray-50 dark:bg-gray-950 px-6 pt-8 pb-6 border-b border-gray-300 dark:border-gray-800"><div class="flex items-start gap-4 flex-wrap"><div class="shrink min-w-0"><div class="flex items-center gap-2 flex-wrap"><span class="flex items-center gap-2 flex-wrap"></span> <!> <h1 data-testid="doc-title" class="min-w-0 text-xs font-normal text-gray-900 dark:text-gray-50 leading-tight"> </h1> <!></div> <!></div> <div class="flex items-center gap-2 flex-wrap ml-auto"><!></div></div> <!> <!> <!> <!> <!></header> <div class="flex min-h-full items-start"><article id="home-doc-view" data-testid="doc-view" class="flex-1 min-w-0 px-6 pt-8 pb-8"><!></article> <!></div> <!> <!> <!> <!> <!> <!>`,1);function yw(e,t){qe(t,!0);let n=/<div\s+data-ld-kanban\b/i,r=qi(t,`navHistory`,19,()=>[]),i=P(null),a=P(null),o=P(null),s=P(null),c=P(!1),l=P(!1),u=P(!1),d=P(null),f=P(I([])),p=``,m=N(()=>V(f).length?Y(V(f).length===1?`search.notice_singular`:`search.notice_plural`).replace(`{count}`,String(V(f).length)).replace(`{query}`,X.searchQuery):``),h=N(()=>Vv(t.doc.content)),g=N(()=>n.test(t.doc.content)),_=N(()=>Ko.has(t.doc.id)),v=N(()=>(V(h)||``).toUpperCase()===`TO BE VALIDATED`),y=P(!1),b=P(null),x=P(!1),S=P(!1),C=P(!1),w=P(!1),T=P(!1);async function E(){try{let e=await(await fetch(`/api/git/status`)).json();F(u,e.mode===`enabled`&&e.ok===!0,!0)}catch{F(u,!1)}}kn(()=>{if(t.doc.id,V(g),V(g)){F(u,!1);return}E()}),kn(()=>{V(g)&&V(y)&&(F(y,!1),F(b,null))});function D(e,t){let n=document.getElementById(`home-content-area`);if(!n)return;let r=document.getElementById(`home-doc-header`),i=r?r.getBoundingClientRect().height:0,a=e.getBoundingClientRect().top-n.getBoundingClientRect().top+n.scrollTop;n.scrollTo({top:Math.max(0,a-i-16),behavior:t?`smooth`:`auto`})}function ee(e){let t=document.getElementById(e);t&&D(t,!1)}function te(e){F(i,e,!0);let n=t.doc.id,r=X.searchQuery;if(V(g)){F(f,[],!0),F(A,[],!0),p=n;return}let a=typeof r==`string`&&r.toLowerCase().startsWith(`metadata://`);F(f,r&&!a?UC(e,r):[],!0),V(d)&&Ey(e,V(d),Y),n===p?V(o)?.apply():(p=n,V(o)?.load(n),Lv.load(n)),F(A,Array.from(e.querySelectorAll(`h1,h2,h3,h4,h5,h6`)).map(e=>({id:e.id,text:e.textContent?.trim()??``,level:parseInt(e.tagName[1])})).filter(e=>e.id&&e.text),!0)}function O(){return V(s).show({title:Y(`snippet.inline_delete_title`),message:Y(`snippet.inline_delete_message`),confirmLabel:Y(`snippet.inline_delete_confirm_btn`),cancelLabel:Y(`common.cancel`),danger:!0})}async function ne(){let e=1;try{let n=await Lv.load(t.doc.id);n&&typeof n.accuracy==`number`&&(e=n.accuracy)}catch{}let n=Math.round(e*100),r=n<100,i=Uv(t.doc.id),a=Y(i?`doc.validate_worklog_message`:`doc.validate_message`),o=r?Y(`doc.validate_detail_low_accuracy`).replace(`{accuracy}`,n+`%`):void 0;if(!await V(s).show({title:Y(`doc.validate_title`),message:a,detail:o,confirmLabel:Y(`doc.validate_confirm`),cancelLabel:Y(`common.cancel`)}))return;let c=Hv(t.doc.content,i?`Done`:`Accepted`);if(c!==t.doc.content)try{await t.onsave(c),r&&await fetch(`/api/metadata/`+encodeURIComponent(t.doc.id)+`/refresh`,{method:`POST`}),await Lv.load(t.doc.id),X.docStatuses={...X.docStatuses,[t.doc.id]:i?`Done`:`Accepted`}}catch(e){F(b,{text:Y(`doc.validate_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`},!0)}}kn(()=>{try{F(x,localStorage.getItem(`ld-full-width`)===`1`)}catch{}});let k=P(!1),A=P(I([])),re=N(()=>!V(g)&&V(k)&&V(A).length>0),ie=`ld-toc-w`,ae=P(!1),oe=P(null),se=P(null),ce=P(0);kn(()=>{if(!V(se))return;let e=new ResizeObserver(()=>{F(ce,V(se).offsetHeight,!0)});return e.observe(V(se)),F(ce,V(se).offsetHeight,!0),()=>e.disconnect()});function le(e){if(e.preventDefault(),!V(oe))return;let t=e.clientX,n=V(oe).getBoundingClientRect().width;F(ae,!0),V(oe).style.transition=`none`,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let r=e=>{let r=Math.max(160,Math.min(400,n-(e.clientX-t)));V(oe).style.width=r+`px`},i=()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i),document.body.style.cursor=``,document.body.style.userSelect=``,F(ae,!1),V(oe).style.transition=``;try{localStorage.setItem(ie,String(parseInt(V(oe).style.width,10)))}catch{}};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)}kn(()=>{try{F(k,localStorage.getItem(`ld-toc-open`)===`1`)}catch{}try{let e=parseInt(localStorage.getItem(ie)||``,10);V(oe)&&e>=160&&e<=400&&(V(oe).style.width=e+`px`)}catch{}});function ue(){F(k,!V(k));try{localStorage.setItem(`ld-toc-open`,V(k)?`1`:`0`)}catch{}}function de(e){let t=document.getElementById(e),n=document.getElementById(`home-content-area`);if(!t||!n)return;let r=t.parentElement;for(;r&&r!==n;)r.tagName===`DETAILS`&&(r.open=!0),r=r.parentElement;D(t,!0)}async function fe(){try{await navigator.clipboard.writeText(decodeURIComponent(t.doc.id)),F(C,!0),setTimeout(()=>F(C,!1),1800)}catch{}}function pe(){window.print()}function me(e){V(i)&&zy.start(V(i),{language:e,codeLabel:Y(`tts.code_label`),imageLabel:Y(`tts.image_label`),diagramLabel:Y(`tts.diagram_label`),tableLabel:Y(`tts.table_label`)})}function he(){let e=BC(t.doc.content);if(!e){F(w,!0);return}me(e)}async function ge(e){F(T,!0);try{let n=VC(t.doc.content,e);n!==t.doc.content&&await t.onsave(n),F(w,!1),me(e)}catch(e){F(b,{text:Y(`tts.language_save_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`},!0)}finally{F(T,!1)}}kn(()=>(t.doc.id,V(y),()=>{F(w,!1),zy.stop()}));var _e=vw(),ve=R(_e),ye=L(ve),be=L(ye),xe=L(be),Se=L(xe);q(Se,21,()=>t.doc.folder||[],Qr,(e,t)=>{var n=GC(),r=L(n,!0);j(n),B(e=>{J(n,`title`,V(t)),G(r,e)},[()=>Y_(V(t))]),W(e,n)}),j(Se);var Ce=z(Se,2),we=e=>{var n=KC(),r=L(n,!0);j(n),B(()=>G(r,t.doc.formattedDate)),W(e,n)};K(Ce,e=>{t.doc.formattedDate&&e(we)});var Te=z(Ce,2),Ee=L(Te,!0);j(Te);var De=z(Te,2),Oe=e=>{var t=qC(),n=L(t);j(t),B(e=>{J(t,`title`,e),vi(t,1,`no-print inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md border border-gray-200 text-xs text-gray-500 transition-colors hover:bg-gray-50 hover:text-blue-600 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-blue-400 ${V(C)?`text-green-600 dark:text-green-400`:``}`),vi(n,1,`fa-${V(C)?`solid fa-check`:`regular fa-copy`}`)},[()=>Y(`doc.copy_mcp_id`)]),H(`click`,t,fe),W(e,t)};K(De,e=>{V(g)||e(Oe)}),j(xe);var ke=z(xe,2),Ae=e=>{var n=YC();q(n,20,()=>t.doc.tags,e=>e,(e,t)=>{var n=JC(),r=L(n);j(n),B(()=>G(r,`#${t??``}`)),W(e,n)}),j(n),W(e,n)};K(ke,e=>{t.doc.tags&&t.doc.tags.length&&e(Ae)}),j(be);var je=z(be,2),Me=L(je),Ne=e=>{var t=ZC(),n=L(t),r=e=>{var t=XC(),n=L(t,!0);j(t),B(()=>{vi(t,1,`text-xs ${V(b).cls??``}`),G(n,V(b).text)}),W(e,t)};K(n,e=>{V(b)&&e(r)});var i=z(n,2),o=L(i,!0);j(i);var s=z(i,2),c=L(s,!0);j(s);var l=z(s,2),u=L(l,!0);j(l),j(t),B((e,t,n,r)=>{G(o,e),J(s,`title`,t),G(c,n),G(u,r)},[()=>Y(`common.cancel`),()=>Y(`doc.snippets`),()=>Y(`doc.snippets_btn`),()=>Y(`common.save`)]),H(`click`,i,()=>V(a).cancelEdit()),H(`click`,s,()=>V(a).openSnippets()),H(`click`,l,()=>V(a).save()),W(e,t)},Pe=e=>{let n=N(()=>X.markerActive?`#fef08a`:`#bfdbfe`),r=N(()=>X.markerActive?`#fef08a`:`#93c5fd`),i=N(()=>X.markerActive?`#fde047`:`#93c5fd`);var o=ow(),s=L(o),d=L(s),f=z(d,1,!0);j(s);var p=z(s,2),m=e=>{var t=QC(),n=z(L(t),1,!0);j(t),B((e,r)=>{J(t,`title`,e),G(n,r)},[()=>Y(`doc.validate_mode`),()=>Y(`doc.validate_btn`)]),H(`click`,t,ne),W(e,t)};K(p,e=>{V(v)&&!V(g)&&e(m)});var h=z(p,2),y=e=>{var t=rw(),o=R(t),s=e=>{var t=$C(),n=R(t),r=L(n);j(n);var i=z(n,2);B((e,t)=>{J(n,`title`,e),vi(r,1,`fa-solid ${zy.status===`playing`?`fa-pause`:`fa-play`}`),J(i,`title`,t)},[()=>zy.status===`playing`?Y(`tts.pause`):Y(`tts.resume`),()=>Y(`tts.stop`)]),H(`click`,n,()=>zy.toggle()),H(`click`,i,()=>zy.stop()),W(e,t)},d=e=>{var t=ew(),n=z(L(t),1,!0);j(t),B((e,r)=>{J(t,`title`,e),G(n,r)},[()=>Y(`tts.play`),()=>Y(`tts.play_btn`)]),H(`click`,t,he),W(e,t)};K(o,e=>{zy.active?e(s):e(d,-1)});var f=z(o,2),p=L(f),m=L(p),h=z(m),g=z(h),_=z(g),v=z(_,2),y=e=>{W(e,tw())};K(v,e=>{X.markerHidden&&e(y)}),j(p);var b=z(p,1,!0);j(f);var x=z(f,2),S=L(x);j(x);var C=z(x,2),w=z(L(C));j(C);var T=z(C,2),E=e=>{var t=nw(),n=z(L(t));j(t),B((e,r)=>{J(t,`title`,e),G(n,` ${r??``}`)},[()=>Y(`versions.button_title`),()=>Y(`versions.button`)]),H(`click`,t,()=>F(l,!0)),W(e,t)};K(T,e=>{V(u)&&e(E)});var D=z(T,2),ee=z(L(D));j(D),B((e,t,a,o,s,c,l,u)=>{J(f,`title`,e),vi(f,1,`no-print text-sm px-3 py-1.5 rounded-lg border transition-colors ${X.markerActive?`border-yellow-400 bg-yellow-100 dark:bg-yellow-900/40 text-yellow-700 dark:text-yellow-300`:`border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700`}`),J(m,`fill`,V(n)),J(h,`fill`,V(r)),J(g,`fill`,V(i)),J(_,`fill`,V(i)),G(b,t),J(x,`title`,a),G(S,`📄 ${o??``}`),J(C,`title`,s),G(w,` ${c??``}`),J(D,`title`,l),G(ee,` ${u??``}`)},[()=>Y(`doc.marker_mode`),()=>Y(`doc.marker_btn`),()=>Y(`doc.export_pdf`),()=>Y(`doc.export_pdf_btn`),()=>Y(`metadata.button_title`),()=>Y(`metadata.button`),()=>Y(`doc.edit`),()=>Y(`doc.edit_btn`)]),H(`click`,f,()=>X.toggleMarker()),H(`click`,x,pe),H(`click`,C,()=>F(c,!0)),H(`click`,D,()=>V(a).enterEdit()),W(e,t)};K(h,e=>{V(g)||e(y)});var b=z(h,2),x=e=>{var t=iw(),n=z(L(t));j(t),B((e,r)=>{J(t,`title`,e),G(n,` ${r??``}`)},[()=>Y(`kanban.edit_columns`),()=>Y(`kanban.edit_columns`)]),H(`click`,t,()=>V(a).openKanbanColumnsEditor()),W(e,t)};K(b,e=>{V(g)&&e(x)});var C=z(b,2),w=z(L(C));j(C);var T=z(C,2),E=e=>{var t=aw();B(e=>{J(t,`title`,e),vi(t,1,`no-print text-sm px-3 py-1.5 rounded-lg border transition-colors ${V(k)?`border-blue-400 bg-blue-50 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400`:`border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700`}`)},[()=>Y(`doc.toc_toggle`)]),H(`click`,t,ue),W(e,t)};K(T,e=>{V(g)||e(E)}),j(o),B((e,t,n,r)=>{J(s,`aria-pressed`,V(_)),J(s,`title`,e),vi(s,1,`no-print text-sm px-3 py-1.5 rounded-lg border transition-colors ${V(_)?`border-amber-300 bg-amber-50 dark:bg-amber-900/30 text-amber-600 dark:text-amber-400`:`border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700`}`),vi(d,1,`fa-${V(_)?`solid`:`regular`} fa-star`),G(f,t),J(C,`title`,n),G(w,` ${r??``}`)},[()=>V(_)?Y(`favorites.remove`):Y(`favorites.add`),()=>Y(`favorites.button`),()=>Y(`doc.delete`),()=>Y(`doc.delete_btn`)]),H(`click`,s,()=>Ko.toggle({id:t.doc.id,title:t.doc.title})),H(`click`,C,()=>F(S,!0)),W(e,o)};K(Me,e=>{V(y)?e(Ne):e(Pe,-1)}),j(je),j(ye);var Fe=z(ye,2),Ie=e=>{zv(e,{onopen:()=>F(c,!0)})};K(Fe,e=>{!V(y)&&!V(g)&&e(Ie)});var Le=z(Fe,2),Re=e=>{var n=lw();q(n,21,r,Qr,(e,n,r)=>{var i=cw(),a=R(i),o=e=>{W(e,sw())};K(a,e=>{r>0&&e(o)});var s=z(a,2),c=L(s);j(s),B(()=>G(c,`← ${V(n).title??``}`)),H(`click`,s,()=>t.ongoback?.(r)),W(e,i)}),j(n),W(e,n)};K(Le,e=>{!V(y)&&r().length&&e(Re)});var ze=z(Le,2),Be=e=>{var t=dw(),n=L(t),r=L(n,!0);j(n);var i=z(n,2);q(i,23,()=>V(f),e=>e.id,(e,t,n)=>{var r=uw(),i=L(r),a=L(i),o=L(a);j(a);var s=z(a),c=L(s,!0);j(s),j(i),j(r),B(()=>{G(o,`${V(n)+1}.`),G(c,V(t).snippet)}),H(`click`,i,()=>WC(V(t).id)),W(e,r)}),j(i),j(t),B(()=>G(r,V(m))),W(e,t)};K(ze,e=>{!V(y)&&!V(g)&&V(f).length&&X.searchQuery&&e(Be)});var Ve=z(ze,2),He=e=>{var t=fw(),n=L(t,!0);j(t),B(()=>G(n,zy.error)),W(e,t)};K(Ve,e=>{!V(y)&&!V(g)&&zy.error&&e(He)});var Ue=z(Ve,2),We=e=>{var t=pw();Ui(t,e=>F(d,e),()=>V(d)),W(e,t)};K(Ue,e=>{V(g)||e(We)}),j(ve),Ui(ve,e=>F(se,e),()=>V(se));var Ge=z(ve,2),Ke=L(Ge);Ui(Wf(L(Ke),{get docId(){return t.doc.id},get content(){return t.doc.content},get html(){return t.doc.html},get onsave(){return t.onsave},get onopen(){return t.onopen},onanchor:ee,onconfirmdelete:O,oncontentwired:te,get rewireSignal(){return X.searchQuery},get editing(){return V(y)},set editing(e){F(y,e,!0)},get saveMsg(){return V(b)},set saveMsg(e){F(b,e,!0)}}),e=>F(a,e,!0),()=>V(a)),j(Ke);var Ye=z(Ke,2),Xe=e=>{var t=hw(),n=R(t),r=z(n,2),i=L(r),a=L(i,!0);j(i);var o=z(i,2),s=L(o);q(s,21,()=>V(A),Qr,(e,t)=>{var n=mw(),r=L(n),i=L(r,!0);j(r),j(n),B(()=>{bi(n,`padding-left: ${(V(t).level-1)*.75}rem`),J(r,`title`,V(t).text),G(i,V(t).text)}),H(`click`,r,()=>de(V(t).id)),W(e,n)}),j(s),j(o),j(r),Ui(r,e=>F(oe,e),()=>V(oe)),B(e=>{vi(n,1,`no-print w-1 shrink-0 self-stretch cursor-col-resize select-none transition-colors ${V(ae)?`bg-blue-500/60`:`bg-transparent hover:bg-blue-500/40`}`),bi(r,`width: 224px; top: ${V(ce)??``}px; min-height: calc(100vh - ${V(ce)??``}px); max-height: calc(100vh - ${V(ce)??``}px)`),G(a,e)},[()=>Y(`doc.toc_title`)]),H(`mousedown`,n,le),W(e,t)};K(Ye,e=>{V(re)&&e(Xe)}),j(Ge);var Ze=z(Ge,2),Qe=e=>{Ui(jv(e,{get contentEl(){return V(i)},get docId(){return t.doc.id}}),e=>F(o,e,!0),()=>V(o))};K(Ze,e=>{V(g)||e(Qe)});var $e=z(Ze,2);oy($e,{get open(){return V(c)},get docId(){return t.doc.id},get content(){return t.doc.content},onclose:()=>F(c,!1)});var et=z($e,2);yy(et,{get open(){return V(l)},get docId(){return t.doc.id},get content(){return t.doc.content},get onsave(){return t.onsave},onclose:()=>F(l,!1)});var tt=z(et,2);Ui($d(tt,{}),e=>F(s,e,!0),()=>V(s));var nt=z(tt,2),rt=e=>{var t=gw(),n=L(t),r=L(n),i=L(r,!0);j(r);var a=z(r,2),o=L(a,!0);j(a);var s=z(a,2),c=L(s),l=L(c,!0);j(c);var u=z(c,2),d=L(u,!0);j(u),j(s);var f=z(s,2),p=L(f),m=L(p,!0);j(p),j(f),j(n),j(t),B((e,t,n,r,a)=>{G(i,e),G(o,t),c.disabled=V(T),G(l,n),u.disabled=V(T),G(d,r),p.disabled=V(T),G(m,a)},[()=>Y(`tts.language_title`),()=>Y(`tts.language_message`),()=>Y(`tts.language_en`),()=>Y(`tts.language_fr`),()=>Y(`common.cancel`)]),H(`click`,t,e=>{e.target===e.currentTarget&&!V(T)&&F(w,!1)}),H(`click`,c,()=>ge(`en`)),H(`click`,u,()=>ge(`fr`)),H(`click`,p,()=>F(w,!1)),W(e,t)};K(nt,e=>{V(w)&&e(rt)});var it=z(nt,2),at=e=>{var n=_w(),r=L(n),i=L(r),a=L(i,!0);j(i);var o=z(i,2),s=L(o,!0);j(o);var c=z(o,2),l=L(c),u=L(l,!0);j(l);var d=z(l,2),f=L(d,!0);j(d),j(c),j(r),j(n),B((e,n,r)=>{G(a,e),G(s,t.doc.title),G(u,n),G(f,r)},[()=>Y(`doc.confirm_delete`),()=>Y(`common.cancel`),()=>Y(`doc.confirm_delete_btn`)]),H(`click`,n,e=>{e.target===e.currentTarget&&F(S,!1)}),H(`click`,l,()=>F(S,!1)),H(`click`,d,async()=>{F(S,!1),await t.ondelete()}),W(e,n)};K(it,e=>{V(S)&&e(at)}),B(()=>G(Ee,t.doc.title)),W(e,_e),Je()}Pr([`click`,`mousedown`]);var bw=U(`<p class="px-3 py-4 text-xs text-gray-400 text-center"> </p>`),xw=U(`<p class="px-3 py-3 text-xs text-red-400 text-center"> </p>`),Sw=U(`<p class="px-3 py-3 text-xs text-gray-400 text-center"> </p>`),Cw=U(`<button class="w-full flex items-center gap-2 px-3 py-2 text-sm text-left hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"><span class="text-gray-400 shrink-0">📁</span> <span class="truncate text-gray-700 dark:text-gray-300"> </span></button>`),ww=U(`<div class="border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden text-sm"><div class="flex items-center gap-2 px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700"><button class="text-xs text-blue-600 dark:text-blue-400 hover:underline disabled:opacity-30 disabled:pointer-events-none shrink-0"> </button> <span class="text-xs text-gray-500 dark:text-gray-400 font-mono truncate flex-1"> </span></div> <div class="max-h-40 overflow-y-auto divide-y divide-gray-100 dark:divide-gray-800"><!></div></div>`),Tw=U(`<p class="text-xs text-red-500"> </p>`),Ew=U(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50"><div class="bg-white dark:bg-gray-900 rounded-xl shadow-xl w-full max-w-md mx-4 p-6 space-y-4"><h3 class="text-base font-semibold text-gray-900 dark:text-gray-50"><svg width="16" height="16" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" class="inline-block mr-1 align-text-bottom"><path d="M2 5a2 2 0 012-2h3.586a1 1 0 01.707.293L9.707 4.707A1 1 0 0010.414 5H16a2 2 0 012 2v8a2 2 0 01-2 2H4a2 2 0 01-2-2V5z" stroke="currentColor" stroke-width="1.5" fill="none"></path><line x1="10" y1="8" x2="10" y2="14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></line><line x1="7" y1="11" x2="13" y2="11" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></line></svg> <span> </span></h3> <div class="space-y-1.5"><label for="new-folder-name" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="new-folder-name" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div> <div class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <div class="flex items-center gap-2"><span class="flex-1 text-sm text-gray-600 dark:text-gray-300 font-mono truncate"> </span> <button class="text-xs px-2 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors shrink-0"> </button></div> <!></div> <div class="space-y-1"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <p class="text-xs font-mono text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 truncate"> </p></div> <!> <div class="flex justify-end gap-3 pt-1"><button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div></div></div>`);function Dw(e,t){qe(t,!0);let n=P(``),r=P(null),i=P(null),a=P(``),o=P(``),s=P(`/ (root)`),c=P(!1),l=P(``),u=P(I([])),d=P(!1),f=P(!1),p=P(``),m=P(!1),h=P(null),g=!1;kn(()=>{t.open&&!g?(g=!0,_()):t.open||(g=!1)});async function _(){try{F(n,(await fetch(`/api/config`).then(e=>e.json())).docsFolder||``,!0)}catch{F(n,``)}let e=``;if(X.currentDocId){let t=decodeURIComponent(X.currentDocId);if(!t.startsWith(`/`)){let n=t.split(`/`);n.length>1&&(e=n.slice(0,-1).join(`/`))}}F(a,e?V(n)+`/`+e:V(n),!0),F(r,V(a),!0),F(i,null),F(o,``),F(s,e?`/`+e:`/ (root)`,!0),F(c,!1),F(p,``),F(m,!1),setTimeout(()=>V(h)?.focus(),50)}let v=N(()=>{let e=Aa(V(o));if(!e)return Y(`modal.new_folder.enter_name`);let t=V(a)||V(n),r=t.startsWith(V(n))?t.slice(V(n).length).replace(/^\//,``):``;return(r?r+`/`:``)+e});function y(e){let t=e.currentTarget,n=Aa(t.value);t.value!==n&&(t.value=n),V(o)!==n&&F(o,n,!0)}function b(){F(c,!V(c)),V(c)&&x(V(r)||V(n))}async function x(e){F(d,!0),F(f,!1);try{let t=await fetch(`/api/browse?path=`+encodeURIComponent(e)).then(e=>e.json());F(r,t.current,!0),F(i,t.parent,!0),F(a,t.current,!0),F(l,t.current,!0),F(s,(t.current.startsWith(V(n)+`/`)?t.current.slice(V(n).length):t.current===V(n)?``:t.current)||`/ (root)`,!0),F(u,t.dirs||[],!0)}catch{F(f,!0),F(u,[],!0)}finally{F(d,!1)}}let S=N(()=>V(r)===V(n));function C(){V(i)&&x(V(i))}async function w(){let e=Aa(V(o));if(F(p,``),!e){F(p,Y(`modal.new_folder.error_empty`),!0);return}if(!/^[a-zA-Z0-9_.-]+$/.test(e)){F(p,Y(`modal.new_folder.error_invalid_chars`),!0);return}let r=V(a)||V(n);if(r===V(n)&&(e===`files`||e===`images`)){F(p,Y(`modal.new_folder.error_reserved`),!0);return}let i=r.endsWith(`/`)?r+e:r+`/`+e;F(m,!0);try{let e=await fetch(`/api/browse/mkdir`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:i})});if(!e.ok)throw Error(await e.text());t.onclose(),t.onsuccess()}catch(e){F(m,!1),F(p,Y(`common.error_prefix`)+(e instanceof Error?e.message:String(e)))}}var T=Wr(),E=R(T),D=e=>{var n=Ew(),r=L(n),i=L(r),a=z(L(i),2),g=L(a,!0);j(a),j(i);var _=z(i,2),T=L(_),E=L(T,!0);j(T);var D=z(T,2);ki(D),Ui(D,e=>F(h,e),()=>V(h)),j(_);var ee=z(_,2),te=L(ee),O=L(te,!0);j(te);var ne=z(te,2),k=L(ne),A=L(k,!0);j(k);var re=z(k,2),ie=L(re,!0);j(re),j(ne);var ae=z(ne,2),oe=e=>{var t=ww(),n=L(t),r=L(n),i=L(r,!0);j(r);var a=z(r,2),o=L(a,!0);j(a),j(n);var s=z(n,2),c=L(s),p=e=>{var t=bw(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`common.loading`)]),W(e,t)},m=e=>{var t=xw(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`modal.new_folder.error_loading`)]),W(e,t)},h=e=>{var t=Sw(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`modal.new_folder.no_subfolders`)]),W(e,t)},g=e=>{var t=Wr();q(R(t),17,()=>V(u),e=>e.path,(e,t)=>{var n=Cw(),r=z(L(n),2),i=L(r,!0);j(r),j(n),B(()=>G(i,V(t).name)),H(`click`,n,()=>x(V(t).path)),W(e,n)}),W(e,t)};K(c,e=>{V(d)?e(p):V(f)?e(m,1):V(u).length===0?e(h,2):e(g,-1)}),j(s),j(t),B(e=>{r.disabled=V(S),G(i,e),G(o,V(l))},[()=>Y(`common.up`)]),H(`click`,r,C),W(e,t)};K(ae,e=>{V(c)&&e(oe)}),j(ee);var se=z(ee,2),ce=L(se),le=L(ce,!0);j(ce);var ue=z(ce,2),de=L(ue,!0);j(ue),j(se);var fe=z(se,2),pe=e=>{var t=Tw(),n=L(t,!0);j(t),B(()=>G(n,V(p))),W(e,t)};K(fe,e=>{V(p)&&e(pe)});var me=z(fe,2),he=L(me),ge=L(he,!0);j(he);var _e=z(he,2),ve=L(_e,!0);j(_e),j(me),j(r),j(n),B((e,t,n,r,i,a,o,c)=>{G(g,e),G(E,t),J(D,`placeholder`,n),G(O,r),G(A,V(s)),G(ie,i),G(le,a),G(de,V(v)),G(ge,o),_e.disabled=V(m),G(ve,c)},[()=>Y(`modal.new_folder.title`),()=>Y(`modal.new_folder.name_label`),()=>Y(`modal.new_folder.name_placeholder`),()=>Y(`modal.new_folder.location_label`),()=>Y(`modal.new_folder.browse_btn`),()=>Y(`modal.new_folder.will_be_created`),()=>Y(`common.cancel`),()=>V(m)?Y(`modal.new_folder.creating_btn`):Y(`modal.new_folder.create_btn`)]),H(`click`,n,e=>{e.target===e.currentTarget&&t.onclose()}),H(`input`,D,y),Fi(D,()=>V(o),e=>F(o,e)),H(`click`,re,b),H(`click`,he,function(...e){t.onclose?.apply(this,e)}),H(`click`,_e,w),W(e,n)};K(E,e=>{t.open&&e(D)}),W(e,T),Je()}Pr([`click`,`input`]);var Ow=U(`<p class="text-sm text-gray-400 py-2"> </p>`),kw=U(`<p class="text-sm text-red-500"> </p>`),Aw=U(`<label class="flex items-center gap-3 px-1 py-1.5 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 cursor-pointer"><input type="checkbox" class="w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"/> <span class="text-sm text-gray-700 dark:text-gray-300"> </span></label>`),jw=U(`<div><div class="max-h-48 overflow-y-auto space-y-0.5 border border-gray-200 dark:border-gray-700 rounded-lg p-2"><!></div></div>`),Mw=U(`<div><p class="text-xs text-gray-500 dark:text-gray-400"> </p> <div class="flex justify-end gap-3 pt-2"><button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div></div>`),Nw=U(`<div><p class="text-xs text-gray-500 dark:text-gray-400"> </p> <div class="flex justify-end gap-3 pt-2"><button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg border border-blue-500 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20 font-semibold transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div></div>`),Pw=U(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50"><div class="bg-white dark:bg-gray-900 rounded-xl shadow-xl w-full max-w-sm mx-4 p-6 space-y-4"><h3 class="text-base font-semibold text-gray-900 dark:text-gray-50"><i class="fa-solid fa-file-export mr-2 text-blue-500"></i> <span> </span></h3> <div class="flex gap-0 border-b border-gray-200 dark:border-gray-700"><button> </button> <button> </button> <button> </button></div> <!> <!> <!> <!></div></div>`);function Fw(e,t){qe(t,!0);let n=P(`markdown`),r=!1,i=P(!1),a=P(!1),o=P(I([])),s=P(I({})),c=P(!1),l=P(!1),u=P(!1),d=P(!1),f=!1;kn(()=>{t.open&&!f?(f=!0,F(n,`markdown`),r=!1,F(o,[],!0),F(s,{},!0)):t.open||(f=!1)});function p(e){return String(e??``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function m(e){F(n,e,!0),e===`html`&&h()}async function h(){if(!r){F(i,!0),F(a,!1);try{let e=await fetch(`/api/documents`).then(e=>e.json()),t=new Set;e.forEach(e=>t.add(e.folder?.[0]??`General`)),F(o,[...t].sort((e,t)=>e===`General`?-1:t===`General`?1:e.localeCompare(t)),!0),r=!0}catch{F(a,!0)}finally{F(i,!1)}}}async function g(){F(c,!0);try{let e=await fetch(`/api/export/markdown`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(!e.ok)throw Error(await e.text());let n=await e.blob(),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`export-markdown.zip`,i.click(),URL.revokeObjectURL(r),t.onclose()}catch(e){alert(Y(`common.error_prefix`)+(e instanceof Error?e.message:String(e)))}finally{F(c,!1)}}async function _(e){let n=V(o).filter(e=>V(s)[e]);if(n.length){F(e===`confluence`?u:l,!0);try{let r=await fetch(`/api/export/html`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({folders:n,mode:e})});if(!r.ok)throw Error(await r.text());let i=await r.blob(),a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=`export-${e}.zip`,o.click(),URL.revokeObjectURL(a),t.onclose()}catch(e){alert(Y(`common.error_prefix`)+(e instanceof Error?e.message:String(e)))}finally{F(u,!1),F(l,!1)}}}async function v(){F(d,!0);try{let e=X.allDocs&&X.allDocs.length?X.allDocs:await fetch(`/api/documents`).then(e=>e.json()),n={};for(let t=0;t<e.length;t+=5){let r=e.slice(t,t+5),i=await Promise.all(r.map(e=>fetch(`/api/documents/`+e.id).then(e=>e.ok?e.json():null).catch(()=>null)));for(let r of i)r&&(n[r.id??e[t]?.id]=r);r.forEach((e,t)=>{i[t]&&(n[e.id]=i[t])})}function r(e){let t={docs:[],children:{}};for(let n of e){let e=t;for(let t of n.folder||[])e.children[t]||(e.children[t]={docs:[],children:{}}),e=e.children[t];e.docs.push(n)}return t}function i(e){let t=[...e.docs],n=Object.keys(e.children).sort((e,t)=>e.localeCompare(t));for(let r of n)t.push(...i(e.children[r]));return t}function a(e){return e.replace(/^\d+_/,``).replace(/[_-]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function o(e,t){let n=``,r=t*1.25;for(let t of e.docs)n+=`<li style="margin-left:${r}rem;padding:0.15rem 0;">`,n+=`<a href="#doc-${t.id}" style="color:#1d4ed8;text-decoration:none;font-size:0.875rem;">${p(t.title)}</a>`,t.formattedDate&&(n+=`<span style="color:#9ca3af;font-size:0.7rem;margin-left:0.5rem;">${p(t.formattedDate)}</span>`),n+=`</li>`;let i=Object.keys(e.children).sort((e,t)=>e.localeCompare(t));for(let s of i)n+=`<li style="margin-left:${r}rem;margin-top:0.75rem;">`,n+=`<span style="font-size:0.7rem;font-weight:700;text-transform:uppercase;letter-spacing:0.05em;color:#7c3aed;">📁 ${a(s)}</span>`,n+=`<ul style="margin:0.2rem 0 0 0;padding:0;list-style:none;">`,n+=o(e.children[s],t+1),n+=`</ul></li>`;return n}function s(e){return e.replace(/href="[^"]*\?doc=([^"&#]+)(?:#[^"]*)?"/g,(e,t)=>`href="#doc-${t}"`)}let c=p(document.title||`Living Documentation`),l=r(e),u=i(l),d=`<!DOCTYPE html>
|
|
223
|
+
`,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=MC(jC(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=MC(jC(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 FC(e){let t=e.prettyErrors!==!1;return{lineCounter:e.lineCounter||t&&new DC||null,prettyErrors:t}}function IC(e,t={}){let{lineCounter:n,prettyErrors:r}=FC(t),i=new PC(n?.addNewLine),a=new pC(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 kS(t.range.slice(0,2),`MULTIPLE_DOCS`,`Source contains multiple documents; please use YAML.parseAllDocuments()`));break}return r&&n&&(o.errors.forEach(jS(e,n)),o.warnings.forEach(jS(e,n))),o}function LC(e,t,n){let r;typeof t==`function`?r=t:n===void 0&&t&&typeof t==`object`&&(n=t);let i=IC(e,n);if(!i)return null;if(i.warnings.forEach(e=>ux(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 RC=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/,zC=/^\s*\*\*[A-Za-z0-9_-]+\s*:\s*\*\*/m,BC=/^\s*(?:\*\*)?([A-Za-z0-9_-]+)(?:\*\*)?\s*:\s*(?:\*\*)?\s*(.*?)\s*$/;function VC(e){if(typeof e!=`string`)return{data:{},body:``,format:`none`,raw:``};let t=e.match(RC);if(!t)return{data:{},body:e,format:`none`,raw:``};let n=t[1],r=e.slice(t[0].length);if(zC.test(n))return{data:HC(n),body:r,format:`legacy`,raw:n};try{let e=LC(n);return{data:e&&typeof e==`object`&&!Array.isArray(e)?e:{},body:r,format:`yaml`,raw:n}}catch{return{data:HC(n),body:r,format:`legacy`,raw:n}}}function HC(e){let t={};for(let n of e.split(/\r?\n/)){let e=BC.exec(n);if(!e)continue;let r=e[1],i=e[2];r.toLowerCase()===`tags`?t[r]=i.split(`,`).map(e=>e.trim()).filter(Boolean):t[r]=i}return t}function UC(e,t){let n=t.toLowerCase();for(let t of Object.keys(e))if(t.toLowerCase()===n)return e[t]}function WC(e){return e==null?null:Array.isArray(e)?e.map(e=>String(e)).join(`, `):String(e)}function GC(e,t){let{data:n}=VC(e);for(let e of t){let t=UC(n,e);if(t!=null)return WC(t)}return null}var KC=/^---\r?\n([\s\S]*?)\r?\n---(?:\r?\n|$)/,qC=/^(\s*(?:\*\*)?(?:language|lang|locale|langue)(?:\*\*)?\s*:\s*(?:\*\*)?\s*)(.+?)\s*$/i;function JC(e){let t=(e??``).trim().toLowerCase();return t?t===`en`||t.startsWith(`en-`)||t===`english`||t===`anglais`?`en`:t===`fr`||t.startsWith(`fr-`)||t===`french`||t===`francais`||t===`français`?`fr`:null:null}function YC(e){return JC(GC(e,[`language`,`lang`,`locale`,`langue`]))}function XC(e,t){let n=e.match(KC);if(!n)return`---\n**language:** ${t}\n---\n\n${e}`;let r=n[0],i=n[1].split(/\r?\n/),a=i.findIndex(e=>qC.test(e));if(a>=0)i[a]=i[a].replace(qC,`$1${t}`);else{let e=i.findIndex(e=>/^\s*(?:\*\*)?date(?:\*\*)?\s*:\s*(?:\*\*)?/i.test(e)),n=e>=0?e+1:i.length;i.splice(n,0,`**language:** ${t}`)}return`---\n${i.join(`
|
|
224
|
+
`)}\n---\n`+e.slice(r.length)}var ZC=e=>e.normalize(`NFC`).normalize(`NFD`).replace(/[̀-ͯ]/g,``).toLowerCase();function QC(e,t){let n=ZC(t);if(!n)return[];let r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),i=[];for(;r.nextNode();)i.push(r.currentNode);let a=0;i.forEach(e=>{let t=(e.textContent||``).normalize(`NFC`),r=ZC(t);if(!r.includes(n))return;let i=``,o=0;for(;o<=r.length;){let e=r.indexOf(n,o);if(e===-1){i+=t.slice(o);break}i+=t.slice(o,e),i+=`<mark id="match-${a++}">${t.slice(e,e+n.length)}</mark>`,o=e+n.length}let s=document.createElement(`span`);s.innerHTML=i,e.parentNode?.replaceChild(s,e)});let o=[];return e.querySelectorAll(`mark[id^='match-']`).forEach(e=>{let r=((e.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre`)||e.parentElement).textContent||``).trim(),i=ZC(r).indexOf(n),a=Math.max(0,i-40),s=Math.min(r.length,i+t.length+40),c=(a>0?`…`:``)+r.slice(a,s)+(s<r.length?`…`:``);o.push({id:e.id,snippet:c})}),o}function $C(e){let t=document.getElementById(e),n=document.getElementById(`home-content-area`);if(!t||!n)return;let r=t.parentElement;for(;r&&r!==n;)r.tagName===`DETAILS`&&!r.open&&(r.open=!0),r=r.parentElement;document.querySelectorAll(`mark.match-active`).forEach(e=>{e.classList.remove(`match-active`)}),t.classList.add(`match-active`);let i=document.querySelector(`#home-doc-view header`),a=i?i.getBoundingClientRect().height:0,o=t.getBoundingClientRect().top,s=n.getBoundingClientRect().top,c=a+(n.clientHeight-a)/3;n.scrollTop+=o-s-c}var ew=U(`<span class="inline-block text-xs font-semibold px-2.5 py-0.5 rounded-full bg-violet-100 text-violet-700 dark:bg-violet-900/40 dark:text-violet-300"> </span>`),tw=U(`<span class="text-xs text-gray-400 dark:text-gray-500"> </span>`),nw=U(`<button type="button" data-testid="copy-doc-id-btn"><i aria-hidden="true"></i></button>`),rw=U(`<span class="inline-block text-[11px] px-2 py-0.5 rounded-full bg-gray-100 dark:bg-gray-800 text-gray-500 dark:text-gray-400 border border-gray-200 dark:border-gray-700"> </span>`),iw=U(`<div class="mt-1.5 flex items-center gap-1.5 flex-wrap" data-testid="doc-tags"></div>`),aw=U(`<span> </span>`),ow=U(`<div data-testid="edit-actions" class="flex items-center gap-2"><!> <button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-1.5 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div>`),sw=U(`<span data-testid="read-only-badge" class="text-xs px-2 py-1 rounded-md border border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400"><i class="fa-solid fa-lock" style="margin-right:4px"></i> </span>`),cw=U(`<button data-testid="validate-btn" class="no-print text-sm px-3 py-1.5 rounded-lg border border-green-700 bg-green-600 text-white font-semibold hover:bg-green-700 transition-colors"><i class="fa-solid fa-check" style="margin-right:4px"></i> </button>`),lw=U(`<button data-testid="tts-toggle" class="no-print text-sm px-3 py-1.5 rounded-lg border border-blue-300 dark:border-blue-700 bg-blue-50 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400 hover:bg-blue-100 dark:hover:bg-blue-900/50 transition-colors"><i></i></button> <button data-testid="tts-stop" class="no-print text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors"><i class="fa-solid fa-stop"></i></button>`,1),uw=U(`<button data-testid="tts-play" class="no-print text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors"><i class="fa-solid fa-headphones" style="margin-right:4px"></i> </button>`),dw=Hr(`<g><line x1="8" y1="8" x2="92" y2="92" stroke="currentColor" stroke-width="8" stroke-linecap="round"></line><line x1="92" y1="8" x2="8" y2="92" stroke="currentColor" stroke-width="8" stroke-linecap="round"></line></g>`),fw=U(`<button data-testid="versions-btn" class="no-print text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors"><i class="fa-solid fa-code-branch"></i> </button>`),pw=U(`<!> <button data-testid="marker-doc-btn"><svg width="18" height="18" viewBox="0 0 100 100" fill="none" style="display:inline-block;vertical-align:middle;margin-right:4px"><rect x="28" y="10" width="44" height="52" rx="6" transform="rotate(40 50 50)" stroke="currentColor" stroke-width="6"></rect><rect x="52" y="8" width="22" height="30" rx="6" transform="rotate(40 50 50)" stroke="currentColor" stroke-width="6"></rect><polygon points="28,60 10,80 30,80 38,72" stroke="currentColor" stroke-width="5" stroke-linejoin="round"></polygon><polygon points="28,48 19,70 36,75 55,70" stroke="currentColor" stroke-width="5" stroke-linejoin="round"></polygon><line x1="10" y1="90" x2="72" y2="90" stroke="currentColor" stroke-width="6" stroke-linecap="round"></line><!></svg> </button> <button data-testid="export-pdf-btn" class="no-print text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors"> </button> <button data-testid="metadata-btn" class="no-print text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors"><i class="fa-solid fa-code-compare"></i> </button> <!> <button data-testid="edit-doc-btn" class="no-print text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors"><i class="fa-solid fa-file-pen"></i> </button>`,1),mw=U(`<button data-testid="kanban-edit-columns" class="no-print text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors"><i class="fa-solid fa-gear"></i> </button>`),hw=U(`<button data-testid="toc-toggle-btn"><i class="fa-solid fa-list-ul"></i></button>`),gw=U(`<div data-testid="view-actions" class="flex items-center gap-2"><button data-testid="favorite-doc-btn"><i style="margin-right:4px"></i> </button> <!> <!> <!> <button data-testid="delete-doc-btn" class="no-print text-sm px-3 py-1.5 rounded-lg border border-red-200 dark:border-red-700 text-red-500 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/40 transition-colors"><i class="fa-solid fa-trash"></i> </button> <!></div>`),_w=U(`<span class="text-gray-300 dark:text-gray-600 mx-1">·</span>`),vw=U(`<!> <button class="text-blue-600 dark:text-blue-400 hover:underline"> </button>`,1),yw=U(`<div class="no-print mt-2 flex flex-wrap gap-1 text-xs"></div>`),bw=U(`<li><button class="w-full text-left px-3 py-1.5 hover:bg-yellow-100 dark:hover:bg-yellow-900/30 transition-colors"><span class="text-yellow-600 dark:text-yellow-500 font-mono text-xs mr-2"> </span><span class="text-xs"> </span></button></li>`),xw=U(`<div class="mt-4 rounded-lg bg-yellow-50 dark:bg-yellow-900/20 border border-yellow-200 dark:border-yellow-800 text-sm text-yellow-800 dark:text-yellow-300 overflow-hidden"><div class="px-3 py-2 font-medium border-b border-yellow-200 dark:border-yellow-800"> </div> <ol class="max-h-40 overflow-y-auto divide-y divide-yellow-100 dark:divide-yellow-900/40 list-none m-0 p-0"></ol></div>`),Sw=U(`<div data-testid="tts-error" class="mt-4 rounded-lg border border-red-200 bg-red-50 px-3 py-2 text-sm text-red-700 dark:border-red-800 dark:bg-red-900/20 dark:text-red-300"> </div>`),Cw=U(`<div class="hidden no-print"></div>`),ww=U(`<li class="m-0 p-0"><button type="button" class="block w-full text-left bg-transparent border-0 cursor-pointer text-xs text-gray-500 dark:text-gray-400 hover:text-blue-600 dark:hover:text-blue-400 hover:underline py-0.5 leading-snug transition-colors truncate"> </button></li>`),Tw=U(`<div></div> <aside class="no-print shrink-0 sticky self-start overflow-y-auto py-8 pr-4 pl-3 ld-toc-aside"><p class="text-xs font-semibold uppercase tracking-wider text-gray-400 dark:text-gray-500 mb-3"> </p> <nav><ul class="space-y-1 list-none m-0 p-0"></ul></nav></aside>`,1),Ew=U(`<div data-testid="tts-language-modal" class="fixed inset-0 z-50 flex items-center justify-center bg-black/50 p-4"><div class="w-full max-w-sm rounded-xl border border-gray-200 bg-white p-5 shadow-2xl dark:border-gray-700 dark:bg-gray-900"><h2 class="text-base font-semibold text-gray-900 dark:text-gray-50"> </h2> <p class="mt-2 text-sm text-gray-600 dark:text-gray-300"> </p> <div class="mt-4 grid grid-cols-2 gap-2"><button type="button" data-testid="tts-language-en" class="rounded-lg border border-gray-200 px-3 py-2 text-sm font-semibold text-gray-700 transition-colors hover:bg-gray-50 disabled:opacity-50 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-800"> </button> <button type="button" data-testid="tts-language-fr" class="rounded-lg border border-gray-200 px-3 py-2 text-sm font-semibold text-gray-700 transition-colors hover:bg-gray-50 disabled:opacity-50 dark:border-gray-700 dark:text-gray-200 dark:hover:bg-gray-800"> </button></div> <div class="mt-3 flex justify-end"><button type="button" class="rounded-lg border border-gray-200 px-3 py-1.5 text-sm text-gray-600 transition-colors hover:bg-gray-50 disabled:opacity-50 dark:border-gray-700 dark:text-gray-300 dark:hover:bg-gray-800"> </button></div></div></div>`),Dw=U(`<div class="fixed inset-0 z-50 bg-black/50 flex items-center justify-center p-4"><div class="w-full max-w-sm bg-white dark:bg-gray-900 border border-red-200 dark:border-red-700 rounded-xl shadow-2xl p-5 flex flex-col gap-3"><p class="text-sm text-gray-700 dark:text-gray-200"> </p> <p class="text-xs text-gray-500 dark:text-gray-400 italic truncate"> </p> <div class="flex justify-end gap-2 mt-2"><button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-1.5 rounded-lg bg-red-500 hover:bg-red-600 text-white font-semibold transition-colors"> </button></div></div></div>`),Ow=U(`<header id="home-doc-header" class="sticky top-0 z-10 bg-gray-50 dark:bg-gray-950 px-6 pt-8 pb-6 border-b border-gray-300 dark:border-gray-800"><div class="flex items-start gap-4 flex-wrap"><div class="shrink min-w-0"><div class="flex items-center gap-2 flex-wrap"><span class="flex items-center gap-2 flex-wrap"></span> <!> <h1 data-testid="doc-title" class="min-w-0 text-xs font-normal text-gray-900 dark:text-gray-50 leading-tight"> </h1> <!></div> <!></div> <div class="flex items-center gap-2 flex-wrap ml-auto"><!></div></div> <!> <!> <!> <!> <!></header> <div class="flex min-h-full items-start"><article id="home-doc-view" data-testid="doc-view" class="flex-1 min-w-0 px-6 pt-8 pb-8"><!></article> <!></div> <!> <!> <!> <!> <!> <!>`,1);function kw(e,t){qe(t,!0);let n=/<div\s+data-ld-kanban\b/i,r=qi(t,`navHistory`,19,()=>[]),i=P(null),a=P(null),o=P(null),s=P(null),c=P(!1),l=P(!1),u=P(!1),d=P(null),f=P(I([])),p=``,m=N(()=>V(f).length?Y(V(f).length===1?`search.notice_singular`:`search.notice_plural`).replace(`{count}`,String(V(f).length)).replace(`{query}`,X.searchQuery):``),h=N(()=>Xv(t.doc.content)),g=N(()=>n.test(t.doc.content)),_=N(()=>Ko.has(t.doc.id)),v=N(()=>(V(h)||``).toUpperCase()===`TO BE VALIDATED`),y=P(!1),b=P(null),x=P(!1),S=P(!1),C=P(!1),w=P(!1),T=P(!1);async function E(){try{let e=await(await fetch(`/api/git/status`)).json();F(u,e.mode===`enabled`&&e.ok===!0,!0)}catch{F(u,!1)}}kn(()=>{if(t.doc.id,V(g),V(g)){F(u,!1);return}E()}),kn(()=>{V(g)&&V(y)&&(F(y,!1),F(b,null))});function D(e,t){let n=document.getElementById(`home-content-area`);if(!n)return;let r=document.getElementById(`home-doc-header`),i=r?r.getBoundingClientRect().height:0,a=e.getBoundingClientRect().top-n.getBoundingClientRect().top+n.scrollTop;n.scrollTo({top:Math.max(0,a-i-16),behavior:t?`smooth`:`auto`})}function ee(e){let t=document.getElementById(e);t&&D(t,!1)}function te(e){F(i,e,!0);let n=t.doc.id,r=X.searchQuery;if(V(g)){F(f,[],!0),F(A,[],!0),p=n;return}let a=typeof r==`string`&&r.toLowerCase().startsWith(`metadata://`);F(f,r&&!a?QC(e,r):[],!0),V(d)&&Fy(e,V(d),Y),n===p?V(o)?.apply():(p=n,V(o)?.load(n),Kv.load(n)),F(A,Array.from(e.querySelectorAll(`h1,h2,h3,h4,h5,h6`)).map(e=>({id:e.id,text:e.textContent?.trim()??``,level:parseInt(e.tagName[1])})).filter(e=>e.id&&e.text),!0)}function O(){return V(s).show({title:Y(`snippet.inline_delete_title`),message:Y(`snippet.inline_delete_message`),confirmLabel:Y(`snippet.inline_delete_confirm_btn`),cancelLabel:Y(`common.cancel`),danger:!0})}async function ne(){let e=1;try{let n=await Kv.load(t.doc.id);n&&typeof n.accuracy==`number`&&(e=n.accuracy)}catch{}let n=Math.round(e*100),r=n<100,i=Qv(t.doc.id),a=Y(i?`doc.validate_worklog_message`:`doc.validate_message`),o=r?Y(`doc.validate_detail_low_accuracy`).replace(`{accuracy}`,n+`%`):void 0;if(!await V(s).show({title:Y(`doc.validate_title`),message:a,detail:o,confirmLabel:Y(`doc.validate_confirm`),cancelLabel:Y(`common.cancel`)}))return;let c=Zv(t.doc.content,i?`Done`:`Accepted`);if(c!==t.doc.content)try{await t.onsave(c),r&&await fetch(`/api/metadata/`+encodeURIComponent(t.doc.id)+`/refresh`,{method:`POST`}),await Kv.load(t.doc.id),X.docStatuses={...X.docStatuses,[t.doc.id]:i?`Done`:`Accepted`}}catch(e){F(b,{text:Y(`doc.validate_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`},!0)}}kn(()=>{try{F(x,localStorage.getItem(`ld-full-width`)===`1`)}catch{}});let k=P(!1),A=P(I([])),re=N(()=>!V(g)&&V(k)&&V(A).length>0),ie=`ld-toc-w`,ae=P(!1),oe=P(null),se=P(null),ce=P(0);kn(()=>{if(!V(se))return;let e=new ResizeObserver(()=>{F(ce,V(se).offsetHeight,!0)});return e.observe(V(se)),F(ce,V(se).offsetHeight,!0),()=>e.disconnect()});function le(e){if(e.preventDefault(),!V(oe))return;let t=e.clientX,n=V(oe).getBoundingClientRect().width;F(ae,!0),V(oe).style.transition=`none`,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let r=e=>{let r=Math.max(160,Math.min(400,n-(e.clientX-t)));V(oe).style.width=r+`px`},i=()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i),document.body.style.cursor=``,document.body.style.userSelect=``,F(ae,!1),V(oe).style.transition=``;try{localStorage.setItem(ie,String(parseInt(V(oe).style.width,10)))}catch{}};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)}kn(()=>{try{F(k,localStorage.getItem(`ld-toc-open`)===`1`)}catch{}try{let e=parseInt(localStorage.getItem(ie)||``,10);V(oe)&&e>=160&&e<=400&&(V(oe).style.width=e+`px`)}catch{}});function ue(){F(k,!V(k));try{localStorage.setItem(`ld-toc-open`,V(k)?`1`:`0`)}catch{}}function de(e){let t=document.getElementById(e),n=document.getElementById(`home-content-area`);if(!t||!n)return;let r=t.parentElement;for(;r&&r!==n;)r.tagName===`DETAILS`&&(r.open=!0),r=r.parentElement;D(t,!0)}async function fe(){try{await navigator.clipboard.writeText(decodeURIComponent(t.doc.id)),F(C,!0),setTimeout(()=>F(C,!1),1800)}catch{}}function pe(){window.print()}function me(e){V(i)&&Jy.start(V(i),{language:e,codeLabel:Y(`tts.code_label`),imageLabel:Y(`tts.image_label`),diagramLabel:Y(`tts.diagram_label`),tableLabel:Y(`tts.table_label`)})}function he(){let e=YC(t.doc.content);if(!e){F(w,!0);return}me(e)}async function ge(e){F(T,!0);try{let n=XC(t.doc.content,e);n!==t.doc.content&&await t.onsave(n),F(w,!1),me(e)}catch(e){F(b,{text:Y(`tts.language_save_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`},!0)}finally{F(T,!1)}}kn(()=>(t.doc.id,V(y),()=>{F(w,!1),Jy.stop()}));var _e=Ow(),ve=R(_e),ye=L(ve),be=L(ye),xe=L(be),Se=L(xe);q(Se,21,()=>t.doc.folder||[],Qr,(e,t)=>{var n=ew(),r=L(n,!0);j(n),B(e=>{J(n,`title`,V(t)),G(r,e)},[()=>X_(V(t))]),W(e,n)}),j(Se);var Ce=z(Se,2),we=e=>{var n=tw(),r=L(n,!0);j(n),B(()=>G(r,t.doc.formattedDate)),W(e,n)};K(Ce,e=>{t.doc.formattedDate&&e(we)});var Te=z(Ce,2),Ee=L(Te,!0);j(Te);var De=z(Te,2),Oe=e=>{var t=nw(),n=L(t);j(t),B(e=>{J(t,`title`,e),vi(t,1,`no-print inline-flex h-6 w-6 shrink-0 items-center justify-center rounded-md border border-gray-200 text-xs text-gray-500 transition-colors hover:bg-gray-50 hover:text-blue-600 dark:border-gray-700 dark:text-gray-400 dark:hover:bg-gray-800 dark:hover:text-blue-400 ${V(C)?`text-green-600 dark:text-green-400`:``}`),vi(n,1,`fa-${V(C)?`solid fa-check`:`regular fa-copy`}`)},[()=>Y(`doc.copy_mcp_id`)]),H(`click`,t,fe),W(e,t)};K(De,e=>{V(g)||e(Oe)}),j(xe);var ke=z(xe,2),Ae=e=>{var n=iw();q(n,20,()=>t.doc.tags,e=>e,(e,t)=>{var n=rw(),r=L(n);j(n),B(()=>G(r,`#${t??``}`)),W(e,n)}),j(n),W(e,n)};K(ke,e=>{t.doc.tags&&t.doc.tags.length&&e(Ae)}),j(be);var je=z(be,2),Me=L(je),Ne=e=>{var t=ow(),n=L(t),r=e=>{var t=aw(),n=L(t,!0);j(t),B(()=>{vi(t,1,`text-xs ${V(b).cls??``}`),G(n,V(b).text)}),W(e,t)};K(n,e=>{V(b)&&e(r)});var i=z(n,2),o=L(i,!0);j(i);var s=z(i,2),c=L(s,!0);j(s);var l=z(s,2),u=L(l,!0);j(l),j(t),B((e,t,n,r)=>{G(o,e),J(s,`title`,t),G(c,n),G(u,r)},[()=>Y(`common.cancel`),()=>Y(`doc.snippets`),()=>Y(`doc.snippets_btn`),()=>Y(`common.save`)]),H(`click`,i,()=>V(a).cancelEdit()),H(`click`,s,()=>V(a).openSnippets()),H(`click`,l,()=>V(a).save()),W(e,t)},Pe=e=>{var t=sw(),n=z(L(t),1,!0);j(t),B(e=>G(n,e),[()=>Y(`doc.read_only`)]),W(e,t)},Fe=e=>{let n=N(()=>X.markerActive?`#fef08a`:`#bfdbfe`),r=N(()=>X.markerActive?`#fef08a`:`#93c5fd`),i=N(()=>X.markerActive?`#fde047`:`#93c5fd`);var o=gw(),s=L(o),d=L(s),f=z(d,1,!0);j(s);var p=z(s,2),m=e=>{var t=cw(),n=z(L(t),1,!0);j(t),B((e,r)=>{J(t,`title`,e),G(n,r)},[()=>Y(`doc.validate_mode`),()=>Y(`doc.validate_btn`)]),H(`click`,t,ne),W(e,t)};K(p,e=>{V(v)&&!V(g)&&e(m)});var h=z(p,2),y=e=>{var t=pw(),o=R(t),s=e=>{var t=lw(),n=R(t),r=L(n);j(n);var i=z(n,2);B((e,t)=>{J(n,`title`,e),vi(r,1,`fa-solid ${Jy.status===`playing`?`fa-pause`:`fa-play`}`),J(i,`title`,t)},[()=>Jy.status===`playing`?Y(`tts.pause`):Y(`tts.resume`),()=>Y(`tts.stop`)]),H(`click`,n,()=>Jy.toggle()),H(`click`,i,()=>Jy.stop()),W(e,t)},d=e=>{var t=uw(),n=z(L(t),1,!0);j(t),B((e,r)=>{J(t,`title`,e),G(n,r)},[()=>Y(`tts.play`),()=>Y(`tts.play_btn`)]),H(`click`,t,he),W(e,t)};K(o,e=>{Jy.active?e(s):e(d,-1)});var f=z(o,2),p=L(f),m=L(p),h=z(m),g=z(h),_=z(g),v=z(_,2),y=e=>{W(e,dw())};K(v,e=>{X.markerHidden&&e(y)}),j(p);var b=z(p,1,!0);j(f);var x=z(f,2),S=L(x);j(x);var C=z(x,2),w=z(L(C));j(C);var T=z(C,2),E=e=>{var t=fw(),n=z(L(t));j(t),B((e,r)=>{J(t,`title`,e),G(n,` ${r??``}`)},[()=>Y(`versions.button_title`),()=>Y(`versions.button`)]),H(`click`,t,()=>F(l,!0)),W(e,t)};K(T,e=>{V(u)&&e(E)});var D=z(T,2),ee=z(L(D));j(D),B((e,t,a,o,s,c,l,u)=>{J(f,`title`,e),vi(f,1,`no-print text-sm px-3 py-1.5 rounded-lg border transition-colors ${X.markerActive?`border-yellow-400 bg-yellow-100 dark:bg-yellow-900/40 text-yellow-700 dark:text-yellow-300`:`border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700`}`),J(m,`fill`,V(n)),J(h,`fill`,V(r)),J(g,`fill`,V(i)),J(_,`fill`,V(i)),G(b,t),J(x,`title`,a),G(S,`📄 ${o??``}`),J(C,`title`,s),G(w,` ${c??``}`),J(D,`title`,l),G(ee,` ${u??``}`)},[()=>Y(`doc.marker_mode`),()=>Y(`doc.marker_btn`),()=>Y(`doc.export_pdf`),()=>Y(`doc.export_pdf_btn`),()=>Y(`metadata.button_title`),()=>Y(`metadata.button`),()=>Y(`doc.edit`),()=>Y(`doc.edit_btn`)]),H(`click`,f,()=>X.toggleMarker()),H(`click`,x,pe),H(`click`,C,()=>F(c,!0)),H(`click`,D,()=>V(a).enterEdit()),W(e,t)};K(h,e=>{V(g)||e(y)});var b=z(h,2),x=e=>{var t=mw(),n=z(L(t));j(t),B((e,r)=>{J(t,`title`,e),G(n,` ${r??``}`)},[()=>Y(`kanban.edit_columns`),()=>Y(`kanban.edit_columns`)]),H(`click`,t,()=>V(a).openKanbanColumnsEditor()),W(e,t)};K(b,e=>{V(g)&&e(x)});var C=z(b,2),w=z(L(C));j(C);var T=z(C,2),E=e=>{var t=hw();B(e=>{J(t,`title`,e),vi(t,1,`no-print text-sm px-3 py-1.5 rounded-lg border transition-colors ${V(k)?`border-blue-400 bg-blue-50 dark:bg-blue-900/30 text-blue-600 dark:text-blue-400`:`border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700`}`)},[()=>Y(`doc.toc_toggle`)]),H(`click`,t,ue),W(e,t)};K(T,e=>{V(g)||e(E)}),j(o),B((e,t,n,r)=>{J(s,`aria-pressed`,V(_)),J(s,`title`,e),vi(s,1,`no-print text-sm px-3 py-1.5 rounded-lg border transition-colors ${V(_)?`border-amber-300 bg-amber-50 dark:bg-amber-900/30 text-amber-600 dark:text-amber-400`:`border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700`}`),vi(d,1,`fa-${V(_)?`solid`:`regular`} fa-star`),G(f,t),J(C,`title`,n),G(w,` ${r??``}`)},[()=>V(_)?Y(`favorites.remove`):Y(`favorites.add`),()=>Y(`favorites.button`),()=>Y(`doc.delete`),()=>Y(`doc.delete_btn`)]),H(`click`,s,()=>Ko.toggle({id:t.doc.id,title:t.doc.title})),H(`click`,C,()=>F(S,!0)),W(e,o)};K(Me,e=>{V(y)?e(Ne):t.doc.reserved?e(Pe,1):e(Fe,-1)}),j(je),j(ye);var Ie=z(ye,2),Le=e=>{Jv(e,{onopen:()=>F(c,!0)})};K(Ie,e=>{!V(y)&&!V(g)&&e(Le)});var Re=z(Ie,2),ze=e=>{var n=yw();q(n,21,r,Qr,(e,n,r)=>{var i=vw(),a=R(i),o=e=>{W(e,_w())};K(a,e=>{r>0&&e(o)});var s=z(a,2),c=L(s);j(s),B(()=>G(c,`← ${V(n).title??``}`)),H(`click`,s,()=>t.ongoback?.(r)),W(e,i)}),j(n),W(e,n)};K(Re,e=>{!V(y)&&r().length&&e(ze)});var Be=z(Re,2),Ve=e=>{var t=xw(),n=L(t),r=L(n,!0);j(n);var i=z(n,2);q(i,23,()=>V(f),e=>e.id,(e,t,n)=>{var r=bw(),i=L(r),a=L(i),o=L(a);j(a);var s=z(a),c=L(s,!0);j(s),j(i),j(r),B(()=>{G(o,`${V(n)+1}.`),G(c,V(t).snippet)}),H(`click`,i,()=>$C(V(t).id)),W(e,r)}),j(i),j(t),B(()=>G(r,V(m))),W(e,t)};K(Be,e=>{!V(y)&&!V(g)&&V(f).length&&X.searchQuery&&e(Ve)});var He=z(Be,2),Ue=e=>{var t=Sw(),n=L(t,!0);j(t),B(()=>G(n,Jy.error)),W(e,t)};K(He,e=>{!V(y)&&!V(g)&&Jy.error&&e(Ue)});var We=z(He,2),Ge=e=>{var t=Cw();Ui(t,e=>F(d,e),()=>V(d)),W(e,t)};K(We,e=>{V(g)||e(Ge)}),j(ve),Ui(ve,e=>F(se,e),()=>V(se));var Ke=z(ve,2),Ye=L(Ke);Ui(Wf(L(Ye),{get docId(){return t.doc.id},get content(){return t.doc.content},get html(){return t.doc.html},get onsave(){return t.onsave},get onopen(){return t.onopen},onanchor:ee,onconfirmdelete:O,oncontentwired:te,get rewireSignal(){return X.searchQuery},get readonly(){return t.doc.reserved},get editing(){return V(y)},set editing(e){F(y,e,!0)},get saveMsg(){return V(b)},set saveMsg(e){F(b,e,!0)}}),e=>F(a,e,!0),()=>V(a)),j(Ye);var Xe=z(Ye,2),Ze=e=>{var t=Tw(),n=R(t),r=z(n,2),i=L(r),a=L(i,!0);j(i);var o=z(i,2),s=L(o);q(s,21,()=>V(A),Qr,(e,t)=>{var n=ww(),r=L(n),i=L(r,!0);j(r),j(n),B(()=>{bi(n,`padding-left: ${(V(t).level-1)*.75}rem`),J(r,`title`,V(t).text),G(i,V(t).text)}),H(`click`,r,()=>de(V(t).id)),W(e,n)}),j(s),j(o),j(r),Ui(r,e=>F(oe,e),()=>V(oe)),B(e=>{vi(n,1,`no-print w-1 shrink-0 self-stretch cursor-col-resize select-none transition-colors ${V(ae)?`bg-blue-500/60`:`bg-transparent hover:bg-blue-500/40`}`),bi(r,`width: 224px; top: ${V(ce)??``}px; min-height: calc(100vh - ${V(ce)??``}px); max-height: calc(100vh - ${V(ce)??``}px)`),G(a,e)},[()=>Y(`doc.toc_title`)]),H(`mousedown`,n,le),W(e,t)};K(Xe,e=>{V(re)&&e(Ze)}),j(Ke);var Qe=z(Ke,2),$e=e=>{Ui(Bv(e,{get contentEl(){return V(i)},get docId(){return t.doc.id}}),e=>F(o,e,!0),()=>V(o))};K(Qe,e=>{V(g)||e($e)});var et=z(Qe,2);hy(et,{get open(){return V(c)},get docId(){return t.doc.id},get content(){return t.doc.content},onclose:()=>F(c,!1)});var tt=z(et,2);Oy(tt,{get open(){return V(l)},get docId(){return t.doc.id},get content(){return t.doc.content},get onsave(){return t.onsave},onclose:()=>F(l,!1)});var nt=z(tt,2);Ui($d(nt,{}),e=>F(s,e,!0),()=>V(s));var rt=z(nt,2),it=e=>{var t=Ew(),n=L(t),r=L(n),i=L(r,!0);j(r);var a=z(r,2),o=L(a,!0);j(a);var s=z(a,2),c=L(s),l=L(c,!0);j(c);var u=z(c,2),d=L(u,!0);j(u),j(s);var f=z(s,2),p=L(f),m=L(p,!0);j(p),j(f),j(n),j(t),B((e,t,n,r,a)=>{G(i,e),G(o,t),c.disabled=V(T),G(l,n),u.disabled=V(T),G(d,r),p.disabled=V(T),G(m,a)},[()=>Y(`tts.language_title`),()=>Y(`tts.language_message`),()=>Y(`tts.language_en`),()=>Y(`tts.language_fr`),()=>Y(`common.cancel`)]),H(`click`,t,e=>{e.target===e.currentTarget&&!V(T)&&F(w,!1)}),H(`click`,c,()=>ge(`en`)),H(`click`,u,()=>ge(`fr`)),H(`click`,p,()=>F(w,!1)),W(e,t)};K(rt,e=>{V(w)&&e(it)});var at=z(rt,2),ot=e=>{var n=Dw(),r=L(n),i=L(r),a=L(i,!0);j(i);var o=z(i,2),s=L(o,!0);j(o);var c=z(o,2),l=L(c),u=L(l,!0);j(l);var d=z(l,2),f=L(d,!0);j(d),j(c),j(r),j(n),B((e,n,r)=>{G(a,e),G(s,t.doc.title),G(u,n),G(f,r)},[()=>Y(`doc.confirm_delete`),()=>Y(`common.cancel`),()=>Y(`doc.confirm_delete_btn`)]),H(`click`,n,e=>{e.target===e.currentTarget&&F(S,!1)}),H(`click`,l,()=>F(S,!1)),H(`click`,d,async()=>{F(S,!1),await t.ondelete()}),W(e,n)};K(at,e=>{V(S)&&e(ot)}),B(()=>G(Ee,t.doc.title)),W(e,_e),Je()}Pr([`click`,`mousedown`]);var Aw=U(`<p class="px-3 py-4 text-xs text-gray-400 text-center"> </p>`),jw=U(`<p class="px-3 py-3 text-xs text-red-400 text-center"> </p>`),Mw=U(`<p class="px-3 py-3 text-xs text-gray-400 text-center"> </p>`),Nw=U(`<button class="w-full flex items-center gap-2 px-3 py-2 text-sm text-left hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"><span class="text-gray-400 shrink-0">📁</span> <span class="truncate text-gray-700 dark:text-gray-300"> </span></button>`),Pw=U(`<div class="border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden text-sm"><div class="flex items-center gap-2 px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700"><button class="text-xs text-blue-600 dark:text-blue-400 hover:underline disabled:opacity-30 disabled:pointer-events-none shrink-0"> </button> <span class="text-xs text-gray-500 dark:text-gray-400 font-mono truncate flex-1"> </span></div> <div class="max-h-40 overflow-y-auto divide-y divide-gray-100 dark:divide-gray-800"><!></div></div>`),Fw=U(`<p class="text-xs text-red-500"> </p>`),Iw=U(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50"><div class="bg-white dark:bg-gray-900 rounded-xl shadow-xl w-full max-w-md mx-4 p-6 space-y-4"><h3 class="text-base font-semibold text-gray-900 dark:text-gray-50"><svg width="16" height="16" viewBox="0 0 20 20" fill="none" xmlns="http://www.w3.org/2000/svg" class="inline-block mr-1 align-text-bottom"><path d="M2 5a2 2 0 012-2h3.586a1 1 0 01.707.293L9.707 4.707A1 1 0 0010.414 5H16a2 2 0 012 2v8a2 2 0 01-2 2H4a2 2 0 01-2-2V5z" stroke="currentColor" stroke-width="1.5" fill="none"></path><line x1="10" y1="8" x2="10" y2="14" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></line><line x1="7" y1="11" x2="13" y2="11" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"></line></svg> <span> </span></h3> <div class="space-y-1.5"><label for="new-folder-name" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="new-folder-name" type="text" class="w-full px-3 py-2 text-sm rounded-lg border border-gray-300 dark:border-gray-600 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-2 focus:ring-blue-500"/></div> <div class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <div class="flex items-center gap-2"><span class="flex-1 text-sm text-gray-600 dark:text-gray-300 font-mono truncate"> </span> <button class="text-xs px-2 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-500 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors shrink-0"> </button></div> <!></div> <div class="space-y-1"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <p class="text-xs font-mono text-gray-500 dark:text-gray-400 bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 truncate"> </p></div> <!> <div class="flex justify-end gap-3 pt-1"><button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div></div></div>`);function Lw(e,t){qe(t,!0);let n=P(``),r=P(null),i=P(null),a=P(``),o=P(``),s=P(`/ (root)`),c=P(!1),l=P(``),u=P(I([])),d=P(!1),f=P(!1),p=P(``),m=P(!1),h=P(null),g=!1;kn(()=>{t.open&&!g?(g=!0,_()):t.open||(g=!1)});async function _(){try{F(n,(await fetch(`/api/config`).then(e=>e.json())).docsFolder||``,!0)}catch{F(n,``)}let e=``;if(X.currentDocId){let t=decodeURIComponent(X.currentDocId);if(!t.startsWith(`/`)){let n=t.split(`/`);n.length>1&&(e=n.slice(0,-1).join(`/`))}}F(a,e?V(n)+`/`+e:V(n),!0),F(r,V(a),!0),F(i,null),F(o,``),F(s,e?`/`+e:`/ (root)`,!0),F(c,!1),F(p,``),F(m,!1),setTimeout(()=>V(h)?.focus(),50)}let v=N(()=>{let e=Aa(V(o));if(!e)return Y(`modal.new_folder.enter_name`);let t=V(a)||V(n),r=t.startsWith(V(n))?t.slice(V(n).length).replace(/^\//,``):``;return(r?r+`/`:``)+e});function y(e){let t=e.currentTarget,n=Aa(t.value);t.value!==n&&(t.value=n),V(o)!==n&&F(o,n,!0)}function b(){F(c,!V(c)),V(c)&&x(V(r)||V(n))}async function x(e){F(d,!0),F(f,!1);try{let t=await fetch(`/api/browse?path=`+encodeURIComponent(e)).then(e=>e.json());F(r,t.current,!0),F(i,t.parent,!0),F(a,t.current,!0),F(l,t.current,!0),F(s,(t.current.startsWith(V(n)+`/`)?t.current.slice(V(n).length):t.current===V(n)?``:t.current)||`/ (root)`,!0),F(u,t.dirs||[],!0)}catch{F(f,!0),F(u,[],!0)}finally{F(d,!1)}}let S=N(()=>V(r)===V(n));function C(){V(i)&&x(V(i))}async function w(){let e=Aa(V(o));if(F(p,``),!e){F(p,Y(`modal.new_folder.error_empty`),!0);return}if(!/^[a-zA-Z0-9_.-]+$/.test(e)){F(p,Y(`modal.new_folder.error_invalid_chars`),!0);return}let r=V(a)||V(n);if(r===V(n)&&(e===`files`||e===`images`)){F(p,Y(`modal.new_folder.error_reserved`),!0);return}let i=r.endsWith(`/`)?r+e:r+`/`+e;F(m,!0);try{let e=await fetch(`/api/browse/mkdir`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:i})});if(!e.ok)throw Error(await e.text());t.onclose(),t.onsuccess()}catch(e){F(m,!1),F(p,Y(`common.error_prefix`)+(e instanceof Error?e.message:String(e)))}}var T=Wr(),E=R(T),D=e=>{var n=Iw(),r=L(n),i=L(r),a=z(L(i),2),g=L(a,!0);j(a),j(i);var _=z(i,2),T=L(_),E=L(T,!0);j(T);var D=z(T,2);ki(D),Ui(D,e=>F(h,e),()=>V(h)),j(_);var ee=z(_,2),te=L(ee),O=L(te,!0);j(te);var ne=z(te,2),k=L(ne),A=L(k,!0);j(k);var re=z(k,2),ie=L(re,!0);j(re),j(ne);var ae=z(ne,2),oe=e=>{var t=Pw(),n=L(t),r=L(n),i=L(r,!0);j(r);var a=z(r,2),o=L(a,!0);j(a),j(n);var s=z(n,2),c=L(s),p=e=>{var t=Aw(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`common.loading`)]),W(e,t)},m=e=>{var t=jw(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`modal.new_folder.error_loading`)]),W(e,t)},h=e=>{var t=Mw(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`modal.new_folder.no_subfolders`)]),W(e,t)},g=e=>{var t=Wr();q(R(t),17,()=>V(u),e=>e.path,(e,t)=>{var n=Nw(),r=z(L(n),2),i=L(r,!0);j(r),j(n),B(()=>G(i,V(t).name)),H(`click`,n,()=>x(V(t).path)),W(e,n)}),W(e,t)};K(c,e=>{V(d)?e(p):V(f)?e(m,1):V(u).length===0?e(h,2):e(g,-1)}),j(s),j(t),B(e=>{r.disabled=V(S),G(i,e),G(o,V(l))},[()=>Y(`common.up`)]),H(`click`,r,C),W(e,t)};K(ae,e=>{V(c)&&e(oe)}),j(ee);var se=z(ee,2),ce=L(se),le=L(ce,!0);j(ce);var ue=z(ce,2),de=L(ue,!0);j(ue),j(se);var fe=z(se,2),pe=e=>{var t=Fw(),n=L(t,!0);j(t),B(()=>G(n,V(p))),W(e,t)};K(fe,e=>{V(p)&&e(pe)});var me=z(fe,2),he=L(me),ge=L(he,!0);j(he);var _e=z(he,2),ve=L(_e,!0);j(_e),j(me),j(r),j(n),B((e,t,n,r,i,a,o,c)=>{G(g,e),G(E,t),J(D,`placeholder`,n),G(O,r),G(A,V(s)),G(ie,i),G(le,a),G(de,V(v)),G(ge,o),_e.disabled=V(m),G(ve,c)},[()=>Y(`modal.new_folder.title`),()=>Y(`modal.new_folder.name_label`),()=>Y(`modal.new_folder.name_placeholder`),()=>Y(`modal.new_folder.location_label`),()=>Y(`modal.new_folder.browse_btn`),()=>Y(`modal.new_folder.will_be_created`),()=>Y(`common.cancel`),()=>V(m)?Y(`modal.new_folder.creating_btn`):Y(`modal.new_folder.create_btn`)]),H(`click`,n,e=>{e.target===e.currentTarget&&t.onclose()}),H(`input`,D,y),Fi(D,()=>V(o),e=>F(o,e)),H(`click`,re,b),H(`click`,he,function(...e){t.onclose?.apply(this,e)}),H(`click`,_e,w),W(e,n)};K(E,e=>{t.open&&e(D)}),W(e,T),Je()}Pr([`click`,`input`]);var Rw=U(`<p class="text-sm text-gray-400 py-2"> </p>`),zw=U(`<p class="text-sm text-red-500"> </p>`),Bw=U(`<label class="flex items-center gap-3 px-1 py-1.5 rounded-lg hover:bg-gray-50 dark:hover:bg-gray-800 cursor-pointer"><input type="checkbox" class="w-4 h-4 rounded border-gray-300 dark:border-gray-600 text-blue-600 focus:ring-blue-500"/> <span class="text-sm text-gray-700 dark:text-gray-300"> </span></label>`),Vw=U(`<div><div class="max-h-48 overflow-y-auto space-y-0.5 border border-gray-200 dark:border-gray-700 rounded-lg p-2"><!></div></div>`),Hw=U(`<div><p class="text-xs text-gray-500 dark:text-gray-400"> </p> <div class="flex justify-end gap-3 pt-2"><button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div></div>`),Uw=U(`<div><p class="text-xs text-gray-500 dark:text-gray-400"> </p> <div class="flex justify-end gap-3 pt-2"><button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg border border-blue-500 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/20 font-semibold transition-colors"> </button> <button class="text-sm px-4 py-2 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors"> </button></div></div>`),Ww=U(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50"><div class="bg-white dark:bg-gray-900 rounded-xl shadow-xl w-full max-w-sm mx-4 p-6 space-y-4"><h3 class="text-base font-semibold text-gray-900 dark:text-gray-50"><i class="fa-solid fa-file-export mr-2 text-blue-500"></i> <span> </span></h3> <div class="flex gap-0 border-b border-gray-200 dark:border-gray-700"><button> </button> <button> </button> <button> </button></div> <!> <!> <!> <!></div></div>`);function Gw(e,t){qe(t,!0);let n=P(`markdown`),r=!1,i=P(!1),a=P(!1),o=P(I([])),s=P(I({})),c=P(!1),l=P(!1),u=P(!1),d=P(!1),f=!1;kn(()=>{t.open&&!f?(f=!0,F(n,`markdown`),r=!1,F(o,[],!0),F(s,{},!0)):t.open||(f=!1)});function p(e){return String(e??``).replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`).replace(/"/g,`"`).replace(/'/g,`'`)}function m(e){F(n,e,!0),e===`html`&&h()}async function h(){if(!r){F(i,!0),F(a,!1);try{let e=await fetch(`/api/documents`).then(e=>e.json()),t=new Set;e.forEach(e=>t.add(e.folder?.[0]??`General`)),F(o,[...t].sort((e,t)=>e===`General`?-1:t===`General`?1:e.localeCompare(t)),!0),r=!0}catch{F(a,!0)}finally{F(i,!1)}}}async function g(){F(c,!0);try{let e=await fetch(`/api/export/markdown`,{method:`POST`,headers:{"Content-Type":`application/json`},body:`{}`});if(!e.ok)throw Error(await e.text());let n=await e.blob(),r=URL.createObjectURL(n),i=document.createElement(`a`);i.href=r,i.download=`export-markdown.zip`,i.click(),URL.revokeObjectURL(r),t.onclose()}catch(e){alert(Y(`common.error_prefix`)+(e instanceof Error?e.message:String(e)))}finally{F(c,!1)}}async function _(e){let n=V(o).filter(e=>V(s)[e]);if(n.length){F(e===`confluence`?u:l,!0);try{let r=await fetch(`/api/export/html`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({folders:n,mode:e})});if(!r.ok)throw Error(await r.text());let i=await r.blob(),a=URL.createObjectURL(i),o=document.createElement(`a`);o.href=a,o.download=`export-${e}.zip`,o.click(),URL.revokeObjectURL(a),t.onclose()}catch(e){alert(Y(`common.error_prefix`)+(e instanceof Error?e.message:String(e)))}finally{F(u,!1),F(l,!1)}}}async function v(){F(d,!0);try{let e=X.allDocs&&X.allDocs.length?X.allDocs:await fetch(`/api/documents`).then(e=>e.json()),n={};for(let t=0;t<e.length;t+=5){let r=e.slice(t,t+5),i=await Promise.all(r.map(e=>fetch(`/api/documents/`+e.id).then(e=>e.ok?e.json():null).catch(()=>null)));for(let r of i)r&&(n[r.id??e[t]?.id]=r);r.forEach((e,t)=>{i[t]&&(n[e.id]=i[t])})}function r(e){let t={docs:[],children:{}};for(let n of e){let e=t;for(let t of n.folder||[])e.children[t]||(e.children[t]={docs:[],children:{}}),e=e.children[t];e.docs.push(n)}return t}function i(e){let t=[...e.docs],n=Object.keys(e.children).sort((e,t)=>e.localeCompare(t));for(let r of n)t.push(...i(e.children[r]));return t}function a(e){return e.replace(/^\d+_/,``).replace(/[_-]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function o(e,t){let n=``,r=t*1.25;for(let t of e.docs)n+=`<li style="margin-left:${r}rem;padding:0.15rem 0;">`,n+=`<a href="#doc-${t.id}" style="color:#1d4ed8;text-decoration:none;font-size:0.875rem;">${p(t.title)}</a>`,t.formattedDate&&(n+=`<span style="color:#9ca3af;font-size:0.7rem;margin-left:0.5rem;">${p(t.formattedDate)}</span>`),n+=`</li>`;let i=Object.keys(e.children).sort((e,t)=>e.localeCompare(t));for(let s of i)n+=`<li style="margin-left:${r}rem;margin-top:0.75rem;">`,n+=`<span style="font-size:0.7rem;font-weight:700;text-transform:uppercase;letter-spacing:0.05em;color:#7c3aed;">📁 ${a(s)}</span>`,n+=`<ul style="margin:0.2rem 0 0 0;padding:0;list-style:none;">`,n+=o(e.children[s],t+1),n+=`</ul></li>`;return n}function s(e){return e.replace(/href="[^"]*\?doc=([^"&#]+)(?:#[^"]*)?"/g,(e,t)=>`href="#doc-${t}"`)}let c=p(document.title||`Living Documentation`),l=r(e),u=i(l),d=`<!DOCTYPE html>
|
|
225
225
|
<html>
|
|
226
226
|
<head>
|
|
227
227
|
<meta charset="UTF-8">
|
|
@@ -275,20 +275,20 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
275
275
|
setTimeout(() => window.print(), 800);
|
|
276
276
|
<\/script>
|
|
277
277
|
</body>
|
|
278
|
-
</html>`,f=window.open(``,`_blank`);if(!f){alert(Y(`error.pdf_popup`));return}f.document.write(d),f.document.close(),t.onclose()}catch(e){alert(Y(`error.pdf_export`)+(e instanceof Error?e.message:String(e)))}finally{F(d,!1)}}let y=`px-4 py-2 text-sm border-b-2 border-blue-500 text-blue-600 dark:text-blue-400 font-semibold transition-colors`,b=`px-4 py-2 text-sm text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-colors`;var x=Wr(),S=R(x),C=e=>{var r=Pw(),f=L(r),p=L(f),h=z(L(p),2),x=L(h,!0);j(h),j(p);var S=z(p,2),C=L(S),w=L(C,!0);j(C);var T=z(C,2),E=L(T,!0);j(T);var D=z(T,2),ee=L(D,!0);j(D),j(S);var te=z(S,2),O=e=>{var t=jw(),n=L(t),r=L(n),c=e=>{var t=Ow(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`common.loading`)]),W(e,t)},l=e=>{var t=kw(),n=L(t);j(t),B(e=>G(n,`${e??``}failed to load folders`),[()=>Y(`common.error_prefix`)]),W(e,t)},u=e=>{var t=Wr();q(R(t),16,()=>V(o),e=>e,(e,t)=>{var n=Aw(),r=L(n);ki(r);var i,a=z(r,2),o=L(a,!0);j(a),j(n),B(()=>{i!==(i=t)&&(r.value=(r.__value=t)??``),G(o,t)}),Ri(r,()=>V(s)[t],e=>V(s)[t]=e),W(e,n)}),W(e,t)};K(r,e=>{V(i)?e(c):V(a)?e(l,1):e(u,-1)}),j(n),j(t),W(e,t)};K(te,e=>{V(n)===`html`&&e(O)});var ne=z(te,2),k=e=>{var n=Mw(),r=L(n),i=L(r,!0);j(r);var a=z(r,2),o=L(a),s=L(o,!0);j(o);var l=z(o,2),u=L(l,!0);j(l),j(a),j(n),B((e,t,n)=>{G(i,e),G(s,t),l.disabled=V(c),G(u,n)},[()=>Y(`modal.export.markdown_hint`),()=>Y(`common.cancel`),()=>V(c)?`⏳`:Y(`modal.export.markdown_btn`)]),H(`click`,o,function(...e){t.onclose?.apply(this,e)}),H(`click`,l,g),W(e,n)};K(ne,e=>{V(n)===`markdown`&&e(k)});var A=z(ne,2),re=e=>{var n=Nw(),r=L(n),i=L(r,!0);j(r);var a=z(r,2),o=L(a),s=L(o,!0);j(o);var c=z(o,2),d=L(c,!0);j(c);var f=z(c,2),p=L(f,!0);j(f),j(a),j(n),B((e,t,n,r)=>{G(i,e),G(s,t),c.disabled=V(l),G(d,n),f.disabled=V(u),G(p,r)},[()=>Y(`modal.export_html.hint`),()=>Y(`common.cancel`),()=>V(l)?`⏳`:Y(`modal.export_html.notion_btn`),()=>V(u)?`⏳`:Y(`modal.export_html.confluence_btn`)]),H(`click`,o,function(...e){t.onclose?.apply(this,e)}),H(`click`,c,()=>_(`notion`)),H(`click`,f,()=>_(`confluence`)),W(e,n)};K(A,e=>{V(n)===`html`&&e(re)});var ie=z(A,2),ae=e=>{var n=Mw(),r=L(n),i=L(r,!0);j(r);var a=z(r,2),o=L(a),s=L(o,!0);j(o);var c=z(o,2),l=L(c,!0);j(c),j(a),j(n),B((e,t,n)=>{G(i,e),G(s,t),c.disabled=V(d),G(l,n)},[()=>Y(`modal.export.pdf_hint`),()=>Y(`common.cancel`),()=>V(d)?`⏳`:Y(`modal.export.pdf_btn`)]),H(`click`,o,function(...e){t.onclose?.apply(this,e)}),H(`click`,c,v),W(e,n)};K(ie,e=>{V(n)===`pdf`&&e(ae)}),j(f),j(r),B((e,t,r,i)=>{G(x,e),vi(C,1,fi(V(n)===`markdown`?y:b)),G(w,t),vi(T,1,fi(V(n)===`html`?y:b)),G(E,r),vi(D,1,fi(V(n)===`pdf`?y:b)),G(ee,i)},[()=>Y(`modal.export.title`),()=>Y(`modal.export.tab_markdown`),()=>Y(`modal.export.tab_html`),()=>Y(`modal.export.tab_pdf`)]),H(`click`,r,e=>{e.target===e.currentTarget&&t.onclose()}),H(`click`,C,()=>m(`markdown`)),H(`click`,T,()=>m(`html`)),H(`click`,D,()=>m(`pdf`)),W(e,r)};K(S,e=>{t.open&&e(C)}),W(e,x),Je()}Pr([`click`]);var Iw=U(`<p class="px-3 py-4 text-xs text-gray-400 text-center"> </p>`),Lw=U(`<p> </p>`),Rw=U(`<div class="group flex items-center hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"><button class="flex-1 flex items-center gap-2 px-3 py-2 text-sm text-left"><span class="text-gray-400 shrink-0">📁</span> <span class="text-gray-700 dark:text-gray-300 truncate"> </span></button> <button title="Add to exclusions" class="shrink-0 text-red-400 hover:text-red-600 px-3 py-2 text-sm font-bold transition-colors">⊖</button></div>`),zw=U(`<div class="group flex items-center hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"><span class="flex-1 flex items-center gap-2 px-3 py-2 text-sm text-gray-500 dark:text-gray-400"><span class="shrink-0 opacity-40">📄</span> <span class="truncate font-mono"> </span></span> <button title="Add to exclusions" class="shrink-0 text-red-400 hover:text-red-600 px-3 py-2 text-sm font-bold transition-colors">⊖</button></div>`),Bw=U(`<div class="border-t border-gray-200 dark:border-gray-700"><div class="flex items-center gap-2 px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700"><button class="text-xs text-blue-600 dark:text-blue-400 hover:underline disabled:opacity-30 disabled:pointer-events-none shrink-0">↑ Up</button> <span class="font-mono text-xs text-gray-400 dark:text-gray-500 truncate flex-1 text-right"> </span></div> <div class="divide-y divide-gray-100 dark:divide-gray-800 max-h-52 overflow-y-auto"><!></div></div>`),Vw=U(`<label class="flex items-center gap-1.5 text-xs text-gray-700 dark:text-gray-300 cursor-pointer"><input type="checkbox"/> </label>`),Hw=U(`<div class="group flex items-center hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"><button class="flex-1 flex items-center gap-2 px-3 py-2 text-sm text-left"><span class="text-gray-400 shrink-0">📁</span> <span class="text-gray-700 dark:text-gray-300 truncate"> </span></button> <button title="Exclude this folder" class="shrink-0 opacity-0 group-hover:opacity-100 text-red-400 hover:text-red-600 px-3 py-2 text-sm transition-opacity">⊖</button></div>`),Uw=U(`<button class="w-full px-3 py-2 text-xs text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-950/30 text-left font-medium border-t border-gray-100 dark:border-gray-800">✓ Select: <span class="font-mono"> </span></button>`),Ww=U(`<!> <!>`,1),Gw=U(`<div> </div>`),Kw=U(`<div> </div> <div> </div> <div> </div> <!>`,1),qw=U(`<div role="button" tabindex="0" class="flex items-center gap-2 px-3 py-1 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors"><span class="text-gray-400 dark:text-gray-600 w-5 text-right shrink-0 tabular-nums text-xs"></span> <div class="flex-1 min-w-0"><div class="flex items-center justify-between gap-1"><span class="text-gray-800 dark:text-gray-200 font-medium truncate text-xs"> </span> <span class="text-gray-400 dark:text-gray-600 tabular-nums shrink-0 text-xs"> </span></div> <div class="h-1 bg-gray-100 dark:bg-gray-800 rounded-full mt-0.5"><div class="h-1 bg-blue-400 dark:bg-blue-600 rounded-full"></div></div></div></div>`),Jw=U(`<div class="w-56 shrink-0 border-r border-gray-200 dark:border-gray-800 flex flex-col bg-white dark:bg-gray-900 overflow-hidden"><div class="px-3 py-2 text-xs text-gray-500 dark:text-gray-400 space-y-0.5 border-b border-gray-100 dark:border-gray-800"><!></div> <div class="px-3 py-2 border-b border-gray-100 dark:border-gray-800 flex items-center gap-2"><span class="text-xs text-gray-500 dark:text-gray-400 shrink-0 cursor-help"> </span> <input type="number" min="1" max="20" class="w-12 px-1.5 py-0.5 text-xs rounded border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-800 dark:text-gray-200 focus:outline-none"/> <button class="text-xs text-blue-600 dark:text-blue-400 hover:underline"> </button></div> <p class="px-3 pt-2 pb-1 text-xs font-semibold text-gray-400 dark:text-gray-600 uppercase tracking-wider"> </p> <div class="flex-1 overflow-y-auto"></div></div>`),Yw=U(`<p class="absolute inset-0 flex items-center justify-center text-gray-400 dark:text-gray-500 text-sm animate-pulse"> </p>`),Xw=U(`<div class="flex items-center gap-1 group py-0.5"><span class="text-gray-600 dark:text-gray-400 break-all font-mono flex-1 text-xs"> </span> <button title="Exclude this file" class="shrink-0 opacity-0 group-hover:opacity-100 text-red-400 hover:text-red-600 text-xs leading-none px-1 transition-opacity">⊖</button></div>`),Zw=U(`<div class="text-gray-400 text-center py-2">—</div>`),Qw=U(`<div class="w-80 shrink-0 border-l border-gray-200 dark:border-gray-800 flex flex-col bg-white dark:bg-gray-900 overflow-hidden"><div class="px-3 py-2 border-b border-gray-100 dark:border-gray-800 flex items-center justify-between"><span class="font-bold text-sm text-gray-900 dark:text-gray-100"> </span> <button class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 text-xs leading-none">✕</button></div> <p class="px-3 pt-2 pb-1 text-xs font-semibold text-gray-400 dark:text-gray-600 uppercase tracking-wider"> </p> <div class="flex-1 overflow-y-auto px-3 py-1 space-y-1 text-xs"><!></div></div>`),$w=U(`<div class="fixed inset-0 z-50 flex flex-col bg-white dark:bg-gray-950"><div class="flex items-center justify-between px-6 h-14 border-b border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shrink-0"><h2 class="font-semibold text-base"> </h2> <button class="text-sm px-3 py-1.5 rounded-lg text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors"> </button></div> <div class="border-b border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shrink-0"><div class="flex items-center gap-3 px-6 py-3"><label class="text-xs font-medium text-gray-500 dark:text-gray-400 shrink-0"> </label> <input type="text" readonly="" spellcheck="false" class="flex-1 px-3 py-1.5 text-sm rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono cursor-default focus:outline-none"/> <button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors shrink-0">📁 <span> </span></button> <button class="text-sm px-4 py-1.5 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors shrink-0"> </button></div> <div class="flex items-start gap-3 px-6 pb-2"><label class="text-xs font-medium text-gray-500 dark:text-gray-400 shrink-0 pt-1.5"> </label> <textarea rows="3" spellcheck="false" class="flex-1 px-3 py-1.5 text-sm rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono focus:outline-none focus:ring-1 focus:ring-blue-400 resize-y"></textarea> <button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors shrink-0">📁 <span> </span></button></div> <!> <div class="flex items-center gap-x-4 gap-y-2 px-6 pb-3 flex-wrap"><span class="text-xs font-medium text-gray-500 dark:text-gray-400 shrink-0"> </span> <label class="flex items-center gap-1.5 text-xs font-medium text-blue-600 dark:text-blue-400 cursor-pointer shrink-0"><input type="checkbox"/> </label> <!></div> <!></div> <div class="flex-1 overflow-hidden flex"><!> <div class="flex-1 relative overflow-hidden"><!> <canvas style="position: absolute; inset: 0"></canvas></div> <!></div></div>`);function eT(e,t){qe(t,!0);let n=new Set(`the.a.an.and.or.but.not.nor.so.yet.both.either.neither.is.are.was.were.be.been.being.have.has.had.do.does.did.will.would.shall.should.may.might.can.could.must.need.dare.ought.used.to.of.in.for.on.with.at.by.from.up.about.into.through.during.before.after.above.below.between.out.off.over.under.again.further.then.once.here.there.when.where.why.how.all.each.few.more.most.other.some.such.no.only.own.same.than.too.very.just.also.still.already.always.never.often.sometimes.usually.this.that.these.those.its.your.our.their.his.her.him.she.you.they.we.me.my.it.who.which.what.whose.whom.if.though.although.because.since.while.unless.until.whether.as.like.via.per.i.am.he.us.see.now.new.old.got.let.put.say.said.says.get.use.make.made.take.come.came.go.went.know.think.look.want.give.seem.back.down.even.much.well.good.work.tell.keep.hold.turn.move.play.live.help.run.start.off.way.too.few.show.hear.etc.eg.ie.one.two.three.four.five.six.seven.eight.nine.ten.le.la.les.un.une.des.du.de.d.l.au.aux.ce.ci.cet.cette.ces.mon.ma.mes.ton.ta.tes.son.sa.ses.notre.nos.votre.vos.leur.leurs.je.tu.il.elle.on.nous.vous.ils.elles.me.te.se.lui.y.en.qui.que.quoi.dont.où.et.ou.mais.donc.or.ni.car.si.ne.pas.plus.moins.très.bien.mal.peu.beaucoup.trop.assez.aussi.comme.pour.par.avec.sans.dans.sur.sous.entre.vers.chez.contre.avant.après.pendant.depuis.selon.malgré.sauf.est.sont.était.être.avoir.fait.faire.dit.dire.peut.pouvoir.doit.devoir.veut.vouloir.sait.savoir.va.aller.vient.venir.tout.tous.toute.toutes.autre.autres.même.chaque.quel.quelle.quels.quelles.aucun.aucune.certain.certaine.plusieurs.quelque.quelques.tel.telle.tels.telles.cela.ceci.ça.celui.celle.ceux.celles.ici.voici.voilà.alors.ainsi.encore.déjà.jamais.toujours.souvent.parfois.rien.personne.chose.fois.jour.temps.part.cas.point.lieu.monde.cependant.néanmoins.pourtant.toutefois.quand.lorsque.puisque.parce.afin.puis.lors.notamment.surtout.seulement.vraiment.enfin.ensuite.ailleurs.là.ici.voici.voilà.dont.lequel.laquelle.lesquels.lesquelles`.split(`.`)),r=new Set(`public.private.protected.static.void.class.interface.abstract.final.const.let.var.function.return.if.else.for.while.do.switch.case.break.continue.try.catch.throw.throws.finally.new.this.self.super.import.export.from.package.module.require.include.using.namespace.struct.enum.trait.impl.fn.def.func.fun.val.mut.async.await.yield.lambda.extends.implements.override.virtual.sealed.data.object.companion.where.when.match.guard.defer.go.chan.select.type.alias.as.is.in.of.with.true.false.null.nil.none.undefined.println.printf.fmt.log.print.main.args.argv.init.setup.teardown.describe.test.expect.assert.before.after.not.and.or.delete.typeof.instanceof.readonly.keyof.infer.never.unknown.declare.satisfies.get.set.add.remove.update.create.find.fetch.load.save.put.post.patch.list.map.filter.reduce.sort.merge.parse.format.convert.transform.validate.check.handle.process.execute.start.stop.reset.clear.close.open.read.write.send.receive.emit.trigger.dispatch.subscribe.unsubscribe.listen.notify.register.unregister.bind.apply.call.invoke.callback.handler.listener.middleware.interceptor.resolver.provider.consumer.producer.builder.factory.adapter.wrapper.proxy.decorator.observer.visitor.strategy.command.controller.service.repository.dao.dto.entity.model.schema.config.context.state.store.action.reducer.selector.hook.ref.effect.memo.component.module.plugin.extension.util.utils.helper.helpers.common.shared.base.default.index.app.core.lib.src.test.spec.mock.stub.fixture.impl.internal.api.sdk.client.server.request.response.status.code.error.exception.message.result.data.value.key.name.label.title.description.item.element.node.child.parent.root.container.wrapper.layout.view.page.screen.panel.header.footer.sidebar.navbar.body.content.section.row.col.column.grid.flex.block.inline.span.div.input.output.param.params.arg.option.options.props.attr.attrs.field.fields.property.properties.method.methods.string.number.boolean.integer.float.double.long.short.byte.char.array.object.map.set.list.vector.queue.stack.hash.table.tree.graph.pair.tuple.optional.nullable.void.unit.any.bool.bytes.none.int.str.bool.all.each.every.some.many.single.multi.first.last.next.prev.previous.current.old.temp.tmp.new.top.bottom.left.right.center.middle.start.end.begin.min.max.count.total.sum.avg.size.length.width.height.depth.flag.num.idx.id.uid.uuid.num.str.val.obj.arr.fn.cb.ctx.req.res.err.msg.src.dst.evt.doc.db.io.fs.os.env.sys.http.https.url.uri.path.port.host.tcp.udp.ssl.tls.html.css.json.xml.yml.yaml.csv.sql.regex.utf.ascii.rgb.rgba.hex.px.em.rem.vh.vw.auto.inherit.initial.application.file.local.source.messages.logging.alerting.programmed.offset.offsets.zone.zoned.decimal.big.integer.constructor.mapper.captor.publisher.verify.subscriber.org.edr.ack.ref.ssr.ssg.csr.isr.mockito.junit.vitest.jest.mocha.rspec.pytest.cypress.playwright.captor.spy.given.then.verify.times.never.invocation.argumentcaptor.inorder.donothing.doreturn.ippon.springframework.jakarta.javax.todo.fixme.hack.note.deprecated.experimental.eslint.prettier.typescript.javascript.java.kotlin.python.golang.rust.csharp.swift.ruby.spring.boot.javax.jakarta.hibernate.lombok.gradle.maven.webpack.vite.react.angular.vue.svelte.nuxt.express.fastapi.flask.django.rails.fiber.gin.actix.tokio.asyncio.junit.jest.mocha.pytest.rspec.docker.kubernetes.aws.gcp.azure.terraform.ansible.nginx.apache.linux.nextjs.remix.astro.sveltekit.gatsby.nuxtjs.qwik.solid.vercel.netlify.cloudflare.supabase.firebase.mongodb.postgres.prisma.drizzle.typeorm.sequelize.mongoose.redis.neon.trpc.graphql.grpc.rest.openapi.swagger.zod.yup.valibot.tailwind.shadcn.radix.headless.chakra.mantine.antd.mui.tanstack.tanstackquery.zustand.jotai.recoil.redux.mobx.storybook.cypress.playwright.vitest.turbopack.turborepo.getserversideprops.getstaticprops.getstaticpaths.generatestaticparams.generatemetadata.serveraction.revalidate.notfound.redirect.permanentredirect.unstablecache.unstablenostore.cookies.headers.userouter.usepathname.usesearchparams.useparams.useformstate.useformstatus.useoptimistic.useserveraction.classname.onclick.onchange.onsubmit.onfocus.onblur.onkeydown.onkeyup.onmousedown.onmouseup.defaultvalue.htmlfor.tabindex.strokewidth.viewbox.fillopacity.strokeopacity.pathdata.children.fragment.portal.suspense.errorboundary.strictmode.createelement.createcontext.createref.forwardref.usestate.useeffect.useref.usecontext.usememo.usecallback.usereducer.useid.usetransition.usedeferredvalue.useimperativehandle.mutex.lock.thread.goroutine.coroutine.channel.buffer.stream.pipe.observable.promise.future.completable.deferred.disposable.lifecycle.scope.annotation.attribute.metadata.reflection.generic.template.macro.preprocessor.compiler.runtime.debug.release.production.development.staging.build.deploy.lint.coverage.report.the.and.for.are.but.not.you.all.this.that.with.have.from.they.will.been.can.has.was.its.our.their.more.also.when.what.about.which.would.into.than.then.each.just.over.after.such.here.some.were.very.only`.split(`.`));function i(e){return n.has(e)||r.has(e)||e.length<3||/^\d+$/.test(e)||/^[^a-z]/.test(e)}function a(e){return e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/([A-Z]+)([A-Z][a-z])/g,`$1 $2`).replace(/[_\-./]+/g,` `).toLowerCase().trim().split(/\s+/).filter(e=>e.length>=3)}function o(e){return e.toLowerCase().split(/[^a-zàâäéèêëïîôùûü]+/).filter(e=>e.length>=3)}let s=[{value:`adoc`,cat:`prose`},{value:`asciidoc`,cat:`prose`},{value:`asm`,cat:`code`},{value:`astro`,cat:`code`},{value:`avsc`,cat:`config`},{value:`bash`,cat:`code`},{value:`bat`,cat:`code`},{value:`bicep`,cat:`config`},{value:`c`,cat:`code`},{value:`cc`,cat:`code`},{value:`cfg`,cat:`config`},{value:`cjs`,cat:`code`},{value:`clj`,cat:`code`},{value:`cljs`,cat:`code`},{value:`cmake`,cat:`code`},{value:`cmd`,cat:`code`},{value:`conf`,cat:`config`},{value:`cpp`,cat:`code`},{value:`cql`,cat:`code`},{value:`cs`,cat:`code`},{value:`cshtml`,cat:`code`},{value:`css`,cat:`config`},{value:`cxx`,cat:`code`},{value:`dart`,cat:`code`},{value:`env`,cat:`config`},{value:`erb`,cat:`code`},{value:`erl`,cat:`code`},{value:`ex`,cat:`code`},{value:`exs`,cat:`code`},{value:`fish`,cat:`code`},{value:`fs`,cat:`code`},{value:`fsx`,cat:`code`},{value:`go`,cat:`code`},{value:`gql`,cat:`code`},{value:`gradle`,cat:`code`},{value:`graphql`,cat:`code`},{value:`groovy`,cat:`code`},{value:`h`,cat:`code`},{value:`hcl`,cat:`config`},{value:`hpp`,cat:`code`},{value:`hs`,cat:`code`},{value:`html`,cat:`config`},{value:`ini`,cat:`config`},{value:`java`,cat:`code`},{value:`jl`,cat:`code`},{value:`js`,cat:`code`},{value:`json`,cat:`config`},{value:`jsx`,cat:`code`,jsx:!0},{value:`kt`,cat:`code`},{value:`less`,cat:`config`},{value:`lua`,cat:`code`},{value:`m`,cat:`code`},{value:`md`,cat:`prose`,def:!0},{value:`mdx`,cat:`prose`},{value:`mjs`,cat:`code`},{value:`mk`,cat:`code`},{value:`ml`,cat:`code`},{value:`mli`,cat:`code`},{value:`mm`,cat:`code`},{value:`nim`,cat:`code`},{value:`php`,cat:`code`},{value:`pl`,cat:`code`},{value:`prisma`,cat:`code`},{value:`properties`,cat:`config`},{value:`proto`,cat:`code`},{value:`ps1`,cat:`code`},{value:`py`,cat:`code`},{value:`r`,cat:`code`},{value:`razor`,cat:`code`},{value:`rb`,cat:`code`},{value:`rs`,cat:`code`},{value:`rst`,cat:`prose`},{value:`s`,cat:`code`},{value:`scala`,cat:`code`},{value:`scss`,cat:`config`},{value:`sh`,cat:`code`},{value:`sol`,cat:`code`},{value:`sql`,cat:`code`},{value:`styl`,cat:`config`},{value:`svelte`,cat:`code`},{value:`swift`,cat:`code`},{value:`tex`,cat:`prose`},{value:`tf`,cat:`config`},{value:`tfvars`,cat:`config`},{value:`thrift`,cat:`code`},{value:`toml`,cat:`config`},{value:`ts`,cat:`code`},{value:`tsx`,cat:`code`,jsx:!0},{value:`txt`,cat:`prose`},{value:`v`,cat:`code`},{value:`vb`,cat:`code`},{value:`vue`,cat:`code`},{value:`xml`,cat:`config`},{value:`yaml`,cat:`config`},{value:`yml`,cat:`config`},{value:`zig`,cat:`code`},{value:`zsh`,cat:`code`}],c=new Set(s.filter(e=>e.cat===`prose`).map(e=>e.value)),l=new Set(s.filter(e=>e.cat===`code`).map(e=>e.value)),u=new Set(s.filter(e=>e.cat===`config`).map(e=>e.value)),d=new Set(s.filter(e=>e.jsx).map(e=>e.value));function f(e,t){let n=[];if(c.has(t)){let t=e.replace(/^\s*(import|export\s+\{[^}]*\}|export\s+\*|package|require|#include|from\s+['"][^'"]+['"]\s*(import)?)\b.*/gm,``).replace(/```[\s\S]*?```/g,` `).replace(/`[^`\n]+`/g,` `).replace(/!\[[^\]]*\]\([^)]*\)/g,` `).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/https?:\/\/\S+/g,` `).replace(/[#*_~>`|!\[\](){}=+\-]/g,` `);n.push(...o(t))}else l.has(t)?(d.has(t)&&(e=e.replace(/<\/?[A-Z][A-Za-z0-9.]*[^>]*>/g,` `),e=e.replace(/<\/?(div|span|main|section|article|aside|nav|header|footer|form|input|button|select|option|textarea|table|thead|tbody|tr|td|th|ul|ol|li|a|img|p|h[1-6]|label|figure|figcaption|picture|video|audio|canvas|svg|path|circle|rect|g|defs|use|link|meta|head|html|body|script|style|br|hr|strong|em|code|pre|blockquote|small|sub|sup)\b[^>]*>/gi,` `),e=e.replace(/\b(className|onClick|onChange|onSubmit|onFocus|onBlur|onKeyDown|onKeyUp|onMouseDown|onMouseUp|htmlFor|tabIndex|strokeWidth|viewBox|fillOpacity|strokeOpacity|defaultValue|placeholder|disabled|checked|readOnly|required|multiple|autoFocus|autoComplete|type|href|src|alt|width|height|style|key|ref)\s*=/g,` =`)),e=e.replace(/^\s*(import\s+[\w.*{},\s'"@/-]+;?|from\s+['"][^'"]+['"]\s*;?|package\s+[\w.]+;?|namespace\s+[\w.]+;?|using\s+[\w.]+;?|require\s*\(?\s*['"][^'"]+['"]\s*\)?;?)\s*$/gm,``),e.replace(/(?:\/\/|#(?!.*[{}[\]<>])| -- )\s*(.+)$/gm,(e,t)=>(n.push(...o(t)),e)),e.replace(/\/\*[\s\S]*?\*\//g,e=>(n.push(...o(e)),e)),e.replace(/"""[\s\S]*?"""|'''[\s\S]*?'''/g,e=>(n.push(...o(e)),e)),e.replace(/["'`]([A-Za-zÀ-ÿ][A-Za-zÀ-ÿ\s,.'éàèùâêîôûç]{3,})["'`]/g,(e,t)=>(n.push(...o(t)),e)),e.replace(/\b([A-Za-z][A-Za-z0-9_]{2,})\b/g,(e,t)=>(n.push(...a(t)),e))):u.has(t)&&(e.replace(/:\s*["']([^"']{3,})["']/g,(e,t)=>(n.push(...o(t)),e)),e.replace(/\b([A-Za-z][A-Za-z0-9_]{2,})\b/g,(e,t)=>(n.push(...a(t)),e)));return n.filter(e=>!i(e))}let p=P(``),m=P(``),h=P(1),g=P(``),_=P(!0),v=P(!1),y=P(I(s.map(e=>({value:e.value,label:`.`+e.value,checked:!!e.def}))));function b(){return V(y).filter(e=>e.checked).map(e=>e.value)}let x=N(()=>V(y).every(e=>e.checked)),S=P(null),C=P(null),w=P(0),T=P(null),E=P(I([])),D=P(I([])),ee=P(!1),te=P(``),O=P(0),ne=P(I([]));function k(){localStorage.setItem(`wc-exts`,JSON.stringify(b()))}function A(){let e=V(x);F(y,V(y).map(t=>({...t,checked:!e})),!0),k()}function re(){k()}function ie(){return new Set((V(m)||``).split(/[\n,]/).map(e=>e.trim()).filter(Boolean))}function ae(e){let t=ie();t.has(e)||(t.add(e),F(m,[...t].join(`, `),!0),localStorage.setItem(`wc-exclude`,V(m)),V(ue)&&_e(V(fe)),se())}function oe(){localStorage.setItem(`wc-exclude`,V(m)),V(ue)&&_e(V(fe)),se()}function se(){V(ee)&&V(te)&&Ne(V(te))}function ce(){V(S)&&Me()}function le(){let e=localStorage.getItem(`wc-root`);e&&(F(p,e,!0),F(xe,e,!0));let t=localStorage.getItem(`wc-exclude`);t&&F(m,t,!0);let n=localStorage.getItem(`wc-exts`);if(n)try{let e=JSON.parse(n);F(y,V(y).map(t=>({...t,checked:e.includes(t.value)})),!0)}catch{}}let ue=P(!1),de=P(null),fe=P(``),pe=P(``),me=P(null),he=P(``);function ge(){F(ue,!V(ue)),V(ue)&&_e(V(fe)||V(p)||`/`)}async function _e(e){F(me,null),F(he,`Loading…`);try{let t=await fetch(`/api/browse?all=1&path=`+encodeURIComponent(e)).then(e=>e.json());F(fe,t.current,!0),F(de,t.parent,!0),F(pe,t.current,!0);let n=V(p).trim(),r=(e,t)=>n&&e.startsWith(n+`/`)?e.slice(n.length+1):t,i=ie(),a=(t.dirs||[]).filter(e=>!i.has(r(e.path,e.name))).map(e=>({kind:`dir`,name:e.name,path:e.path,entry:r(e.path,e.name)})),o=b(),s=(t.files||[]).filter(e=>o.some(t=>e.name.endsWith(`.`+t))).filter(e=>!i.has(r(e.path,e.name))).map(e=>({kind:`file`,name:e.name,entry:r(e.path,e.name)})),c=[...a,...s];F(me,c,!0),F(he,c.length?``:`Empty directory`,!0)}catch{F(me,[],!0),F(he,`Cannot read directory`)}}function ve(){V(de)&&_e(V(de))}let ye=P(!1),be=P(null),xe=P(``),Se=P(``),Ce=P(null),we=P(``);function Te(){F(ye,!V(ye)),V(ye)&&Ee(V(xe)||V(p)||`/`)}async function Ee(e){F(Ce,null),F(we,`Loading…`);try{let t=await fetch(`/api/browse?path=`+encodeURIComponent(e)).then(e=>e.json());F(xe,t.current,!0),F(be,t.parent,!0),F(Se,t.current,!0),F(Ce,(t.dirs||[]).map(e=>({name:e.name,path:e.path})),!0),F(we,V(Ce).length?``:`No sub-folders`,!0)}catch{F(Ce,[],!0),F(we,`Cannot read directory`)}}function De(){V(be)&&Ee(V(be))}function Oe(){F(p,V(xe),!0),localStorage.setItem(`wc-root`,V(xe)),F(ye,!1),F(m,``),localStorage.removeItem(`wc-exclude`),F(fe,V(xe),!0)}let ke=P(null),Ae=P(null),je=P(!1);function Me(){if(!V(S)||!V(C))return;let e=Math.max(1,V(h)||1),t=[...V(S).entries()].sort((e,t)=>t[1]-e[1]),n=t.filter(([t])=>(V(C).get(t)||new Set).size>=e).slice(0,150);if(!n.length){let n=t.length;F(g,n?`${n} domain word(s) found but none appear in ${e}+ file(s). Lower the "Min files" threshold to 1.`:`No domain words extracted. Try adding more file extensions or a broader folder.`,!0),F(_,!0),F(je,!1),F(v,!1);return}let r=[...V(S).keys()].filter(t=>(V(C).get(t)||new Set).size>=e).length;F(T,{scanned:V(w),unique:r,shown:n.length},!0);let i=n.slice(0,50),a=i[0][1];F(D,i.map(([e,t])=>({word:e,freq:t,pct:Math.round(t/a*100)})),!0),F(v,!0),F(_,!1);let o=document.documentElement.classList.contains(`dark`),s=o?[`#60a5fa`,`#34d399`,`#f9a8d4`,`#a78bfa`,`#fbbf24`,`#6ee7b7`,`#93c5fd`,`#fb923c`,`#4ade80`,`#f472b6`]:[`#1d4ed8`,`#047857`,`#7c3aed`,`#b45309`,`#be123c`,`#0369a1`,`#4338ca`,`#c2410c`,`#15803d`,`#9333ea`];requestAnimationFrame(()=>{if(!V(ke)||!V(Ae))return;let e=V(ke),t=V(Ae);e.width=Math.max(400,t.offsetWidth),e.height=Math.max(300,t.offsetHeight),e.style.width=e.width+`px`,e.style.height=e.height+`px`,F(je,!0);let n=Math.sqrt(e.width*e.height/(800*500)),r=Math.min(220,Math.round(72*n)),c=i.map(([e,t])=>[e,Math.max(12,Math.round(r*t/a))]);window.WordCloud?.(e,{list:c,gridSize:Math.round(4*e.width/1024),fontFamily:`ui-sans-serif, system-ui, sans-serif`,color:()=>s[Math.floor(Math.random()*s.length)],backgroundColor:o?`#030712`:`#ffffff`,rotateRatio:.2,minSize:6,shrinkToFit:!0,click:e=>Ne(e[0])})})}function Ne(e){if(!V(C)||!V(S))return;let t=[...V(C).get(e)||[]].sort(),n=V(S).get(e)||0;F(te,e,!0),F(O,n,!0),F(ne,t,!0),F(ee,!0)}function Pe(){F(ee,!1)}async function Fe(){let e=V(p).trim();if(!e){F(g,`Please select a root folder first.`),F(_,!0);return}let t=b();if(!t.length){F(g,`Please select at least one extension.`),F(_,!0);return}F(ye,!1),F(v,!1),F(ee,!1),F(g,`Reading files…`),F(_,!0),F(je,!1);try{let n=V(m).trim(),r=n?n.split(/[\n,]/).map(e=>e.trim()).filter(Boolean):[];localStorage.setItem(`wc-exclude`,n);let i=new URLSearchParams({path:e});t.forEach(e=>i.append(`ext`,e)),r.forEach(e=>i.append(`exclude`,e));let a=await fetch(`/api/wordcloud?`+i);if(!a.ok){F(g,`Error: `+((await a.json()).error||a.statusText));return}let{files:o,fileTexts:s}=await a.json();F(g,`Analyzing ${o} file(s)…`);let c=new Map,l=new Map,u=new Set;F(w,o,!0);for(let{path:e,text:t}of s){let n=(e.split(`.`).pop()||``).toLowerCase();n&&u.add(n);let r=f(t,n),i=new Set;for(let t of r)c.set(t,(c.get(t)||0)+1),i.has(t)||(i.add(t),l.has(t)||l.set(t,new Set),l.get(t).add(e))}F(S,c,!0),F(C,l,!0),F(E,[...u].sort().map(e=>`.`+e),!0),Me()}catch(e){F(g,`Error: `+e.message)}}let Ie=!1;kn(()=>{t.open&&!Ie?(Ie=!0,F(g,`Choose a root folder and click Launch.`),F(_,!0),F(je,!1),F(v,!1),F(ee,!1),F(S,null),F(C,null),F(T,null),F(D,[],!0),F(ye,!1),F(ue,!1),F(h,1),le(),V(p)||fetch(`/api/config`).then(e=>e.json()).then(e=>{e.docsFolder&&(F(p,e.docsFolder,!0),F(xe,e.docsFolder,!0))}).catch(()=>{})):t.open||(Ie=!1)});var Le=Wr(),Re=R(Le),ze=e=>{var n=$w(),r=L(n),i=L(r),a=L(i,!0);j(i);var o=z(i,2),s=L(o,!0);j(o),j(r);var c=z(r,2),l=L(c),u=L(l),d=L(u,!0);j(u);var f=z(u,2);ki(f);var b=z(f,2),S=z(L(b)),C=L(S,!0);j(S),j(b);var w=z(b,2),k=L(w,!0);j(w),j(l);var ie=z(l,2),se=L(ie),le=L(se,!0);j(se);var fe=z(se,2);yn(fe);var xe=z(fe,2),Me=z(L(xe)),Ie=L(Me,!0);j(Me),j(xe),j(ie);var Le=z(ie,2),Re=e=>{var t=Bw(),n=L(t),r=L(n),i=z(r,2),a=L(i,!0);j(i),j(n);var o=z(n,2),s=L(o),c=e=>{var t=Iw(),n=L(t,!0);j(t),B(()=>G(n,V(he))),W(e,t)},l=e=>{var t=Lw(),n=L(t,!0);j(t),B(()=>{vi(t,1,`px-3 py-3 text-xs ${V(he)===`Cannot read directory`?`text-red-400`:`text-gray-400`} text-center`),G(n,V(he))}),W(e,t)},u=e=>{var t=Wr();q(R(t),17,()=>V(me),Qr,(e,t)=>{var n=Wr(),r=R(n),i=e=>{var n=Rw(),r=L(n),i=z(L(r),2),a=L(i,!0);j(i),j(r);var o=z(r,2);j(n),B(()=>G(a,V(t).name)),H(`click`,r,()=>_e(V(t).path)),H(`click`,o,()=>ae(V(t).entry)),W(e,n)},a=e=>{var n=zw(),r=L(n),i=z(L(r),2),a=L(i,!0);j(i),j(r);var o=z(r,2);j(n),B(()=>G(a,V(t).name)),H(`click`,o,()=>ae(V(t).entry)),W(e,n)};K(r,e=>{V(t).kind===`dir`?e(i):e(a,-1)}),W(e,n)}),W(e,t)};K(s,e=>{V(me)===null?e(c):V(me).length===0?e(l,1):e(u,-1)}),j(o),j(t),B(()=>{r.disabled=!V(de),G(a,V(pe))}),H(`click`,r,ve),W(e,t)};K(Le,e=>{V(ue)&&e(Re)});var ze=z(Le,2),Be=L(ze),Ve=L(Be,!0);j(Be);var He=z(Be,2),Ue=L(He);ki(Ue);var We=z(Ue);j(He),q(z(He,2),17,()=>V(y),e=>e.value,(e,t,n)=>{var r=Vw(),i=L(r);ki(i);var a=z(i);j(r),B(()=>G(a,` ${V(t).label??``}`)),H(`change`,i,re),Ri(i,()=>V(t).checked,e=>V(t).checked=e),W(e,r)}),j(ze);var Ge=z(ze,2),Ke=e=>{var t=Bw(),n=L(t),r=L(n),i=z(r,2),a=L(i,!0);j(i),j(n);var o=z(n,2),s=L(o),c=e=>{var t=Iw(),n=L(t,!0);j(t),B(()=>G(n,V(we))),W(e,t)},l=e=>{var t=Ww(),n=R(t),r=e=>{var t=Lw(),n=L(t,!0);j(t),B(()=>{vi(t,1,`px-3 py-3 text-xs ${V(we)===`Cannot read directory`?`text-red-400`:`text-gray-400`} text-center`),G(n,V(we))}),W(e,t)},i=e=>{var t=Wr();q(R(t),17,()=>V(Ce),Qr,(e,t)=>{var n=Hw(),r=L(n),i=z(L(r),2),a=L(i,!0);j(i),j(r);var o=z(r,2);j(n),B(()=>G(a,V(t).name)),H(`click`,r,()=>Ee(V(t).path)),H(`click`,o,()=>ae(V(t).name)),W(e,n)}),W(e,t)};K(n,e=>{V(Ce).length===0?e(r):e(i,-1)});var a=z(n,2),o=e=>{var t=Uw(),n=z(L(t)),r=L(n,!0);j(n),j(t),B(()=>G(r,V(Se))),H(`click`,t,Oe),W(e,t)};K(a,e=>{V(we)!==`Cannot read directory`&&e(o)}),W(e,t)};K(s,e=>{V(Ce)===null?e(c):e(l,-1)}),j(o),j(t),B(()=>{r.disabled=!V(be),G(a,V(Se))}),H(`click`,r,De),W(e,t)};K(Ge,e=>{V(ye)&&e(Ke)}),j(c);var qe=z(c,2),Je=L(qe),Ye=e=>{var t=Jw(),n=L(t),r=L(n),i=e=>{var t=Kw(),n=R(t),r=L(n);j(n);var i=z(n,2),a=L(i);j(i);var o=z(i,2),s=L(o);j(o);var c=z(o,2),l=e=>{var t=Gw(),n=L(t);j(t),B((e,r)=>{J(t,`title`,e),G(n,`${V(E).length??``} extension${V(E).length>1?`s`:``} found (${r??``})`)},[()=>V(E).join(`, `),()=>V(E).join(`, `)]),W(e,t)};K(c,e=>{V(E).length&&e(l)}),B(()=>{G(r,`${V(T).scanned??``} file(s) scanned`),G(a,`${V(T).unique??``} unique domain words`),G(s,`${V(T).shown??``} shown`)}),W(e,t)};K(r,e=>{V(T)&&e(i)}),j(n);var a=z(n,2),o=L(a),s=L(o,!0);j(o);var c=z(o,2);ki(c);var l=z(c,2),u=L(l,!0);j(l),j(a);var d=z(a,2),f=L(d,!0);j(d);var p=z(d,2);q(p,21,()=>V(D),Qr,(e,t,n)=>{var r=qw(),i=L(r);i.textContent=n+1;var a=z(i,2),o=L(a),s=L(o),c=L(s,!0);j(s);var l=z(s,2),u=L(l,!0);j(l),j(o);var d=z(o,2),f=L(d);j(d),j(a),j(r),B(()=>{G(c,V(t).word),G(u,V(t).freq),bi(f,`width:${V(t).pct??``}%`)}),H(`click`,r,()=>Ne(V(t).word)),W(e,r)}),j(p),j(t),B((e,t,n,r,i,a)=>{J(o,`title`,e),G(s,t),J(c,`title`,n),J(l,`title`,r),G(u,i),G(f,a)},[()=>Y(`wc.min_files_hint`),()=>Y(`wc.min_files_label`),()=>Y(`wc.min_files_hint`),()=>Y(`wc.apply_hint`),()=>Y(`wc.apply_btn`),()=>Y(`wc.top_words`)]),Fi(c,()=>V(h),e=>F(h,e)),H(`click`,l,ce),W(e,t)};K(Je,e=>{V(v)&&e(Ye)});var Xe=z(Je,2),Ze=L(Xe),Qe=e=>{var t=Yw(),n=L(t,!0);j(t),B(()=>G(n,V(g))),W(e,t)};K(Ze,e=>{V(_)&&e(Qe)});var $e=z(Ze,2);let et;Ui($e,e=>F(ke,e),()=>V(ke)),j(Xe),Ui(Xe,e=>F(Ae,e),()=>V(Ae));var tt=z(Xe,2),nt=e=>{var t=Qw(),n=L(t),r=L(n),i=L(r);j(r);var a=z(r,2);j(n);var o=z(n,2),s=L(o,!0);j(o);var c=z(o,2),l=L(c),u=e=>{var t=Wr();q(R(t),17,()=>V(ne),Qr,(e,t)=>{var n=Xw(),r=L(n),i=L(r,!0);j(r);var a=z(r,2);j(n),B(()=>G(i,V(t))),H(`click`,a,()=>ae(V(t))),W(e,n)}),W(e,t)},d=e=>{W(e,Zw())};K(l,e=>{V(ne).length?e(u):e(d,-1)}),j(c),j(t),B(e=>{G(i,`${V(te)??``} ×${V(O)??``}`),G(s,e)},[()=>Y(`wc.found_in`)]),H(`click`,a,Pe),W(e,t)};K(tt,e=>{V(ee)&&e(nt)}),j(qe),j(n),B((e,t,n,r,i,o,c,l,u,f)=>{G(a,e),G(s,t),G(d,n),G(C,r),G(k,i),G(le,o),J(fe,`placeholder`,c),G(Ie,l),G(Ve,u),ji(Ue,V(x)),G(We,` ${f??``}`),et=vi($e,1,``,null,et,{hidden:!V(je)})},[()=>Y(`wc.title`),()=>Y(`wc.close_btn`),()=>Y(`wc.search_root_label`),()=>Y(`wc.browse_btn`),()=>Y(`wc.launch_btn`),()=>Y(`wc.exclude_label`),()=>Y(`wc.exclude_placeholder`),()=>Y(`wc.browse_btn`),()=>Y(`wc.extensions_label`),()=>Y(`wc.all_btn`)]),H(`click`,o,function(...e){t.onclose?.apply(this,e)}),Fi(f,()=>V(p),e=>F(p,e)),H(`click`,b,Te),H(`click`,w,Fe),H(`input`,fe,oe),Fi(fe,()=>V(m),e=>F(m,e)),H(`click`,xe,ge),H(`change`,Ue,A),W(e,n)};K(Re,e=>{t.open&&e(ze)}),W(e,Le),Je()}Pr([`click`,`input`,`change`]);var tT=U(`<button class="ghost-button"><i class="fa-solid fa-cloud"></i></button>`),nT=U(`<button title="Toggle dark mode" class="ghost-button" aria-label="Toggle dark mode"> </button>`),rT=U(`<!> <!>`,1),iT=U(`<div class="relative hidden sm:block"><input type="search" class="w-56 pl-8 pr-3 py-1.5 text-sm rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500"/> <span class="absolute left-2.5 top-2 text-gray-400 text-sm pointer-events-none">🔍</span></div>`),aT=U(`<p class="p-8 text-red-500"> </p>`),oT=U(`<div class="h-full flex items-center justify-center p-8"><div class="max-w-md text-center"><div class="text-5xl mb-4 select-none" aria-hidden="true">📚</div> <h2 class="text-xl font-semibold text-gray-700 dark:text-gray-300 mb-2"> </h2> <p class="text-sm text-gray-500 dark:text-gray-500"> </p></div></div>`),sT=U(`<div class="app-shell bg-gray-50 text-gray-900 dark:bg-gray-900 dark:text-gray-100"><!> <div class="flex overflow-hidden"><!> <main id="home-content-area" class="flex-1 overflow-y-auto"><!></main></div></div> <!> <!> <!> <!>`,1);function cT(e,t){qe(t,!0);let n=P(!1),r=P(!1),i=P(!1),a=P(!1),o=P(null),s=P(!1),c=P(``),l=P(!1),u=P(!1),d=P(`Living AI Documentation`),f=null;function p(){try{let e=localStorage.getItem(`ld-dark`);if(e!==null)return e===`true`}catch{}return window.matchMedia(`(prefers-color-scheme: dark)`).matches}function m(e){is()&&(e=!1),F(l,e,!0),document.documentElement.classList.toggle(`dark`,e)}function h(){m(!V(l));try{localStorage.setItem(`ld-dark`,String(V(l)))}catch{}}kn(()=>{let e=document.getElementById(`hljs-dark`),t=document.getElementById(`hljs-light`);if(!e||!t)return;let n=X.codeBlockLightTheme&&!V(l);e.disabled=n,t.disabled=!n,document.body.classList.toggle(`ld-code-light`,n)});function g(e){let t=e.trim();if(f&&clearTimeout(f),!t){X.searchQuery=``,X.searchResults=null;return}X.searchQuery=t,X.searchResults=X.allDocs.filter(e=>e.title.toLowerCase().includes(t.toLowerCase())),f=window.setTimeout(async()=>{try{let e=await J_(t);t===X.searchQuery&&(X.searchResults=e)}catch{}},350)}let _=P(I([]));function v(e){let t=V(_)[e];t&&(F(_,V(_).slice(0,e),!0),y(t.id,!1,`restore`))}async function y(e,t=!1,n=!1,r=null){if(n===!0&&X.currentDocId&&X.currentDocId!==e){let t=V(_).findIndex(t=>t.id===e);if(t!==-1)F(_,V(_).slice(0,t),!0);else{let e=X.allDocs.find(e=>e.id===X.currentDocId);F(_,[...V(_),{id:X.currentDocId,title:e?e.title:X.currentDocId}],!0)}}else n||F(_,[],!0);X.currentDocId=e;let i=X.allDocs.find(t=>t.id===e);if(i&&X.revealDoc(i),!t){let t=new URL(location.href);t.searchParams.set(`doc`,e),t.hash=r?`#${r}`:``,history.pushState({docId:e,anchor:r||null},``,t)}F(s,!0),F(c,``);try{let t=await W_(e);t.id=e,F(o,t,!0),document.title=t.title,requestAnimationFrame(()=>{let e=document.getElementById(`home-content-area`);if(r){let t=document.getElementById(r);t&&e&&(e.scrollTop+=t.getBoundingClientRect().top-e.getBoundingClientRect().top-80)}else e&&(e.scrollTop=0)})}catch(e){F(c,Y(`doc.failed_to_load`)+(e instanceof Error?e.message:String(e)))}finally{F(s,!1)}}async function b(e){if(!V(o))return;let t=V(o).id,n=await fetch(`/api/documents/`+t,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({content:e})});if(!n.ok)throw Error(await n.text());let r=await W_(t);r.id=t,F(o,r,!0);let i=e.match(/\]\(\s*\.?\/files\/[^)\s]+/g),a={...X.fileAttachmentCounts};i&&i.length?a[t]=i.length:delete a[t],X.fileAttachmentCounts=a}function x(e){let t=X.allDocs.find(t=>t.id===e);if(!t)return null;let n=(t.folder||[]).join(`/`),r=X.allDocs.filter(e=>(e.folder||[]).join(`/`)===n).slice().sort((e,t)=>(e.filename||``).localeCompare(t.filename||``)),i=r.findIndex(t=>t.id===e);if(i===-1)return null;let a=r[i+1]??r[i-1];return a?a.id:null}async function S(){if(!V(o))return;let e=V(o).id;if(!(await fetch(`/api/documents/`+encodeURIComponent(e),{method:`DELETE`})).ok)return;let t=x(e);X.allDocs=X.allDocs.filter(t=>t.id!==e),Array.isArray(X.searchResults)&&(X.searchResults=X.searchResults.filter(t=>t.id!==e));let n={...X.annotationCounts};delete n[e],X.annotationCounts=n;let r={...X.fileAttachmentCounts};delete r[e],X.fileAttachmentCounts=r,t?await y(t):(X.currentDocId=null,F(o,null),history.pushState({},``,location.pathname))}async function C(e,t){let n=X.currentDocId?iv(X.currentDocId,e,t):null;if(await w(),!n)return;X.currentDocId=n;try{F(o,{...await W_(n),id:n},!0)}catch{}let r=new URL(location.href);r.searchParams.set(`doc`,n),history.replaceState({docId:n,anchor:r.hash.slice(1)||null},``,r);let i=X.allDocs.find(e=>e.id===n);i&&X.revealDoc(i)}async function w(){let[e,t,n]=await Promise.all([z_(),R_(),B_()]);if(X.allDocs=e,X.explorerTree=n,X.docsFolder=typeof t.docsFolder==`string`?t.docsFolder:``,t.docsFolder)try{X.allFolderPaths=await U_(t.docsFolder)}catch{X.allFolderPaths=[]}let[r,i,a]=await Promise.all([G_(),K_(),q_()]);X.annotationCounts=r,X.fileAttachmentCounts=i,X.docStatuses=a}Ji(async()=>{F(u,is(),!0),m(p());let e=await R_();await Ca(e.language||`en`),e.title&&(document.title=e.title,F(d,e.title,!0)),X.exclusiveFolderExpansion=!!e.exclusiveFolderExpansion,X.codeBlockMaxHeight=typeof e.codeBlockMaxHeight==`number`?e.codeBlockMaxHeight:400,X.imageRoundedCorners=!!e.imageRoundedCorners,X.imageCentered=!!e.imageCentered,X.imageBorder=!!e.imageBorder,X.codeBlockLightTheme=!!e.codeBlockLightTheme,X.codeBlockMaxHeight>0&&document.documentElement.style.setProperty(`--ld-code-max-h`,X.codeBlockMaxHeight+`px`),await w();let t=new URLSearchParams(location.search).get(`doc`);if(t)y(t,!0,!1,location.hash?location.hash.slice(1):null);else{let t=Array.isArray(e.favorites)?e.favorites:[],n=t.length?t[0]?.id:void 0,r=(n?X.allDocs.find(e=>e.id===n):void 0)??X.allDocs.find(e=>!e.folder?.length)??X.allDocs[0];r&&y(r.id,!0)}let n=e=>{let t=e.state?.docId||new URLSearchParams(location.search).get(`doc`),n=e.state?.anchor||(location.hash.length>1?location.hash.slice(1):null);t&&y(t,!0,!1,n)};window.addEventListener(`popstate`,n);let r=()=>{w()};return window.addEventListener(`ld:documents-changed`,r),()=>{window.removeEventListener(`popstate`,n),window.removeEventListener(`ld:documents-changed`,r)}});var T=sT(),E=R(T),D=L(E);es(D,{get title(){return V(d)},subtitle:``,actions:e=>{var t=rT(),n=R(t),r=e=>{var t=tT();B((e,n)=>{J(t,`title`,e),J(t,`aria-label`,n)},[()=>Y(`nav.word_cloud`),()=>Y(`nav.word_cloud`)]),H(`click`,t,()=>F(a,!0)),W(e,t)},i=N(()=>!va.hidden.includes(ha));K(n,e=>{V(i)&&e(r)});var o=z(n,2),s=e=>{var t=nT(),n=L(t,!0);j(t),B(()=>G(n,V(l)?`☀`:`☾`)),H(`click`,t,h),W(e,t)};K(o,e=>{V(u)||e(s)}),W(e,t)},children:(e,t)=>{var n=iT(),r=L(n);ki(r),Ie(2),j(n),B(e=>{J(r,`placeholder`,e),Ai(r,X.searchQuery)},[()=>Y(`nav.search_placeholder`)]),H(`input`,r,e=>g(e.target.value)),W(e,n)},$$slots:{actions:!0,default:!0}});var ee=z(D,2),te=L(ee);yv(te,{onopen:e=>y(e),onsearch:g,onexport:()=>F(i,!0),onnewfolder:()=>F(n,!0),onnewdoc:()=>F(r,!0),onmoved:C});var O=z(te,2),ne=L(O),k=e=>{var t=Wr(),n=R(t),r=e=>{var t=aT(),n=L(t,!0);j(t),B(()=>G(n,V(c))),W(e,t)},i=e=>{yw(e,{get doc(){return V(o)},get navHistory(){return V(_)},ongoback:v,onopen:(e,t)=>y(e,!1,!0,t),onsave:b,ondelete:S})};K(n,e=>{V(c)?e(r):e(i,-1)}),W(e,t)},A=e=>{var t=oT(),n=L(t),r=z(L(n),2),i=L(r,!0);j(r);var a=z(r,2),o=L(a,!0);j(a),j(n),j(t),B((e,t)=>{G(i,e),G(o,t)},[()=>Y(`welcome.title`),()=>Y(`welcome.hint`)]),W(e,t)};K(ne,e=>{V(o)?e(k):e(A,-1)}),j(O),j(ee),j(E);var re=z(E,2);Dw(re,{get open(){return V(n)},onclose:()=>F(n,!1),onsuccess:w});var ie=z(re,2);Ja(ie,{get open(){return V(r)},onclose:()=>F(r,!1),onsuccess:async e=>{await w(),y(e)}});var ae=z(ie,2);Fw(ae,{get open(){return V(i)},onclose:()=>F(i,!1)}),eT(z(ae,2),{get open(){return V(a)},onclose:()=>F(a,!1)}),W(e,T),Je()}Pr([`click`,`input`]);var lT=`modulepreload`,uT=function(e){return`/`+e},dT={},fT=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,new URL(`../../../src/node/plugins/importAnalysisBuild.ts`,import.meta.url)).href}r=o(t.map(t=>{if(t=uT(t,n),t=s(t),t in dT)return;dT[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:lT,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},pT=U(`<div class="flex flex-col h-screen overflow-hidden bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100"><header class="flex items-center gap-1 px-2 h-12 shrink-0 border-b border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-sm z-10"><button class="tool-btn !w-auto px-2 text-xs font-medium text-gray-500 dark:text-gray-400"> </button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnSidebar" class="tool-btn">☰</button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnCopyDiagramId" class="tool-btn"><svg width="15" height="15" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="5" width="8" height="9" rx="1.5"></rect><path d="M3 11V3a1 1 0 0 1 1-1h7"></path></svg></button> <button id="toolSelect" class="tool-btn tool-active"><svg width="11" height="13" viewBox="0 0 11 13" fill="currentColor" stroke="none"><path d="M1 1 L1 12 L4 9 L6.5 13 L8 12.2 L5.5 8.2 L10 8.2 Z"></path></svg></button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="toolBox" class="tool-btn"><svg width="15" height="10" viewBox="0 0 15 10" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="1" y="1" width="13" height="8" rx="1"></rect></svg></button> <button id="toolEllipse" class="tool-btn"><svg width="16" height="10" viewBox="0 0 16 10" fill="none" stroke="currentColor" stroke-width="1.5"><ellipse cx="8" cy="5" rx="7" ry="4"></ellipse></svg></button> <button id="toolDatabase" class="tool-btn"><svg width="12" height="16" viewBox="0 0 12 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><ellipse cx="6" cy="3" rx="5" ry="2"></ellipse><path d="M1 3v10c0 1.1 2.2 2 5 2s5-.9 5-2V3"></path><path d="M11 7.5c0 1.1-2.2 2-5 2s-5-.9-5-2"></path></svg></button> <button id="toolCircle" class="tool-btn"><svg width="13" height="13" viewBox="0 0 13 13" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="6.5" cy="6.5" r="5.5"></circle></svg></button> <button id="toolActor" class="tool-btn"><svg width="12" height="17" viewBox="0 0 12 17" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="6" cy="3" r="2.2"></circle><line x1="6" y1="5.2" x2="6" y2="10"></line><line x1="1.5" y1="7.5" x2="10.5" y2="7.5"></line><line x1="6" y1="10" x2="2.5" y2="15"></line><line x1="6" y1="10" x2="9.5" y2="15"></line></svg></button> <button id="toolPostIt" class="tool-btn"><svg width="13" height="13" viewBox="0 0 13 13" fill="none" stroke="currentColor" stroke-width="1.4"><path d="M1 1 H9 L12 4 V12 H1 Z"></path><path d="M9 1 V4 H12" stroke-opacity="0.5"></path></svg></button> <button id="toolTextFree" class="tool-btn" style="font-size:11px; font-weight:600;">T</button> <button id="toolImage" class="tool-btn"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="1" width="12" height="12" rx="1.5"></rect><circle cx="4.5" cy="4.5" r="1.2"></circle><path d="M1 9.5 L4 6.5 L6.5 9 L9 7 L13 10.5"></path></svg></button> <a href="/shape-editor" class="tool-btn">✦</a> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="toolArrow" class="tool-btn">→</button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnDelete" class="tool-btn"><svg width="11" height="11" viewBox="0 0 11 11" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><line x1="1" y1="1" x2="10" y2="10"></line><line x1="10" y1="1" x2="1" y2="10"></line></svg></button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnDiagramDefaults" class="tool-btn"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492M5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0"></path><path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.474l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115z"></path></svg></button> <button id="btnAlign" class="tool-btn"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4"><line x1="0.5" y1="7.5" x2="13.5" y2="7.5"></line><line x1="3.5" y1="0.5" x2="3.5" y2="13.5" stroke-dasharray="1.5 1.5"></line><line x1="10.5" y1="0.5" x2="10.5" y2="13.5" stroke-dasharray="1.5 1.5"></line></svg></button> <button id="btnGrid" class="tool-btn"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.2"><line x1="5" y1="1" x2="5" y2="13"></line><line x1="9" y1="1" x2="9" y2="13"></line><line x1="1" y1="5" x2="13" y2="5"></line><line x1="1" y1="9" x2="13" y2="9"></line><rect x="1" y="1" width="12" height="12" rx="1"></rect></svg></button> <button id="btnEdgeStraight" class="tool-btn"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><line x1="2" y1="12" x2="12" y2="2"></line><polyline points="8,2 12,2 12,6"></polyline></svg></button> <button id="btnEvidenceMode" class="tool-btn"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M4 1.5 H8.5 L11 4 V12.5 H4 Z"></path><path d="M8.5 1.5 V4 H11"></path><path d="M1.5 5.5 H6.5"></path><path d="M1.5 8 H6.5"></path><path d="M1.5 10.5 H5"></path></svg></button> <button id="btnResizeMode" class="tool-btn active-tool"><svg id="icon-resize-corner" width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="1" width="12" height="12" stroke-dasharray="2.5 2"></rect><line x1="4" y1="4" x2="10" y2="10"></line><polyline points="7,10 10,10 10,7"></polyline></svg> <svg id="icon-resize-center" width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="hidden"><rect x="1" y="1" width="12" height="12" stroke-dasharray="2.5 2"></rect><line x1="4" y1="4" x2="10" y2="10"></line><polyline points="4,6.5 4,4 6.5,4"></polyline><polyline points="10,7.5 10,10 7.5,10"></polyline><line x1="10" y1="4" x2="4" y2="10"></line><polyline points="7.5,4 10,4 10,6.5"></polyline><polyline points="4,7.5 4,10 6.5,10"></polyline></svg></button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <input id="diagramTitle" type="text" class="flex-1 min-w-0 px-2 py-1 text-sm bg-transparent border-0 focus:outline-none focus:ring-1 focus:ring-blue-500 rounded text-gray-700 dark:text-gray-300 placeholder:text-gray-400"/> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnZoomOut" class="tool-btn">−</button> <span id="zoomLevel" class="text-xs text-gray-500 dark:text-gray-400 w-10 text-center tabular-nums select-none">100%</span> <button id="btnZoomIn" class="tool-btn">+</button> <button id="btnZoomReset" class="tool-btn">⊡</button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnDark" class="tool-btn"><span id="darkIcon">☽</span></button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnDebug" class="hidden tool-btn text-xs font-mono">dbg</button> <div id="sepDebug" class="hidden w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnExportDrawio" class="tool-btn"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg></button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnSave" disabled="" class="px-3 py-1.5 text-xs font-semibold rounded-lg bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-40 disabled:cursor-not-allowed shrink-0 transition-colors"><span> </span></button></header> <div class="flex flex-1 overflow-hidden"><div id="sidebar" class="w-56 shrink-0 border-r border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 flex flex-col overflow-hidden" style="transition: width 0.2s ease"><div class="flex items-center justify-between px-3 py-2 border-b border-gray-200 dark:border-gray-700 shrink-0"><span class="text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider"> </span> <button id="btnNewDiagram" class="text-xs font-medium text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 transition-colors"> </button></div> <div id="diagramList" class="flex-1 overflow-y-auto py-1"></div></div> <div role="separator" aria-orientation="vertical"></div> <div class="relative flex-1 overflow-hidden bg-gray-50 dark:bg-gray-950"><div id="vis-canvas" class="w-full h-full"></div> <div id="customShapeBar" class="hidden"><div id="customShapeBarBody"></div></div> <div id="debugLayer"></div> <div id="evidenceLayer" class="hidden"></div> <div id="stampOverlay" style="position:absolute;inset:0;display:none;z-index:11;cursor:crosshair;"></div> <div id="selectionOverlay"><div id="rh-tl" class="resize-handle" style="top: -5px; left: -5px; cursor: nw-resize"></div> <div id="rh-tr" class="resize-handle" style="top: -5px; right: -5px; cursor: ne-resize"></div> <div id="rh-bl" class="resize-handle" style="bottom: -5px; left: -5px; cursor: sw-resize"></div> <div id="rh-br" class="resize-handle" style="bottom: -5px; right: -5px; cursor: se-resize"></div> <div id="rh-rotate">↻</div> <div id="rh-label-rotate" style="left: 0; top: -28px;"><svg width="10" height="10" viewBox="0 0 10 10" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><g transform="rotate(25,5,5)"><line x1="2.5" y1="3" x2="7.5" y2="3"></line><line x1="5" y1="3" x2="5" y2="8"></line></g></svg></div></div> <aside id="evidencePanel" class="hidden absolute top-0 right-0 bottom-0 w-80 max-w-[85vw] z-30 bg-gray-50 dark:bg-gray-900 border-l border-gray-200 dark:border-gray-700 shadow-xl flex flex-col"><div class="flex items-center justify-between gap-2 px-4 py-3 border-b border-gray-200 dark:border-gray-700"><h2 id="evidencePanelTitle" class="text-sm font-semibold text-gray-800 dark:text-gray-100"> </h2> <button id="btnEvidenceClose" class="tool-btn !w-7 !h-7">×</button></div> <div id="evidencePanelBody" class="flex-1 overflow-y-auto p-3 space-y-3"></div></aside> <div id="nodePanel" class="float-panel hidden"><button id="btnNodeLock" class="tool-btn !w-6 !h-6 text-sm">🔒</button> <div class="panel-sep"></div> <div id="nodePanelControls" class="contents"><button id="nodeColorSwatch" style="width:1.5rem;height:1.5rem;border-radius:0.25rem;border:2px solid #a8a29e;background:#f5f5f4;cursor:pointer;flex-shrink:0;"></button> <div class="panel-sep"></div> <input id="nodeBgOpacity" type="range" min="0" max="100" step="5" value="100" class="w-16 h-1 accent-orange-500 cursor-pointer"/> <div class="panel-sep"></div> <button id="btnNodeLabelEdit" class="tool-btn !w-6 !h-6">✎</button> <button id="btnNodeLink" class="tool-btn !w-6 !h-6"><svg width="13" height="13" viewBox="0 0 13 13" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M5 7.5a3.5 3.5 0 0 0 5 0l1.5-1.5a3.5 3.5 0 0 0-5-5L5 2.5"></path><path d="M8 5.5a3.5 3.5 0 0 0-5 0L1.5 7a3.5 3.5 0 0 0 5 5L8 10.5"></path></svg></button> <div class="panel-sep"></div> <button id="btnNodeFontDecrease" class="tool-btn !w-8 !h-6" style="font-size: 10px">Aa−</button> <span id="nodeFontSizeValue" class="inline-flex items-center justify-center min-w-[2.25rem] h-6 px-1 text-[11px] font-mono text-gray-700 dark:text-gray-200 border border-gray-300 dark:border-gray-600 rounded bg-white/80 dark:bg-gray-800/80">13</span> <button id="btnNodeFontIncrease" class="tool-btn !w-8 !h-6" style="font-size: 10px">Aa+</button> <div class="panel-sep"></div> <button id="btnAlignLeft" class="tool-btn !w-6 !h-6"><svg width="12" height="10" viewBox="0 0 12 10" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"><line x1="1" y1="2" x2="11" y2="2"></line><line x1="1" y1="5" x2="7" y2="5"></line><line x1="1" y1="8" x2="9" y2="8"></line></svg></button> <button id="btnAlignCenter" class="tool-btn !w-6 !h-6"><svg width="12" height="10" viewBox="0 0 12 10" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"><line x1="1" y1="2" x2="11" y2="2"></line><line x1="2.5" y1="5" x2="9.5" y2="5"></line><line x1="1.5" y1="8" x2="10.5" y2="8"></line></svg></button> <button id="btnAlignRight" class="tool-btn !w-6 !h-6"><svg width="12" height="10" viewBox="0 0 12 10" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"><line x1="1" y1="2" x2="11" y2="2"></line><line x1="5" y1="5" x2="11" y2="5"></line><line x1="3" y1="8" x2="11" y2="8"></line></svg></button> <div class="panel-sep"></div> <button id="btnValignTop" class="tool-btn !w-6 !h-6"><svg width="10" height="12" viewBox="0 0 10 12" fill="none" stroke="currentColor" stroke-linecap="round"><line x1="1" y1="1.5" x2="9" y2="1.5" stroke-width="2"></line><line x1="1" y1="5" x2="8" y2="5" stroke-width="1.3"></line><line x1="1" y1="8.5" x2="6" y2="8.5" stroke-width="1.3"></line></svg></button> <button id="btnValignMiddle" class="tool-btn !w-6 !h-6"><svg width="10" height="12" viewBox="0 0 10 12" fill="none" stroke="currentColor" stroke-linecap="round"><line x1="1" y1="2.5" x2="8" y2="2.5" stroke-width="1.3"></line><line x1="1" y1="6" x2="9" y2="6" stroke-width="2"></line><line x1="1" y1="9.5" x2="6" y2="9.5" stroke-width="1.3"></line></svg></button> <button id="btnValignBottom" class="tool-btn !w-6 !h-6"><svg width="10" height="12" viewBox="0 0 10 12" fill="none" stroke="currentColor" stroke-linecap="round"><line x1="1" y1="3.5" x2="8" y2="3.5" stroke-width="1.3"></line><line x1="1" y1="7" x2="6" y2="7" stroke-width="1.3"></line><line x1="1" y1="10.5" x2="9" y2="10.5" stroke-width="2"></line></svg></button> <div class="panel-sep"></div> <div id="customShapeLabelPlacementControls" class="hidden"><button class="tool-btn !w-7 !h-6 font-mono text-[10px]" data-label-placement="above">T↑</button> <button class="tool-btn !w-7 !h-6 font-mono text-[10px]" data-label-placement="below">T↓</button> <button class="tool-btn !w-7 !h-6 font-mono text-[10px]" data-label-placement="left">←T</button> <button class="tool-btn !w-7 !h-6 font-mono text-[10px]" data-label-placement="right">T→</button> <button class="tool-btn !w-7 !h-6 font-mono text-[10px]" data-label-placement="center">T□</button> <div class="panel-sep"></div></div> <button id="btnZOrderBack" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="5" width="8" height="8" rx="1"></rect><rect x="5" y="1" width="8" height="8" rx="1" stroke-opacity="0.35"></rect></svg></button> <button id="btnZOrderFront" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="5" width="8" height="8" rx="1" stroke-opacity="0.35"></rect><rect x="5" y="1" width="8" height="8" rx="1"></rect></svg></button> <div class="panel-sep"></div> <button id="btnStampColor" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M7 2 C7 2 3 6.5 3 9 a4 4 0 0 0 8 0 C11 6.5 7 2 7 2 Z" fill="currentColor" fill-opacity="0.25"></path></svg></button> <button id="btnStampFontSize" class="tool-btn !w-7 !h-6 font-mono text-xs font-bold">Aa</button> <button id="btnStampSize" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="4" width="6" height="6" rx="0.8" fill="currentColor" fill-opacity="0.25"></rect><path d="M10 2 L12 2 L12 4"></path><path d="M12 2 L9 5"></path><path d="M10 12 L12 12 L12 10"></path><path d="M12 12 L9 9"></path></svg></button> <div class="panel-sep"></div> <button id="btnRotateCCW" class="tool-btn !w-7 !h-6" style="font-size:15px; line-height:1;">↺</button> <button id="btnRotateCW" class="tool-btn !w-7 !h-6" style="font-size:15px; line-height:1;">↻</button> <div class="panel-sep"></div> <button id="btnCopyPng" class="tool-btn !h-6 px-1.5 font-mono text-xs font-semibold flex items-center gap-0.5"><svg width="10" height="10" viewBox="0 0 10 10" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="7" x2="5" y2="1"></line><polyline points="2,4 5,1 8,4"></polyline><line x1="1" y1="9" x2="9" y2="9"></line></svg> PNG</button> <div class="panel-sep"></div> <button id="btnGroup" class="tool-btn !w-8 !h-7"><svg width="22" height="14" viewBox="0 0 22 14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"><rect x="0.7" y="1" width="20.6" height="12" rx="2" stroke-dasharray="2.5,1.5"></rect><rect x="4" y="4.5" width="3" height="5" rx="1" fill="currentColor"></rect><rect x="15" y="4.5" width="3" height="5" rx="1" fill="currentColor"></rect></svg></button> <button id="btnUngroup" class="tool-btn !w-8 !h-7"><svg width="26" height="14" viewBox="0 0 26 14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"><rect x="0.7" y="1" width="9" height="12" rx="2" stroke-dasharray="2.5,1.5"></rect><rect x="3" y="4.5" width="3" height="5" rx="1" fill="currentColor"></rect><rect x="16.3" y="1" width="9" height="12" rx="2" stroke-dasharray="2.5,1.5"></rect><rect x="19" y="4.5" width="3" height="5" rx="1" fill="currentColor"></rect></svg></button> <div class="panel-sep"></div> <button id="btnSaveShapeDefault" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492M5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0"></path><path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.474l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115z"></path></svg></button></div></div> <div id="linkPanel" class="float-panel hidden" style="min-width:260px; flex-direction:column; align-items:stretch; gap:0.5rem; padding:0.75rem;"><div class="text-xs font-semibold text-gray-500 dark:text-gray-400 mb-1"> </div> <label class="flex items-center gap-2 text-xs cursor-pointer"><input type="radio" name="linkType" id="linkTypeUrl" value="url" class="accent-orange-500"/> <span> </span></label> <div id="linkUrlRow"><input id="linkUrlInput" type="url" class="w-full text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-1 focus:ring-orange-400"/></div> <label class="flex items-center gap-2 text-xs cursor-pointer"><input type="radio" name="linkType" id="linkTypeDiagram" value="diagram" class="accent-orange-500"/> <span> </span></label> <div id="linkDiagramRow" class="hidden"><select id="linkDiagramSelect" class="w-full text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-1 focus:ring-orange-400"></select></div> <label class="flex items-center gap-2 text-xs cursor-pointer"><input type="radio" name="linkType" id="linkTypeNew" value="new" class="accent-orange-500"/> <span> </span></label> <div id="linkNewRow" class="hidden"><input id="linkNewName" type="text" class="w-full text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-1 focus:ring-orange-400"/></div> <div class="flex gap-1 mt-1"><button id="btnLinkSave" class="flex-1 text-xs bg-orange-500 hover:bg-orange-600 text-white rounded px-2 py-1"> </button> <button id="btnLinkRemove" class="text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 hover:bg-red-50 dark:hover:bg-red-900/20 hover:text-red-600"> </button> <button id="btnLinkCancel" class="text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 hover:bg-gray-100 dark:hover:bg-gray-700">✕</button></div></div> <div id="edgePanel" class="float-panel hidden"><button id="btnEdgeLock" class="tool-btn !w-6 !h-6 text-sm">🔒</button> <div class="panel-sep"></div> <div id="edgePanelControls" class="contents"><button id="edgeBtnNone" class="tool-btn !w-7 !h-6 font-mono text-xs">—</button> <button id="edgeBtnFrom" class="tool-btn !w-7 !h-6 text-xs">←</button> <button id="edgeBtnTo" class="tool-btn !w-7 !h-6 text-xs">→</button> <button id="edgeBtnBoth" class="tool-btn !w-8 !h-6 text-xs">←→</button> <div class="panel-sep"></div> <button id="edgeBtnSolid" class="tool-btn !w-8 !h-6"><svg width="22" height="4" viewBox="0 0 22 4"><line x1="1" y1="2" x2="21" y2="2" stroke="currentColor" stroke-width="2" stroke-linecap="round"></line></svg></button> <button id="edgeBtnDashed" class="tool-btn !w-8 !h-6"><svg width="22" height="4" viewBox="0 0 22 4"><line x1="1" y1="2" x2="21" y2="2" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-dasharray="4,3"></line></svg></button> <div class="panel-sep"></div> <button id="btnEdgeFontDecrease" class="tool-btn !w-8 !h-6" style="font-size: 10px">Aa−</button> <span id="edgeFontSizeValue" class="inline-flex items-center justify-center min-w-[2.25rem] h-6 px-1 text-[11px] font-mono text-gray-700 dark:text-gray-200 border border-gray-300 dark:border-gray-600 rounded bg-white/80 dark:bg-gray-800/80">11</span> <button id="btnEdgeFontIncrease" class="tool-btn !w-8 !h-6" style="font-size: 10px">Aa+</button> <div class="panel-sep"></div> <button id="btnEdgeLabelEdit" class="tool-btn !w-6 !h-6">✎</button> <button id="btnEdgeLabelWidthReset" class="tool-btn !w-6 !h-6 text-xs">↔</button> <div class="panel-sep"></div> <button id="btnEdgeLabelRotateCCW" class="tool-btn !w-7 !h-6 text-sm">↺</button> <button id="btnEdgeLabelRotateCW" class="tool-btn !w-7 !h-6 text-sm">↻</button> <div class="panel-sep"></div> <button id="btnEdgeLabelOffsetLeft" class="tool-btn !w-6 !h-6 text-sm">←</button> <button id="btnEdgeLabelOffsetRight" class="tool-btn !w-6 !h-6 text-sm">→</button> <button id="btnEdgeLabelOffsetUp" class="tool-btn !w-6 !h-6 text-sm">↑</button> <button id="btnEdgeLabelOffsetDown" class="tool-btn !w-6 !h-6 text-sm">↓</button> <button id="btnEdgeLabelOffsetReset" class="tool-btn !w-6 !h-6 text-xs">⊙</button> <div class="panel-sep"></div> <button id="btnEdgeWidthDecrease" class="tool-btn !w-7 !h-6" style="font-size:10px">W−</button> <button id="btnEdgeWidthIncrease" class="tool-btn !w-7 !h-6" style="font-size:10px">W+</button> <div class="panel-sep"></div> <button id="edgeColorSwatch" style="width:1.5rem;height:1.5rem;border-radius:0.25rem;border:2px solid #a8a29e;background:#a8a29e;cursor:pointer;flex-shrink:0;"></button> <div class="panel-sep"></div> <button id="btnEdgeClearPorts" class="tool-btn !w-8 !h-6 text-xs">⊗</button> <div class="panel-sep"></div> <button id="btnSaveEdgeDefault" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492M5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0"></path><path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.474l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115z"></path></svg></button></div></div> <textarea id="labelInput" class="hidden" rows="1"></textarea> <div id="emptyState" class="absolute inset-0 flex flex-col items-center justify-center text-gray-400 dark:text-gray-600 pointer-events-none select-none"><svg width="52" height="44" viewBox="0 0 52 44" fill="none" stroke="currentColor" stroke-width="1.5" class="mb-3 opacity-50"><rect x="2" y="4" width="18" height="12" rx="2"></rect><rect x="32" y="28" width="18" height="12" rx="2"></rect><line x1="20" y1="10" x2="32" y2="34" stroke-dasharray="4,3"></line><rect x="17" y="16" width="18" height="12" rx="2"></rect><line x1="26" y1="16" x2="26" y2="10" stroke-dasharray="4,3"></line></svg> <p class="text-sm"> </p></div></div></div> <div id="toastContainer"></div> <div id="imageNameModal" style="display:none;position:fixed;inset:0;z-index:1000;background:rgba(0,0,0,0.5);" class="flex items-center justify-center"><div class="bg-white dark:bg-gray-800 rounded-xl shadow-2xl p-6 w-80 flex flex-col gap-3"><p class="text-sm font-semibold text-gray-700 dark:text-gray-200"> </p> <p class="text-xs text-gray-400 dark:text-gray-500">Lettres, chiffres, <code class="bg-gray-100 dark:bg-gray-700 px-0.5 rounded">_</code> et <code class="bg-gray-100 dark:bg-gray-700 px-0.5 rounded">-</code> uniquement.
|
|
278
|
+
</html>`,f=window.open(``,`_blank`);if(!f){alert(Y(`error.pdf_popup`));return}f.document.write(d),f.document.close(),t.onclose()}catch(e){alert(Y(`error.pdf_export`)+(e instanceof Error?e.message:String(e)))}finally{F(d,!1)}}let y=`px-4 py-2 text-sm border-b-2 border-blue-500 text-blue-600 dark:text-blue-400 font-semibold transition-colors`,b=`px-4 py-2 text-sm text-gray-500 dark:text-gray-400 hover:text-gray-700 dark:hover:text-gray-300 transition-colors`;var x=Wr(),S=R(x),C=e=>{var r=Ww(),f=L(r),p=L(f),h=z(L(p),2),x=L(h,!0);j(h),j(p);var S=z(p,2),C=L(S),w=L(C,!0);j(C);var T=z(C,2),E=L(T,!0);j(T);var D=z(T,2),ee=L(D,!0);j(D),j(S);var te=z(S,2),O=e=>{var t=Vw(),n=L(t),r=L(n),c=e=>{var t=Rw(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`common.loading`)]),W(e,t)},l=e=>{var t=zw(),n=L(t);j(t),B(e=>G(n,`${e??``}failed to load folders`),[()=>Y(`common.error_prefix`)]),W(e,t)},u=e=>{var t=Wr();q(R(t),16,()=>V(o),e=>e,(e,t)=>{var n=Bw(),r=L(n);ki(r);var i,a=z(r,2),o=L(a,!0);j(a),j(n),B(()=>{i!==(i=t)&&(r.value=(r.__value=t)??``),G(o,t)}),Ri(r,()=>V(s)[t],e=>V(s)[t]=e),W(e,n)}),W(e,t)};K(r,e=>{V(i)?e(c):V(a)?e(l,1):e(u,-1)}),j(n),j(t),W(e,t)};K(te,e=>{V(n)===`html`&&e(O)});var ne=z(te,2),k=e=>{var n=Hw(),r=L(n),i=L(r,!0);j(r);var a=z(r,2),o=L(a),s=L(o,!0);j(o);var l=z(o,2),u=L(l,!0);j(l),j(a),j(n),B((e,t,n)=>{G(i,e),G(s,t),l.disabled=V(c),G(u,n)},[()=>Y(`modal.export.markdown_hint`),()=>Y(`common.cancel`),()=>V(c)?`⏳`:Y(`modal.export.markdown_btn`)]),H(`click`,o,function(...e){t.onclose?.apply(this,e)}),H(`click`,l,g),W(e,n)};K(ne,e=>{V(n)===`markdown`&&e(k)});var A=z(ne,2),re=e=>{var n=Uw(),r=L(n),i=L(r,!0);j(r);var a=z(r,2),o=L(a),s=L(o,!0);j(o);var c=z(o,2),d=L(c,!0);j(c);var f=z(c,2),p=L(f,!0);j(f),j(a),j(n),B((e,t,n,r)=>{G(i,e),G(s,t),c.disabled=V(l),G(d,n),f.disabled=V(u),G(p,r)},[()=>Y(`modal.export_html.hint`),()=>Y(`common.cancel`),()=>V(l)?`⏳`:Y(`modal.export_html.notion_btn`),()=>V(u)?`⏳`:Y(`modal.export_html.confluence_btn`)]),H(`click`,o,function(...e){t.onclose?.apply(this,e)}),H(`click`,c,()=>_(`notion`)),H(`click`,f,()=>_(`confluence`)),W(e,n)};K(A,e=>{V(n)===`html`&&e(re)});var ie=z(A,2),ae=e=>{var n=Hw(),r=L(n),i=L(r,!0);j(r);var a=z(r,2),o=L(a),s=L(o,!0);j(o);var c=z(o,2),l=L(c,!0);j(c),j(a),j(n),B((e,t,n)=>{G(i,e),G(s,t),c.disabled=V(d),G(l,n)},[()=>Y(`modal.export.pdf_hint`),()=>Y(`common.cancel`),()=>V(d)?`⏳`:Y(`modal.export.pdf_btn`)]),H(`click`,o,function(...e){t.onclose?.apply(this,e)}),H(`click`,c,v),W(e,n)};K(ie,e=>{V(n)===`pdf`&&e(ae)}),j(f),j(r),B((e,t,r,i)=>{G(x,e),vi(C,1,fi(V(n)===`markdown`?y:b)),G(w,t),vi(T,1,fi(V(n)===`html`?y:b)),G(E,r),vi(D,1,fi(V(n)===`pdf`?y:b)),G(ee,i)},[()=>Y(`modal.export.title`),()=>Y(`modal.export.tab_markdown`),()=>Y(`modal.export.tab_html`),()=>Y(`modal.export.tab_pdf`)]),H(`click`,r,e=>{e.target===e.currentTarget&&t.onclose()}),H(`click`,C,()=>m(`markdown`)),H(`click`,T,()=>m(`html`)),H(`click`,D,()=>m(`pdf`)),W(e,r)};K(S,e=>{t.open&&e(C)}),W(e,x),Je()}Pr([`click`]);var Kw=U(`<p class="px-3 py-4 text-xs text-gray-400 text-center"> </p>`),qw=U(`<p> </p>`),Jw=U(`<div class="group flex items-center hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"><button class="flex-1 flex items-center gap-2 px-3 py-2 text-sm text-left"><span class="text-gray-400 shrink-0">📁</span> <span class="text-gray-700 dark:text-gray-300 truncate"> </span></button> <button title="Add to exclusions" class="shrink-0 text-red-400 hover:text-red-600 px-3 py-2 text-sm font-bold transition-colors">⊖</button></div>`),Yw=U(`<div class="group flex items-center hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"><span class="flex-1 flex items-center gap-2 px-3 py-2 text-sm text-gray-500 dark:text-gray-400"><span class="shrink-0 opacity-40">📄</span> <span class="truncate font-mono"> </span></span> <button title="Add to exclusions" class="shrink-0 text-red-400 hover:text-red-600 px-3 py-2 text-sm font-bold transition-colors">⊖</button></div>`),Xw=U(`<div class="border-t border-gray-200 dark:border-gray-700"><div class="flex items-center gap-2 px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700"><button class="text-xs text-blue-600 dark:text-blue-400 hover:underline disabled:opacity-30 disabled:pointer-events-none shrink-0">↑ Up</button> <span class="font-mono text-xs text-gray-400 dark:text-gray-500 truncate flex-1 text-right"> </span></div> <div class="divide-y divide-gray-100 dark:divide-gray-800 max-h-52 overflow-y-auto"><!></div></div>`),Zw=U(`<label class="flex items-center gap-1.5 text-xs text-gray-700 dark:text-gray-300 cursor-pointer"><input type="checkbox"/> </label>`),Qw=U(`<div class="group flex items-center hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"><button class="flex-1 flex items-center gap-2 px-3 py-2 text-sm text-left"><span class="text-gray-400 shrink-0">📁</span> <span class="text-gray-700 dark:text-gray-300 truncate"> </span></button> <button title="Exclude this folder" class="shrink-0 opacity-0 group-hover:opacity-100 text-red-400 hover:text-red-600 px-3 py-2 text-sm transition-opacity">⊖</button></div>`),$w=U(`<button class="w-full px-3 py-2 text-xs text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-950/30 text-left font-medium border-t border-gray-100 dark:border-gray-800">✓ Select: <span class="font-mono"> </span></button>`),eT=U(`<!> <!>`,1),tT=U(`<div> </div>`),nT=U(`<div> </div> <div> </div> <div> </div> <!>`,1),rT=U(`<div role="button" tabindex="0" class="flex items-center gap-2 px-3 py-1 cursor-pointer hover:bg-gray-50 dark:hover:bg-gray-800/50 transition-colors"><span class="text-gray-400 dark:text-gray-600 w-5 text-right shrink-0 tabular-nums text-xs"></span> <div class="flex-1 min-w-0"><div class="flex items-center justify-between gap-1"><span class="text-gray-800 dark:text-gray-200 font-medium truncate text-xs"> </span> <span class="text-gray-400 dark:text-gray-600 tabular-nums shrink-0 text-xs"> </span></div> <div class="h-1 bg-gray-100 dark:bg-gray-800 rounded-full mt-0.5"><div class="h-1 bg-blue-400 dark:bg-blue-600 rounded-full"></div></div></div></div>`),iT=U(`<div class="w-56 shrink-0 border-r border-gray-200 dark:border-gray-800 flex flex-col bg-white dark:bg-gray-900 overflow-hidden"><div class="px-3 py-2 text-xs text-gray-500 dark:text-gray-400 space-y-0.5 border-b border-gray-100 dark:border-gray-800"><!></div> <div class="px-3 py-2 border-b border-gray-100 dark:border-gray-800 flex items-center gap-2"><span class="text-xs text-gray-500 dark:text-gray-400 shrink-0 cursor-help"> </span> <input type="number" min="1" max="20" class="w-12 px-1.5 py-0.5 text-xs rounded border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-800 dark:text-gray-200 focus:outline-none"/> <button class="text-xs text-blue-600 dark:text-blue-400 hover:underline"> </button></div> <p class="px-3 pt-2 pb-1 text-xs font-semibold text-gray-400 dark:text-gray-600 uppercase tracking-wider"> </p> <div class="flex-1 overflow-y-auto"></div></div>`),aT=U(`<p class="absolute inset-0 flex items-center justify-center text-gray-400 dark:text-gray-500 text-sm animate-pulse"> </p>`),oT=U(`<div class="flex items-center gap-1 group py-0.5"><span class="text-gray-600 dark:text-gray-400 break-all font-mono flex-1 text-xs"> </span> <button title="Exclude this file" class="shrink-0 opacity-0 group-hover:opacity-100 text-red-400 hover:text-red-600 text-xs leading-none px-1 transition-opacity">⊖</button></div>`),sT=U(`<div class="text-gray-400 text-center py-2">—</div>`),cT=U(`<div class="w-80 shrink-0 border-l border-gray-200 dark:border-gray-800 flex flex-col bg-white dark:bg-gray-900 overflow-hidden"><div class="px-3 py-2 border-b border-gray-100 dark:border-gray-800 flex items-center justify-between"><span class="font-bold text-sm text-gray-900 dark:text-gray-100"> </span> <button class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 text-xs leading-none">✕</button></div> <p class="px-3 pt-2 pb-1 text-xs font-semibold text-gray-400 dark:text-gray-600 uppercase tracking-wider"> </p> <div class="flex-1 overflow-y-auto px-3 py-1 space-y-1 text-xs"><!></div></div>`),lT=U(`<div class="fixed inset-0 z-50 flex flex-col bg-white dark:bg-gray-950"><div class="flex items-center justify-between px-6 h-14 border-b border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shrink-0"><h2 class="font-semibold text-base"> </h2> <button class="text-sm px-3 py-1.5 rounded-lg text-gray-600 dark:text-gray-400 hover:bg-gray-100 dark:hover:bg-gray-800 transition-colors"> </button></div> <div class="border-b border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 shrink-0"><div class="flex items-center gap-3 px-6 py-3"><label class="text-xs font-medium text-gray-500 dark:text-gray-400 shrink-0"> </label> <input type="text" readonly="" spellcheck="false" class="flex-1 px-3 py-1.5 text-sm rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono cursor-default focus:outline-none"/> <button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors shrink-0">📁 <span> </span></button> <button class="text-sm px-4 py-1.5 rounded-lg bg-blue-600 hover:bg-blue-700 text-white font-semibold transition-colors shrink-0"> </button></div> <div class="flex items-start gap-3 px-6 pb-2"><label class="text-xs font-medium text-gray-500 dark:text-gray-400 shrink-0 pt-1.5"> </label> <textarea rows="3" spellcheck="false" class="flex-1 px-3 py-1.5 text-sm rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 font-mono focus:outline-none focus:ring-1 focus:ring-blue-400 resize-y"></textarea> <button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors shrink-0">📁 <span> </span></button></div> <!> <div class="flex items-center gap-x-4 gap-y-2 px-6 pb-3 flex-wrap"><span class="text-xs font-medium text-gray-500 dark:text-gray-400 shrink-0"> </span> <label class="flex items-center gap-1.5 text-xs font-medium text-blue-600 dark:text-blue-400 cursor-pointer shrink-0"><input type="checkbox"/> </label> <!></div> <!></div> <div class="flex-1 overflow-hidden flex"><!> <div class="flex-1 relative overflow-hidden"><!> <canvas style="position: absolute; inset: 0"></canvas></div> <!></div></div>`);function uT(e,t){qe(t,!0);let n=new Set(`the.a.an.and.or.but.not.nor.so.yet.both.either.neither.is.are.was.were.be.been.being.have.has.had.do.does.did.will.would.shall.should.may.might.can.could.must.need.dare.ought.used.to.of.in.for.on.with.at.by.from.up.about.into.through.during.before.after.above.below.between.out.off.over.under.again.further.then.once.here.there.when.where.why.how.all.each.few.more.most.other.some.such.no.only.own.same.than.too.very.just.also.still.already.always.never.often.sometimes.usually.this.that.these.those.its.your.our.their.his.her.him.she.you.they.we.me.my.it.who.which.what.whose.whom.if.though.although.because.since.while.unless.until.whether.as.like.via.per.i.am.he.us.see.now.new.old.got.let.put.say.said.says.get.use.make.made.take.come.came.go.went.know.think.look.want.give.seem.back.down.even.much.well.good.work.tell.keep.hold.turn.move.play.live.help.run.start.off.way.too.few.show.hear.etc.eg.ie.one.two.three.four.five.six.seven.eight.nine.ten.le.la.les.un.une.des.du.de.d.l.au.aux.ce.ci.cet.cette.ces.mon.ma.mes.ton.ta.tes.son.sa.ses.notre.nos.votre.vos.leur.leurs.je.tu.il.elle.on.nous.vous.ils.elles.me.te.se.lui.y.en.qui.que.quoi.dont.où.et.ou.mais.donc.or.ni.car.si.ne.pas.plus.moins.très.bien.mal.peu.beaucoup.trop.assez.aussi.comme.pour.par.avec.sans.dans.sur.sous.entre.vers.chez.contre.avant.après.pendant.depuis.selon.malgré.sauf.est.sont.était.être.avoir.fait.faire.dit.dire.peut.pouvoir.doit.devoir.veut.vouloir.sait.savoir.va.aller.vient.venir.tout.tous.toute.toutes.autre.autres.même.chaque.quel.quelle.quels.quelles.aucun.aucune.certain.certaine.plusieurs.quelque.quelques.tel.telle.tels.telles.cela.ceci.ça.celui.celle.ceux.celles.ici.voici.voilà.alors.ainsi.encore.déjà.jamais.toujours.souvent.parfois.rien.personne.chose.fois.jour.temps.part.cas.point.lieu.monde.cependant.néanmoins.pourtant.toutefois.quand.lorsque.puisque.parce.afin.puis.lors.notamment.surtout.seulement.vraiment.enfin.ensuite.ailleurs.là.ici.voici.voilà.dont.lequel.laquelle.lesquels.lesquelles`.split(`.`)),r=new Set(`public.private.protected.static.void.class.interface.abstract.final.const.let.var.function.return.if.else.for.while.do.switch.case.break.continue.try.catch.throw.throws.finally.new.this.self.super.import.export.from.package.module.require.include.using.namespace.struct.enum.trait.impl.fn.def.func.fun.val.mut.async.await.yield.lambda.extends.implements.override.virtual.sealed.data.object.companion.where.when.match.guard.defer.go.chan.select.type.alias.as.is.in.of.with.true.false.null.nil.none.undefined.println.printf.fmt.log.print.main.args.argv.init.setup.teardown.describe.test.expect.assert.before.after.not.and.or.delete.typeof.instanceof.readonly.keyof.infer.never.unknown.declare.satisfies.get.set.add.remove.update.create.find.fetch.load.save.put.post.patch.list.map.filter.reduce.sort.merge.parse.format.convert.transform.validate.check.handle.process.execute.start.stop.reset.clear.close.open.read.write.send.receive.emit.trigger.dispatch.subscribe.unsubscribe.listen.notify.register.unregister.bind.apply.call.invoke.callback.handler.listener.middleware.interceptor.resolver.provider.consumer.producer.builder.factory.adapter.wrapper.proxy.decorator.observer.visitor.strategy.command.controller.service.repository.dao.dto.entity.model.schema.config.context.state.store.action.reducer.selector.hook.ref.effect.memo.component.module.plugin.extension.util.utils.helper.helpers.common.shared.base.default.index.app.core.lib.src.test.spec.mock.stub.fixture.impl.internal.api.sdk.client.server.request.response.status.code.error.exception.message.result.data.value.key.name.label.title.description.item.element.node.child.parent.root.container.wrapper.layout.view.page.screen.panel.header.footer.sidebar.navbar.body.content.section.row.col.column.grid.flex.block.inline.span.div.input.output.param.params.arg.option.options.props.attr.attrs.field.fields.property.properties.method.methods.string.number.boolean.integer.float.double.long.short.byte.char.array.object.map.set.list.vector.queue.stack.hash.table.tree.graph.pair.tuple.optional.nullable.void.unit.any.bool.bytes.none.int.str.bool.all.each.every.some.many.single.multi.first.last.next.prev.previous.current.old.temp.tmp.new.top.bottom.left.right.center.middle.start.end.begin.min.max.count.total.sum.avg.size.length.width.height.depth.flag.num.idx.id.uid.uuid.num.str.val.obj.arr.fn.cb.ctx.req.res.err.msg.src.dst.evt.doc.db.io.fs.os.env.sys.http.https.url.uri.path.port.host.tcp.udp.ssl.tls.html.css.json.xml.yml.yaml.csv.sql.regex.utf.ascii.rgb.rgba.hex.px.em.rem.vh.vw.auto.inherit.initial.application.file.local.source.messages.logging.alerting.programmed.offset.offsets.zone.zoned.decimal.big.integer.constructor.mapper.captor.publisher.verify.subscriber.org.edr.ack.ref.ssr.ssg.csr.isr.mockito.junit.vitest.jest.mocha.rspec.pytest.cypress.playwright.captor.spy.given.then.verify.times.never.invocation.argumentcaptor.inorder.donothing.doreturn.ippon.springframework.jakarta.javax.todo.fixme.hack.note.deprecated.experimental.eslint.prettier.typescript.javascript.java.kotlin.python.golang.rust.csharp.swift.ruby.spring.boot.javax.jakarta.hibernate.lombok.gradle.maven.webpack.vite.react.angular.vue.svelte.nuxt.express.fastapi.flask.django.rails.fiber.gin.actix.tokio.asyncio.junit.jest.mocha.pytest.rspec.docker.kubernetes.aws.gcp.azure.terraform.ansible.nginx.apache.linux.nextjs.remix.astro.sveltekit.gatsby.nuxtjs.qwik.solid.vercel.netlify.cloudflare.supabase.firebase.mongodb.postgres.prisma.drizzle.typeorm.sequelize.mongoose.redis.neon.trpc.graphql.grpc.rest.openapi.swagger.zod.yup.valibot.tailwind.shadcn.radix.headless.chakra.mantine.antd.mui.tanstack.tanstackquery.zustand.jotai.recoil.redux.mobx.storybook.cypress.playwright.vitest.turbopack.turborepo.getserversideprops.getstaticprops.getstaticpaths.generatestaticparams.generatemetadata.serveraction.revalidate.notfound.redirect.permanentredirect.unstablecache.unstablenostore.cookies.headers.userouter.usepathname.usesearchparams.useparams.useformstate.useformstatus.useoptimistic.useserveraction.classname.onclick.onchange.onsubmit.onfocus.onblur.onkeydown.onkeyup.onmousedown.onmouseup.defaultvalue.htmlfor.tabindex.strokewidth.viewbox.fillopacity.strokeopacity.pathdata.children.fragment.portal.suspense.errorboundary.strictmode.createelement.createcontext.createref.forwardref.usestate.useeffect.useref.usecontext.usememo.usecallback.usereducer.useid.usetransition.usedeferredvalue.useimperativehandle.mutex.lock.thread.goroutine.coroutine.channel.buffer.stream.pipe.observable.promise.future.completable.deferred.disposable.lifecycle.scope.annotation.attribute.metadata.reflection.generic.template.macro.preprocessor.compiler.runtime.debug.release.production.development.staging.build.deploy.lint.coverage.report.the.and.for.are.but.not.you.all.this.that.with.have.from.they.will.been.can.has.was.its.our.their.more.also.when.what.about.which.would.into.than.then.each.just.over.after.such.here.some.were.very.only`.split(`.`));function i(e){return n.has(e)||r.has(e)||e.length<3||/^\d+$/.test(e)||/^[^a-z]/.test(e)}function a(e){return e.replace(/([a-z])([A-Z])/g,`$1 $2`).replace(/([A-Z]+)([A-Z][a-z])/g,`$1 $2`).replace(/[_\-./]+/g,` `).toLowerCase().trim().split(/\s+/).filter(e=>e.length>=3)}function o(e){return e.toLowerCase().split(/[^a-zàâäéèêëïîôùûü]+/).filter(e=>e.length>=3)}let s=[{value:`adoc`,cat:`prose`},{value:`asciidoc`,cat:`prose`},{value:`asm`,cat:`code`},{value:`astro`,cat:`code`},{value:`avsc`,cat:`config`},{value:`bash`,cat:`code`},{value:`bat`,cat:`code`},{value:`bicep`,cat:`config`},{value:`c`,cat:`code`},{value:`cc`,cat:`code`},{value:`cfg`,cat:`config`},{value:`cjs`,cat:`code`},{value:`clj`,cat:`code`},{value:`cljs`,cat:`code`},{value:`cmake`,cat:`code`},{value:`cmd`,cat:`code`},{value:`conf`,cat:`config`},{value:`cpp`,cat:`code`},{value:`cql`,cat:`code`},{value:`cs`,cat:`code`},{value:`cshtml`,cat:`code`},{value:`css`,cat:`config`},{value:`cxx`,cat:`code`},{value:`dart`,cat:`code`},{value:`env`,cat:`config`},{value:`erb`,cat:`code`},{value:`erl`,cat:`code`},{value:`ex`,cat:`code`},{value:`exs`,cat:`code`},{value:`fish`,cat:`code`},{value:`fs`,cat:`code`},{value:`fsx`,cat:`code`},{value:`go`,cat:`code`},{value:`gql`,cat:`code`},{value:`gradle`,cat:`code`},{value:`graphql`,cat:`code`},{value:`groovy`,cat:`code`},{value:`h`,cat:`code`},{value:`hcl`,cat:`config`},{value:`hpp`,cat:`code`},{value:`hs`,cat:`code`},{value:`html`,cat:`config`},{value:`ini`,cat:`config`},{value:`java`,cat:`code`},{value:`jl`,cat:`code`},{value:`js`,cat:`code`},{value:`json`,cat:`config`},{value:`jsx`,cat:`code`,jsx:!0},{value:`kt`,cat:`code`},{value:`less`,cat:`config`},{value:`lua`,cat:`code`},{value:`m`,cat:`code`},{value:`md`,cat:`prose`,def:!0},{value:`mdx`,cat:`prose`},{value:`mjs`,cat:`code`},{value:`mk`,cat:`code`},{value:`ml`,cat:`code`},{value:`mli`,cat:`code`},{value:`mm`,cat:`code`},{value:`nim`,cat:`code`},{value:`php`,cat:`code`},{value:`pl`,cat:`code`},{value:`prisma`,cat:`code`},{value:`properties`,cat:`config`},{value:`proto`,cat:`code`},{value:`ps1`,cat:`code`},{value:`py`,cat:`code`},{value:`r`,cat:`code`},{value:`razor`,cat:`code`},{value:`rb`,cat:`code`},{value:`rs`,cat:`code`},{value:`rst`,cat:`prose`},{value:`s`,cat:`code`},{value:`scala`,cat:`code`},{value:`scss`,cat:`config`},{value:`sh`,cat:`code`},{value:`sol`,cat:`code`},{value:`sql`,cat:`code`},{value:`styl`,cat:`config`},{value:`svelte`,cat:`code`},{value:`swift`,cat:`code`},{value:`tex`,cat:`prose`},{value:`tf`,cat:`config`},{value:`tfvars`,cat:`config`},{value:`thrift`,cat:`code`},{value:`toml`,cat:`config`},{value:`ts`,cat:`code`},{value:`tsx`,cat:`code`,jsx:!0},{value:`txt`,cat:`prose`},{value:`v`,cat:`code`},{value:`vb`,cat:`code`},{value:`vue`,cat:`code`},{value:`xml`,cat:`config`},{value:`yaml`,cat:`config`},{value:`yml`,cat:`config`},{value:`zig`,cat:`code`},{value:`zsh`,cat:`code`}],c=new Set(s.filter(e=>e.cat===`prose`).map(e=>e.value)),l=new Set(s.filter(e=>e.cat===`code`).map(e=>e.value)),u=new Set(s.filter(e=>e.cat===`config`).map(e=>e.value)),d=new Set(s.filter(e=>e.jsx).map(e=>e.value));function f(e,t){let n=[];if(c.has(t)){let t=e.replace(/^\s*(import|export\s+\{[^}]*\}|export\s+\*|package|require|#include|from\s+['"][^'"]+['"]\s*(import)?)\b.*/gm,``).replace(/```[\s\S]*?```/g,` `).replace(/`[^`\n]+`/g,` `).replace(/!\[[^\]]*\]\([^)]*\)/g,` `).replace(/\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/https?:\/\/\S+/g,` `).replace(/[#*_~>`|!\[\](){}=+\-]/g,` `);n.push(...o(t))}else l.has(t)?(d.has(t)&&(e=e.replace(/<\/?[A-Z][A-Za-z0-9.]*[^>]*>/g,` `),e=e.replace(/<\/?(div|span|main|section|article|aside|nav|header|footer|form|input|button|select|option|textarea|table|thead|tbody|tr|td|th|ul|ol|li|a|img|p|h[1-6]|label|figure|figcaption|picture|video|audio|canvas|svg|path|circle|rect|g|defs|use|link|meta|head|html|body|script|style|br|hr|strong|em|code|pre|blockquote|small|sub|sup)\b[^>]*>/gi,` `),e=e.replace(/\b(className|onClick|onChange|onSubmit|onFocus|onBlur|onKeyDown|onKeyUp|onMouseDown|onMouseUp|htmlFor|tabIndex|strokeWidth|viewBox|fillOpacity|strokeOpacity|defaultValue|placeholder|disabled|checked|readOnly|required|multiple|autoFocus|autoComplete|type|href|src|alt|width|height|style|key|ref)\s*=/g,` =`)),e=e.replace(/^\s*(import\s+[\w.*{},\s'"@/-]+;?|from\s+['"][^'"]+['"]\s*;?|package\s+[\w.]+;?|namespace\s+[\w.]+;?|using\s+[\w.]+;?|require\s*\(?\s*['"][^'"]+['"]\s*\)?;?)\s*$/gm,``),e.replace(/(?:\/\/|#(?!.*[{}[\]<>])| -- )\s*(.+)$/gm,(e,t)=>(n.push(...o(t)),e)),e.replace(/\/\*[\s\S]*?\*\//g,e=>(n.push(...o(e)),e)),e.replace(/"""[\s\S]*?"""|'''[\s\S]*?'''/g,e=>(n.push(...o(e)),e)),e.replace(/["'`]([A-Za-zÀ-ÿ][A-Za-zÀ-ÿ\s,.'éàèùâêîôûç]{3,})["'`]/g,(e,t)=>(n.push(...o(t)),e)),e.replace(/\b([A-Za-z][A-Za-z0-9_]{2,})\b/g,(e,t)=>(n.push(...a(t)),e))):u.has(t)&&(e.replace(/:\s*["']([^"']{3,})["']/g,(e,t)=>(n.push(...o(t)),e)),e.replace(/\b([A-Za-z][A-Za-z0-9_]{2,})\b/g,(e,t)=>(n.push(...a(t)),e)));return n.filter(e=>!i(e))}let p=P(``),m=P(``),h=P(1),g=P(``),_=P(!0),v=P(!1),y=P(I(s.map(e=>({value:e.value,label:`.`+e.value,checked:!!e.def}))));function b(){return V(y).filter(e=>e.checked).map(e=>e.value)}let x=N(()=>V(y).every(e=>e.checked)),S=P(null),C=P(null),w=P(0),T=P(null),E=P(I([])),D=P(I([])),ee=P(!1),te=P(``),O=P(0),ne=P(I([]));function k(){localStorage.setItem(`wc-exts`,JSON.stringify(b()))}function A(){let e=V(x);F(y,V(y).map(t=>({...t,checked:!e})),!0),k()}function re(){k()}function ie(){return new Set((V(m)||``).split(/[\n,]/).map(e=>e.trim()).filter(Boolean))}function ae(e){let t=ie();t.has(e)||(t.add(e),F(m,[...t].join(`, `),!0),localStorage.setItem(`wc-exclude`,V(m)),V(ue)&&_e(V(fe)),se())}function oe(){localStorage.setItem(`wc-exclude`,V(m)),V(ue)&&_e(V(fe)),se()}function se(){V(ee)&&V(te)&&Ne(V(te))}function ce(){V(S)&&Me()}function le(){let e=localStorage.getItem(`wc-root`);e&&(F(p,e,!0),F(xe,e,!0));let t=localStorage.getItem(`wc-exclude`);t&&F(m,t,!0);let n=localStorage.getItem(`wc-exts`);if(n)try{let e=JSON.parse(n);F(y,V(y).map(t=>({...t,checked:e.includes(t.value)})),!0)}catch{}}let ue=P(!1),de=P(null),fe=P(``),pe=P(``),me=P(null),he=P(``);function ge(){F(ue,!V(ue)),V(ue)&&_e(V(fe)||V(p)||`/`)}async function _e(e){F(me,null),F(he,`Loading…`);try{let t=await fetch(`/api/browse?all=1&path=`+encodeURIComponent(e)).then(e=>e.json());F(fe,t.current,!0),F(de,t.parent,!0),F(pe,t.current,!0);let n=V(p).trim(),r=(e,t)=>n&&e.startsWith(n+`/`)?e.slice(n.length+1):t,i=ie(),a=(t.dirs||[]).filter(e=>!i.has(r(e.path,e.name))).map(e=>({kind:`dir`,name:e.name,path:e.path,entry:r(e.path,e.name)})),o=b(),s=(t.files||[]).filter(e=>o.some(t=>e.name.endsWith(`.`+t))).filter(e=>!i.has(r(e.path,e.name))).map(e=>({kind:`file`,name:e.name,entry:r(e.path,e.name)})),c=[...a,...s];F(me,c,!0),F(he,c.length?``:`Empty directory`,!0)}catch{F(me,[],!0),F(he,`Cannot read directory`)}}function ve(){V(de)&&_e(V(de))}let ye=P(!1),be=P(null),xe=P(``),Se=P(``),Ce=P(null),we=P(``);function Te(){F(ye,!V(ye)),V(ye)&&Ee(V(xe)||V(p)||`/`)}async function Ee(e){F(Ce,null),F(we,`Loading…`);try{let t=await fetch(`/api/browse?path=`+encodeURIComponent(e)).then(e=>e.json());F(xe,t.current,!0),F(be,t.parent,!0),F(Se,t.current,!0),F(Ce,(t.dirs||[]).map(e=>({name:e.name,path:e.path})),!0),F(we,V(Ce).length?``:`No sub-folders`,!0)}catch{F(Ce,[],!0),F(we,`Cannot read directory`)}}function De(){V(be)&&Ee(V(be))}function Oe(){F(p,V(xe),!0),localStorage.setItem(`wc-root`,V(xe)),F(ye,!1),F(m,``),localStorage.removeItem(`wc-exclude`),F(fe,V(xe),!0)}let ke=P(null),Ae=P(null),je=P(!1);function Me(){if(!V(S)||!V(C))return;let e=Math.max(1,V(h)||1),t=[...V(S).entries()].sort((e,t)=>t[1]-e[1]),n=t.filter(([t])=>(V(C).get(t)||new Set).size>=e).slice(0,150);if(!n.length){let n=t.length;F(g,n?`${n} domain word(s) found but none appear in ${e}+ file(s). Lower the "Min files" threshold to 1.`:`No domain words extracted. Try adding more file extensions or a broader folder.`,!0),F(_,!0),F(je,!1),F(v,!1);return}let r=[...V(S).keys()].filter(t=>(V(C).get(t)||new Set).size>=e).length;F(T,{scanned:V(w),unique:r,shown:n.length},!0);let i=n.slice(0,50),a=i[0][1];F(D,i.map(([e,t])=>({word:e,freq:t,pct:Math.round(t/a*100)})),!0),F(v,!0),F(_,!1);let o=document.documentElement.classList.contains(`dark`),s=o?[`#60a5fa`,`#34d399`,`#f9a8d4`,`#a78bfa`,`#fbbf24`,`#6ee7b7`,`#93c5fd`,`#fb923c`,`#4ade80`,`#f472b6`]:[`#1d4ed8`,`#047857`,`#7c3aed`,`#b45309`,`#be123c`,`#0369a1`,`#4338ca`,`#c2410c`,`#15803d`,`#9333ea`];requestAnimationFrame(()=>{if(!V(ke)||!V(Ae))return;let e=V(ke),t=V(Ae);e.width=Math.max(400,t.offsetWidth),e.height=Math.max(300,t.offsetHeight),e.style.width=e.width+`px`,e.style.height=e.height+`px`,F(je,!0);let n=Math.sqrt(e.width*e.height/(800*500)),r=Math.min(220,Math.round(72*n)),c=i.map(([e,t])=>[e,Math.max(12,Math.round(r*t/a))]);window.WordCloud?.(e,{list:c,gridSize:Math.round(4*e.width/1024),fontFamily:`ui-sans-serif, system-ui, sans-serif`,color:()=>s[Math.floor(Math.random()*s.length)],backgroundColor:o?`#030712`:`#ffffff`,rotateRatio:.2,minSize:6,shrinkToFit:!0,click:e=>Ne(e[0])})})}function Ne(e){if(!V(C)||!V(S))return;let t=[...V(C).get(e)||[]].sort(),n=V(S).get(e)||0;F(te,e,!0),F(O,n,!0),F(ne,t,!0),F(ee,!0)}function Pe(){F(ee,!1)}async function Fe(){let e=V(p).trim();if(!e){F(g,`Please select a root folder first.`),F(_,!0);return}let t=b();if(!t.length){F(g,`Please select at least one extension.`),F(_,!0);return}F(ye,!1),F(v,!1),F(ee,!1),F(g,`Reading files…`),F(_,!0),F(je,!1);try{let n=V(m).trim(),r=n?n.split(/[\n,]/).map(e=>e.trim()).filter(Boolean):[];localStorage.setItem(`wc-exclude`,n);let i=new URLSearchParams({path:e});t.forEach(e=>i.append(`ext`,e)),r.forEach(e=>i.append(`exclude`,e));let a=await fetch(`/api/wordcloud?`+i);if(!a.ok){F(g,`Error: `+((await a.json()).error||a.statusText));return}let{files:o,fileTexts:s}=await a.json();F(g,`Analyzing ${o} file(s)…`);let c=new Map,l=new Map,u=new Set;F(w,o,!0);for(let{path:e,text:t}of s){let n=(e.split(`.`).pop()||``).toLowerCase();n&&u.add(n);let r=f(t,n),i=new Set;for(let t of r)c.set(t,(c.get(t)||0)+1),i.has(t)||(i.add(t),l.has(t)||l.set(t,new Set),l.get(t).add(e))}F(S,c,!0),F(C,l,!0),F(E,[...u].sort().map(e=>`.`+e),!0),Me()}catch(e){F(g,`Error: `+e.message)}}let Ie=!1;kn(()=>{t.open&&!Ie?(Ie=!0,F(g,`Choose a root folder and click Launch.`),F(_,!0),F(je,!1),F(v,!1),F(ee,!1),F(S,null),F(C,null),F(T,null),F(D,[],!0),F(ye,!1),F(ue,!1),F(h,1),le(),V(p)||fetch(`/api/config`).then(e=>e.json()).then(e=>{e.docsFolder&&(F(p,e.docsFolder,!0),F(xe,e.docsFolder,!0))}).catch(()=>{})):t.open||(Ie=!1)});var Le=Wr(),Re=R(Le),ze=e=>{var n=lT(),r=L(n),i=L(r),a=L(i,!0);j(i);var o=z(i,2),s=L(o,!0);j(o),j(r);var c=z(r,2),l=L(c),u=L(l),d=L(u,!0);j(u);var f=z(u,2);ki(f);var b=z(f,2),S=z(L(b)),C=L(S,!0);j(S),j(b);var w=z(b,2),k=L(w,!0);j(w),j(l);var ie=z(l,2),se=L(ie),le=L(se,!0);j(se);var fe=z(se,2);yn(fe);var xe=z(fe,2),Me=z(L(xe)),Ie=L(Me,!0);j(Me),j(xe),j(ie);var Le=z(ie,2),Re=e=>{var t=Xw(),n=L(t),r=L(n),i=z(r,2),a=L(i,!0);j(i),j(n);var o=z(n,2),s=L(o),c=e=>{var t=Kw(),n=L(t,!0);j(t),B(()=>G(n,V(he))),W(e,t)},l=e=>{var t=qw(),n=L(t,!0);j(t),B(()=>{vi(t,1,`px-3 py-3 text-xs ${V(he)===`Cannot read directory`?`text-red-400`:`text-gray-400`} text-center`),G(n,V(he))}),W(e,t)},u=e=>{var t=Wr();q(R(t),17,()=>V(me),Qr,(e,t)=>{var n=Wr(),r=R(n),i=e=>{var n=Jw(),r=L(n),i=z(L(r),2),a=L(i,!0);j(i),j(r);var o=z(r,2);j(n),B(()=>G(a,V(t).name)),H(`click`,r,()=>_e(V(t).path)),H(`click`,o,()=>ae(V(t).entry)),W(e,n)},a=e=>{var n=Yw(),r=L(n),i=z(L(r),2),a=L(i,!0);j(i),j(r);var o=z(r,2);j(n),B(()=>G(a,V(t).name)),H(`click`,o,()=>ae(V(t).entry)),W(e,n)};K(r,e=>{V(t).kind===`dir`?e(i):e(a,-1)}),W(e,n)}),W(e,t)};K(s,e=>{V(me)===null?e(c):V(me).length===0?e(l,1):e(u,-1)}),j(o),j(t),B(()=>{r.disabled=!V(de),G(a,V(pe))}),H(`click`,r,ve),W(e,t)};K(Le,e=>{V(ue)&&e(Re)});var ze=z(Le,2),Be=L(ze),Ve=L(Be,!0);j(Be);var He=z(Be,2),Ue=L(He);ki(Ue);var We=z(Ue);j(He),q(z(He,2),17,()=>V(y),e=>e.value,(e,t,n)=>{var r=Zw(),i=L(r);ki(i);var a=z(i);j(r),B(()=>G(a,` ${V(t).label??``}`)),H(`change`,i,re),Ri(i,()=>V(t).checked,e=>V(t).checked=e),W(e,r)}),j(ze);var Ge=z(ze,2),Ke=e=>{var t=Xw(),n=L(t),r=L(n),i=z(r,2),a=L(i,!0);j(i),j(n);var o=z(n,2),s=L(o),c=e=>{var t=Kw(),n=L(t,!0);j(t),B(()=>G(n,V(we))),W(e,t)},l=e=>{var t=eT(),n=R(t),r=e=>{var t=qw(),n=L(t,!0);j(t),B(()=>{vi(t,1,`px-3 py-3 text-xs ${V(we)===`Cannot read directory`?`text-red-400`:`text-gray-400`} text-center`),G(n,V(we))}),W(e,t)},i=e=>{var t=Wr();q(R(t),17,()=>V(Ce),Qr,(e,t)=>{var n=Qw(),r=L(n),i=z(L(r),2),a=L(i,!0);j(i),j(r);var o=z(r,2);j(n),B(()=>G(a,V(t).name)),H(`click`,r,()=>Ee(V(t).path)),H(`click`,o,()=>ae(V(t).name)),W(e,n)}),W(e,t)};K(n,e=>{V(Ce).length===0?e(r):e(i,-1)});var a=z(n,2),o=e=>{var t=$w(),n=z(L(t)),r=L(n,!0);j(n),j(t),B(()=>G(r,V(Se))),H(`click`,t,Oe),W(e,t)};K(a,e=>{V(we)!==`Cannot read directory`&&e(o)}),W(e,t)};K(s,e=>{V(Ce)===null?e(c):e(l,-1)}),j(o),j(t),B(()=>{r.disabled=!V(be),G(a,V(Se))}),H(`click`,r,De),W(e,t)};K(Ge,e=>{V(ye)&&e(Ke)}),j(c);var qe=z(c,2),Je=L(qe),Ye=e=>{var t=iT(),n=L(t),r=L(n),i=e=>{var t=nT(),n=R(t),r=L(n);j(n);var i=z(n,2),a=L(i);j(i);var o=z(i,2),s=L(o);j(o);var c=z(o,2),l=e=>{var t=tT(),n=L(t);j(t),B((e,r)=>{J(t,`title`,e),G(n,`${V(E).length??``} extension${V(E).length>1?`s`:``} found (${r??``})`)},[()=>V(E).join(`, `),()=>V(E).join(`, `)]),W(e,t)};K(c,e=>{V(E).length&&e(l)}),B(()=>{G(r,`${V(T).scanned??``} file(s) scanned`),G(a,`${V(T).unique??``} unique domain words`),G(s,`${V(T).shown??``} shown`)}),W(e,t)};K(r,e=>{V(T)&&e(i)}),j(n);var a=z(n,2),o=L(a),s=L(o,!0);j(o);var c=z(o,2);ki(c);var l=z(c,2),u=L(l,!0);j(l),j(a);var d=z(a,2),f=L(d,!0);j(d);var p=z(d,2);q(p,21,()=>V(D),Qr,(e,t,n)=>{var r=rT(),i=L(r);i.textContent=n+1;var a=z(i,2),o=L(a),s=L(o),c=L(s,!0);j(s);var l=z(s,2),u=L(l,!0);j(l),j(o);var d=z(o,2),f=L(d);j(d),j(a),j(r),B(()=>{G(c,V(t).word),G(u,V(t).freq),bi(f,`width:${V(t).pct??``}%`)}),H(`click`,r,()=>Ne(V(t).word)),W(e,r)}),j(p),j(t),B((e,t,n,r,i,a)=>{J(o,`title`,e),G(s,t),J(c,`title`,n),J(l,`title`,r),G(u,i),G(f,a)},[()=>Y(`wc.min_files_hint`),()=>Y(`wc.min_files_label`),()=>Y(`wc.min_files_hint`),()=>Y(`wc.apply_hint`),()=>Y(`wc.apply_btn`),()=>Y(`wc.top_words`)]),Fi(c,()=>V(h),e=>F(h,e)),H(`click`,l,ce),W(e,t)};K(Je,e=>{V(v)&&e(Ye)});var Xe=z(Je,2),Ze=L(Xe),Qe=e=>{var t=aT(),n=L(t,!0);j(t),B(()=>G(n,V(g))),W(e,t)};K(Ze,e=>{V(_)&&e(Qe)});var $e=z(Ze,2);let et;Ui($e,e=>F(ke,e),()=>V(ke)),j(Xe),Ui(Xe,e=>F(Ae,e),()=>V(Ae));var tt=z(Xe,2),nt=e=>{var t=cT(),n=L(t),r=L(n),i=L(r);j(r);var a=z(r,2);j(n);var o=z(n,2),s=L(o,!0);j(o);var c=z(o,2),l=L(c),u=e=>{var t=Wr();q(R(t),17,()=>V(ne),Qr,(e,t)=>{var n=oT(),r=L(n),i=L(r,!0);j(r);var a=z(r,2);j(n),B(()=>G(i,V(t))),H(`click`,a,()=>ae(V(t))),W(e,n)}),W(e,t)},d=e=>{W(e,sT())};K(l,e=>{V(ne).length?e(u):e(d,-1)}),j(c),j(t),B(e=>{G(i,`${V(te)??``} ×${V(O)??``}`),G(s,e)},[()=>Y(`wc.found_in`)]),H(`click`,a,Pe),W(e,t)};K(tt,e=>{V(ee)&&e(nt)}),j(qe),j(n),B((e,t,n,r,i,o,c,l,u,f)=>{G(a,e),G(s,t),G(d,n),G(C,r),G(k,i),G(le,o),J(fe,`placeholder`,c),G(Ie,l),G(Ve,u),ji(Ue,V(x)),G(We,` ${f??``}`),et=vi($e,1,``,null,et,{hidden:!V(je)})},[()=>Y(`wc.title`),()=>Y(`wc.close_btn`),()=>Y(`wc.search_root_label`),()=>Y(`wc.browse_btn`),()=>Y(`wc.launch_btn`),()=>Y(`wc.exclude_label`),()=>Y(`wc.exclude_placeholder`),()=>Y(`wc.browse_btn`),()=>Y(`wc.extensions_label`),()=>Y(`wc.all_btn`)]),H(`click`,o,function(...e){t.onclose?.apply(this,e)}),Fi(f,()=>V(p),e=>F(p,e)),H(`click`,b,Te),H(`click`,w,Fe),H(`input`,fe,oe),Fi(fe,()=>V(m),e=>F(m,e)),H(`click`,xe,ge),H(`change`,Ue,A),W(e,n)};K(Re,e=>{t.open&&e(ze)}),W(e,Le),Je()}Pr([`click`,`input`,`change`]);var dT=U(`<button class="ghost-button"><i class="fa-solid fa-cloud"></i></button>`),fT=U(`<button title="Toggle dark mode" class="ghost-button" aria-label="Toggle dark mode"> </button>`),pT=U(`<!> <!>`,1),mT=U(`<div class="relative hidden sm:block"><input type="search" class="w-56 pl-8 pr-3 py-1.5 text-sm rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500"/> <span class="absolute left-2.5 top-2 text-gray-400 text-sm pointer-events-none">🔍</span></div>`),hT=U(`<p class="p-8 text-red-500"> </p>`),gT=U(`<div class="h-full flex items-center justify-center p-8"><div class="max-w-md text-center"><div class="text-5xl mb-4 select-none" aria-hidden="true">📚</div> <h2 class="text-xl font-semibold text-gray-700 dark:text-gray-300 mb-2"> </h2> <p class="text-sm text-gray-500 dark:text-gray-500"> </p></div></div>`),_T=U(`<div class="app-shell bg-gray-50 text-gray-900 dark:bg-gray-900 dark:text-gray-100"><!> <div class="flex overflow-hidden"><!> <main id="home-content-area" class="flex-1 overflow-y-auto"><!></main></div></div> <!> <!> <!> <!>`,1);function vT(e,t){qe(t,!0);let n=P(!1),r=P(!1),i=P(!1),a=P(!1),o=P(null),s=P(!1),c=P(``),l=P(!1),u=P(!1),d=P(`Living AI Documentation`),f=null;function p(){try{let e=localStorage.getItem(`ld-dark`);if(e!==null)return e===`true`}catch{}return window.matchMedia(`(prefers-color-scheme: dark)`).matches}function m(e){is()&&(e=!1),F(l,e,!0),document.documentElement.classList.toggle(`dark`,e)}function h(){m(!V(l));try{localStorage.setItem(`ld-dark`,String(V(l)))}catch{}}kn(()=>{let e=document.getElementById(`hljs-dark`),t=document.getElementById(`hljs-light`);if(!e||!t)return;let n=X.codeBlockLightTheme&&!V(l);e.disabled=n,t.disabled=!n,document.body.classList.toggle(`ld-code-light`,n)});function g(e){let t=e.trim();if(f&&clearTimeout(f),!t){X.searchQuery=``,X.searchResults=null;return}X.searchQuery=t,X.searchResults=X.allDocs.filter(e=>e.title.toLowerCase().includes(t.toLowerCase())),f=window.setTimeout(async()=>{try{let e=await Y_(t);t===X.searchQuery&&(X.searchResults=e)}catch{}},350)}let _=P(I([]));function v(e){let t=V(_)[e];t&&(F(_,V(_).slice(0,e),!0),y(t.id,!1,`restore`))}async function y(e,t=!1,n=!1,r=null){if(n===!0&&X.currentDocId&&X.currentDocId!==e){let t=V(_).findIndex(t=>t.id===e);if(t!==-1)F(_,V(_).slice(0,t),!0);else{let e=X.allDocs.find(e=>e.id===X.currentDocId);F(_,[...V(_),{id:X.currentDocId,title:e?e.title:X.currentDocId}],!0)}}else n||F(_,[],!0);X.currentDocId=e;let i=X.allDocs.find(t=>t.id===e);if(i&&X.revealDoc(i),!t){let t=new URL(location.href);t.searchParams.set(`doc`,e),t.hash=r?`#${r}`:``,history.pushState({docId:e,anchor:r||null},``,t)}F(s,!0),F(c,``);try{let t=await G_(e);t.id=e,F(o,t,!0),document.title=t.title,requestAnimationFrame(()=>{let e=document.getElementById(`home-content-area`);if(r){let t=document.getElementById(r);t&&e&&(e.scrollTop+=t.getBoundingClientRect().top-e.getBoundingClientRect().top-80)}else e&&(e.scrollTop=0)})}catch(e){F(c,Y(`doc.failed_to_load`)+(e instanceof Error?e.message:String(e)))}finally{F(s,!1)}}async function b(e){if(!V(o))return;let t=V(o).id,n=await fetch(`/api/documents/`+t,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({content:e})});if(!n.ok)throw Error(await n.text());let r=await G_(t);r.id=t,F(o,r,!0);let i=e.match(/\]\(\s*\.?\/files\/[^)\s]+/g),a={...X.fileAttachmentCounts};i&&i.length?a[t]=i.length:delete a[t],X.fileAttachmentCounts=a}function x(e){let t=X.allDocs.find(t=>t.id===e);if(!t)return null;let n=(t.folder||[]).join(`/`),r=X.allDocs.filter(e=>(e.folder||[]).join(`/`)===n).slice().sort((e,t)=>(e.filename||``).localeCompare(t.filename||``)),i=r.findIndex(t=>t.id===e);if(i===-1)return null;let a=r[i+1]??r[i-1];return a?a.id:null}async function S(){if(!V(o))return;let e=V(o).id;if(!(await fetch(`/api/documents/`+encodeURIComponent(e),{method:`DELETE`})).ok)return;let t=x(e);X.allDocs=X.allDocs.filter(t=>t.id!==e),Array.isArray(X.searchResults)&&(X.searchResults=X.searchResults.filter(t=>t.id!==e));let n={...X.annotationCounts};delete n[e],X.annotationCounts=n;let r={...X.fileAttachmentCounts};delete r[e],X.fileAttachmentCounts=r,t?await y(t):(X.currentDocId=null,F(o,null),history.pushState({},``,location.pathname))}async function C(e,t){let n=X.currentDocId?cv(X.currentDocId,e,t):null;if(await w(),!n)return;X.currentDocId=n;try{F(o,{...await G_(n),id:n},!0)}catch{}let r=new URL(location.href);r.searchParams.set(`doc`,n),history.replaceState({docId:n,anchor:r.hash.slice(1)||null},``,r);let i=X.allDocs.find(e=>e.id===n);i&&X.revealDoc(i)}async function w(){let[e,t,n]=await Promise.all([z_(),R_(),B_()]);if(X.allDocs=e,X.explorerTree=n,X.docsFolder=typeof t.docsFolder==`string`?t.docsFolder:``,t.docsFolder)try{X.allFolderPaths=await W_(t.docsFolder)}catch{X.allFolderPaths=[]}let[r,i,a]=await Promise.all([K_(),q_(),J_()]);X.annotationCounts=r,X.fileAttachmentCounts=i,X.docStatuses=a}Ji(async()=>{F(u,is(),!0),m(p());let e=await R_();await Ca(e.language||`en`),e.title&&(document.title=e.title,F(d,e.title,!0)),X.exclusiveFolderExpansion=!!e.exclusiveFolderExpansion,X.codeBlockMaxHeight=typeof e.codeBlockMaxHeight==`number`?e.codeBlockMaxHeight:400,X.imageRoundedCorners=!!e.imageRoundedCorners,X.imageCentered=!!e.imageCentered,X.imageBorder=!!e.imageBorder,X.codeBlockLightTheme=!!e.codeBlockLightTheme,X.codeBlockMaxHeight>0&&document.documentElement.style.setProperty(`--ld-code-max-h`,X.codeBlockMaxHeight+`px`),await w();let t=new URLSearchParams(location.search).get(`doc`);if(t)y(t,!0,!1,location.hash?location.hash.slice(1):null);else{let t=Array.isArray(e.favorites)?e.favorites:[],n=t.length?t[0]?.id:void 0,r=(n?X.allDocs.find(e=>e.id===n):void 0)??X.allDocs.find(e=>!e.folder?.length)??X.allDocs[0];r&&y(r.id,!0)}let n=e=>{let t=e.state?.docId||new URLSearchParams(location.search).get(`doc`),n=e.state?.anchor||(location.hash.length>1?location.hash.slice(1):null);t&&y(t,!0,!1,n)};window.addEventListener(`popstate`,n);let r=()=>{w()};return window.addEventListener(`ld:documents-changed`,r),()=>{window.removeEventListener(`popstate`,n),window.removeEventListener(`ld:documents-changed`,r)}});var T=_T(),E=R(T),D=L(E);es(D,{get title(){return V(d)},subtitle:``,actions:e=>{var t=pT(),n=R(t),r=e=>{var t=dT();B((e,n)=>{J(t,`title`,e),J(t,`aria-label`,n)},[()=>Y(`nav.word_cloud`),()=>Y(`nav.word_cloud`)]),H(`click`,t,()=>F(a,!0)),W(e,t)},i=N(()=>!va.hidden.includes(ha));K(n,e=>{V(i)&&e(r)});var o=z(n,2),s=e=>{var t=fT(),n=L(t,!0);j(t),B(()=>G(n,V(l)?`☀`:`☾`)),H(`click`,t,h),W(e,t)};K(o,e=>{V(u)||e(s)}),W(e,t)},children:(e,t)=>{var n=mT(),r=L(n);ki(r),Ie(2),j(n),B(e=>{J(r,`placeholder`,e),Ai(r,X.searchQuery)},[()=>Y(`nav.search_placeholder`)]),H(`input`,r,e=>g(e.target.value)),W(e,n)},$$slots:{actions:!0,default:!0}});var ee=z(D,2),te=L(ee);Ov(te,{onopen:e=>y(e),onsearch:g,onexport:()=>F(i,!0),onnewfolder:()=>F(n,!0),onnewdoc:()=>F(r,!0),onmoved:C});var O=z(te,2),ne=L(O),k=e=>{var t=Wr(),n=R(t),r=e=>{var t=hT(),n=L(t,!0);j(t),B(()=>G(n,V(c))),W(e,t)},i=e=>{kw(e,{get doc(){return V(o)},get navHistory(){return V(_)},ongoback:v,onopen:(e,t)=>y(e,!1,!0,t),onsave:b,ondelete:S})};K(n,e=>{V(c)?e(r):e(i,-1)}),W(e,t)},A=e=>{var t=gT(),n=L(t),r=z(L(n),2),i=L(r,!0);j(r);var a=z(r,2),o=L(a,!0);j(a),j(n),j(t),B((e,t)=>{G(i,e),G(o,t)},[()=>Y(`welcome.title`),()=>Y(`welcome.hint`)]),W(e,t)};K(ne,e=>{V(o)?e(k):e(A,-1)}),j(O),j(ee),j(E);var re=z(E,2);Lw(re,{get open(){return V(n)},onclose:()=>F(n,!1),onsuccess:w});var ie=z(re,2);Ja(ie,{get open(){return V(r)},onclose:()=>F(r,!1),onsuccess:async e=>{await w(),y(e)}});var ae=z(ie,2);Gw(ae,{get open(){return V(i)},onclose:()=>F(i,!1)}),uT(z(ae,2),{get open(){return V(a)},onclose:()=>F(a,!1)}),W(e,T),Je()}Pr([`click`,`input`]);var yT=`modulepreload`,bT=function(e){return`/`+e},xT={},ST=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e=document.getElementsByTagName(`link`),i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?import.meta.resolve(e):new URL(e,new URL(`../../../src/node/plugins/importAnalysisBuild.ts`,import.meta.url)).href}r=o(t.map(t=>{if(t=bT(t,n),t=s(t),t in xT)return;xT[t]=!0;let r=t.endsWith(`.css`);for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}let i=document.createElement(`link`);if(i.rel=r?`stylesheet`:yT,r||(i.as=`script`),i.crossOrigin=``,i.href=t,a&&i.setAttribute(`nonce`,a),document.head.appendChild(i),r)return new Promise((e,n)=>{i.addEventListener(`load`,e),i.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${t}`)))})}))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},CT=U(`<div class="flex flex-col h-screen overflow-hidden bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100"><header class="flex items-center gap-1 px-2 h-12 shrink-0 border-b border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 shadow-sm z-10"><button class="tool-btn !w-auto px-2 text-xs font-medium text-gray-500 dark:text-gray-400"> </button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnSidebar" class="tool-btn">☰</button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnCopyDiagramId" class="tool-btn"><svg width="15" height="15" viewBox="0 0 16 16" fill="none" stroke="currentColor" stroke-width="1.6" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="5" width="8" height="9" rx="1.5"></rect><path d="M3 11V3a1 1 0 0 1 1-1h7"></path></svg></button> <button id="toolSelect" class="tool-btn tool-active"><svg width="11" height="13" viewBox="0 0 11 13" fill="currentColor" stroke="none"><path d="M1 1 L1 12 L4 9 L6.5 13 L8 12.2 L5.5 8.2 L10 8.2 Z"></path></svg></button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="toolBox" class="tool-btn"><svg width="15" height="10" viewBox="0 0 15 10" fill="none" stroke="currentColor" stroke-width="1.5"><rect x="1" y="1" width="13" height="8" rx="1"></rect></svg></button> <button id="toolEllipse" class="tool-btn"><svg width="16" height="10" viewBox="0 0 16 10" fill="none" stroke="currentColor" stroke-width="1.5"><ellipse cx="8" cy="5" rx="7" ry="4"></ellipse></svg></button> <button id="toolDatabase" class="tool-btn"><svg width="12" height="16" viewBox="0 0 12 16" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><ellipse cx="6" cy="3" rx="5" ry="2"></ellipse><path d="M1 3v10c0 1.1 2.2 2 5 2s5-.9 5-2V3"></path><path d="M11 7.5c0 1.1-2.2 2-5 2s-5-.9-5-2"></path></svg></button> <button id="toolCircle" class="tool-btn"><svg width="13" height="13" viewBox="0 0 13 13" fill="none" stroke="currentColor" stroke-width="1.5"><circle cx="6.5" cy="6.5" r="5.5"></circle></svg></button> <button id="toolActor" class="tool-btn"><svg width="12" height="17" viewBox="0 0 12 17" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><circle cx="6" cy="3" r="2.2"></circle><line x1="6" y1="5.2" x2="6" y2="10"></line><line x1="1.5" y1="7.5" x2="10.5" y2="7.5"></line><line x1="6" y1="10" x2="2.5" y2="15"></line><line x1="6" y1="10" x2="9.5" y2="15"></line></svg></button> <button id="toolPostIt" class="tool-btn"><svg width="13" height="13" viewBox="0 0 13 13" fill="none" stroke="currentColor" stroke-width="1.4"><path d="M1 1 H9 L12 4 V12 H1 Z"></path><path d="M9 1 V4 H12" stroke-opacity="0.5"></path></svg></button> <button id="toolTextFree" class="tool-btn" style="font-size:11px; font-weight:600;">T</button> <button id="toolImage" class="tool-btn"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="1" width="12" height="12" rx="1.5"></rect><circle cx="4.5" cy="4.5" r="1.2"></circle><path d="M1 9.5 L4 6.5 L6.5 9 L9 7 L13 10.5"></path></svg></button> <a href="/shape-editor" class="tool-btn">✦</a> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="toolArrow" class="tool-btn">→</button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnDelete" class="tool-btn"><svg width="11" height="11" viewBox="0 0 11 11" fill="none" stroke="currentColor" stroke-width="1.8" stroke-linecap="round"><line x1="1" y1="1" x2="10" y2="10"></line><line x1="10" y1="1" x2="1" y2="10"></line></svg></button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnDiagramDefaults" class="tool-btn"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492M5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0"></path><path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.474l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115z"></path></svg></button> <button id="btnAlign" class="tool-btn"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4"><line x1="0.5" y1="7.5" x2="13.5" y2="7.5"></line><line x1="3.5" y1="0.5" x2="3.5" y2="13.5" stroke-dasharray="1.5 1.5"></line><line x1="10.5" y1="0.5" x2="10.5" y2="13.5" stroke-dasharray="1.5 1.5"></line></svg></button> <button id="btnGrid" class="tool-btn"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.2"><line x1="5" y1="1" x2="5" y2="13"></line><line x1="9" y1="1" x2="9" y2="13"></line><line x1="1" y1="5" x2="13" y2="5"></line><line x1="1" y1="9" x2="13" y2="9"></line><rect x="1" y="1" width="12" height="12" rx="1"></rect></svg></button> <button id="btnEdgeStraight" class="tool-btn"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round"><line x1="2" y1="12" x2="12" y2="2"></line><polyline points="8,2 12,2 12,6"></polyline></svg></button> <button id="btnEvidenceMode" class="tool-btn"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M4 1.5 H8.5 L11 4 V12.5 H4 Z"></path><path d="M8.5 1.5 V4 H11"></path><path d="M1.5 5.5 H6.5"></path><path d="M1.5 8 H6.5"></path><path d="M1.5 10.5 H5"></path></svg></button> <button id="btnResizeMode" class="tool-btn active-tool"><svg id="icon-resize-corner" width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="1" width="12" height="12" stroke-dasharray="2.5 2"></rect><line x1="4" y1="4" x2="10" y2="10"></line><polyline points="7,10 10,10 10,7"></polyline></svg> <svg id="icon-resize-center" width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round" class="hidden"><rect x="1" y="1" width="12" height="12" stroke-dasharray="2.5 2"></rect><line x1="4" y1="4" x2="10" y2="10"></line><polyline points="4,6.5 4,4 6.5,4"></polyline><polyline points="10,7.5 10,10 7.5,10"></polyline><line x1="10" y1="4" x2="4" y2="10"></line><polyline points="7.5,4 10,4 10,6.5"></polyline><polyline points="4,7.5 4,10 6.5,10"></polyline></svg></button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <input id="diagramTitle" type="text" class="flex-1 min-w-0 px-2 py-1 text-sm bg-transparent border-0 focus:outline-none focus:ring-1 focus:ring-blue-500 rounded text-gray-700 dark:text-gray-300 placeholder:text-gray-400"/> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnZoomOut" class="tool-btn">−</button> <span id="zoomLevel" class="text-xs text-gray-500 dark:text-gray-400 w-10 text-center tabular-nums select-none">100%</span> <button id="btnZoomIn" class="tool-btn">+</button> <button id="btnZoomReset" class="tool-btn">⊡</button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnDark" class="tool-btn"><span id="darkIcon">☽</span></button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnDebug" class="hidden tool-btn text-xs font-mono">dbg</button> <div id="sepDebug" class="hidden w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnExportDrawio" class="tool-btn"><svg xmlns="http://www.w3.org/2000/svg" width="16" height="16" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true"><path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"></path><polyline points="7 10 12 15 17 10"></polyline><line x1="12" y1="15" x2="12" y2="3"></line></svg></button> <div class="w-px h-6 bg-gray-200 dark:bg-gray-700 mx-0.5"></div> <button id="btnSave" disabled="" class="px-3 py-1.5 text-xs font-semibold rounded-lg bg-blue-600 hover:bg-blue-700 text-white disabled:opacity-40 disabled:cursor-not-allowed shrink-0 transition-colors"><span> </span></button></header> <div class="flex flex-1 overflow-hidden"><div id="sidebar" class="w-56 shrink-0 border-r border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 flex flex-col overflow-hidden" style="transition: width 0.2s ease"><div class="flex items-center justify-between px-3 py-2 border-b border-gray-200 dark:border-gray-700 shrink-0"><span class="text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider"> </span> <button id="btnNewDiagram" class="text-xs font-medium text-blue-600 dark:text-blue-400 hover:text-blue-700 dark:hover:text-blue-300 transition-colors"> </button></div> <div id="diagramList" class="flex-1 overflow-y-auto py-1"></div></div> <div role="separator" aria-orientation="vertical"></div> <div class="relative flex-1 overflow-hidden bg-gray-50 dark:bg-gray-950"><div id="vis-canvas" class="w-full h-full"></div> <div id="customShapeBar" class="hidden"><div id="customShapeBarBody"></div></div> <div id="debugLayer"></div> <div id="evidenceLayer" class="hidden"></div> <div id="stampOverlay" style="position:absolute;inset:0;display:none;z-index:11;cursor:crosshair;"></div> <div id="selectionOverlay"><div id="rh-tl" class="resize-handle" style="top: -5px; left: -5px; cursor: nw-resize"></div> <div id="rh-tr" class="resize-handle" style="top: -5px; right: -5px; cursor: ne-resize"></div> <div id="rh-bl" class="resize-handle" style="bottom: -5px; left: -5px; cursor: sw-resize"></div> <div id="rh-br" class="resize-handle" style="bottom: -5px; right: -5px; cursor: se-resize"></div> <div id="rh-rotate">↻</div> <div id="rh-label-rotate" style="left: 0; top: -28px;"><svg width="10" height="10" viewBox="0 0 10 10" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><g transform="rotate(25,5,5)"><line x1="2.5" y1="3" x2="7.5" y2="3"></line><line x1="5" y1="3" x2="5" y2="8"></line></g></svg></div></div> <aside id="evidencePanel" class="hidden absolute top-0 right-0 bottom-0 w-80 max-w-[85vw] z-30 bg-gray-50 dark:bg-gray-900 border-l border-gray-200 dark:border-gray-700 shadow-xl flex flex-col"><div class="flex items-center justify-between gap-2 px-4 py-3 border-b border-gray-200 dark:border-gray-700"><h2 id="evidencePanelTitle" class="text-sm font-semibold text-gray-800 dark:text-gray-100"> </h2> <button id="btnEvidenceClose" class="tool-btn !w-7 !h-7">×</button></div> <div id="evidencePanelBody" class="flex-1 overflow-y-auto p-3 space-y-3"></div></aside> <div id="nodePanel" class="float-panel hidden"><button id="btnNodeLock" class="tool-btn !w-6 !h-6 text-sm">🔒</button> <div class="panel-sep"></div> <div id="nodePanelControls" class="contents"><button id="nodeColorSwatch" style="width:1.5rem;height:1.5rem;border-radius:0.25rem;border:2px solid #a8a29e;background:#f5f5f4;cursor:pointer;flex-shrink:0;"></button> <div class="panel-sep"></div> <input id="nodeBgOpacity" type="range" min="0" max="100" step="5" value="100" class="w-16 h-1 accent-orange-500 cursor-pointer"/> <div class="panel-sep"></div> <button id="btnNodeLabelEdit" class="tool-btn !w-6 !h-6">✎</button> <button id="btnNodeLink" class="tool-btn !w-6 !h-6"><svg width="13" height="13" viewBox="0 0 13 13" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M5 7.5a3.5 3.5 0 0 0 5 0l1.5-1.5a3.5 3.5 0 0 0-5-5L5 2.5"></path><path d="M8 5.5a3.5 3.5 0 0 0-5 0L1.5 7a3.5 3.5 0 0 0 5 5L8 10.5"></path></svg></button> <div class="panel-sep"></div> <button id="btnNodeFontDecrease" class="tool-btn !w-8 !h-6" style="font-size: 10px">Aa−</button> <span id="nodeFontSizeValue" class="inline-flex items-center justify-center min-w-[2.25rem] h-6 px-1 text-[11px] font-mono text-gray-700 dark:text-gray-200 border border-gray-300 dark:border-gray-600 rounded bg-white/80 dark:bg-gray-800/80">13</span> <button id="btnNodeFontIncrease" class="tool-btn !w-8 !h-6" style="font-size: 10px">Aa+</button> <div class="panel-sep"></div> <button id="btnAlignLeft" class="tool-btn !w-6 !h-6"><svg width="12" height="10" viewBox="0 0 12 10" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"><line x1="1" y1="2" x2="11" y2="2"></line><line x1="1" y1="5" x2="7" y2="5"></line><line x1="1" y1="8" x2="9" y2="8"></line></svg></button> <button id="btnAlignCenter" class="tool-btn !w-6 !h-6"><svg width="12" height="10" viewBox="0 0 12 10" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"><line x1="1" y1="2" x2="11" y2="2"></line><line x1="2.5" y1="5" x2="9.5" y2="5"></line><line x1="1.5" y1="8" x2="10.5" y2="8"></line></svg></button> <button id="btnAlignRight" class="tool-btn !w-6 !h-6"><svg width="12" height="10" viewBox="0 0 12 10" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round"><line x1="1" y1="2" x2="11" y2="2"></line><line x1="5" y1="5" x2="11" y2="5"></line><line x1="3" y1="8" x2="11" y2="8"></line></svg></button> <div class="panel-sep"></div> <button id="btnValignTop" class="tool-btn !w-6 !h-6"><svg width="10" height="12" viewBox="0 0 10 12" fill="none" stroke="currentColor" stroke-linecap="round"><line x1="1" y1="1.5" x2="9" y2="1.5" stroke-width="2"></line><line x1="1" y1="5" x2="8" y2="5" stroke-width="1.3"></line><line x1="1" y1="8.5" x2="6" y2="8.5" stroke-width="1.3"></line></svg></button> <button id="btnValignMiddle" class="tool-btn !w-6 !h-6"><svg width="10" height="12" viewBox="0 0 10 12" fill="none" stroke="currentColor" stroke-linecap="round"><line x1="1" y1="2.5" x2="8" y2="2.5" stroke-width="1.3"></line><line x1="1" y1="6" x2="9" y2="6" stroke-width="2"></line><line x1="1" y1="9.5" x2="6" y2="9.5" stroke-width="1.3"></line></svg></button> <button id="btnValignBottom" class="tool-btn !w-6 !h-6"><svg width="10" height="12" viewBox="0 0 10 12" fill="none" stroke="currentColor" stroke-linecap="round"><line x1="1" y1="3.5" x2="8" y2="3.5" stroke-width="1.3"></line><line x1="1" y1="7" x2="6" y2="7" stroke-width="1.3"></line><line x1="1" y1="10.5" x2="9" y2="10.5" stroke-width="2"></line></svg></button> <div class="panel-sep"></div> <div id="customShapeLabelPlacementControls" class="hidden"><button class="tool-btn !w-7 !h-6 font-mono text-[10px]" data-label-placement="above">T↑</button> <button class="tool-btn !w-7 !h-6 font-mono text-[10px]" data-label-placement="below">T↓</button> <button class="tool-btn !w-7 !h-6 font-mono text-[10px]" data-label-placement="left">←T</button> <button class="tool-btn !w-7 !h-6 font-mono text-[10px]" data-label-placement="right">T→</button> <button class="tool-btn !w-7 !h-6 font-mono text-[10px]" data-label-placement="center">T□</button> <div class="panel-sep"></div></div> <button id="btnZOrderBack" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="5" width="8" height="8" rx="1"></rect><rect x="5" y="1" width="8" height="8" rx="1" stroke-opacity="0.35"></rect></svg></button> <button id="btnZOrderFront" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><rect x="1" y="5" width="8" height="8" rx="1" stroke-opacity="0.35"></rect><rect x="5" y="1" width="8" height="8" rx="1"></rect></svg></button> <div class="panel-sep"></div> <button id="btnStampColor" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><path d="M7 2 C7 2 3 6.5 3 9 a4 4 0 0 0 8 0 C11 6.5 7 2 7 2 Z" fill="currentColor" fill-opacity="0.25"></path></svg></button> <button id="btnStampFontSize" class="tool-btn !w-7 !h-6 font-mono text-xs font-bold">Aa</button> <button id="btnStampSize" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 14 14" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><rect x="2" y="4" width="6" height="6" rx="0.8" fill="currentColor" fill-opacity="0.25"></rect><path d="M10 2 L12 2 L12 4"></path><path d="M12 2 L9 5"></path><path d="M10 12 L12 12 L12 10"></path><path d="M12 12 L9 9"></path></svg></button> <div class="panel-sep"></div> <button id="btnRotateCCW" class="tool-btn !w-7 !h-6" style="font-size:15px; line-height:1;">↺</button> <button id="btnRotateCW" class="tool-btn !w-7 !h-6" style="font-size:15px; line-height:1;">↻</button> <div class="panel-sep"></div> <button id="btnCopyPng" class="tool-btn !h-6 px-1.5 font-mono text-xs font-semibold flex items-center gap-0.5"><svg width="10" height="10" viewBox="0 0 10 10" fill="none" stroke="currentColor" stroke-width="1.4" stroke-linecap="round" stroke-linejoin="round"><line x1="5" y1="7" x2="5" y2="1"></line><polyline points="2,4 5,1 8,4"></polyline><line x1="1" y1="9" x2="9" y2="9"></line></svg> PNG</button> <div class="panel-sep"></div> <button id="btnGroup" class="tool-btn !w-8 !h-7"><svg width="22" height="14" viewBox="0 0 22 14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"><rect x="0.7" y="1" width="20.6" height="12" rx="2" stroke-dasharray="2.5,1.5"></rect><rect x="4" y="4.5" width="3" height="5" rx="1" fill="currentColor"></rect><rect x="15" y="4.5" width="3" height="5" rx="1" fill="currentColor"></rect></svg></button> <button id="btnUngroup" class="tool-btn !w-8 !h-7"><svg width="26" height="14" viewBox="0 0 26 14" fill="none" stroke="currentColor" stroke-width="1.3" stroke-linecap="round" stroke-linejoin="round"><rect x="0.7" y="1" width="9" height="12" rx="2" stroke-dasharray="2.5,1.5"></rect><rect x="3" y="4.5" width="3" height="5" rx="1" fill="currentColor"></rect><rect x="16.3" y="1" width="9" height="12" rx="2" stroke-dasharray="2.5,1.5"></rect><rect x="19" y="4.5" width="3" height="5" rx="1" fill="currentColor"></rect></svg></button> <div class="panel-sep"></div> <button id="btnSaveShapeDefault" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492M5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0"></path><path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.474l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115z"></path></svg></button></div></div> <div id="linkPanel" class="float-panel hidden" style="min-width:260px; flex-direction:column; align-items:stretch; gap:0.5rem; padding:0.75rem;"><div class="text-xs font-semibold text-gray-500 dark:text-gray-400 mb-1"> </div> <label class="flex items-center gap-2 text-xs cursor-pointer"><input type="radio" name="linkType" id="linkTypeUrl" value="url" class="accent-orange-500"/> <span> </span></label> <div id="linkUrlRow"><input id="linkUrlInput" type="url" class="w-full text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-1 focus:ring-orange-400"/></div> <label class="flex items-center gap-2 text-xs cursor-pointer"><input type="radio" name="linkType" id="linkTypeDiagram" value="diagram" class="accent-orange-500"/> <span> </span></label> <div id="linkDiagramRow" class="hidden"><select id="linkDiagramSelect" class="w-full text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-1 focus:ring-orange-400"></select></div> <label class="flex items-center gap-2 text-xs cursor-pointer"><input type="radio" name="linkType" id="linkTypeNew" value="new" class="accent-orange-500"/> <span> </span></label> <div id="linkNewRow" class="hidden"><input id="linkNewName" type="text" class="w-full text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 bg-white dark:bg-gray-800 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-1 focus:ring-orange-400"/></div> <div class="flex gap-1 mt-1"><button id="btnLinkSave" class="flex-1 text-xs bg-orange-500 hover:bg-orange-600 text-white rounded px-2 py-1"> </button> <button id="btnLinkRemove" class="text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 hover:bg-red-50 dark:hover:bg-red-900/20 hover:text-red-600"> </button> <button id="btnLinkCancel" class="text-xs border border-gray-300 dark:border-gray-600 rounded px-2 py-1 hover:bg-gray-100 dark:hover:bg-gray-700">✕</button></div></div> <div id="edgePanel" class="float-panel hidden"><button id="btnEdgeLock" class="tool-btn !w-6 !h-6 text-sm">🔒</button> <div class="panel-sep"></div> <div id="edgePanelControls" class="contents"><button id="edgeBtnNone" class="tool-btn !w-7 !h-6 font-mono text-xs">—</button> <button id="edgeBtnFrom" class="tool-btn !w-7 !h-6 text-xs">←</button> <button id="edgeBtnTo" class="tool-btn !w-7 !h-6 text-xs">→</button> <button id="edgeBtnBoth" class="tool-btn !w-8 !h-6 text-xs">←→</button> <div class="panel-sep"></div> <button id="edgeBtnSolid" class="tool-btn !w-8 !h-6"><svg width="22" height="4" viewBox="0 0 22 4"><line x1="1" y1="2" x2="21" y2="2" stroke="currentColor" stroke-width="2" stroke-linecap="round"></line></svg></button> <button id="edgeBtnDashed" class="tool-btn !w-8 !h-6"><svg width="22" height="4" viewBox="0 0 22 4"><line x1="1" y1="2" x2="21" y2="2" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-dasharray="4,3"></line></svg></button> <div class="panel-sep"></div> <button id="btnEdgeFontDecrease" class="tool-btn !w-8 !h-6" style="font-size: 10px">Aa−</button> <span id="edgeFontSizeValue" class="inline-flex items-center justify-center min-w-[2.25rem] h-6 px-1 text-[11px] font-mono text-gray-700 dark:text-gray-200 border border-gray-300 dark:border-gray-600 rounded bg-white/80 dark:bg-gray-800/80">11</span> <button id="btnEdgeFontIncrease" class="tool-btn !w-8 !h-6" style="font-size: 10px">Aa+</button> <div class="panel-sep"></div> <button id="btnEdgeLabelEdit" class="tool-btn !w-6 !h-6">✎</button> <button id="btnEdgeLabelWidthReset" class="tool-btn !w-6 !h-6 text-xs">↔</button> <div class="panel-sep"></div> <button id="btnEdgeLabelRotateCCW" class="tool-btn !w-7 !h-6 text-sm">↺</button> <button id="btnEdgeLabelRotateCW" class="tool-btn !w-7 !h-6 text-sm">↻</button> <div class="panel-sep"></div> <button id="btnEdgeLabelOffsetLeft" class="tool-btn !w-6 !h-6 text-sm">←</button> <button id="btnEdgeLabelOffsetRight" class="tool-btn !w-6 !h-6 text-sm">→</button> <button id="btnEdgeLabelOffsetUp" class="tool-btn !w-6 !h-6 text-sm">↑</button> <button id="btnEdgeLabelOffsetDown" class="tool-btn !w-6 !h-6 text-sm">↓</button> <button id="btnEdgeLabelOffsetReset" class="tool-btn !w-6 !h-6 text-xs">⊙</button> <div class="panel-sep"></div> <button id="btnEdgeWidthDecrease" class="tool-btn !w-7 !h-6" style="font-size:10px">W−</button> <button id="btnEdgeWidthIncrease" class="tool-btn !w-7 !h-6" style="font-size:10px">W+</button> <div class="panel-sep"></div> <button id="edgeColorSwatch" style="width:1.5rem;height:1.5rem;border-radius:0.25rem;border:2px solid #a8a29e;background:#a8a29e;cursor:pointer;flex-shrink:0;"></button> <div class="panel-sep"></div> <button id="btnEdgeClearPorts" class="tool-btn !w-8 !h-6 text-xs">⊗</button> <div class="panel-sep"></div> <button id="btnSaveEdgeDefault" class="tool-btn !w-7 !h-6"><svg width="14" height="14" viewBox="0 0 16 16" fill="currentColor"><path d="M8 4.754a3.246 3.246 0 1 0 0 6.492 3.246 3.246 0 0 0 0-6.492M5.754 8a2.246 2.246 0 1 1 4.492 0 2.246 2.246 0 0 1-4.492 0"></path><path d="M9.796 1.343c-.527-1.79-3.065-1.79-3.592 0l-.094.319a.873.873 0 0 1-1.255.52l-.292-.16c-1.64-.892-3.433.902-2.54 2.541l.159.292a.873.873 0 0 1-.52 1.255l-.319.094c-1.79.527-1.79 3.065 0 3.592l.319.094a.873.873 0 0 1 .52 1.255l-.16.292c-.892 1.64.901 3.434 2.541 2.54l.292-.159a.873.873 0 0 1 1.255.52l.094.319c.527 1.79 3.065 1.79 3.592 0l.094-.319a.873.873 0 0 1 1.255-.52l.292.16c1.64.893 3.434-.902 2.54-2.541l-.159-.292a.873.873 0 0 1 .52-1.255l.319-.094c1.79-.527 1.79-3.065 0-3.592l-.319-.094a.873.873 0 0 1-.52-1.255l.16-.292c.893-1.64-.902-3.433-2.541-2.54l-.292.159a.873.873 0 0 1-1.255-.52zm-2.633.283c.246-.835 1.428-.835 1.674 0l.094.319a1.873 1.873 0 0 0 2.693 1.115l.291-.16c.764-.415 1.6.42 1.184 1.185l-.159.292a1.873 1.873 0 0 0 1.116 2.692l.318.094c.835.246.835 1.428 0 1.674l-.319.094a1.873 1.873 0 0 0-1.115 2.693l.16.291c.415.764-.42 1.6-1.185 1.184l-.291-.159a1.873 1.873 0 0 0-2.693 1.116l-.094.318c-.246.835-1.428.835-1.674 0l-.094-.319a1.873 1.873 0 0 0-2.692-1.115l-.292.16c-.764.415-1.6-.42-1.184-1.185l.159-.291A1.873 1.873 0 0 0 1.945 8.93l-.319-.094c-.835-.246-.835-1.428 0-1.674l.319-.094A1.873 1.873 0 0 0 3.06 4.474l-.16-.292c-.415-.764.42-1.6 1.185-1.184l.292.159a1.873 1.873 0 0 0 2.692-1.115z"></path></svg></button></div></div> <textarea id="labelInput" class="hidden" rows="1"></textarea> <div id="emptyState" class="absolute inset-0 flex flex-col items-center justify-center text-gray-400 dark:text-gray-600 pointer-events-none select-none"><svg width="52" height="44" viewBox="0 0 52 44" fill="none" stroke="currentColor" stroke-width="1.5" class="mb-3 opacity-50"><rect x="2" y="4" width="18" height="12" rx="2"></rect><rect x="32" y="28" width="18" height="12" rx="2"></rect><line x1="20" y1="10" x2="32" y2="34" stroke-dasharray="4,3"></line><rect x="17" y="16" width="18" height="12" rx="2"></rect><line x1="26" y1="16" x2="26" y2="10" stroke-dasharray="4,3"></line></svg> <p class="text-sm"> </p></div></div></div> <div id="toastContainer"></div> <div id="imageNameModal" style="display:none;position:fixed;inset:0;z-index:1000;background:rgba(0,0,0,0.5);" class="flex items-center justify-center"><div class="bg-white dark:bg-gray-800 rounded-xl shadow-2xl p-6 w-80 flex flex-col gap-3"><p class="text-sm font-semibold text-gray-700 dark:text-gray-200"> </p> <p class="text-xs text-gray-400 dark:text-gray-500">Lettres, chiffres, <code class="bg-gray-100 dark:bg-gray-700 px-0.5 rounded">_</code> et <code class="bg-gray-100 dark:bg-gray-700 px-0.5 rounded">-</code> uniquement.
|
|
279
279
|
Laisser vide pour un nom automatique.</p> <div class="flex items-center gap-1"><input id="imageNameInput" type="text" autocomplete="off" spellcheck="false" class="flex-1 rounded border border-gray-300 dark:border-gray-600 bg-white dark:bg-gray-700
|
|
280
280
|
text-gray-900 dark:text-gray-100 text-sm px-2 py-1 outline-none focus:ring-2 focus:ring-blue-400"/> <span class="text-xs text-gray-400 dark:text-gray-500 whitespace-nowrap">.png</span></div> <p id="imageNameError" class="text-xs text-red-500 hidden"> </p> <div class="flex gap-2 justify-end"><button id="imageNameCancel" class="px-3 py-1 text-xs rounded border border-gray-300 dark:border-gray-600
|
|
281
|
-
text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"> </button> <button id="imageNameConfirm" class="px-3 py-1 text-xs rounded bg-blue-500 text-white hover:bg-blue-600"> </button></div></div></div></div>`);function mT(e,t){qe(t,!0),Ji(()=>{let e;return(async()=>{let t=`en`;try{t=(await fetch(`/api/config`).then(e=>e.json())).language||`en`}catch{}await Ca(t);let{initDiagram:r}=await fT(async()=>{let{initDiagram:e}=await import(`./main-BC6pYW7Q.js`);return{initDiagram:e}},[]);e=r();let i=document.getElementById(`sidebar`),a=parseInt(localStorage.getItem(n)||``,10);i&&Number.isFinite(a)&&(i.style.width=a+`px`)})(),()=>e?.()});let n=`ld-diagram-sidebar-w`,r=P(!1);function i(e){e.preventDefault();let t=document.getElementById(`sidebar`);if(!t)return;let i=e.clientX,a=t.getBoundingClientRect().width;F(r,!0),t.style.transition=`none`,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let o=e=>{let n=Math.max(160,Math.min(480,a+e.clientX-i));t.style.width=n+`px`},s=()=>{document.removeEventListener(`mousemove`,o),document.removeEventListener(`mouseup`,s),document.body.style.cursor=``,document.body.style.userSelect=``,F(r,!1),t.style.transition=``;try{localStorage.setItem(n,String(parseInt(t.style.width,10)))}catch{}};document.addEventListener(`mousemove`,o),document.addEventListener(`mouseup`,s)}var a=pT(),o=L(a),s=L(o),c=L(s,!0);j(s);var l=z(s,4),u=z(l,4),d=z(u,2),f=z(d,4),p=z(f,2),m=z(p,2),h=z(m,2),g=z(h,2),_=z(g,2),v=z(_,2),y=z(v,2),b=z(y,2),x=z(b,4),S=z(x,4),C=z(S,4),w=z(C,2),T=z(w,2),E=z(T,2),D=z(E,2),ee=z(D,2),te=z(ee,4),O=z(te,4),ne=z(O,4),k=z(ne,2),A=z(k,8),re=z(A,4),ie=z(re,4),ae=L(ie),oe=L(ae,!0);j(ae),j(ie),j(o);var se=z(o,2),ce=L(se),le=L(ce),ue=L(le),de=L(ue,!0);j(ue);var fe=z(ue,2),pe=L(fe,!0);j(fe),j(le),Ie(2),j(ce);var me=z(ce,2),he=z(me,2),ge=z(L(he),10),_e=z(L(ge),8),ve=z(_e,2);j(ge);var ye=z(ge,2),be=L(ye),xe=L(be),Se=L(xe,!0);j(xe);var Ce=z(xe,2);j(be),Ie(2),j(ye);var we=z(ye,2),Te=L(we),Ee=z(Te,4),De=L(Ee),Oe=z(De,4),ke=z(Oe,4),Ae=z(ke,2),je=z(Ae,4),Me=z(je,2),Ne=z(Me,2),Pe=z(Ne,4),Fe=z(Pe,2),Le=z(Fe,2),Re=z(Le,4),ze=z(Re,2),Be=z(ze,2),Ve=z(Be,4),He=L(Ve),Ue=z(He,2),We=z(Ue,2),Ge=z(We,2),Ke=z(Ge,2);Ie(2),j(Ve);var Ye=z(Ve,2),Xe=z(Ye,2),Ze=z(Xe,4),Qe=z(Ze,2),$e=z(Qe,2),et=z($e,4),tt=z(et,2),nt=z(tt,4),rt=z(nt,4),it=z(rt,2),at=z(it,4);j(Ee),j(we);var ot=z(we,2),st=L(ot),ct=L(st,!0);j(st);var lt=z(st,2),ut=z(L(lt),2),dt=L(ut,!0);j(ut),j(lt);var ft=z(lt,2),M=L(ft);j(ft);var pt=z(ft,2),mt=z(L(pt),2),ht=L(mt,!0);j(mt),j(pt);var gt=z(pt,4),_t=z(L(gt),2),vt=L(_t,!0);j(_t),j(gt);var yt=z(gt,2),N=L(yt);j(yt);var bt=z(yt,2),xt=L(bt),St=L(xt,!0);j(xt);var Ct=z(xt,2),wt=L(Ct,!0);j(Ct),Ie(2),j(bt),j(ot);var Tt=z(ot,2),Et=L(Tt),Dt=z(Et,4),Ot=L(Dt),kt=z(Ot,2),At=z(kt,2),jt=z(At,2),Mt=z(jt,4),Nt=z(Mt,2),Pt=z(Nt,4),Ft=z(Pt,2),It=z(Ft,2),Lt=z(It,4),Rt=z(Lt,2),zt=z(Rt,4),Bt=z(zt,2),Vt=z(Bt,4),Ht=z(Vt,2),Ut=z(Ht,2),Wt=z(Ut,2),Gt=z(Wt,2),Kt=z(Gt,4),qt=z(Kt,2),Jt=z(qt,4),Yt=z(Jt,4),Xt=z(Yt,4);j(Dt),j(Tt);var Zt=z(Tt,2),Qt=z(Zt,2),$t=z(L(Qt),2),en=L($t,!0);j($t),j(Qt),j(he),j(se);var tn=z(se,4),nn=L(tn),I=L(nn),rn=L(I,!0);j(I);var an=z(I,4),on=L(an);Ie(2),j(an);var sn=z(an,2),cn=L(sn,!0);j(sn);var ln=z(sn,2),un=L(ln),dn=L(un,!0);j(un);var fn=z(un,2),pn=L(fn,!0);j(fn),j(ln),j(nn),j(tn),j(a),B((e,t,n,i,a,o,s,ie,ae,se,ce,le,ue,fe,he,ge,ye,be,xe,we,Ee,j,Ie,Ve,qe,Je,ot,st,lt,ut,ft,pt,mt,gt,_t,yt,bt,xt,Ct,Tt,Dt,P,Qt,F,$t,tn,nn,I,an,sn,ln,un,fn,L,R,z,mn,hn,gn,_n,vn,yn,bn,xn,Sn,Cn,wn,Tn,En,Dn,On,kn,An,jn,Mn,Nn,Pn,Fn,B,In,Ln,Rn,zn,Bn,Vn,Hn,Un,Wn,Gn,Kn,qn,Jn,Yn,Xn,Zn,Qn,$n,er,tr,nr,rr,ir,ar)=>{G(c,e),J(l,`title`,t),J(u,`title`,n),J(d,`title`,i),J(f,`title`,a),J(p,`title`,o),J(m,`title`,s),J(h,`title`,ie),J(g,`title`,ae),J(_,`title`,se),J(v,`title`,ce),J(y,`title`,le),J(b,`title`,ue),J(x,`title`,fe),J(S,`title`,he),J(C,`title`,ge),J(w,`title`,ye),J(T,`title`,be),J(E,`title`,xe),J(D,`title`,we),J(ee,`title`,Ee),J(te,`placeholder`,j),J(O,`title`,Ie),J(ne,`title`,Ve),J(k,`title`,qe),J(A,`title`,Je),J(re,`title`,ot),G(oe,st),G(de,lt),G(pe,ut),vi(me,1,`w-1 shrink-0 cursor-col-resize select-none transition-colors ${V(r)?`bg-blue-500/60`:`bg-transparent hover:bg-blue-500/40`}`),J(_e,`title`,ft),J(ve,`title`,pt),G(Se,mt),J(Ce,`title`,gt),J(Te,`title`,_t),J(De,`title`,yt),J(Oe,`title`,bt),J(ke,`title`,xt),J(Ae,`title`,Ct),J(je,`title`,Tt),J(Me,`title`,Dt),J(Ne,`title`,P),J(Pe,`title`,Qt),J(Fe,`title`,F),J(Le,`title`,$t),J(Re,`title`,tn),J(ze,`title`,nn),J(Be,`title`,I),J(He,`title`,an),J(Ue,`title`,sn),J(We,`title`,ln),J(Ge,`title`,un),J(Ke,`title`,fn),J(Ye,`title`,L),J(Xe,`title`,R),J(Ze,`title`,z),J(Qe,`title`,mn),J($e,`title`,hn),J(et,`title`,gn),J(tt,`title`,_n),J(nt,`title`,vn),J(rt,`title`,yn),J(it,`title`,bn),J(at,`title`,xn),G(ct,Sn),G(dt,Cn),J(M,`placeholder`,wn),G(ht,Tn),G(vt,En),J(N,`placeholder`,Dn),G(St,On),G(wt,kn),J(Et,`title`,An),J(Ot,`title`,jn),J(kt,`title`,Mn),J(At,`title`,Nn),J(jt,`title`,Pn),J(Mt,`title`,Fn),J(Nt,`title`,B),J(Pt,`title`,In),J(Ft,`title`,Ln),J(It,`title`,Rn),J(Lt,`title`,zn),J(Rt,`title`,Bn),J(zt,`title`,Vn),J(Bt,`title`,Hn),J(Vt,`title`,Un),J(Ht,`title`,Wn),J(Ut,`title`,Gn),J(Wt,`title`,Kn),J(Gt,`title`,qn),J(Kt,`title`,Jn),J(qt,`title`,Yn),J(Jt,`title`,Xn),J(Yt,`title`,Zn),J(Xt,`title`,Qn),J(Zt,`placeholder`,$n),G(en,er),G(rn,tr),J(on,`placeholder`,nr),G(cn,rr),G(dn,ir),G(pn,ar)},[()=>Y(`diagram.back_btn`),()=>Y(`diagram.diagrams_list_title`),()=>Y(`diagram.toolbar.copy_mcp_id`),()=>Y(`diagram.toolbar.select`),()=>Y(`diagram.toolbar.box`),()=>Y(`diagram.toolbar.ellipse`),()=>Y(`diagram.toolbar.database`),()=>Y(`diagram.toolbar.circle`),()=>Y(`diagram.toolbar.actor`),()=>Y(`diagram.toolbar.postit`),()=>Y(`diagram.toolbar.text_free`),()=>Y(`diagram.toolbar.image`),()=>Y(`diagram.toolbar.shape_editor`),()=>Y(`diagram.toolbar.arrow`),()=>Y(`diagram.toolbar.delete`),()=>Y(`diagram.toolbar.defaults`),()=>Y(`diagram.toolbar.align_guides`),()=>Y(`diagram.toolbar.grid`),()=>Y(`diagram.toolbar.edge_style`),()=>Y(`diagram.toolbar.evidence_mode`),()=>Y(`diagram.toolbar.resize_corner`),()=>Y(`diagram.toolbar.title_placeholder`),()=>Y(`diagram.toolbar.zoom_out`),()=>Y(`diagram.toolbar.zoom_in`),()=>Y(`diagram.toolbar.fit`),()=>Y(`diagram.toolbar.debug`),()=>Y(`diagram.toolbar.export_drawio`),()=>Y(`diagram.toolbar.save`),()=>Y(`diagram.sidebar.title`),()=>Y(`diagram.sidebar.new_btn`),()=>Y(`diagram.selection.rotate_shape`),()=>Y(`diagram.selection.rotate_text`),()=>Y(`diagram.evidence.panel_title`),()=>Y(`diagram.evidence.close`),()=>Y(`diagram.node_panel.lock`),()=>Y(`diagram.node_panel.color`),()=>Y(`diagram.node_panel.bg_opacity`),()=>Y(`diagram.node_panel.edit_label`),()=>Y(`diagram.node_panel.edit_link`),()=>Y(`diagram.node_panel.font_decrease`),()=>Y(`diagram.node_panel.font_size_value`),()=>Y(`diagram.node_panel.font_increase`),()=>Y(`diagram.node_panel.align_left`),()=>Y(`diagram.node_panel.align_center`),()=>Y(`diagram.node_panel.align_right`),()=>Y(`diagram.node_panel.align_top`),()=>Y(`diagram.node_panel.align_middle`),()=>Y(`diagram.node_panel.align_bottom`),()=>Y(`diagram.node_panel.custom_label_above`),()=>Y(`diagram.node_panel.custom_label_below`),()=>Y(`diagram.node_panel.custom_label_left`),()=>Y(`diagram.node_panel.custom_label_right`),()=>Y(`diagram.node_panel.custom_label_center`),()=>Y(`diagram.node_panel.send_back`),()=>Y(`diagram.node_panel.bring_front`),()=>Y(`diagram.node_panel.stamp_color`),()=>Y(`diagram.node_panel.stamp_font`),()=>Y(`diagram.node_panel.stamp_size`),()=>Y(`diagram.node_panel.rotate_ccw`),()=>Y(`diagram.node_panel.rotate_cw`),()=>Y(`diagram.node_panel.copy_png`),()=>Y(`diagram.node_panel.group`),()=>Y(`diagram.node_panel.ungroup`),()=>Y(`diagram.node_panel.save_as_default`),()=>Y(`diagram.link_panel.title`),()=>Y(`diagram.link_panel.external`),()=>Y(`diagram.link_panel.url_placeholder`),()=>Y(`diagram.link_panel.existing_diagram`),()=>Y(`diagram.link_panel.new_diagram`),()=>Y(`diagram.link_panel.diagram_name_placeholder`),()=>Y(`diagram.link_panel.save_btn`),()=>Y(`diagram.link_panel.remove_btn`),()=>Y(`diagram.edge_panel.lock`),()=>Y(`diagram.edge_panel.no_arrow`),()=>Y(`diagram.edge_panel.arrow_from`),()=>Y(`diagram.edge_panel.arrow_to`),()=>Y(`diagram.edge_panel.arrow_both`),()=>Y(`diagram.edge_panel.solid`),()=>Y(`diagram.edge_panel.dashed`),()=>Y(`diagram.edge_panel.font_decrease`),()=>Y(`diagram.edge_panel.font_size_value`),()=>Y(`diagram.edge_panel.font_increase`),()=>Y(`diagram.edge_panel.edit_label`),()=>Y(`diagram.edge_panel.reset_label_width`),()=>Y(`diagram.edge_panel.rotate_label_ccw`),()=>Y(`diagram.edge_panel.rotate_label_cw`),()=>Y(`diagram.edge_panel.offset_label_left`),()=>Y(`diagram.edge_panel.offset_label_right`),()=>Y(`diagram.edge_panel.offset_label_up`),()=>Y(`diagram.edge_panel.offset_label_down`),()=>Y(`diagram.edge_panel.offset_label_reset`),()=>Y(`diagram.edge_panel.width_decrease`),()=>Y(`diagram.edge_panel.width_increase`),()=>Y(`diagram.edge_panel.color`),()=>Y(`diagram.edge_panel.clear_ports`),()=>Y(`diagram.edge_panel.save_as_default`),()=>Y(`diagram.label_input.placeholder`),()=>Y(`diagram.empty_state`),()=>Y(`diagram.image_modal.title`),()=>Y(`diagram.image_modal.placeholder`),()=>Y(`diagram.image_modal.error_chars`),()=>Y(`diagram.image_modal.cancel_btn`),()=>Y(`diagram.image_modal.paste_btn`)]),H(`click`,s,()=>history.back()),H(`mousedown`,me,i),W(e,a),Je()}Pr([`click`,`mousedown`]);var hT=U(`<span class="legend-item svelte-1bqlvrg"><span class="legend-dot svelte-1bqlvrg"></span> </span>`),gT=U(`<p class="graph-msg svelte-1bqlvrg"> </p>`),_T=U(`<p class="graph-msg graph-error svelte-1bqlvrg"> </p>`),vT=U(`<div class="graph-page svelte-1bqlvrg"><!> <div class="graph-toolbar svelte-1bqlvrg"><span class="graph-counts svelte-1bqlvrg"> </span> <div class="graph-legend svelte-1bqlvrg"></div></div> <div class="graph-canvas-wrap svelte-1bqlvrg"><!> <div class="graph-canvas svelte-1bqlvrg"></div></div></div>`);function yT(e,t){qe(t,!0);let n={ADR:`#3b82f6`,Worklog:`#22c55e`,Rule:`#f97316`,"Technical Doc":`#a855f7`,Document:`#64748b`,Concept:`#14b8a6`},r,i=P(!0),a=P(``),o=P(I({nodes:0,edges:0})),s=P(I([]));function c(e){return n[e]??`#94a3b8`}Ji(()=>{let e;return(async()=>{let t=`en`;try{t=(await fetch(`/api/config`).then(e=>e.json())).language||`en`}catch{}await Ca(t);try{let t=await fetch(`/api/graph`);if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();F(o,{nodes:n.nodes.length,edges:n.edges.length},!0),F(s,[...new Set(n.nodes.map(e=>e.type))].sort().map(e=>({type:e,color:c(e)})),!0);let i=window.vis;if(!i)throw Error(Y(`graph.renderer_error`));let a=new i.DataSet(n.nodes.map(e=>({id:e.id,label:e.title,title:e.folder?`${e.folder} · ${e.type}`:e.type,color:{background:c(e.type),border:`rgba(100,116,139,0.9)`},shape:`dot`,size:12}))),l=new i.DataSet(n.edges.map((e,t)=>({id:t,from:e.from,to:e.to}))),u=getComputedStyle(document.body).color||`#334155`;e=new i.Network(r,{nodes:a,edges:l},{nodes:{font:{color:u,size:13,face:`inherit`},borderWidth:1.5},edges:{arrows:{to:{enabled:!0,scaleFactor:.5}},color:{color:`rgba(148,163,184,0.55)`,highlight:`#3b82f6`},smooth:{enabled:!0,type:`continuous`,roundness:.4},width:1},physics:{solver:`forceAtlas2Based`,forceAtlas2Based:{gravitationalConstant:-45,springLength:120,avoidOverlap:.6},stabilization:{iterations:250}},interaction:{hover:!0,tooltipDelay:150,navigationButtons:!1}}),e.on(`click`,e=>{e.nodes&&e.nodes.length>0&&(window.location.href=`/?doc=`+encodeURIComponent(e.nodes[0]))})}catch(e){F(a,e.message,!0)}finally{F(i,!1)}})(),()=>e?.destroy?.()});var l=vT(),u=L(l);{let e=N(()=>Y(`graph.title`)||`Concept graph`);es(u,{get title(){return V(e)},subtitle:``})}var d=z(u,2),f=L(d),p=L(f);j(f);var m=z(f,2);q(m,21,()=>V(s),e=>e.type,(e,t)=>{var n=hT(),r=L(n),i=z(r,1,!0);j(n),B(()=>{bi(r,`background:${V(t).color??``}`),G(i,V(t).type)}),W(e,n)}),j(m),j(d);var h=z(d,2),g=L(h),_=e=>{var t=gT(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`graph.loading`)||`Loading graph…`]),W(e,t)},v=e=>{var t=_T(),n=L(t,!0);j(t),B(()=>G(n,V(a))),W(e,t)},y=e=>{var t=gT(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`graph.empty`)||`No concepts to graph yet.`]),W(e,t)};K(g,e=>{V(i)?e(_):V(a)?e(v,1):V(o).nodes===0&&e(y,2)}),Ui(z(g,2),e=>r=e,()=>r),j(h),j(l),B(()=>G(p,`${V(o).nodes??``} · ${V(o).edges??``}`)),W(e,l),Je()}We();var bT={network:null,nodes:null,edges:null,diagrams:[],currentDiagramId:null,currentTool:`select`,pendingShape:`box`,selectedNodeIds:[],selectedEdgeIds:[],alignGuides:!0,gridEnabled:!0,debugMode:!1,isDirty:!1,sidebarOpen:!0,editingNodeId:null,editingEdgeId:null,resizeDrag:null,rotateDrag:null,labelRotateDrag:null,activeStamp:null,stampTargetIds:[],clipboard:null,canonicalOrder:[],edgesStraight:!1,resizeSymmetric:!1,nodeColorOverrides:{},customShapeLibraries:[],customShapeDefs:new Map,edgeLabelCanvasPos:{},edgeLabelBBox:{},freeArrowFirstPoint:null,exportingPng:!1,evidenceMode:!1};function xT(){bT.isDirty=!0,document.getElementById(`btnSave`).disabled=!1}var ST=`custom-shape`,CT=`custom-shape:`,wT=[{id:`N`,x:.5,y:0},{id:`NE`,x:1,y:0},{id:`E`,x:1,y:.5},{id:`SE`,x:1,y:1},{id:`S`,x:.5,y:1},{id:`SW`,x:0,y:1},{id:`W`,x:0,y:.5},{id:`NW`,x:0,y:0}];function TT(e){return typeof e==`string`&&e.startsWith(`custom-shape:`)}function ET(e){return TT(e)?e.slice(13):null}function DT(e){return e&&bT.customShapeDefs&&bT.customShapeDefs.get(e)||null}function OT(e){let t=DT(e);return[t&&t.width||65,t&&t.height||65]}function kT(e){let t=DT(e);return t&&Array.isArray(t.anchors)&&t.anchors.length?t.anchors:wT}function AT(e){let t=DT(e);return t&&[`center`,`below`,`above`,`right`,`left`].includes(t.labelPlacement)?t.labelPlacement:`below`}async function jT(){try{let e=await fetch(`/api/shape-libraries`);if(!e.ok)throw Error(`shape libraries unavailable`);let t=await e.json(),n=Array.isArray(t.libraries)?t.libraries:[];bT.customShapeLibraries=n,bT.customShapeDefs=new Map,n.forEach(e=>{(e.shapes||[]).forEach(e=>bT.customShapeDefs.set(e.id,e))})}catch{bT.customShapeLibraries=[],bT.customShapeDefs=new Map}}function MT(){let e=document.getElementById(`customShapeBar`),t=document.getElementById(`customShapeBarBody`);if(!e||!t)return;t.innerHTML=``;let n=(bT.customShapeLibraries||[]).flatMap(e=>(e.shapes||[]).filter(e=>e.showInDiagram!==!1).map(t=>({...t,libraryName:e.name})));e.classList.toggle(`hidden`,n.length===0),n.forEach(e=>{let n=document.createElement(`button`);n.type=`button`,n.className=`custom-shape-btn`,n.title=`${e.libraryName||``}${e.libraryName?` · `:``}${e.name}`,n.dataset.customShapeId=e.id;let r=document.createElement(`img`);r.src=e.imageSrc,r.alt=``,r.draggable=!1,n.appendChild(r),n.addEventListener(`click`,()=>{window.dispatchEvent(new CustomEvent(`diagram:setTool`,{detail:{tool:`addNode`,shape:`${CT}${e.id}`}}))}),t.appendChild(n)})}function NT(){let e={saveState:document.getElementById(`saveState`),librarySelect:document.getElementById(`librarySelect`),libraryName:document.getElementById(`libraryName`),shapeList:document.getElementById(`shapeList`),previewStage:document.getElementById(`previewStage`),previewImage:document.getElementById(`previewImage`),shapeName:document.getElementById(`shapeName`),imageFile:document.getElementById(`imageFile`),shapeWidth:document.getElementById(`shapeWidth`),shapeHeight:document.getElementById(`shapeHeight`),labelPlacement:document.getElementById(`labelPlacement`),shapeShowInDiagram:document.getElementById(`shapeShowInDiagram`),anchorList:document.getElementById(`anchorList`),anchorCount:document.getElementById(`anchorCount`)},t={libraries:[]},n=null,r=null,i=null,a=null,o=e=>`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,s=()=>t.libraries.find(e=>e.id===n)||null,c=()=>s()?.shapes.find(e=>e.id===r)||null,l=e=>Math.max(0,Math.min(1,e)),u=e=>[`below`,`above`,`right`,`left`,`center`].includes(e)?e:`below`,d=e=>String(e??``).replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e]);function f(t){e.saveState.textContent=t,t&&setTimeout(()=>{e.saveState.textContent===t&&(e.saveState.textContent=``)},1800)}async function p(){t=await(await fetch(`/api/shape-libraries`)).json(),Array.isArray(t.libraries)||(t.libraries=[]),t.libraries.length||t.libraries.push({id:o(`lib`),name:`My shapes`,shapes:[]}),n=t.libraries[0].id,r=t.libraries[0].shapes[0]?.id||null,i=c()?structuredClone(c()):h(),g()}async function m(){t=await(await fetch(`/api/shape-libraries`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)})).json(),f(`Saved`)}function h(){return{id:o(`shape`),name:`New shape`,imageSrc:``,width:65,height:65,labelPlacement:`below`,showInDiagram:!0,anchors:structuredClone(wT)}}function g(){_(),v(),y()}function _(){e.librarySelect.innerHTML=``,t.libraries.forEach(t=>{let r=document.createElement(`option`);r.value=t.id,r.textContent=t.name,r.selected=t.id===n,e.librarySelect.appendChild(r)}),e.libraryName.value=s()?.name||``}function v(){let t=s();e.shapeList.innerHTML=``,(t?.shapes||[]).forEach(t=>{let n=document.createElement(`button`);n.type=`button`,n.className=`shape-item w-full flex items-center gap-2 px-2 py-1.5 rounded text-sm text-left hover:bg-gray-100 ${t.id===r?`active`:``}`;let a=document.createElement(`img`);a.src=t.imageSrc,a.alt=``,a.className=`w-6 h-6 object-contain shrink-0`;let o=document.createElement(`span`);o.className=`truncate`,o.textContent=t.name,n.append(a,o),n.addEventListener(`click`,()=>{r=t.id,i=structuredClone(t),g()}),e.shapeList.appendChild(n)}),t?.shapes?.length||(e.shapeList.innerHTML=`<p class="text-xs text-gray-400 px-2 py-2">No shape yet.</p>`)}function y(){i||=h(),e.previewStage.style.aspectRatio=`${Math.max(16,Number(i.width)||65)} / ${Math.max(16,Number(i.height)||65)}`,e.previewImage.src=i.imageSrc||``,e.previewImage.style.display=i.imageSrc?`block`:`none`,e.shapeName.value=i.name||``,e.shapeWidth.value=i.width||65,e.shapeHeight.value=i.height||65,e.labelPlacement.value=u(i.labelPlacement),e.shapeShowInDiagram.checked=i.showInDiagram!==!1,b()}function b(){e.previewStage.querySelectorAll(`.anchor-dot`).forEach(e=>e.remove()),e.anchorList.innerHTML=``;let t=i.anchors||[];e.anchorCount.textContent=`${t.length} anchor${t.length>1?`s`:``}`,t.forEach((t,n)=>{let r=document.createElement(`button`);r.type=`button`,r.className=`anchor-dot`,r.style.left=`${t.x*100}%`,r.style.top=`${t.y*100}%`,r.dataset.anchorId=t.id,r.innerHTML=`<span>${t.id}</span>`,r.addEventListener(`pointerdown`,e=>{e.preventDefault(),a=t.id,r.setPointerCapture(e.pointerId)}),e.previewStage.appendChild(r);let o=document.createElement(`div`);o.className=`grid grid-cols-[4.5rem_1fr_1fr_2rem] gap-2 items-center`,o.innerHTML=`
|
|
281
|
+
text-gray-600 dark:text-gray-300 hover:bg-gray-100 dark:hover:bg-gray-700"> </button> <button id="imageNameConfirm" class="px-3 py-1 text-xs rounded bg-blue-500 text-white hover:bg-blue-600"> </button></div></div></div></div>`);function wT(e,t){qe(t,!0),Ji(()=>{let e;return(async()=>{let t=`en`;try{t=(await fetch(`/api/config`).then(e=>e.json())).language||`en`}catch{}await Ca(t);let{initDiagram:r}=await ST(async()=>{let{initDiagram:e}=await import(`./main-CRJRAz1a.js`);return{initDiagram:e}},[]);e=r();let i=document.getElementById(`sidebar`),a=parseInt(localStorage.getItem(n)||``,10);i&&Number.isFinite(a)&&(i.style.width=a+`px`)})(),()=>e?.()});let n=`ld-diagram-sidebar-w`,r=P(!1);function i(e){e.preventDefault();let t=document.getElementById(`sidebar`);if(!t)return;let i=e.clientX,a=t.getBoundingClientRect().width;F(r,!0),t.style.transition=`none`,document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let o=e=>{let n=Math.max(160,Math.min(480,a+e.clientX-i));t.style.width=n+`px`},s=()=>{document.removeEventListener(`mousemove`,o),document.removeEventListener(`mouseup`,s),document.body.style.cursor=``,document.body.style.userSelect=``,F(r,!1),t.style.transition=``;try{localStorage.setItem(n,String(parseInt(t.style.width,10)))}catch{}};document.addEventListener(`mousemove`,o),document.addEventListener(`mouseup`,s)}var a=CT(),o=L(a),s=L(o),c=L(s,!0);j(s);var l=z(s,4),u=z(l,4),d=z(u,2),f=z(d,4),p=z(f,2),m=z(p,2),h=z(m,2),g=z(h,2),_=z(g,2),v=z(_,2),y=z(v,2),b=z(y,2),x=z(b,4),S=z(x,4),C=z(S,4),w=z(C,2),T=z(w,2),E=z(T,2),D=z(E,2),ee=z(D,2),te=z(ee,4),O=z(te,4),ne=z(O,4),k=z(ne,2),A=z(k,8),re=z(A,4),ie=z(re,4),ae=L(ie),oe=L(ae,!0);j(ae),j(ie),j(o);var se=z(o,2),ce=L(se),le=L(ce),ue=L(le),de=L(ue,!0);j(ue);var fe=z(ue,2),pe=L(fe,!0);j(fe),j(le),Ie(2),j(ce);var me=z(ce,2),he=z(me,2),ge=z(L(he),10),_e=z(L(ge),8),ve=z(_e,2);j(ge);var ye=z(ge,2),be=L(ye),xe=L(be),Se=L(xe,!0);j(xe);var Ce=z(xe,2);j(be),Ie(2),j(ye);var we=z(ye,2),Te=L(we),Ee=z(Te,4),De=L(Ee),Oe=z(De,4),ke=z(Oe,4),Ae=z(ke,2),je=z(Ae,4),Me=z(je,2),Ne=z(Me,2),Pe=z(Ne,4),Fe=z(Pe,2),Le=z(Fe,2),Re=z(Le,4),ze=z(Re,2),Be=z(ze,2),Ve=z(Be,4),He=L(Ve),Ue=z(He,2),We=z(Ue,2),Ge=z(We,2),Ke=z(Ge,2);Ie(2),j(Ve);var Ye=z(Ve,2),Xe=z(Ye,2),Ze=z(Xe,4),Qe=z(Ze,2),$e=z(Qe,2),et=z($e,4),tt=z(et,2),nt=z(tt,4),rt=z(nt,4),it=z(rt,2),at=z(it,4);j(Ee),j(we);var ot=z(we,2),st=L(ot),ct=L(st,!0);j(st);var lt=z(st,2),ut=z(L(lt),2),dt=L(ut,!0);j(ut),j(lt);var ft=z(lt,2),M=L(ft);j(ft);var pt=z(ft,2),mt=z(L(pt),2),ht=L(mt,!0);j(mt),j(pt);var gt=z(pt,4),_t=z(L(gt),2),vt=L(_t,!0);j(_t),j(gt);var yt=z(gt,2),N=L(yt);j(yt);var bt=z(yt,2),xt=L(bt),St=L(xt,!0);j(xt);var Ct=z(xt,2),wt=L(Ct,!0);j(Ct),Ie(2),j(bt),j(ot);var Tt=z(ot,2),Et=L(Tt),Dt=z(Et,4),Ot=L(Dt),kt=z(Ot,2),At=z(kt,2),jt=z(At,2),Mt=z(jt,4),Nt=z(Mt,2),Pt=z(Nt,4),Ft=z(Pt,2),It=z(Ft,2),Lt=z(It,4),Rt=z(Lt,2),zt=z(Rt,4),Bt=z(zt,2),Vt=z(Bt,4),Ht=z(Vt,2),Ut=z(Ht,2),Wt=z(Ut,2),Gt=z(Wt,2),Kt=z(Gt,4),qt=z(Kt,2),Jt=z(qt,4),Yt=z(Jt,4),Xt=z(Yt,4);j(Dt),j(Tt);var Zt=z(Tt,2),Qt=z(Zt,2),$t=z(L(Qt),2),en=L($t,!0);j($t),j(Qt),j(he),j(se);var tn=z(se,4),nn=L(tn),I=L(nn),rn=L(I,!0);j(I);var an=z(I,4),on=L(an);Ie(2),j(an);var sn=z(an,2),cn=L(sn,!0);j(sn);var ln=z(sn,2),un=L(ln),dn=L(un,!0);j(un);var fn=z(un,2),pn=L(fn,!0);j(fn),j(ln),j(nn),j(tn),j(a),B((e,t,n,i,a,o,s,ie,ae,se,ce,le,ue,fe,he,ge,ye,be,xe,we,Ee,j,Ie,Ve,qe,Je,ot,st,lt,ut,ft,pt,mt,gt,_t,yt,bt,xt,Ct,Tt,Dt,P,Qt,F,$t,tn,nn,I,an,sn,ln,un,fn,L,R,z,mn,hn,gn,_n,vn,yn,bn,xn,Sn,Cn,wn,Tn,En,Dn,On,kn,An,jn,Mn,Nn,Pn,Fn,B,In,Ln,Rn,zn,Bn,Vn,Hn,Un,Wn,Gn,Kn,qn,Jn,Yn,Xn,Zn,Qn,$n,er,tr,nr,rr,ir,ar)=>{G(c,e),J(l,`title`,t),J(u,`title`,n),J(d,`title`,i),J(f,`title`,a),J(p,`title`,o),J(m,`title`,s),J(h,`title`,ie),J(g,`title`,ae),J(_,`title`,se),J(v,`title`,ce),J(y,`title`,le),J(b,`title`,ue),J(x,`title`,fe),J(S,`title`,he),J(C,`title`,ge),J(w,`title`,ye),J(T,`title`,be),J(E,`title`,xe),J(D,`title`,we),J(ee,`title`,Ee),J(te,`placeholder`,j),J(O,`title`,Ie),J(ne,`title`,Ve),J(k,`title`,qe),J(A,`title`,Je),J(re,`title`,ot),G(oe,st),G(de,lt),G(pe,ut),vi(me,1,`w-1 shrink-0 cursor-col-resize select-none transition-colors ${V(r)?`bg-blue-500/60`:`bg-transparent hover:bg-blue-500/40`}`),J(_e,`title`,ft),J(ve,`title`,pt),G(Se,mt),J(Ce,`title`,gt),J(Te,`title`,_t),J(De,`title`,yt),J(Oe,`title`,bt),J(ke,`title`,xt),J(Ae,`title`,Ct),J(je,`title`,Tt),J(Me,`title`,Dt),J(Ne,`title`,P),J(Pe,`title`,Qt),J(Fe,`title`,F),J(Le,`title`,$t),J(Re,`title`,tn),J(ze,`title`,nn),J(Be,`title`,I),J(He,`title`,an),J(Ue,`title`,sn),J(We,`title`,ln),J(Ge,`title`,un),J(Ke,`title`,fn),J(Ye,`title`,L),J(Xe,`title`,R),J(Ze,`title`,z),J(Qe,`title`,mn),J($e,`title`,hn),J(et,`title`,gn),J(tt,`title`,_n),J(nt,`title`,vn),J(rt,`title`,yn),J(it,`title`,bn),J(at,`title`,xn),G(ct,Sn),G(dt,Cn),J(M,`placeholder`,wn),G(ht,Tn),G(vt,En),J(N,`placeholder`,Dn),G(St,On),G(wt,kn),J(Et,`title`,An),J(Ot,`title`,jn),J(kt,`title`,Mn),J(At,`title`,Nn),J(jt,`title`,Pn),J(Mt,`title`,Fn),J(Nt,`title`,B),J(Pt,`title`,In),J(Ft,`title`,Ln),J(It,`title`,Rn),J(Lt,`title`,zn),J(Rt,`title`,Bn),J(zt,`title`,Vn),J(Bt,`title`,Hn),J(Vt,`title`,Un),J(Ht,`title`,Wn),J(Ut,`title`,Gn),J(Wt,`title`,Kn),J(Gt,`title`,qn),J(Kt,`title`,Jn),J(qt,`title`,Yn),J(Jt,`title`,Xn),J(Yt,`title`,Zn),J(Xt,`title`,Qn),J(Zt,`placeholder`,$n),G(en,er),G(rn,tr),J(on,`placeholder`,nr),G(cn,rr),G(dn,ir),G(pn,ar)},[()=>Y(`diagram.back_btn`),()=>Y(`diagram.diagrams_list_title`),()=>Y(`diagram.toolbar.copy_mcp_id`),()=>Y(`diagram.toolbar.select`),()=>Y(`diagram.toolbar.box`),()=>Y(`diagram.toolbar.ellipse`),()=>Y(`diagram.toolbar.database`),()=>Y(`diagram.toolbar.circle`),()=>Y(`diagram.toolbar.actor`),()=>Y(`diagram.toolbar.postit`),()=>Y(`diagram.toolbar.text_free`),()=>Y(`diagram.toolbar.image`),()=>Y(`diagram.toolbar.shape_editor`),()=>Y(`diagram.toolbar.arrow`),()=>Y(`diagram.toolbar.delete`),()=>Y(`diagram.toolbar.defaults`),()=>Y(`diagram.toolbar.align_guides`),()=>Y(`diagram.toolbar.grid`),()=>Y(`diagram.toolbar.edge_style`),()=>Y(`diagram.toolbar.evidence_mode`),()=>Y(`diagram.toolbar.resize_corner`),()=>Y(`diagram.toolbar.title_placeholder`),()=>Y(`diagram.toolbar.zoom_out`),()=>Y(`diagram.toolbar.zoom_in`),()=>Y(`diagram.toolbar.fit`),()=>Y(`diagram.toolbar.debug`),()=>Y(`diagram.toolbar.export_drawio`),()=>Y(`diagram.toolbar.save`),()=>Y(`diagram.sidebar.title`),()=>Y(`diagram.sidebar.new_btn`),()=>Y(`diagram.selection.rotate_shape`),()=>Y(`diagram.selection.rotate_text`),()=>Y(`diagram.evidence.panel_title`),()=>Y(`diagram.evidence.close`),()=>Y(`diagram.node_panel.lock`),()=>Y(`diagram.node_panel.color`),()=>Y(`diagram.node_panel.bg_opacity`),()=>Y(`diagram.node_panel.edit_label`),()=>Y(`diagram.node_panel.edit_link`),()=>Y(`diagram.node_panel.font_decrease`),()=>Y(`diagram.node_panel.font_size_value`),()=>Y(`diagram.node_panel.font_increase`),()=>Y(`diagram.node_panel.align_left`),()=>Y(`diagram.node_panel.align_center`),()=>Y(`diagram.node_panel.align_right`),()=>Y(`diagram.node_panel.align_top`),()=>Y(`diagram.node_panel.align_middle`),()=>Y(`diagram.node_panel.align_bottom`),()=>Y(`diagram.node_panel.custom_label_above`),()=>Y(`diagram.node_panel.custom_label_below`),()=>Y(`diagram.node_panel.custom_label_left`),()=>Y(`diagram.node_panel.custom_label_right`),()=>Y(`diagram.node_panel.custom_label_center`),()=>Y(`diagram.node_panel.send_back`),()=>Y(`diagram.node_panel.bring_front`),()=>Y(`diagram.node_panel.stamp_color`),()=>Y(`diagram.node_panel.stamp_font`),()=>Y(`diagram.node_panel.stamp_size`),()=>Y(`diagram.node_panel.rotate_ccw`),()=>Y(`diagram.node_panel.rotate_cw`),()=>Y(`diagram.node_panel.copy_png`),()=>Y(`diagram.node_panel.group`),()=>Y(`diagram.node_panel.ungroup`),()=>Y(`diagram.node_panel.save_as_default`),()=>Y(`diagram.link_panel.title`),()=>Y(`diagram.link_panel.external`),()=>Y(`diagram.link_panel.url_placeholder`),()=>Y(`diagram.link_panel.existing_diagram`),()=>Y(`diagram.link_panel.new_diagram`),()=>Y(`diagram.link_panel.diagram_name_placeholder`),()=>Y(`diagram.link_panel.save_btn`),()=>Y(`diagram.link_panel.remove_btn`),()=>Y(`diagram.edge_panel.lock`),()=>Y(`diagram.edge_panel.no_arrow`),()=>Y(`diagram.edge_panel.arrow_from`),()=>Y(`diagram.edge_panel.arrow_to`),()=>Y(`diagram.edge_panel.arrow_both`),()=>Y(`diagram.edge_panel.solid`),()=>Y(`diagram.edge_panel.dashed`),()=>Y(`diagram.edge_panel.font_decrease`),()=>Y(`diagram.edge_panel.font_size_value`),()=>Y(`diagram.edge_panel.font_increase`),()=>Y(`diagram.edge_panel.edit_label`),()=>Y(`diagram.edge_panel.reset_label_width`),()=>Y(`diagram.edge_panel.rotate_label_ccw`),()=>Y(`diagram.edge_panel.rotate_label_cw`),()=>Y(`diagram.edge_panel.offset_label_left`),()=>Y(`diagram.edge_panel.offset_label_right`),()=>Y(`diagram.edge_panel.offset_label_up`),()=>Y(`diagram.edge_panel.offset_label_down`),()=>Y(`diagram.edge_panel.offset_label_reset`),()=>Y(`diagram.edge_panel.width_decrease`),()=>Y(`diagram.edge_panel.width_increase`),()=>Y(`diagram.edge_panel.color`),()=>Y(`diagram.edge_panel.clear_ports`),()=>Y(`diagram.edge_panel.save_as_default`),()=>Y(`diagram.label_input.placeholder`),()=>Y(`diagram.empty_state`),()=>Y(`diagram.image_modal.title`),()=>Y(`diagram.image_modal.placeholder`),()=>Y(`diagram.image_modal.error_chars`),()=>Y(`diagram.image_modal.cancel_btn`),()=>Y(`diagram.image_modal.paste_btn`)]),H(`click`,s,()=>history.back()),H(`mousedown`,me,i),W(e,a),Je()}Pr([`click`,`mousedown`]);var TT=U(`<span class="legend-item svelte-1bqlvrg"><span class="legend-dot svelte-1bqlvrg"></span> </span>`),ET=U(`<p class="graph-msg svelte-1bqlvrg"> </p>`),DT=U(`<p class="graph-msg graph-error svelte-1bqlvrg"> </p>`),OT=U(`<div class="graph-page svelte-1bqlvrg"><!> <div class="graph-toolbar svelte-1bqlvrg"><span class="graph-counts svelte-1bqlvrg"> </span> <div class="graph-legend svelte-1bqlvrg"></div></div> <div class="graph-canvas-wrap svelte-1bqlvrg"><!> <div class="graph-canvas svelte-1bqlvrg"></div></div></div>`);function kT(e,t){qe(t,!0);let n={ADR:`#3b82f6`,Worklog:`#22c55e`,Rule:`#f97316`,"Technical Doc":`#a855f7`,Document:`#64748b`,Concept:`#14b8a6`},r,i=P(!0),a=P(``),o=P(I({nodes:0,edges:0})),s=P(I([]));function c(e){return n[e]??`#94a3b8`}Ji(()=>{let e;return(async()=>{let t=`en`;try{t=(await fetch(`/api/config`).then(e=>e.json())).language||`en`}catch{}await Ca(t);try{let t=await fetch(`/api/graph`);if(!t.ok)throw Error(`HTTP ${t.status}`);let n=await t.json();F(o,{nodes:n.nodes.length,edges:n.edges.length},!0),F(s,[...new Set(n.nodes.map(e=>e.type))].sort().map(e=>({type:e,color:c(e)})),!0);let i=window.vis;if(!i)throw Error(Y(`graph.renderer_error`));let a=new i.DataSet(n.nodes.map(e=>({id:e.id,label:e.title,title:e.folder?`${e.folder} · ${e.type}`:e.type,color:{background:c(e.type),border:`rgba(100,116,139,0.9)`},shape:`dot`,size:12}))),l=new i.DataSet(n.edges.map((e,t)=>({id:t,from:e.from,to:e.to}))),u=getComputedStyle(document.body).color||`#334155`;e=new i.Network(r,{nodes:a,edges:l},{nodes:{font:{color:u,size:13,face:`inherit`},borderWidth:1.5},edges:{arrows:{to:{enabled:!0,scaleFactor:.5}},color:{color:`rgba(148,163,184,0.55)`,highlight:`#3b82f6`},smooth:{enabled:!0,type:`continuous`,roundness:.4},width:1},physics:{solver:`forceAtlas2Based`,forceAtlas2Based:{gravitationalConstant:-45,springLength:120,avoidOverlap:.6},stabilization:{iterations:250}},interaction:{hover:!0,tooltipDelay:150,navigationButtons:!1}}),e.on(`click`,e=>{e.nodes&&e.nodes.length>0&&(window.location.href=`/?doc=`+encodeURIComponent(e.nodes[0]))})}catch(e){F(a,e.message,!0)}finally{F(i,!1)}})(),()=>e?.destroy?.()});var l=OT(),u=L(l);{let e=N(()=>Y(`graph.title`)||`Concept graph`);es(u,{get title(){return V(e)},subtitle:``})}var d=z(u,2),f=L(d),p=L(f);j(f);var m=z(f,2);q(m,21,()=>V(s),e=>e.type,(e,t)=>{var n=TT(),r=L(n),i=z(r,1,!0);j(n),B(()=>{bi(r,`background:${V(t).color??``}`),G(i,V(t).type)}),W(e,n)}),j(m),j(d);var h=z(d,2),g=L(h),_=e=>{var t=ET(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`graph.loading`)||`Loading graph…`]),W(e,t)},v=e=>{var t=DT(),n=L(t,!0);j(t),B(()=>G(n,V(a))),W(e,t)},y=e=>{var t=ET(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`graph.empty`)||`No concepts to graph yet.`]),W(e,t)};K(g,e=>{V(i)?e(_):V(a)?e(v,1):V(o).nodes===0&&e(y,2)}),Ui(z(g,2),e=>r=e,()=>r),j(h),j(l),B(()=>G(p,`${V(o).nodes??``} · ${V(o).edges??``}`)),W(e,l),Je()}We();var AT={network:null,nodes:null,edges:null,diagrams:[],currentDiagramId:null,currentTool:`select`,pendingShape:`box`,selectedNodeIds:[],selectedEdgeIds:[],alignGuides:!0,gridEnabled:!0,debugMode:!1,isDirty:!1,sidebarOpen:!0,editingNodeId:null,editingEdgeId:null,resizeDrag:null,rotateDrag:null,labelRotateDrag:null,activeStamp:null,stampTargetIds:[],clipboard:null,canonicalOrder:[],edgesStraight:!1,resizeSymmetric:!1,nodeColorOverrides:{},customShapeLibraries:[],customShapeDefs:new Map,edgeLabelCanvasPos:{},edgeLabelBBox:{},freeArrowFirstPoint:null,exportingPng:!1,evidenceMode:!1};function jT(){AT.isDirty=!0,document.getElementById(`btnSave`).disabled=!1}var MT=`custom-shape`,NT=`custom-shape:`,PT=[{id:`N`,x:.5,y:0},{id:`NE`,x:1,y:0},{id:`E`,x:1,y:.5},{id:`SE`,x:1,y:1},{id:`S`,x:.5,y:1},{id:`SW`,x:0,y:1},{id:`W`,x:0,y:.5},{id:`NW`,x:0,y:0}];function FT(e){return typeof e==`string`&&e.startsWith(`custom-shape:`)}function IT(e){return FT(e)?e.slice(13):null}function LT(e){return e&&AT.customShapeDefs&&AT.customShapeDefs.get(e)||null}function RT(e){let t=LT(e);return[t&&t.width||65,t&&t.height||65]}function zT(e){let t=LT(e);return t&&Array.isArray(t.anchors)&&t.anchors.length?t.anchors:PT}function BT(e){let t=LT(e);return t&&[`center`,`below`,`above`,`right`,`left`].includes(t.labelPlacement)?t.labelPlacement:`below`}async function VT(){try{let e=await fetch(`/api/shape-libraries`);if(!e.ok)throw Error(`shape libraries unavailable`);let t=await e.json(),n=Array.isArray(t.libraries)?t.libraries:[];AT.customShapeLibraries=n,AT.customShapeDefs=new Map,n.forEach(e=>{(e.shapes||[]).forEach(e=>AT.customShapeDefs.set(e.id,e))})}catch{AT.customShapeLibraries=[],AT.customShapeDefs=new Map}}function HT(){let e=document.getElementById(`customShapeBar`),t=document.getElementById(`customShapeBarBody`);if(!e||!t)return;t.innerHTML=``;let n=(AT.customShapeLibraries||[]).flatMap(e=>(e.shapes||[]).filter(e=>e.showInDiagram!==!1).map(t=>({...t,libraryName:e.name})));e.classList.toggle(`hidden`,n.length===0),n.forEach(e=>{let n=document.createElement(`button`);n.type=`button`,n.className=`custom-shape-btn`,n.title=`${e.libraryName||``}${e.libraryName?` · `:``}${e.name}`,n.dataset.customShapeId=e.id;let r=document.createElement(`img`);r.src=e.imageSrc,r.alt=``,r.draggable=!1,n.appendChild(r),n.addEventListener(`click`,()=>{window.dispatchEvent(new CustomEvent(`diagram:setTool`,{detail:{tool:`addNode`,shape:`${NT}${e.id}`}}))}),t.appendChild(n)})}function UT(){let e={saveState:document.getElementById(`saveState`),librarySelect:document.getElementById(`librarySelect`),libraryName:document.getElementById(`libraryName`),shapeList:document.getElementById(`shapeList`),previewStage:document.getElementById(`previewStage`),previewImage:document.getElementById(`previewImage`),shapeName:document.getElementById(`shapeName`),imageFile:document.getElementById(`imageFile`),shapeWidth:document.getElementById(`shapeWidth`),shapeHeight:document.getElementById(`shapeHeight`),labelPlacement:document.getElementById(`labelPlacement`),shapeShowInDiagram:document.getElementById(`shapeShowInDiagram`),anchorList:document.getElementById(`anchorList`),anchorCount:document.getElementById(`anchorCount`)},t={libraries:[]},n=null,r=null,i=null,a=null,o=e=>`${e}-${Date.now().toString(36)}-${Math.random().toString(36).slice(2,6)}`,s=()=>t.libraries.find(e=>e.id===n)||null,c=()=>s()?.shapes.find(e=>e.id===r)||null,l=e=>Math.max(0,Math.min(1,e)),u=e=>[`below`,`above`,`right`,`left`,`center`].includes(e)?e:`below`,d=e=>String(e??``).replace(/[&<>"']/g,e=>({"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`})[e]);function f(t){e.saveState.textContent=t,t&&setTimeout(()=>{e.saveState.textContent===t&&(e.saveState.textContent=``)},1800)}async function p(){t=await(await fetch(`/api/shape-libraries`)).json(),Array.isArray(t.libraries)||(t.libraries=[]),t.libraries.length||t.libraries.push({id:o(`lib`),name:`My shapes`,shapes:[]}),n=t.libraries[0].id,r=t.libraries[0].shapes[0]?.id||null,i=c()?structuredClone(c()):h(),g()}async function m(){t=await(await fetch(`/api/shape-libraries`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify(t)})).json(),f(`Saved`)}function h(){return{id:o(`shape`),name:`New shape`,imageSrc:``,width:65,height:65,labelPlacement:`below`,showInDiagram:!0,anchors:structuredClone(PT)}}function g(){_(),v(),y()}function _(){e.librarySelect.innerHTML=``,t.libraries.forEach(t=>{let r=document.createElement(`option`);r.value=t.id,r.textContent=t.name,r.selected=t.id===n,e.librarySelect.appendChild(r)}),e.libraryName.value=s()?.name||``}function v(){let t=s();e.shapeList.innerHTML=``,(t?.shapes||[]).forEach(t=>{let n=document.createElement(`button`);n.type=`button`,n.className=`shape-item w-full flex items-center gap-2 px-2 py-1.5 rounded text-sm text-left hover:bg-gray-100 ${t.id===r?`active`:``}`;let a=document.createElement(`img`);a.src=t.imageSrc,a.alt=``,a.className=`w-6 h-6 object-contain shrink-0`;let o=document.createElement(`span`);o.className=`truncate`,o.textContent=t.name,n.append(a,o),n.addEventListener(`click`,()=>{r=t.id,i=structuredClone(t),g()}),e.shapeList.appendChild(n)}),t?.shapes?.length||(e.shapeList.innerHTML=`<p class="text-xs text-gray-400 px-2 py-2">No shape yet.</p>`)}function y(){i||=h(),e.previewStage.style.aspectRatio=`${Math.max(16,Number(i.width)||65)} / ${Math.max(16,Number(i.height)||65)}`,e.previewImage.src=i.imageSrc||``,e.previewImage.style.display=i.imageSrc?`block`:`none`,e.shapeName.value=i.name||``,e.shapeWidth.value=i.width||65,e.shapeHeight.value=i.height||65,e.labelPlacement.value=u(i.labelPlacement),e.shapeShowInDiagram.checked=i.showInDiagram!==!1,b()}function b(){e.previewStage.querySelectorAll(`.anchor-dot`).forEach(e=>e.remove()),e.anchorList.innerHTML=``;let t=i.anchors||[];e.anchorCount.textContent=`${t.length} anchor${t.length>1?`s`:``}`,t.forEach((t,n)=>{let r=document.createElement(`button`);r.type=`button`,r.className=`anchor-dot`,r.style.left=`${t.x*100}%`,r.style.top=`${t.y*100}%`,r.dataset.anchorId=t.id,r.innerHTML=`<span>${t.id}</span>`,r.addEventListener(`pointerdown`,e=>{e.preventDefault(),a=t.id,r.setPointerCapture(e.pointerId)}),e.previewStage.appendChild(r);let o=document.createElement(`div`);o.className=`grid grid-cols-[4.5rem_1fr_1fr_2rem] gap-2 items-center`,o.innerHTML=`
|
|
282
282
|
<input class="field !h-7 text-xs" value="${d(t.id)}">
|
|
283
283
|
<input class="field !h-7 text-xs" type="number" min="0" max="100" step="1" value="${Math.round(t.x*100)}">
|
|
284
284
|
<input class="field !h-7 text-xs" type="number" min="0" max="100" step="1" value="${Math.round(t.y*100)}">
|
|
285
285
|
<button class="btn btn-danger !h-7 !px-0">×</button>
|
|
286
|
-
`;let[s,c,u]=o.querySelectorAll(`input`);s.addEventListener(`input`,()=>{t.id=s.value.trim()||`p${n+1}`,b()}),c.addEventListener(`input`,()=>{t.x=l(Number(c.value)/100),b()}),u.addEventListener(`input`,()=>{t.y=l(Number(u.value)/100),b()}),o.querySelector(`button`).addEventListener(`click`,()=>{i.anchors=i.anchors.filter(e=>e!==t),b()}),e.anchorList.appendChild(o)})}function x(t,n){let r=e.previewStage.getBoundingClientRect();t.x=l((n.clientX-r.left)/r.width),t.y=l((n.clientY-r.top)/r.height)}let S=[],C=(e,t,n,r)=>{e.addEventListener(t,n,r),S.push(()=>e.removeEventListener(t,n,r))};return C(e.previewStage,`pointermove`,e=>{if(!a||!i)return;let t=i.anchors.find(e=>e.id===a);t&&(x(t,e),b())}),C(window,`pointerup`,()=>{a=null}),C(e.previewStage,`click`,e=>{if(e.target.closest(`.anchor-dot`)||a||!i)return;let t={id:`p${(i.anchors||[]).length+1}`,x:.5,y:.5};x(t,e),i.anchors=[...i.anchors||[],t],b()}),C(document.getElementById(`btnAddLibrary`),`click`,async()=>{let e={id:o(`lib`),name:`New library`,shapes:[]};t.libraries.push(e),n=e.id,r=null,i=h(),g(),await m()}),C(e.librarySelect,`change`,()=>{n=e.librarySelect.value,r=s()?.shapes[0]?.id||null,i=c()?structuredClone(c()):h(),g()}),C(e.libraryName,`change`,async()=>{let t=s();t&&(t.name=e.libraryName.value.trim()||t.name,_(),await m())}),C(document.getElementById(`btnNewShape`),`click`,()=>{r=null,i=h(),g()}),C(document.getElementById(`btnDeleteShape`),`click`,async()=>{let e=s();!e||!r||(e.shapes=e.shapes.filter(e=>e.id!==r),r=e.shapes[0]?.id||null,i=c()?structuredClone(c()):h(),g(),await m())}),C(document.getElementById(`btnDefaultAnchors`),`click`,()=>{i.anchors=structuredClone(
|
|
287
|
-
position.</p></div> <div class="space-y-4"><div class="grid grid-cols-2 gap-3"><label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Shape name</span> <input id="shapeName" class="field w-full" placeholder="Shape name"/></label> <label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Image / SVG</span> <input id="imageFile" type="file" accept="image/*,.svg" class="block w-full text-sm"/></label> <label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Width</span> <input id="shapeWidth" type="number" min="16" max="1200" class="field w-full"/></label> <label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Height</span> <input id="shapeHeight" type="number" min="16" max="1200" class="field w-full"/></label> <label class="space-y-1 col-span-2"><span class="block text-xs font-semibold text-gray-500">Text placement</span> <select id="labelPlacement" class="field w-full"><option> </option><option> </option><option> </option><option> </option><option> </option></select></label> <label class="col-span-2 flex items-start gap-2 rounded-md border border-gray-200 bg-white px-2 py-2 text-sm"><input id="shapeShowInDiagram" type="checkbox" class="mt-0.5 h-4 w-4 rounded border-gray-300 text-blue-600"/> <span class="space-y-0.5"><span class="block font-semibold text-gray-700"> </span> <span class="block text-xs text-gray-500"> </span></span></label></div> <div class="flex flex-wrap gap-2"><button id="btnDefaultAnchors" class="btn">Use 8 default anchors</button> <button id="btnClearAnchors" class="btn">Clear anchors</button> <button id="btnSaveShape" class="btn btn-primary">Save shape</button></div> <div><div class="flex items-center justify-between mb-2"><h2 class="text-xs font-semibold uppercase tracking-wide text-gray-500">Anchors</h2> <span id="anchorCount" class="text-xs text-gray-500"></span></div> <div id="anchorList" class="space-y-1"></div></div></div></div></section></main></div>`);function
|
|
286
|
+
`;let[s,c,u]=o.querySelectorAll(`input`);s.addEventListener(`input`,()=>{t.id=s.value.trim()||`p${n+1}`,b()}),c.addEventListener(`input`,()=>{t.x=l(Number(c.value)/100),b()}),u.addEventListener(`input`,()=>{t.y=l(Number(u.value)/100),b()}),o.querySelector(`button`).addEventListener(`click`,()=>{i.anchors=i.anchors.filter(e=>e!==t),b()}),e.anchorList.appendChild(o)})}function x(t,n){let r=e.previewStage.getBoundingClientRect();t.x=l((n.clientX-r.left)/r.width),t.y=l((n.clientY-r.top)/r.height)}let S=[],C=(e,t,n,r)=>{e.addEventListener(t,n,r),S.push(()=>e.removeEventListener(t,n,r))};return C(e.previewStage,`pointermove`,e=>{if(!a||!i)return;let t=i.anchors.find(e=>e.id===a);t&&(x(t,e),b())}),C(window,`pointerup`,()=>{a=null}),C(e.previewStage,`click`,e=>{if(e.target.closest(`.anchor-dot`)||a||!i)return;let t={id:`p${(i.anchors||[]).length+1}`,x:.5,y:.5};x(t,e),i.anchors=[...i.anchors||[],t],b()}),C(document.getElementById(`btnAddLibrary`),`click`,async()=>{let e={id:o(`lib`),name:`New library`,shapes:[]};t.libraries.push(e),n=e.id,r=null,i=h(),g(),await m()}),C(e.librarySelect,`change`,()=>{n=e.librarySelect.value,r=s()?.shapes[0]?.id||null,i=c()?structuredClone(c()):h(),g()}),C(e.libraryName,`change`,async()=>{let t=s();t&&(t.name=e.libraryName.value.trim()||t.name,_(),await m())}),C(document.getElementById(`btnNewShape`),`click`,()=>{r=null,i=h(),g()}),C(document.getElementById(`btnDeleteShape`),`click`,async()=>{let e=s();!e||!r||(e.shapes=e.shapes.filter(e=>e.id!==r),r=e.shapes[0]?.id||null,i=c()?structuredClone(c()):h(),g(),await m())}),C(document.getElementById(`btnDefaultAnchors`),`click`,()=>{i.anchors=structuredClone(PT),b()}),C(document.getElementById(`btnClearAnchors`),`click`,()=>{i.anchors=[],b()}),C(document.getElementById(`btnSaveShape`),`click`,async()=>{let t=s();if(!t||!i||!i.imageSrc)return;i.name=e.shapeName.value.trim()||`Untitled shape`,i.width=Math.max(16,Math.min(1200,Math.round(Number(e.shapeWidth.value)||65))),i.height=Math.max(16,Math.min(1200,Math.round(Number(e.shapeHeight.value)||65))),i.labelPlacement=u(e.labelPlacement.value),i.showInDiagram=e.shapeShowInDiagram.checked;let n=t.shapes.findIndex(e=>e.id===i.id);n>=0?t.shapes[n]=structuredClone(i):t.shapes.push(structuredClone(i)),r=i.id,g(),await m()}),[`shapeName`,`shapeWidth`,`shapeHeight`,`labelPlacement`,`shapeShowInDiagram`].forEach(t=>{C(document.getElementById(t),`input`,()=>{i.name=e.shapeName.value,i.width=Number(e.shapeWidth.value)||65,i.height=Number(e.shapeHeight.value)||65,i.labelPlacement=u(e.labelPlacement.value),i.showInDiagram=e.shapeShowInDiagram.checked})}),C(e.imageFile,`change`,async()=>{let t=e.imageFile.files&&e.imageFile.files[0];if(!t||!i)return;let n=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(r.result),r.onerror=n,r.readAsDataURL(t)}),r=(t.name.split(`.`).pop()||`png`).toLowerCase().replace(/[^a-z0-9]/g,``)||`png`,a=t.name.replace(/\.[^.]+$/,``).slice(0,60),o=await(await fetch(`/api/images/upload`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:n,ext:r,name:a})})).json();i.imageSrc=`/images/${o.filename}`,(!e.shapeName.value||e.shapeName.value===`New shape`)&&(i.name=a||i.name),y()}),p(),()=>{S.forEach(e=>e()),S.length=0}}var WT=U(`<div class="ld-shape-editor h-screen overflow-hidden bg-gray-50 text-gray-900"><header class="h-12 border-b border-gray-200 bg-white flex items-center gap-2 px-3"><button class="btn">← Back</button> <h1 class="text-sm font-semibold">Shape editor</h1> <span id="saveState" class="ml-auto text-xs text-gray-500"></span></header> <main class="h-[calc(100vh-3rem)] grid grid-cols-[17rem_1fr] overflow-hidden"><aside class="border-r border-gray-200 bg-white flex flex-col min-h-0"><div class="p-3 border-b border-gray-200 space-y-2"><label class="block text-xs font-semibold text-gray-500">Library</label> <div class="flex gap-2"><select id="librarySelect" class="field flex-1"></select> <button id="btnAddLibrary" class="btn">+</button></div> <input id="libraryName" class="field w-full" placeholder="Library name"/></div> <div class="p-3 border-b border-gray-200 flex gap-2"><button id="btnNewShape" class="btn btn-primary flex-1">New shape</button> <button id="btnDeleteShape" class="btn btn-danger">Delete</button></div> <div id="shapeList" class="flex-1 overflow-y-auto p-2 space-y-1"></div></aside> <section class="min-w-0 min-h-0 overflow-y-auto p-5"><div class="grid grid-cols-[minmax(20rem,34rem)_minmax(20rem,1fr)] gap-5 items-start"><div class="space-y-3"><div id="previewStage"><img id="previewImage" alt=""/></div> <p class="text-xs text-gray-500">Click on the image to add an anchor. Drag anchors to refine their
|
|
287
|
+
position.</p></div> <div class="space-y-4"><div class="grid grid-cols-2 gap-3"><label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Shape name</span> <input id="shapeName" class="field w-full" placeholder="Shape name"/></label> <label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Image / SVG</span> <input id="imageFile" type="file" accept="image/*,.svg" class="block w-full text-sm"/></label> <label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Width</span> <input id="shapeWidth" type="number" min="16" max="1200" class="field w-full"/></label> <label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Height</span> <input id="shapeHeight" type="number" min="16" max="1200" class="field w-full"/></label> <label class="space-y-1 col-span-2"><span class="block text-xs font-semibold text-gray-500">Text placement</span> <select id="labelPlacement" class="field w-full"><option> </option><option> </option><option> </option><option> </option><option> </option></select></label> <label class="col-span-2 flex items-start gap-2 rounded-md border border-gray-200 bg-white px-2 py-2 text-sm"><input id="shapeShowInDiagram" type="checkbox" class="mt-0.5 h-4 w-4 rounded border-gray-300 text-blue-600"/> <span class="space-y-0.5"><span class="block font-semibold text-gray-700"> </span> <span class="block text-xs text-gray-500"> </span></span></label></div> <div class="flex flex-wrap gap-2"><button id="btnDefaultAnchors" class="btn">Use 8 default anchors</button> <button id="btnClearAnchors" class="btn">Clear anchors</button> <button id="btnSaveShape" class="btn btn-primary">Save shape</button></div> <div><div class="flex items-center justify-between mb-2"><h2 class="text-xs font-semibold uppercase tracking-wide text-gray-500">Anchors</h2> <span id="anchorCount" class="text-xs text-gray-500"></span></div> <div id="anchorList" class="space-y-1"></div></div></div></div></section></main></div>`);function GT(e,t){qe(t,!1),Ji(async()=>{try{await Ca((await fetch(`/api/config`).then(e=>e.json())).language||`en`)}catch{await Ca(`en`)}return UT()}),Gi();var n=WT(),r=L(n),i=L(r);Ie(4),j(r);var a=z(r,2),o=z(L(a),2),s=L(o),c=z(L(s),2),l=L(c),u=z(L(l),8),d=z(L(u),2),f=L(d),p=L(f,!0);j(f),f.value=f.__value=`below`;var m=z(f),h=L(m,!0);j(m),m.value=m.__value=`above`;var g=z(m),_=L(g,!0);j(g),g.value=g.__value=`right`;var v=z(g),y=L(v,!0);j(v),v.value=v.__value=`left`;var b=z(v),x=L(b,!0);j(b),b.value=b.__value=`center`,j(d),j(u);var S=z(u,2),C=z(L(S),2),w=L(C),T=L(w,!0);j(w);var E=z(w,2),D=L(E,!0);j(E),j(C),j(S),j(l),Ie(4),j(c),j(s),j(o),j(a),j(n),B((e,t,n,r,i,a,o)=>{G(p,e),G(h,t),G(_,n),G(y,r),G(x,i),G(T,a),G(D,o)},[()=>Y(`shape_editor.label_placement.below`),()=>Y(`shape_editor.label_placement.above`),()=>Y(`shape_editor.label_placement.right`),()=>Y(`shape_editor.label_placement.left`),()=>Y(`shape_editor.label_placement.center`),()=>Y(`shape_editor.show_in_diagram_label`),()=>Y(`shape_editor.show_in_diagram_hint`)]),H(`click`,i,()=>history.back()),W(e,n),Je()}Pr([`click`]);function KT(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var qT=KT();function JT(e){qT=e}var YT=/[&<>"']/,XT=new RegExp(YT.source,`g`),ZT=/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,QT=new RegExp(ZT.source,`g`),$T={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},eE=e=>$T[e];function tE(e,t){if(t){if(YT.test(e))return e.replace(XT,eE)}else if(ZT.test(e))return e.replace(QT,eE);return e}var nE=/&(#(?:\d+)|(?:#x[0-9A-Fa-f]+)|(?:\w+));?/gi;function rE(e){return e.replace(nE,(e,t)=>(t=t.toLowerCase(),t===`colon`?`:`:t.charAt(0)===`#`?t.charAt(1)===`x`?String.fromCharCode(parseInt(t.substring(2),16)):String.fromCharCode(+t.substring(1)):``))}var iE=/(^|[^\[])\^/g;function aE(e,t){let n=typeof e==`string`?e:e.source;t||=``;let r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(iE,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}function oE(e){try{e=encodeURI(e).replace(/%25/g,`%`)}catch{return null}return e}var sE={exec:()=>null};function cE(e,t){let n=e.replace(/\|/g,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(/ \|/),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n[n.length-1].trim()&&n.pop(),t)if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``);for(;r<n.length;r++)n[r]=n[r].trim().replace(/\\\|/g,`|`);return n}function lE(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function uE(e,t){if(e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return-1}function dE(e,t,n,r){let i=t.href,a=t.title?tE(t.title):null,o=e[1].replace(/\\([\[\]])/g,`$1`);if(e[0].charAt(0)!==`!`){r.state.inLink=!0;let e={type:`link`,raw:n,href:i,title:a,text:o,tokens:r.inlineTokens(o)};return r.state.inLink=!1,e}return{type:`image`,raw:n,href:i,title:a,text:tE(o)}}function fE(e,t){let n=e.match(/^(\s+)(?:```)/);if(n===null)return t;let r=n[1];return t.split(`
|
|
288
288
|
`).map(e=>{let t=e.match(/^\s+/);if(t===null)return e;let[n]=t;return n.length>=r.length?e.slice(r.length):e}).join(`
|
|
289
|
-
`)}var
|
|
290
|
-
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=
|
|
291
|
-
$1`);e
|
|
289
|
+
`)}var pE=class{options;rules;lexer;constructor(e){this.options=e||qT}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=t[0].replace(/^ {1,4}/gm,``);return{type:`code`,raw:t[0],codeBlockStyle:`indented`,text:this.options.pedantic?e:lE(e,`
|
|
290
|
+
`)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=fE(e,t[3]||``);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(/#$/.test(e)){let t=lE(e,`#`);(this.options.pedantic||!t||/ $/.test(t))&&(e=t.trim())}return{type:`heading`,raw:t[0],depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:t[0]}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=t[0].replace(/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,`
|
|
291
|
+
$1`);e=lE(e.replace(/^ *>[ \t]?/gm,``),`
|
|
292
292
|
`);let n=this.lexer.state.top;this.lexer.state.top=!0;let r=this.lexer.blockTokens(e);return this.lexer.state.top=n,{type:`blockquote`,raw:t[0],tokens:r,text:e}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=t[1].trim(),r=n.length>1,i={type:`list`,raw:``,ordered:r,start:r?+n.slice(0,-1):``,loose:!1,items:[]};n=r?`\\d{1,9}\\${n.slice(-1)}`:`\\${n}`,this.options.pedantic&&(n=r?n:`[*+-]`);let a=RegExp(`^( {0,3}${n})((?:[\t ][^\\n]*)?(?:\\n|$))`),o=``,s=``,c=!1;for(;e;){let n=!1;if(!(t=a.exec(e))||this.rules.block.hr.test(e))break;o=t[0],e=e.substring(o.length);let r=t[2].split(`
|
|
293
293
|
`,1)[0].replace(/^\t+/,e=>` `.repeat(3*e.length)),l=e.split(`
|
|
294
294
|
`,1)[0],u=0;this.options.pedantic?(u=2,s=r.trimStart()):(u=t[2].search(/[^ ]/),u=u>4?1:u,s=r.slice(u),u+=t[1].length);let d=!1;if(!r&&/^ *$/.test(l)&&(o+=l+`
|
|
@@ -296,10 +296,10 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
296
296
|
`,1)[0];if(l=c,this.options.pedantic&&(l=l.replace(/^ {1,4}(?=( {4})*[^ ])/g,` `)),i.test(l)||a.test(l)||t.test(l)||n.test(e))break;if(l.search(/[^ ]/)>=u||!l.trim())s+=`
|
|
297
297
|
`+l.slice(u);else{if(d||r.search(/[^ ]/)>=4||i.test(r)||a.test(r)||n.test(r))break;s+=`
|
|
298
298
|
`+l}!d&&!l.trim()&&(d=!0),o+=c+`
|
|
299
|
-
`,e=e.substring(c.length+1),r=l.slice(u)}}i.loose||(c?i.loose=!0:/\n *\n *$/.test(o)&&(c=!0));let f=null,p;this.options.gfm&&(f=/^\[[ xX]\] /.exec(s),f&&(p=f[0]!==`[ ] `,s=s.replace(/^\[[ xX]\] +/,``))),i.items.push({type:`list_item`,raw:o,task:!!f,checked:p,loose:!1,text:s,tokens:[]}),i.raw+=o}i.items[i.items.length-1].raw=o.trimEnd(),i.items[i.items.length-1].text=s.trimEnd(),i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>/\n.*\n/.test(e.raw))}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(/\s+/g,` `),n=t[2]?t[2].replace(/^<(.*)>$/,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;let n=
|
|
300
|
-
`):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)/^ *-+: *$/.test(e)?a.align.push(`right`):/^ *:-+: *$/.test(e)?a.align.push(`center`):/^ *:-+ *$/.test(e)?a.align.push(`left`):a.align.push(null);for(let e of n)a.header.push({text:e,tokens:this.lexer.inline(e)});for(let e of i)a.rows.push(
|
|
301
|
-
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:
|
|
302
|
-
]`).replace(`lheading`,
|
|
299
|
+
`,e=e.substring(c.length+1),r=l.slice(u)}}i.loose||(c?i.loose=!0:/\n *\n *$/.test(o)&&(c=!0));let f=null,p;this.options.gfm&&(f=/^\[[ xX]\] /.exec(s),f&&(p=f[0]!==`[ ] `,s=s.replace(/^\[[ xX]\] +/,``))),i.items.push({type:`list_item`,raw:o,task:!!f,checked:p,loose:!1,text:s,tokens:[]}),i.raw+=o}i.items[i.items.length-1].raw=o.trimEnd(),i.items[i.items.length-1].text=s.trimEnd(),i.raw=i.raw.trimEnd();for(let e=0;e<i.items.length;e++)if(this.lexer.state.top=!1,i.items[e].tokens=this.lexer.blockTokens(i.items[e].text,[]),!i.loose){let t=i.items[e].tokens.filter(e=>e.type===`space`);i.loose=t.length>0&&t.some(e=>/\n.*\n/.test(e.raw))}if(i.loose)for(let e=0;e<i.items.length;e++)i.items[e].loose=!0;return i}}html(e){let t=this.rules.block.html.exec(e);if(t)return{type:`html`,block:!0,raw:t[0],pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:t[0]}}def(e){let t=this.rules.block.def.exec(e);if(t){let e=t[1].toLowerCase().replace(/\s+/g,` `),n=t[2]?t[2].replace(/^<(.*)>$/,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:t[0],href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!/[:|]/.test(t[2]))return;let n=cE(t[1]),r=t[2].replace(/^\||\| *$/g,``).split(`|`),i=t[3]&&t[3].trim()?t[3].replace(/\n[ \t]*$/,``).split(`
|
|
300
|
+
`):[],a={type:`table`,raw:t[0],header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)/^ *-+: *$/.test(e)?a.align.push(`right`):/^ *:-+: *$/.test(e)?a.align.push(`center`):/^ *:-+ *$/.test(e)?a.align.push(`left`):a.align.push(null);for(let e of n)a.header.push({text:e,tokens:this.lexer.inline(e)});for(let e of i)a.rows.push(cE(e,a.header.length).map(e=>({text:e,tokens:this.lexer.inline(e)})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t)return{type:`heading`,raw:t[0],depth:t[2].charAt(0)===`=`?1:2,text:t[1],tokens:this.lexer.inline(t[1])}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
|
|
301
|
+
`?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:tE(t[1])}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&/^<a /i.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&/^<\/a>/i.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&/^<(pre|code|kbd|script)(\s|>)/i.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&/^<\/(pre|code|kbd|script)(\s|>)/i.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){let t=this.rules.inline.link.exec(e);if(t){let e=t[2].trim();if(!this.options.pedantic&&/^</.test(e)){if(!/>$/.test(e))return;let t=lE(e.slice(0,-1),`\\`);if((e.length-t.length)%2==0)return}else{let e=uE(t[2],`()`);if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let n=t[2],r=``;if(this.options.pedantic){let e=/^([^'"]*[^\s])\s+(['"])(.*)\2/.exec(n);e&&(n=e[1],r=e[3])}else r=t[3]?t[3].slice(1,-1):``;return n=n.trim(),/^</.test(n)&&(n=this.options.pedantic&&!/>$/.test(e)?n.slice(1):n.slice(1,-1)),dE(t,{href:n&&n.replace(this.rules.inline.anyPunctuation,`$1`),title:r&&r.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let e=t[(n[2]||n[1]).replace(/\s+/g,` `).toLowerCase()];if(!e){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return dE(n,e,n[0],this.lexer)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(r&&!(r[3]&&n.match(/[\p{L}\p{N}]/u))&&(!(r[1]||r[2])||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=0,c=r[0][0]===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(c.lastIndex=0,t=t.slice(-1*e.length+n);(r=c.exec(t))!=null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i)continue;if(a=[...i].length,r[3]||r[4]){o+=a;continue}else if((r[5]||r[6])&&n%3&&!((n+a)%3)){s+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o+s);let t=[...r[0]][0].length,c=e.slice(0,n+r.index+t+a);if(Math.min(n,a)%2){let e=c.slice(1,-1);return{type:`em`,raw:c,text:e,tokens:this.lexer.inlineTokens(e)}}let l=c.slice(2,-2);return{type:`strong`,raw:c,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(/\n/g,` `),n=/[^ ]/.test(e),r=/^ /.test(e)&&/ $/.test(e);return n&&r&&(e=e.substring(1,e.length-1)),e=tE(e,!0),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e){let t=this.rules.inline.del.exec(e);if(t)return{type:`del`,raw:t[0],text:t[2],tokens:this.lexer.inlineTokens(t[2])}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=tE(t[1]),n=`mailto:`+e):(e=tE(t[1]),n=e),{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=tE(t[0]),n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=tE(t[0]),n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e;return e=this.lexer.state.inRawBlock?t[0]:tE(t[0]),{type:`text`,raw:t[0],text:e}}}},mE=/^(?: *(?:\n|$))+/,hE=/^( {4}[^\n]+(?:\n(?: *(?:\n|$))*)?)+/,gE=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,_E=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,vE=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,yE=/(?:[*+-]|\d{1,9}[.)])/,bE=aE(/^(?!bull |blockCode|fences|blockquote|heading|html)((?:.|\n(?!\s*?\n|bull |blockCode|fences|blockquote|heading|html))+?)\n {0,3}(=+|-+) *(?:\n+|$)/).replace(/bull/g,yE).replace(/blockCode/g,/ {4}/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).getRegex(),xE=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table| +\n)[^\n]+)*)/,SE=/^[^\n]+/,CE=/(?!\s*\])(?:\\.|[^\[\]\\])+/,wE=aE(/^ {0,3}\[(label)\]: *(?:\n *)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n *)?| *\n *)(title))? *(?:\n+|$)/).replace(`label`,CE).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),TE=aE(/^( {0,3}bull)([ \t][^\n]+?)?(?:\n|$)/).replace(/bull/g,yE).getRegex(),EE=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,DE=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,OE=aE(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n+|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>\\n*|$)|<![A-Z][\\s\\S]*?(?:>\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n *)+\\n|$)|<(?!script|pre|style|textarea)([a-z][\\w-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$)|</(?!script|pre|style|textarea)[a-z][\\w-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n *)+\\n|$))`,`i`).replace(`comment`,DE).replace(`tag`,EE).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),kE=aE(xE).replace(`hr`,_E).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,EE).getRegex(),AE={blockquote:aE(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,kE).getRegex(),code:hE,def:wE,fences:gE,heading:vE,hr:_E,html:OE,lheading:bE,list:TE,newline:mE,paragraph:kE,table:sE,text:SE},jE=aE(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,_E).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,` {4}[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,EE).getRegex(),ME={...AE,table:jE,paragraph:aE(xE).replace(`hr`,_E).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,jE).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*\\n)|~{3,})[^\\n]*\\n").replace(`list`,` {0,3}(?:[*+-]|1[.)]) `).replace(`html`,`</?(?:tag)(?: +|\\n|/?>)|<(?:script|pre|style|textarea|!--)`).replace(`tag`,EE).getRegex()},NE={...AE,html:aE(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,DE).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:sE,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:aE(xE).replace(`hr`,_E).replace(`heading`,` *#{1,6} *[^
|
|
302
|
+
]`).replace(`lheading`,bE).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},PE=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,FE=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,IE=/^( {2,}|\\)\n(?!\s*$)/,LE=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,RE=`\\p{P}\\p{S}`,zE=aE(/^((?![*_])[\spunctuation])/,`u`).replace(/punctuation/g,RE).getRegex(),BE=/\[[^[\]]*?\]\([^\(\)]*?\)|`[^`]*?`|<[^<>]*?>/g,VE=aE(/^(?:\*+(?:((?!\*)[punct])|[^\s*]))|^_+(?:((?!_)[punct])|([^\s_]))/,`u`).replace(/punct/g,RE).getRegex(),HE=aE(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)[punct](\\*+)(?=[\\s]|$)|[^punct\\s](\\*+)(?!\\*)(?=[punct\\s]|$)|(?!\\*)[punct\\s](\\*+)(?=[^punct\\s])|[\\s](\\*+)(?!\\*)(?=[punct])|(?!\\*)[punct](\\*+)(?!\\*)(?=[punct])|[^punct\\s](\\*+)(?=[^punct\\s])`,`gu`).replace(/punct/g,RE).getRegex(),UE=aE(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)[punct](_+)(?=[\\s]|$)|[^punct\\s](_+)(?!_)(?=[punct\\s]|$)|(?!_)[punct\\s](_+)(?=[^punct\\s])|[\\s](_+)(?!_)(?=[punct])|(?!_)[punct](_+)(?!_)(?=[punct])`,`gu`).replace(/punct/g,RE).getRegex(),WE=aE(/\\([punct])/,`gu`).replace(/punct/g,RE).getRegex(),GE=aE(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),KE=aE(DE).replace(`(?:-->|$)`,`-->`).getRegex(),qE=aE(`^comment|^</[a-zA-Z][\\w:-]*\\s*>|^<[a-zA-Z][\\w-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,KE).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),JE=/(?:\[(?:\\.|[^\[\]\\])*\]|\\.|`[^`]*`|[^\[\]\\`])*?/,YE=aE(/^!?\[(label)\]\(\s*(href)(?:\s+(title))?\s*\)/).replace(`label`,JE).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^\s\x00-\x1f]*/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),XE=aE(/^!?\[(label)\]\[(ref)\]/).replace(`label`,JE).replace(`ref`,CE).getRegex(),ZE=aE(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,CE).getRegex(),QE={_backpedal:sE,anyPunctuation:WE,autolink:GE,blockSkip:BE,br:IE,code:FE,del:sE,emStrongLDelim:VE,emStrongRDelimAst:HE,emStrongRDelimUnd:UE,escape:PE,link:YE,nolink:ZE,punctuation:zE,reflink:XE,reflinkSearch:aE(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,XE).replace(`nolink`,ZE).getRegex(),tag:qE,text:LE,url:sE},$E={...QE,link:aE(/^!?\[(label)\]\((.*?)\)/).replace(`label`,JE).getRegex(),reflink:aE(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,JE).getRegex()},eD={...QE,escape:aE(PE).replace(`])`,`~|])`).getRegex(),url:aE(/^((?:ftp|https?):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/,`i`).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![-_])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])([\s\S]*?[^\s~])\1(?=[^~]|$)/,text:/^([`~]+|[^`~])(?:(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|https?:\/\/|ftp:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)))/},tD={...eD,br:aE(IE).replace(`{2,}`,`*`).getRegex(),text:aE(eD.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},nD={normal:AE,gfm:ME,pedantic:NE},rD={normal:QE,gfm:eD,breaks:tD,pedantic:$E},iD=class e{tokens;options;state;tokenizer;inlineQueue;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||qT,this.options.tokenizer=this.options.tokenizer||new pE,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,top:!0};let t={block:nD.normal,inline:rD.normal};this.options.pedantic?(t.block=nD.pedantic,t.inline=rD.pedantic):this.options.gfm&&(t.block=nD.gfm,this.options.breaks?t.inline=rD.breaks:t.inline=rD.gfm),this.tokenizer.rules=t}static get rules(){return{block:nD,inline:rD}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(/\r\n|\r/g,`
|
|
303
303
|
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[]){e=this.options.pedantic?e.replace(/\t/g,` `).replace(/^ +$/gm,``):e.replace(/^( *)(\t+)/gm,(e,t,n)=>t+` `.repeat(n.length));let n,r,i,a;for(;e;)if(!(this.options.extensions&&this.options.extensions.block&&this.options.extensions.block.some(r=>(n=r.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.space(e)){e=e.substring(n.raw.length),n.raw.length===1&&t.length>0?t[t.length-1].raw+=`
|
|
304
304
|
`:t.push(n);continue}if(n=this.tokenizer.code(e)){e=e.substring(n.raw.length),r=t[t.length-1],r&&(r.type===`paragraph`||r.type===`text`)?(r.raw+=`
|
|
305
305
|
`+n.raw,r.text+=`
|
|
@@ -309,9 +309,9 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
309
309
|
`+n.raw,r.text+=`
|
|
310
310
|
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n),a=i.length!==e.length,e=e.substring(n.raw.length);continue}if(n=this.tokenizer.text(e)){e=e.substring(n.raw.length),r=t[t.length-1],r&&r.type===`text`?(r.raw+=`
|
|
311
311
|
`+n.raw,r.text+=`
|
|
312
|
-
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,r,i,a=e,o,s,c;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)e.includes(o[0].slice(o[0].lastIndexOf(`[`)+1,-1))&&(a=a.slice(0,o.index)+`[`+`a`.repeat(o[0].length-2)+`]`+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,o.index)+`[`+`a`.repeat(o[0].length-2)+`]`+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(a))!=null;)a=a.slice(0,o.index)+`++`+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(s||(c=``),s=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(r=>(n=r.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),r=t[t.length-1],r&&n.type===`text`&&r.type===`text`?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length),r=t[t.length-1],r&&n.type===`text`&&r.type===`text`?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,a,c)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}if(i=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(i)){e=e.substring(n.raw.length),n.raw.slice(-1)!==`_`&&(c=n.raw.slice(-1)),s=!0,r=t[t.length-1],r&&r.type===`text`?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return t}},
|
|
313
|
-
`,r?`<pre><code class="language-`+
|
|
314
|
-
`:`<pre><code>`+(n?e:
|
|
312
|
+
`+n.text,this.inlineQueue.pop(),this.inlineQueue[this.inlineQueue.length-1].src=r.text):t.push(n);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}inlineTokens(e,t=[]){let n,r,i,a=e,o,s,c;if(this.tokens.links){let e=Object.keys(this.tokens.links);if(e.length>0)for(;(o=this.tokenizer.rules.inline.reflinkSearch.exec(a))!=null;)e.includes(o[0].slice(o[0].lastIndexOf(`[`)+1,-1))&&(a=a.slice(0,o.index)+`[`+`a`.repeat(o[0].length-2)+`]`+a.slice(this.tokenizer.rules.inline.reflinkSearch.lastIndex))}for(;(o=this.tokenizer.rules.inline.blockSkip.exec(a))!=null;)a=a.slice(0,o.index)+`[`+`a`.repeat(o[0].length-2)+`]`+a.slice(this.tokenizer.rules.inline.blockSkip.lastIndex);for(;(o=this.tokenizer.rules.inline.anyPunctuation.exec(a))!=null;)a=a.slice(0,o.index)+`++`+a.slice(this.tokenizer.rules.inline.anyPunctuation.lastIndex);for(;e;)if(s||(c=``),s=!1,!(this.options.extensions&&this.options.extensions.inline&&this.options.extensions.inline.some(r=>(n=r.call({lexer:this},e,t))?(e=e.substring(n.raw.length),t.push(n),!0):!1))){if(n=this.tokenizer.escape(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.tag(e)){e=e.substring(n.raw.length),r=t[t.length-1],r&&n.type===`text`&&r.type===`text`?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(n=this.tokenizer.link(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(n.raw.length),r=t[t.length-1],r&&n.type===`text`&&r.type===`text`?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(n=this.tokenizer.emStrong(e,a,c)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.codespan(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.br(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.del(e)){e=e.substring(n.raw.length),t.push(n);continue}if(n=this.tokenizer.autolink(e)){e=e.substring(n.raw.length),t.push(n);continue}if(!this.state.inLink&&(n=this.tokenizer.url(e))){e=e.substring(n.raw.length),t.push(n);continue}if(i=e,this.options.extensions&&this.options.extensions.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(i=e.substring(0,t+1))}if(n=this.tokenizer.inlineText(i)){e=e.substring(n.raw.length),n.raw.slice(-1)!==`_`&&(c=n.raw.slice(-1)),s=!0,r=t[t.length-1],r&&r.type===`text`?(r.raw+=n.raw,r.text+=n.text):t.push(n);continue}if(e){let t=`Infinite loop on byte: `+e.charCodeAt(0);if(this.options.silent){console.error(t);break}else throw Error(t)}}return t}},aD=class{options;constructor(e){this.options=e||qT}code(e,t,n){let r=(t||``).match(/^\S*/)?.[0];return e=e.replace(/\n$/,``)+`
|
|
313
|
+
`,r?`<pre><code class="language-`+tE(r)+`">`+(n?e:tE(e,!0))+`</code></pre>
|
|
314
|
+
`:`<pre><code>`+(n?e:tE(e,!0))+`</code></pre>
|
|
315
315
|
`}blockquote(e){return`<blockquote>\n${e}</blockquote>\n`}html(e,t){return e}heading(e,t,n){return`<h${t}>${e}</h${t}>\n`}hr(){return`<hr>
|
|
316
316
|
`}list(e,t,n){let r=t?`ol`:`ul`,i=t&&n!==1?` start="`+n+`"`:``;return`<`+r+i+`>
|
|
317
317
|
`+e+`</`+r+`>
|
|
@@ -319,10 +319,10 @@ $&`).replace(/(?:^|\n)([\t ].*)(?:([\n\t ]*)\n(?![\n\t ]))?/g,`$1$2`).replace(/\
|
|
|
319
319
|
<thead>
|
|
320
320
|
`+e+`</thead>
|
|
321
321
|
`+t+`</table>
|
|
322
|
-
`}tablerow(e){return`<tr>\n${e}</tr>\n`}tablecell(e,t){let n=t.header?`th`:`td`;return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>\n`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return`<br>`}del(e){return`<del>${e}</del>`}link(e,t,n){let r=
|
|
323
|
-
`+(a.tokens?this.parseInline(a.tokens):a.text);n+=t?this.renderer.paragraph(o):o;continue}default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}parseInline(e,t){t||=this.renderer;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}switch(i.type){case`escape`:{let e=i;n+=t.text(e.text);break}case`html`:{let e=i;n+=t.html(e.text);break}case`link`:{let e=i;n+=t.link(e.href,e.title,this.parseInline(e.tokens,t));break}case`image`:{let e=i;n+=t.image(e.href,e.title,e.text);break}case`strong`:{let e=i;n+=t.strong(this.parseInline(e.tokens,t));break}case`em`:{let e=i;n+=t.em(this.parseInline(e.tokens,t));break}case`codespan`:{let e=i;n+=t.codespan(e.text);break}case`br`:n+=t.br();break;case`del`:{let e=i;n+=t.del(this.parseInline(e.tokens,t));break}case`text`:{let e=i;n+=t.text(e.text);break}default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},
|
|
324
|
-
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+GT(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function eD(e,t){return $E.parse(e,t)}eD.options=eD.setOptions=function(e){return $E.setOptions(e),eD.defaults=$E.defaults,RT(eD.defaults),eD},eD.getDefaults=IT,eD.defaults=LT,eD.use=function(...e){return $E.use(...e),eD.defaults=$E.defaults,RT(eD.defaults),eD},eD.walkTokens=function(e,t){return $E.walkTokens(e,t)},eD.parseInline=$E.parseInline,eD.Parser=ZE,eD.parser=ZE.parse,eD.Renderer=YE,eD.TextRenderer=XE,eD.Lexer=JE,eD.lexer=JE.lex,eD.Tokenizer=rE,eD.Hooks=QE,eD.parse=eD,eD.options,eD.setOptions,eD.use,eD.walkTokens,eD.parseInline,ZE.parse,JE.lex;var tD=/<!--[\s\S]*?(?:-->|$)|<(pre|code|script|style|textarea)\b(?:"[^"]*"|'[^']*'|[^'">])*?>[\s\S]*?(?:<\/\1\s*>|$)|(<summary\b(?:"[^"]*"|'[^']*'|[^'">])*?>)([\s\S]*?)(<\/summary\s*>)|<\/?[a-z][a-z0-9-]*\b(?:"[^"]*"|'[^']*'|[^'">])*?>/gi;function nD(e,t){return e.replace(tD,(e,n,r,i,a)=>{if(n||!r)return e;let o=i.trim(),s=/^(#{1,6})(?:[ \t]+(.*)|$)$/.exec(o);if(s){let e=s[1].length,n=(s[2]??``).replace(/[ \t]+#+[ \t]*$/,``);return`${r}<h${e} style="display: inline; margin: 0">${eD.parseInline(n,t)}</h${e}>${a}`}return`${r}${eD.parseInline(i,t)}${a}`})}function rD(e,t={}){let n={...eD.defaults,...t},r=eD.lexer(e,n);return eD.walkTokens(r,e=>{e.type===`html`&&(e.text=nD(e.text,n))}),eD.parser(r,n)}var iD=U(`<iframe sandbox="" class="svelte-zodsi8"></iframe>`);function aD(e,t){qe(t,!0);let n=P(!1);Ji(()=>{let e=()=>{F(n,document.documentElement.classList.contains(`dark`),!0)};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>t.disconnect()});let r=N(()=>rD(t.content.replace(/^---\r?\n[\s\S]*?\r?\n---(?:\r?\n|$)/,``),{async:!1})),i=N(()=>`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; img-src data:;"><style>html{color-scheme:${V(n)?`dark`:`light`}}body{font:15px/1.7 system-ui;margin:24px;overflow-wrap:anywhere}h1{font-size:1.7em}h2{font-size:1.3em}pre{overflow:auto;padding:16px;background:light-dark(#f1f5f9,#1e293b);border-radius:8px}code{font-family:monospace}table{border-collapse:collapse;width:100%}th,td{border:1px solid #8886;padding:8px;text-align:left}blockquote{border-left:3px solid #8886;padding-left:16px;margin-left:0}img{max-width:100%}a{color:light-dark(#2563eb,#93c5fd)}</style></head><body>${V(r)}</body></html>`);var a=Wr();Zr(R(a),()=>V(i),e=>{var t=iD();B(e=>{J(t,`title`,e),J(t,`srcdoc`,V(i))},[()=>Y(`templates.preview`)]),W(e,t)}),W(e,a),Je()}var oD=U(`<span> </span>`),sD=U(`<span class="success svelte-3z3jlz"> </span>`),cD=U(`<div role="alert" class="error svelte-3z3jlz"><span> </span><button class="secondary-button svelte-3z3jlz"> </button></div>`),lD=U(`<p> </p>`),uD=U(`<button><span class="svelte-3z3jlz"> </span><span class="svelte-3z3jlz"> </span></button>`),dD=U(`<details class="folder-actions"><summary class="svelte-3z3jlz"> </summary><div class="actions svelte-3z3jlz"><button class="secondary-button svelte-3z3jlz"> </button><button class="text-button danger svelte-3z3jlz" data-testid="template-delete-folder"> </button></div></details>`),fD=U(`<form class="folder-form svelte-3z3jlz"><label for="template-folder-input" class="svelte-3z3jlz"> </label> <input id="template-folder-input" maxlength="120" aria-describedby="template-folder-error" class="svelte-3z3jlz"/> <span id="template-folder-error" class="error svelte-3z3jlz" role="alert"> </span> <div class="actions svelte-3z3jlz"><button class="primary-button svelte-3z3jlz" data-testid="template-add-folder"> </button><button type="button" class="text-button svelte-3z3jlz"> </button></div></form>`),pD=U(`<button><span class="item-title svelte-3z3jlz"> </span><span class="hint svelte-3z3jlz"> </span></button>`),mD=U(`<button class="primary-button svelte-3z3jlz"> </button>`),hD=U(`<div class="empty svelte-3z3jlz"><h2 class="svelte-3z3jlz"> </h2><p class="svelte-3z3jlz"> </p><!></div>`),gD=U(`<option> </option>`),_D=U(`<form class="edit-form svelte-3z3jlz"><div class="pane-heading svelte-3z3jlz"><h2 class="svelte-3z3jlz"> </h2><span class="draft-status svelte-3z3jlz"> </span></div> <footer class="editor-footer svelte-3z3jlz"><span class="hint svelte-3z3jlz"> </span><div class="actions svelte-3z3jlz"><button type="button" class="secondary-button svelte-3z3jlz"> </button><button class="primary-button svelte-3z3jlz" data-testid="template-save"> </button></div></footer> <div class="fields svelte-3z3jlz"><div><label for="template-name" class="svelte-3z3jlz"> </label><input id="template-name" maxlength="120" aria-describedby="template-name-error" class="svelte-3z3jlz"/><span class="error svelte-3z3jlz" id="template-name-error" role="alert"> </span></div><div><label for="template-destination" class="svelte-3z3jlz"> </label><select id="template-destination" class="svelte-3z3jlz"></select></div></div> <label for="template-content" class="svelte-3z3jlz"> </label> <div class="editor-body svelte-3z3jlz"><textarea id="template-content" maxlength="1000000" spellcheck="false" class="svelte-3z3jlz"></textarea><details class="live-preview svelte-3z3jlz"><summary class="svelte-3z3jlz"> </summary><!></details></div></form>`),vD=U(`<pre class="svelte-3z3jlz"> </pre>`),yD=U(`<div class="detail-heading svelte-3z3jlz"><span class="eyebrow svelte-3z3jlz"> </span><h2 class="svelte-3z3jlz"> </h2><div class="actions svelte-3z3jlz"><button class="primary-button svelte-3z3jlz"> </button><button class="secondary-button svelte-3z3jlz" id="template-edit" data-testid="template-edit"> </button><details class="more-actions svelte-3z3jlz"><summary class="svelte-3z3jlz"> </summary><div class="actions svelte-3z3jlz"><button class="text-button svelte-3z3jlz"> </button><button class="text-button danger svelte-3z3jlz"> </button></div></details></div><p class="hint svelte-3z3jlz"> </p></div> <div class="preview-heading svelte-3z3jlz"><h3 class="svelte-3z3jlz"> </h3><button class="text-button svelte-3z3jlz"> </button></div> <div class="preview-content svelte-3z3jlz"><!></div>`,1),bD=U(`<div class="empty svelte-3z3jlz"><h2 class="svelte-3z3jlz"> </h2><p class="svelte-3z3jlz"> </p></div>`),xD=U(`<div><aside class="folder-pane svelte-3z3jlz"><div class="pane-heading svelte-3z3jlz"><h2 class="svelte-3z3jlz"> </h2><button class="text-button svelte-3z3jlz"> </button></div> <button> <span class="svelte-3z3jlz"> </span></button> <!> <p class="hint svelte-3z3jlz"> </p> <!> <!></aside> <section class="list-pane svelte-3z3jlz"><label for="template-search" class="svelte-3z3jlz"> </label><input type="search" id="template-search" class="svelte-3z3jlz"/> <div class="list-caption svelte-3z3jlz"> </div> <div class="template-list svelte-3z3jlz"></div></section> <section class="detail-pane svelte-3z3jlz"><button class="text-button mobile-back svelte-3z3jlz"> </button> <!></section></div>`),SD=U(`<!> <div class="template-library svelte-3z3jlz" data-testid="templates-manager"><header class="library-heading svelte-3z3jlz"><div><h1 class="svelte-3z3jlz"> </h1><p class="svelte-3z3jlz"> </p></div> <button class="primary-button svelte-3z3jlz" data-testid="template-new"><span aria-hidden="true">+</span> </button></header> <div class="feedback svelte-3z3jlz" aria-live="polite"><!> <!></div> <!></div> <!>`,1);function CD(e,t){qe(t,!0);let n=Pa(),r=P(I({version:1,folders:[]})),i=P(!1),a=P(!1),o=P(``),s=P(``),c=P(``),l=P(``),u=P(``),d=P(!1),f=P(``),p=P(``),m=P(``),h=P(``),g=P(``),_=P(``),v=P(null),y=P(``),b=P(``),x=P(``),S=P(!1),C=P(!1),w=P(!1),T=P(void 0),E,D=N(()=>V(r).folders.flatMap(e=>e.templates.map(t=>({...t,folderId:e.id,folderName:e.name})))),ee=N(()=>V(r).folders.find(e=>e.id===V(l))),te=N(()=>V(D).find(e=>e.id===V(u))),O=e=>e.normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).toLocaleLowerCase(),ne=N(()=>V(D).filter(e=>(!V(l)||e.folderId===V(l))&&O(e.name+` `+e.content).includes(O(V(c))))),k=()=>JSON.stringify([V(p),V(m),V(h)]),A=N(()=>V(d)&&k()!==V(g)||V(v)!==null&&V(y)!==V(b));async function re(){if(V(a))return!1;if(!V(A))return!0;let e=await E.show({title:Y(`templates.unsaved_title`),message:Y(`templates.unsaved_message`),confirmLabel:Y(`templates.discard`),cancelLabel:Y(`templates.keep_editing`),danger:!0});return e&&(F(d,!1),F(v,null)),e}async function ie(e){await re()&&(F(d,!1),F(v,null),F(o,``),F(s,``),await e())}async function ae(){F(r,await n(),!0),F(i,!0),V(l)&&!V(r).folders.some(e=>e.id===V(l))&&F(l,``),V(D).some(e=>e.id===V(u))||F(u,V(D)[0]?.id||``,!0)}async function oe(e){if(!V(a)){F(a,!0),F(o,``),F(s,``);try{await e()}catch(e){F(o,e instanceof Error?e.message:Y(`templates.errors.storage_error`),!0)}finally{F(a,!1)}}}let se=()=>ie(()=>oe(ae));Ji(()=>(oe(ae),Wo(re)));function ce(e){(V(A)||V(a))&&(e.preventDefault(),e.returnValue=``)}async function le(e){await ie(()=>{F(l,e,!0),F(w,!1),F(u,V(D).find(t=>!e||t.folderId===e)?.id||``,!0)})}async function ue(e){await ie(()=>{F(u,e,!0),F(w,!0),F(S,!1)})}async function de(e,t=!1){await ie(async()=>{if(F(f,t?``:e?.id||``,!0),F(h,e?.folderId||V(l)||V(r).folders[0]?.id||``,!0),F(p,e?.name||``,!0),t&&e){let t=Y(`templates.copy_name`,{name:e.name});F(p,t,!0);let n=2;for(;V(D).some(e=>e.folderId===V(h)&&e.name.toLocaleLowerCase()===V(p).toLocaleLowerCase());)F(p,`${t} ${n++}`)}F(m,e?.content||``,!0),F(g,t?``:k(),!0),F(_,``),F(d,!0),F(w,!0),await xr(),document.getElementById(`template-name`)?.focus()})}async function fe(){if(F(_,``),!V(p).trim()||V(p).trim().length>120){F(_,Y(`templates.errors.invalid_name`),!0);return}if(V(D).some(e=>e.id!==V(f)&&e.folderId===V(h)&&e.name.toLocaleLowerCase()===V(p).trim().toLocaleLowerCase())){F(_,Y(`templates.errors.duplicate_name`),!0);return}await oe(async()=>{let e=await n(V(f)?`/${V(f)}`:`/folders/${V(h)}/templates`,V(f)?`PUT`:`POST`,{name:V(p),content:V(m),folderId:V(h)});F(r,{...V(r),folders:V(r).folders.map(t=>({...t,templates:[...t.templates.filter(t=>t.id!==e.id),...t.id===V(h)?[e]:[]]}))},!0),F(u,e.id,!0),F(l,V(h),!0),F(c,``),F(d,!1),F(S,!1),F(s,Y(`templates.saved`),!0),await xr(),document.getElementById(`template-edit`)?.focus()})}async function pe(e){await ie(async()=>{F(y,e===`rename`&&V(ee)?.name||``,!0),F(b,V(y),!0),F(v,e,!0),F(x,``),await xr(),document.getElementById(`template-folder-input`)?.focus()})}async function me(){if(!V(y).trim()||V(y).trim().length>120){F(x,Y(`templates.errors.invalid_name`),!0);return}if(V(r).folders.some(e=>(V(v)===`new`||e.id!==V(l))&&e.name.toLocaleLowerCase()===V(y).trim().toLocaleLowerCase())){F(x,Y(`templates.errors.duplicate_name`),!0);return}await oe(async()=>{let e=await n(V(v)===`new`?`/folders`:`/folders/${V(l)}`,V(v)===`new`?`POST`:`PUT`,{name:V(y)});F(r,{...V(r),folders:V(v)===`new`?[...V(r).folders,e]:V(r).folders.map(t=>t.id===e.id?e:t)},!0),F(l,e.id,!0),F(u,e.templates[0]?.id||``,!0),F(v,null),F(x,``),F(s,Y(`templates.folder_saved`),!0)})}async function he(e){if(!await re())return;let t=V(e?ee:te);t&&await E.show({title:Y(e?`templates.delete_folder`:`templates.delete_template`),message:Y(`templates.delete_message`,{name:t.name}),detail:e?Y(`templates.delete_count`,{count:String(V(ee)?.templates.length||0)}):Y(`templates.independent`),confirmLabel:Y(`common.remove`),cancelLabel:Y(`common.cancel`),danger:!0})&&await oe(async()=>{await n(e?`/folders/${t.id}?confirm=true`:`/${t.id}`,`DELETE`),F(r,{...V(r),folders:e?V(r).folders.filter(e=>e.id!==t.id):V(r).folders.map(e=>({...e,templates:e.templates.filter(e=>e.id!==t.id)}))},!0),e&&F(l,``),F(u,V(D).find(e=>!V(l)||e.folderId===V(l))?.id||``,!0),F(d,!1),F(w,!1),F(s,Y(`templates.deleted`),!0)})}function ge(e){(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`&&V(d)&&(e.preventDefault(),V(a)||fe())}var _e=SD();Nr(`beforeunload`,on,ce),Nr(`keydown`,on,ge);var ve=R(_e);Ui($d(ve,{}),e=>E=e,()=>E);var ye=z(ve,2),be=L(ye),xe=L(be),Se=L(xe),Ce=L(Se,!0);j(Se);var we=z(Se),Te=L(we,!0);j(we),j(xe);var Ee=z(xe,2),De=z(L(Ee));j(Ee),j(be);var Oe=z(be,2),ke=L(Oe),Ae=e=>{var t=oD(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`common.loading`)]),W(e,t)},je=e=>{var t=sD(),n=L(t);j(t),B(()=>G(n,`✓ ${V(s)??``}`)),W(e,t)};K(ke,e=>{V(a)?e(Ae):V(s)&&e(je,1)});var Me=z(ke,2),Ne=e=>{var t=cD(),n=L(t),r=L(n,!0);j(n);var i=z(n),s=L(i,!0);j(i),j(t),B(e=>{G(r,V(o)),i.disabled=V(a),G(s,e)},[()=>Y(`templates.reload`)]),H(`click`,i,se),W(e,t)};K(Me,e=>{V(o)&&e(Ne)}),j(Oe);var Pe=z(Oe,2),Fe=e=>{var t=Wr(),n=R(t),r=e=>{var t=lD(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`templates.load_failed`)]),W(e,t)};K(n,e=>{!V(a)&&V(o)&&e(r)}),W(e,t)},Ie=e=>{var t=xD();let n;var i=L(t),o=L(i),s=L(o),g=L(s,!0);j(s);var b=z(s),E=L(b,!0);j(b),j(o);var O=z(o,2);let k;var re=L(O,!0),ae=z(re),oe=L(ae,!0);j(ae),j(O);var se=z(O,2);q(se,17,()=>V(r).folders,e=>e.id,(e,t)=>{var n=uD();let r;var i=L(n),o=L(i);j(i);var s=z(i),c=L(s,!0);j(s),j(n),B(()=>{r=vi(n,1,`folder-item svelte-3z3jlz`,null,r,{chosen:V(l)===V(t).id}),J(n,`aria-pressed`,V(l)===V(t).id),n.disabled=V(a),G(o,`▱ ${V(t).name??``}`),G(c,V(t).templates.length)}),H(`click`,n,()=>le(V(t).id)),W(e,n)});var ce=z(se,2),ge=L(ce,!0);j(ce);var _e=z(ce,2),ve=e=>{var t=dD(),n=L(t),r=L(n,!0);j(n);var i=z(n),o=L(i),s=L(o,!0);j(o);var c=z(o),l=L(c,!0);j(c),j(i),j(t),B((e,t,n)=>{G(r,e),o.disabled=V(a),G(s,t),c.disabled=V(a),G(l,n)},[()=>Y(`templates.folder_actions`),()=>Y(`templates.rename`),()=>Y(`common.remove`)]),H(`click`,o,()=>pe(`rename`)),H(`click`,c,()=>he(!0)),W(e,t)};K(_e,e=>{V(ee)&&e(ve)});var ye=z(_e,2),be=e=>{var t=fD(),n=L(t),r=L(n,!0);j(n);var i=z(n,2);ki(i);var o=z(i,2),s=L(o,!0);j(o);var c=z(o,2),l=L(c),u=L(l,!0);j(l);var d=z(l),f=L(d,!0);j(d),j(c),j(t),B((e,t,n,o)=>{G(r,e),i.disabled=V(a),J(i,`aria-invalid`,!!V(x)),G(s,V(x)),l.disabled=t,G(u,n),d.disabled=V(a),G(f,o)},[()=>Y(V(v)===`new`?`templates.new_folder`:`templates.rename_folder`),()=>V(a)||!V(y).trim(),()=>Y(V(v)===`new`?`common.create`:`common.save`),()=>Y(`common.cancel`)]),Nr(`submit`,t,e=>{e.preventDefault(),me()}),Fi(i,()=>V(y),e=>F(y,e)),H(`click`,d,()=>ie(()=>{})),W(e,t)};K(ye,e=>{V(v)&&e(be)}),j(i);var xe=z(i,2),Se=L(xe),Ce=L(Se,!0);j(Se);var we=z(Se);ki(we);var Te=z(we,2),Ee=L(Te,!0);j(Te);var De=z(Te,2);q(De,21,()=>V(ne),e=>e.id,(e,t)=>{var n=pD();let r;var i=L(n),o=L(i,!0);j(i);var s=z(i),c=L(s,!0);j(s),j(n),B(()=>{r=vi(n,1,`template-item svelte-3z3jlz`,null,r,{chosen:V(u)===V(t).id}),J(n,`aria-pressed`,V(u)===V(t).id),n.disabled=V(a),G(o,V(t).name),G(c,V(t).folderName)}),H(`click`,n,()=>ue(V(t).id)),W(e,n)},e=>{var t=hD(),n=L(t),i=L(n,!0);j(n);var a=z(n),o=L(a,!0);j(a);var s=z(a),l=e=>{var t=mD(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`templates.new_folder`)]),H(`click`,t,()=>pe(`new`)),W(e,t)};K(s,e=>{V(r).folders.length||e(l)}),j(t),B((e,t)=>{G(i,e),G(o,t)},[()=>Y(V(r).folders.length?V(c)?`templates.no_results`:`templates.folder_empty`:`templates.welcome`),()=>Y(V(r).folders.length?V(c)?`templates.search_hint`:`templates.empty_hint`:`templates.start_hint`)]),W(e,t)}),j(De),j(xe);var Oe=z(xe,2),ke=L(Oe),Ae=L(ke);j(ke);var je=z(ke,2),Me=e=>{var t=_D(),n=L(t),i=L(n),o=L(i,!0);j(i);var s=z(i),c=L(s,!0);j(s),j(n);var l=z(n,2),u=L(l),d=L(u,!0);j(u);var g=z(u),v=L(g),y=L(v,!0);j(v);var b=z(v),x=L(b,!0);j(b),j(g),j(l);var S=z(l,2),w=L(S),T=L(w),E=L(T,!0);j(T);var D=z(T);ki(D);var ee=z(D),te=L(ee,!0);j(ee),j(w);var O=z(w),ne=L(O),k=L(ne,!0);j(ne);var re=z(ne);q(re,21,()=>V(r).folders,Qr,(e,t)=>{var n=gD(),r=L(n,!0);j(n);var i={};B(()=>{G(r,V(t).name),i!==(i=V(t).id)&&(n.value=(n.__value=V(t).id)??``)}),W(e,n)}),j(re),j(O),j(S);var ae=z(S,2),oe=L(ae,!0);j(ae);var se=z(ae,2),ce=L(se);yn(ce);var le=z(ce),ue=L(le),de=L(ue,!0);j(ue);var pe=z(ue),me=e=>{aD(e,{get content(){return V(m)}})};K(pe,e=>{V(C)&&e(me)}),j(le),j(se),j(t),B((e,t,n,r,i,s,l,u,f,p)=>{G(o,e),G(c,t),G(d,n),v.disabled=V(a),G(y,r),b.disabled=i,G(x,s),G(E,l),D.disabled=V(a),J(D,`aria-invalid`,!!V(_)),G(te,V(_)),G(k,u),re.disabled=V(a),G(oe,f),ce.disabled=V(a),G(de,p)},[()=>Y(V(f)?`templates.edit`:`templates.new_template`),()=>Y(V(A)?`templates.unsaved`:`templates.no_changes`),()=>Y(`templates.save_shortcut`),()=>Y(`common.cancel`),()=>V(a)||!V(p).trim()||!V(h),()=>Y(`templates.save_template`),()=>Y(`templates.name`),()=>Y(`templates.folder`),()=>Y(`templates.content`),()=>Y(`templates.preview`)]),Nr(`submit`,t,e=>{e.preventDefault(),fe()}),H(`click`,v,()=>ie(()=>{})),Fi(D,()=>V(p),e=>F(p,e)),Ci(re,()=>V(h),e=>F(h,e)),Fi(ce,()=>V(m),e=>F(m,e)),Wi(`open`,`toggle`,le,e=>F(C,e),()=>V(C)),W(e,t)},Ne=e=>{var t=yD(),n=R(t),r=L(n),i=L(r);j(r);var o=z(r),s=L(o,!0);j(o);var c=z(o),l=L(c),u=L(l,!0);j(l);var d=z(l),f=L(d,!0);j(d);var p=z(d),m=L(p),h=L(m,!0);j(m);var g=z(m),_=L(g),v=L(_,!0);j(_);var y=z(_),b=L(y,!0);j(y),j(g),j(p),j(c);var x=z(c),C=L(x,!0);j(x),j(n);var w=z(n,2),E=L(w),D=L(E,!0);j(E);var ee=z(E),O=L(ee,!0);j(ee),j(w);var ne=z(w,2),k=L(ne),A=e=>{var t=vD(),n=L(t,!0);j(t),B(()=>G(n,V(te).content)),W(e,t)},re=e=>{aD(e,{get content(){return V(te).content}})};K(k,e=>{V(S)?e(A):e(re,-1)}),j(ne),B((e,t,n,r,o,c,p,m,g)=>{G(i,`${V(te).folderName??``} / ${e??``}`),G(s,V(te).name),l.disabled=V(a),G(u,t),d.disabled=V(a),G(f,n),G(h,r),_.disabled=V(a),G(v,o),y.disabled=V(a),G(b,c),G(C,p),G(D,m),J(ee,`aria-pressed`,V(S)),G(O,g)},[()=>Y(`templates.template`),()=>Y(`templates.use`),()=>Y(`templates.edit`),()=>Y(`templates.more`),()=>Y(`templates.duplicate`),()=>Y(`common.remove`),()=>Y(`templates.independent`),()=>Y(`templates.preview`),()=>Y(V(S)?`templates.formatted`:`templates.source`)]),H(`click`,l,()=>F(T,V(te)?.id,!0)),H(`click`,d,()=>de(V(te))),H(`click`,_,()=>de(V(te),!0)),H(`click`,y,()=>he(!1)),H(`click`,ee,()=>F(S,!V(S))),W(e,t)},Pe=e=>{var t=bD(),n=L(t),r=L(n,!0);j(n);var i=z(n),a=L(i,!0);j(i),j(t),B((e,t)=>{G(r,e),G(a,t)},[()=>Y(`templates.select_template`),()=>Y(`templates.preview_hint`)]),W(e,t)};K(je,e=>{V(d)?e(Me):V(te)?e(Ne,1):e(Pe,-1)}),j(Oe),j(t),B((e,r,o,s,c,u,d,f,p,m,h)=>{n=vi(t,1,`library-layout svelte-3z3jlz`,null,n,{"show-detail":V(w)}),J(i,`aria-label`,e),G(g,r),b.disabled=V(a),G(E,o),k=vi(O,1,`folder-item svelte-3z3jlz`,null,k,{chosen:!V(l)}),J(O,`aria-pressed`,!V(l)),O.disabled=V(a),G(re,s),G(oe,V(D).length),G(ge,c),J(xe,`aria-label`,u),G(Ce,d),J(we,`placeholder`,f),G(Ee,p),J(Oe,`aria-label`,m),ke.disabled=V(a),G(Ae,`← ${h??``}`)},[()=>Y(`templates.folders`),()=>Y(`templates.folders`),()=>Y(`templates.add_folder`),()=>Y(`templates.all`),()=>Y(`templates.folder_hint`),()=>Y(`templates.menu`),()=>Y(`templates.search`),()=>Y(`templates.search_placeholder`),()=>Y(`templates.result_count`,{count:String(V(ne).length)}),()=>Y(`templates.detail`),()=>Y(`templates.back_list`)]),H(`click`,b,()=>pe(`new`)),H(`click`,O,()=>le(``)),Fi(we,()=>V(c),e=>F(c,e)),H(`click`,ke,()=>ie(()=>{F(w,!1)})),W(e,t)};K(Pe,e=>{V(i)?e(Ie,-1):e(Fe)}),j(ye);var Le=z(ye,2),Re=e=>{Ja(e,{open:!0,get initialTemplateId(){return V(T)},onclose:()=>F(T,void 0),onsuccess:e=>{window.location.href=`/?doc=`+encodeURIComponent(e)}})};K(Le,e=>{V(T)&&e(Re)}),B((e,t,n)=>{J(ye,`aria-busy`,V(a)),G(Ce,e),G(Te,t),Ee.disabled=V(a)||!V(i)||!V(r).folders.length,G(De,` ${n??``}`)},[()=>Y(`templates.library`),()=>Y(`templates.library_subtitle`),()=>Y(`templates.new_template`)]),H(`click`,Ee,()=>de()),W(e,_e),Je()}Pr([`click`]);var wD=U(`<div class="app-shell templates-shell svelte-j6d35n"><!> <!></div>`);function TD(e,t){qe(t,!1),Ji(async()=>{try{let e=await fetch(`/api/config`);e.ok&&await Ca((await e.json()).language||`en`)}catch{}}),Gi();var n=wD(),r=L(n);{let e=bt(()=>Y(`templates.library`));es(r,{get title(){return V(e)},subtitle:``})}CD(z(r,2),{}),j(n),W(e,n),Je()}var ED=I({tasks:[],notes:[],links:[]}),DD=!1,OD=null;async function kD(){try{let e=await fetch(`/api/survival-kit`);if(e.ok){let t=await e.json();ED.tasks=Array.isArray(t.tasks)?t.tasks:[],ED.notes=Array.isArray(t.notes)?t.notes:[],ED.links=Array.isArray(t.links)?t.links:[]}}catch{}finally{DD=!0}}async function AD(){try{await fetch(`/api/survival-kit`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({tasks:ED.tasks,notes:ED.notes,links:ED.links})})}catch{}}function jD(){DD&&(OD&&clearTimeout(OD),OD=setTimeout(()=>{OD=null,AD()},400))}var MD=U(`<button type="button"> </button>`),ND=U(`<p class="sk-empty svelte-lo2xyl"> </p>`),PD=U(`<div><button type="button" aria-label="toggle"></button> <span class="sk-task-text svelte-lo2xyl"> </span> <span class="sk-task-tag svelte-lo2xyl"> </span> <button type="button" class="sk-task-del svelte-lo2xyl">✕</button></div>`),FD=U(`<div class="sk-panel-head"><h2 class="sk-panel-title"> <span class="sk-accent">.</span></h2> <p class="sk-panel-sub"> </p></div> <div class="sk-add-bar svelte-lo2xyl"><input type="text" class="svelte-lo2xyl"/> <select class="svelte-lo2xyl"><option> </option><option> </option><option> </option></select> <button type="button" class="sk-add-btn svelte-lo2xyl">+</button></div> <div class="sk-filters svelte-lo2xyl"></div> <div class="sk-tasks svelte-lo2xyl"><!></div>`,1);function ID(e,t){qe(t,!0);let n=P(``),r=P(`normal`),i=P(`all`),a=[{key:`all`,label:()=>Y(`survival.tasks_filter_all`)},{key:`todo`,label:()=>Y(`survival.tasks_filter_todo`)},{key:`done`,label:()=>Y(`survival.tasks_filter_done`)},{key:`urgent`,label:()=>Y(`survival.tasks_filter_urgent`)},{key:`normal`,label:()=>Y(`survival.tasks_filter_normal`)},{key:`later`,label:()=>Y(`survival.tasks_filter_later`)}];function o(e){return Y(`survival.tasks_priority_${e}`)}let s=N(()=>ED.tasks.filter(e=>V(i)===`todo`?!e.done:V(i)===`done`?e.done:V(i)===`urgent`||V(i)===`normal`||V(i)===`later`?e.priority===V(i):!0));function c(){let e=V(n).trim();e&&(ED.tasks.unshift({id:Date.now(),text:e,priority:V(r),done:!1}),F(n,``),jD())}function l(e){let t=ED.tasks.find(t=>t.id===e);t&&(t.done=!t.done),jD()}function u(e){ED.tasks=ED.tasks.filter(t=>t.id!==e),jD()}var d=FD(),f=R(d),p=L(f),m=L(p,!0);Ie(),j(p);var h=z(p,2),g=L(h,!0);j(h),j(f);var _=z(f,2),v=L(_);ki(v);var y=z(v,2),b=L(y),x=L(b,!0);j(b),b.value=b.__value=`normal`;var S=z(b),C=L(S,!0);j(S),S.value=S.__value=`urgent`;var w=z(S),T=L(w,!0);j(w),w.value=w.__value=`later`,j(y);var E=z(y,2);j(_);var D=z(_,2);q(D,21,()=>a,Qr,(e,t)=>{var n=MD();let r;var a=L(n,!0);j(n),B(e=>{r=vi(n,1,`svelte-lo2xyl`,null,r,{active:V(i)===V(t).key}),G(a,e)},[()=>V(t).label()]),H(`click`,n,()=>F(i,V(t).key,!0)),W(e,n)}),j(D);var ee=z(D,2),te=L(ee),O=e=>{var t=ND(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`survival.tasks_empty`)]),W(e,t)},ne=e=>{var t=Wr();q(R(t),17,()=>V(s),e=>e.id,(e,t)=>{var n=PD();let r;var i=L(n);let a;var s=z(i,2),c=L(s,!0);j(s);var d=z(s,2),f=L(d,!0);j(d);var p=z(d,2);j(n),B((e,o)=>{r=vi(n,1,`sk-task sk-task--${V(t).priority??``}`,`svelte-lo2xyl`,r,{done:V(t).done}),a=vi(i,1,`sk-check svelte-lo2xyl`,null,a,{checked:V(t).done}),G(c,V(t).text),G(f,e),J(p,`title`,o)},[()=>o(V(t).priority),()=>Y(`survival.tasks_delete_title`)]),H(`click`,i,()=>l(V(t).id)),H(`click`,p,()=>u(V(t).id)),W(e,n)}),W(e,t)};K(te,e=>{V(s).length===0?e(O):e(ne,-1)}),j(ee),B((e,t,n,r,i,a)=>{G(m,e),G(g,t),J(v,`placeholder`,n),G(x,r),G(C,i),G(T,a)},[()=>Y(`survival.tasks_title`),()=>Y(`survival.tasks_subtitle`),()=>Y(`survival.tasks_input_placeholder`),()=>Y(`survival.tasks_priority_normal`),()=>Y(`survival.tasks_priority_urgent`),()=>Y(`survival.tasks_priority_later`)]),H(`keydown`,v,e=>e.key===`Enter`&&c()),Fi(v,()=>V(n),e=>F(n,e)),Ci(y,()=>V(r),e=>F(r,e)),H(`click`,E,c),W(e,d),Je()}Pr([`keydown`,`click`]);var LD=[`t-green`,`t-violet`,`t-amber`,`t-sky`,`t-rose`,`t-teal`],RD=U(`<div class="sk-modal-backdrop svelte-1rcj86" role="presentation"><div class="sk-modal svelte-1rcj86" role="dialog" aria-modal="true"><h3 class="sk-modal-title svelte-1rcj86"> </h3> <div class="sk-modal-body svelte-1rcj86"><!></div> <div class="sk-modal-actions svelte-1rcj86"><button type="button" class="sk-btn svelte-1rcj86"> </button> <button type="button"> </button></div></div></div>`);function zD(e,t){qe(t,!0);let n=qi(t,`open`,3,!1),r=qi(t,`title`,3,``),i=qi(t,`confirmLabel`,19,()=>Y(`common.save`)),a=qi(t,`danger`,3,!1);function o(e){e.target===e.currentTarget&&t.onClose()}function s(e){e.key===`Escape`&&t.onClose()}var c=Wr(),l=R(c),u=e=>{var n=RD(),c=L(n),l=L(c),u=L(l,!0);j(l);var d=z(l,2);ci(L(d),()=>t.children),j(d);var f=z(d,2),p=L(f),m=L(p,!0);j(p);var h=z(p,2);let g;var _=L(h,!0);j(h),j(f),j(c),j(n),B(e=>{G(u,r()),G(m,e),g=vi(h,1,`sk-btn sk-btn--primary svelte-1rcj86`,null,g,{"sk-btn--danger":a()}),G(_,i())},[()=>Y(`common.cancel`)]),H(`click`,n,o),H(`keydown`,n,s),H(`click`,p,function(...e){t.onClose?.apply(this,e)}),H(`click`,h,function(...e){t.onConfirm?.apply(this,e)}),W(e,n)};K(l,e=>{n()&&e(u)}),W(e,c),Je()}Pr([`click`,`keydown`]);var BD=U(`<p class="sk-empty svelte-hpbata"> </p>`),VD=U(`<strong> </strong>`),HD=U(`<p> </p>`),UD=U(`<div class="sk-pre-wrap svelte-hpbata"><pre> </pre> <button type="button" class="sk-copy svelte-hpbata"> </button></div>`),WD=U(`<li> </li>`),GD=U(`<ul></ul>`),KD=U(`<th> </th>`),qD=U(`<td> </td>`),JD=U(`<tr></tr>`),YD=U(`<div class="sk-table-wrap svelte-hpbata"><table><thead><tr></tr></thead><tbody></tbody></table></div>`),XD=U(`<div class="sk-bloc svelte-hpbata"><div class="sk-bloc-content svelte-hpbata"><!></div> <div class="sk-bloc-actions svelte-hpbata"><button type="button" class="sk-mini svelte-hpbata">✎</button> <button type="button" class="sk-mini sk-mini--del svelte-hpbata">✕</button></div></div>`),ZD=U(`<div><div class="sk-note-head svelte-hpbata"><h3 class="svelte-hpbata"> </h3> <div class="sk-note-actions svelte-hpbata"><button type="button" class="sk-mini svelte-hpbata">✎</button> <button type="button" class="sk-mini sk-mini--del svelte-hpbata">✕</button></div> <button type="button" class="sk-toggle svelte-hpbata" aria-label="toggle"><svg viewBox="0 0 10 6" width="10" height="6"><path d="M1 1 L5 5 L9 1" stroke="currentColor" stroke-width="1.5" fill="none" stroke-linecap="round" stroke-linejoin="round"></path></svg></button></div> <div class="sk-note-body svelte-hpbata"><!> <div class="sk-note-foot svelte-hpbata"><button type="button" class="sk-add-bloc svelte-hpbata"> </button></div></div></div>`),QD=U(`<option> </option>`),$D=U(`<label for="sk-note-titre"> </label> <input id="sk-note-titre" type="text"/> <label for="sk-note-color"> </label> <select id="sk-note-color"></select>`,1),eO=U(`<input id="sk-bloc-content" type="text"/>`),tO=U(`<textarea id="sk-bloc-content" rows="6"></textarea>`),nO=U(`<label for="sk-bloc-type"> </label> <select id="sk-bloc-type"><option> </option><option> </option><option> </option><option> </option><option> </option></select> <label for="sk-bloc-content"> </label> <!>`,1),rO=U(`<div class="sk-panel-head"><h2 class="sk-panel-title"> <span class="sk-accent">.</span></h2> <p class="sk-panel-sub"> </p></div> <div class="sk-toolbar svelte-hpbata"><button type="button" class="sk-tool svelte-hpbata"> </button> <button type="button" class="sk-tool svelte-hpbata"> </button> <button type="button" class="sk-tool sk-tool--add svelte-hpbata"> </button></div> <div><!> <!></div> <!> <!>`,1);function iO(e,t){qe(t,!0);let n=P(!1),r=P(I({})),i=P(null),a=P(!1),o=P(-1),s=P(``),c=P(`t-green`),l=P(!1),u=P(-1),d=P(-1),f=P(`p`),p=P(``),m={"t-green":`survival.color_green`,"t-violet":`survival.color_violet`,"t-amber":`survival.color_amber`,"t-sky":`survival.color_sky`,"t-rose":`survival.color_rose`,"t-teal":`survival.color_teal`},h=N(()=>ED.notes.length>0&&ED.notes.every(e=>V(r)[e.id]));function g(e){V(r)[e]=!V(r)[e]}function _(){if(V(h))F(r,{},!0);else{let e={};ED.notes.forEach(t=>e[t.id]=!0),F(r,e,!0)}}function v(){F(o,-1),F(s,``),F(c,`t-green`),F(a,!0)}function y(e){F(o,e,!0),F(s,ED.notes[e].titre,!0),F(c,ED.notes[e].theme,!0),F(a,!0)}function b(){let e=V(s).trim();if(e){if(V(o)===-1){let t=Date.now();ED.notes.push({id:t,theme:V(c),titre:e,blocs:[]}),V(r)[t]=!0}else ED.notes[V(o)].titre=e,ED.notes[V(o)].theme=V(c);jD(),F(a,!1)}}async function x(e){await t.confirmDelete(Y(`survival.confirm_del_note_title`),Y(`survival.confirm_del_note_msg`))&&(ED.notes.splice(e,1),jD())}function S(e){return e.type===`ul`?e.items.join(`
|
|
322
|
+
`}tablerow(e){return`<tr>\n${e}</tr>\n`}tablecell(e,t){let n=t.header?`th`:`td`;return(t.align?`<${n} align="${t.align}">`:`<${n}>`)+e+`</${n}>\n`}strong(e){return`<strong>${e}</strong>`}em(e){return`<em>${e}</em>`}codespan(e){return`<code>${e}</code>`}br(){return`<br>`}del(e){return`<del>${e}</del>`}link(e,t,n){let r=oE(e);if(r===null)return n;e=r;let i=`<a href="`+e+`"`;return t&&(i+=` title="`+t+`"`),i+=`>`+n+`</a>`,i}image(e,t,n){let r=oE(e);if(r===null)return n;e=r;let i=`<img src="${e}" alt="${n}"`;return t&&(i+=` title="${t}"`),i+=`>`,i}text(e){return e}},oD=class{strong(e){return e}em(e){return e}codespan(e){return e}del(e){return e}html(e){return e}text(e){return e}link(e,t,n){return``+n}image(e,t,n){return``+n}br(){return``}},sD=class e{options;renderer;textRenderer;constructor(e){this.options=e||qT,this.options.renderer=this.options.renderer||new aD,this.renderer=this.options.renderer,this.renderer.options=this.options,this.textRenderer=new oD}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e,t=!0){let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){let e=i,t=this.options.extensions.renderers[e.type].call({parser:this},e);if(t!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`html`,`paragraph`,`text`].includes(e.type)){n+=t||``;continue}}switch(i.type){case`space`:continue;case`hr`:n+=this.renderer.hr();continue;case`heading`:{let e=i;n+=this.renderer.heading(this.parseInline(e.tokens),e.depth,rE(this.parseInline(e.tokens,this.textRenderer)));continue}case`code`:{let e=i;n+=this.renderer.code(e.text,e.lang,!!e.escaped);continue}case`table`:{let e=i,t=``,r=``;for(let t=0;t<e.header.length;t++)r+=this.renderer.tablecell(this.parseInline(e.header[t].tokens),{header:!0,align:e.align[t]});t+=this.renderer.tablerow(r);let a=``;for(let t=0;t<e.rows.length;t++){let n=e.rows[t];r=``;for(let t=0;t<n.length;t++)r+=this.renderer.tablecell(this.parseInline(n[t].tokens),{header:!1,align:e.align[t]});a+=this.renderer.tablerow(r)}n+=this.renderer.table(t,a);continue}case`blockquote`:{let e=i,t=this.parse(e.tokens);n+=this.renderer.blockquote(t);continue}case`list`:{let e=i,t=e.ordered,r=e.start,a=e.loose,o=``;for(let t=0;t<e.items.length;t++){let n=e.items[t],r=n.checked,i=n.task,s=``;if(n.task){let e=this.renderer.checkbox(!!r);a?n.tokens.length>0&&n.tokens[0].type===`paragraph`?(n.tokens[0].text=e+` `+n.tokens[0].text,n.tokens[0].tokens&&n.tokens[0].tokens.length>0&&n.tokens[0].tokens[0].type===`text`&&(n.tokens[0].tokens[0].text=e+` `+n.tokens[0].tokens[0].text)):n.tokens.unshift({type:`text`,text:e+` `}):s+=e+` `}s+=this.parse(n.tokens,a),o+=this.renderer.listitem(s,i,!!r)}n+=this.renderer.list(o,t,r);continue}case`html`:{let e=i;n+=this.renderer.html(e.text,e.block);continue}case`paragraph`:{let e=i;n+=this.renderer.paragraph(this.parseInline(e.tokens));continue}case`text`:{let a=i,o=a.tokens?this.parseInline(a.tokens):a.text;for(;r+1<e.length&&e[r+1].type===`text`;)a=e[++r],o+=`
|
|
323
|
+
`+(a.tokens?this.parseInline(a.tokens):a.text);n+=t?this.renderer.paragraph(o):o;continue}default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}parseInline(e,t){t||=this.renderer;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions&&this.options.extensions.renderers&&this.options.extensions.renderers[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}switch(i.type){case`escape`:{let e=i;n+=t.text(e.text);break}case`html`:{let e=i;n+=t.html(e.text);break}case`link`:{let e=i;n+=t.link(e.href,e.title,this.parseInline(e.tokens,t));break}case`image`:{let e=i;n+=t.image(e.href,e.title,e.text);break}case`strong`:{let e=i;n+=t.strong(this.parseInline(e.tokens,t));break}case`em`:{let e=i;n+=t.em(this.parseInline(e.tokens,t));break}case`codespan`:{let e=i;n+=t.codespan(e.text);break}case`br`:n+=t.br();break;case`del`:{let e=i;n+=t.del(this.parseInline(e.tokens,t));break}case`text`:{let e=i;n+=t.text(e.text);break}default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},cD=class{options;constructor(e){this.options=e||qT}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}},lD=new class{defaults=KT();options=this.setOptions;parse=this.#e(iD.lex,sD.parse);parseInline=this.#e(iD.lexInline,sD.parseInline);Parser=sD;Renderer=aD;TextRenderer=oD;Lexer=iD;Tokenizer=pE;Hooks=cD;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(n=n.concat(t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)n=n.concat(this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)n=n.concat(this.walkTokens(e.tokens,t));break}case`list`:{let e=r;n=n.concat(this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);n=n.concat(this.walkTokens(i,t))}):e.tokens&&(n=n.concat(this.walkTokens(e.tokens,t)))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new aD(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if(n===`options`)continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new pE(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new cD;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if(n===`options`)continue;let r=n,i=e.hooks[r],a=t[r];cD.passThroughHooks.has(n)?t[r]=e=>{if(this.defaults.async)return Promise.resolve(i.call(t,e)).then(e=>a.call(t,e));let n=i.call(t,e);return a.call(t,n)}:t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&(n=n.concat(t.call(this,e))),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return iD.lex(e,t??this.defaults)}parser(e,t){return sD.parse(e,t??this.defaults)}#e(e,t){return(n,r)=>{let i={...r},a={...this.defaults,...i};this.defaults.async===!0&&i.async===!1&&(a.silent||console.warn(`marked(): The async option was set to true by an extension. The async: false option sent to parse will be ignored.`),a.async=!0);let o=this.#t(!!a.silent,!!a.async);if(n==null)return o(Error(`marked(): input parameter is undefined or null`));if(typeof n!=`string`)return o(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(n)+`, string expected`));if(a.hooks&&(a.hooks.options=a),a.async)return Promise.resolve(a.hooks?a.hooks.preprocess(n):n).then(t=>e(t,a)).then(e=>a.hooks?a.hooks.processAllTokens(e):e).then(e=>a.walkTokens?Promise.all(this.walkTokens(e,a.walkTokens)).then(()=>e):e).then(e=>t(e,a)).then(e=>a.hooks?a.hooks.postprocess(e):e).catch(o);try{a.hooks&&(n=a.hooks.preprocess(n));let r=e(n,a);a.hooks&&(r=a.hooks.processAllTokens(r)),a.walkTokens&&this.walkTokens(r,a.walkTokens);let i=t(r,a);return a.hooks&&(i=a.hooks.postprocess(i)),i}catch(e){return o(e)}}}#t(e,t){return n=>{if(n.message+=`
|
|
324
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+tE(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function uD(e,t){return lD.parse(e,t)}uD.options=uD.setOptions=function(e){return lD.setOptions(e),uD.defaults=lD.defaults,JT(uD.defaults),uD},uD.getDefaults=KT,uD.defaults=qT,uD.use=function(...e){return lD.use(...e),uD.defaults=lD.defaults,JT(uD.defaults),uD},uD.walkTokens=function(e,t){return lD.walkTokens(e,t)},uD.parseInline=lD.parseInline,uD.Parser=sD,uD.parser=sD.parse,uD.Renderer=aD,uD.TextRenderer=oD,uD.Lexer=iD,uD.lexer=iD.lex,uD.Tokenizer=pE,uD.Hooks=cD,uD.parse=uD,uD.options,uD.setOptions,uD.use,uD.walkTokens,uD.parseInline,sD.parse,iD.lex;var dD=/<!--[\s\S]*?(?:-->|$)|<(pre|code|script|style|textarea)\b(?:"[^"]*"|'[^']*'|[^'">])*?>[\s\S]*?(?:<\/\1\s*>|$)|(<summary\b(?:"[^"]*"|'[^']*'|[^'">])*?>)([\s\S]*?)(<\/summary\s*>)|<\/?[a-z][a-z0-9-]*\b(?:"[^"]*"|'[^']*'|[^'">])*?>/gi;function fD(e,t){return e.replace(dD,(e,n,r,i,a)=>{if(n||!r)return e;let o=i.trim(),s=/^(#{1,6})(?:[ \t]+(.*)|$)$/.exec(o);if(s){let e=s[1].length,n=(s[2]??``).replace(/[ \t]+#+[ \t]*$/,``);return`${r}<h${e} style="display: inline; margin: 0">${uD.parseInline(n,t)}</h${e}>${a}`}return`${r}${uD.parseInline(i,t)}${a}`})}function pD(e,t={}){let n={...uD.defaults,...t},r=uD.lexer(e,n);return uD.walkTokens(r,e=>{e.type===`html`&&(e.text=fD(e.text,n))}),uD.parser(r,n)}var mD=U(`<iframe sandbox="" class="svelte-zodsi8"></iframe>`);function hD(e,t){qe(t,!0);let n=P(!1);Ji(()=>{let e=()=>{F(n,document.documentElement.classList.contains(`dark`),!0)};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>t.disconnect()});let r=N(()=>pD(t.content.replace(/^---\r?\n[\s\S]*?\r?\n---(?:\r?\n|$)/,``),{async:!1})),i=N(()=>`<!doctype html><html><head><meta http-equiv="Content-Security-Policy" content="default-src 'none'; style-src 'unsafe-inline'; img-src data:;"><style>html{color-scheme:${V(n)?`dark`:`light`}}body{font:15px/1.7 system-ui;margin:24px;overflow-wrap:anywhere}h1{font-size:1.7em}h2{font-size:1.3em}pre{overflow:auto;padding:16px;background:light-dark(#f1f5f9,#1e293b);border-radius:8px}code{font-family:monospace}table{border-collapse:collapse;width:100%}th,td{border:1px solid #8886;padding:8px;text-align:left}blockquote{border-left:3px solid #8886;padding-left:16px;margin-left:0}img{max-width:100%}a{color:light-dark(#2563eb,#93c5fd)}</style></head><body>${V(r)}</body></html>`);var a=Wr();Zr(R(a),()=>V(i),e=>{var t=mD();B(e=>{J(t,`title`,e),J(t,`srcdoc`,V(i))},[()=>Y(`templates.preview`)]),W(e,t)}),W(e,a),Je()}var gD=U(`<span> </span>`),_D=U(`<span class="success svelte-3z3jlz"> </span>`),vD=U(`<div role="alert" class="error svelte-3z3jlz"><span> </span><button class="secondary-button svelte-3z3jlz"> </button></div>`),yD=U(`<p> </p>`),bD=U(`<button><span class="svelte-3z3jlz"> </span><span class="svelte-3z3jlz"> </span></button>`),xD=U(`<details class="folder-actions"><summary class="svelte-3z3jlz"> </summary><div class="actions svelte-3z3jlz"><button class="secondary-button svelte-3z3jlz"> </button><button class="text-button danger svelte-3z3jlz" data-testid="template-delete-folder"> </button></div></details>`),SD=U(`<form class="folder-form svelte-3z3jlz"><label for="template-folder-input" class="svelte-3z3jlz"> </label> <input id="template-folder-input" maxlength="120" aria-describedby="template-folder-error" class="svelte-3z3jlz"/> <span id="template-folder-error" class="error svelte-3z3jlz" role="alert"> </span> <div class="actions svelte-3z3jlz"><button class="primary-button svelte-3z3jlz" data-testid="template-add-folder"> </button><button type="button" class="text-button svelte-3z3jlz"> </button></div></form>`),CD=U(`<button><span class="item-title svelte-3z3jlz"> </span><span class="hint svelte-3z3jlz"> </span></button>`),wD=U(`<button class="primary-button svelte-3z3jlz"> </button>`),TD=U(`<div class="empty svelte-3z3jlz"><h2 class="svelte-3z3jlz"> </h2><p class="svelte-3z3jlz"> </p><!></div>`),ED=U(`<option> </option>`),DD=U(`<form class="edit-form svelte-3z3jlz"><div class="pane-heading svelte-3z3jlz"><h2 class="svelte-3z3jlz"> </h2><span class="draft-status svelte-3z3jlz"> </span></div> <footer class="editor-footer svelte-3z3jlz"><span class="hint svelte-3z3jlz"> </span><div class="actions svelte-3z3jlz"><button type="button" class="secondary-button svelte-3z3jlz"> </button><button class="primary-button svelte-3z3jlz" data-testid="template-save"> </button></div></footer> <div class="fields svelte-3z3jlz"><div><label for="template-name" class="svelte-3z3jlz"> </label><input id="template-name" maxlength="120" aria-describedby="template-name-error" class="svelte-3z3jlz"/><span class="error svelte-3z3jlz" id="template-name-error" role="alert"> </span></div><div><label for="template-destination" class="svelte-3z3jlz"> </label><select id="template-destination" class="svelte-3z3jlz"></select></div></div> <label for="template-content" class="svelte-3z3jlz"> </label> <div class="editor-body svelte-3z3jlz"><textarea id="template-content" maxlength="1000000" spellcheck="false" class="svelte-3z3jlz"></textarea><details class="live-preview svelte-3z3jlz"><summary class="svelte-3z3jlz"> </summary><!></details></div></form>`),OD=U(`<pre class="svelte-3z3jlz"> </pre>`),kD=U(`<div class="detail-heading svelte-3z3jlz"><span class="eyebrow svelte-3z3jlz"> </span><h2 class="svelte-3z3jlz"> </h2><div class="actions svelte-3z3jlz"><button class="primary-button svelte-3z3jlz"> </button><button class="secondary-button svelte-3z3jlz" id="template-edit" data-testid="template-edit"> </button><details class="more-actions svelte-3z3jlz"><summary class="svelte-3z3jlz"> </summary><div class="actions svelte-3z3jlz"><button class="text-button svelte-3z3jlz"> </button><button class="text-button danger svelte-3z3jlz"> </button></div></details></div><p class="hint svelte-3z3jlz"> </p></div> <div class="preview-heading svelte-3z3jlz"><h3 class="svelte-3z3jlz"> </h3><button class="text-button svelte-3z3jlz"> </button></div> <div class="preview-content svelte-3z3jlz"><!></div>`,1),AD=U(`<div class="empty svelte-3z3jlz"><h2 class="svelte-3z3jlz"> </h2><p class="svelte-3z3jlz"> </p></div>`),jD=U(`<div><aside class="folder-pane svelte-3z3jlz"><div class="pane-heading svelte-3z3jlz"><h2 class="svelte-3z3jlz"> </h2><button class="text-button svelte-3z3jlz"> </button></div> <button> <span class="svelte-3z3jlz"> </span></button> <!> <p class="hint svelte-3z3jlz"> </p> <!> <!></aside> <section class="list-pane svelte-3z3jlz"><label for="template-search" class="svelte-3z3jlz"> </label><input type="search" id="template-search" class="svelte-3z3jlz"/> <div class="list-caption svelte-3z3jlz"> </div> <div class="template-list svelte-3z3jlz"></div></section> <section class="detail-pane svelte-3z3jlz"><button class="text-button mobile-back svelte-3z3jlz"> </button> <!></section></div>`),MD=U(`<!> <div class="template-library svelte-3z3jlz" data-testid="templates-manager"><header class="library-heading svelte-3z3jlz"><div><h1 class="svelte-3z3jlz"> </h1><p class="svelte-3z3jlz"> </p></div> <button class="primary-button svelte-3z3jlz" data-testid="template-new"><span aria-hidden="true">+</span> </button></header> <div class="feedback svelte-3z3jlz" aria-live="polite"><!> <!></div> <!></div> <!>`,1);function ND(e,t){qe(t,!0);let n=Pa(),r=P(I({version:1,folders:[]})),i=P(!1),a=P(!1),o=P(``),s=P(``),c=P(``),l=P(``),u=P(``),d=P(!1),f=P(``),p=P(``),m=P(``),h=P(``),g=P(``),_=P(``),v=P(null),y=P(``),b=P(``),x=P(``),S=P(!1),C=P(!1),w=P(!1),T=P(void 0),E,D=N(()=>V(r).folders.flatMap(e=>e.templates.map(t=>({...t,folderId:e.id,folderName:e.name})))),ee=N(()=>V(r).folders.find(e=>e.id===V(l))),te=N(()=>V(D).find(e=>e.id===V(u))),O=e=>e.normalize(`NFD`).replace(/[\u0300-\u036f]/g,``).toLocaleLowerCase(),ne=N(()=>V(D).filter(e=>(!V(l)||e.folderId===V(l))&&O(e.name+` `+e.content).includes(O(V(c))))),k=()=>JSON.stringify([V(p),V(m),V(h)]),A=N(()=>V(d)&&k()!==V(g)||V(v)!==null&&V(y)!==V(b));async function re(){if(V(a))return!1;if(!V(A))return!0;let e=await E.show({title:Y(`templates.unsaved_title`),message:Y(`templates.unsaved_message`),confirmLabel:Y(`templates.discard`),cancelLabel:Y(`templates.keep_editing`),danger:!0});return e&&(F(d,!1),F(v,null)),e}async function ie(e){await re()&&(F(d,!1),F(v,null),F(o,``),F(s,``),await e())}async function ae(){F(r,await n(),!0),F(i,!0),V(l)&&!V(r).folders.some(e=>e.id===V(l))&&F(l,``),V(D).some(e=>e.id===V(u))||F(u,V(D)[0]?.id||``,!0)}async function oe(e){if(!V(a)){F(a,!0),F(o,``),F(s,``);try{await e()}catch(e){F(o,e instanceof Error?e.message:Y(`templates.errors.storage_error`),!0)}finally{F(a,!1)}}}let se=()=>ie(()=>oe(ae));Ji(()=>(oe(ae),Wo(re)));function ce(e){(V(A)||V(a))&&(e.preventDefault(),e.returnValue=``)}async function le(e){await ie(()=>{F(l,e,!0),F(w,!1),F(u,V(D).find(t=>!e||t.folderId===e)?.id||``,!0)})}async function ue(e){await ie(()=>{F(u,e,!0),F(w,!0),F(S,!1)})}async function de(e,t=!1){await ie(async()=>{if(F(f,t?``:e?.id||``,!0),F(h,e?.folderId||V(l)||V(r).folders[0]?.id||``,!0),F(p,e?.name||``,!0),t&&e){let t=Y(`templates.copy_name`,{name:e.name});F(p,t,!0);let n=2;for(;V(D).some(e=>e.folderId===V(h)&&e.name.toLocaleLowerCase()===V(p).toLocaleLowerCase());)F(p,`${t} ${n++}`)}F(m,e?.content||``,!0),F(g,t?``:k(),!0),F(_,``),F(d,!0),F(w,!0),await xr(),document.getElementById(`template-name`)?.focus()})}async function fe(){if(F(_,``),!V(p).trim()||V(p).trim().length>120){F(_,Y(`templates.errors.invalid_name`),!0);return}if(V(D).some(e=>e.id!==V(f)&&e.folderId===V(h)&&e.name.toLocaleLowerCase()===V(p).trim().toLocaleLowerCase())){F(_,Y(`templates.errors.duplicate_name`),!0);return}await oe(async()=>{let e=await n(V(f)?`/${V(f)}`:`/folders/${V(h)}/templates`,V(f)?`PUT`:`POST`,{name:V(p),content:V(m),folderId:V(h)});F(r,{...V(r),folders:V(r).folders.map(t=>({...t,templates:[...t.templates.filter(t=>t.id!==e.id),...t.id===V(h)?[e]:[]]}))},!0),F(u,e.id,!0),F(l,V(h),!0),F(c,``),F(d,!1),F(S,!1),F(s,Y(`templates.saved`),!0),await xr(),document.getElementById(`template-edit`)?.focus()})}async function pe(e){await ie(async()=>{F(y,e===`rename`&&V(ee)?.name||``,!0),F(b,V(y),!0),F(v,e,!0),F(x,``),await xr(),document.getElementById(`template-folder-input`)?.focus()})}async function me(){if(!V(y).trim()||V(y).trim().length>120){F(x,Y(`templates.errors.invalid_name`),!0);return}if(V(r).folders.some(e=>(V(v)===`new`||e.id!==V(l))&&e.name.toLocaleLowerCase()===V(y).trim().toLocaleLowerCase())){F(x,Y(`templates.errors.duplicate_name`),!0);return}await oe(async()=>{let e=await n(V(v)===`new`?`/folders`:`/folders/${V(l)}`,V(v)===`new`?`POST`:`PUT`,{name:V(y)});F(r,{...V(r),folders:V(v)===`new`?[...V(r).folders,e]:V(r).folders.map(t=>t.id===e.id?e:t)},!0),F(l,e.id,!0),F(u,e.templates[0]?.id||``,!0),F(v,null),F(x,``),F(s,Y(`templates.folder_saved`),!0)})}async function he(e){if(!await re())return;let t=V(e?ee:te);t&&await E.show({title:Y(e?`templates.delete_folder`:`templates.delete_template`),message:Y(`templates.delete_message`,{name:t.name}),detail:e?Y(`templates.delete_count`,{count:String(V(ee)?.templates.length||0)}):Y(`templates.independent`),confirmLabel:Y(`common.remove`),cancelLabel:Y(`common.cancel`),danger:!0})&&await oe(async()=>{await n(e?`/folders/${t.id}?confirm=true`:`/${t.id}`,`DELETE`),F(r,{...V(r),folders:e?V(r).folders.filter(e=>e.id!==t.id):V(r).folders.map(e=>({...e,templates:e.templates.filter(e=>e.id!==t.id)}))},!0),e&&F(l,``),F(u,V(D).find(e=>!V(l)||e.folderId===V(l))?.id||``,!0),F(d,!1),F(w,!1),F(s,Y(`templates.deleted`),!0)})}function ge(e){(e.metaKey||e.ctrlKey)&&e.key.toLowerCase()===`s`&&V(d)&&(e.preventDefault(),V(a)||fe())}var _e=MD();Nr(`beforeunload`,on,ce),Nr(`keydown`,on,ge);var ve=R(_e);Ui($d(ve,{}),e=>E=e,()=>E);var ye=z(ve,2),be=L(ye),xe=L(be),Se=L(xe),Ce=L(Se,!0);j(Se);var we=z(Se),Te=L(we,!0);j(we),j(xe);var Ee=z(xe,2),De=z(L(Ee));j(Ee),j(be);var Oe=z(be,2),ke=L(Oe),Ae=e=>{var t=gD(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`common.loading`)]),W(e,t)},je=e=>{var t=_D(),n=L(t);j(t),B(()=>G(n,`✓ ${V(s)??``}`)),W(e,t)};K(ke,e=>{V(a)?e(Ae):V(s)&&e(je,1)});var Me=z(ke,2),Ne=e=>{var t=vD(),n=L(t),r=L(n,!0);j(n);var i=z(n),s=L(i,!0);j(i),j(t),B(e=>{G(r,V(o)),i.disabled=V(a),G(s,e)},[()=>Y(`templates.reload`)]),H(`click`,i,se),W(e,t)};K(Me,e=>{V(o)&&e(Ne)}),j(Oe);var Pe=z(Oe,2),Fe=e=>{var t=Wr(),n=R(t),r=e=>{var t=yD(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`templates.load_failed`)]),W(e,t)};K(n,e=>{!V(a)&&V(o)&&e(r)}),W(e,t)},Ie=e=>{var t=jD();let n;var i=L(t),o=L(i),s=L(o),g=L(s,!0);j(s);var b=z(s),E=L(b,!0);j(b),j(o);var O=z(o,2);let k;var re=L(O,!0),ae=z(re),oe=L(ae,!0);j(ae),j(O);var se=z(O,2);q(se,17,()=>V(r).folders,e=>e.id,(e,t)=>{var n=bD();let r;var i=L(n),o=L(i);j(i);var s=z(i),c=L(s,!0);j(s),j(n),B(()=>{r=vi(n,1,`folder-item svelte-3z3jlz`,null,r,{chosen:V(l)===V(t).id}),J(n,`aria-pressed`,V(l)===V(t).id),n.disabled=V(a),G(o,`▱ ${V(t).name??``}`),G(c,V(t).templates.length)}),H(`click`,n,()=>le(V(t).id)),W(e,n)});var ce=z(se,2),ge=L(ce,!0);j(ce);var _e=z(ce,2),ve=e=>{var t=xD(),n=L(t),r=L(n,!0);j(n);var i=z(n),o=L(i),s=L(o,!0);j(o);var c=z(o),l=L(c,!0);j(c),j(i),j(t),B((e,t,n)=>{G(r,e),o.disabled=V(a),G(s,t),c.disabled=V(a),G(l,n)},[()=>Y(`templates.folder_actions`),()=>Y(`templates.rename`),()=>Y(`common.remove`)]),H(`click`,o,()=>pe(`rename`)),H(`click`,c,()=>he(!0)),W(e,t)};K(_e,e=>{V(ee)&&e(ve)});var ye=z(_e,2),be=e=>{var t=SD(),n=L(t),r=L(n,!0);j(n);var i=z(n,2);ki(i);var o=z(i,2),s=L(o,!0);j(o);var c=z(o,2),l=L(c),u=L(l,!0);j(l);var d=z(l),f=L(d,!0);j(d),j(c),j(t),B((e,t,n,o)=>{G(r,e),i.disabled=V(a),J(i,`aria-invalid`,!!V(x)),G(s,V(x)),l.disabled=t,G(u,n),d.disabled=V(a),G(f,o)},[()=>Y(V(v)===`new`?`templates.new_folder`:`templates.rename_folder`),()=>V(a)||!V(y).trim(),()=>Y(V(v)===`new`?`common.create`:`common.save`),()=>Y(`common.cancel`)]),Nr(`submit`,t,e=>{e.preventDefault(),me()}),Fi(i,()=>V(y),e=>F(y,e)),H(`click`,d,()=>ie(()=>{})),W(e,t)};K(ye,e=>{V(v)&&e(be)}),j(i);var xe=z(i,2),Se=L(xe),Ce=L(Se,!0);j(Se);var we=z(Se);ki(we);var Te=z(we,2),Ee=L(Te,!0);j(Te);var De=z(Te,2);q(De,21,()=>V(ne),e=>e.id,(e,t)=>{var n=CD();let r;var i=L(n),o=L(i,!0);j(i);var s=z(i),c=L(s,!0);j(s),j(n),B(()=>{r=vi(n,1,`template-item svelte-3z3jlz`,null,r,{chosen:V(u)===V(t).id}),J(n,`aria-pressed`,V(u)===V(t).id),n.disabled=V(a),G(o,V(t).name),G(c,V(t).folderName)}),H(`click`,n,()=>ue(V(t).id)),W(e,n)},e=>{var t=TD(),n=L(t),i=L(n,!0);j(n);var a=z(n),o=L(a,!0);j(a);var s=z(a),l=e=>{var t=wD(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`templates.new_folder`)]),H(`click`,t,()=>pe(`new`)),W(e,t)};K(s,e=>{V(r).folders.length||e(l)}),j(t),B((e,t)=>{G(i,e),G(o,t)},[()=>Y(V(r).folders.length?V(c)?`templates.no_results`:`templates.folder_empty`:`templates.welcome`),()=>Y(V(r).folders.length?V(c)?`templates.search_hint`:`templates.empty_hint`:`templates.start_hint`)]),W(e,t)}),j(De),j(xe);var Oe=z(xe,2),ke=L(Oe),Ae=L(ke);j(ke);var je=z(ke,2),Me=e=>{var t=DD(),n=L(t),i=L(n),o=L(i,!0);j(i);var s=z(i),c=L(s,!0);j(s),j(n);var l=z(n,2),u=L(l),d=L(u,!0);j(u);var g=z(u),v=L(g),y=L(v,!0);j(v);var b=z(v),x=L(b,!0);j(b),j(g),j(l);var S=z(l,2),w=L(S),T=L(w),E=L(T,!0);j(T);var D=z(T);ki(D);var ee=z(D),te=L(ee,!0);j(ee),j(w);var O=z(w),ne=L(O),k=L(ne,!0);j(ne);var re=z(ne);q(re,21,()=>V(r).folders,Qr,(e,t)=>{var n=ED(),r=L(n,!0);j(n);var i={};B(()=>{G(r,V(t).name),i!==(i=V(t).id)&&(n.value=(n.__value=V(t).id)??``)}),W(e,n)}),j(re),j(O),j(S);var ae=z(S,2),oe=L(ae,!0);j(ae);var se=z(ae,2),ce=L(se);yn(ce);var le=z(ce),ue=L(le),de=L(ue,!0);j(ue);var pe=z(ue),me=e=>{hD(e,{get content(){return V(m)}})};K(pe,e=>{V(C)&&e(me)}),j(le),j(se),j(t),B((e,t,n,r,i,s,l,u,f,p)=>{G(o,e),G(c,t),G(d,n),v.disabled=V(a),G(y,r),b.disabled=i,G(x,s),G(E,l),D.disabled=V(a),J(D,`aria-invalid`,!!V(_)),G(te,V(_)),G(k,u),re.disabled=V(a),G(oe,f),ce.disabled=V(a),G(de,p)},[()=>Y(V(f)?`templates.edit`:`templates.new_template`),()=>Y(V(A)?`templates.unsaved`:`templates.no_changes`),()=>Y(`templates.save_shortcut`),()=>Y(`common.cancel`),()=>V(a)||!V(p).trim()||!V(h),()=>Y(`templates.save_template`),()=>Y(`templates.name`),()=>Y(`templates.folder`),()=>Y(`templates.content`),()=>Y(`templates.preview`)]),Nr(`submit`,t,e=>{e.preventDefault(),fe()}),H(`click`,v,()=>ie(()=>{})),Fi(D,()=>V(p),e=>F(p,e)),Ci(re,()=>V(h),e=>F(h,e)),Fi(ce,()=>V(m),e=>F(m,e)),Wi(`open`,`toggle`,le,e=>F(C,e),()=>V(C)),W(e,t)},Ne=e=>{var t=kD(),n=R(t),r=L(n),i=L(r);j(r);var o=z(r),s=L(o,!0);j(o);var c=z(o),l=L(c),u=L(l,!0);j(l);var d=z(l),f=L(d,!0);j(d);var p=z(d),m=L(p),h=L(m,!0);j(m);var g=z(m),_=L(g),v=L(_,!0);j(_);var y=z(_),b=L(y,!0);j(y),j(g),j(p),j(c);var x=z(c),C=L(x,!0);j(x),j(n);var w=z(n,2),E=L(w),D=L(E,!0);j(E);var ee=z(E),O=L(ee,!0);j(ee),j(w);var ne=z(w,2),k=L(ne),A=e=>{var t=OD(),n=L(t,!0);j(t),B(()=>G(n,V(te).content)),W(e,t)},re=e=>{hD(e,{get content(){return V(te).content}})};K(k,e=>{V(S)?e(A):e(re,-1)}),j(ne),B((e,t,n,r,o,c,p,m,g)=>{G(i,`${V(te).folderName??``} / ${e??``}`),G(s,V(te).name),l.disabled=V(a),G(u,t),d.disabled=V(a),G(f,n),G(h,r),_.disabled=V(a),G(v,o),y.disabled=V(a),G(b,c),G(C,p),G(D,m),J(ee,`aria-pressed`,V(S)),G(O,g)},[()=>Y(`templates.template`),()=>Y(`templates.use`),()=>Y(`templates.edit`),()=>Y(`templates.more`),()=>Y(`templates.duplicate`),()=>Y(`common.remove`),()=>Y(`templates.independent`),()=>Y(`templates.preview`),()=>Y(V(S)?`templates.formatted`:`templates.source`)]),H(`click`,l,()=>F(T,V(te)?.id,!0)),H(`click`,d,()=>de(V(te))),H(`click`,_,()=>de(V(te),!0)),H(`click`,y,()=>he(!1)),H(`click`,ee,()=>F(S,!V(S))),W(e,t)},Pe=e=>{var t=AD(),n=L(t),r=L(n,!0);j(n);var i=z(n),a=L(i,!0);j(i),j(t),B((e,t)=>{G(r,e),G(a,t)},[()=>Y(`templates.select_template`),()=>Y(`templates.preview_hint`)]),W(e,t)};K(je,e=>{V(d)?e(Me):V(te)?e(Ne,1):e(Pe,-1)}),j(Oe),j(t),B((e,r,o,s,c,u,d,f,p,m,h)=>{n=vi(t,1,`library-layout svelte-3z3jlz`,null,n,{"show-detail":V(w)}),J(i,`aria-label`,e),G(g,r),b.disabled=V(a),G(E,o),k=vi(O,1,`folder-item svelte-3z3jlz`,null,k,{chosen:!V(l)}),J(O,`aria-pressed`,!V(l)),O.disabled=V(a),G(re,s),G(oe,V(D).length),G(ge,c),J(xe,`aria-label`,u),G(Ce,d),J(we,`placeholder`,f),G(Ee,p),J(Oe,`aria-label`,m),ke.disabled=V(a),G(Ae,`← ${h??``}`)},[()=>Y(`templates.folders`),()=>Y(`templates.folders`),()=>Y(`templates.add_folder`),()=>Y(`templates.all`),()=>Y(`templates.folder_hint`),()=>Y(`templates.menu`),()=>Y(`templates.search`),()=>Y(`templates.search_placeholder`),()=>Y(`templates.result_count`,{count:String(V(ne).length)}),()=>Y(`templates.detail`),()=>Y(`templates.back_list`)]),H(`click`,b,()=>pe(`new`)),H(`click`,O,()=>le(``)),Fi(we,()=>V(c),e=>F(c,e)),H(`click`,ke,()=>ie(()=>{F(w,!1)})),W(e,t)};K(Pe,e=>{V(i)?e(Ie,-1):e(Fe)}),j(ye);var Le=z(ye,2),Re=e=>{Ja(e,{open:!0,get initialTemplateId(){return V(T)},onclose:()=>F(T,void 0),onsuccess:e=>{window.location.href=`/?doc=`+encodeURIComponent(e)}})};K(Le,e=>{V(T)&&e(Re)}),B((e,t,n)=>{J(ye,`aria-busy`,V(a)),G(Ce,e),G(Te,t),Ee.disabled=V(a)||!V(i)||!V(r).folders.length,G(De,` ${n??``}`)},[()=>Y(`templates.library`),()=>Y(`templates.library_subtitle`),()=>Y(`templates.new_template`)]),H(`click`,Ee,()=>de()),W(e,_e),Je()}Pr([`click`]);var PD=U(`<div class="app-shell templates-shell svelte-j6d35n"><!> <!></div>`);function FD(e,t){qe(t,!1),Ji(async()=>{try{let e=await fetch(`/api/config`);e.ok&&await Ca((await e.json()).language||`en`)}catch{}}),Gi();var n=PD(),r=L(n);{let e=bt(()=>Y(`templates.library`));es(r,{get title(){return V(e)},subtitle:``})}ND(z(r,2),{}),j(n),W(e,n),Je()}var ID=I({tasks:[],notes:[],links:[]}),LD=!1,RD=null;async function zD(){try{let e=await fetch(`/api/survival-kit`);if(e.ok){let t=await e.json();ID.tasks=Array.isArray(t.tasks)?t.tasks:[],ID.notes=Array.isArray(t.notes)?t.notes:[],ID.links=Array.isArray(t.links)?t.links:[]}}catch{}finally{LD=!0}}async function BD(){try{await fetch(`/api/survival-kit`,{method:`PUT`,headers:{"Content-Type":`application/json`},body:JSON.stringify({tasks:ID.tasks,notes:ID.notes,links:ID.links})})}catch{}}function VD(){LD&&(RD&&clearTimeout(RD),RD=setTimeout(()=>{RD=null,BD()},400))}var HD=U(`<button type="button"> </button>`),UD=U(`<p class="sk-empty svelte-lo2xyl"> </p>`),WD=U(`<div><button type="button" aria-label="toggle"></button> <span class="sk-task-text svelte-lo2xyl"> </span> <span class="sk-task-tag svelte-lo2xyl"> </span> <button type="button" class="sk-task-del svelte-lo2xyl">✕</button></div>`),GD=U(`<div class="sk-panel-head"><h2 class="sk-panel-title"> <span class="sk-accent">.</span></h2> <p class="sk-panel-sub"> </p></div> <div class="sk-add-bar svelte-lo2xyl"><input type="text" class="svelte-lo2xyl"/> <select class="svelte-lo2xyl"><option> </option><option> </option><option> </option></select> <button type="button" class="sk-add-btn svelte-lo2xyl">+</button></div> <div class="sk-filters svelte-lo2xyl"></div> <div class="sk-tasks svelte-lo2xyl"><!></div>`,1);function KD(e,t){qe(t,!0);let n=P(``),r=P(`normal`),i=P(`all`),a=[{key:`all`,label:()=>Y(`survival.tasks_filter_all`)},{key:`todo`,label:()=>Y(`survival.tasks_filter_todo`)},{key:`done`,label:()=>Y(`survival.tasks_filter_done`)},{key:`urgent`,label:()=>Y(`survival.tasks_filter_urgent`)},{key:`normal`,label:()=>Y(`survival.tasks_filter_normal`)},{key:`later`,label:()=>Y(`survival.tasks_filter_later`)}];function o(e){return Y(`survival.tasks_priority_${e}`)}let s=N(()=>ID.tasks.filter(e=>V(i)===`todo`?!e.done:V(i)===`done`?e.done:V(i)===`urgent`||V(i)===`normal`||V(i)===`later`?e.priority===V(i):!0));function c(){let e=V(n).trim();e&&(ID.tasks.unshift({id:Date.now(),text:e,priority:V(r),done:!1}),F(n,``),VD())}function l(e){let t=ID.tasks.find(t=>t.id===e);t&&(t.done=!t.done),VD()}function u(e){ID.tasks=ID.tasks.filter(t=>t.id!==e),VD()}var d=GD(),f=R(d),p=L(f),m=L(p,!0);Ie(),j(p);var h=z(p,2),g=L(h,!0);j(h),j(f);var _=z(f,2),v=L(_);ki(v);var y=z(v,2),b=L(y),x=L(b,!0);j(b),b.value=b.__value=`normal`;var S=z(b),C=L(S,!0);j(S),S.value=S.__value=`urgent`;var w=z(S),T=L(w,!0);j(w),w.value=w.__value=`later`,j(y);var E=z(y,2);j(_);var D=z(_,2);q(D,21,()=>a,Qr,(e,t)=>{var n=HD();let r;var a=L(n,!0);j(n),B(e=>{r=vi(n,1,`svelte-lo2xyl`,null,r,{active:V(i)===V(t).key}),G(a,e)},[()=>V(t).label()]),H(`click`,n,()=>F(i,V(t).key,!0)),W(e,n)}),j(D);var ee=z(D,2),te=L(ee),O=e=>{var t=UD(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`survival.tasks_empty`)]),W(e,t)},ne=e=>{var t=Wr();q(R(t),17,()=>V(s),e=>e.id,(e,t)=>{var n=WD();let r;var i=L(n);let a;var s=z(i,2),c=L(s,!0);j(s);var d=z(s,2),f=L(d,!0);j(d);var p=z(d,2);j(n),B((e,o)=>{r=vi(n,1,`sk-task sk-task--${V(t).priority??``}`,`svelte-lo2xyl`,r,{done:V(t).done}),a=vi(i,1,`sk-check svelte-lo2xyl`,null,a,{checked:V(t).done}),G(c,V(t).text),G(f,e),J(p,`title`,o)},[()=>o(V(t).priority),()=>Y(`survival.tasks_delete_title`)]),H(`click`,i,()=>l(V(t).id)),H(`click`,p,()=>u(V(t).id)),W(e,n)}),W(e,t)};K(te,e=>{V(s).length===0?e(O):e(ne,-1)}),j(ee),B((e,t,n,r,i,a)=>{G(m,e),G(g,t),J(v,`placeholder`,n),G(x,r),G(C,i),G(T,a)},[()=>Y(`survival.tasks_title`),()=>Y(`survival.tasks_subtitle`),()=>Y(`survival.tasks_input_placeholder`),()=>Y(`survival.tasks_priority_normal`),()=>Y(`survival.tasks_priority_urgent`),()=>Y(`survival.tasks_priority_later`)]),H(`keydown`,v,e=>e.key===`Enter`&&c()),Fi(v,()=>V(n),e=>F(n,e)),Ci(y,()=>V(r),e=>F(r,e)),H(`click`,E,c),W(e,d),Je()}Pr([`keydown`,`click`]);var qD=[`t-green`,`t-violet`,`t-amber`,`t-sky`,`t-rose`,`t-teal`],JD=U(`<div class="sk-modal-backdrop svelte-1rcj86" role="presentation"><div class="sk-modal svelte-1rcj86" role="dialog" aria-modal="true"><h3 class="sk-modal-title svelte-1rcj86"> </h3> <div class="sk-modal-body svelte-1rcj86"><!></div> <div class="sk-modal-actions svelte-1rcj86"><button type="button" class="sk-btn svelte-1rcj86"> </button> <button type="button"> </button></div></div></div>`);function YD(e,t){qe(t,!0);let n=qi(t,`open`,3,!1),r=qi(t,`title`,3,``),i=qi(t,`confirmLabel`,19,()=>Y(`common.save`)),a=qi(t,`danger`,3,!1);function o(e){e.target===e.currentTarget&&t.onClose()}function s(e){e.key===`Escape`&&t.onClose()}var c=Wr(),l=R(c),u=e=>{var n=JD(),c=L(n),l=L(c),u=L(l,!0);j(l);var d=z(l,2);ci(L(d),()=>t.children),j(d);var f=z(d,2),p=L(f),m=L(p,!0);j(p);var h=z(p,2);let g;var _=L(h,!0);j(h),j(f),j(c),j(n),B(e=>{G(u,r()),G(m,e),g=vi(h,1,`sk-btn sk-btn--primary svelte-1rcj86`,null,g,{"sk-btn--danger":a()}),G(_,i())},[()=>Y(`common.cancel`)]),H(`click`,n,o),H(`keydown`,n,s),H(`click`,p,function(...e){t.onClose?.apply(this,e)}),H(`click`,h,function(...e){t.onConfirm?.apply(this,e)}),W(e,n)};K(l,e=>{n()&&e(u)}),W(e,c),Je()}Pr([`click`,`keydown`]);var XD=U(`<p class="sk-empty svelte-hpbata"> </p>`),ZD=U(`<strong> </strong>`),QD=U(`<p> </p>`),$D=U(`<div class="sk-pre-wrap svelte-hpbata"><pre> </pre> <button type="button" class="sk-copy svelte-hpbata"> </button></div>`),eO=U(`<li> </li>`),tO=U(`<ul></ul>`),nO=U(`<th> </th>`),rO=U(`<td> </td>`),iO=U(`<tr></tr>`),aO=U(`<div class="sk-table-wrap svelte-hpbata"><table><thead><tr></tr></thead><tbody></tbody></table></div>`),oO=U(`<div class="sk-bloc svelte-hpbata"><div class="sk-bloc-content svelte-hpbata"><!></div> <div class="sk-bloc-actions svelte-hpbata"><button type="button" class="sk-mini svelte-hpbata">✎</button> <button type="button" class="sk-mini sk-mini--del svelte-hpbata">✕</button></div></div>`),sO=U(`<div><div class="sk-note-head svelte-hpbata"><h3 class="svelte-hpbata"> </h3> <div class="sk-note-actions svelte-hpbata"><button type="button" class="sk-mini svelte-hpbata">✎</button> <button type="button" class="sk-mini sk-mini--del svelte-hpbata">✕</button></div> <button type="button" class="sk-toggle svelte-hpbata" aria-label="toggle"><svg viewBox="0 0 10 6" width="10" height="6"><path d="M1 1 L5 5 L9 1" stroke="currentColor" stroke-width="1.5" fill="none" stroke-linecap="round" stroke-linejoin="round"></path></svg></button></div> <div class="sk-note-body svelte-hpbata"><!> <div class="sk-note-foot svelte-hpbata"><button type="button" class="sk-add-bloc svelte-hpbata"> </button></div></div></div>`),cO=U(`<option> </option>`),lO=U(`<label for="sk-note-titre"> </label> <input id="sk-note-titre" type="text"/> <label for="sk-note-color"> </label> <select id="sk-note-color"></select>`,1),uO=U(`<input id="sk-bloc-content" type="text"/>`),dO=U(`<textarea id="sk-bloc-content" rows="6"></textarea>`),fO=U(`<label for="sk-bloc-type"> </label> <select id="sk-bloc-type"><option> </option><option> </option><option> </option><option> </option><option> </option></select> <label for="sk-bloc-content"> </label> <!>`,1),pO=U(`<div class="sk-panel-head"><h2 class="sk-panel-title"> <span class="sk-accent">.</span></h2> <p class="sk-panel-sub"> </p></div> <div class="sk-toolbar svelte-hpbata"><button type="button" class="sk-tool svelte-hpbata"> </button> <button type="button" class="sk-tool svelte-hpbata"> </button> <button type="button" class="sk-tool sk-tool--add svelte-hpbata"> </button></div> <div><!> <!></div> <!> <!>`,1);function mO(e,t){qe(t,!0);let n=P(!1),r=P(I({})),i=P(null),a=P(!1),o=P(-1),s=P(``),c=P(`t-green`),l=P(!1),u=P(-1),d=P(-1),f=P(`p`),p=P(``),m={"t-green":`survival.color_green`,"t-violet":`survival.color_violet`,"t-amber":`survival.color_amber`,"t-sky":`survival.color_sky`,"t-rose":`survival.color_rose`,"t-teal":`survival.color_teal`},h=N(()=>ID.notes.length>0&&ID.notes.every(e=>V(r)[e.id]));function g(e){V(r)[e]=!V(r)[e]}function _(){if(V(h))F(r,{},!0);else{let e={};ID.notes.forEach(t=>e[t.id]=!0),F(r,e,!0)}}function v(){F(o,-1),F(s,``),F(c,`t-green`),F(a,!0)}function y(e){F(o,e,!0),F(s,ID.notes[e].titre,!0),F(c,ID.notes[e].theme,!0),F(a,!0)}function b(){let e=V(s).trim();if(e){if(V(o)===-1){let t=Date.now();ID.notes.push({id:t,theme:V(c),titre:e,blocs:[]}),V(r)[t]=!0}else ID.notes[V(o)].titre=e,ID.notes[V(o)].theme=V(c);VD(),F(a,!1)}}async function x(e){await t.confirmDelete(Y(`survival.confirm_del_note_title`),Y(`survival.confirm_del_note_msg`))&&(ID.notes.splice(e,1),VD())}function S(e){return e.type===`ul`?e.items.join(`
|
|
325
325
|
`):e.type===`table`?[e.headers.join(` | `),...e.rows.map(e=>e.join(` | `))].join(`
|
|
326
|
-
`):e.content}function C(e){F(u,e,!0),F(d,-1),F(f,`p`),F(p,``),F(l,!0)}function w(e,t){F(u,e,!0),F(d,t,!0);let n=
|
|
326
|
+
`):e.content}function C(e){F(u,e,!0),F(d,-1),F(f,`p`),F(p,``),F(l,!0)}function w(e,t){F(u,e,!0),F(d,t,!0);let n=ID.notes[e].blocs[t];F(f,n.type,!0),F(p,S(n),!0),F(l,!0)}function T(){let e=V(p);if(!e.trim())return null;if(V(f)===`ul`){let t=e.split(`
|
|
327
327
|
`).map(e=>e.trim()).filter(Boolean);return t.length?{type:`ul`,items:t}:null}if(V(f)===`table`){let t=e.split(`
|
|
328
|
-
`).map(e=>e.trim()).filter(Boolean);return t.length?{type:`table`,headers:t[0].split(`|`).map(e=>e.trim()),rows:t.slice(1).map(e=>e.split(`|`).map(e=>e.trim()))}:null}return{type:V(f),content:e}}function E(){let e=T();e&&(V(d)===-1?ED.notes[V(u)].blocs.push(e):ED.notes[V(u)].blocs[V(d)]=e,jD(),F(l,!1))}async function D(e,n){await t.confirmDelete(Y(`survival.confirm_del_bloc_title`),Y(`survival.irreversible`))&&(ED.notes[e].blocs.splice(n,1),jD())}async function ee(e,t){try{await navigator.clipboard.writeText(e),F(i,t,!0),setTimeout(()=>F(i,V(i)===t?null:V(i),!0),1500)}catch{}}let te=N(()=>V(f)===`ul`?Y(`survival.modal_bloc_placeholder_ul`):V(f)===`pre`?Y(`survival.modal_bloc_placeholder_pre`):V(f)===`table`?Y(`survival.modal_bloc_placeholder_table`):V(f)===`b`?Y(`survival.modal_bloc_placeholder_b`):Y(`survival.modal_bloc_placeholder_p`));var O=rO(),ne=R(O),k=L(ne),A=L(k,!0);Ie(),j(k);var re=z(k,2),ie=L(re,!0);j(re),j(ne);var ae=z(ne,2),oe=L(ae),se=L(oe,!0);j(oe);var ce=z(oe,2),le=L(ce,!0);j(ce);var ue=z(ce,2),de=L(ue,!0);j(ue),j(ae);var fe=z(ae,2);let pe;var me=L(fe),he=e=>{var t=BD(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`survival.notes_empty`)]),W(e,t)};K(me,e=>{ED.notes.length===0&&e(he)}),q(z(me,2),19,()=>ED.notes,e=>e.id,(e,t,n)=>{let a=N(()=>!V(r)[V(t).id]);var o=ZD();let s;var c=L(o),l=L(c),u=L(l,!0);j(l);var d=z(l,2),f=L(d),p=z(f,2);j(d);var m=z(d,2);j(c);var h=z(c,2),_=L(h);q(_,17,()=>V(t).blocs,Qr,(e,r,a)=>{var o=XD(),s=L(o),c=L(s),l=e=>{var t=VD(),n=L(t,!0);j(t),B(()=>G(n,V(r).content)),W(e,t)},u=e=>{var t=HD(),n=L(t,!0);j(t),B(()=>G(n,V(r).content)),W(e,t)},d=e=>{let n=N(()=>`${V(t).id}-${a}`);var o=UD(),s=L(o),c=L(s,!0);j(s);var l=z(s,2),u=L(l,!0);j(l),j(o),B(e=>{G(c,V(r).content),G(u,e)},[()=>V(i)===V(n)?Y(`survival.notes_btn_copied`):Y(`survival.notes_btn_copy`)]),H(`click`,l,()=>ee(V(r).content,V(n))),W(e,o)},f=e=>{var t=GD();q(t,21,()=>V(r).items,Qr,(e,t)=>{var n=WD(),r=L(n,!0);j(n),B(()=>G(r,V(t))),W(e,n)}),j(t),W(e,t)},p=e=>{var t=YD(),n=L(t),i=L(n),a=L(i);q(a,21,()=>V(r).headers,Qr,(e,t)=>{var n=KD(),r=L(n,!0);j(n),B(()=>G(r,V(t))),W(e,n)}),j(a),j(i);var o=z(i);q(o,21,()=>V(r).rows,Qr,(e,t)=>{var n=JD();q(n,21,()=>V(t),Qr,(e,t)=>{var n=qD(),r=L(n,!0);j(n),B(()=>G(r,V(t))),W(e,n)}),j(n),W(e,n)}),j(o),j(n),j(t),W(e,t)};K(c,e=>{V(r).type===`b`?e(l):V(r).type===`p`?e(u,1):V(r).type===`pre`?e(d,2):V(r).type===`ul`?e(f,3):V(r).type===`table`&&e(p,4)}),j(s);var m=z(s,2),h=L(m),g=z(h,2);j(m),j(o),H(`click`,h,()=>w(V(n),a)),H(`click`,g,()=>D(V(n),a)),W(e,o)});var v=z(_,2),b=L(v),S=L(b,!0);j(b),j(v),j(h),j(o),B(e=>{s=vi(o,1,`sk-note ${V(t).theme??``}`,`svelte-hpbata`,s,{collapsed:V(a)}),G(u,V(t).titre),G(S,e)},[()=>Y(`survival.notes_btn_add_bloc`)]),H(`click`,f,()=>y(V(n))),H(`click`,p,()=>x(V(n))),H(`click`,m,()=>g(V(t).id)),H(`click`,b,()=>C(V(n))),W(e,o)}),j(fe);var ge=z(fe,2);{let e=N(()=>V(o)===-1?Y(`survival.modal_note_title`):Y(`survival.modal_edit_note_title`)),t=N(()=>V(o)===-1?Y(`common.create`):Y(`common.save`));zD(ge,{get open(){return V(a)},get title(){return V(e)},get confirmLabel(){return V(t)},onConfirm:b,onClose:()=>F(a,!1),children:(e,t)=>{var n=$D(),r=R(n),i=L(r,!0);j(r);var a=z(r,2);ki(a);var o=z(a,2),l=L(o,!0);j(o);var u=z(o,2);q(u,21,()=>LD,Qr,(e,t)=>{var n=QD(),r=L(n,!0);j(n);var i={};B(e=>{G(r,e),i!==(i=V(t))&&(n.value=(n.__value=V(t))??``)},[()=>Y(m[V(t)])]),W(e,n)}),j(u),B((e,t,n)=>{G(i,e),J(a,`placeholder`,t),G(l,n)},[()=>Y(`survival.modal_note_label_title`),()=>Y(`survival.modal_note_placeholder`),()=>Y(`survival.modal_label_color`)]),H(`keydown`,a,e=>e.key===`Enter`&&b()),Fi(a,()=>V(s),e=>F(s,e)),Ci(u,()=>V(c),e=>F(c,e)),W(e,n)},$$slots:{default:!0}})}var _e=z(ge,2);{let e=N(()=>V(d)===-1?Y(`survival.modal_bloc_new`):Y(`survival.modal_bloc_edit`)),t=N(()=>Y(`common.save`));zD(_e,{get open(){return V(l)},get title(){return V(e)},get confirmLabel(){return V(t)},onConfirm:E,onClose:()=>F(l,!1),children:(e,t)=>{var n=nO(),r=R(n),i=L(r,!0);j(r);var a=z(r,2),o=L(a),s=L(o,!0);j(o),o.value=o.__value=`b`;var c=z(o),l=L(c,!0);j(c),c.value=c.__value=`p`;var u=z(c),d=L(u,!0);j(u),u.value=u.__value=`pre`;var m=z(u),h=L(m,!0);j(m),m.value=m.__value=`ul`;var g=z(m),_=L(g,!0);j(g),g.value=g.__value=`table`,j(a);var v=z(a,2),y=L(v,!0);j(v);var b=z(v,2),x=e=>{var t=eO();ki(t),B(()=>J(t,`placeholder`,V(te))),H(`keydown`,t,e=>e.key===`Enter`&&E()),Fi(t,()=>V(p),e=>F(p,e)),W(e,t)},S=e=>{var t=tO();yn(t),B(()=>J(t,`placeholder`,V(te))),Fi(t,()=>V(p),e=>F(p,e)),W(e,t)};K(b,e=>{V(f)===`b`?e(x):e(S,-1)}),B((e,t,n,r,a,o,c)=>{G(i,e),G(s,t),G(l,n),G(d,r),G(h,a),G(_,o),G(y,c)},[()=>Y(`survival.modal_bloc_label_type`),()=>Y(`survival.modal_bloc_type_b`),()=>Y(`survival.modal_bloc_type_p`),()=>Y(`survival.modal_bloc_type_pre`),()=>Y(`survival.modal_bloc_type_ul`),()=>Y(`survival.modal_bloc_type_table`),()=>Y(`survival.modal_bloc_label_content`)]),Ci(a,()=>V(f),e=>F(f,e)),W(e,n)},$$slots:{default:!0}})}B((e,t,r,i,a)=>{G(A,e),G(ie,t),G(se,r),G(le,i),G(de,a),pe=vi(fe,1,`sk-notes svelte-hpbata`,null,pe,{"edit-mode":V(n)})},[()=>Y(`survival.notes_title`),()=>Y(`survival.notes_subtitle`),()=>V(n)?Y(`survival.btn_read_mode`):Y(`survival.btn_edit_mode`),()=>V(h)?Y(`survival.btn_collapse_all`):Y(`survival.btn_expand_all`),()=>Y(`survival.notes_btn_add`)]),H(`click`,oe,()=>F(n,!V(n))),H(`click`,ce,_),H(`click`,ue,v),W(e,O),Je()}Pr([`click`,`keydown`]);var aO=U(`<p class="sk-empty svelte-1j811iq"> </p>`),oO=U(`<span class="sk-link-desc svelte-1j811iq"> </span>`),sO=U(`<a target="_blank" rel="noopener" class="sk-link svelte-1j811iq"><span class="sk-link-text svelte-1j811iq"><span class="sk-link-name svelte-1j811iq"> </span><!></span> <span class="sk-arrow svelte-1j811iq">↗</span> <span class="sk-link-actions svelte-1j811iq"><button type="button" class="sk-mini svelte-1j811iq">✎</button> <button type="button" class="sk-mini sk-mini--del svelte-1j811iq">✕</button></span></a>`),cO=U(`<section><div class="sk-cat-head svelte-1j811iq"><h3 class="svelte-1j811iq"> </h3> <div class="sk-cat-actions svelte-1j811iq"><button type="button" class="sk-mini svelte-1j811iq">+</button> <button type="button" class="sk-mini sk-mini--del svelte-1j811iq">✕</button></div> <button type="button" class="sk-toggle svelte-1j811iq" aria-label="toggle"><svg viewBox="0 0 10 6" width="10" height="6"><path d="M1 1 L5 5 L9 1" stroke="currentColor" stroke-width="1.5" fill="none" stroke-linecap="round" stroke-linejoin="round"></path></svg></button></div> <div class="sk-links svelte-1j811iq"></div></section>`),lO=U(`<option> </option>`),uO=U(`<label for="sk-cat-name"> </label> <input id="sk-cat-name" type="text"/> <label for="sk-cat-color"> </label> <select id="sk-cat-color"></select>`,1),dO=U(`<label for="sk-link-nom"> </label> <input id="sk-link-nom" type="text"/> <label for="sk-link-desc"> </label> <input id="sk-link-desc" type="text"/> <label for="sk-link-url"> </label> <input id="sk-link-url" type="text" placeholder="https://…"/>`,1),fO=U(`<div class="sk-panel-head"><h2 class="sk-panel-title"> <span class="sk-accent">.</span></h2> <p class="sk-panel-sub"> </p></div> <div class="sk-toolbar svelte-1j811iq"><button type="button" class="sk-tool svelte-1j811iq"> </button> <button type="button" class="sk-tool svelte-1j811iq"> </button> <button type="button" class="sk-tool sk-tool--add svelte-1j811iq"> </button></div> <div><!> <!></div> <!> <!>`,1);function pO(e,t){qe(t,!0);let n=P(!1),r=P(I({})),i=P(!1),a=P(``),o=P(`t-green`),s=P(!1),c=P(-1),l=P(-1),u=P(``),d=P(``),f=P(``),p={"t-green":`survival.color_green`,"t-violet":`survival.color_violet`,"t-amber":`survival.color_amber`,"t-sky":`survival.color_sky`,"t-rose":`survival.color_rose`,"t-teal":`survival.color_teal`},m=N(()=>ED.links.length>0&&ED.links.every(e=>V(r)[e.titre]));function h(e){V(r)[e]=!V(r)[e]}function g(){if(V(m))F(r,{},!0);else{let e={};ED.links.forEach(t=>e[t.titre]=!0),F(r,e,!0)}}function _(){F(a,``),F(o,`t-green`),F(i,!0)}function v(){let e=V(a).trim();e&&(ED.links.push({theme:V(o),titre:e,liens:[]}),jD(),F(i,!1))}async function y(e){ED.links[e],await t.confirmDelete(Y(`survival.confirm_del_cat_title`),Y(`survival.confirm_del_cat_msg`))&&(ED.links.splice(e,1),jD())}function b(e){F(c,e,!0),F(l,-1),F(u,``),F(d,``),F(f,``),F(s,!0)}function x(e,t,n){e.preventDefault();let r=ED.links[t].liens[n];F(c,t,!0),F(l,n,!0),F(u,r.nom,!0),F(d,r.desc,!0),F(f,r.url,!0),F(s,!0)}function S(){let e=V(u).trim(),t=V(f).trim();if(!e||!t)return;let n={nom:e,desc:V(d).trim(),url:t};V(l)===-1?ED.links[V(c)].liens.push(n):ED.links[V(c)].liens[V(l)]=n,jD(),F(s,!1)}async function C(e,n,r){e.preventDefault(),await t.confirmDelete(Y(`survival.confirm_del_link_title`),Y(`survival.irreversible`))&&(ED.links[n].liens.splice(r,1),jD())}var w=fO(),T=R(w),E=L(T),D=L(E,!0);Ie(),j(E);var ee=z(E,2),te=L(ee,!0);j(ee),j(T);var O=z(T,2),ne=L(O),k=L(ne,!0);j(ne);var A=z(ne,2),re=L(A,!0);j(A);var ie=z(A,2),ae=L(ie,!0);j(ie),j(O);var oe=z(O,2);let se;var ce=L(oe),le=e=>{var t=aO(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`survival.links_empty`)]),W(e,t)};K(ce,e=>{ED.links.length===0&&e(le)}),q(z(ce,2),19,()=>ED.links,(e,t)=>e.titre+t,(e,t,n)=>{let i=N(()=>!V(r)[V(t).titre]);var a=cO();let o;var s=L(a),c=L(s),l=L(c,!0);j(c);var u=z(c,2),d=L(u),f=z(d,2);j(u);var p=z(u,2);j(s);var m=z(s,2);q(m,21,()=>V(t).liens,Qr,(e,t,r)=>{var i=sO(),a=L(i),o=L(a),s=L(o,!0);j(o);var c=z(o),l=e=>{var n=oO(),r=L(n);j(n),B(()=>G(r,`— ${V(t).desc??``}`)),W(e,n)};K(c,e=>{V(t).desc&&e(l)}),j(a);var u=z(a,4),d=L(u),f=z(d,2);j(u),j(i),B((e,n)=>{J(i,`href`,V(t).url),G(s,V(t).nom),J(d,`title`,e),J(f,`title`,n)},[()=>Y(`survival.links_edit_link_title`),()=>Y(`survival.links_del_link_title`)]),H(`click`,d,e=>x(e,V(n),r)),H(`click`,f,e=>C(e,V(n),r)),W(e,i)}),j(m),j(a),B((e,n)=>{o=vi(a,1,`sk-cat ${V(t).theme??``}`,`svelte-1j811iq`,o,{collapsed:V(i)}),G(l,V(t).titre),J(d,`title`,e),J(f,`title`,n)},[()=>Y(`survival.links_add_link_title`),()=>Y(`survival.links_del_cat_title`)]),H(`click`,d,()=>b(V(n))),H(`click`,f,()=>y(V(n))),H(`click`,p,()=>h(V(t).titre)),W(e,a)}),j(oe);var ue=z(oe,2);{let e=N(()=>Y(`survival.modal_cat_title`)),t=N(()=>Y(`common.add`));zD(ue,{get open(){return V(i)},get title(){return V(e)},get confirmLabel(){return V(t)},onConfirm:v,onClose:()=>F(i,!1),children:(e,t)=>{var n=uO(),r=R(n),i=L(r,!0);j(r);var s=z(r,2);ki(s);var c=z(s,2),l=L(c,!0);j(c);var u=z(c,2);q(u,21,()=>LD,Qr,(e,t)=>{var n=lO(),r=L(n,!0);j(n);var i={};B(e=>{G(r,e),i!==(i=V(t))&&(n.value=(n.__value=V(t))??``)},[()=>Y(p[V(t)])]),W(e,n)}),j(u),B((e,t,n)=>{G(i,e),J(s,`placeholder`,t),G(l,n)},[()=>Y(`survival.modal_cat_label_name`),()=>Y(`survival.modal_cat_placeholder_name`),()=>Y(`survival.modal_label_color`)]),H(`keydown`,s,e=>e.key===`Enter`&&v()),Fi(s,()=>V(a),e=>F(a,e)),Ci(u,()=>V(o),e=>F(o,e)),W(e,n)},$$slots:{default:!0}})}var de=z(ue,2);{let e=N(()=>V(l)===-1?Y(`survival.modal_link_title`):Y(`survival.modal_edit_link_title`)),t=N(()=>V(l)===-1?Y(`common.add`):Y(`common.save`));zD(de,{get open(){return V(s)},get title(){return V(e)},get confirmLabel(){return V(t)},onConfirm:S,onClose:()=>F(s,!1),children:(e,t)=>{var n=dO(),r=R(n),i=L(r,!0);j(r);var a=z(r,2);ki(a);var o=z(a,2),s=L(o,!0);j(o);var c=z(o,2);ki(c);var l=z(c,2),p=L(l,!0);j(l);var m=z(l,2);ki(m),B((e,t,n,r,o)=>{G(i,e),J(a,`placeholder`,t),G(s,n),J(c,`placeholder`,r),G(p,o)},[()=>Y(`survival.modal_link_label_name`),()=>Y(`survival.modal_link_placeholder_name`),()=>Y(`survival.modal_link_label_desc`),()=>Y(`survival.modal_link_placeholder_desc`),()=>Y(`survival.modal_link_label_url`)]),Fi(a,()=>V(u),e=>F(u,e)),Fi(c,()=>V(d),e=>F(d,e)),H(`keydown`,m,e=>e.key===`Enter`&&S()),Fi(m,()=>V(f),e=>F(f,e)),W(e,n)},$$slots:{default:!0}})}B((e,t,r,i,a)=>{G(D,e),G(te,t),G(k,r),G(re,i),G(ae,a),se=vi(oe,1,`sk-cats svelte-1j811iq`,null,se,{"edit-mode":V(n)})},[()=>Y(`survival.links_title`),()=>Y(`survival.links_subtitle`),()=>V(n)?Y(`survival.btn_read_mode`):Y(`survival.btn_edit_mode`),()=>V(m)?Y(`survival.btn_collapse_all`):Y(`survival.btn_expand_all`),()=>Y(`survival.links_btn_add_cat`)]),H(`click`,ne,()=>F(n,!V(n))),H(`click`,A,g),H(`click`,ie,_),W(e,w),Je()}Pr([`click`,`keydown`]);var mO=U(`<button class="ghost-button"><i class="fa-solid fa-cloud"></i></button>`),hO=U(`<!> <button title="Toggle dark mode" class="ghost-button" aria-label="Toggle dark mode"> </button>`,1),gO=U(`<p class="sk-loading svelte-ha6eja"> </p>`),_O=U(`<div class="sk-grid svelte-ha6eja"><section class="sk-col svelte-ha6eja"><div class="sk-inner svelte-ha6eja"><!></div></section> <section class="sk-col svelte-ha6eja"><div class="sk-inner svelte-ha6eja"><!></div></section> <section class="sk-col svelte-ha6eja"><div class="sk-inner svelte-ha6eja"><!></div></section></div>`),vO=U(`<!> <div class="app-shell sk-root svelte-ha6eja"><!> <!></div> <!>`,1);function yO(e,t){qe(t,!0);let n=P(null),r=P(!1),i=P(!1),a=P(!1);async function o(e,t){return V(n).show({title:e,message:t,confirmLabel:Y(`survival.irreversible_delete`),cancelLabel:Y(`common.cancel`),danger:!0})}function s(e){F(i,e,!0),document.documentElement.classList.toggle(`dark`,e)}function c(){let e=!1;try{let t=localStorage.getItem(`ld-dark`);e=t===null?window.matchMedia(`(prefers-color-scheme: dark)`).matches:t===`true`}catch{}s(e)}function l(){s(!V(i));try{localStorage.setItem(`ld-dark`,String(V(i)))}catch{}}Ji(async()=>{c();try{await Ca((await fetch(`/api/config`).then(e=>e.json())).language||`en`)}catch{}await kD(),F(r,!0)});var u=vO(),d=R(u);Ui($d(d,{}),e=>F(n,e,!0),()=>V(n));var f=z(d,2),p=L(f);{let e=e=>{var t=hO(),n=R(t),r=e=>{var t=mO();B((e,n)=>{J(t,`title`,e),J(t,`aria-label`,n)},[()=>Y(`nav.word_cloud`),()=>Y(`nav.word_cloud`)]),H(`click`,t,()=>F(a,!0)),W(e,t)},o=N(()=>!va.hidden.includes(ha));K(n,e=>{V(o)&&e(r)});var s=z(n,2),c=L(s,!0);j(s),B(()=>G(c,V(i)?`☀`:`☾`)),H(`click`,s,l),W(e,t)},t=N(()=>Y(`survival.title`)),n=N(()=>Y(`survival.subtitle`));es(p,{get title(){return V(t)},get subtitle(){return V(n)},actions:e,$$slots:{actions:!0}})}var m=z(p,2),h=e=>{var t=gO(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`common.loading`)]),W(e,t)},g=e=>{var t=_O(),n=L(t),r=L(n);ID(L(r),{}),j(r),j(n);var i=z(n,2),a=L(i);iO(L(a),{confirmDelete:o}),j(a),j(i);var s=z(i,2),c=L(s);pO(L(c),{confirmDelete:o}),j(c),j(s),j(t),W(e,t)};K(m,e=>{V(r)?e(g,-1):e(h)}),j(f),eT(z(f,2),{get open(){return V(a)},onclose:()=>F(a,!1)}),W(e,u),Je()}Pr([`click`]);var bO=`git-integration-config`,xO=`git-integration-status`,SO=`git-integration-save`,CO=`/admin#git-integration`,wO=120*1e3,TO=!1,EO=!1;function DO(e){let t=Date.parse(e);return Number.isFinite(t)&&Date.now()-t<wO}function OO(e){let t=e.toLowerCase();return t.includes(`cannot lock ref 'head'`)&&t.includes(`but expected`)?`un autre commit a modifié HEAD pendant l'autocommit. Réessayez l'enregistrement.`:e}async function kO(){if(!TO){TO=!0;try{let e=await fetch(`/api/git/status`,{cache:`no-store`});if(!e.ok)return;let t=await e.json();if(t.mode===`unconfigured`){wo(`Veuillez configurer l'intégration Git dans la page Admin.`,`error`,600*1e3,{id:bO,href:CO,linkLabel:`Admin`}),ho(xO),ho(SO);return}if(ho(bO),t.mode===`disabled`){ho(xO),ho(SO);return}if(!t.ok){wo(`Intégration Git : ${t.message}`,`error`,600*1e3,{id:xO,href:CO,linkLabel:`Admin`});return}if(t.dirtyOutsideDocsCount>0){let e=t.docsFolder?.trim()||`docsFolder`;wo(`Git : ${t.dirtyOutsideDocsCount} changement(s) hors ${e} seront ignorés par Living Documentation.`,`error`,600*1e3,xO)}else ho(xO);let n=t.lastSave;n&&DO(n.timestamp)&&(n.error||n.warning)?wo(`Git : ${OO(n.error||n.warning||``)}`,`error`,600*1e3,{id:SO,href:CO,linkLabel:`Admin`}):ho(SO)}catch{}finally{TO=!1}}}function AO(){if(EO)return;EO=!0;let e=window.fetch.bind(window);window.fetch=async(t,n)=>{let r=await e(t,n),i=typeof t==`string`?t:t instanceof URL?t.toString():t.url;return(n?.method||(t instanceof Request?t.method:`GET`)).toUpperCase()!==`GET`&&!i.includes(`/api/git/`)&&(i.startsWith(`/api/`)||i.startsWith(`/mcp`)||i.startsWith(window.location.origin))&&window.setTimeout(()=>void kO(),80),r}}var jO=U(`<p style="padding:2rem"> </p>`);function MO(e,t){qe(t,!0);function n(e){return e.length>1?e.replace(/\/+$/,``):e}let r=new Set([`/`,`/admin`,`/workspace`,`/blueprint`,`/diagram`,`/shape-editor`,`/context`,`/files`,`/survival-kit`,`/templates`,`/graph`]),i=window.location.pathname+window.location.search+window.location.hash,a=P(I(n(window.location.pathname)));async function o(e){let t=new URL(e,window.location.href),r=n(t.pathname),o=`${r}${t.search}${t.hash}`;if(o===`${window.location.pathname}${window.location.search}${window.location.hash}`){So();return}await Go()&&(history.pushState(null,``,o),i=o,F(a,r,!0),So(),kO(),window.dispatchEvent(new PopStateEvent(`popstate`)))}function s(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.target instanceof Element?e.target.closest(`a[href]`):null;if(!(t instanceof HTMLAnchorElement)||t.target||t.hasAttribute(`download`))return;let i=new URL(t.href,window.location.href);if(i.origin!==window.location.origin)return;let a=n(i.pathname);r.has(a)&&(e.preventDefault(),o(`${a}${i.search}${i.hash}`))}Ji(()=>(So(),AO(),kO(),document.addEventListener(`click`,s,!0),()=>{document.removeEventListener(`click`,s,!0)})),window.addEventListener(`popstate`,async()=>{if(!await Go()){history.pushState(null,``,i);return}i=window.location.pathname+window.location.search+window.location.hash,F(a,n(window.location.pathname),!0),So(),kO()}),kn(()=>{V(a)===`/blueprint`?document.documentElement.setAttribute(`data-blueprint`,``):document.documentElement.removeAttribute(`data-blueprint`)});function c(e){o(e)}var l=Wr(),u=R(l),d=e=>{TD(e,{})},f=e=>{Cs(e,{navigate:c})},p=e=>{lp(e,{})},m=e=>{Gg(e,{})},h=e=>{r_(e,{})},g=e=>{L_(e,{navigate:c})},_=e=>{mT(e,{})},v=e=>{yT(e,{})},y=e=>{FT(e,{})},b=e=>{yO(e,{})},x=e=>{cT(e,{})},S=e=>{var t=jO(),n=L(t);j(t),B(()=>G(n,`Route "${V(a)??``}" — not yet migrated.`)),W(e,t)};K(u,e=>{V(a)===`/templates`?e(d):V(a)===`/admin`?e(f,1):V(a)===`/blueprint`?e(p,2):V(a)===`/workspace`?e(m,3):V(a)===`/files`?e(h,4):V(a)===`/context`?e(g,5):V(a)===`/diagram`?e(_,6):V(a)===`/graph`?e(v,7):V(a)===`/shape-editor`?e(y,8):V(a)===`/survival-kit`?e(b,9):V(a)===`/`?e(x,10):e(S,-1)}),W(e,l),Je()}var NO=new Set,PO=!1;function FO(e){NO.add(e)}function IO(){if(PO)return;PO=!0;let e=window.fetch.bind(window);window.fetch=async(t,n)=>{let r=await e(t,n);try{let e=typeof t==`string`?t:t instanceof URL?t.toString():t.url;(n?.method||(t instanceof Request?t.method:`GET`)).toUpperCase()===`GET`&&/\/api\/config(?:\?|$)/.test(e)&&r.clone().json().then(e=>{for(let t of NO)try{t(e)}catch{}}).catch(()=>{})}catch{}return r}}as(),FO(e=>os(e)),FO(e=>Ko.syncFromConfig(e)),FO(ya),IO(),So(),Ca(Sa()).finally(()=>{let e=document.getElementById(`app`);if(!e)throw Error(`#app element is missing`);Gr(MO,{target:e})});export{DT as a,jT as c,bT as d,fd as f,OT as i,MT as l,Y as m,ET as n,AT as o,Ca as p,kT as r,TT as s,ST as t,xT as u};
|
|
328
|
+
`).map(e=>e.trim()).filter(Boolean);return t.length?{type:`table`,headers:t[0].split(`|`).map(e=>e.trim()),rows:t.slice(1).map(e=>e.split(`|`).map(e=>e.trim()))}:null}return{type:V(f),content:e}}function E(){let e=T();e&&(V(d)===-1?ID.notes[V(u)].blocs.push(e):ID.notes[V(u)].blocs[V(d)]=e,VD(),F(l,!1))}async function D(e,n){await t.confirmDelete(Y(`survival.confirm_del_bloc_title`),Y(`survival.irreversible`))&&(ID.notes[e].blocs.splice(n,1),VD())}async function ee(e,t){try{await navigator.clipboard.writeText(e),F(i,t,!0),setTimeout(()=>F(i,V(i)===t?null:V(i),!0),1500)}catch{}}let te=N(()=>V(f)===`ul`?Y(`survival.modal_bloc_placeholder_ul`):V(f)===`pre`?Y(`survival.modal_bloc_placeholder_pre`):V(f)===`table`?Y(`survival.modal_bloc_placeholder_table`):V(f)===`b`?Y(`survival.modal_bloc_placeholder_b`):Y(`survival.modal_bloc_placeholder_p`));var O=pO(),ne=R(O),k=L(ne),A=L(k,!0);Ie(),j(k);var re=z(k,2),ie=L(re,!0);j(re),j(ne);var ae=z(ne,2),oe=L(ae),se=L(oe,!0);j(oe);var ce=z(oe,2),le=L(ce,!0);j(ce);var ue=z(ce,2),de=L(ue,!0);j(ue),j(ae);var fe=z(ae,2);let pe;var me=L(fe),he=e=>{var t=XD(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`survival.notes_empty`)]),W(e,t)};K(me,e=>{ID.notes.length===0&&e(he)}),q(z(me,2),19,()=>ID.notes,e=>e.id,(e,t,n)=>{let a=N(()=>!V(r)[V(t).id]);var o=sO();let s;var c=L(o),l=L(c),u=L(l,!0);j(l);var d=z(l,2),f=L(d),p=z(f,2);j(d);var m=z(d,2);j(c);var h=z(c,2),_=L(h);q(_,17,()=>V(t).blocs,Qr,(e,r,a)=>{var o=oO(),s=L(o),c=L(s),l=e=>{var t=ZD(),n=L(t,!0);j(t),B(()=>G(n,V(r).content)),W(e,t)},u=e=>{var t=QD(),n=L(t,!0);j(t),B(()=>G(n,V(r).content)),W(e,t)},d=e=>{let n=N(()=>`${V(t).id}-${a}`);var o=$D(),s=L(o),c=L(s,!0);j(s);var l=z(s,2),u=L(l,!0);j(l),j(o),B(e=>{G(c,V(r).content),G(u,e)},[()=>V(i)===V(n)?Y(`survival.notes_btn_copied`):Y(`survival.notes_btn_copy`)]),H(`click`,l,()=>ee(V(r).content,V(n))),W(e,o)},f=e=>{var t=tO();q(t,21,()=>V(r).items,Qr,(e,t)=>{var n=eO(),r=L(n,!0);j(n),B(()=>G(r,V(t))),W(e,n)}),j(t),W(e,t)},p=e=>{var t=aO(),n=L(t),i=L(n),a=L(i);q(a,21,()=>V(r).headers,Qr,(e,t)=>{var n=nO(),r=L(n,!0);j(n),B(()=>G(r,V(t))),W(e,n)}),j(a),j(i);var o=z(i);q(o,21,()=>V(r).rows,Qr,(e,t)=>{var n=iO();q(n,21,()=>V(t),Qr,(e,t)=>{var n=rO(),r=L(n,!0);j(n),B(()=>G(r,V(t))),W(e,n)}),j(n),W(e,n)}),j(o),j(n),j(t),W(e,t)};K(c,e=>{V(r).type===`b`?e(l):V(r).type===`p`?e(u,1):V(r).type===`pre`?e(d,2):V(r).type===`ul`?e(f,3):V(r).type===`table`&&e(p,4)}),j(s);var m=z(s,2),h=L(m),g=z(h,2);j(m),j(o),H(`click`,h,()=>w(V(n),a)),H(`click`,g,()=>D(V(n),a)),W(e,o)});var v=z(_,2),b=L(v),S=L(b,!0);j(b),j(v),j(h),j(o),B(e=>{s=vi(o,1,`sk-note ${V(t).theme??``}`,`svelte-hpbata`,s,{collapsed:V(a)}),G(u,V(t).titre),G(S,e)},[()=>Y(`survival.notes_btn_add_bloc`)]),H(`click`,f,()=>y(V(n))),H(`click`,p,()=>x(V(n))),H(`click`,m,()=>g(V(t).id)),H(`click`,b,()=>C(V(n))),W(e,o)}),j(fe);var ge=z(fe,2);{let e=N(()=>V(o)===-1?Y(`survival.modal_note_title`):Y(`survival.modal_edit_note_title`)),t=N(()=>V(o)===-1?Y(`common.create`):Y(`common.save`));YD(ge,{get open(){return V(a)},get title(){return V(e)},get confirmLabel(){return V(t)},onConfirm:b,onClose:()=>F(a,!1),children:(e,t)=>{var n=lO(),r=R(n),i=L(r,!0);j(r);var a=z(r,2);ki(a);var o=z(a,2),l=L(o,!0);j(o);var u=z(o,2);q(u,21,()=>qD,Qr,(e,t)=>{var n=cO(),r=L(n,!0);j(n);var i={};B(e=>{G(r,e),i!==(i=V(t))&&(n.value=(n.__value=V(t))??``)},[()=>Y(m[V(t)])]),W(e,n)}),j(u),B((e,t,n)=>{G(i,e),J(a,`placeholder`,t),G(l,n)},[()=>Y(`survival.modal_note_label_title`),()=>Y(`survival.modal_note_placeholder`),()=>Y(`survival.modal_label_color`)]),H(`keydown`,a,e=>e.key===`Enter`&&b()),Fi(a,()=>V(s),e=>F(s,e)),Ci(u,()=>V(c),e=>F(c,e)),W(e,n)},$$slots:{default:!0}})}var _e=z(ge,2);{let e=N(()=>V(d)===-1?Y(`survival.modal_bloc_new`):Y(`survival.modal_bloc_edit`)),t=N(()=>Y(`common.save`));YD(_e,{get open(){return V(l)},get title(){return V(e)},get confirmLabel(){return V(t)},onConfirm:E,onClose:()=>F(l,!1),children:(e,t)=>{var n=fO(),r=R(n),i=L(r,!0);j(r);var a=z(r,2),o=L(a),s=L(o,!0);j(o),o.value=o.__value=`b`;var c=z(o),l=L(c,!0);j(c),c.value=c.__value=`p`;var u=z(c),d=L(u,!0);j(u),u.value=u.__value=`pre`;var m=z(u),h=L(m,!0);j(m),m.value=m.__value=`ul`;var g=z(m),_=L(g,!0);j(g),g.value=g.__value=`table`,j(a);var v=z(a,2),y=L(v,!0);j(v);var b=z(v,2),x=e=>{var t=uO();ki(t),B(()=>J(t,`placeholder`,V(te))),H(`keydown`,t,e=>e.key===`Enter`&&E()),Fi(t,()=>V(p),e=>F(p,e)),W(e,t)},S=e=>{var t=dO();yn(t),B(()=>J(t,`placeholder`,V(te))),Fi(t,()=>V(p),e=>F(p,e)),W(e,t)};K(b,e=>{V(f)===`b`?e(x):e(S,-1)}),B((e,t,n,r,a,o,c)=>{G(i,e),G(s,t),G(l,n),G(d,r),G(h,a),G(_,o),G(y,c)},[()=>Y(`survival.modal_bloc_label_type`),()=>Y(`survival.modal_bloc_type_b`),()=>Y(`survival.modal_bloc_type_p`),()=>Y(`survival.modal_bloc_type_pre`),()=>Y(`survival.modal_bloc_type_ul`),()=>Y(`survival.modal_bloc_type_table`),()=>Y(`survival.modal_bloc_label_content`)]),Ci(a,()=>V(f),e=>F(f,e)),W(e,n)},$$slots:{default:!0}})}B((e,t,r,i,a)=>{G(A,e),G(ie,t),G(se,r),G(le,i),G(de,a),pe=vi(fe,1,`sk-notes svelte-hpbata`,null,pe,{"edit-mode":V(n)})},[()=>Y(`survival.notes_title`),()=>Y(`survival.notes_subtitle`),()=>V(n)?Y(`survival.btn_read_mode`):Y(`survival.btn_edit_mode`),()=>V(h)?Y(`survival.btn_collapse_all`):Y(`survival.btn_expand_all`),()=>Y(`survival.notes_btn_add`)]),H(`click`,oe,()=>F(n,!V(n))),H(`click`,ce,_),H(`click`,ue,v),W(e,O),Je()}Pr([`click`,`keydown`]);var hO=U(`<p class="sk-empty svelte-1j811iq"> </p>`),gO=U(`<span class="sk-link-desc svelte-1j811iq"> </span>`),_O=U(`<a target="_blank" rel="noopener" class="sk-link svelte-1j811iq"><span class="sk-link-text svelte-1j811iq"><span class="sk-link-name svelte-1j811iq"> </span><!></span> <span class="sk-arrow svelte-1j811iq">↗</span> <span class="sk-link-actions svelte-1j811iq"><button type="button" class="sk-mini svelte-1j811iq">✎</button> <button type="button" class="sk-mini sk-mini--del svelte-1j811iq">✕</button></span></a>`),vO=U(`<section><div class="sk-cat-head svelte-1j811iq"><h3 class="svelte-1j811iq"> </h3> <div class="sk-cat-actions svelte-1j811iq"><button type="button" class="sk-mini svelte-1j811iq">+</button> <button type="button" class="sk-mini sk-mini--del svelte-1j811iq">✕</button></div> <button type="button" class="sk-toggle svelte-1j811iq" aria-label="toggle"><svg viewBox="0 0 10 6" width="10" height="6"><path d="M1 1 L5 5 L9 1" stroke="currentColor" stroke-width="1.5" fill="none" stroke-linecap="round" stroke-linejoin="round"></path></svg></button></div> <div class="sk-links svelte-1j811iq"></div></section>`),yO=U(`<option> </option>`),bO=U(`<label for="sk-cat-name"> </label> <input id="sk-cat-name" type="text"/> <label for="sk-cat-color"> </label> <select id="sk-cat-color"></select>`,1),xO=U(`<label for="sk-link-nom"> </label> <input id="sk-link-nom" type="text"/> <label for="sk-link-desc"> </label> <input id="sk-link-desc" type="text"/> <label for="sk-link-url"> </label> <input id="sk-link-url" type="text" placeholder="https://…"/>`,1),SO=U(`<div class="sk-panel-head"><h2 class="sk-panel-title"> <span class="sk-accent">.</span></h2> <p class="sk-panel-sub"> </p></div> <div class="sk-toolbar svelte-1j811iq"><button type="button" class="sk-tool svelte-1j811iq"> </button> <button type="button" class="sk-tool svelte-1j811iq"> </button> <button type="button" class="sk-tool sk-tool--add svelte-1j811iq"> </button></div> <div><!> <!></div> <!> <!>`,1);function CO(e,t){qe(t,!0);let n=P(!1),r=P(I({})),i=P(!1),a=P(``),o=P(`t-green`),s=P(!1),c=P(-1),l=P(-1),u=P(``),d=P(``),f=P(``),p={"t-green":`survival.color_green`,"t-violet":`survival.color_violet`,"t-amber":`survival.color_amber`,"t-sky":`survival.color_sky`,"t-rose":`survival.color_rose`,"t-teal":`survival.color_teal`},m=N(()=>ID.links.length>0&&ID.links.every(e=>V(r)[e.titre]));function h(e){V(r)[e]=!V(r)[e]}function g(){if(V(m))F(r,{},!0);else{let e={};ID.links.forEach(t=>e[t.titre]=!0),F(r,e,!0)}}function _(){F(a,``),F(o,`t-green`),F(i,!0)}function v(){let e=V(a).trim();e&&(ID.links.push({theme:V(o),titre:e,liens:[]}),VD(),F(i,!1))}async function y(e){ID.links[e],await t.confirmDelete(Y(`survival.confirm_del_cat_title`),Y(`survival.confirm_del_cat_msg`))&&(ID.links.splice(e,1),VD())}function b(e){F(c,e,!0),F(l,-1),F(u,``),F(d,``),F(f,``),F(s,!0)}function x(e,t,n){e.preventDefault();let r=ID.links[t].liens[n];F(c,t,!0),F(l,n,!0),F(u,r.nom,!0),F(d,r.desc,!0),F(f,r.url,!0),F(s,!0)}function S(){let e=V(u).trim(),t=V(f).trim();if(!e||!t)return;let n={nom:e,desc:V(d).trim(),url:t};V(l)===-1?ID.links[V(c)].liens.push(n):ID.links[V(c)].liens[V(l)]=n,VD(),F(s,!1)}async function C(e,n,r){e.preventDefault(),await t.confirmDelete(Y(`survival.confirm_del_link_title`),Y(`survival.irreversible`))&&(ID.links[n].liens.splice(r,1),VD())}var w=SO(),T=R(w),E=L(T),D=L(E,!0);Ie(),j(E);var ee=z(E,2),te=L(ee,!0);j(ee),j(T);var O=z(T,2),ne=L(O),k=L(ne,!0);j(ne);var A=z(ne,2),re=L(A,!0);j(A);var ie=z(A,2),ae=L(ie,!0);j(ie),j(O);var oe=z(O,2);let se;var ce=L(oe),le=e=>{var t=hO(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`survival.links_empty`)]),W(e,t)};K(ce,e=>{ID.links.length===0&&e(le)}),q(z(ce,2),19,()=>ID.links,(e,t)=>e.titre+t,(e,t,n)=>{let i=N(()=>!V(r)[V(t).titre]);var a=vO();let o;var s=L(a),c=L(s),l=L(c,!0);j(c);var u=z(c,2),d=L(u),f=z(d,2);j(u);var p=z(u,2);j(s);var m=z(s,2);q(m,21,()=>V(t).liens,Qr,(e,t,r)=>{var i=_O(),a=L(i),o=L(a),s=L(o,!0);j(o);var c=z(o),l=e=>{var n=gO(),r=L(n);j(n),B(()=>G(r,`— ${V(t).desc??``}`)),W(e,n)};K(c,e=>{V(t).desc&&e(l)}),j(a);var u=z(a,4),d=L(u),f=z(d,2);j(u),j(i),B((e,n)=>{J(i,`href`,V(t).url),G(s,V(t).nom),J(d,`title`,e),J(f,`title`,n)},[()=>Y(`survival.links_edit_link_title`),()=>Y(`survival.links_del_link_title`)]),H(`click`,d,e=>x(e,V(n),r)),H(`click`,f,e=>C(e,V(n),r)),W(e,i)}),j(m),j(a),B((e,n)=>{o=vi(a,1,`sk-cat ${V(t).theme??``}`,`svelte-1j811iq`,o,{collapsed:V(i)}),G(l,V(t).titre),J(d,`title`,e),J(f,`title`,n)},[()=>Y(`survival.links_add_link_title`),()=>Y(`survival.links_del_cat_title`)]),H(`click`,d,()=>b(V(n))),H(`click`,f,()=>y(V(n))),H(`click`,p,()=>h(V(t).titre)),W(e,a)}),j(oe);var ue=z(oe,2);{let e=N(()=>Y(`survival.modal_cat_title`)),t=N(()=>Y(`common.add`));YD(ue,{get open(){return V(i)},get title(){return V(e)},get confirmLabel(){return V(t)},onConfirm:v,onClose:()=>F(i,!1),children:(e,t)=>{var n=bO(),r=R(n),i=L(r,!0);j(r);var s=z(r,2);ki(s);var c=z(s,2),l=L(c,!0);j(c);var u=z(c,2);q(u,21,()=>qD,Qr,(e,t)=>{var n=yO(),r=L(n,!0);j(n);var i={};B(e=>{G(r,e),i!==(i=V(t))&&(n.value=(n.__value=V(t))??``)},[()=>Y(p[V(t)])]),W(e,n)}),j(u),B((e,t,n)=>{G(i,e),J(s,`placeholder`,t),G(l,n)},[()=>Y(`survival.modal_cat_label_name`),()=>Y(`survival.modal_cat_placeholder_name`),()=>Y(`survival.modal_label_color`)]),H(`keydown`,s,e=>e.key===`Enter`&&v()),Fi(s,()=>V(a),e=>F(a,e)),Ci(u,()=>V(o),e=>F(o,e)),W(e,n)},$$slots:{default:!0}})}var de=z(ue,2);{let e=N(()=>V(l)===-1?Y(`survival.modal_link_title`):Y(`survival.modal_edit_link_title`)),t=N(()=>V(l)===-1?Y(`common.add`):Y(`common.save`));YD(de,{get open(){return V(s)},get title(){return V(e)},get confirmLabel(){return V(t)},onConfirm:S,onClose:()=>F(s,!1),children:(e,t)=>{var n=xO(),r=R(n),i=L(r,!0);j(r);var a=z(r,2);ki(a);var o=z(a,2),s=L(o,!0);j(o);var c=z(o,2);ki(c);var l=z(c,2),p=L(l,!0);j(l);var m=z(l,2);ki(m),B((e,t,n,r,o)=>{G(i,e),J(a,`placeholder`,t),G(s,n),J(c,`placeholder`,r),G(p,o)},[()=>Y(`survival.modal_link_label_name`),()=>Y(`survival.modal_link_placeholder_name`),()=>Y(`survival.modal_link_label_desc`),()=>Y(`survival.modal_link_placeholder_desc`),()=>Y(`survival.modal_link_label_url`)]),Fi(a,()=>V(u),e=>F(u,e)),Fi(c,()=>V(d),e=>F(d,e)),H(`keydown`,m,e=>e.key===`Enter`&&S()),Fi(m,()=>V(f),e=>F(f,e)),W(e,n)},$$slots:{default:!0}})}B((e,t,r,i,a)=>{G(D,e),G(te,t),G(k,r),G(re,i),G(ae,a),se=vi(oe,1,`sk-cats svelte-1j811iq`,null,se,{"edit-mode":V(n)})},[()=>Y(`survival.links_title`),()=>Y(`survival.links_subtitle`),()=>V(n)?Y(`survival.btn_read_mode`):Y(`survival.btn_edit_mode`),()=>V(m)?Y(`survival.btn_collapse_all`):Y(`survival.btn_expand_all`),()=>Y(`survival.links_btn_add_cat`)]),H(`click`,ne,()=>F(n,!V(n))),H(`click`,A,g),H(`click`,ie,_),W(e,w),Je()}Pr([`click`,`keydown`]);var wO=U(`<button class="ghost-button"><i class="fa-solid fa-cloud"></i></button>`),TO=U(`<!> <button title="Toggle dark mode" class="ghost-button" aria-label="Toggle dark mode"> </button>`,1),EO=U(`<p class="sk-loading svelte-ha6eja"> </p>`),DO=U(`<div class="sk-grid svelte-ha6eja"><section class="sk-col svelte-ha6eja"><div class="sk-inner svelte-ha6eja"><!></div></section> <section class="sk-col svelte-ha6eja"><div class="sk-inner svelte-ha6eja"><!></div></section> <section class="sk-col svelte-ha6eja"><div class="sk-inner svelte-ha6eja"><!></div></section></div>`),OO=U(`<!> <div class="app-shell sk-root svelte-ha6eja"><!> <!></div> <!>`,1);function kO(e,t){qe(t,!0);let n=P(null),r=P(!1),i=P(!1),a=P(!1);async function o(e,t){return V(n).show({title:e,message:t,confirmLabel:Y(`survival.irreversible_delete`),cancelLabel:Y(`common.cancel`),danger:!0})}function s(e){F(i,e,!0),document.documentElement.classList.toggle(`dark`,e)}function c(){let e=!1;try{let t=localStorage.getItem(`ld-dark`);e=t===null?window.matchMedia(`(prefers-color-scheme: dark)`).matches:t===`true`}catch{}s(e)}function l(){s(!V(i));try{localStorage.setItem(`ld-dark`,String(V(i)))}catch{}}Ji(async()=>{c();try{await Ca((await fetch(`/api/config`).then(e=>e.json())).language||`en`)}catch{}await zD(),F(r,!0)});var u=OO(),d=R(u);Ui($d(d,{}),e=>F(n,e,!0),()=>V(n));var f=z(d,2),p=L(f);{let e=e=>{var t=TO(),n=R(t),r=e=>{var t=wO();B((e,n)=>{J(t,`title`,e),J(t,`aria-label`,n)},[()=>Y(`nav.word_cloud`),()=>Y(`nav.word_cloud`)]),H(`click`,t,()=>F(a,!0)),W(e,t)},o=N(()=>!va.hidden.includes(ha));K(n,e=>{V(o)&&e(r)});var s=z(n,2),c=L(s,!0);j(s),B(()=>G(c,V(i)?`☀`:`☾`)),H(`click`,s,l),W(e,t)},t=N(()=>Y(`survival.title`)),n=N(()=>Y(`survival.subtitle`));es(p,{get title(){return V(t)},get subtitle(){return V(n)},actions:e,$$slots:{actions:!0}})}var m=z(p,2),h=e=>{var t=EO(),n=L(t,!0);j(t),B(e=>G(n,e),[()=>Y(`common.loading`)]),W(e,t)},g=e=>{var t=DO(),n=L(t),r=L(n);KD(L(r),{}),j(r),j(n);var i=z(n,2),a=L(i);mO(L(a),{confirmDelete:o}),j(a),j(i);var s=z(i,2),c=L(s);CO(L(c),{confirmDelete:o}),j(c),j(s),j(t),W(e,t)};K(m,e=>{V(r)?e(g,-1):e(h)}),j(f),uT(z(f,2),{get open(){return V(a)},onclose:()=>F(a,!1)}),W(e,u),Je()}Pr([`click`]);var AO=`git-integration-config`,jO=`git-integration-status`,MO=`git-integration-save`,NO=`/admin#git-integration`,PO=120*1e3,FO=!1,IO=!1;function LO(e){let t=Date.parse(e);return Number.isFinite(t)&&Date.now()-t<PO}function RO(e){let t=e.toLowerCase();return t.includes(`cannot lock ref 'head'`)&&t.includes(`but expected`)?`un autre commit a modifié HEAD pendant l'autocommit. Réessayez l'enregistrement.`:e}async function zO(){if(!FO){FO=!0;try{let e=await fetch(`/api/git/status`,{cache:`no-store`});if(!e.ok)return;let t=await e.json();if(t.mode===`unconfigured`){wo(`Veuillez configurer l'intégration Git dans la page Admin.`,`error`,600*1e3,{id:AO,href:NO,linkLabel:`Admin`}),ho(jO),ho(MO);return}if(ho(AO),t.mode===`disabled`){ho(jO),ho(MO);return}if(!t.ok){wo(`Intégration Git : ${t.message}`,`error`,600*1e3,{id:jO,href:NO,linkLabel:`Admin`});return}if(t.dirtyOutsideDocsCount>0){let e=t.docsFolder?.trim()||`docsFolder`;wo(`Git : ${t.dirtyOutsideDocsCount} changement(s) hors ${e} seront ignorés par Living Documentation.`,`error`,600*1e3,jO)}else ho(jO);let n=t.lastSave;n&&LO(n.timestamp)&&(n.error||n.warning)?wo(`Git : ${RO(n.error||n.warning||``)}`,`error`,600*1e3,{id:MO,href:NO,linkLabel:`Admin`}):ho(MO)}catch{}finally{FO=!1}}}function BO(){if(IO)return;IO=!0;let e=window.fetch.bind(window);window.fetch=async(t,n)=>{let r=await e(t,n),i=typeof t==`string`?t:t instanceof URL?t.toString():t.url;return(n?.method||(t instanceof Request?t.method:`GET`)).toUpperCase()!==`GET`&&!i.includes(`/api/git/`)&&(i.startsWith(`/api/`)||i.startsWith(`/mcp`)||i.startsWith(window.location.origin))&&window.setTimeout(()=>void zO(),80),r}}var VO=U(`<p style="padding:2rem"> </p>`);function HO(e,t){qe(t,!0);function n(e){return e.length>1?e.replace(/\/+$/,``):e}let r=new Set([`/`,`/admin`,`/workspace`,`/blueprint`,`/diagram`,`/shape-editor`,`/context`,`/files`,`/survival-kit`,`/templates`,`/graph`]),i=window.location.pathname+window.location.search+window.location.hash,a=P(I(n(window.location.pathname)));async function o(e){let t=new URL(e,window.location.href),r=n(t.pathname),o=`${r}${t.search}${t.hash}`;if(o===`${window.location.pathname}${window.location.search}${window.location.hash}`){So();return}await Go()&&(history.pushState(null,``,o),i=o,F(a,r,!0),So(),zO(),window.dispatchEvent(new PopStateEvent(`popstate`)))}function s(e){if(e.defaultPrevented||e.button!==0||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey)return;let t=e.target instanceof Element?e.target.closest(`a[href]`):null;if(!(t instanceof HTMLAnchorElement)||t.target||t.hasAttribute(`download`))return;let i=new URL(t.href,window.location.href);if(i.origin!==window.location.origin)return;let a=n(i.pathname);r.has(a)&&(e.preventDefault(),o(`${a}${i.search}${i.hash}`))}Ji(()=>(So(),BO(),zO(),document.addEventListener(`click`,s,!0),()=>{document.removeEventListener(`click`,s,!0)})),window.addEventListener(`popstate`,async()=>{if(!await Go()){history.pushState(null,``,i);return}i=window.location.pathname+window.location.search+window.location.hash,F(a,n(window.location.pathname),!0),So(),zO()}),kn(()=>{V(a)===`/blueprint`?document.documentElement.setAttribute(`data-blueprint`,``):document.documentElement.removeAttribute(`data-blueprint`)});function c(e){o(e)}var l=Wr(),u=R(l),d=e=>{FD(e,{})},f=e=>{Cs(e,{navigate:c})},p=e=>{lp(e,{})},m=e=>{Gg(e,{})},h=e=>{r_(e,{})},g=e=>{L_(e,{navigate:c})},_=e=>{wT(e,{})},v=e=>{kT(e,{})},y=e=>{GT(e,{})},b=e=>{kO(e,{})},x=e=>{vT(e,{})},S=e=>{var t=VO(),n=L(t);j(t),B(()=>G(n,`Route "${V(a)??``}" — not yet migrated.`)),W(e,t)};K(u,e=>{V(a)===`/templates`?e(d):V(a)===`/admin`?e(f,1):V(a)===`/blueprint`?e(p,2):V(a)===`/workspace`?e(m,3):V(a)===`/files`?e(h,4):V(a)===`/context`?e(g,5):V(a)===`/diagram`?e(_,6):V(a)===`/graph`?e(v,7):V(a)===`/shape-editor`?e(y,8):V(a)===`/survival-kit`?e(b,9):V(a)===`/`?e(x,10):e(S,-1)}),W(e,l),Je()}var UO=new Set,WO=!1;function GO(e){UO.add(e)}function KO(){if(WO)return;WO=!0;let e=window.fetch.bind(window);window.fetch=async(t,n)=>{let r=await e(t,n);try{let e=typeof t==`string`?t:t instanceof URL?t.toString():t.url;(n?.method||(t instanceof Request?t.method:`GET`)).toUpperCase()===`GET`&&/\/api\/config(?:\?|$)/.test(e)&&r.clone().json().then(e=>{for(let t of UO)try{t(e)}catch{}}).catch(()=>{})}catch{}return r}}as(),GO(e=>os(e)),GO(e=>Ko.syncFromConfig(e)),GO(ya),KO(),So(),Ca(Sa()).finally(()=>{let e=document.getElementById(`app`);if(!e)throw Error(`#app element is missing`);Gr(HO,{target:e})});export{LT as a,VT as c,AT as d,fd as f,RT as i,HT as l,Y as m,IT as n,BT as o,Ca as p,zT as r,FT as s,MT as t,jT as u};
|