living-ai-documentation 3.5.0 → 3.6.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.
|
@@ -88,7 +88,7 @@ Texte`};case`link`:return{text:Ce(`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=cm(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 um(e,t,n){if(!e||typeof t!=`string`)return()=>{};let r=em(t);nm(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=Wp(e.type),o=Kp(e.type);im(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=lm(t,e,i.target,r,i.clientY);o!==null&&(i.preventDefault(),im(i,{iconClass:`fa-solid fa-plus`,labelKey:`snippet.inline_insert_btn`,dataAction:`insert`,onActivate:()=>n.onInsert(o)}))};e.addEventListener(`contextmenu`,i);let a=e.closest(`#home-content-area`)||e.closest(`main`),o=null;a&&(o=r=>{r.defaultPrevented||e.offsetParent!==null&&(r.target?.closest(`textarea, input, [data-inline-snippet-index]`)||e.contains(r.target)||(r.preventDefault(),im(r,{iconClass:`fa-solid fa-plus`,labelKey:`snippet.inline_insert_btn`,dataAction:`insert`,onActivate:()=>n.onInsert(t.length)})))},a.addEventListener(`contextmenu`,o));let s=e=>{Jp&&!Jp.contains(e.target)&&rm()},c=e=>{e.key===`Escape`&&rm()};return document.addEventListener(`click`,s),document.addEventListener(`keydown`,c),()=>{e.removeEventListener(`contextmenu`,i),a&&o&&a.removeEventListener(`contextmenu`,o),document.removeEventListener(`click`,s),document.removeEventListener(`keydown`,c),rm(),e.querySelectorAll(`[data-inline-snippet-index]`).forEach(e=>{e.removeAttribute(`data-inline-snippet-index`),e.classList.remove(`ld-inline-snippet-target`)})}}var dm=W(`<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>`),fm=W(`<span class="text-xs text-gray-400 dark:text-gray-500"> </span>`),pm=W(`<span> </span>`),mm=W(`<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>`),hm=W(`<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>`),gm=Vr(`<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>`),_m=W(`<div data-testid="view-actions" class="flex items-center gap-2"><!> <button><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 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 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-link"></i> </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 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> <button 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> <button><i class="fa-solid fa-list-ul"></i></button></div>`),vm=W(`<span class="text-gray-300 dark:text-gray-600 mx-1">·</span>`),ym=W(`<!> <button class="text-blue-600 dark:text-blue-400 hover:underline"> </button>`,1),bm=W(`<div class="no-print mt-2 flex flex-wrap gap-1 text-xs"></div>`),xm=W(`<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>`),Sm=W(`<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>`),Cm=W(`<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>`),wm=W(`<div id="doc-content" data-testid="doc-content"></div>`),Tm=W(`<li class="m-0 p-0"><a class="block 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"> </a></li>`),Em=W(`<div></div> <aside class="no-print shrink-0 sticky top-0 self-start max-h-screen 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),Dm=W(`<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>`),Om=W(`<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>`),km=W(`<div class="fixed inset-0 z-50 bg-black/90 flex items-center justify-center cursor-pointer"><img class="max-w-full max-h-full object-contain select-none"/> <button class="absolute top-4 right-4 text-white/70 hover:text-white text-2xl leading-none">×</button></div>`),Am=W(`<header id="home-doc-header" class="sticky top-0 z-10 bg-gray-50 dark:bg-gray-950 px-6 pt-8 pb-6 mb-0 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 mb-2 flex-wrap"><span class="flex items-center gap-2 flex-wrap"><!> <span class="inline-block text-xs font-semibold px-2.5 py-0.5 rounded-full bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300"> </span></span> <!></div> <div class="flex items-center gap-2"><h1 data-testid="doc-title" class="min-w-0 text-2xl font-bold text-gray-900 dark:text-gray-50 leading-tight"> </h1> <button type="button" data-testid="copy-doc-id-btn"><i aria-hidden="true"></i></button></div></div> <div class="flex items-center gap-2 flex-wrap ml-auto"><!></div></div> <!> <!> <!> <div class="hidden no-print"></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 jm(e,t){Ge(t,!0);let n=Bi(t,`navHistory`,19,()=>[]),r=F(null),i=F(null),a=F(null),o=F(null),s=F(!1),c=F(!1),l=F(`insert`),u=F(null),d=F(0),f=null;Vi(()=>{let e=window;return e.openSnippetsModal=()=>{I(l,`insert`),I(c,!0)},e.openSnippetsModalForInlineInsert=e=>{I(l,`inline-insert`),I(d,Math.max(0,Number(e)||0),!0),I(c,!0)},()=>{delete e.openSnippetsModal,delete e.openSnippetsModalForInlineInsert}});let p=F(null),m=F(L([])),h=``,g=P(()=>H(m).length?Y(H(m).length===1?`search.notice_singular`:`search.notice_plural`).replace(`{count}`,String(H(m).length)).replace(`{query}`,$.searchQuery):``),_=P(()=>Yd(t.doc.content)),v=P(()=>(H(_)||``).toUpperCase()===`TO BE VALIDATED`),y=F(!1),b=F(``),x=F(null),S=F(!1),C=F(!1),w=F(!1),T=F(!1),E=F(``),D=F(`png`),ee=null,O=0,te=0,k=F(null),ne=F(``),re=/[̀-ͯ]/g;function ie(e){return(e||``).normalize(`NFD`).replace(re,``).toLowerCase().replace(/[^a-z0-9]/g,`_`)}function ae(e){let t=document.getElementById(`home-content-area`),n=document.getElementById(e);if(!t||!n)return;let r=document.querySelector(`#home-doc-view header`),i=r?r.getBoundingClientRect().height:0;t.scrollTop+=n.getBoundingClientRect().top-t.getBoundingClientRect().top-i-8}On(()=>{let e=t.doc.id,n=$.searchQuery;if(f?.(),f=null,H(y)||!H(r))return;Cd(H(r),t.doc.html,{content:t.doc.content,codeBlockMaxHeight:$.codeBlockMaxHeight,t:Y,onDocLink:(e,n)=>t.onopen(e,n),onAnchor:ae});let i=typeof n==`string`&&n.toLowerCase().startsWith(`metadata://`);I(m,n&&!i?Bp(H(r),n):[],!0),H(p)&&Rp(H(r),H(p),Y),f=um(H(r),t.doc.content,{onEdit:e=>{I(l,`inline-edit`),I(u,e,!0),I(c,!0)},onInsert:e=>{I(l,`inline-insert`),I(d,e,!0),I(c,!0)},onDelete:async e=>{await H(o).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})&&await t.onsave(t.doc.content.slice(0,e.start)+t.doc.content.slice(e.end))}}),e===h?H(a)?.apply():(h=e,H(a)?.load(e),Gd.load(e)),I(ce,Array.from(H(r).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)});async function oe(){let e=1;try{let n=await Gd.load(t.doc.id);n&&typeof n.accuracy==`number`&&(e=n.accuracy)}catch{}let n=Math.round(e*100),r=n<100,i=Zd(t.doc.id),a=Y(i?`doc.validate_worklog_message`:`doc.validate_message`),s=r?Y(`doc.validate_detail_low_accuracy`).replace(`{accuracy}`,n+`%`):void 0;if(!await H(o).show({title:Y(`doc.validate_title`),message:a,detail:s,confirmLabel:Y(`doc.validate_confirm`),cancelLabel:Y(`common.cancel`)}))return;let c=Xd(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 Gd.load(t.doc.id),$.docStatuses={...$.docStatuses,[t.doc.id]:i?`Done`:`Accepted`}}catch(e){I(x,{text:Y(`doc.validate_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`},!0)}}On(()=>{try{I(S,localStorage.getItem(`ld-full-width`)===`1`)}catch{}});let se=F(!1),ce=F(L([])),le=`ld-toc-w`,ue=F(!1),de=F(null);function fe(e){if(e.preventDefault(),!H(de))return;let t=e.clientX,n=H(de).getBoundingClientRect().width;I(ue,!0),H(de).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)));H(de).style.width=r+`px`},i=()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i),document.body.style.cursor=``,document.body.style.userSelect=``,I(ue,!1),H(de).style.transition=``;try{localStorage.setItem(le,String(parseInt(H(de).style.width,10)))}catch{}};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)}On(()=>{try{I(se,localStorage.getItem(`ld-toc-open`)===`1`)}catch{}try{let e=parseInt(localStorage.getItem(le)||``,10);H(de)&&e>=160&&e<=400&&(H(de).style.width=e+`px`)}catch{}});function pe(){I(se,!H(se));try{localStorage.setItem(`ld-toc-open`,H(se)?`1`:`0`)}catch{}}function me(e){let t=document.getElementById(e),n=document.getElementById(`home-content-area`),r=document.getElementById(`home-doc-header`);if(!t||!n)return;let i=t.parentElement;for(;i&&i!==n;)i.tagName===`DETAILS`&&(i.open=!0),i=i.parentElement;let a=r?r.getBoundingClientRect().height:0,o=t.getBoundingClientRect().top-n.getBoundingClientRect().top+n.scrollTop;n.scrollTo({top:o-a-16,behavior:`smooth`})}function he(){I(b,t.doc.content,!0),I(y,!0),I(x,null),requestAnimationFrame(()=>H(i)?.focus())}function ge(){I(y,!1),I(x,null)}async function _e(){I(x,{text:Y(`doc.saving`),cls:`text-gray-400`},!0);try{await t.onsave(H(b)),I(y,!1),I(x,null)}catch(e){I(x,{text:Y(`error.save`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`},!0)}}function ve(e){let t=Array.from(e.clipboardData?.items??[]).find(e=>e.type.startsWith(`image/`));if(t){e.preventDefault(),O=H(i).selectionStart,te=H(i).selectionEnd,I(D,t.type.split(`/`)[1].replace(`jpeg`,`jpg`)||`png`,!0);let n=t.getAsFile();if(!n)return;ee=n,I(E,ie(Date.now().toString()),!0),I(T,!0);return}let n=Array.from(e.clipboardData?.files??[]).filter(e=>!e.type.startsWith(`image/`));if(n.length){e.preventDefault();let t=H(i).selectionStart,r=H(i).selectionEnd;(async()=>{for(let e of n)await Ce(e,t,r)})()}}function ye(e){let t=Array.from(e.dataTransfer?.files??[]).filter(e=>!e.type.startsWith(`image/`));if(!t.length)return;e.preventDefault(),e.stopPropagation();let n=H(i).selectionStart,r=H(i).selectionEnd;(async()=>{for(let e of t)await Ce(e,n,r)})()}function be(e){e.dataTransfer?.types?.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)}function xe(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=H(b).slice(0,t),a=H(b).slice(n);I(b,r+e+a),requestAnimationFrame(()=>{H(i).selectionStart=H(i).selectionEnd=t+e.length,H(i).focus()})}async function Ce(e,t,n){if(e.size>19922944){I(x,{text:Y(`doc.file_too_large`)+` (${(e.size/1024/1024).toFixed(1)} MB, max 19 MB)`,cls:`text-red-500 dark:text-red-400`},!0);return}I(x,{text:Y(`doc.uploading_file`),cls:`text-gray-400`},!0);try{let r=await xe(e),i=await fetch(`/api/files/upload`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:r,name:e.name})});if(!i.ok){let e=``;try{e=(await i.json()).error||``}catch{e=await i.text()}throw Error(e||`HTTP ${i.status}`)}let{url:a,originalName:o}=await i.json();Se(`[📎 ${o||e.name}](${a})`,t,n),I(x,null)}catch(e){I(x,{text:Y(`doc.file_upload_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`},!0)}}function we(){I(T,!1),ee=null}async function Te(){let e=ie(H(E))||Date.now().toString();if(I(T,!1),ee){I(x,{text:Y(`doc.uploading_image`),cls:`text-gray-400`},!0);try{let t=await xe(ee),n=await fetch(`/api/images/upload`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:t,ext:H(D),name:e})});if(!n.ok)throw Error(await n.text());let{filename:r}=await n.json();Se(``,O,te),I(x,null)}catch(e){I(x,{text:Y(`doc.image_upload_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`},!0)}finally{ee=null}}}async function A(){try{await navigator.clipboard.writeText(location.href)}catch{}}async function Ee(){try{await navigator.clipboard.writeText(decodeURIComponent(t.doc.id)),I(w,!0),setTimeout(()=>I(w,!1),1800)}catch{}}function De(){window.print()}function Oe(e){let t=e.target.closest(`img`);!t||!e.shiftKey||(e.preventDefault(),e.stopPropagation(),I(k,t.src,!0),I(ne,t.alt||``,!0))}function ke(e){e.key===`Escape`&&H(k)&&I(k,null)}var Ae=Am();Mr(`keydown`,an,ke);var j=z(Ae),je=R(j),M=R(je),Me=R(M),Ne=R(Me),Pe=R(Ne);$r(Pe,17,()=>t.doc.folder||[],Yr,(e,t)=>{var n=dm(),r=R(n,!0);N(n),V(e=>{J(n,`title`,H(t)),K(r,e)},[()=>Bu(H(t))]),G(e,n)});var Fe=B(Pe,2),Ie=R(Fe,!0);N(Fe),N(Ne);var Le=B(Ne,2),Re=e=>{var n=fm(),r=R(n,!0);N(n),V(()=>K(r,t.doc.formattedDate)),G(e,n)};q(Le,e=>{t.doc.formattedDate&&e(Re)}),N(Me);var ze=B(Me,2),Be=R(ze),Ve=R(Be,!0);N(Be);var He=B(Be,2),Ue=R(He);N(He),N(ze),N(M);var We=B(M,2),qe=R(We),Je=e=>{var t=mm(),n=R(t),r=e=>{var t=pm(),n=R(t,!0);N(t),V(()=>{hi(t,1,`text-xs ${H(x).cls??``}`),K(n,H(x).text)}),G(e,t)};q(n,e=>{H(x)&&e(r)});var i=B(n,2),a=R(i,!0);N(i);var o=B(i,2),s=R(o,!0);N(o);var u=B(o,2),d=R(u,!0);N(u),N(t),V((e,t,n,r)=>{K(a,e),J(o,`title`,t),K(s,n),K(d,r)},[()=>Y(`common.cancel`),()=>Y(`doc.snippets`),()=>Y(`doc.snippets_btn`),()=>Y(`common.save`)]),U(`click`,i,ge),U(`click`,o,()=>{I(l,`insert`),I(c,!0)}),U(`click`,u,_e),G(e,t)},Ye=e=>{let t=P(()=>$.markerActive?`#fef08a`:`#bfdbfe`),n=P(()=>$.markerActive?`#fef08a`:`#93c5fd`),r=P(()=>$.markerActive?`#fde047`:`#93c5fd`);var i=_m(),a=R(i),o=e=>{var t=hm(),n=B(R(t),1,!0);N(t),V((e,r)=>{J(t,`title`,e),K(n,r)},[()=>Y(`doc.validate_mode`),()=>Y(`doc.validate_btn`)]),U(`click`,t,oe),G(e,t)};q(a,e=>{H(v)&&e(o)});var c=B(a,2),l=R(c),u=R(l),d=B(u),f=B(d),p=B(f),m=B(p,2),h=e=>{G(e,gm())};q(m,e=>{$.markerHidden&&e(h)}),N(l);var g=B(l,1,!0);N(c);var _=B(c,2),y=R(_);N(_);var b=B(_,2),x=B(R(b));N(b);var S=B(b,2),w=B(R(S));N(S);var T=B(S,2),E=B(R(T));N(T);var D=B(T,2),ee=B(R(D));N(D);var O=B(D,2);N(i),V((e,i,a,o,s,l,m,h,v,C,te,k,ne)=>{J(c,`title`,e),hi(c,1,`no-print text-sm px-3 py-1.5 rounded-lg border transition-colors ${$.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(u,`fill`,H(t)),J(d,`fill`,H(n)),J(f,`fill`,H(r)),J(p,`fill`,H(r)),K(g,i),J(_,`title`,a),K(y,`📄 ${o??``}`),J(b,`title`,s),K(x,` ${l??``}`),J(S,`title`,m),K(w,` ${h??``}`),J(T,`title`,v),K(E,` ${C??``}`),J(D,`title`,te),K(ee,` ${k??``}`),J(O,`title`,ne),hi(O,1,`no-print text-sm px-3 py-1.5 rounded-lg border transition-colors ${H(se)?`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.marker_mode`),()=>Y(`doc.marker_btn`),()=>Y(`doc.export_pdf`),()=>Y(`doc.export_pdf_btn`),()=>Y(`doc.copy_link`),()=>Y(`doc.copy_link_btn`),()=>Y(`metadata.button_title`),()=>Y(`metadata.button`),()=>Y(`doc.edit`),()=>Y(`doc.edit_btn`),()=>Y(`doc.delete`),()=>Y(`doc.delete_btn`),()=>Y(`doc.toc_toggle`)]),U(`click`,c,()=>$.toggleMarker()),U(`click`,_,De),U(`click`,b,A),U(`click`,S,()=>I(s,!0)),U(`click`,T,he),U(`click`,D,()=>I(C,!0)),U(`click`,O,pe),G(e,i)};q(qe,e=>{H(y)?e(Je):e(Ye,-1)}),N(We),N(je);var Xe=B(je,2),Ze=e=>{qd(e,{onopen:()=>I(s,!0)})};q(Xe,e=>{H(y)||e(Ze)});var Qe=B(Xe,2),$e=e=>{var r=bm();$r(r,21,n,Yr,(e,n,r)=>{var i=ym(),a=z(i),o=e=>{G(e,vm())};q(a,e=>{r>0&&e(o)});var s=B(a,2),c=R(s);N(s),V(()=>K(c,`← ${H(n).title??``}`)),U(`click`,s,()=>t.ongoback?.(r)),G(e,i)}),N(r),G(e,r)};q(Qe,e=>{!H(y)&&n().length&&e($e)});var et=B(Qe,2),tt=e=>{var t=Sm(),n=R(t),r=R(n,!0);N(n);var i=B(n,2);$r(i,23,()=>H(m),e=>e.id,(e,t,n)=>{var r=xm(),i=R(r),a=R(i),o=R(a);N(a);var s=B(a),c=R(s,!0);N(s),N(i),N(r),V(()=>{K(o,`${H(n)+1}.`),K(c,H(t).snippet)}),U(`click`,i,()=>Vp(H(t).id)),G(e,r)}),N(i),N(t),V(()=>K(r,H(g))),G(e,t)};q(et,e=>{!H(y)&&H(m).length&&$.searchQuery&&e(tt)}),Li(B(et,2),e=>I(p,e),()=>H(p)),N(j);var nt=B(j,2),rt=R(nt),it=R(rt),at=e=>{var t=Cm();vn(t),Li(t,e=>I(i,e),()=>H(i)),Mr(`paste`,t,ve),Mr(`drop`,t,ye),Mr(`dragover`,t,be),Mi(t,()=>H(b),e=>I(b,e)),G(e,t)},ot=e=>{var t=wm();Li(t,e=>I(r,e),()=>H(r)),V(()=>hi(t,1,`prose prose-gray dark:prose-invert max-w-none prose-headings:scroll-mt-4 prose-a:text-blue-600 dark:prose-a:text-blue-400 prose-code:before:content-none prose-code:after:content-none ${$.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`} ${$.imageRoundedCorners?`[&_img]:rounded-xl`:``} ${$.imageCentered?`[&_img]:mx-auto [&_img]:block`:``} ${$.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)]`:``}`)),U(`click`,t,Oe),G(e,t)};q(it,e=>{H(y)?e(at):e(ot,-1)}),N(rt);var st=B(rt,2),ct=e=>{var t=Em(),n=z(t),r=B(n,2);_i(r,`width: 224px`);var i=R(r),a=R(i,!0);N(i);var o=B(i,2),s=R(o);$r(s,21,()=>H(ce),Yr,(e,t)=>{var n=Tm(),r=R(n),i=R(r,!0);N(r),N(n),V(()=>{_i(n,`padding-left: ${(H(t).level-1)*.75}rem`),J(r,`href`,`#${H(t).id??``}`),J(r,`title`,H(t).text),K(i,H(t).text)}),U(`click`,r,e=>{e.preventDefault(),me(H(t).id)}),G(e,n)}),N(s),N(o),N(r),Li(r,e=>I(de,e),()=>H(de)),V(e=>{hi(n,1,`no-print w-1 shrink-0 self-stretch cursor-col-resize select-none transition-colors ${H(ue)?`bg-blue-500/60`:`bg-transparent hover:bg-blue-500/40`}`),K(a,e)},[()=>Y(`doc.toc_title`)]),U(`mousedown`,n,fe),G(e,t)};q(st,e=>{H(se)&&H(ce).length>0&&e(ct)}),N(nt);var lt=B(nt,2);Li(zd(lt,{get contentEl(){return H(r)},get docId(){return t.doc.id}}),e=>I(a,e,!0),()=>H(a));var ut=B(lt,2);hf(ut,{get open(){return H(s)},get docId(){return t.doc.id},get content(){return t.doc.content},onclose:()=>I(s,!1)});var dt=B(ut,2);jp(dt,{get open(){return H(c)},get editor(){return H(i)},get mode(){return H(l)},get content(){return t.doc.content},get range(){return H(u)},get insertPos(){return H(d)},get onsave(){return t.onsave},onclose:()=>I(c,!1)});var ft=B(dt,2);Li(Dl(ft,{}),e=>I(o,e,!0),()=>H(o));var pt=B(ft,2),mt=e=>{var t=Dm(),n=R(t),r=R(n),i=R(r);N(r);var a=B(r,2),o=R(a),s=R(o),c=B(s),l=R(c,!0);N(c),N(o);var u=B(o,2),d=R(u);Ei(d);var f=B(d,2),p=R(f);N(f),N(u),N(a);var m=B(a,2),h=R(m),g=R(h,!0);N(h);var _=B(h,2),v=R(_,!0);N(_),N(m),N(n),N(t),V((e,t,n,r,a)=>{K(i,`🖼️ ${e??``}`),K(s,`${t??``} `),K(l,n),Di(d,H(E)),K(p,`.${H(D)??``}`),K(g,r),K(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`)]),U(`input`,d,e=>I(E,ie(e.target.value),!0)),U(`click`,h,we),U(`click`,_,Te),G(e,t)};q(pt,e=>{H(T)&&e(mt)});var ht=B(pt,2),gt=e=>{var n=Om(),r=R(n),i=R(r),a=R(i,!0);N(i);var o=B(i,2),s=R(o,!0);N(o);var c=B(o,2),l=R(c),u=R(l,!0);N(l);var d=B(l,2),f=R(d,!0);N(d),N(c),N(r),N(n),V((e,n,r)=>{K(a,e),K(s,t.doc.title),K(u,n),K(f,r)},[()=>Y(`doc.confirm_delete`),()=>Y(`common.cancel`),()=>Y(`doc.confirm_delete_btn`)]),U(`click`,n,e=>{e.target===e.currentTarget&&I(C,!1)}),U(`click`,l,()=>I(C,!1)),U(`click`,d,async()=>{I(C,!1),await t.ondelete()}),G(e,n)};q(ht,e=>{H(C)&&e(gt)});var _t=B(ht,2),vt=e=>{var t=km(),n=R(t),r=B(n,2);N(t),V(()=>{J(n,`src`,H(k)),J(n,`alt`,H(ne))}),U(`click`,t,()=>I(k,null)),U(`click`,n,e=>e.stopPropagation()),U(`click`,r,()=>I(k,null)),G(e,t)};q(_t,e=>{H(k)&&e(vt)}),V(e=>{K(Ie,t.doc.category),K(Ve,t.doc.title),J(He,`title`,e),hi(He,1,`no-print inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-gray-200 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 ${H(w)?`text-green-600 dark:text-green-400`:``}`),hi(Ue,1,`fa-${H(w)?`solid fa-check`:`regular fa-copy`}`)},[()=>Y(`doc.copy_mcp_id`)]),U(`click`,He,Ee),G(e,Ae),Ke()}Nr([`click`,`mousedown`,`input`]);var Mm=W(`<p class="px-3 py-4 text-xs text-gray-400 text-center"> </p>`),Nm=W(`<p class="px-3 py-3 text-xs text-red-400 text-center"> </p>`),Pm=W(`<p class="px-3 py-3 text-xs text-gray-400 text-center"> </p>`),Fm=W(`<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>`),Im=W(`<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>`),Lm=W(`<p class="text-xs text-red-500"> </p>`),Rm=W(`<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 zm(e,t){Ge(t,!0);let n=F(``),r=F(null),i=F(null),a=F(``),o=F(``),s=F(`/ (root)`),c=F(!1),l=F(``),u=F(L([])),d=F(!1),f=F(!1),p=F(``),m=F(!1),h=F(null),g=!1;On(()=>{t.open&&!g?(g=!0,_()):t.open||(g=!1)});async function _(){try{I(n,(await fetch(`/api/config`).then(e=>e.json())).docsFolder||``,!0)}catch{I(n,``)}let e=``;if($.currentDocId){let t=decodeURIComponent($.currentDocId);if(!t.startsWith(`/`)){let n=t.split(`/`);n.length>1&&(e=n.slice(0,-1).join(`/`))}}I(a,e?H(n)+`/`+e:H(n),!0),I(r,H(a),!0),I(i,null),I(o,``),I(s,e?`/`+e:`/ (root)`,!0),I(c,!1),I(p,``),I(m,!1),setTimeout(()=>H(h)?.focus(),50)}let v=P(()=>{let e=H(o).trim();if(!e)return Y(`modal.new_folder.enter_name`);let t=H(a)||H(n),r=t.startsWith(H(n))?t.slice(H(n).length).replace(/^\//,``):``;return(r?r+`/`:``)+e});function y(){I(c,!H(c)),H(c)&&b(H(r)||H(n))}async function b(e){I(d,!0),I(f,!1);try{let t=await fetch(`/api/browse?path=`+encodeURIComponent(e)).then(e=>e.json());I(r,t.current,!0),I(i,t.parent,!0),I(a,t.current,!0),I(l,t.current,!0),I(s,(t.current.startsWith(H(n)+`/`)?t.current.slice(H(n).length):t.current===H(n)?``:t.current)||`/ (root)`,!0),I(u,t.dirs||[],!0)}catch{I(f,!0),I(u,[],!0)}finally{I(d,!1)}}let x=P(()=>H(r)===H(n));function S(){H(i)&&b(H(i))}async function C(){let e=H(o).trim();if(I(p,``),!e){I(p,Y(`modal.new_folder.error_empty`),!0);return}if(!/^[a-zA-Z0-9_\-. ]+$/.test(e)){I(p,Y(`modal.new_folder.error_invalid_chars`),!0);return}let r=H(a)||H(n);if(r===H(n)&&(e===`files`||e===`images`)){I(p,Y(`modal.new_folder.error_reserved`),!0);return}let i=r.endsWith(`/`)?r+e:r+`/`+e;I(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){I(m,!1),I(p,Y(`common.error_prefix`)+(e instanceof Error?e.message:String(e)))}}var w=Ur(),T=z(w),E=e=>{var n=Rm(),r=R(n),i=R(r),a=B(R(i),2),g=R(a,!0);N(a),N(i);var _=B(i,2),w=R(_),T=R(w,!0);N(w);var E=B(w,2);Ei(E),Li(E,e=>I(h,e),()=>H(h)),N(_);var D=B(_,2),ee=R(D),O=R(ee,!0);N(ee);var te=B(ee,2),k=R(te),ne=R(k,!0);N(k);var re=B(k,2),ie=R(re,!0);N(re),N(te);var ae=B(te,2),oe=e=>{var t=Im(),n=R(t),r=R(n),i=R(r,!0);N(r);var a=B(r,2),o=R(a,!0);N(a),N(n);var s=B(n,2),c=R(s),p=e=>{var t=Mm(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.loading`)]),G(e,t)},m=e=>{var t=Nm(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`modal.new_folder.error_loading`)]),G(e,t)},h=e=>{var t=Pm(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`modal.new_folder.no_subfolders`)]),G(e,t)},g=e=>{var t=Ur();$r(z(t),17,()=>H(u),e=>e.path,(e,t)=>{var n=Fm(),r=B(R(n),2),i=R(r,!0);N(r),N(n),V(()=>K(i,H(t).name)),U(`click`,n,()=>b(H(t).path)),G(e,n)}),G(e,t)};q(c,e=>{H(d)?e(p):H(f)?e(m,1):H(u).length===0?e(h,2):e(g,-1)}),N(s),N(t),V(e=>{r.disabled=H(x),K(i,e),K(o,H(l))},[()=>Y(`common.up`)]),U(`click`,r,S),G(e,t)};q(ae,e=>{H(c)&&e(oe)}),N(D);var se=B(D,2),ce=R(se),le=R(ce,!0);N(ce);var ue=B(ce,2),de=R(ue,!0);N(ue),N(se);var fe=B(se,2),pe=e=>{var t=Lm(),n=R(t,!0);N(t),V(()=>K(n,H(p))),G(e,t)};q(fe,e=>{H(p)&&e(pe)});var me=B(fe,2),he=R(me),ge=R(he,!0);N(he);var _e=B(he,2),ve=R(_e,!0);N(_e),N(me),N(r),N(n),V((e,t,n,r,i,a,o,c)=>{K(g,e),K(T,t),J(E,`placeholder`,n),K(O,r),K(ne,H(s)),K(ie,i),K(le,a),K(de,H(v)),K(ge,o),_e.disabled=H(m),K(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`),()=>H(m)?Y(`modal.new_folder.creating_btn`):Y(`modal.new_folder.create_btn`)]),U(`click`,n,e=>{e.target===e.currentTarget&&t.onclose()}),Mi(E,()=>H(o),e=>I(o,e)),U(`click`,re,y),U(`click`,he,function(...e){t.onclose?.apply(this,e)}),U(`click`,_e,C),G(e,n)};q(T,e=>{t.open&&e(E)}),G(e,w),Ke()}Nr([`click`]);var Bm=W(`<option></option>`),Vm=W(`<p class="px-3 py-4 text-xs text-gray-400 text-center"> </p>`),Hm=W(`<p class="px-3 py-4 text-xs text-red-400 text-center"> </p>`),Um=W(`<p class="px-3 py-3 text-xs text-gray-400 text-center"> </p>`),Wm=W(`<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="text-gray-700 dark:text-gray-300 truncate"> </span></button>`),Gm=W(`<div class="border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden"><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="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-40 overflow-y-auto"><!></div> <div class="border-t border-gray-200 dark:border-gray-700 flex items-center gap-2 px-3 py-2 bg-gray-50 dark:bg-gray-800/50"><input type="text" class="flex-1 px-2 py-1 text-xs rounded border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-1 focus:ring-blue-400"/> <button class="text-xs px-2 py-1 rounded bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors shrink-0"> </button></div></div>`),Km=W(`<p class="text-xs text-red-500"> </p>`),qm=W(`<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-lg mx-4 p-6 space-y-4"><h3 class="text-base font-semibold text-gray-900 dark:text-gray-50">➕ <span> </span></h3> <div class="space-y-1.5"><label for="new-doc-title" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="new-doc-title" 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 for="new-doc-category" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="new-doc-category" type="text" list="new-doc-category-options" autocomplete="off" placeholder="GENERAL" 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"/> <datalist id="new-doc-category-options"></datalist></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 px-3 py-2 text-xs rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 font-mono truncate"> </span> <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> <div class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <p class="text-xs bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 font-mono text-gray-600 dark:text-gray-300 break-all"> </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 Jm(e,t){Ge(t,!0);let n=F(``),r=F(`YYYY_MM_DD_HH_mm_[Category]_title`),i=F(null),a=F(null),o=F(``),s=F(``),c=F(``),l=F(`/ (root)`),u=F(!1),d=F(``),f=F(L([])),p=F(!1),m=F(!1),h=F(``),g=F(L([])),_=F(``),v=F(!1),y=F(null);function b(e){return(e||``).normalize(`NFD`).replace(/[̀-ͯ]/g,``).toUpperCase().replace(/[^A-Z0-9_-]/g,``)}function x(e){let t=H(n);return e===t?``:e.startsWith(t+`/`)?e.slice(t.length+1):e}let S=!1;On(()=>{t.open&&!S?(S=!0,C()):t.open||(S=!1)});async function C(){try{let e=await fetch(`/api/config`).then(e=>e.json());I(n,e.docsFolder||``,!0),I(r,e.filenamePattern||`YYYY_MM_DD_HH_mm_[Category]_title`,!0)}catch{I(n,``),I(r,`YYYY_MM_DD_HH_mm_[Category]_title`)}let e=$.currentDocId&&$.allDocs.find(e=>e.id===$.currentDocId),t=b(e&&e.category||`General`)||`GENERAL`,d=``;if($.currentDocId){let e=decodeURIComponent($.currentDocId);if(!e.startsWith(`/`)){let t=e.split(`/`);t.length>1&&(d=t.slice(0,-1).join(`/`))}}let f=d?H(n)+`/`+d:``;I(o,d,!0),I(i,f||null,!0),I(a,null),w(),I(s,``),I(c,t,!0),I(l,d?`/`+d:`/ (root)`,!0),I(u,!1),I(h,``),I(_,``),I(v,!1),setTimeout(()=>H(y)?.focus(),50)}function w(){let e=new Set;($.allDocs||[]).forEach(t=>{let n=b(t.category||``);n&&e.add(n)}),I(g,Array.from(e).sort((e,t)=>e.localeCompare(t)),!0)}function T(){let e=b(H(c));H(c)!==e&&I(c,e,!0)}let E=P(()=>{let e=H(s).trim();if(!e)return Y(`modal.new_doc.title_placeholder`);let t=b(H(c))||`GENERAL`,n=new Date,i=n.getFullYear(),a=String(n.getMonth()+1).padStart(2,`0`),l=String(n.getDate()).padStart(2,`0`),u=String(n.getHours()).padStart(2,`0`),d=String(n.getMinutes()).padStart(2,`0`),f=e.toLowerCase().replace(/\s+/g,`_`).replace(/[^a-z0-9_]/g,``).replace(/_+/g,`_`).replace(/^_|_$/g,``)||`document`,p=H(r).replace(`YYYY`,String(i)).replace(`MM`,a).replace(`DD`,l).replace(`HH`,u).replace(`mm`,d).replace(/\[Category\]/i,`[${t}]`).replace(/(?<![a-z0-9])(?:title_words|title)(?![a-z0-9])/i,f)+`.md`;return H(o)?H(o)+`/`+p:p});function D(){I(u,!H(u)),H(u)&&ee(H(i)||H(n))}async function ee(e){I(p,!0),I(m,!1);try{let t=await fetch(`/api/browse?path=`+encodeURIComponent(e)).then(e=>e.json());I(i,t.current,!0),I(a,t.parent,!0),I(o,x(t.current),!0),I(d,t.current,!0),I(l,H(o)?`/`+H(o):`/ (root)`,!0),I(f,t.dirs||[],!0)}catch{I(m,!0),I(f,[],!0)}finally{I(p,!1)}}let O=P(()=>H(i)===H(n));function te(){H(i)!==H(n)&&H(a)&&ee(H(a))}function k(){let e=H(h).trim();if(!e)return;let t=H(i)||H(n);if(t===H(n)&&(e===`files`||e===`images`)){I(_,Y(`modal.new_folder.error_reserved`),!0);return}I(_,``);let r=(x(t)?x(t)+`/`:``)+e;I(o,r),I(l,`/`+r),I(h,``)}async function ne(){let e=H(s).trim(),n=b(H(c))||`GENERAL`;if(!e){I(_,Y(`modal.new_doc.error_empty_title`),!0);return}I(_,``),I(v,!0);try{let r=await fetch(`/api/documents`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:e,category:n,folder:H(o)})});if(!r.ok){let e=await r.json();throw Error(e.error||`Creation failed`)}let i=await r.json();t.onclose(),t.onsuccess(i.id)}catch(e){I(_,Y(`common.error_prefix`)+(e instanceof Error?e.message:String(e))),I(v,!1)}}function re(e){e.key===`Enter`&&ne(),e.key===`Escape`&&t.onclose()}var ie=Ur(),ae=z(ie),oe=e=>{var n=qm(),r=R(n),i=R(r),a=B(R(i)),o=R(a,!0);N(a),N(i);var b=B(i,2),x=R(b),S=R(x,!0);N(x);var C=B(x,2);Ei(C),Li(C,e=>I(y,e),()=>H(y)),N(b);var w=B(b,2),ie=R(w),ae=R(ie,!0);N(ie);var oe=B(ie,2);Ei(oe);var se=B(oe,2);$r(se,20,()=>H(g),e=>e,(e,t)=>{var n=Bm(),r={};V(()=>{r!==(r=t)&&(n.value=(n.__value=t)??``)}),G(e,n)}),N(se),N(w);var ce=B(w,2),le=R(ce),ue=R(le,!0);N(le);var de=B(le,2),fe=R(de),pe=R(fe,!0);N(fe);var me=B(fe,2),he=B(R(me)),ge=R(he,!0);N(he),N(me),N(de);var _e=B(de,2),ve=e=>{var t=Gm(),n=R(t),r=R(n),i=R(r);N(r);var a=B(r,2),o=R(a,!0);N(a),N(n);var s=B(n,2),c=R(s),l=e=>{var t=Vm(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.loading`)]),G(e,t)},u=e=>{var t=Hm(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.cannot_read_dir`)]),G(e,t)},g=e=>{var t=Um(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`modal.new_doc.no_subfolders`)]),G(e,t)},_=e=>{var t=Ur();$r(z(t),17,()=>H(f),e=>e.path,(e,t)=>{var n=Wm(),r=B(R(n),2),i=R(r,!0);N(r),N(n),V(()=>K(i,H(t).name)),U(`click`,n,()=>ee(H(t).path)),G(e,n)}),G(e,t)};q(c,e=>{H(p)?e(l):H(m)?e(u,1):H(f).length===0?e(g,2):e(_,-1)}),N(s);var v=B(s,2),y=R(v);Ei(y);var b=B(y,2),x=R(b,!0);N(b),N(v),N(t),V((e,t,n)=>{r.disabled=H(O),K(i,`↑ ${e??``}`),K(o,H(d)),J(y,`placeholder`,t),K(x,n)},[()=>Y(`common.up`),()=>Y(`modal.new_doc.new_folder_placeholder`),()=>Y(`modal.new_doc.create_folder_btn`)]),U(`click`,r,te),U(`keydown`,y,e=>{e.key===`Enter`&&k()}),Mi(y,()=>H(h),e=>I(h,e)),U(`click`,b,k),G(e,t)};q(_e,e=>{H(u)&&e(ve)}),N(ce);var ye=B(ce,2),be=R(ye),xe=R(be,!0);N(be);var Se=B(be,2),Ce=R(Se,!0);N(Se),N(ye);var we=B(ye,2),Te=e=>{var t=Km(),n=R(t,!0);N(t),V(()=>K(n,H(_))),G(e,t)};q(we,e=>{H(_)&&e(Te)});var A=B(we,2),Ee=R(A),De=R(Ee,!0);N(Ee);var Oe=B(Ee,2),ke=R(Oe,!0);N(Oe),N(A),N(r),N(n),V((e,t,n,r,i,a,s,c,u)=>{K(o,e),K(S,t),J(C,`placeholder`,n),K(ae,r),K(ue,i),K(pe,H(l)),K(ge,a),K(xe,s),K(Ce,H(E)),K(De,c),Oe.disabled=H(v),K(ke,u)},[()=>Y(`modal.new_doc.title`),()=>Y(`modal.new_doc.title_label`),()=>Y(`modal.new_doc.title_placeholder`),()=>Y(`modal.new_doc.category_label`),()=>Y(`modal.new_doc.location_label`),()=>Y(`modal.new_doc.browse_btn`),()=>Y(`modal.new_doc.filename_label`),()=>Y(`common.cancel`),()=>H(v)?Y(`modal.new_folder.creating_btn`):Y(`common.create`)]),U(`click`,n,e=>{e.target===e.currentTarget&&t.onclose()}),U(`keydown`,C,re),Mi(C,()=>H(s),e=>I(s,e)),U(`input`,oe,T),U(`keydown`,oe,re),Mi(oe,()=>H(c),e=>I(c,e)),U(`click`,me,D),U(`click`,Ee,function(...e){t.onclose?.apply(this,e)}),U(`click`,Oe,ne),G(e,n)};q(ae,e=>{t.open&&e(oe)}),G(e,ie),Ke()}Nr([`click`,`keydown`,`input`]);var Ym=W(`<p class="text-sm text-gray-400 py-2"> </p>`),Xm=W(`<p class="text-sm text-red-500"> </p>`),Zm=W(`<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>`),Qm=W(`<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>`),$m=W(`<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>`),eh=W(`<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>`),th=W(`<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 nh(e,t){Ge(t,!0);let n=F(`markdown`),r=!1,i=F(!1),a=F(!1),o=F(L([])),s=F(L({})),c=F(!1),l=F(!1),u=F(!1),d=F(!1),f=!1;On(()=>{t.open&&!f?(f=!0,I(n,`markdown`),r=!1,I(o,[],!0),I(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){I(n,e,!0),e===`html`&&h()}async function h(){if(!r){I(i,!0),I(a,!1);try{let e=await fetch(`/api/documents`).then(e=>e.json()),t=new Set;e.forEach(e=>t.add(e.folder?.[0]??e.category??`General`)),I(o,[...t].sort((e,t)=>e===`General`?-1:t===`General`?1:e.localeCompare(t)),!0),r=!0}catch{I(a,!0)}finally{I(i,!1)}}}async function g(){I(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{I(c,!1)}}async function _(e){let n=H(o).filter(e=>H(s)[e]);if(n.length){I(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{I(u,!1),I(l,!1)}}}async function v(){I(d,!0);try{let e=$.allDocs&&$.allDocs.length?$.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={categories:{},children:{}};for(let n of e){let e=t;for(let t of n.folder||[])e.children[t]||(e.children[t]={categories:{},children:{}}),e=e.children[t];e.categories[n.category]||(e.categories[n.category]=[]),e.categories[n.category].push(n)}return t}function i(e){let t=[];e.categories.General&&t.push(...e.categories.General);let n=Object.keys(e.children).sort((e,t)=>e.localeCompare(t));for(let r of n)t.push(...i(e.children[r]));let r=Object.keys(e.categories).filter(e=>e!==`General`).sort((e,t)=>e.localeCompare(t));for(let n of r)t.push(...e.categories[n]);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,i=(e,i)=>{let a=t===0&&e===`General`?`General`:e;n+=`<li style="margin-left:${r}rem;margin-top:${t===0?`0.75`:`0.4`}rem;">`,n+=`<span style="font-size:0.7rem;font-weight:700;text-transform:uppercase;letter-spacing:0.05em;color:#6b7280;">${a}</span>`,n+=`<ul style="margin:0.2rem 0 0 0;padding:0;list-style:none;">`;for(let e of i)n+=`<li style="margin-left:${r+.75}rem;padding:0.15rem 0;">`,n+=`<a href="#doc-${e.id}" style="color:#1d4ed8;text-decoration:none;font-size:0.875rem;">${p(e.title)}</a>`,e.formattedDate&&(n+=`<span style="color:#9ca3af;font-size:0.7rem;margin-left:0.5rem;">${p(e.formattedDate)}</span>`),n+=`</li>`;n+=`</ul></li>`};e.categories.General&&i(`General`,e.categories.General);let s=Object.keys(e.children).sort((e,t)=>e.localeCompare(t));for(let i of s)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(i)}</span>`,n+=`<ul style="margin:0.2rem 0 0 0;padding:0;list-style:none;">`,n+=o(e.children[i],t+1),n+=`</ul></li>`;let c=Object.keys(e.categories).filter(e=>e!==`General`).sort((e,t)=>e.localeCompare(t));for(let t of c)i(t,e.categories[t]);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>
|
|
91
|
+
`,t);return n>=0?n:0}c=c.nextElementSibling}return e.length}function um(e,t,n){if(!e||typeof t!=`string`)return()=>{};let r=em(t);nm(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=Wp(e.type),o=Kp(e.type);im(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=lm(t,e,i.target,r,i.clientY);o!==null&&(i.preventDefault(),im(i,{iconClass:`fa-solid fa-plus`,labelKey:`snippet.inline_insert_btn`,dataAction:`insert`,onActivate:()=>n.onInsert(o)}))};e.addEventListener(`contextmenu`,i);let a=e.closest(`#home-content-area`)||e.closest(`main`),o=null;a&&(o=r=>{r.defaultPrevented||e.offsetParent!==null&&(r.target?.closest(`textarea, input, [data-inline-snippet-index]`)||e.contains(r.target)||(r.preventDefault(),im(r,{iconClass:`fa-solid fa-plus`,labelKey:`snippet.inline_insert_btn`,dataAction:`insert`,onActivate:()=>n.onInsert(t.length)})))},a.addEventListener(`contextmenu`,o));let s=e=>{Jp&&!Jp.contains(e.target)&&rm()},c=e=>{e.key===`Escape`&&rm()};return document.addEventListener(`click`,s),document.addEventListener(`keydown`,c),()=>{e.removeEventListener(`contextmenu`,i),a&&o&&a.removeEventListener(`contextmenu`,o),document.removeEventListener(`click`,s),document.removeEventListener(`keydown`,c),rm(),e.querySelectorAll(`[data-inline-snippet-index]`).forEach(e=>{e.removeAttribute(`data-inline-snippet-index`),e.classList.remove(`ld-inline-snippet-target`)})}}var dm=W(`<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>`),fm=W(`<span class="text-xs text-gray-400 dark:text-gray-500"> </span>`),pm=W(`<span> </span>`),mm=W(`<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>`),hm=W(`<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>`),gm=Vr(`<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>`),_m=W(`<div data-testid="view-actions" class="flex items-center gap-2"><!> <button><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 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 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-link"></i> </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 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> <button 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> <button><i class="fa-solid fa-list-ul"></i></button></div>`),vm=W(`<span class="text-gray-300 dark:text-gray-600 mx-1">·</span>`),ym=W(`<!> <button class="text-blue-600 dark:text-blue-400 hover:underline"> </button>`,1),bm=W(`<div class="no-print mt-2 flex flex-wrap gap-1 text-xs"></div>`),xm=W(`<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>`),Sm=W(`<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>`),Cm=W(`<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>`),wm=W(`<div id="doc-content" data-testid="doc-content"></div>`),Tm=W(`<li class="m-0 p-0"><a class="block 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"> </a></li>`),Em=W(`<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),Dm=W(`<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>`),Om=W(`<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>`),km=W(`<div class="fixed inset-0 z-50 bg-black/90 flex items-center justify-center cursor-pointer"><img class="max-w-full max-h-full object-contain select-none"/> <button class="absolute top-4 right-4 text-white/70 hover:text-white text-2xl leading-none">×</button></div>`),Am=W(`<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 mb-2 flex-wrap"><span class="flex items-center gap-2 flex-wrap"><!> <span class="inline-block text-xs font-semibold px-2.5 py-0.5 rounded-full bg-blue-100 text-blue-700 dark:bg-blue-900/40 dark:text-blue-300"> </span></span> <!></div> <div class="flex items-center gap-2"><h1 data-testid="doc-title" class="min-w-0 text-2xl font-bold text-gray-900 dark:text-gray-50 leading-tight"> </h1> <button type="button" data-testid="copy-doc-id-btn"><i aria-hidden="true"></i></button></div></div> <div class="flex items-center gap-2 flex-wrap ml-auto"><!></div></div> <!> <!> <!> <div class="hidden no-print"></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 jm(e,t){Ge(t,!0);let n=Bi(t,`navHistory`,19,()=>[]),r=F(null),i=F(null),a=F(null),o=F(null),s=F(!1),c=F(!1),l=F(`insert`),u=F(null),d=F(0),f=null;Vi(()=>{let e=window;return e.openSnippetsModal=()=>{I(l,`insert`),I(c,!0)},e.openSnippetsModalForInlineInsert=e=>{I(l,`inline-insert`),I(d,Math.max(0,Number(e)||0),!0),I(c,!0)},()=>{delete e.openSnippetsModal,delete e.openSnippetsModalForInlineInsert}});let p=F(null),m=F(L([])),h=``,g=P(()=>H(m).length?Y(H(m).length===1?`search.notice_singular`:`search.notice_plural`).replace(`{count}`,String(H(m).length)).replace(`{query}`,$.searchQuery):``),_=P(()=>Yd(t.doc.content)),v=P(()=>(H(_)||``).toUpperCase()===`TO BE VALIDATED`),y=F(!1),b=F(``),x=F(null),S=F(!1),C=F(!1),w=F(!1),T=F(!1),E=F(``),D=F(`png`),ee=null,O=0,te=0,k=F(null),ne=F(``),re=/[̀-ͯ]/g;function ie(e){return(e||``).normalize(`NFD`).replace(re,``).toLowerCase().replace(/[^a-z0-9]/g,`_`)}function ae(e){let t=document.getElementById(`home-content-area`),n=document.getElementById(e);if(!t||!n)return;let r=document.querySelector(`#home-doc-view header`),i=r?r.getBoundingClientRect().height:0;t.scrollTop+=n.getBoundingClientRect().top-t.getBoundingClientRect().top-i-8}On(()=>{let e=t.doc.id,n=$.searchQuery;if(f?.(),f=null,H(y)||!H(r))return;Cd(H(r),t.doc.html,{content:t.doc.content,codeBlockMaxHeight:$.codeBlockMaxHeight,t:Y,onDocLink:(e,n)=>t.onopen(e,n),onAnchor:ae});let i=typeof n==`string`&&n.toLowerCase().startsWith(`metadata://`);I(m,n&&!i?Bp(H(r),n):[],!0),H(p)&&Rp(H(r),H(p),Y),f=um(H(r),t.doc.content,{onEdit:e=>{I(l,`inline-edit`),I(u,e,!0),I(c,!0)},onInsert:e=>{I(l,`inline-insert`),I(d,e,!0),I(c,!0)},onDelete:async e=>{await H(o).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})&&await t.onsave(t.doc.content.slice(0,e.start)+t.doc.content.slice(e.end))}}),e===h?H(a)?.apply():(h=e,H(a)?.load(e),Gd.load(e)),I(ce,Array.from(H(r).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)});async function oe(){let e=1;try{let n=await Gd.load(t.doc.id);n&&typeof n.accuracy==`number`&&(e=n.accuracy)}catch{}let n=Math.round(e*100),r=n<100,i=Zd(t.doc.id),a=Y(i?`doc.validate_worklog_message`:`doc.validate_message`),s=r?Y(`doc.validate_detail_low_accuracy`).replace(`{accuracy}`,n+`%`):void 0;if(!await H(o).show({title:Y(`doc.validate_title`),message:a,detail:s,confirmLabel:Y(`doc.validate_confirm`),cancelLabel:Y(`common.cancel`)}))return;let c=Xd(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 Gd.load(t.doc.id),$.docStatuses={...$.docStatuses,[t.doc.id]:i?`Done`:`Accepted`}}catch(e){I(x,{text:Y(`doc.validate_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`},!0)}}On(()=>{try{I(S,localStorage.getItem(`ld-full-width`)===`1`)}catch{}});let se=F(!1),ce=F(L([])),le=P(()=>H(se)&&H(ce).length>0),ue=`ld-toc-w`,de=F(!1),fe=F(null),pe=F(null),me=F(0);On(()=>{if(!H(pe))return;let e=new ResizeObserver(()=>{I(me,H(pe).offsetHeight,!0)});return e.observe(H(pe)),I(me,H(pe).offsetHeight,!0),()=>e.disconnect()});function he(e){if(e.preventDefault(),!H(fe))return;let t=e.clientX,n=H(fe).getBoundingClientRect().width;I(de,!0),H(fe).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)));H(fe).style.width=r+`px`},i=()=>{document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i),document.body.style.cursor=``,document.body.style.userSelect=``,I(de,!1),H(fe).style.transition=``;try{localStorage.setItem(ue,String(parseInt(H(fe).style.width,10)))}catch{}};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)}On(()=>{try{I(se,localStorage.getItem(`ld-toc-open`)===`1`)}catch{}try{let e=parseInt(localStorage.getItem(ue)||``,10);H(fe)&&e>=160&&e<=400&&(H(fe).style.width=e+`px`)}catch{}});function ge(){I(se,!H(se));try{localStorage.setItem(`ld-toc-open`,H(se)?`1`:`0`)}catch{}}function _e(e){let t=document.getElementById(e),n=document.getElementById(`home-content-area`),r=document.getElementById(`home-doc-header`);if(!t||!n)return;let i=t.parentElement;for(;i&&i!==n;)i.tagName===`DETAILS`&&(i.open=!0),i=i.parentElement;let a=r?r.getBoundingClientRect().height:0,o=t.getBoundingClientRect().top-n.getBoundingClientRect().top+n.scrollTop;n.scrollTo({top:o-a-16,behavior:`smooth`})}function ve(){I(b,t.doc.content,!0),I(y,!0),I(x,null),requestAnimationFrame(()=>H(i)?.focus())}function ye(){I(y,!1),I(x,null)}async function be(){I(x,{text:Y(`doc.saving`),cls:`text-gray-400`},!0);try{await t.onsave(H(b)),I(y,!1),I(x,null)}catch(e){I(x,{text:Y(`error.save`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`},!0)}}function xe(e){let t=Array.from(e.clipboardData?.items??[]).find(e=>e.type.startsWith(`image/`));if(t){e.preventDefault(),O=H(i).selectionStart,te=H(i).selectionEnd,I(D,t.type.split(`/`)[1].replace(`jpeg`,`jpg`)||`png`,!0);let n=t.getAsFile();if(!n)return;ee=n,I(E,ie(Date.now().toString()),!0),I(T,!0);return}let n=Array.from(e.clipboardData?.files??[]).filter(e=>!e.type.startsWith(`image/`));if(n.length){e.preventDefault();let t=H(i).selectionStart,r=H(i).selectionEnd;(async()=>{for(let e of n)await A(e,t,r)})()}}function Se(e){let t=Array.from(e.dataTransfer?.files??[]).filter(e=>!e.type.startsWith(`image/`));if(!t.length)return;e.preventDefault(),e.stopPropagation();let n=H(i).selectionStart,r=H(i).selectionEnd;(async()=>{for(let e of t)await A(e,n,r)})()}function Ce(e){e.dataTransfer?.types?.includes(`Files`)&&(e.preventDefault(),e.dataTransfer.dropEffect=`copy`)}function we(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(r.result),r.onerror=n,r.readAsDataURL(e)})}function Te(e,t,n){let r=H(b).slice(0,t),a=H(b).slice(n);I(b,r+e+a),requestAnimationFrame(()=>{H(i).selectionStart=H(i).selectionEnd=t+e.length,H(i).focus()})}async function A(e,t,n){if(e.size>19922944){I(x,{text:Y(`doc.file_too_large`)+` (${(e.size/1024/1024).toFixed(1)} MB, max 19 MB)`,cls:`text-red-500 dark:text-red-400`},!0);return}I(x,{text:Y(`doc.uploading_file`),cls:`text-gray-400`},!0);try{let r=await we(e),i=await fetch(`/api/files/upload`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:r,name:e.name})});if(!i.ok){let e=``;try{e=(await i.json()).error||``}catch{e=await i.text()}throw Error(e||`HTTP ${i.status}`)}let{url:a,originalName:o}=await i.json();Te(`[📎 ${o||e.name}](${a})`,t,n),I(x,null)}catch(e){I(x,{text:Y(`doc.file_upload_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`},!0)}}function Ee(){I(T,!1),ee=null}async function De(){let e=ie(H(E))||Date.now().toString();if(I(T,!1),ee){I(x,{text:Y(`doc.uploading_image`),cls:`text-gray-400`},!0);try{let t=await we(ee),n=await fetch(`/api/images/upload`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:t,ext:H(D),name:e})});if(!n.ok)throw Error(await n.text());let{filename:r}=await n.json();Te(``,O,te),I(x,null)}catch(e){I(x,{text:Y(`doc.image_upload_failed`)+(e instanceof Error?e.message:String(e)),cls:`text-red-500 dark:text-red-400`},!0)}finally{ee=null}}}async function Oe(){try{await navigator.clipboard.writeText(location.href)}catch{}}async function ke(){try{await navigator.clipboard.writeText(decodeURIComponent(t.doc.id)),I(w,!0),setTimeout(()=>I(w,!1),1800)}catch{}}function Ae(){window.print()}function j(e){let t=e.target.closest(`img`);!t||!e.shiftKey||(e.preventDefault(),e.stopPropagation(),I(k,t.src,!0),I(ne,t.alt||``,!0))}function je(e){e.key===`Escape`&&H(k)&&I(k,null)}var M=Am();Mr(`keydown`,an,je);var Me=z(M),Ne=R(Me),Pe=R(Ne),Fe=R(Pe),Ie=R(Fe),Le=R(Ie);$r(Le,17,()=>t.doc.folder||[],Yr,(e,t)=>{var n=dm(),r=R(n,!0);N(n),V(e=>{J(n,`title`,H(t)),K(r,e)},[()=>Bu(H(t))]),G(e,n)});var Re=B(Le,2),ze=R(Re,!0);N(Re),N(Ie);var Be=B(Ie,2),Ve=e=>{var n=fm(),r=R(n,!0);N(n),V(()=>K(r,t.doc.formattedDate)),G(e,n)};q(Be,e=>{t.doc.formattedDate&&e(Ve)}),N(Fe);var He=B(Fe,2),Ue=R(He),We=R(Ue,!0);N(Ue);var qe=B(Ue,2),Je=R(qe);N(qe),N(He),N(Pe);var Ye=B(Pe,2),Xe=R(Ye),Ze=e=>{var t=mm(),n=R(t),r=e=>{var t=pm(),n=R(t,!0);N(t),V(()=>{hi(t,1,`text-xs ${H(x).cls??``}`),K(n,H(x).text)}),G(e,t)};q(n,e=>{H(x)&&e(r)});var i=B(n,2),a=R(i,!0);N(i);var o=B(i,2),s=R(o,!0);N(o);var u=B(o,2),d=R(u,!0);N(u),N(t),V((e,t,n,r)=>{K(a,e),J(o,`title`,t),K(s,n),K(d,r)},[()=>Y(`common.cancel`),()=>Y(`doc.snippets`),()=>Y(`doc.snippets_btn`),()=>Y(`common.save`)]),U(`click`,i,ye),U(`click`,o,()=>{I(l,`insert`),I(c,!0)}),U(`click`,u,be),G(e,t)},Qe=e=>{let t=P(()=>$.markerActive?`#fef08a`:`#bfdbfe`),n=P(()=>$.markerActive?`#fef08a`:`#93c5fd`),r=P(()=>$.markerActive?`#fde047`:`#93c5fd`);var i=_m(),a=R(i),o=e=>{var t=hm(),n=B(R(t),1,!0);N(t),V((e,r)=>{J(t,`title`,e),K(n,r)},[()=>Y(`doc.validate_mode`),()=>Y(`doc.validate_btn`)]),U(`click`,t,oe),G(e,t)};q(a,e=>{H(v)&&e(o)});var c=B(a,2),l=R(c),u=R(l),d=B(u),f=B(d),p=B(f),m=B(p,2),h=e=>{G(e,gm())};q(m,e=>{$.markerHidden&&e(h)}),N(l);var g=B(l,1,!0);N(c);var _=B(c,2),y=R(_);N(_);var b=B(_,2),x=B(R(b));N(b);var S=B(b,2),w=B(R(S));N(S);var T=B(S,2),E=B(R(T));N(T);var D=B(T,2),ee=B(R(D));N(D);var O=B(D,2);N(i),V((e,i,a,o,s,l,m,h,v,C,te,k,ne)=>{J(c,`title`,e),hi(c,1,`no-print text-sm px-3 py-1.5 rounded-lg border transition-colors ${$.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(u,`fill`,H(t)),J(d,`fill`,H(n)),J(f,`fill`,H(r)),J(p,`fill`,H(r)),K(g,i),J(_,`title`,a),K(y,`📄 ${o??``}`),J(b,`title`,s),K(x,` ${l??``}`),J(S,`title`,m),K(w,` ${h??``}`),J(T,`title`,v),K(E,` ${C??``}`),J(D,`title`,te),K(ee,` ${k??``}`),J(O,`title`,ne),hi(O,1,`no-print text-sm px-3 py-1.5 rounded-lg border transition-colors ${H(se)?`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.marker_mode`),()=>Y(`doc.marker_btn`),()=>Y(`doc.export_pdf`),()=>Y(`doc.export_pdf_btn`),()=>Y(`doc.copy_link`),()=>Y(`doc.copy_link_btn`),()=>Y(`metadata.button_title`),()=>Y(`metadata.button`),()=>Y(`doc.edit`),()=>Y(`doc.edit_btn`),()=>Y(`doc.delete`),()=>Y(`doc.delete_btn`),()=>Y(`doc.toc_toggle`)]),U(`click`,c,()=>$.toggleMarker()),U(`click`,_,Ae),U(`click`,b,Oe),U(`click`,S,()=>I(s,!0)),U(`click`,T,ve),U(`click`,D,()=>I(C,!0)),U(`click`,O,ge),G(e,i)};q(Xe,e=>{H(y)?e(Ze):e(Qe,-1)}),N(Ye),N(Ne);var $e=B(Ne,2),et=e=>{qd(e,{onopen:()=>I(s,!0)})};q($e,e=>{H(y)||e(et)});var tt=B($e,2),nt=e=>{var r=bm();$r(r,21,n,Yr,(e,n,r)=>{var i=ym(),a=z(i),o=e=>{G(e,vm())};q(a,e=>{r>0&&e(o)});var s=B(a,2),c=R(s);N(s),V(()=>K(c,`← ${H(n).title??``}`)),U(`click`,s,()=>t.ongoback?.(r)),G(e,i)}),N(r),G(e,r)};q(tt,e=>{!H(y)&&n().length&&e(nt)});var rt=B(tt,2),it=e=>{var t=Sm(),n=R(t),r=R(n,!0);N(n);var i=B(n,2);$r(i,23,()=>H(m),e=>e.id,(e,t,n)=>{var r=xm(),i=R(r),a=R(i),o=R(a);N(a);var s=B(a),c=R(s,!0);N(s),N(i),N(r),V(()=>{K(o,`${H(n)+1}.`),K(c,H(t).snippet)}),U(`click`,i,()=>Vp(H(t).id)),G(e,r)}),N(i),N(t),V(()=>K(r,H(g))),G(e,t)};q(rt,e=>{!H(y)&&H(m).length&&$.searchQuery&&e(it)}),Li(B(rt,2),e=>I(p,e),()=>H(p)),N(Me),Li(Me,e=>I(pe,e),()=>H(pe));var at=B(Me,2),ot=R(at),st=R(ot),ct=e=>{var t=Cm();vn(t),Li(t,e=>I(i,e),()=>H(i)),Mr(`paste`,t,xe),Mr(`drop`,t,Se),Mr(`dragover`,t,Ce),Mi(t,()=>H(b),e=>I(b,e)),G(e,t)},lt=e=>{var t=wm();Li(t,e=>I(r,e),()=>H(r)),V(()=>hi(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 ${$.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`} ${$.imageRoundedCorners?`[&_img]:rounded-xl`:``} ${$.imageCentered?`[&_img]:mx-auto [&_img]:block`:``} ${$.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)]`:``}`)),U(`click`,t,j),G(e,t)};q(st,e=>{H(y)?e(ct):e(lt,-1)}),N(ot);var ut=B(ot,2),dt=e=>{var t=Em(),n=z(t),r=B(n,2),i=R(r),a=R(i,!0);N(i);var o=B(i,2),s=R(o);$r(s,21,()=>H(ce),Yr,(e,t)=>{var n=Tm(),r=R(n),i=R(r,!0);N(r),N(n),V(()=>{_i(n,`padding-left: ${(H(t).level-1)*.75}rem`),J(r,`href`,`#${H(t).id??``}`),J(r,`title`,H(t).text),K(i,H(t).text)}),U(`mousedown`,r,e=>e.preventDefault()),U(`click`,r,e=>{e.preventDefault(),_e(H(t).id)}),G(e,n)}),N(s),N(o),N(r),Li(r,e=>I(fe,e),()=>H(fe)),V(e=>{hi(n,1,`no-print w-1 shrink-0 self-stretch cursor-col-resize select-none transition-colors ${H(de)?`bg-blue-500/60`:`bg-transparent hover:bg-blue-500/40`}`),_i(r,`width: 224px; top: ${H(me)??``}px; max-height: calc(100vh - ${H(me)??``}px)`),K(a,e)},[()=>Y(`doc.toc_title`)]),U(`mousedown`,n,he),G(e,t)};q(ut,e=>{H(le)&&e(dt)}),N(at);var ft=B(at,2);Li(zd(ft,{get contentEl(){return H(r)},get docId(){return t.doc.id}}),e=>I(a,e,!0),()=>H(a));var pt=B(ft,2);hf(pt,{get open(){return H(s)},get docId(){return t.doc.id},get content(){return t.doc.content},onclose:()=>I(s,!1)});var mt=B(pt,2);jp(mt,{get open(){return H(c)},get editor(){return H(i)},get mode(){return H(l)},get content(){return t.doc.content},get range(){return H(u)},get insertPos(){return H(d)},get onsave(){return t.onsave},onclose:()=>I(c,!1)});var ht=B(mt,2);Li(Dl(ht,{}),e=>I(o,e,!0),()=>H(o));var gt=B(ht,2),_t=e=>{var t=Dm(),n=R(t),r=R(n),i=R(r);N(r);var a=B(r,2),o=R(a),s=R(o),c=B(s),l=R(c,!0);N(c),N(o);var u=B(o,2),d=R(u);Ei(d);var f=B(d,2),p=R(f);N(f),N(u),N(a);var m=B(a,2),h=R(m),g=R(h,!0);N(h);var _=B(h,2),v=R(_,!0);N(_),N(m),N(n),N(t),V((e,t,n,r,a)=>{K(i,`🖼️ ${e??``}`),K(s,`${t??``} `),K(l,n),Di(d,H(E)),K(p,`.${H(D)??``}`),K(g,r),K(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`)]),U(`input`,d,e=>I(E,ie(e.target.value),!0)),U(`click`,h,Ee),U(`click`,_,De),G(e,t)};q(gt,e=>{H(T)&&e(_t)});var vt=B(gt,2),yt=e=>{var n=Om(),r=R(n),i=R(r),a=R(i,!0);N(i);var o=B(i,2),s=R(o,!0);N(o);var c=B(o,2),l=R(c),u=R(l,!0);N(l);var d=B(l,2),f=R(d,!0);N(d),N(c),N(r),N(n),V((e,n,r)=>{K(a,e),K(s,t.doc.title),K(u,n),K(f,r)},[()=>Y(`doc.confirm_delete`),()=>Y(`common.cancel`),()=>Y(`doc.confirm_delete_btn`)]),U(`click`,n,e=>{e.target===e.currentTarget&&I(C,!1)}),U(`click`,l,()=>I(C,!1)),U(`click`,d,async()=>{I(C,!1),await t.ondelete()}),G(e,n)};q(vt,e=>{H(C)&&e(yt)});var bt=B(vt,2),xt=e=>{var t=km(),n=R(t),r=B(n,2);N(t),V(()=>{J(n,`src`,H(k)),J(n,`alt`,H(ne))}),U(`click`,t,()=>I(k,null)),U(`click`,n,e=>e.stopPropagation()),U(`click`,r,()=>I(k,null)),G(e,t)};q(bt,e=>{H(k)&&e(xt)}),V(e=>{K(ze,t.doc.category),K(We,t.doc.title),J(qe,`title`,e),hi(qe,1,`no-print inline-flex h-8 w-8 shrink-0 items-center justify-center rounded-md border border-gray-200 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 ${H(w)?`text-green-600 dark:text-green-400`:``}`),hi(Je,1,`fa-${H(w)?`solid fa-check`:`regular fa-copy`}`)},[()=>Y(`doc.copy_mcp_id`)]),U(`click`,qe,ke),G(e,M),Ke()}Nr([`click`,`mousedown`,`input`]);var Mm=W(`<p class="px-3 py-4 text-xs text-gray-400 text-center"> </p>`),Nm=W(`<p class="px-3 py-3 text-xs text-red-400 text-center"> </p>`),Pm=W(`<p class="px-3 py-3 text-xs text-gray-400 text-center"> </p>`),Fm=W(`<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>`),Im=W(`<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>`),Lm=W(`<p class="text-xs text-red-500"> </p>`),Rm=W(`<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 zm(e,t){Ge(t,!0);let n=F(``),r=F(null),i=F(null),a=F(``),o=F(``),s=F(`/ (root)`),c=F(!1),l=F(``),u=F(L([])),d=F(!1),f=F(!1),p=F(``),m=F(!1),h=F(null),g=!1;On(()=>{t.open&&!g?(g=!0,_()):t.open||(g=!1)});async function _(){try{I(n,(await fetch(`/api/config`).then(e=>e.json())).docsFolder||``,!0)}catch{I(n,``)}let e=``;if($.currentDocId){let t=decodeURIComponent($.currentDocId);if(!t.startsWith(`/`)){let n=t.split(`/`);n.length>1&&(e=n.slice(0,-1).join(`/`))}}I(a,e?H(n)+`/`+e:H(n),!0),I(r,H(a),!0),I(i,null),I(o,``),I(s,e?`/`+e:`/ (root)`,!0),I(c,!1),I(p,``),I(m,!1),setTimeout(()=>H(h)?.focus(),50)}let v=P(()=>{let e=H(o).trim();if(!e)return Y(`modal.new_folder.enter_name`);let t=H(a)||H(n),r=t.startsWith(H(n))?t.slice(H(n).length).replace(/^\//,``):``;return(r?r+`/`:``)+e});function y(){I(c,!H(c)),H(c)&&b(H(r)||H(n))}async function b(e){I(d,!0),I(f,!1);try{let t=await fetch(`/api/browse?path=`+encodeURIComponent(e)).then(e=>e.json());I(r,t.current,!0),I(i,t.parent,!0),I(a,t.current,!0),I(l,t.current,!0),I(s,(t.current.startsWith(H(n)+`/`)?t.current.slice(H(n).length):t.current===H(n)?``:t.current)||`/ (root)`,!0),I(u,t.dirs||[],!0)}catch{I(f,!0),I(u,[],!0)}finally{I(d,!1)}}let x=P(()=>H(r)===H(n));function S(){H(i)&&b(H(i))}async function C(){let e=H(o).trim();if(I(p,``),!e){I(p,Y(`modal.new_folder.error_empty`),!0);return}if(!/^[a-zA-Z0-9_\-. ]+$/.test(e)){I(p,Y(`modal.new_folder.error_invalid_chars`),!0);return}let r=H(a)||H(n);if(r===H(n)&&(e===`files`||e===`images`)){I(p,Y(`modal.new_folder.error_reserved`),!0);return}let i=r.endsWith(`/`)?r+e:r+`/`+e;I(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){I(m,!1),I(p,Y(`common.error_prefix`)+(e instanceof Error?e.message:String(e)))}}var w=Ur(),T=z(w),E=e=>{var n=Rm(),r=R(n),i=R(r),a=B(R(i),2),g=R(a,!0);N(a),N(i);var _=B(i,2),w=R(_),T=R(w,!0);N(w);var E=B(w,2);Ei(E),Li(E,e=>I(h,e),()=>H(h)),N(_);var D=B(_,2),ee=R(D),O=R(ee,!0);N(ee);var te=B(ee,2),k=R(te),ne=R(k,!0);N(k);var re=B(k,2),ie=R(re,!0);N(re),N(te);var ae=B(te,2),oe=e=>{var t=Im(),n=R(t),r=R(n),i=R(r,!0);N(r);var a=B(r,2),o=R(a,!0);N(a),N(n);var s=B(n,2),c=R(s),p=e=>{var t=Mm(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.loading`)]),G(e,t)},m=e=>{var t=Nm(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`modal.new_folder.error_loading`)]),G(e,t)},h=e=>{var t=Pm(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`modal.new_folder.no_subfolders`)]),G(e,t)},g=e=>{var t=Ur();$r(z(t),17,()=>H(u),e=>e.path,(e,t)=>{var n=Fm(),r=B(R(n),2),i=R(r,!0);N(r),N(n),V(()=>K(i,H(t).name)),U(`click`,n,()=>b(H(t).path)),G(e,n)}),G(e,t)};q(c,e=>{H(d)?e(p):H(f)?e(m,1):H(u).length===0?e(h,2):e(g,-1)}),N(s),N(t),V(e=>{r.disabled=H(x),K(i,e),K(o,H(l))},[()=>Y(`common.up`)]),U(`click`,r,S),G(e,t)};q(ae,e=>{H(c)&&e(oe)}),N(D);var se=B(D,2),ce=R(se),le=R(ce,!0);N(ce);var ue=B(ce,2),de=R(ue,!0);N(ue),N(se);var fe=B(se,2),pe=e=>{var t=Lm(),n=R(t,!0);N(t),V(()=>K(n,H(p))),G(e,t)};q(fe,e=>{H(p)&&e(pe)});var me=B(fe,2),he=R(me),ge=R(he,!0);N(he);var _e=B(he,2),ve=R(_e,!0);N(_e),N(me),N(r),N(n),V((e,t,n,r,i,a,o,c)=>{K(g,e),K(T,t),J(E,`placeholder`,n),K(O,r),K(ne,H(s)),K(ie,i),K(le,a),K(de,H(v)),K(ge,o),_e.disabled=H(m),K(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`),()=>H(m)?Y(`modal.new_folder.creating_btn`):Y(`modal.new_folder.create_btn`)]),U(`click`,n,e=>{e.target===e.currentTarget&&t.onclose()}),Mi(E,()=>H(o),e=>I(o,e)),U(`click`,re,y),U(`click`,he,function(...e){t.onclose?.apply(this,e)}),U(`click`,_e,C),G(e,n)};q(T,e=>{t.open&&e(E)}),G(e,w),Ke()}Nr([`click`]);var Bm=W(`<option></option>`),Vm=W(`<p class="px-3 py-4 text-xs text-gray-400 text-center"> </p>`),Hm=W(`<p class="px-3 py-4 text-xs text-red-400 text-center"> </p>`),Um=W(`<p class="px-3 py-3 text-xs text-gray-400 text-center"> </p>`),Wm=W(`<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="text-gray-700 dark:text-gray-300 truncate"> </span></button>`),Gm=W(`<div class="border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden"><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="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-40 overflow-y-auto"><!></div> <div class="border-t border-gray-200 dark:border-gray-700 flex items-center gap-2 px-3 py-2 bg-gray-50 dark:bg-gray-800/50"><input type="text" class="flex-1 px-2 py-1 text-xs rounded border border-gray-200 dark:border-gray-700 bg-white dark:bg-gray-900 text-gray-900 dark:text-gray-100 focus:outline-none focus:ring-1 focus:ring-blue-400"/> <button class="text-xs px-2 py-1 rounded bg-gray-100 dark:bg-gray-800 text-gray-600 dark:text-gray-400 hover:bg-gray-200 dark:hover:bg-gray-700 transition-colors shrink-0"> </button></div></div>`),Km=W(`<p class="text-xs text-red-500"> </p>`),qm=W(`<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-lg mx-4 p-6 space-y-4"><h3 class="text-base font-semibold text-gray-900 dark:text-gray-50">➕ <span> </span></h3> <div class="space-y-1.5"><label for="new-doc-title" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="new-doc-title" 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 for="new-doc-category" class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <input id="new-doc-category" type="text" list="new-doc-category-options" autocomplete="off" placeholder="GENERAL" 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"/> <datalist id="new-doc-category-options"></datalist></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 px-3 py-2 text-xs rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-500 dark:text-gray-400 font-mono truncate"> </span> <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> <div class="space-y-1.5"><label class="block text-xs font-medium text-gray-500 dark:text-gray-400"> </label> <p class="text-xs bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 font-mono text-gray-600 dark:text-gray-300 break-all"> </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 Jm(e,t){Ge(t,!0);let n=F(``),r=F(`YYYY_MM_DD_HH_mm_[Category]_title`),i=F(null),a=F(null),o=F(``),s=F(``),c=F(``),l=F(`/ (root)`),u=F(!1),d=F(``),f=F(L([])),p=F(!1),m=F(!1),h=F(``),g=F(L([])),_=F(``),v=F(!1),y=F(null);function b(e){return(e||``).normalize(`NFD`).replace(/[̀-ͯ]/g,``).toUpperCase().replace(/[^A-Z0-9_-]/g,``)}function x(e){let t=H(n);return e===t?``:e.startsWith(t+`/`)?e.slice(t.length+1):e}let S=!1;On(()=>{t.open&&!S?(S=!0,C()):t.open||(S=!1)});async function C(){try{let e=await fetch(`/api/config`).then(e=>e.json());I(n,e.docsFolder||``,!0),I(r,e.filenamePattern||`YYYY_MM_DD_HH_mm_[Category]_title`,!0)}catch{I(n,``),I(r,`YYYY_MM_DD_HH_mm_[Category]_title`)}let e=$.currentDocId&&$.allDocs.find(e=>e.id===$.currentDocId),t=b(e&&e.category||`General`)||`GENERAL`,d=``;if($.currentDocId){let e=decodeURIComponent($.currentDocId);if(!e.startsWith(`/`)){let t=e.split(`/`);t.length>1&&(d=t.slice(0,-1).join(`/`))}}let f=d?H(n)+`/`+d:``;I(o,d,!0),I(i,f||null,!0),I(a,null),w(),I(s,``),I(c,t,!0),I(l,d?`/`+d:`/ (root)`,!0),I(u,!1),I(h,``),I(_,``),I(v,!1),setTimeout(()=>H(y)?.focus(),50)}function w(){let e=new Set;($.allDocs||[]).forEach(t=>{let n=b(t.category||``);n&&e.add(n)}),I(g,Array.from(e).sort((e,t)=>e.localeCompare(t)),!0)}function T(){let e=b(H(c));H(c)!==e&&I(c,e,!0)}let E=P(()=>{let e=H(s).trim();if(!e)return Y(`modal.new_doc.title_placeholder`);let t=b(H(c))||`GENERAL`,n=new Date,i=n.getFullYear(),a=String(n.getMonth()+1).padStart(2,`0`),l=String(n.getDate()).padStart(2,`0`),u=String(n.getHours()).padStart(2,`0`),d=String(n.getMinutes()).padStart(2,`0`),f=e.toLowerCase().replace(/\s+/g,`_`).replace(/[^a-z0-9_]/g,``).replace(/_+/g,`_`).replace(/^_|_$/g,``)||`document`,p=H(r).replace(`YYYY`,String(i)).replace(`MM`,a).replace(`DD`,l).replace(`HH`,u).replace(`mm`,d).replace(/\[Category\]/i,`[${t}]`).replace(/(?<![a-z0-9])(?:title_words|title)(?![a-z0-9])/i,f)+`.md`;return H(o)?H(o)+`/`+p:p});function D(){I(u,!H(u)),H(u)&&ee(H(i)||H(n))}async function ee(e){I(p,!0),I(m,!1);try{let t=await fetch(`/api/browse?path=`+encodeURIComponent(e)).then(e=>e.json());I(i,t.current,!0),I(a,t.parent,!0),I(o,x(t.current),!0),I(d,t.current,!0),I(l,H(o)?`/`+H(o):`/ (root)`,!0),I(f,t.dirs||[],!0)}catch{I(m,!0),I(f,[],!0)}finally{I(p,!1)}}let O=P(()=>H(i)===H(n));function te(){H(i)!==H(n)&&H(a)&&ee(H(a))}function k(){let e=H(h).trim();if(!e)return;let t=H(i)||H(n);if(t===H(n)&&(e===`files`||e===`images`)){I(_,Y(`modal.new_folder.error_reserved`),!0);return}I(_,``);let r=(x(t)?x(t)+`/`:``)+e;I(o,r),I(l,`/`+r),I(h,``)}async function ne(){let e=H(s).trim(),n=b(H(c))||`GENERAL`;if(!e){I(_,Y(`modal.new_doc.error_empty_title`),!0);return}I(_,``),I(v,!0);try{let r=await fetch(`/api/documents`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({title:e,category:n,folder:H(o)})});if(!r.ok){let e=await r.json();throw Error(e.error||`Creation failed`)}let i=await r.json();t.onclose(),t.onsuccess(i.id)}catch(e){I(_,Y(`common.error_prefix`)+(e instanceof Error?e.message:String(e))),I(v,!1)}}function re(e){e.key===`Enter`&&ne(),e.key===`Escape`&&t.onclose()}var ie=Ur(),ae=z(ie),oe=e=>{var n=qm(),r=R(n),i=R(r),a=B(R(i)),o=R(a,!0);N(a),N(i);var b=B(i,2),x=R(b),S=R(x,!0);N(x);var C=B(x,2);Ei(C),Li(C,e=>I(y,e),()=>H(y)),N(b);var w=B(b,2),ie=R(w),ae=R(ie,!0);N(ie);var oe=B(ie,2);Ei(oe);var se=B(oe,2);$r(se,20,()=>H(g),e=>e,(e,t)=>{var n=Bm(),r={};V(()=>{r!==(r=t)&&(n.value=(n.__value=t)??``)}),G(e,n)}),N(se),N(w);var ce=B(w,2),le=R(ce),ue=R(le,!0);N(le);var de=B(le,2),fe=R(de),pe=R(fe,!0);N(fe);var me=B(fe,2),he=B(R(me)),ge=R(he,!0);N(he),N(me),N(de);var _e=B(de,2),ve=e=>{var t=Gm(),n=R(t),r=R(n),i=R(r);N(r);var a=B(r,2),o=R(a,!0);N(a),N(n);var s=B(n,2),c=R(s),l=e=>{var t=Vm(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.loading`)]),G(e,t)},u=e=>{var t=Hm(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.cannot_read_dir`)]),G(e,t)},g=e=>{var t=Um(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`modal.new_doc.no_subfolders`)]),G(e,t)},_=e=>{var t=Ur();$r(z(t),17,()=>H(f),e=>e.path,(e,t)=>{var n=Wm(),r=B(R(n),2),i=R(r,!0);N(r),N(n),V(()=>K(i,H(t).name)),U(`click`,n,()=>ee(H(t).path)),G(e,n)}),G(e,t)};q(c,e=>{H(p)?e(l):H(m)?e(u,1):H(f).length===0?e(g,2):e(_,-1)}),N(s);var v=B(s,2),y=R(v);Ei(y);var b=B(y,2),x=R(b,!0);N(b),N(v),N(t),V((e,t,n)=>{r.disabled=H(O),K(i,`↑ ${e??``}`),K(o,H(d)),J(y,`placeholder`,t),K(x,n)},[()=>Y(`common.up`),()=>Y(`modal.new_doc.new_folder_placeholder`),()=>Y(`modal.new_doc.create_folder_btn`)]),U(`click`,r,te),U(`keydown`,y,e=>{e.key===`Enter`&&k()}),Mi(y,()=>H(h),e=>I(h,e)),U(`click`,b,k),G(e,t)};q(_e,e=>{H(u)&&e(ve)}),N(ce);var ye=B(ce,2),be=R(ye),xe=R(be,!0);N(be);var Se=B(be,2),Ce=R(Se,!0);N(Se),N(ye);var we=B(ye,2),Te=e=>{var t=Km(),n=R(t,!0);N(t),V(()=>K(n,H(_))),G(e,t)};q(we,e=>{H(_)&&e(Te)});var A=B(we,2),Ee=R(A),De=R(Ee,!0);N(Ee);var Oe=B(Ee,2),ke=R(Oe,!0);N(Oe),N(A),N(r),N(n),V((e,t,n,r,i,a,s,c,u)=>{K(o,e),K(S,t),J(C,`placeholder`,n),K(ae,r),K(ue,i),K(pe,H(l)),K(ge,a),K(xe,s),K(Ce,H(E)),K(De,c),Oe.disabled=H(v),K(ke,u)},[()=>Y(`modal.new_doc.title`),()=>Y(`modal.new_doc.title_label`),()=>Y(`modal.new_doc.title_placeholder`),()=>Y(`modal.new_doc.category_label`),()=>Y(`modal.new_doc.location_label`),()=>Y(`modal.new_doc.browse_btn`),()=>Y(`modal.new_doc.filename_label`),()=>Y(`common.cancel`),()=>H(v)?Y(`modal.new_folder.creating_btn`):Y(`common.create`)]),U(`click`,n,e=>{e.target===e.currentTarget&&t.onclose()}),U(`keydown`,C,re),Mi(C,()=>H(s),e=>I(s,e)),U(`input`,oe,T),U(`keydown`,oe,re),Mi(oe,()=>H(c),e=>I(c,e)),U(`click`,me,D),U(`click`,Ee,function(...e){t.onclose?.apply(this,e)}),U(`click`,Oe,ne),G(e,n)};q(ae,e=>{t.open&&e(oe)}),G(e,ie),Ke()}Nr([`click`,`keydown`,`input`]);var Ym=W(`<p class="text-sm text-gray-400 py-2"> </p>`),Xm=W(`<p class="text-sm text-red-500"> </p>`),Zm=W(`<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>`),Qm=W(`<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>`),$m=W(`<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>`),eh=W(`<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>`),th=W(`<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 nh(e,t){Ge(t,!0);let n=F(`markdown`),r=!1,i=F(!1),a=F(!1),o=F(L([])),s=F(L({})),c=F(!1),l=F(!1),u=F(!1),d=F(!1),f=!1;On(()=>{t.open&&!f?(f=!0,I(n,`markdown`),r=!1,I(o,[],!0),I(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){I(n,e,!0),e===`html`&&h()}async function h(){if(!r){I(i,!0),I(a,!1);try{let e=await fetch(`/api/documents`).then(e=>e.json()),t=new Set;e.forEach(e=>t.add(e.folder?.[0]??e.category??`General`)),I(o,[...t].sort((e,t)=>e===`General`?-1:t===`General`?1:e.localeCompare(t)),!0),r=!0}catch{I(a,!0)}finally{I(i,!1)}}}async function g(){I(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{I(c,!1)}}async function _(e){let n=H(o).filter(e=>H(s)[e]);if(n.length){I(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{I(u,!1),I(l,!1)}}}async function v(){I(d,!0);try{let e=$.allDocs&&$.allDocs.length?$.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={categories:{},children:{}};for(let n of e){let e=t;for(let t of n.folder||[])e.children[t]||(e.children[t]={categories:{},children:{}}),e=e.children[t];e.categories[n.category]||(e.categories[n.category]=[]),e.categories[n.category].push(n)}return t}function i(e){let t=[];e.categories.General&&t.push(...e.categories.General);let n=Object.keys(e.children).sort((e,t)=>e.localeCompare(t));for(let r of n)t.push(...i(e.children[r]));let r=Object.keys(e.categories).filter(e=>e!==`General`).sort((e,t)=>e.localeCompare(t));for(let n of r)t.push(...e.categories[n]);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,i=(e,i)=>{let a=t===0&&e===`General`?`General`:e;n+=`<li style="margin-left:${r}rem;margin-top:${t===0?`0.75`:`0.4`}rem;">`,n+=`<span style="font-size:0.7rem;font-weight:700;text-transform:uppercase;letter-spacing:0.05em;color:#6b7280;">${a}</span>`,n+=`<ul style="margin:0.2rem 0 0 0;padding:0;list-style:none;">`;for(let e of i)n+=`<li style="margin-left:${r+.75}rem;padding:0.15rem 0;">`,n+=`<a href="#doc-${e.id}" style="color:#1d4ed8;text-decoration:none;font-size:0.875rem;">${p(e.title)}</a>`,e.formattedDate&&(n+=`<span style="color:#9ca3af;font-size:0.7rem;margin-left:0.5rem;">${p(e.formattedDate)}</span>`),n+=`</li>`;n+=`</ul></li>`};e.categories.General&&i(`General`,e.categories.General);let s=Object.keys(e.children).sort((e,t)=>e.localeCompare(t));for(let i of s)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(i)}</span>`,n+=`<ul style="margin:0.2rem 0 0 0;padding:0;list-style:none;">`,n+=o(e.children[i],t+1),n+=`</ul></li>`;let c=Object.keys(e.categories).filter(e=>e!==`General`).sort((e,t)=>e.localeCompare(t));for(let t of c)i(t,e.categories[t]);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>
|
|
92
92
|
<html>
|
|
93
93
|
<head>
|
|
94
94
|
<meta charset="UTF-8">
|
|
@@ -134,7 +134,7 @@ Texte`};case`link`:return{text:Ce(`snip-link-text`),textFallback:Y(`snippet.link
|
|
|
134
134
|
</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{I(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=Ur(),S=z(x),C=e=>{var r=th(),f=R(r),p=R(f),h=B(R(p),2),x=R(h,!0);N(h),N(p);var S=B(p,2),C=R(S),w=R(C,!0);N(C);var T=B(C,2),E=R(T,!0);N(T);var D=B(T,2),ee=R(D,!0);N(D),N(S);var O=B(S,2),te=e=>{var t=Qm(),n=R(t),r=R(n),c=e=>{var t=Ym(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.loading`)]),G(e,t)},l=e=>{var t=Xm(),n=R(t);N(t),V(e=>K(n,`${e??``}failed to load folders`),[()=>Y(`common.error_prefix`)]),G(e,t)},u=e=>{var t=Ur();$r(z(t),16,()=>H(o),e=>e,(e,t)=>{var n=Zm(),r=R(n);Ei(r);var i,a=B(r,2),o=R(a,!0);N(a),N(n),V(()=>{i!==(i=t)&&(r.value=(r.__value=t)??``),K(o,t)}),Ni(r,()=>H(s)[t],e=>H(s)[t]=e),G(e,n)}),G(e,t)};q(r,e=>{H(i)?e(c):H(a)?e(l,1):e(u,-1)}),N(n),N(t),G(e,t)};q(O,e=>{H(n)===`html`&&e(te)});var k=B(O,2),ne=e=>{var n=$m(),r=R(n),i=R(r,!0);N(r);var a=B(r,2),o=R(a),s=R(o,!0);N(o);var l=B(o,2),u=R(l,!0);N(l),N(a),N(n),V((e,t,n)=>{K(i,e),K(s,t),l.disabled=H(c),K(u,n)},[()=>Y(`modal.export.markdown_hint`),()=>Y(`common.cancel`),()=>H(c)?`⏳`:Y(`modal.export.markdown_btn`)]),U(`click`,o,function(...e){t.onclose?.apply(this,e)}),U(`click`,l,g),G(e,n)};q(k,e=>{H(n)===`markdown`&&e(ne)});var re=B(k,2),ie=e=>{var n=eh(),r=R(n),i=R(r,!0);N(r);var a=B(r,2),o=R(a),s=R(o,!0);N(o);var c=B(o,2),d=R(c,!0);N(c);var f=B(c,2),p=R(f,!0);N(f),N(a),N(n),V((e,t,n,r)=>{K(i,e),K(s,t),c.disabled=H(l),K(d,n),f.disabled=H(u),K(p,r)},[()=>Y(`modal.export_html.hint`),()=>Y(`common.cancel`),()=>H(l)?`⏳`:Y(`modal.export_html.notion_btn`),()=>H(u)?`⏳`:Y(`modal.export_html.confluence_btn`)]),U(`click`,o,function(...e){t.onclose?.apply(this,e)}),U(`click`,c,()=>_(`notion`)),U(`click`,f,()=>_(`confluence`)),G(e,n)};q(re,e=>{H(n)===`html`&&e(ie)});var ae=B(re,2),oe=e=>{var n=$m(),r=R(n),i=R(r,!0);N(r);var a=B(r,2),o=R(a),s=R(o,!0);N(o);var c=B(o,2),l=R(c,!0);N(c),N(a),N(n),V((e,t,n)=>{K(i,e),K(s,t),c.disabled=H(d),K(l,n)},[()=>Y(`modal.export.pdf_hint`),()=>Y(`common.cancel`),()=>H(d)?`⏳`:Y(`modal.export.pdf_btn`)]),U(`click`,o,function(...e){t.onclose?.apply(this,e)}),U(`click`,c,v),G(e,n)};q(ae,e=>{H(n)===`pdf`&&e(oe)}),N(f),N(r),V((e,t,r,i)=>{K(x,e),hi(C,1,li(H(n)===`markdown`?y:b)),K(w,t),hi(T,1,li(H(n)===`html`?y:b)),K(E,r),hi(D,1,li(H(n)===`pdf`?y:b)),K(ee,i)},[()=>Y(`modal.export.title`),()=>Y(`modal.export.tab_markdown`),()=>Y(`modal.export.tab_html`),()=>Y(`modal.export.tab_pdf`)]),U(`click`,r,e=>{e.target===e.currentTarget&&t.onclose()}),U(`click`,C,()=>m(`markdown`)),U(`click`,T,()=>m(`html`)),U(`click`,D,()=>m(`pdf`)),G(e,r)};q(S,e=>{t.open&&e(C)}),G(e,x),Ke()}Nr([`click`]);var rh=W(`<p class="px-3 py-4 text-xs text-gray-400 text-center"> </p>`),ih=W(`<p> </p>`),ah=W(`<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>`),oh=W(`<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>`),sh=W(`<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>`),ch=W(`<label class="flex items-center gap-1.5 text-xs text-gray-700 dark:text-gray-300 cursor-pointer"><input type="checkbox"/> </label>`),lh=W(`<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>`),uh=W(`<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>`),dh=W(`<!> <!>`,1),fh=W(`<div> </div>`),ph=W(`<div> </div> <div> </div> <div> </div> <!>`,1),mh=W(`<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>`),hh=W(`<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>`),gh=W(`<p class="absolute inset-0 flex items-center justify-center text-gray-400 dark:text-gray-500 text-sm animate-pulse"> </p>`),_h=W(`<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>`),vh=W(`<div class="text-gray-400 text-center py-2">—</div>`),yh=W(`<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>`),bh=W(`<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 xh(e,t){Ge(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=F(``),m=F(``),h=F(1),g=F(``),_=F(!0),v=F(!1),y=F(L(s.map(e=>({value:e.value,label:`.`+e.value,checked:!!e.def}))));function b(){return H(y).filter(e=>e.checked).map(e=>e.value)}let x=P(()=>H(y).every(e=>e.checked)),S=F(null),C=F(null),w=F(0),T=F(null),E=F(L([])),D=F(L([])),ee=F(!1),O=F(``),te=F(0),k=F(L([]));function ne(){localStorage.setItem(`wc-exts`,JSON.stringify(b()))}function re(){let e=H(x);I(y,H(y).map(t=>({...t,checked:!e})),!0),ne()}function ie(){ne()}function ae(){return new Set((H(m)||``).split(/[\n,]/).map(e=>e.trim()).filter(Boolean))}function oe(e){let t=ae();t.has(e)||(t.add(e),I(m,[...t].join(`, `),!0),localStorage.setItem(`wc-exclude`,H(m)),H(de)&&ve(H(pe)),ce())}function se(){localStorage.setItem(`wc-exclude`,H(m)),H(de)&&ve(H(pe)),ce()}function ce(){H(ee)&&H(O)&&M(H(O))}function le(){H(S)&&je()}function ue(){let e=localStorage.getItem(`wc-root`);e&&(I(p,e,!0),I(Se,e,!0));let t=localStorage.getItem(`wc-exclude`);t&&I(m,t,!0);let n=localStorage.getItem(`wc-exts`);if(n)try{let e=JSON.parse(n);I(y,H(y).map(t=>({...t,checked:e.includes(t.value)})),!0)}catch{}}let de=F(!1),fe=F(null),pe=F(``),me=F(``),he=F(null),ge=F(``);function _e(){I(de,!H(de)),H(de)&&ve(H(pe)||H(p)||`/`)}async function ve(e){I(he,null),I(ge,`Loading…`);try{let t=await fetch(`/api/browse?all=1&path=`+encodeURIComponent(e)).then(e=>e.json());I(pe,t.current,!0),I(fe,t.parent,!0),I(me,t.current,!0);let n=H(p).trim(),r=(e,t)=>n&&e.startsWith(n+`/`)?e.slice(n.length+1):t,i=ae(),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];I(he,c,!0),I(ge,c.length?``:`Empty directory`,!0)}catch{I(he,[],!0),I(ge,`Cannot read directory`)}}function ye(){H(fe)&&ve(H(fe))}let be=F(!1),xe=F(null),Se=F(``),Ce=F(``),we=F(null),Te=F(``);function A(){I(be,!H(be)),H(be)&&Ee(H(Se)||H(p)||`/`)}async function Ee(e){I(we,null),I(Te,`Loading…`);try{let t=await fetch(`/api/browse?path=`+encodeURIComponent(e)).then(e=>e.json());I(Se,t.current,!0),I(xe,t.parent,!0),I(Ce,t.current,!0),I(we,(t.dirs||[]).map(e=>({name:e.name,path:e.path})),!0),I(Te,H(we).length?``:`No sub-folders`,!0)}catch{I(we,[],!0),I(Te,`Cannot read directory`)}}function De(){H(xe)&&Ee(H(xe))}function Oe(){I(p,H(Se),!0),localStorage.setItem(`wc-root`,H(Se)),I(be,!1),I(m,``),localStorage.removeItem(`wc-exclude`),I(pe,H(Se),!0)}let ke=F(null),Ae=F(null),j=F(!1);function je(){if(!H(S)||!H(C))return;let e=Math.max(1,H(h)||1),t=[...H(S).entries()].sort((e,t)=>t[1]-e[1]),n=t.filter(([t])=>(H(C).get(t)||new Set).size>=e).slice(0,150);if(!n.length){let n=t.length;I(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),I(_,!0),I(j,!1),I(v,!1);return}let r=[...H(S).keys()].filter(t=>(H(C).get(t)||new Set).size>=e).length;I(T,{scanned:H(w),unique:r,shown:n.length},!0);let i=n.slice(0,50),a=i[0][1];I(D,i.map(([e,t])=>({word:e,freq:t,pct:Math.round(t/a*100)})),!0),I(v,!0),I(_,!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(!H(ke)||!H(Ae))return;let e=H(ke),t=H(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`,I(j,!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=>M(e[0])})})}function M(e){if(!H(C)||!H(S))return;let t=[...H(C).get(e)||[]].sort(),n=H(S).get(e)||0;I(O,e,!0),I(te,n,!0),I(k,t,!0),I(ee,!0)}function Me(){I(ee,!1)}async function Ne(){let e=H(p).trim();if(!e){I(g,`Please select a root folder first.`),I(_,!0);return}let t=b();if(!t.length){I(g,`Please select at least one extension.`),I(_,!0);return}I(be,!1),I(v,!1),I(ee,!1),I(g,`Reading files…`),I(_,!0),I(j,!1);try{let n=H(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){I(g,`Error: `+((await a.json()).error||a.statusText));return}let{files:o,fileTexts:s}=await a.json();I(g,`Analyzing ${o} file(s)…`);let c=new Map,l=new Map,u=new Set;I(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))}I(S,c,!0),I(C,l,!0),I(E,[...u].sort().map(e=>`.`+e),!0),je()}catch(e){I(g,`Error: `+e.message)}}let Pe=!1;On(()=>{t.open&&!Pe?(Pe=!0,I(g,`Choose a root folder and click Launch.`),I(_,!0),I(j,!1),I(v,!1),I(ee,!1),I(S,null),I(C,null),I(T,null),I(D,[],!0),I(be,!1),I(de,!1),I(h,1),ue(),H(p)||fetch(`/api/config`).then(e=>e.json()).then(e=>{e.docsFolder&&(I(p,e.docsFolder,!0),I(Se,e.docsFolder,!0))}).catch(()=>{})):t.open||(Pe=!1)});var Fe=Ur(),Ie=z(Fe),Le=e=>{var n=bh(),r=R(n),i=R(r),a=R(i,!0);N(i);var o=B(i,2),s=R(o,!0);N(o),N(r);var c=B(r,2),l=R(c),u=R(l),d=R(u,!0);N(u);var f=B(u,2);Ei(f);var b=B(f,2),S=B(R(b)),C=R(S,!0);N(S),N(b);var w=B(b,2),ne=R(w,!0);N(w),N(l);var ae=B(l,2),ce=R(ae),ue=R(ce,!0);N(ce);var pe=B(ce,2);vn(pe);var Se=B(pe,2),je=B(R(Se)),Pe=R(je,!0);N(je),N(Se),N(ae);var Fe=B(ae,2),Ie=e=>{var t=sh(),n=R(t),r=R(n),i=B(r,2),a=R(i,!0);N(i),N(n);var o=B(n,2),s=R(o),c=e=>{var t=rh(),n=R(t,!0);N(t),V(()=>K(n,H(ge))),G(e,t)},l=e=>{var t=ih(),n=R(t,!0);N(t),V(()=>{hi(t,1,`px-3 py-3 text-xs ${H(ge)===`Cannot read directory`?`text-red-400`:`text-gray-400`} text-center`),K(n,H(ge))}),G(e,t)},u=e=>{var t=Ur();$r(z(t),17,()=>H(he),Yr,(e,t)=>{var n=Ur(),r=z(n),i=e=>{var n=ah(),r=R(n),i=B(R(r),2),a=R(i,!0);N(i),N(r);var o=B(r,2);N(n),V(()=>K(a,H(t).name)),U(`click`,r,()=>ve(H(t).path)),U(`click`,o,()=>oe(H(t).entry)),G(e,n)},a=e=>{var n=oh(),r=R(n),i=B(R(r),2),a=R(i,!0);N(i),N(r);var o=B(r,2);N(n),V(()=>K(a,H(t).name)),U(`click`,o,()=>oe(H(t).entry)),G(e,n)};q(r,e=>{H(t).kind===`dir`?e(i):e(a,-1)}),G(e,n)}),G(e,t)};q(s,e=>{H(he)===null?e(c):H(he).length===0?e(l,1):e(u,-1)}),N(o),N(t),V(()=>{r.disabled=!H(fe),K(a,H(me))}),U(`click`,r,ye),G(e,t)};q(Fe,e=>{H(de)&&e(Ie)});var Le=B(Fe,2),Re=R(Le),ze=R(Re,!0);N(Re);var Be=B(Re,2),Ve=R(Be);Ei(Ve);var He=B(Ve);N(Be),$r(B(Be,2),17,()=>H(y),e=>e.value,(e,t,n)=>{var r=ch(),i=R(r);Ei(i);var a=B(i);N(r),V(()=>K(a,` ${H(t).label??``}`)),U(`change`,i,ie),Ni(i,()=>H(t).checked,e=>H(t).checked=e),G(e,r)}),N(Le);var Ue=B(Le,2),We=e=>{var t=sh(),n=R(t),r=R(n),i=B(r,2),a=R(i,!0);N(i),N(n);var o=B(n,2),s=R(o),c=e=>{var t=rh(),n=R(t,!0);N(t),V(()=>K(n,H(Te))),G(e,t)},l=e=>{var t=dh(),n=z(t),r=e=>{var t=ih(),n=R(t,!0);N(t),V(()=>{hi(t,1,`px-3 py-3 text-xs ${H(Te)===`Cannot read directory`?`text-red-400`:`text-gray-400`} text-center`),K(n,H(Te))}),G(e,t)},i=e=>{var t=Ur();$r(z(t),17,()=>H(we),Yr,(e,t)=>{var n=lh(),r=R(n),i=B(R(r),2),a=R(i,!0);N(i),N(r);var o=B(r,2);N(n),V(()=>K(a,H(t).name)),U(`click`,r,()=>Ee(H(t).path)),U(`click`,o,()=>oe(H(t).name)),G(e,n)}),G(e,t)};q(n,e=>{H(we).length===0?e(r):e(i,-1)});var a=B(n,2),o=e=>{var t=uh(),n=B(R(t)),r=R(n,!0);N(n),N(t),V(()=>K(r,H(Ce))),U(`click`,t,Oe),G(e,t)};q(a,e=>{H(Te)!==`Cannot read directory`&&e(o)}),G(e,t)};q(s,e=>{H(we)===null?e(c):e(l,-1)}),N(o),N(t),V(()=>{r.disabled=!H(xe),K(a,H(Ce))}),U(`click`,r,De),G(e,t)};q(Ue,e=>{H(be)&&e(We)}),N(c);var Ge=B(c,2),Ke=R(Ge),qe=e=>{var t=hh(),n=R(t),r=R(n),i=e=>{var t=ph(),n=z(t),r=R(n);N(n);var i=B(n,2),a=R(i);N(i);var o=B(i,2),s=R(o);N(o);var c=B(o,2),l=e=>{var t=fh(),n=R(t);N(t),V((e,r)=>{J(t,`title`,e),K(n,`${H(E).length??``} extension${H(E).length>1?`s`:``} found (${r??``})`)},[()=>H(E).join(`, `),()=>H(E).join(`, `)]),G(e,t)};q(c,e=>{H(E).length&&e(l)}),V(()=>{K(r,`${H(T).scanned??``} file(s) scanned`),K(a,`${H(T).unique??``} unique domain words`),K(s,`${H(T).shown??``} shown`)}),G(e,t)};q(r,e=>{H(T)&&e(i)}),N(n);var a=B(n,2),o=R(a),s=R(o,!0);N(o);var c=B(o,2);Ei(c);var l=B(c,2),u=R(l,!0);N(l),N(a);var d=B(a,2),f=R(d,!0);N(d);var p=B(d,2);$r(p,21,()=>H(D),Yr,(e,t,n)=>{var r=mh(),i=R(r);i.textContent=n+1;var a=B(i,2),o=R(a),s=R(o),c=R(s,!0);N(s);var l=B(s,2),u=R(l,!0);N(l),N(o);var d=B(o,2),f=R(d);N(d),N(a),N(r),V(()=>{K(c,H(t).word),K(u,H(t).freq),_i(f,`width:${H(t).pct??``}%`)}),U(`click`,r,()=>M(H(t).word)),G(e,r)}),N(p),N(t),V((e,t,n,r,i,a)=>{J(o,`title`,e),K(s,t),J(c,`title`,n),J(l,`title`,r),K(u,i),K(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`)]),Mi(c,()=>H(h),e=>I(h,e)),U(`click`,l,le),G(e,t)};q(Ke,e=>{H(v)&&e(qe)});var Je=B(Ke,2),Ye=R(Je),Xe=e=>{var t=gh(),n=R(t,!0);N(t),V(()=>K(n,H(g))),G(e,t)};q(Ye,e=>{H(_)&&e(Xe)});var Ze=B(Ye,2);let Qe;Li(Ze,e=>I(ke,e),()=>H(ke)),N(Je),Li(Je,e=>I(Ae,e),()=>H(Ae));var $e=B(Je,2),et=e=>{var t=yh(),n=R(t),r=R(n),i=R(r);N(r);var a=B(r,2);N(n);var o=B(n,2),s=R(o,!0);N(o);var c=B(o,2),l=R(c),u=e=>{var t=Ur();$r(z(t),17,()=>H(k),Yr,(e,t)=>{var n=_h(),r=R(n),i=R(r,!0);N(r);var a=B(r,2);N(n),V(()=>K(i,H(t))),U(`click`,a,()=>oe(H(t))),G(e,n)}),G(e,t)},d=e=>{G(e,vh())};q(l,e=>{H(k).length?e(u):e(d,-1)}),N(c),N(t),V(e=>{K(i,`${H(O)??``} ×${H(te)??``}`),K(s,e)},[()=>Y(`wc.found_in`)]),U(`click`,a,Me),G(e,t)};q($e,e=>{H(ee)&&e(et)}),N(Ge),N(n),V((e,t,n,r,i,o,c,l,u,f)=>{K(a,e),K(s,t),K(d,n),K(C,r),K(ne,i),K(ue,o),J(pe,`placeholder`,c),K(Pe,l),K(ze,u),Oi(Ve,H(x)),K(He,` ${f??``}`),Qe=hi(Ze,1,``,null,Qe,{hidden:!H(j)})},[()=>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`)]),U(`click`,o,function(...e){t.onclose?.apply(this,e)}),Mi(f,()=>H(p),e=>I(p,e)),U(`click`,b,A),U(`click`,w,Ne),U(`input`,pe,se),Mi(pe,()=>H(m),e=>I(m,e)),U(`click`,Se,_e),U(`change`,Ve,re),G(e,n)};q(Ie,e=>{t.open&&e(Le)}),G(e,Fe),Ke()}Nr([`click`,`input`,`change`]);var Sh=W(`<button class="ghost-button"><i class="fa-solid fa-cloud"></i></button> <button title="Toggle dark mode" class="ghost-button" aria-label="Toggle dark mode"> </button>`,1),Ch=W(`<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>`),wh=W(`<p class="p-8 text-red-500"> </p>`),Th=W(`<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> <p class="mt-4 text-xs text-gray-400 dark:text-gray-600 font-mono bg-gray-100 dark:bg-gray-800 rounded-lg px-3 py-2 inline-block"> </p> <p class="mt-2 text-xs text-gray-400"> </p></div></div>`),Eh=W(`<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 Dh(e,t){Ge(t,!0);let n=F(!1),r=F(!1),i=F(!1),a=F(!1),o=F(null),s=F(!1),c=F(``),l=F(!1),u=F(`Living AI Documentation`),d=F(`YYYY_MM_DD_HH_mm_[Category]_title.md`),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){I(l,e,!0),document.documentElement.classList.toggle(`dark`,e)}function h(){m(!H(l));try{localStorage.setItem(`ld-dark`,String(H(l)))}catch{}}On(()=>{let e=document.getElementById(`hljs-dark`),t=document.getElementById(`hljs-light`);if(!e||!t)return;let n=$.codeBlockLightTheme&&!H(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){$.searchQuery=``,$.searchResults=null;return}$.searchQuery=t,$.searchResults=$.allDocs.filter(e=>e.title.toLowerCase().includes(t.toLowerCase())||e.category.toLowerCase().includes(t.toLowerCase())),f=window.setTimeout(async()=>{try{let e=await Fu(t);t===$.searchQuery&&($.searchResults=e)}catch{}},350)}let _=F(L([]));function v(e){let t=H(_)[e];t&&(I(_,H(_).slice(0,e),!0),y(t.id,!1,`restore`))}async function y(e,t=!1,n=!1,r=null){if(n===!0&&$.currentDocId&&$.currentDocId!==e){let t=H(_).findIndex(t=>t.id===e);if(t!==-1)I(_,H(_).slice(0,t),!0);else{let e=$.allDocs.find(e=>e.id===$.currentDocId);I(_,[...H(_),{id:$.currentDocId,title:e?e.title:$.currentDocId}],!0)}}else n||I(_,[],!0);$.currentDocId=e;let i=$.allDocs.find(t=>t.id===e);if(i&&$.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)}I(s,!0),I(c,``);try{let t=await ju(e);t.id=e,I(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){I(c,Y(`doc.failed_to_load`)+(e instanceof Error?e.message:String(e)))}finally{I(s,!1)}}async function b(e){if(!H(o))return;let t=H(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 ju(t);r.id=t,I(o,r,!0);let i=e.match(/\]\(\s*\.?\/files\/[^)\s]+/g),a={...$.fileAttachmentCounts};i&&i.length?a[t]=i.length:delete a[t],$.fileAttachmentCounts=a}async function x(){if(!H(o))return;let e=H(o).id;if(!(await fetch(`/api/documents/`+encodeURIComponent(e),{method:`DELETE`})).ok)return;$.allDocs=$.allDocs.filter(t=>t.id!==e),Array.isArray($.searchResults)&&($.searchResults=$.searchResults.filter(t=>t.id!==e));let t={...$.annotationCounts};delete t[e],$.annotationCounts=t;let n={...$.fileAttachmentCounts};delete n[e],$.fileAttachmentCounts=n,$.currentDocId=null,I(o,null),history.pushState({},``,location.pathname)}async function S(){let[e,t]=await Promise.all([ku(),Ou()]);if($.allDocs=e,t.docsFolder)try{$.allFolderPaths=await Au(t.docsFolder)}catch{$.allFolderPaths=[]}let[n,r,i]=await Promise.all([Mu(),Nu(),Pu()]);$.annotationCounts=n,$.fileAttachmentCounts=r,$.docStatuses=i}Vi(async()=>{m(p());let e=await Ou();await fa(e.language||`en`),e.title&&(document.title=e.title,I(u,e.title,!0)),e.filenamePattern&&I(d,e.filenamePattern+`.md`),$.exclusiveFolderExpansion=!!e.exclusiveFolderExpansion,$.exclusiveCategoryExpansion=!!e.exclusiveCategoryExpansion,$.codeBlockMaxHeight=typeof e.codeBlockMaxHeight==`number`?e.codeBlockMaxHeight:400,$.imageRoundedCorners=!!e.imageRoundedCorners,$.imageCentered=!!e.imageCentered,$.imageBorder=!!e.imageBorder,$.codeBlockLightTheme=!!e.codeBlockLightTheme,$.codeBlockMaxHeight>0&&document.documentElement.style.setProperty(`--ld-code-max-h`,$.codeBlockMaxHeight+`px`),$.expandedCategories.size===0&&($.expandedCategories=new Set([`General`])),await S();let t=new URLSearchParams(location.search).get(`doc`);if(t)y(t,!0,!1,location.hash?location.hash.slice(1):null);else{let e=$.allDocs.find(e=>e.category===`General`)??$.allDocs[0];e&&y(e.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)};return window.addEventListener(`popstate`,n),()=>window.removeEventListener(`popstate`,n)});var C=Eh(),w=z(C),T=R(w);ua(T,{get title(){return H(u)},subtitle:``,actions:e=>{var t=Sh(),n=z(t),r=B(n,2),i=R(r,!0);N(r),V((e,t)=>{J(n,`title`,e),J(n,`aria-label`,t),K(i,H(l)?`☀`:`☾`)},[()=>Y(`nav.word_cloud`),()=>Y(`nav.word_cloud`)]),U(`click`,n,()=>I(a,!0)),U(`click`,r,h),G(e,t)},children:(e,t)=>{var n=Ch(),r=R(n);Ei(r),Pe(2),N(n),V(e=>{J(r,`placeholder`,e),Di(r,$.searchQuery)},[()=>Y(`nav.search_placeholder`)]),U(`input`,r,e=>g(e.target.value)),G(e,n)},$$slots:{actions:!0,default:!0}});var E=B(T,2),D=R(E);sd(D,{onopen:e=>y(e),onsearch:g,onexport:()=>I(i,!0),onnewfolder:()=>I(n,!0),onnewdoc:()=>I(r,!0)});var ee=B(D,2),O=R(ee),te=e=>{var t=Ur(),n=z(t),r=e=>{var t=wh(),n=R(t,!0);N(t),V(()=>K(n,H(c))),G(e,t)},i=e=>{jm(e,{get doc(){return H(o)},get navHistory(){return H(_)},ongoback:v,onopen:(e,t)=>y(e,!1,!0,t),onsave:b,ondelete:x})};q(n,e=>{H(c)?e(r):e(i,-1)}),G(e,t)},k=e=>{var t=Th(),n=R(t),r=B(R(n),2),i=R(r,!0);N(r);var a=B(r,2),o=R(a,!0);N(a);var s=B(a,2),c=R(s,!0);N(s);var l=B(s,2),u=R(l,!0);N(l),N(n),N(t),V((e,t,n)=>{K(i,e),K(o,t),K(c,H(d)),K(u,n)},[()=>Y(`welcome.title`),()=>Y(`welcome.hint`),()=>Y(`welcome.pattern_hint`)]),G(e,t)};q(O,e=>{H(o)?e(te):e(k,-1)}),N(ee),N(E),N(w);var ne=B(w,2);zm(ne,{get open(){return H(n)},onclose:()=>I(n,!1),onsuccess:S});var re=B(ne,2);Jm(re,{get open(){return H(r)},onclose:()=>I(r,!1),onsuccess:async e=>{await S(),y(e)}});var ie=B(re,2);nh(ie,{get open(){return H(i)},onclose:()=>I(i,!1)}),xh(B(ie,2),{get open(){return H(a)},onclose:()=>I(a,!1)}),G(e,C),Ke()}Nr([`click`,`input`]);var Oh=`modulepreload`,kh=function(e){return`/`+e},Ah={},jh=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}))))}r=o(t.map(t=>{if(t=kh(t,n),t in Ah)return;Ah[t]=!0;let r=t.endsWith(`.css`),i=r?`[rel="stylesheet"]`:``;if(n)for(let n=e.length-1;n>=0;n--){let i=e[n];if(i.href===t&&(!r||i.rel===`stylesheet`))return}else if(document.querySelector(`link[href="${t}"]${i}`))return;let o=document.createElement(`link`);if(o.rel=r?`stylesheet`:Oh,r||(o.as=`script`),o.crossOrigin=``,o.href=t,a&&o.setAttribute(`nonce`,a),document.head.appendChild(o),r)return new Promise((e,n)=>{o.addEventListener(`load`,e),o.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)})},Mh=W(`<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.
|
|
135
135
|
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
|
|
136
136
|
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
|
|
137
|
-
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 Nh(e,t){Ge(t,!0),Vi(()=>{let e;return(async()=>{let t=`en`;try{t=(await fetch(`/api/config`).then(e=>e.json())).language||`en`}catch{}await fa(t);let{initDiagram:r}=await jh(async()=>{let{initDiagram:e}=await import(`./main-BIFGig6a.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=F(!1);function i(e){e.preventDefault();let t=document.getElementById(`sidebar`);if(!t)return;let i=e.clientX,a=t.getBoundingClientRect().width;I(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=``,I(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=Mh(),o=R(a),s=R(o),c=R(s,!0);N(s);var l=B(s,4),u=B(l,4),d=B(u,2),f=B(d,4),p=B(f,2),m=B(p,2),h=B(m,2),g=B(h,2),_=B(g,2),v=B(_,2),y=B(v,2),b=B(y,2),x=B(b,4),S=B(x,4),C=B(S,4),w=B(C,2),T=B(w,2),E=B(T,2),D=B(E,2),ee=B(D,2),O=B(ee,4),te=B(O,4),k=B(te,4),ne=B(k,2),re=B(ne,8),ie=B(re,4),ae=B(ie,4),oe=R(ae),se=R(oe,!0);N(oe),N(ae),N(o);var ce=B(o,2),le=R(ce),ue=R(le),de=R(ue),fe=R(de,!0);N(de);var pe=B(de,2),me=R(pe,!0);N(pe),N(ue),Pe(2),N(le);var he=B(le,2),ge=B(he,2),_e=B(R(ge),10),ve=B(R(_e),8),ye=B(ve,2);N(_e);var be=B(_e,2),xe=R(be),Se=R(xe),Ce=R(Se,!0);N(Se);var we=B(Se,2);N(xe),Pe(2),N(be);var Te=B(be,2),A=R(Te),Ee=B(A,4),De=R(Ee),Oe=B(De,4),ke=B(Oe,4),Ae=B(ke,2),j=B(Ae,4),je=B(j,2),M=B(je,2),Me=B(M,4),Ne=B(Me,2),Fe=B(Ne,2),Ie=B(Fe,4),Le=B(Ie,2),Re=B(Le,2),ze=B(Re,4),Be=R(ze),Ve=B(Be,2),He=B(Ve,2),Ue=B(He,2),We=B(Ue,2);Pe(2),N(ze);var qe=B(ze,2),Je=B(qe,2),Ye=B(Je,4),Xe=B(Ye,2),Ze=B(Xe,2),Qe=B(Ze,4),$e=B(Qe,2),et=B($e,4),tt=B(et,4),nt=B(tt,2),rt=B(nt,4);N(Ee),N(Te);var it=B(Te,2),at=R(it),ot=R(at,!0);N(at);var st=B(at,2),ct=B(R(st),2),lt=R(ct,!0);N(ct),N(st);var ut=B(st,2),dt=R(ut);N(ut);var ft=B(ut,2),pt=B(R(ft),2),mt=R(pt,!0);N(pt),N(ft);var ht=B(ft,4),gt=B(R(ht),2),_t=R(gt,!0);N(gt),N(ht);var vt=B(ht,2),yt=R(vt);N(vt);var bt=B(vt,2),xt=R(bt),St=R(xt,!0);N(xt);var Ct=B(xt,2),wt=R(Ct,!0);N(Ct),Pe(2),N(bt),N(it);var Tt=B(it,2),Et=R(Tt),Dt=B(Et,4),Ot=R(Dt),kt=B(Ot,2),At=B(kt,2),jt=B(At,2),Mt=B(jt,4),Nt=B(Mt,2),Pt=B(Nt,4),Ft=B(Pt,2),It=B(Ft,2),Lt=B(It,4),Rt=B(Lt,2),zt=B(Rt,4),Bt=B(zt,2),P=B(Bt,4),Vt=B(P,2),Ht=B(Vt,2),Ut=B(Ht,2),Wt=B(Ut,2),Gt=B(Wt,4),Kt=B(Gt,2),qt=B(Kt,4),Jt=B(qt,4),Yt=B(Jt,4);N(Dt),N(Tt);var Xt=B(Tt,2),Zt=B(Xt,2),Qt=B(R(Zt),2),$t=R(Qt,!0);N(Qt),N(Zt),N(ge),N(ce);var en=B(ce,4),tn=R(en),L=R(tn),nn=R(L,!0);N(L);var rn=B(L,4),an=R(rn);Pe(2),N(rn);var on=B(rn,2),sn=R(on,!0);N(on);var cn=B(on,2),ln=R(cn),un=R(ln,!0);N(ln);var dn=B(ln,2),fn=R(dn,!0);N(dn),N(cn),N(tn),N(en),N(a),V((e,t,n,i,a,o,s,ae,oe,ce,le,ue,de,pe,ge,_e,be,xe,Se,Te,Ee,N,Pe,ze,Ge,Ke,it,at,st,ct,ut,ft,pt,ht,gt,vt,bt,xt,Ct,Tt,Dt,F,Zt,I,Qt,en,tn,L,rn,on,cn,ln,dn,R,z,B,pn,mn,hn,gn,_n,vn,yn,bn,xn,Sn,Cn,wn,Tn,En,Dn,On,kn,An,jn,Mn,Nn,Pn,V,Fn,In,Ln,Rn,zn,Bn,Vn,Hn,Un,Wn,Gn,Kn,qn,Jn,Yn,Xn,Zn,Qn,$n,er,tr,nr,rr,ir)=>{K(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`,ae),J(g,`title`,oe),J(_,`title`,ce),J(v,`title`,le),J(y,`title`,ue),J(b,`title`,de),J(x,`title`,pe),J(S,`title`,ge),J(C,`title`,_e),J(w,`title`,be),J(T,`title`,xe),J(E,`title`,Se),J(D,`title`,Te),J(ee,`title`,Ee),J(O,`placeholder`,N),J(te,`title`,Pe),J(k,`title`,ze),J(ne,`title`,Ge),J(re,`title`,Ke),J(ie,`title`,it),K(se,at),K(fe,st),K(me,ct),hi(he,1,`w-1 shrink-0 cursor-col-resize select-none transition-colors ${H(r)?`bg-blue-500/60`:`bg-transparent hover:bg-blue-500/40`}`),J(ve,`title`,ut),J(ye,`title`,ft),K(Ce,pt),J(we,`title`,ht),J(A,`title`,gt),J(De,`title`,vt),J(Oe,`title`,bt),J(ke,`title`,xt),J(Ae,`title`,Ct),J(j,`title`,Tt),J(je,`title`,Dt),J(M,`title`,F),J(Me,`title`,Zt),J(Ne,`title`,I),J(Fe,`title`,Qt),J(Ie,`title`,en),J(Le,`title`,tn),J(Re,`title`,L),J(Be,`title`,rn),J(Ve,`title`,on),J(He,`title`,cn),J(Ue,`title`,ln),J(We,`title`,dn),J(qe,`title`,R),J(Je,`title`,z),J(Ye,`title`,B),J(Xe,`title`,pn),J(Ze,`title`,mn),J(Qe,`title`,hn),J($e,`title`,gn),J(et,`title`,_n),J(tt,`title`,vn),J(nt,`title`,yn),J(rt,`title`,bn),K(ot,xn),K(lt,Sn),J(dt,`placeholder`,Cn),K(mt,wn),K(_t,Tn),J(yt,`placeholder`,En),K(St,Dn),K(wt,On),J(Et,`title`,kn),J(Ot,`title`,An),J(kt,`title`,jn),J(At,`title`,Mn),J(jt,`title`,Nn),J(Mt,`title`,Pn),J(Nt,`title`,V),J(Pt,`title`,Fn),J(Ft,`title`,In),J(It,`title`,Ln),J(Lt,`title`,Rn),J(Rt,`title`,zn),J(zt,`title`,Bn),J(Bt,`title`,Vn),J(P,`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,`placeholder`,Qn),K($t,$n),K(nn,er),J(an,`placeholder`,tr),K(sn,nr),K(un,rr),K(fn,ir)},[()=>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`)]),U(`click`,s,()=>history.back()),U(`mousedown`,he,i),G(e,a),Ke()}Nr([`click`,`mousedown`]),He();var Ph={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 Fh(){Ph.isDirty=!0,document.getElementById(`btnSave`).disabled=!1}var Ih=`custom-shape`,Lh=`custom-shape:`,Rh=[{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 zh(e){return typeof e==`string`&&e.startsWith(`custom-shape:`)}function Bh(e){return zh(e)?e.slice(13):null}function Vh(e){return e&&Ph.customShapeDefs&&Ph.customShapeDefs.get(e)||null}function Hh(e){let t=Vh(e);return[t&&t.width||65,t&&t.height||65]}function Uh(e){let t=Vh(e);return t&&Array.isArray(t.anchors)&&t.anchors.length?t.anchors:Rh}function Wh(e){let t=Vh(e);return t&&[`center`,`below`,`above`,`right`,`left`].includes(t.labelPlacement)?t.labelPlacement:`below`}async function Gh(){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:[];Ph.customShapeLibraries=n,Ph.customShapeDefs=new Map,n.forEach(e=>{(e.shapes||[]).forEach(e=>Ph.customShapeDefs.set(e.id,e))})}catch{Ph.customShapeLibraries=[],Ph.customShapeDefs=new Map}}function Kh(){let e=document.getElementById(`customShapeBar`),t=document.getElementById(`customShapeBarBody`);if(!e||!t)return;t.innerHTML=``;let n=(Ph.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:`${Lh}${e.id}`}}))}),t.appendChild(n)})}function qh(){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(Rh)}}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=`
|
|
137
|
+
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 Nh(e,t){Ge(t,!0),Vi(()=>{let e;return(async()=>{let t=`en`;try{t=(await fetch(`/api/config`).then(e=>e.json())).language||`en`}catch{}await fa(t);let{initDiagram:r}=await jh(async()=>{let{initDiagram:e}=await import(`./main-RlbyF6qN.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=F(!1);function i(e){e.preventDefault();let t=document.getElementById(`sidebar`);if(!t)return;let i=e.clientX,a=t.getBoundingClientRect().width;I(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=``,I(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=Mh(),o=R(a),s=R(o),c=R(s,!0);N(s);var l=B(s,4),u=B(l,4),d=B(u,2),f=B(d,4),p=B(f,2),m=B(p,2),h=B(m,2),g=B(h,2),_=B(g,2),v=B(_,2),y=B(v,2),b=B(y,2),x=B(b,4),S=B(x,4),C=B(S,4),w=B(C,2),T=B(w,2),E=B(T,2),D=B(E,2),ee=B(D,2),O=B(ee,4),te=B(O,4),k=B(te,4),ne=B(k,2),re=B(ne,8),ie=B(re,4),ae=B(ie,4),oe=R(ae),se=R(oe,!0);N(oe),N(ae),N(o);var ce=B(o,2),le=R(ce),ue=R(le),de=R(ue),fe=R(de,!0);N(de);var pe=B(de,2),me=R(pe,!0);N(pe),N(ue),Pe(2),N(le);var he=B(le,2),ge=B(he,2),_e=B(R(ge),10),ve=B(R(_e),8),ye=B(ve,2);N(_e);var be=B(_e,2),xe=R(be),Se=R(xe),Ce=R(Se,!0);N(Se);var we=B(Se,2);N(xe),Pe(2),N(be);var Te=B(be,2),A=R(Te),Ee=B(A,4),De=R(Ee),Oe=B(De,4),ke=B(Oe,4),Ae=B(ke,2),j=B(Ae,4),je=B(j,2),M=B(je,2),Me=B(M,4),Ne=B(Me,2),Fe=B(Ne,2),Ie=B(Fe,4),Le=B(Ie,2),Re=B(Le,2),ze=B(Re,4),Be=R(ze),Ve=B(Be,2),He=B(Ve,2),Ue=B(He,2),We=B(Ue,2);Pe(2),N(ze);var qe=B(ze,2),Je=B(qe,2),Ye=B(Je,4),Xe=B(Ye,2),Ze=B(Xe,2),Qe=B(Ze,4),$e=B(Qe,2),et=B($e,4),tt=B(et,4),nt=B(tt,2),rt=B(nt,4);N(Ee),N(Te);var it=B(Te,2),at=R(it),ot=R(at,!0);N(at);var st=B(at,2),ct=B(R(st),2),lt=R(ct,!0);N(ct),N(st);var ut=B(st,2),dt=R(ut);N(ut);var ft=B(ut,2),pt=B(R(ft),2),mt=R(pt,!0);N(pt),N(ft);var ht=B(ft,4),gt=B(R(ht),2),_t=R(gt,!0);N(gt),N(ht);var vt=B(ht,2),yt=R(vt);N(vt);var bt=B(vt,2),xt=R(bt),St=R(xt,!0);N(xt);var Ct=B(xt,2),wt=R(Ct,!0);N(Ct),Pe(2),N(bt),N(it);var Tt=B(it,2),Et=R(Tt),Dt=B(Et,4),Ot=R(Dt),kt=B(Ot,2),At=B(kt,2),jt=B(At,2),Mt=B(jt,4),Nt=B(Mt,2),Pt=B(Nt,4),Ft=B(Pt,2),It=B(Ft,2),Lt=B(It,4),Rt=B(Lt,2),zt=B(Rt,4),Bt=B(zt,2),P=B(Bt,4),Vt=B(P,2),Ht=B(Vt,2),Ut=B(Ht,2),Wt=B(Ut,2),Gt=B(Wt,4),Kt=B(Gt,2),qt=B(Kt,4),Jt=B(qt,4),Yt=B(Jt,4);N(Dt),N(Tt);var Xt=B(Tt,2),Zt=B(Xt,2),Qt=B(R(Zt),2),$t=R(Qt,!0);N(Qt),N(Zt),N(ge),N(ce);var en=B(ce,4),tn=R(en),L=R(tn),nn=R(L,!0);N(L);var rn=B(L,4),an=R(rn);Pe(2),N(rn);var on=B(rn,2),sn=R(on,!0);N(on);var cn=B(on,2),ln=R(cn),un=R(ln,!0);N(ln);var dn=B(ln,2),fn=R(dn,!0);N(dn),N(cn),N(tn),N(en),N(a),V((e,t,n,i,a,o,s,ae,oe,ce,le,ue,de,pe,ge,_e,be,xe,Se,Te,Ee,N,Pe,ze,Ge,Ke,it,at,st,ct,ut,ft,pt,ht,gt,vt,bt,xt,Ct,Tt,Dt,F,Zt,I,Qt,en,tn,L,rn,on,cn,ln,dn,R,z,B,pn,mn,hn,gn,_n,vn,yn,bn,xn,Sn,Cn,wn,Tn,En,Dn,On,kn,An,jn,Mn,Nn,Pn,V,Fn,In,Ln,Rn,zn,Bn,Vn,Hn,Un,Wn,Gn,Kn,qn,Jn,Yn,Xn,Zn,Qn,$n,er,tr,nr,rr,ir)=>{K(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`,ae),J(g,`title`,oe),J(_,`title`,ce),J(v,`title`,le),J(y,`title`,ue),J(b,`title`,de),J(x,`title`,pe),J(S,`title`,ge),J(C,`title`,_e),J(w,`title`,be),J(T,`title`,xe),J(E,`title`,Se),J(D,`title`,Te),J(ee,`title`,Ee),J(O,`placeholder`,N),J(te,`title`,Pe),J(k,`title`,ze),J(ne,`title`,Ge),J(re,`title`,Ke),J(ie,`title`,it),K(se,at),K(fe,st),K(me,ct),hi(he,1,`w-1 shrink-0 cursor-col-resize select-none transition-colors ${H(r)?`bg-blue-500/60`:`bg-transparent hover:bg-blue-500/40`}`),J(ve,`title`,ut),J(ye,`title`,ft),K(Ce,pt),J(we,`title`,ht),J(A,`title`,gt),J(De,`title`,vt),J(Oe,`title`,bt),J(ke,`title`,xt),J(Ae,`title`,Ct),J(j,`title`,Tt),J(je,`title`,Dt),J(M,`title`,F),J(Me,`title`,Zt),J(Ne,`title`,I),J(Fe,`title`,Qt),J(Ie,`title`,en),J(Le,`title`,tn),J(Re,`title`,L),J(Be,`title`,rn),J(Ve,`title`,on),J(He,`title`,cn),J(Ue,`title`,ln),J(We,`title`,dn),J(qe,`title`,R),J(Je,`title`,z),J(Ye,`title`,B),J(Xe,`title`,pn),J(Ze,`title`,mn),J(Qe,`title`,hn),J($e,`title`,gn),J(et,`title`,_n),J(tt,`title`,vn),J(nt,`title`,yn),J(rt,`title`,bn),K(ot,xn),K(lt,Sn),J(dt,`placeholder`,Cn),K(mt,wn),K(_t,Tn),J(yt,`placeholder`,En),K(St,Dn),K(wt,On),J(Et,`title`,kn),J(Ot,`title`,An),J(kt,`title`,jn),J(At,`title`,Mn),J(jt,`title`,Nn),J(Mt,`title`,Pn),J(Nt,`title`,V),J(Pt,`title`,Fn),J(Ft,`title`,In),J(It,`title`,Ln),J(Lt,`title`,Rn),J(Rt,`title`,zn),J(zt,`title`,Bn),J(Bt,`title`,Vn),J(P,`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,`placeholder`,Qn),K($t,$n),K(nn,er),J(an,`placeholder`,tr),K(sn,nr),K(un,rr),K(fn,ir)},[()=>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`)]),U(`click`,s,()=>history.back()),U(`mousedown`,he,i),G(e,a),Ke()}Nr([`click`,`mousedown`]),He();var Ph={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 Fh(){Ph.isDirty=!0,document.getElementById(`btnSave`).disabled=!1}var Ih=`custom-shape`,Lh=`custom-shape:`,Rh=[{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 zh(e){return typeof e==`string`&&e.startsWith(`custom-shape:`)}function Bh(e){return zh(e)?e.slice(13):null}function Vh(e){return e&&Ph.customShapeDefs&&Ph.customShapeDefs.get(e)||null}function Hh(e){let t=Vh(e);return[t&&t.width||65,t&&t.height||65]}function Uh(e){let t=Vh(e);return t&&Array.isArray(t.anchors)&&t.anchors.length?t.anchors:Rh}function Wh(e){let t=Vh(e);return t&&[`center`,`below`,`above`,`right`,`left`].includes(t.labelPlacement)?t.labelPlacement:`below`}async function Gh(){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:[];Ph.customShapeLibraries=n,Ph.customShapeDefs=new Map,n.forEach(e=>{(e.shapes||[]).forEach(e=>Ph.customShapeDefs.set(e.id,e))})}catch{Ph.customShapeLibraries=[],Ph.customShapeDefs=new Map}}function Kh(){let e=document.getElementById(`customShapeBar`),t=document.getElementById(`customShapeBarBody`);if(!e||!t)return;t.innerHTML=``;let n=(Ph.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:`${Lh}${e.id}`}}))}),t.appendChild(n)})}function qh(){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(Rh)}}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=`
|
|
138
138
|
<input class="field !h-7 text-xs" value="${d(t.id)}">
|
|
139
139
|
<input class="field !h-7 text-xs" type="number" min="0" max="100" step="1" value="${Math.round(t.x*100)}">
|
|
140
140
|
<input class="field !h-7 text-xs" type="number" min="0" max="100" step="1" value="${Math.round(t.y*100)}">
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{a as e,c as t,d as n,f as r,i,l as a,n as o,o as s,p as c,r as l,s as u,t as d,u as f}from"./index-
|
|
1
|
+
import{a as e,c as t,d as n,f as r,i,l as a,n as o,o as s,p as c,r as l,s as u,t as d,u as f}from"./index-B1jXz6oI.js";var p={select:`toolSelect`,"addNode:box":`toolBox`,"addNode:ellipse":`toolEllipse`,"addNode:database":`toolDatabase`,"addNode:circle":`toolCircle`,"addNode:actor":`toolActor`,"addNode:post-it":`toolPostIt`,"addNode:text-free":`toolTextFree`,"addNode:image":`toolImage`,addEdge:`toolArrow`},m={"c-gray":{bg:`#f5f5f4`,border:`#a8a29e`,font:`#292524`,hbg:`#e7e5e4`,hborder:`#78716c`},"c-blue":{bg:`#dbeafe`,border:`#3b82f6`,font:`#1e40af`,hbg:`#bfdbfe`,hborder:`#2563eb`},"c-green":{bg:`#dcfce7`,border:`#22c55e`,font:`#166534`,hbg:`#bbf7d0`,hborder:`#16a34a`},"c-amber":{bg:`#fef9c3`,border:`#f59e0b`,font:`#78350f`,hbg:`#fef08a`,hborder:`#d97706`},"c-rose":{bg:`#ffe4e6`,border:`#f43f5e`,font:`#881337`,hbg:`#fecdd3`,hborder:`#e11d48`},"c-purple":{bg:`#ede9fe`,border:`#8b5cf6`,font:`#4c1d95`,hbg:`#ddd6fe`,hborder:`#7c3aed`},"c-teal":{bg:`#ccfbf1`,border:`#14b8a6`,font:`#134e4a`,hbg:`#99f6e4`,hborder:`#0d9488`},"c-orange":{bg:`#ffedd5`,border:`#f97316`,font:`#7c2d12`,hbg:`#fed7aa`,hborder:`#ea580c`},"c-cyan":{bg:`#cffafe`,border:`#06b6d4`,font:`#164e63`,hbg:`#a5f3fc`,hborder:`#0891b2`},"c-indigo":{bg:`#e0e7ff`,border:`#6366f1`,font:`#312e81`,hbg:`#c7d2fe`,hborder:`#4f46e5`},"c-pink":{bg:`#fce7f3`,border:`#ec4899`,font:`#831843`,hbg:`#fbcfe8`,hborder:`#db2777`},"c-lime":{bg:`#ecfccb`,border:`#84cc16`,font:`#365314`,hbg:`#d9f99d`,hborder:`#65a30d`},"c-red":{bg:`#fee2e2`,border:`#ef4444`,font:`#7f1d1d`,hbg:`#fecaca`,hborder:`#dc2626`},"c-sky":{bg:`#e0f2fe`,border:`#0ea5e9`,font:`#0c4a6e`,hbg:`#bae6fd`,hborder:`#0284c7`},"c-slate":{bg:`#f1f5f9`,border:`#64748b`,font:`#0f172a`,hbg:`#e2e8f0`,hborder:`#475569`}},h=[`c-gray`,`c-slate`,`c-blue`,`c-sky`,`c-cyan`,`c-teal`,`c-green`,`c-lime`,`c-amber`,`c-orange`,`c-red`,`c-rose`,`c-pink`,`c-purple`,`c-indigo`],g=[`#a8a29e`,`#374151`,`#3b82f6`,`#14b8a6`,`#22c55e`,`#f97316`,`#ef4444`,`#a855f7`],_={"c-gray":.667,"c-slate":.488,"c-blue":.645,"c-sky":.518,"c-cyan":.473,"c-teal":.448,"c-green":.489,"c-lime":.496,"c-amber":.57,"c-orange":.578,"c-red":.64,"c-rose":.636,"c-pink":.638,"c-purple":.694,"c-indigo":.71};function v(e,t=.6){let n=parseInt(e.slice(1,3),16)/255,r=parseInt(e.slice(3,5),16)/255,i=parseInt(e.slice(5,7),16)/255,a=Math.max(n,r,i),o=Math.min(n,r,i),s=(a+o)/2,c=a-o,l=0,u=0;c>0&&(u=s>.5?c/(2-a-o):c/(a+o),l=a===n?((r-i)/c+(r<i?6:0))/6:a===r?((i-n)/c+2)/6:((n-r)/c+4)/6);function d(e,t,n){let r,i,a;if(t===0)r=i=a=n;else{let o=(e,t,n)=>(n<0&&(n+=1),n>1&&--n,n<1/6?e+(t-e)*6*n:n<1/2?t:n<2/3?e+(t-e)*(2/3-n)*6:e),s=n<.5?n*(1+t):n+t-n*t,c=2*n-s;r=o(c,s,e+1/3),i=o(c,s,e),a=o(c,s,e-1/3)}return`#`+[r,i,a].map(e=>Math.max(0,Math.min(255,Math.round(e*255))).toString(16).padStart(2,`0`)).join(``)}let f=s*t,p=s*.93,m=f*.89;return{bg:e,border:d(l,u,f),font:s>.5?`#292524`:`#fafaf9`,hbg:d(l,u,Math.min(s,p)),hborder:d(l,u,Math.min(f,m))}}function y(e){return n.nodeColorOverrides[e]||m[e]||m[`c-gray`]}function b(e,t){return typeof e!=`string`||e.charAt(0)!==`#`||e.length!==7?e:`rgba(${parseInt(e.slice(1,3),16)},${parseInt(e.slice(3,5),16)},${parseInt(e.slice(5,7),16)},${t})`}function x(e,t,r,i){let a=n.nodes&&n.nodes.get(t);if(!a||!a.nodeLink)return;let o=r/2-7,s=i/2-7;e.save(),e.fillStyle=a.nodeLink.type===`url`?`#3b82f6`:`#f97316`,e.strokeStyle=`#fff`,e.lineWidth=1,e.beginPath(),e.arc(o,s,7,0,Math.PI*2),e.fill(),e.stroke(),e.strokeStyle=`#fff`,e.lineWidth=1.2,e.lineCap=`round`,e.beginPath(),e.moveTo(o-1.5,s+1.5),e.lineTo(o+1.5,s-1.5),e.moveTo(o-2.5,s-.5),e.lineTo(o-.5,s-2.5),e.moveTo(o+.5,s+2.5),e.lineTo(o+2.5,s+.5),e.stroke(),e.restore()}function S(e,t,n){if(!t)return[``];let r=t.split(` `),i=[],a=``;for(let t of r){let r=a?a+` `+t:t;a&&e.measureText(r).width>n?(i.push(a),a=t):a=r}return a&&i.push(a),i.length?i:[``]}function C(e,t,n,r,i,a,o,s,c){if(!t)return;e.save(),e.font=`${n}px system-ui,-apple-system,sans-serif`,e.fillStyle=r,e.textBaseline=`middle`;let l=0;i===`left`?(e.textAlign=`left`,l=o?-o/2+8:-40):i===`right`?(e.textAlign=`right`,l=o?o/2-8:40):(e.textAlign=`center`,l=0);let u=o?o-16:1/0,d=String(t).split(`
|
|
2
2
|
`).flatMap(t=>S(e,t,u)),f=n*1.3,p;p=o&&s?a===`top`?-(s/2-n/2-8):a===`bottom`?s/2-n/2-8-(d.length-1)*f:-((d.length-1)*f)/2:-((d.length-1)*f)/2,c&&e.rotate(c),d.forEach((t,n)=>e.fillText(t,l,p+n*f)),e.restore()}function w(e,t,n,r,i,a){a=Math.min(a,r/2,i/2),e.beginPath(),e.moveTo(t+a,n),e.lineTo(t+r-a,n),e.quadraticCurveTo(t+r,n,t+r,n+a),e.lineTo(t+r,n+i-a),e.quadraticCurveTo(t+r,n+i,t+r-a,n+i),e.lineTo(t+a,n+i),e.quadraticCurveTo(t,n+i,t,n+i-a),e.lineTo(t,n+a),e.quadraticCurveTo(t,n,t+a,n),e.closePath()}function T(e,t,r,i){let a=n.nodes&&n.nodes.get(e),o=a&&a.colorKey||i||`c-gray`,s=a&&a.bgOpacity,c=typeof s==`number`?Math.max(0,Math.min(1,s)):1,l=y(o),u=c<1?{...l,bg:b(l.bg,c),hbg:b(l.hbg,c)}:l;return{W:a&&a.nodeWidth||t,H:a&&a.nodeHeight||r,rotation:a&&a.rotation||0,labelRotation:a&&a.labelRotation||0,textAlign:a&&a.textAlign||`center`,textValign:a&&a.textValign||`middle`,fontSize:a&&a.fontSize||13,bgOpacity:c,colorKey:o,c:u}}function ee(e){return e?String(e).split(`
|
|
3
3
|
`):[]}function E(e){return[`center`,`below`,`above`,`right`,`left`].includes(e)?e:null}function te(e){return[`above`,`below`,`right`,`left`].includes(e)}function D(e,t,n){let r=`${t}px system-ui,-apple-system,sans-serif`;if(n){let t=n.font;n.font=r;let i=n.measureText(e).width;return n.font=t,i}return typeof document>`u`?String(e).length*t*.58:(D._ctx||=document.createElement(`canvas`).getContext(`2d`),D._ctx.font=r,D._ctx.measureText(e).width)}function ne(t,n,r){let i=e(t&&t.customShapeId),a=t&&t.nodeWidth||i&&i.width||65,o=t&&t.nodeHeight||i&&i.height||65,s=E(t&&t.labelPlacement)||E(i&&i.labelPlacement)||`below`,c=t&&t.fontSize||13,l=ee(n),u=c*1.3;if(!l.length||!te(s))return{placement:s,lines:l,lineH:u,imageOffsetX:0,imageOffsetY:0,labelBlockW:0,labelBlockH:0,totalW:a,totalH:o};let d=Math.max(...l.map(e=>D(e,c,r)))+16,f=l.length*u+8,p=s===`left`||s===`right`,m=p?a+d:Math.max(a,d),h=p?Math.max(o,f):o+f;return{placement:s,lines:l,lineH:u,imageOffsetX:s===`right`?-d/2:s===`left`?d/2:0,imageOffsetY:s===`below`?-f/2:s===`above`?f/2:0,labelBlockW:d,labelBlockH:f,totalW:m,totalH:h}}function re(e){return function({ctx:t,x:n,y:r,id:i,state:a,label:o}){let{W:s,H:c,rotation:l,labelRotation:u,textAlign:d,textValign:f,fontSize:p,c:m}=T(i,100,40,e);return{drawNode(){t.save(),t.translate(n,r),t.rotate(l),t.strokeStyle=a.selected?`#f97316`:m.border,t.fillStyle=a.selected?m.hbg:m.bg,t.lineWidth=1.5,w(t,-s/2,-c/2,s,c,4),t.fill(),t.stroke(),C(t,o,p,m.font,d,f,s,c,u),x(t,i,s,c),t.restore()},nodeDimensions:{width:s,height:c}}}}function ie(e){return function({ctx:t,x:n,y:r,id:i,state:a,label:o}){let{W:s,H:c,rotation:l,labelRotation:u,textAlign:d,textValign:f,fontSize:p,c:m}=T(i,110,50,e);return{drawNode(){t.save(),t.translate(n,r),t.rotate(l),t.strokeStyle=a.selected?`#f97316`:m.border,t.fillStyle=a.selected?m.hbg:m.bg,t.lineWidth=1.5,t.beginPath(),t.ellipse(0,0,s/2,c/2,0,0,Math.PI*2),t.fill(),t.stroke(),C(t,o,p,m.font,d,f,s,c,u),x(t,i,s,c),t.restore()},nodeDimensions:{width:s,height:c}}}}function ae(e){return function({ctx:t,x:n,y:r,id:i,state:a,label:o}){let{W:s,rotation:c,labelRotation:l,textAlign:u,textValign:d,fontSize:f,c:p}=T(i,55,55,e),m=s/2;return{drawNode(){t.save(),t.translate(n,r),t.rotate(c),t.strokeStyle=a.selected?`#f97316`:p.border,t.fillStyle=a.selected?p.hbg:p.bg,t.lineWidth=1.5,t.beginPath(),t.arc(0,0,m,0,Math.PI*2),t.fill(),t.stroke(),C(t,o,f,p.font,u,d,s,s,l),x(t,i,s,s),t.restore()},nodeDimensions:{width:s,height:s}}}}function oe(e){return function({ctx:t,x:n,y:r,id:i,state:a,label:o}){let{W:s,H:c,rotation:l,labelRotation:u,textAlign:d,textValign:f,fontSize:p,c:m}=T(i,50,70,e),h=s/2,g=Math.max(c*.12,6),_=-c/2+g,v=c/2-g;return{drawNode(){t.save(),t.translate(n,r),t.rotate(l),t.strokeStyle=a.selected?`#f97316`:m.border,t.fillStyle=a.selected?m.hbg:m.bg,t.lineWidth=1.5,t.fillRect(-h,_,s,v-_),t.beginPath(),t.ellipse(0,v,h,g,0,0,Math.PI*2),t.fill(),t.stroke(),t.beginPath(),t.moveTo(-h,_),t.lineTo(-h,v),t.moveTo(h,_),t.lineTo(h,v),t.stroke(),t.beginPath(),t.ellipse(0,_,h,g,0,0,Math.PI*2),t.fill(),t.stroke(),C(t,o,p,m.font,d,f,s,c,u),x(t,i,s,c),t.restore()},nodeDimensions:{width:s,height:c}}}}function se(e){return function({ctx:t,x:n,y:r,id:i,state:a,label:o}){let{W:s,H:c,rotation:l,labelRotation:u,textAlign:d,textValign:f,fontSize:p,c:m}=T(i,120,100,e||`c-amber`),h=Math.min(s,c)*.18;return{drawNode(){t.save(),t.translate(n,r),t.rotate(l),t.strokeStyle=a.selected?`#f97316`:m.border,t.fillStyle=a.selected?m.hbg:m.bg,t.lineWidth=1.5,t.beginPath(),t.moveTo(-s/2,-c/2),t.lineTo(s/2-h,-c/2),t.lineTo(s/2,-c/2+h),t.lineTo(s/2,c/2),t.lineTo(-s/2,c/2),t.closePath(),t.fill(),t.stroke(),t.globalAlpha=.3,t.fillStyle=m.border,t.beginPath(),t.moveTo(s/2-h,-c/2),t.lineTo(s/2,-c/2+h),t.lineTo(s/2-h,-c/2+h),t.closePath(),t.fill(),t.globalAlpha=1,t.beginPath(),t.moveTo(s/2-h,-c/2),t.lineTo(s/2-h,-c/2+h),t.lineTo(s/2,-c/2+h),t.stroke(),C(t,o,p,m.font,d,f,s,c,u),x(t,i,s,c),t.restore()},nodeDimensions:{width:s,height:c}}}}function ce(e){return function({ctx:t,x:n,y:r,id:i,state:a,label:o}){let{W:s,H:c,rotation:l,labelRotation:u,textAlign:d,textValign:f,fontSize:p,c:m}=T(i,80,30,e);return{drawNode(){t.save(),t.translate(n,r),t.rotate(l),(a.selected||a.hover)&&(t.strokeStyle=`#f97316`,t.lineWidth=1,t.setLineDash([4,3]),w(t,-s/2,-c/2,s,c,3),t.stroke(),t.setLineDash([])),C(t,o,p,m.font,d,f,s,c,u),x(t,i,s,c),t.restore()},nodeDimensions:{width:s,height:c}}}}var le=30,ue=52;function de(e){return function({ctx:t,x:n,y:r,id:i,state:a,label:o}){let{W:s,H:c,rotation:l,labelRotation:u,fontSize:d,c:f}=T(i,le,ue,e),p=s/le,m=c/ue;return{drawNode(){if(t.save(),t.translate(n,r),t.rotate(l),t.strokeStyle=a.selected?`#f97316`:f.border,t.fillStyle=a.selected?f.hbg:f.bg,t.lineWidth=2,t.lineCap=`round`,t.beginPath(),t.arc(0,-20*m,8*m,0,Math.PI*2),t.fill(),t.stroke(),t.beginPath(),t.moveTo(0,-12*m),t.lineTo(0,8*m),t.stroke(),t.beginPath(),t.moveTo(-13*p,0*m),t.lineTo(13*p,0*m),t.stroke(),t.beginPath(),t.moveTo(0,8*m),t.lineTo(-10*p,24*m),t.stroke(),t.beginPath(),t.moveTo(0,8*m),t.lineTo(10*p,24*m),t.stroke(),o){t.save(),u&&t.rotate(u),t.font=`${d}px system-ui,-apple-system,sans-serif`,t.fillStyle=f.font,t.textAlign=`center`,t.textBaseline=`top`;let e=String(o).split(`
|
|
4
4
|
`),n=d*1.3,r=24*m+4;e.forEach((e,i)=>t.fillText(e,0,r+i*n)),t.restore()}x(t,i,s,c),t.restore()},nodeDimensions:{width:s,height:c}}}}var fe=new Map;function pe(e,t){if(!e)return null;let n=fe.get(e);if(n===`loading`||n===`error`)return null;if(n)return n;fe.set(e,`loading`);let r=new Image;return r.onload=()=>{fe.set(e,r),t&&t()},r.onerror=()=>{fe.set(e,`error`)},r.src=e,null}function me(e){return function({ctx:t,x:r,y:i,id:a,state:o,label:s}){let{W:c,H:l,rotation:u,labelRotation:d,textAlign:f,textValign:p,fontSize:m,c:h}=T(a,160,120,e||`c-gray`),g=n.nodes&&n.nodes.get(a),_=g&&g.imageSrc,v=pe(_,()=>n.network&&n.network.redraw());return{drawNode(){if(t.save(),t.translate(r,i),t.rotate(u),t.strokeStyle=o.selected?`#f97316`:h.border,t.lineWidth=o.selected?2:1,w(t,-c/2,-l/2,c,l,4),t.stroke(),v?(t.save(),w(t,-c/2,-l/2,c,l,4),t.clip(),t.drawImage(v,-c/2,-l/2,c,l),t.restore()):(t.fillStyle=o.selected?h.hbg:h.bg,w(t,-c/2,-l/2,c,l,4),t.fill(),t.fillStyle=h.border,t.font=`${Math.round(Math.min(c,l)*.25)}px system-ui`,t.textAlign=`center`,t.textBaseline=`middle`,t.fillText(_?`…`:`🖼`,0,0)),s){let e=String(s).split(`
|
|
@@ -15,7 +15,7 @@
|
|
|
15
15
|
<link id="hljs-light" rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/github.min.css" disabled />
|
|
16
16
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
|
|
17
17
|
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlightjs-line-numbers.js/2.8.0/highlightjs-line-numbers.min.js"></script>
|
|
18
|
-
<script type="module" crossorigin src="/assets/index-
|
|
18
|
+
<script type="module" crossorigin src="/assets/index-B1jXz6oI.js"></script>
|
|
19
19
|
<link rel="stylesheet" crossorigin href="/assets/index-DemWpj2z.css">
|
|
20
20
|
</head>
|
|
21
21
|
<body>
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "living-ai-documentation",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.6.0",
|
|
4
4
|
"description": "Local Markdown documentation hub with a built-in MCP server — coding agents create ADRs, draw diagrams and detect drift while you code.",
|
|
5
5
|
"main": "dist/src/server.js",
|
|
6
6
|
"bin": {
|