living-ai-documentation 3.4.0 → 3.5.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.
@@ -7,10 +7,10 @@ import e from"https://cdn.jsdelivr.net/npm/mermaid@11/dist/mermaid.esm.min.mjs";
7
7
  `)}function T(e){if(typeof e==`string`)return e;if(!e||typeof e!=`object`)return String(e??``);if(e.error)return JSON.stringify(e.error,null,2);let t=e.result;return t?.isError?(Array.isArray(t.content)?t.content.map(e=>e&&e.type===`text`&&typeof e.text==`string`?e.text:JSON.stringify(e,null,2)).filter(Boolean):[]).join(`
8
8
 
9
9
  `)||JSON.stringify(t,null,2):JSON.stringify(e,null,2)}async function E(e,t,n){let r=await fetch(`/api/context/mcp-result`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({name:e,content:t,kind:n})});if(!r.ok)throw Error(await r.text()||`HTTP ${r.status}`);return r.json()}function D(e){let t=encodeURIComponent(String(e||``).replace(/\.md$/i,``));return`/?doc=`+encodeURIComponent(t)}async function ee(e,t){let n=d(e,t),r={};try{r=n.argsJson.trim()?JSON.parse(n.argsJson):{}}catch{f(e,t,{error:Y(`context.mcp_invalid_json`)});return}f(e,t,{running:!0,error:``,resultHtml:`<span class="mcp-running">${Y(`context.mcp_running`)}</span>`});try{await v();let n=e===`tool`?await _(2,`tools/call`,{name:t,arguments:r}):await _(2,`prompts/get`,{name:t,arguments:r});if(n.error||n.result?.isError){let r=T(n);f(e,t,{running:!1,error:Y(`context.mcp_error`),resultHtml:r?`<pre class="mcp-error-pre">${te(r)}</pre>`:``});return}let i=e===`tool`?H(o).find(e=>e.name===t):null,{path:a}=await E(t,e===`tool`&&i?w(i,r,n):x(n),e),s=D(a);f(e,t,{running:!1,error:``,resultHtml:`<div class="mcp-saved-label">${te(Y(`context.mcp_saved_to`))}</div>
10
- <a href="${te(s)}" target="_blank" rel="noopener" class="mcp-saved-link">📄 ${te(a)}</a>`})}catch(n){f(e,t,{running:!1,error:n.message||String(n),resultHtml:``})}}async function O(e){let n=H(e===`tool`?o:s);if(!n.length)return;I(c,!0);let r=n.length;try{for(let i=0;i<n.length;i++)t.onStatus(Y(`context.mcp_running_all`).replace(`{current}`,String(i+1)).replace(`{total}`,String(r))),await ee(e,n[i].name);t.onStatus(Y(`context.mcp_done_all`).replace(`{total}`,String(r)))}finally{I(c,!1)}}function te(e){return String(e??``).replace(/[&<>"']/g,e=>({"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`})[e])}async function k(){try{let e=await fetch(`/mcp`);if(!e.ok)throw Error(await e.text());let t=await e.json(),c=Array.isArray(t.tools)?t.tools:[],l=Array.isArray(t.prompts)?t.prompts:[];I(n,Y(`context.mcp_available`),!0),I(r,!0),I(i,t.transport||`-`,!0),I(a,t.endpoint||`POST /mcp`,!0),I(o,c,!0),I(s,l,!0),c.forEach(m),l.forEach(h)}catch{I(n,Y(`context.mcp_unavailable`),!0),I(r,!1),I(i,`-`),I(a,`/mcp`),I(o,[],!0),I(s,[],!0)}}var ne={load:k},re=du(),ie=R(re),ae=R(ie),oe=R(ae,!0);N(ae);var se=B(ae,2),ce=R(se,!0);N(se),N(ie);var le=B(ie,2),ue=R(le,!0);N(le);var de=B(le,2),fe=R(de),pe=R(fe),me=R(pe,!0);N(pe);var he=B(pe,2),ge=R(he,!0);N(he),N(fe);var _e=B(fe,2),ve=R(_e),ye=R(ve,!0);N(ve);var be=B(ve,2),xe=R(be,!0);N(be),N(_e);var Se=B(_e,2),Ce=R(Se),we=R(Ce,!0);N(Ce);var Te=B(Ce,2),A=R(Te,!0);N(Te),N(Se),N(de);var Ee=B(de,2),De=R(Ee),Oe=R(De),ke=R(Oe,!0);N(Oe);var Ae=B(Oe,2),j=R(Ae),je=R(j,!0);N(j);var M=B(j,2),Me=R(M,!0);N(M),N(Ae),N(De);var Ne=B(De,2),Pe=R(Ne),Fe=e=>{var t=ru(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`context.mcp_no_tools`)]),G(e,t)},Ie=e=>{var t=Ur();$r(z(t),17,()=>H(o),Yr,(e,t)=>{let n=P(()=>H(l).get(H(t).name)??{argsJson:`{}`,running:!1,error:``,resultHtml:``});var r=su(),i=R(r),a=R(i,!0);N(i);var o=B(i,2),s=e=>{var n=iu(),r=R(n,!0);N(n),V(()=>K(r,H(t).description)),G(e,n)};q(o,e=>{H(t).description&&e(s)});var c=B(o,2),u=e=>{var n=au(),r=R(n),i=R(r,!0);N(r);var a=B(r,2),o=R(a,!0);N(a),N(n),V((e,t)=>{K(i,e),K(o,t)},[()=>Y(`context.mcp_input_schema`),()=>JSON.stringify(H(t).inputSchema,null,2)]),G(e,n)};q(c,e=>{H(t).inputSchema&&e(u)});var d=B(c,2),p=R(d),m=R(p,!0);N(p);var h=B(p,2);vn(h);var g=B(h,2),_=R(g),v=R(_,!0);N(_);var y=B(_,2),b=R(y,!0);N(y),N(g);var x=B(g,2),S=e=>{var t=ou();ai(t,()=>H(n).resultHtml,!0),N(t),G(e,t)};q(x,e=>{H(n).resultHtml&&e(S)}),N(d),N(r),V((e,r)=>{K(a,H(t).name),K(m,e),Di(h,H(n).argsJson),K(v,H(n).error),y.disabled=H(n).running,K(b,r)},[()=>Y(`context.mcp_request_json`),()=>Y(`context.mcp_run_tool`)]),U(`input`,h,e=>f(`tool`,H(t).name,{argsJson:e.target.value})),U(`click`,y,()=>ee(`tool`,H(t).name)),G(e,r)}),G(e,t)};q(Pe,e=>{H(o).length?e(Ie,-1):e(Fe)}),N(Ne),N(Ee);var Le=B(Ee,2),Re=R(Le),ze=R(Re),Be=R(ze,!0);N(ze);var Ve=B(ze,2),He=R(Ve),Ue=R(He,!0);N(He);var We=B(He,2),qe=R(We,!0);N(We),N(Ve),N(Re);var Je=B(Re,2),Ye=R(Je),Xe=e=>{var t=ru(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`context.mcp_no_prompts`)]),G(e,t)},Ze=e=>{var t=Ur();$r(z(t),17,()=>H(s),Yr,(e,t)=>{let n=P(()=>H(u).get(H(t).name)??{argsJson:`{}`,running:!1,error:``,resultHtml:``});var r=su(),i=R(r),a=R(i,!0);N(i);var o=B(i,2),s=e=>{var n=iu(),r=R(n,!0);N(n),V(()=>K(r,H(t).description)),G(e,n)};q(o,e=>{H(t).description&&e(s)});var c=B(o,2),l=e=>{var n=uu(),r=R(n),i=R(r,!0);N(r);var a=B(r,2);$r(a,21,()=>H(t).arguments,Yr,(e,t)=>{var n=lu(),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=e=>{var n=cu(),r=R(n,!0);N(n),V(()=>K(r,H(t).description)),G(e,n)};q(c,e=>{H(t).description&&e(l)}),N(n),V(e=>{K(a,H(t).name),K(s,e)},[()=>H(t).required?Y(`context.mcp_required`):Y(`context.mcp_optional`)]),G(e,n)}),N(a),N(n),V(e=>K(i,e),[()=>Y(`context.mcp_arguments`)]),G(e,n)};q(c,e=>{H(t).arguments?.length&&e(l)});var d=B(c,2),p=R(d),m=R(p,!0);N(p);var h=B(p,2);vn(h);var g=B(h,2),_=R(g),v=R(_,!0);N(_);var y=B(_,2),b=R(y,!0);N(y),N(g);var x=B(g,2),S=e=>{var t=ou();ai(t,()=>H(n).resultHtml,!0),N(t),G(e,t)};q(x,e=>{H(n).resultHtml&&e(S)}),N(d),N(r),V((e,r)=>{K(a,H(t).name),K(m,e),Di(h,H(n).argsJson),K(v,H(n).error),y.disabled=H(n).running,K(b,r)},[()=>Y(`context.mcp_request_json`),()=>Y(`context.mcp_get_prompt`)]),U(`input`,h,e=>f(`prompt`,H(t).name,{argsJson:e.target.value})),U(`click`,y,()=>ee(`prompt`,H(t).name)),G(e,r)}),G(e,t)};return q(Ye,e=>{H(s).length?e(Ze,-1):e(Xe)}),N(Je),N(Le),N(re),V((e,t,l,u,d,f,p,m,h,g)=>{K(oe,e),K(ce,t),K(ue,l),K(me,u),hi(he,1,li(H(r)?`mcp-info-value ok`:`mcp-info-value err`),`svelte-1ui2b6s`),K(ge,H(n)),K(ye,d),K(xe,H(i)),K(we,f),K(A,H(a)),K(ke,p),K(je,H(o).length),M.disabled=H(c)||!H(o).length,K(Me,m),K(Be,h),K(Ue,H(s).length),We.disabled=H(c)||!H(s).length,K(qe,g)},[()=>Y(`context.mcp_title`),()=>Y(`context.mcp_refresh`),()=>Y(`context.mcp_intro`),()=>Y(`context.mcp_status`),()=>Y(`context.mcp_transport`),()=>Y(`context.mcp_endpoint`),()=>Y(`context.mcp_tools`),()=>Y(`context.mcp_run_all_tools`),()=>Y(`context.mcp_prompts`),()=>Y(`context.mcp_get_all_prompts`)]),U(`click`,se,k),U(`click`,M,()=>O(`tool`)),U(`click`,We,()=>O(`prompt`)),G(e,re),Ke(ne)}Nr([`click`,`input`]);var pu=W(`<p class="status-text svelte-rpj1e5"> </p>`),mu=W(`<div class="app-shell"><!> <main class="context-scroll svelte-rpj1e5"><div class="context-inner svelte-rpj1e5"><section class="page-intro svelte-rpj1e5"><h2 class="page-title svelte-rpj1e5"> </h2> <p class="page-desc svelte-rpj1e5"> </p> <!></section> <!> <!> <!></div></main></div> <!>`,1);function hu(e,t){Ge(t,!0);let n=F(``),r=F(L([])),i=F(L([])),a=F(``),o=F(null),s=F(null),c=F(null);function l(e){I(n,e,!0)}async function u(){l(Y(`context.loading`));let e=await fetch(`/api/context/orientation`);if(!e.ok)throw Error(await e.text());let t=await e.json();I(o,t,!0),I(r,t.instructions||[],!0),I(i,t.rules||[],!0),I(a,t.rulesFolder||``,!0),l(``)}async function d(e){l(Y(`context.adding_instruction_file`));let t=await fetch(`/api/context/instructions`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})});if(!t.ok)throw Error(await t.text());await u()}async function f(e){if(!await H(s).show({kicker:Y(`context.remove_instruction_title`),title:Y(`context.remove_instruction_title`),message:Y(`context.remove_instruction_message`).replace(`{name}`,e),confirmLabel:Y(`common.remove`),cancelLabel:Y(`common.cancel`)||`Cancel`,danger:!0}))return;l(Y(`context.removing_instruction_file`));let t=await fetch(`/api/context/instructions/`+encodeURIComponent(e),{method:`DELETE`});if(!t.ok)throw Error(await t.text());await u()}async function p(e){l(Y(`context.saving_rule`));let t=await fetch(`/api/context/rules`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());await u()}Vi(async()=>{try{let e=await fetch(`/api/config`);await fa((e.ok?await e.json():{}).language||`en`)}catch{await fa(`en`)}document.title=Y(`context.title`),await u().catch(e=>l(e.message)),await H(c).load().catch(()=>{})});var m=mu(),h=z(m),g=R(h);ua(g,{get navigate(){return t.navigate}});var _=B(g,2),v=R(_),y=R(v),b=R(y),x=R(b,!0);N(b);var S=B(b,2),C=R(S,!0);N(S);var w=B(S,2),T=e=>{var t=pu(),r=R(t,!0);N(t),V(()=>K(r,H(n))),G(e,t)};q(w,e=>{H(n)&&e(T)}),N(y);var E=B(y,2);Jl(E,{onAdd:d,onRemove:f,get items(){return H(r)},set items(e){I(r,e,!0)}});var D=B(E,2);nu(D,{get rules(){return H(i)},get rulesFolder(){return H(a)},onAdd:p}),Li(fu(B(D,2),{onStatus:l}),e=>I(c,e,!0),()=>H(c)),N(v),N(_),N(h),Li(Dl(B(h,2),{}),e=>I(s,e,!0),()=>H(s)),V((e,t)=>{K(x,e),K(C,t)},[()=>Y(`context.orientation_title`),()=>Y(`context.orientation_intro`)]),G(e,m),Ke()}var gu=W(`<p class="agents-msg svelte-lf8l46"> </p>`),_u=W(`<p class="agents-msg agents-msg--error svelte-lf8l46"> </p>`),vu=W(`<p class="agents-msg agents-msg--empty svelte-lf8l46"> </p>`),yu=W(`<button type="button"><span class="agent-name svelte-lf8l46"> </span> <span class="agent-provider svelte-lf8l46"> </span> <span> </span></button>`),bu=W(`<div class="agents-grid svelte-lf8l46"></div>`),xu=W(`<div class="confirm-overlay"><section class="confirm-dialog agent-input-dialog svelte-lf8l46" role="dialog" aria-modal="true"><h2> </h2> <p class="confirm-message"> </p> <div class="field-group" style="margin-top:1rem"><label class="field-label" for="agent-input"> </label> <textarea id="agent-input" class="field-input"></textarea></div> <footer class="confirm-actions"><button class="secondary-button" type="button"> </button> <button class="btn-primary" type="button"> </button></footer></section></div>`),Su=W(`<a class="agent-toast-link svelte-lf8l46"> </a>`),Cu=W(`<div><span class="agent-toast-icon svelte-lf8l46"><!></span> <div class="agent-toast-body svelte-lf8l46"><p class="agent-toast-title svelte-lf8l46"> </p> <p class="agent-toast-message svelte-lf8l46"> </p> <!></div> <button class="agent-toast-close svelte-lf8l46" type="button">×</button></div>`),wu=W(`<div class="app-shell"><!> <div class="agents-page svelte-lf8l46"><!> <!> <!></div></div>`);function Tu(e,t){Ge(t,!0);let n=F(L([])),r=F(!0),i=F(``),a=F(null),o=F(``),s=F(`idle`),c=F(``),l=F(``),u=F(null);function d(e){let t=e.provider;return!t||t.kind!==`llm`||!t.config?.model||!e.config?.systemPrompt||e.config?.requiresUserInput&&!e.config?.userInputDescription?.trim()?`not_ready`:e.config?.requiresUserInput?`requires_input`:`ready`}function f(e){return d(e)===`not_ready`}async function p(){I(r,!0),I(i,``);try{let e=await fetch(`/api/workspace`,{headers:{Accept:`application/json`}});if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json(),r=Array.isArray(t.entities)?t.entities:[],i=new Map(r.map(e=>[e.id,e]));I(n,r.filter(e=>e.kind===`agent`).map(e=>({...e,provider:i.get(e.parentId??``)})),!0)}catch(e){I(i,e instanceof Error?e.message:Y(`agents.load_failed`),!0)}finally{I(r,!1)}}function m(e){f(e)||(e.config?.requiresUserInput?(I(a,e,!0),I(o,``)):_(e.id,``))}function h(){I(a,null),I(o,``)}async function g(){if(!H(a))return;let e=H(a).id;I(a,null),await _(e,H(o))}async function _(e,t){let r=H(n).find(t=>t.id===e);I(u,null),I(s,`loading`),I(c,Y(`agents.loading`),!0),I(l,r?.label??``,!0);try{let n=await fetch(`/api/workspace/run-agent-document`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({agentId:e,userInput:t})}),r=await n.json();r.document?.id&&I(u,r.document.id,!0),n.ok&&r.ok?(I(s,`success`),I(c,Y(`agents.success`),!0),I(l,r.document?.filename??``,!0)):(I(s,`error`),I(c,Y(`agents.failure`),!0),I(l,r.error??Y(`agents.run_failed`),!0))}catch(e){I(s,`error`),I(c,Y(`agents.failure`),!0),I(l,e instanceof Error?e.message:Y(`agents.run_failed`),!0)}}Vi(async()=>{try{await fa((await fetch(`/api/config`).then(e=>e.json())).language||`en`)}catch{}await p()});var v=wu(),y=R(v);{let e=P(()=>Y(`agents.title`)),t=P(()=>Y(`agents.subtitle`));ua(y,{get title(){return H(e)},get subtitle(){return H(t)}})}var b=B(y,2),x=R(b),S=e=>{var t=gu(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.loading`)]),G(e,t)},C=e=>{var t=_u(),n=R(t,!0);N(t),V(()=>K(n,H(i))),G(e,t)},w=e=>{var t=vu(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`agents.empty`)]),G(e,t)},T=e=>{var t=bu();$r(t,21,()=>H(n),Yr,(e,t)=>{let n=P(()=>d(H(t))),r=P(()=>f(H(t)));var i=yu();let a;var o=R(i),s=R(o,!0);N(o);var c=B(o,2),l=R(c,!0);N(c);var u=B(c,2),p=R(u,!0);N(u),N(i),V((e,o)=>{a=hi(i,1,`agent-card svelte-lf8l46`,null,a,{"agent-card--disabled":H(r)}),i.disabled=H(r),K(s,H(t).label),K(l,e),hi(u,1,`agent-badge agent-badge--${H(n)??``}`,`svelte-lf8l46`),K(p,o)},[()=>H(t).provider?.label??Y(`agents.no_provider`),()=>Y(`agents.${H(n)}`)]),U(`click`,i,()=>m(H(t))),G(e,i)}),N(t),G(e,t)};q(x,e=>{H(r)?e(S):H(i)?e(C,1):H(n).length===0?e(w,2):e(T,-1)});var E=B(x,2),D=e=>{var t=xu(),n=R(t),r=R(n),i=R(r,!0);N(r);var s=B(r,2),c=R(s,!0);N(s);var l=B(s,2),u=R(l),d=R(u,!0);N(u);var f=B(u,2);vn(f),J(f,`rows`,4),N(l);var p=B(l,2),m=R(p),_=R(m,!0);N(m);var v=B(m,2),y=R(v,!0);N(v),N(p),N(n),N(t),V((e,t,n,r,o,s)=>{K(i,H(a).label),K(c,e),K(d,t),J(f,`placeholder`,n),K(_,r),v.disabled=o,K(y,s)},[()=>H(a).config?.userInputDescription?.trim()||Y(`agents.input_hint`),()=>Y(`agents.input_title`),()=>Y(`agents.input_hint`),()=>Y(`common.cancel`),()=>!H(o).trim(),()=>Y(`agents.run`)]),U(`click`,t,e=>{e.target===e.currentTarget&&h()}),Mi(f,()=>H(o),e=>I(o,e)),U(`click`,m,h),U(`click`,v,g),G(e,t)};q(E,e=>{H(a)&&e(D)});var ee=B(E,2),O=e=>{var t=Cu(),n=R(t),r=R(n),i=e=>{G(e,Hr(`⟳`))},a=e=>{G(e,Hr(`✓`))},o=e=>{G(e,Hr(`!`))};q(r,e=>{H(s)===`loading`?e(i):H(s)===`success`?e(a,1):e(o,-1)}),N(n);var d=B(n,2),f=R(d),p=R(f,!0);N(f);var m=B(f,2),h=R(m,!0);N(m);var g=B(m,2),_=e=>{var t=Su(),n=R(t,!0);N(t),V((e,r)=>{J(t,`href`,`/?doc=${e??``}`),K(n,r)},[()=>encodeURIComponent(H(u)),()=>Y(`agents.open_document`)]),G(e,t)};q(g,e=>{H(u)&&e(_)}),N(d);var v=B(d,2);N(t),V(()=>{hi(t,1,`agent-toast agent-toast--${H(s)??``}`,`svelte-lf8l46`),K(p,H(c)),K(h,H(l))}),U(`click`,v,()=>I(s,`idle`)),G(e,t)};q(ee,e=>{H(s)!==`idle`&&e(O)}),N(b),N(v),G(e,v),Ke()}Nr([`click`]);function Eu(e){try{return localStorage.getItem(e)===`1`}catch{return!1}}function Du(){try{let e=parseInt(localStorage.getItem(`ld-highlight-status`)||`0`,10);return e===1||e===2?e:0}catch{return 0}}var $=new class{#e;get allDocs(){return H(this.#e)}set allDocs(e){I(this.#e,e,!0)}#t;get allFolderPaths(){return H(this.#t)}set allFolderPaths(e){I(this.#t,e,!0)}#n;get annotationCounts(){return H(this.#n)}set annotationCounts(e){I(this.#n,e,!0)}#r;get fileAttachmentCounts(){return H(this.#r)}set fileAttachmentCounts(e){I(this.#r,e,!0)}#i;get docStatuses(){return H(this.#i)}set docStatuses(e){I(this.#i,e,!0)}#a;get currentDocId(){return H(this.#a)}set currentDocId(e){I(this.#a,e,!0)}#o;get searchQuery(){return H(this.#o)}set searchQuery(e){I(this.#o,e,!0)}#s;get searchResults(){return H(this.#s)}set searchResults(e){I(this.#s,e,!0)}#c;get expandedCategories(){return H(this.#c)}set expandedCategories(e){I(this.#c,e,!0)}#l;get expandedFolders(){return H(this.#l)}set expandedFolders(e){I(this.#l,e,!0)}#u;get hideCategories(){return H(this.#u)}set hideCategories(e){I(this.#u,e,!0)}#d;get hideAttachments(){return H(this.#d)}set hideAttachments(e){I(this.#d,e,!0)}#f;get highlightStatusState(){return H(this.#f)}set highlightStatusState(e){I(this.#f,e,!0)}#p;get exclusiveFolderExpansion(){return H(this.#p)}set exclusiveFolderExpansion(e){I(this.#p,e,!0)}#m;get exclusiveCategoryExpansion(){return H(this.#m)}set exclusiveCategoryExpansion(e){I(this.#m,e,!0)}#h;get codeBlockMaxHeight(){return H(this.#h)}set codeBlockMaxHeight(e){I(this.#h,e,!0)}#g;get imageRoundedCorners(){return H(this.#g)}set imageRoundedCorners(e){I(this.#g,e,!0)}#_;get imageCentered(){return H(this.#_)}set imageCentered(e){I(this.#_,e,!0)}#v;get imageBorder(){return H(this.#v)}set imageBorder(e){I(this.#v,e,!0)}#y;get codeBlockLightTheme(){return H(this.#y)}set codeBlockLightTheme(e){I(this.#y,e,!0)}#b;get markerState(){return H(this.#b)}set markerState(e){I(this.#b,e,!0)}constructor(){this.#e=F(L([])),this.#t=F(L([])),this.#n=F(L({})),this.#r=F(L({})),this.#i=F(L({})),this.#a=F(null),this.#o=F(``),this.#s=F(null),this.#c=F(L(new Set)),this.#l=F(L(new Set)),this.#u=F(L(Eu(`ld-hide-categories`))),this.#d=F(L(Eu(`ld-hide-attachments`))),this.#f=F(L(Du())),this.#p=F(!1),this.#m=F(!1),this.#h=F(400),this.#g=F(!1),this.#_=F(!1),this.#v=F(!1),this.#y=F(!1),this.#b=F(`normal`)}get markerActive(){return this.markerState===`active`}get markerHidden(){return this.markerState===`hidden`}initMarker(){let e=`normal`;try{e=localStorage.getItem(`ld-marker-state`)||`normal`}catch{}this.markerState=e===`active`?`active`:e===`hidden`?`hidden`:`normal`}toggleMarker(){this.markerState===`normal`?this.markerState=`active`:this.markerState===`active`?this.markerState=`hidden`:this.markerState=`normal`;try{localStorage.setItem(`ld-marker-state`,this.markerState)}catch{}return this.markerState}get filteredDocs(){if(!this.searchQuery)return this.allDocs;if(Array.isArray(this.searchResults))return this.searchResults;let e=this.searchQuery.toLowerCase();return this.allDocs.filter(t=>t.title.toLowerCase().includes(e)||t.category.toLowerCase().includes(e))}toggleHideCategories(){this.hideCategories=!this.hideCategories;try{localStorage.setItem(`ld-hide-categories`,this.hideCategories?`1`:`0`)}catch{}}toggleHideAttachments(){this.hideAttachments=!this.hideAttachments;try{localStorage.setItem(`ld-hide-attachments`,this.hideAttachments?`1`:`0`)}catch{}}cycleHighlightStatus(){this.highlightStatusState=(this.highlightStatusState+1)%3;try{localStorage.setItem(`ld-highlight-status`,String(this.highlightStatusState))}catch{}}toggleCategory(e){let t=new Set(this.expandedCategories);if(t.has(e))t.delete(e);else{if(this.exclusiveCategoryExpansion){let n=e.split(`|`).slice(0,-1).join(`|`);for(let e of[...t])e.split(`|`).slice(0,-1).join(`|`)===n&&t.delete(e)}t.add(e)}this.expandedCategories=t}toggleFolder(e){let t=new Set(this.expandedFolders);if(t.has(e)){t.delete(e);let n=e+`|`;for(let e of[...t])e.startsWith(n)&&t.delete(e);let r=new Set(this.expandedCategories);for(let e of[...r])e.startsWith(n)&&r.delete(e);this.expandedCategories=r}else{if(this.exclusiveFolderExpansion){let n=e.split(`|`).slice(0,-1).join(`|`);for(let e of[...t])if(e.split(`|`).slice(0,-1).join(`|`)===n){t.delete(e);let n=e+`|`;for(let e of[...t])e.startsWith(n)&&t.delete(e)}}t.add(e)}this.expandedFolders=t}revealDoc(e){let t=new Set(this.expandedFolders),n=new Set(this.expandedCategories),r=e.folder||[];for(let e=0;e<r.length;e++)t.add(r.slice(0,e+1).join(`|`));n.add([...r,e.category].join(`|`)),this.expandedFolders=t,this.expandedCategories=n}};async function Ou(){return fetch(`/api/config`).then(e=>e.json())}async function ku(){return fetch(`/api/documents`).then(e=>e.json())}async function Au(e){return fetch(`/api/browse/alldirs?path=`+encodeURIComponent(e)).then(e=>e.json())}async function ju(e){let t=await fetch(`/api/documents/`+e);if(!t.ok)throw Error(t.statusText);return t.json()}async function Mu(){try{let e=await fetch(`/api/annotations`).then(e=>e.json()),t={};for(let[n,r]of Object.entries(e||{})){t[n]=r;try{t[encodeURIComponent(n)]=r}catch{}}return t}catch{return{}}}async function Nu(){try{return await fetch(`/api/documents/file-counts`).then(e=>e.json())}catch{return{}}}async function Pu(){try{return await fetch(`/api/documents/statuses`).then(e=>e.json())}catch{return{}}}async function Fu(e){return fetch(`/api/documents/search?q=`+encodeURIComponent(e)).then(e=>e.json())}function Iu(e,t,n){let r={categories:{},children:{}};for(let t of e){let e=r;for(let n of t.folder||[])e.children[n]||(e.children[n]={categories:{},children:{}}),e=e.children[n];e.categories[t.category]||(e.categories[t.category]=[]),e.categories[t.category].push(t)}if(!n)return r;for(let e of t){let t=e.split(`/`).filter(Boolean),n=r;for(let e of t)n.children[e]||(n.children[e]={categories:{},children:{}}),n=n.children[e]}return r}function Lu(e){let t=Object.values(e.categories).reduce((e,t)=>e+t.length,0);for(let n of Object.values(e.children))t+=Lu(n);return t}function Ru(e,t){let n=0;for(let r of Object.values(e.categories))for(let e of r)t[e.id]>0&&(n+=1);for(let r of Object.values(e.children))n+=Ru(r,t);return n}function zu(e,t){let n=0;for(let r of Object.values(e.categories))for(let e of r)t[e.id]>0&&(n+=1);for(let r of Object.values(e.children))n+=zu(r,t);return n}function Bu(e){return e.replace(/^\d+_/,``).replace(/[_-]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function Vu(e){return Object.keys(e.children).sort((e,t)=>e.localeCompare(t))}function Hu(e){return Object.keys(e.categories).filter(e=>e!==`General`).sort((e,t)=>e.localeCompare(t))}function Uu(e){return Object.values(e.categories).flat().sort((e,t)=>(e.filename||``).localeCompare(t.filename||``))}var Wu=W(`<span class="inline-flex items-center justify-center w-5 h-5 rounded-full bg-green-500 text-[10px] font-bold text-white border border-green-600 shadow-sm">V</span>`),Gu=W(`<span class="inline-flex items-center justify-center w-5 h-5 rounded-full bg-orange-500 text-[10px] font-bold text-white border border-orange-600 shadow-sm">S</span>`),Ku=W(`<span class="inline-flex items-center justify-center min-w-[1.25rem] h-5 px-1.5 rounded-full bg-yellow-300 dark:bg-yellow-400 text-[10px] font-bold text-yellow-900 border border-yellow-500 shadow-sm"> </span>`),qu=W(`<span class="inline-flex items-center justify-center min-w-[1.25rem] h-5 px-1.5 rounded-full bg-sky-200 dark:bg-sky-300 text-[10px] font-bold text-sky-900 border border-sky-500 shadow-sm"> </span>`),Ju=W(`<div class="text-xs text-gray-400 dark:text-gray-500 mt-0.5"> </div>`),Yu=W(`<button><div class="leading-snug flex items-center justify-between gap-2"><span class="truncate"> </span> <span class="flex items-center gap-1 shrink-0"><!> <!> <!></span></div> <!></button>`),Xu=W(`<span class="inline-flex items-center justify-center min-w-[1.25rem] h-5 px-1.5 rounded-full bg-orange-400 dark:bg-orange-500 text-[10px] font-bold text-white border border-orange-600 shadow-sm"> </span>`),Zu=W(`<span class="inline-flex items-center justify-center min-w-[1.25rem] h-5 px-1.5 rounded-full bg-slate-400 dark:bg-slate-500 text-[10px] font-bold text-white border border-slate-600 shadow-sm"> </span>`),Qu=W(`<div class="pl-2"></div>`),$u=W(`<div class="mb-0.5"><button class="w-full flex items-center justify-between px-3 py-1.5 text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider hover:bg-gray-50 dark:hover:bg-gray-800/60 rounded-md transition-colors"><span class="flex items-center gap-2"><span> </span> <!> <!></span> <span class="flex items-center gap-1.5"><span class="font-normal normal-case text-gray-400"> </span> <span>▸</span></span></button> <!></div>`),ed=W(`<div class="pl-3"><!></div>`),td=W(`<div class="mb-1"><button class="w-full flex items-center justify-between px-3 py-1.5 text-xs font-semibold text-violet-600 dark:text-violet-400 uppercase tracking-wider hover:bg-gray-50 dark:hover:bg-gray-800/60 rounded-md transition-colors"><span class="flex items-center gap-2 min-w-0"><span class="truncate"> </span> <!> <!></span> <span class="flex items-center gap-1.5"><span class="font-normal normal-case text-gray-400"> </span> <span>▸</span></span></button> <!></div>`),nd=W(`<!> <!>`,1),rd=W(`<!> <!> <!>`,1);function id(e,t){Ge(t,!0);let n=(e,n=f)=>{let r=P(()=>$.annotationCounts[n().id]||0),i=P(()=>$.fileAttachmentCounts[n().id]||0),a=P(()=>c(n()));var o=Yu(),l=R(o),u=R(l),d=R(u,!0);N(u);var p=B(u,2),m=R(p),h=e=>{var t=Wu();V(e=>J(t,`title`,e),[()=>Y(`sidebar.status_to_validate`)]),G(e,t)},g=e=>{var t=Gu();V(e=>J(t,`title`,e),[()=>Y(`sidebar.status_superseeded`)]),G(e,t)};q(m,e=>{H(a)===`V`?e(h):H(a)===`S`&&e(g,1)});var _=B(m,2),v=e=>{var t=Ku(),n=R(t,!0);N(t),V(e=>{J(t,`title`,e),K(n,H(r))},[()=>s(H(r),`sidebar.annotation_badge`)]),G(e,t)};q(_,e=>{H(r)>0&&!$.markerHidden&&e(v)});var y=B(_,2),b=e=>{var t=qu(),n=R(t,!0);N(t),V(e=>{J(t,`title`,e),K(n,H(i))},[()=>s(H(i),`sidebar.file_attachment_badge`)]),G(e,t)};q(y,e=>{H(i)>0&&!$.hideAttachments&&e(b)}),N(p),N(l);var x=B(l,2),S=e=>{var t=Ju(),r=R(t,!0);N(t),V(()=>K(r,n().formattedDate)),G(e,t)};q(x,e=>{n().formattedDate&&e(S)}),N(o),V(()=>{J(o,`id`,`item-${n().id??``}`),hi(o,1,`doc-item w-full text-left px-3 py-1.5 rounded-md text-sm transition-colors text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800/60 ${n().id===$.currentDocId?`active`:``}`),K(d,n().title)}),U(`click`,o,()=>t.onopen(n().id)),G(e,o)},r=(e,r=f)=>{let i=P(()=>a(r())),o=P(()=>$.expandedCategories.has(H(i))),c=P(()=>t.node.categories[r()]),l=P(()=>H(c).reduce((e,t)=>e+ +($.annotationCounts[t.id]>0),0)),u=P(()=>H(c).reduce((e,t)=>e+ +($.fileAttachmentCounts[t.id]>0),0));var d=$u(),p=R(d),m=R(p),h=R(m),g=R(h,!0);N(h);var _=B(h,2),v=e=>{var t=Xu(),n=R(t,!0);N(t),V(e=>{J(t,`title`,e),K(n,H(l))},[()=>s(H(l),`sidebar.annotated_docs_badge`)]),G(e,t)};q(_,e=>{H(l)>0&&!$.markerHidden&&e(v)});var y=B(_,2),b=e=>{var t=Zu(),n=R(t,!0);N(t),V(e=>{J(t,`title`,e),K(n,H(u))},[()=>s(H(u),`sidebar.file_attached_docs_badge`)]),G(e,t)};q(y,e=>{H(u)>0&&!$.hideAttachments&&e(b)}),N(m);var x=B(m,2),S=R(x),C=R(S,!0);N(S);var w=B(S,2);N(x),N(p);var T=B(p,2),E=e=>{var t=Qu();$r(t,21,()=>H(c),e=>e.id,(e,t)=>{n(e,()=>H(t))}),N(t),G(e,t)};q(T,e=>{H(o)&&e(E)}),N(d),V(()=>{K(g,r()),K(C,H(c).length),hi(w,1,`transition-transform duration-200 ${H(o)?`rotate-90`:``}`)}),U(`click`,p,()=>$.toggleCategory(H(i))),G(e,d)},i=(e,n=f)=>{let r=P(()=>o(n())),i=P(()=>$.expandedFolders.has(H(r))),a=P(()=>t.node.children[n()]),c=P(()=>Lu(H(a))),l=P(()=>Ru(H(a),$.annotationCounts)),u=P(()=>zu(H(a),$.fileAttachmentCounts));var d=td(),p=R(d),m=R(p),h=R(m),g=R(h);N(h);var _=B(h,2),v=e=>{var t=Xu(),n=R(t,!0);N(t),V(e=>{J(t,`title`,e),K(n,H(l))},[()=>s(H(l),`sidebar.annotated_docs_badge`)]),G(e,t)};q(_,e=>{H(l)>0&&!$.markerHidden&&e(v)});var y=B(_,2),b=e=>{var t=Zu(),n=R(t,!0);N(t),V(e=>{J(t,`title`,e),K(n,H(u))},[()=>s(H(u),`sidebar.file_attached_docs_badge`)]),G(e,t)};q(y,e=>{H(u)>0&&!$.hideAttachments&&e(b)}),N(m);var x=B(m,2),S=R(x),C=R(S,!0);N(S);var w=B(S,2);N(x),N(p);var T=B(p,2),E=e=>{var r=ed(),i=R(r);{let e=P(()=>[...t.folderPath,n()]);id(i,{get node(){return H(a)},get folderPath(){return H(e)},get onopen(){return t.onopen}})}N(r),G(e,r)};q(T,e=>{H(i)&&e(E)}),N(d),V(e=>{J(h,`title`,n()),K(g,`📁 ${e??``}`),K(C,H(c)),hi(w,1,`transition-transform duration-200 ${H(i)?`rotate-90`:``}`)},[()=>Bu(n())]),U(`click`,p,()=>$.toggleFolder(H(r))),G(e,d)};function a(e){return[...t.folderPath,e].join(`|`)}function o(e){return[...t.folderPath,e].join(`|`)}function s(e,t){return`${e} ${Y(t)}${e>1?`s`:``}`}function c(e){if(!$.highlightStatusState)return null;let t=String($.docStatuses[e.id]||``).trim().toLowerCase();return t===`to be validated`?`V`:$.highlightStatusState===2&&t===`superseeded`?`S`:null}var l=Ur(),u=z(l),d=e=>{var r=nd(),a=z(r);$r(a,17,()=>Uu(t.node),e=>e.id,(e,t)=>{n(e,()=>H(t))}),$r(B(a,2),16,()=>Vu(t.node),e=>e,(e,t)=>{i(e,()=>t)}),G(e,r)},p=e=>{var n=rd(),a=z(n),o=e=>{r(e,()=>`General`)};q(a,e=>{t.node.categories.General&&e(o)});var s=B(a,2);$r(s,16,()=>Vu(t.node),e=>e,(e,t)=>{i(e,()=>t)}),$r(B(s,2),16,()=>Hu(t.node),e=>e,(e,t)=>{r(e,()=>t)}),G(e,n)};q(u,e=>{$.hideCategories?e(d):e(p,-1)}),G(e,l),Ke()}Nr([`click`]);var ad=W(`<p class="px-4 py-8 text-sm text-gray-400 text-center"> </p>`),od=W(`<aside><div class="sticky top-0 z-10 bg-white dark:bg-gray-900 p-3 border-b border-gray-100 dark:border-gray-800"><div class="relative sm:hidden"><input type="search" class="w-full pl-8 pr-3 py-1.5 text-sm rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500"/> <span class="absolute left-2.5 top-2 text-gray-400 text-sm pointer-events-none">🔍</span></div> <div class="flex items-center justify-between mt-2 sm:mt-0"><p class="text-xs text-gray-400 dark:text-gray-500"> </p> <div class="flex items-center gap-2"><button><i class="fa-solid fa-certificate"></i></button> <button><i class="fa-solid fa-paperclip"></i></button> <button><i class="fa-solid fa-tags"></i></button> <button class="text-gray-400 hover:text-blue-500 dark:text-gray-500 dark:hover:text-blue-400 transition-colors leading-none"><i class="fa-solid fa-file-export"></i></button> <button class="text-gray-400 hover:text-blue-500 dark:text-gray-500 dark:hover:text-blue-400 transition-colors leading-none"><i class="fa-solid fa-folder-plus"></i></button> <button class="text-gray-400 hover:text-blue-500 dark:text-gray-500 dark:hover:text-blue-400 transition-colors leading-none"><i class="fa-solid fa-file-circle-plus"></i></button></div></div></div> <nav data-testid="category-tree" class="flex-1 py-2 space-y-0.5"><!></nav> <div aria-hidden="true"></div></aside>`);function sd(e,t){Ge(t,!0);let n=P(()=>Iu($.filteredDocs,$.allFolderPaths,!$.searchQuery)),r=P(()=>$.filteredDocs.length),i=P(()=>$.filteredDocs.length===0&&$.allFolderPaths.length===0),a=`ld-sidebar-w`,o=F(null),s=F(!1),c=F(null);On(()=>{let e=parseInt(localStorage.getItem(a)||``,10);Number.isFinite(e)&&I(o,Math.max(200,Math.min(600,e)),!0)});function l(e){e.preventDefault();let t=e.clientX,n=H(c).getBoundingClientRect().width;I(s,!0),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let r=e=>{I(o,Math.max(200,Math.min(600,n+e.clientX-t)),!0)},i=()=>{if(document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i),document.body.style.cursor=``,document.body.style.userSelect=``,I(s,!1),H(o)!=null)try{localStorage.setItem(a,String(H(o)))}catch{}};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)}var u=od(),d=R(u),f=R(d),p=R(f);Ei(p),Pe(2),N(f);var m=B(f,2),h=R(m),g=R(h);N(h);var _=B(h,2),v=R(_),y=B(v,2),b=B(y,2),x=B(b,2),S=B(x,2),C=B(S,2);N(_),N(m),N(d);var w=B(d,2),T=R(w),E=e=>{var t=ad(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`sidebar.no_docs`)]),G(e,t)},D=e=>{id(e,{get node(){return H(n)},folderPath:[],get onopen(){return t.onopen}})};q(T,e=>{H(i)?e(E):e(D,-1)}),N(w);var ee=B(w,2);N(u),Li(u,e=>I(c,e),()=>H(c)),V((e,t,n,i,a,c,l)=>{hi(u,1,`no-print ${H(o)==null?`w-72`:``} shrink-0 flex flex-col border-r border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 overflow-y-auto relative`),_i(u,H(o)==null?``:`width:${H(o)}px`),J(p,`placeholder`,e),Di(p,$.searchQuery),K(g,`${H(r)??``} document${H(r)===1?``:`s`}`),J(v,`title`,t),hi(v,1,`hover:opacity-80 transition-colors leading-none ${$.highlightStatusState===0?`text-gray-400 dark:text-gray-500`:$.highlightStatusState===1?`text-green-500 dark:text-green-400`:`text-orange-500 dark:text-orange-400`}`),J(y,`title`,n),hi(y,1,`transition-colors leading-none ${$.hideAttachments?`text-gray-400 dark:text-gray-500`:`text-blue-500 dark:text-blue-400`}`),J(b,`title`,i),hi(b,1,`transition-colors leading-none ${$.hideCategories?`text-gray-400 dark:text-gray-500`:`text-blue-500 dark:text-blue-400`}`),J(x,`title`,a),J(S,`title`,c),J(C,`title`,l),hi(ee,1,`absolute top-0 right-[-2px] w-1.5 h-full cursor-col-resize z-20 select-none transition-colors ${H(s)?`bg-blue-500/55`:`hover:bg-blue-500/35`}`)},[()=>Y(`nav.search_mobile_placeholder`),()=>Y(`nav.toggle_status_highlight`),()=>Y(`nav.toggle_attachments`),()=>Y(`nav.toggle_categories`),()=>Y(`nav.export`),()=>Y(`nav.new_folder`),()=>Y(`nav.new_document`)]),U(`input`,p,e=>t.onsearch(e.target.value)),U(`click`,v,()=>$.cycleHighlightStatus()),U(`click`,y,()=>$.toggleHideAttachments()),U(`click`,b,()=>$.toggleHideCategories()),U(`click`,x,function(...e){t.onexport?.apply(this,e)}),U(`click`,S,function(...e){t.onnewfolder?.apply(this,e)}),U(`click`,C,function(...e){t.onnewdoc?.apply(this,e)}),U(`mousedown`,ee,l),G(e,u),Ke()}Nr([`input`,`click`,`mousedown`]);var cd=`(?:<!--\\s*table-(?:style|border|color):\\s*[a-z][a-z0-9_-]*\\s*-->\\n+){0,3}(?:\\|[^\\n]*\\|\\n)\\|[ \\t:|-]*-[ \\t:|-]*\\|(?:\\n\\|[^\\n]*\\|)*`;function ld(){return cd}var ud=new Set([`compact`,`striped`]),dd=new Set([`bordered`,`borderless`]),fd=new Set([`bordered`,`borderless`]),pd=new Set([`info`,`success`,`warning`,`danger`,`note`]);function md(e){let t=null,n=null,r=null,i=/<!--\s*table-(style|border|color):\s*([a-z][a-z0-9_-]*)\s*-->/g,a;for(;a=i.exec(e||``);){let[,e,i]=a;e===`style`&&ud.has(i)&&(t=i),e===`style`&&fd.has(i)&&(n=i),e===`border`&&dd.has(i)&&(n=i),e===`color`&&pd.has(i)&&(r=i)}return{style:t,border:n,color:r}}function hd(e){let t=typeof e==`string`?e.trim():``,n=RegExp(`^(?:<!--\\s*table-(?:style|border|color):\\s*[a-z][a-z0-9_-]*\\s*-->\\n+){0,3}`);return md(t.match(n)?.[0]||``)}function gd(e){let t=md([e?.style?`<!-- table-style: ${e.style} -->`:``,e?.border?`<!-- table-border: ${e.border} -->`:``,e?.color?`<!-- table-color: ${e.color} -->`:``].filter(Boolean).join(`
10
+ <a href="${te(s)}" target="_blank" rel="noopener" class="mcp-saved-link">📄 ${te(a)}</a>`})}catch(n){f(e,t,{running:!1,error:n.message||String(n),resultHtml:``})}}async function O(e){let n=H(e===`tool`?o:s);if(!n.length)return;I(c,!0);let r=n.length;try{for(let i=0;i<n.length;i++)t.onStatus(Y(`context.mcp_running_all`).replace(`{current}`,String(i+1)).replace(`{total}`,String(r))),await ee(e,n[i].name);t.onStatus(Y(`context.mcp_done_all`).replace(`{total}`,String(r)))}finally{I(c,!1)}}function te(e){return String(e??``).replace(/[&<>"']/g,e=>({"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`})[e])}async function k(){try{let e=await fetch(`/mcp`);if(!e.ok)throw Error(await e.text());let t=await e.json(),c=Array.isArray(t.tools)?t.tools:[],l=Array.isArray(t.prompts)?t.prompts:[];I(n,Y(`context.mcp_available`),!0),I(r,!0),I(i,t.transport||`-`,!0),I(a,t.endpoint||`POST /mcp`,!0),I(o,c,!0),I(s,l,!0),c.forEach(m),l.forEach(h)}catch{I(n,Y(`context.mcp_unavailable`),!0),I(r,!1),I(i,`-`),I(a,`/mcp`),I(o,[],!0),I(s,[],!0)}}var ne={load:k},re=du(),ie=R(re),ae=R(ie),oe=R(ae,!0);N(ae);var se=B(ae,2),ce=R(se,!0);N(se),N(ie);var le=B(ie,2),ue=R(le,!0);N(le);var de=B(le,2),fe=R(de),pe=R(fe),me=R(pe,!0);N(pe);var he=B(pe,2),ge=R(he,!0);N(he),N(fe);var _e=B(fe,2),ve=R(_e),ye=R(ve,!0);N(ve);var be=B(ve,2),xe=R(be,!0);N(be),N(_e);var Se=B(_e,2),Ce=R(Se),we=R(Ce,!0);N(Ce);var Te=B(Ce,2),A=R(Te,!0);N(Te),N(Se),N(de);var Ee=B(de,2),De=R(Ee),Oe=R(De),ke=R(Oe,!0);N(Oe);var Ae=B(Oe,2),j=R(Ae),je=R(j,!0);N(j);var M=B(j,2),Me=R(M,!0);N(M),N(Ae),N(De);var Ne=B(De,2),Pe=R(Ne),Fe=e=>{var t=ru(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`context.mcp_no_tools`)]),G(e,t)},Ie=e=>{var t=Ur();$r(z(t),17,()=>H(o),Yr,(e,t)=>{let n=P(()=>H(l).get(H(t).name)??{argsJson:`{}`,running:!1,error:``,resultHtml:``});var r=su(),i=R(r),a=R(i,!0);N(i);var o=B(i,2),s=e=>{var n=iu(),r=R(n,!0);N(n),V(()=>K(r,H(t).description)),G(e,n)};q(o,e=>{H(t).description&&e(s)});var c=B(o,2),u=e=>{var n=au(),r=R(n),i=R(r,!0);N(r);var a=B(r,2),o=R(a,!0);N(a),N(n),V((e,t)=>{K(i,e),K(o,t)},[()=>Y(`context.mcp_input_schema`),()=>JSON.stringify(H(t).inputSchema,null,2)]),G(e,n)};q(c,e=>{H(t).inputSchema&&e(u)});var d=B(c,2),p=R(d),m=R(p,!0);N(p);var h=B(p,2);vn(h);var g=B(h,2),_=R(g),v=R(_,!0);N(_);var y=B(_,2),b=R(y,!0);N(y),N(g);var x=B(g,2),S=e=>{var t=ou();ai(t,()=>H(n).resultHtml,!0),N(t),G(e,t)};q(x,e=>{H(n).resultHtml&&e(S)}),N(d),N(r),V((e,r)=>{K(a,H(t).name),K(m,e),Di(h,H(n).argsJson),K(v,H(n).error),y.disabled=H(n).running,K(b,r)},[()=>Y(`context.mcp_request_json`),()=>Y(`context.mcp_run_tool`)]),U(`input`,h,e=>f(`tool`,H(t).name,{argsJson:e.target.value})),U(`click`,y,()=>ee(`tool`,H(t).name)),G(e,r)}),G(e,t)};q(Pe,e=>{H(o).length?e(Ie,-1):e(Fe)}),N(Ne),N(Ee);var Le=B(Ee,2),Re=R(Le),ze=R(Re),Be=R(ze,!0);N(ze);var Ve=B(ze,2),He=R(Ve),Ue=R(He,!0);N(He);var We=B(He,2),qe=R(We,!0);N(We),N(Ve),N(Re);var Je=B(Re,2),Ye=R(Je),Xe=e=>{var t=ru(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`context.mcp_no_prompts`)]),G(e,t)},Ze=e=>{var t=Ur();$r(z(t),17,()=>H(s),Yr,(e,t)=>{let n=P(()=>H(u).get(H(t).name)??{argsJson:`{}`,running:!1,error:``,resultHtml:``});var r=su(),i=R(r),a=R(i,!0);N(i);var o=B(i,2),s=e=>{var n=iu(),r=R(n,!0);N(n),V(()=>K(r,H(t).description)),G(e,n)};q(o,e=>{H(t).description&&e(s)});var c=B(o,2),l=e=>{var n=uu(),r=R(n),i=R(r,!0);N(r);var a=B(r,2);$r(a,21,()=>H(t).arguments,Yr,(e,t)=>{var n=lu(),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=e=>{var n=cu(),r=R(n,!0);N(n),V(()=>K(r,H(t).description)),G(e,n)};q(c,e=>{H(t).description&&e(l)}),N(n),V(e=>{K(a,H(t).name),K(s,e)},[()=>H(t).required?Y(`context.mcp_required`):Y(`context.mcp_optional`)]),G(e,n)}),N(a),N(n),V(e=>K(i,e),[()=>Y(`context.mcp_arguments`)]),G(e,n)};q(c,e=>{H(t).arguments?.length&&e(l)});var d=B(c,2),p=R(d),m=R(p,!0);N(p);var h=B(p,2);vn(h);var g=B(h,2),_=R(g),v=R(_,!0);N(_);var y=B(_,2),b=R(y,!0);N(y),N(g);var x=B(g,2),S=e=>{var t=ou();ai(t,()=>H(n).resultHtml,!0),N(t),G(e,t)};q(x,e=>{H(n).resultHtml&&e(S)}),N(d),N(r),V((e,r)=>{K(a,H(t).name),K(m,e),Di(h,H(n).argsJson),K(v,H(n).error),y.disabled=H(n).running,K(b,r)},[()=>Y(`context.mcp_request_json`),()=>Y(`context.mcp_get_prompt`)]),U(`input`,h,e=>f(`prompt`,H(t).name,{argsJson:e.target.value})),U(`click`,y,()=>ee(`prompt`,H(t).name)),G(e,r)}),G(e,t)};return q(Ye,e=>{H(s).length?e(Ze,-1):e(Xe)}),N(Je),N(Le),N(re),V((e,t,l,u,d,f,p,m,h,g)=>{K(oe,e),K(ce,t),K(ue,l),K(me,u),hi(he,1,li(H(r)?`mcp-info-value ok`:`mcp-info-value err`),`svelte-1ui2b6s`),K(ge,H(n)),K(ye,d),K(xe,H(i)),K(we,f),K(A,H(a)),K(ke,p),K(je,H(o).length),M.disabled=H(c)||!H(o).length,K(Me,m),K(Be,h),K(Ue,H(s).length),We.disabled=H(c)||!H(s).length,K(qe,g)},[()=>Y(`context.mcp_title`),()=>Y(`context.mcp_refresh`),()=>Y(`context.mcp_intro`),()=>Y(`context.mcp_status`),()=>Y(`context.mcp_transport`),()=>Y(`context.mcp_endpoint`),()=>Y(`context.mcp_tools`),()=>Y(`context.mcp_run_all_tools`),()=>Y(`context.mcp_prompts`),()=>Y(`context.mcp_get_all_prompts`)]),U(`click`,se,k),U(`click`,M,()=>O(`tool`)),U(`click`,We,()=>O(`prompt`)),G(e,re),Ke(ne)}Nr([`click`,`input`]);var pu=W(`<p class="status-text svelte-rpj1e5"> </p>`),mu=W(`<div class="app-shell"><!> <main class="context-scroll svelte-rpj1e5"><div class="context-inner svelte-rpj1e5"><section class="page-intro svelte-rpj1e5"><h2 class="page-title svelte-rpj1e5"> </h2> <p class="page-desc svelte-rpj1e5"> </p> <!></section> <!> <!> <!></div></main></div> <!>`,1);function hu(e,t){Ge(t,!0);let n=F(``),r=F(L([])),i=F(L([])),a=F(``),o=F(null),s=F(null),c=F(null);function l(e){I(n,e,!0)}async function u(){l(Y(`context.loading`));let e=await fetch(`/api/context/orientation`);if(!e.ok)throw Error(await e.text());let t=await e.json();I(o,t,!0),I(r,t.instructions||[],!0),I(i,t.rules||[],!0),I(a,t.rulesFolder||``,!0),l(``)}async function d(e){l(Y(`context.adding_instruction_file`));let t=await fetch(`/api/context/instructions`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:e})});if(!t.ok)throw Error(await t.text());await u()}async function f(e){if(!await H(s).show({kicker:Y(`context.remove_instruction_title`),title:Y(`context.remove_instruction_title`),message:Y(`context.remove_instruction_message`).replace(`{name}`,e),confirmLabel:Y(`common.remove`),cancelLabel:Y(`common.cancel`)||`Cancel`,danger:!0}))return;l(Y(`context.removing_instruction_file`));let t=await fetch(`/api/context/instructions/`+encodeURIComponent(e),{method:`DELETE`});if(!t.ok)throw Error(await t.text());await u()}async function p(e){l(Y(`context.saving_rule`));let t=await fetch(`/api/context/rules`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify(e)});if(!t.ok)throw Error(await t.text());await u()}Vi(async()=>{try{let e=await fetch(`/api/config`);await fa((e.ok?await e.json():{}).language||`en`)}catch{await fa(`en`)}document.title=Y(`context.title`),await u().catch(e=>l(e.message)),await H(c).load().catch(()=>{})});var m=mu(),h=z(m),g=R(h);ua(g,{get navigate(){return t.navigate}});var _=B(g,2),v=R(_),y=R(v),b=R(y),x=R(b,!0);N(b);var S=B(b,2),C=R(S,!0);N(S);var w=B(S,2),T=e=>{var t=pu(),r=R(t,!0);N(t),V(()=>K(r,H(n))),G(e,t)};q(w,e=>{H(n)&&e(T)}),N(y);var E=B(y,2);Jl(E,{onAdd:d,onRemove:f,get items(){return H(r)},set items(e){I(r,e,!0)}});var D=B(E,2);nu(D,{get rules(){return H(i)},get rulesFolder(){return H(a)},onAdd:p}),Li(fu(B(D,2),{onStatus:l}),e=>I(c,e,!0),()=>H(c)),N(v),N(_),N(h),Li(Dl(B(h,2),{}),e=>I(s,e,!0),()=>H(s)),V((e,t)=>{K(x,e),K(C,t)},[()=>Y(`context.orientation_title`),()=>Y(`context.orientation_intro`)]),G(e,m),Ke()}var gu=W(`<p class="agents-msg svelte-lf8l46"> </p>`),_u=W(`<p class="agents-msg agents-msg--error svelte-lf8l46"> </p>`),vu=W(`<p class="agents-msg agents-msg--empty svelte-lf8l46"> </p>`),yu=W(`<button type="button"><span class="agent-name svelte-lf8l46"> </span> <span class="agent-provider svelte-lf8l46"> </span> <span> </span></button>`),bu=W(`<div class="agents-grid svelte-lf8l46"></div>`),xu=W(`<div class="confirm-overlay"><section class="confirm-dialog agent-input-dialog svelte-lf8l46" role="dialog" aria-modal="true"><h2> </h2> <p class="confirm-message"> </p> <div class="field-group" style="margin-top:1rem"><label class="field-label" for="agent-input"> </label> <textarea id="agent-input" class="field-input"></textarea></div> <footer class="confirm-actions"><button class="secondary-button" type="button"> </button> <button class="btn-primary" type="button"> </button></footer></section></div>`),Su=W(`<a class="agent-toast-link svelte-lf8l46"> </a>`),Cu=W(`<div><span class="agent-toast-icon svelte-lf8l46"><!></span> <div class="agent-toast-body svelte-lf8l46"><p class="agent-toast-title svelte-lf8l46"> </p> <p class="agent-toast-message svelte-lf8l46"> </p> <!></div> <button class="agent-toast-close svelte-lf8l46" type="button">×</button></div>`),wu=W(`<div class="app-shell"><!> <div class="agents-page svelte-lf8l46"><!> <!> <!></div></div>`);function Tu(e,t){Ge(t,!0);let n=F(L([])),r=F(!0),i=F(``),a=F(null),o=F(``),s=F(`idle`),c=F(``),l=F(``),u=F(null);function d(e){let t=e.provider;return!t||t.kind!==`llm`||!t.config?.model||!e.config?.systemPrompt||e.config?.requiresUserInput&&!e.config?.userInputDescription?.trim()?`not_ready`:e.config?.requiresUserInput?`requires_input`:`ready`}function f(e){return d(e)===`not_ready`}async function p(){I(r,!0),I(i,``);try{let e=await fetch(`/api/workspace`,{headers:{Accept:`application/json`}});if(!e.ok)throw Error(`HTTP ${e.status}`);let t=await e.json(),r=Array.isArray(t.entities)?t.entities:[],i=new Map(r.map(e=>[e.id,e]));I(n,r.filter(e=>e.kind===`agent`).map(e=>({...e,provider:i.get(e.parentId??``)})),!0)}catch(e){I(i,e instanceof Error?e.message:Y(`agents.load_failed`),!0)}finally{I(r,!1)}}function m(e){f(e)||(e.config?.requiresUserInput?(I(a,e,!0),I(o,``)):_(e.id,``))}function h(){I(a,null),I(o,``)}async function g(){if(!H(a))return;let e=H(a).id;I(a,null),await _(e,H(o))}async function _(e,t){let r=H(n).find(t=>t.id===e);I(u,null),I(s,`loading`),I(c,Y(`agents.loading`),!0),I(l,r?.label??``,!0);try{let n=await fetch(`/api/workspace/run-agent-document`,{method:`POST`,headers:{Accept:`application/json`,"Content-Type":`application/json`},body:JSON.stringify({agentId:e,userInput:t})}),r=await n.json();r.document?.id&&I(u,r.document.id,!0),n.ok&&r.ok?(I(s,`success`),I(c,Y(`agents.success`),!0),I(l,r.document?.filename??``,!0)):(I(s,`error`),I(c,Y(`agents.failure`),!0),I(l,r.error??Y(`agents.run_failed`),!0))}catch(e){I(s,`error`),I(c,Y(`agents.failure`),!0),I(l,e instanceof Error?e.message:Y(`agents.run_failed`),!0)}}Vi(async()=>{try{await fa((await fetch(`/api/config`).then(e=>e.json())).language||`en`)}catch{}await p()});var v=wu(),y=R(v);{let e=P(()=>Y(`agents.title`)),t=P(()=>Y(`agents.subtitle`));ua(y,{get title(){return H(e)},get subtitle(){return H(t)}})}var b=B(y,2),x=R(b),S=e=>{var t=gu(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.loading`)]),G(e,t)},C=e=>{var t=_u(),n=R(t,!0);N(t),V(()=>K(n,H(i))),G(e,t)},w=e=>{var t=vu(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`agents.empty`)]),G(e,t)},T=e=>{var t=bu();$r(t,21,()=>H(n),Yr,(e,t)=>{let n=P(()=>d(H(t))),r=P(()=>f(H(t)));var i=yu();let a;var o=R(i),s=R(o,!0);N(o);var c=B(o,2),l=R(c,!0);N(c);var u=B(c,2),p=R(u,!0);N(u),N(i),V((e,o)=>{a=hi(i,1,`agent-card svelte-lf8l46`,null,a,{"agent-card--disabled":H(r)}),i.disabled=H(r),K(s,H(t).label),K(l,e),hi(u,1,`agent-badge agent-badge--${H(n)??``}`,`svelte-lf8l46`),K(p,o)},[()=>H(t).provider?.label??Y(`agents.no_provider`),()=>Y(`agents.${H(n)}`)]),U(`click`,i,()=>m(H(t))),G(e,i)}),N(t),G(e,t)};q(x,e=>{H(r)?e(S):H(i)?e(C,1):H(n).length===0?e(w,2):e(T,-1)});var E=B(x,2),D=e=>{var t=xu(),n=R(t),r=R(n),i=R(r,!0);N(r);var s=B(r,2),c=R(s,!0);N(s);var l=B(s,2),u=R(l),d=R(u,!0);N(u);var f=B(u,2);vn(f),J(f,`rows`,4),N(l);var p=B(l,2),m=R(p),_=R(m,!0);N(m);var v=B(m,2),y=R(v,!0);N(v),N(p),N(n),N(t),V((e,t,n,r,o,s)=>{K(i,H(a).label),K(c,e),K(d,t),J(f,`placeholder`,n),K(_,r),v.disabled=o,K(y,s)},[()=>H(a).config?.userInputDescription?.trim()||Y(`agents.input_hint`),()=>Y(`agents.input_title`),()=>Y(`agents.input_hint`),()=>Y(`common.cancel`),()=>!H(o).trim(),()=>Y(`agents.run`)]),U(`click`,t,e=>{e.target===e.currentTarget&&h()}),Mi(f,()=>H(o),e=>I(o,e)),U(`click`,m,h),U(`click`,v,g),G(e,t)};q(E,e=>{H(a)&&e(D)});var ee=B(E,2),O=e=>{var t=Cu(),n=R(t),r=R(n),i=e=>{G(e,Hr(`⟳`))},a=e=>{G(e,Hr(`✓`))},o=e=>{G(e,Hr(`!`))};q(r,e=>{H(s)===`loading`?e(i):H(s)===`success`?e(a,1):e(o,-1)}),N(n);var d=B(n,2),f=R(d),p=R(f,!0);N(f);var m=B(f,2),h=R(m,!0);N(m);var g=B(m,2),_=e=>{var t=Su(),n=R(t,!0);N(t),V((e,r)=>{J(t,`href`,`/?doc=${e??``}`),K(n,r)},[()=>encodeURIComponent(H(u)),()=>Y(`agents.open_document`)]),G(e,t)};q(g,e=>{H(u)&&e(_)}),N(d);var v=B(d,2);N(t),V(()=>{hi(t,1,`agent-toast agent-toast--${H(s)??``}`,`svelte-lf8l46`),K(p,H(c)),K(h,H(l))}),U(`click`,v,()=>I(s,`idle`)),G(e,t)};q(ee,e=>{H(s)!==`idle`&&e(O)}),N(b),N(v),G(e,v),Ke()}Nr([`click`]);function Eu(e){try{return localStorage.getItem(e)===`1`}catch{return!1}}function Du(){try{let e=parseInt(localStorage.getItem(`ld-highlight-status`)||`0`,10);return e===1||e===2?e:0}catch{return 0}}var $=new class{#e;get allDocs(){return H(this.#e)}set allDocs(e){I(this.#e,e,!0)}#t;get allFolderPaths(){return H(this.#t)}set allFolderPaths(e){I(this.#t,e,!0)}#n;get annotationCounts(){return H(this.#n)}set annotationCounts(e){I(this.#n,e,!0)}#r;get fileAttachmentCounts(){return H(this.#r)}set fileAttachmentCounts(e){I(this.#r,e,!0)}#i;get docStatuses(){return H(this.#i)}set docStatuses(e){I(this.#i,e,!0)}#a;get currentDocId(){return H(this.#a)}set currentDocId(e){I(this.#a,e,!0)}#o;get searchQuery(){return H(this.#o)}set searchQuery(e){I(this.#o,e,!0)}#s;get searchResults(){return H(this.#s)}set searchResults(e){I(this.#s,e,!0)}#c;get expandedCategories(){return H(this.#c)}set expandedCategories(e){I(this.#c,e,!0)}#l;get expandedFolders(){return H(this.#l)}set expandedFolders(e){I(this.#l,e,!0)}#u;get hideCategories(){return H(this.#u)}set hideCategories(e){I(this.#u,e,!0)}#d;get hideAttachments(){return H(this.#d)}set hideAttachments(e){I(this.#d,e,!0)}#f;get highlightStatusState(){return H(this.#f)}set highlightStatusState(e){I(this.#f,e,!0)}#p;get exclusiveFolderExpansion(){return H(this.#p)}set exclusiveFolderExpansion(e){I(this.#p,e,!0)}#m;get exclusiveCategoryExpansion(){return H(this.#m)}set exclusiveCategoryExpansion(e){I(this.#m,e,!0)}#h;get codeBlockMaxHeight(){return H(this.#h)}set codeBlockMaxHeight(e){I(this.#h,e,!0)}#g;get imageRoundedCorners(){return H(this.#g)}set imageRoundedCorners(e){I(this.#g,e,!0)}#_;get imageCentered(){return H(this.#_)}set imageCentered(e){I(this.#_,e,!0)}#v;get imageBorder(){return H(this.#v)}set imageBorder(e){I(this.#v,e,!0)}#y;get codeBlockLightTheme(){return H(this.#y)}set codeBlockLightTheme(e){I(this.#y,e,!0)}#b;get markerState(){return H(this.#b)}set markerState(e){I(this.#b,e,!0)}constructor(){this.#e=F(L([])),this.#t=F(L([])),this.#n=F(L({})),this.#r=F(L({})),this.#i=F(L({})),this.#a=F(null),this.#o=F(``),this.#s=F(null),this.#c=F(L(new Set)),this.#l=F(L(new Set)),this.#u=F(L(Eu(`ld-hide-categories`))),this.#d=F(L(Eu(`ld-hide-attachments`))),this.#f=F(L(Du())),this.#p=F(!1),this.#m=F(!1),this.#h=F(400),this.#g=F(!1),this.#_=F(!1),this.#v=F(!1),this.#y=F(!1),this.#b=F(`normal`)}get markerActive(){return this.markerState===`active`}get markerHidden(){return this.markerState===`hidden`}initMarker(){let e=`normal`;try{e=localStorage.getItem(`ld-marker-state`)||`normal`}catch{}this.markerState=e===`active`?`active`:e===`hidden`?`hidden`:`normal`}toggleMarker(){this.markerState===`normal`?this.markerState=`active`:this.markerState===`active`?this.markerState=`hidden`:this.markerState=`normal`;try{localStorage.setItem(`ld-marker-state`,this.markerState)}catch{}return this.markerState}get filteredDocs(){if(!this.searchQuery)return this.allDocs;if(Array.isArray(this.searchResults))return this.searchResults;let e=e=>e.normalize(`NFD`).replace(/[̀-ͯ]/g,``).toLowerCase(),t=e(this.searchQuery);return this.allDocs.filter(n=>e(n.title).includes(t)||e(n.category).includes(t))}toggleHideCategories(){this.hideCategories=!this.hideCategories;try{localStorage.setItem(`ld-hide-categories`,this.hideCategories?`1`:`0`)}catch{}}toggleHideAttachments(){this.hideAttachments=!this.hideAttachments;try{localStorage.setItem(`ld-hide-attachments`,this.hideAttachments?`1`:`0`)}catch{}}cycleHighlightStatus(){this.highlightStatusState=(this.highlightStatusState+1)%3;try{localStorage.setItem(`ld-highlight-status`,String(this.highlightStatusState))}catch{}}toggleCategory(e){let t=new Set(this.expandedCategories);if(t.has(e))t.delete(e);else{if(this.exclusiveCategoryExpansion){let n=e.split(`|`).slice(0,-1).join(`|`);for(let e of[...t])e.split(`|`).slice(0,-1).join(`|`)===n&&t.delete(e)}t.add(e)}this.expandedCategories=t}toggleFolder(e){let t=new Set(this.expandedFolders);if(t.has(e)){t.delete(e);let n=e+`|`;for(let e of[...t])e.startsWith(n)&&t.delete(e);let r=new Set(this.expandedCategories);for(let e of[...r])e.startsWith(n)&&r.delete(e);this.expandedCategories=r}else{if(this.exclusiveFolderExpansion){let n=e.split(`|`).slice(0,-1).join(`|`);for(let e of[...t])if(e.split(`|`).slice(0,-1).join(`|`)===n){t.delete(e);let n=e+`|`;for(let e of[...t])e.startsWith(n)&&t.delete(e)}}t.add(e)}this.expandedFolders=t}revealDoc(e){let t=new Set(this.expandedFolders),n=new Set(this.expandedCategories),r=e.folder||[];for(let e=0;e<r.length;e++)t.add(r.slice(0,e+1).join(`|`));n.add([...r,e.category].join(`|`)),this.expandedFolders=t,this.expandedCategories=n}};async function Ou(){return fetch(`/api/config`).then(e=>e.json())}async function ku(){return fetch(`/api/documents`).then(e=>e.json())}async function Au(e){return fetch(`/api/browse/alldirs?path=`+encodeURIComponent(e)).then(e=>e.json())}async function ju(e){let t=await fetch(`/api/documents/`+e);if(!t.ok)throw Error(t.statusText);return t.json()}async function Mu(){try{let e=await fetch(`/api/annotations`).then(e=>e.json()),t={};for(let[n,r]of Object.entries(e||{})){t[n]=r;try{t[encodeURIComponent(n)]=r}catch{}}return t}catch{return{}}}async function Nu(){try{return await fetch(`/api/documents/file-counts`).then(e=>e.json())}catch{return{}}}async function Pu(){try{return await fetch(`/api/documents/statuses`).then(e=>e.json())}catch{return{}}}async function Fu(e){return fetch(`/api/documents/search?q=`+encodeURIComponent(e)).then(e=>e.json())}function Iu(e,t,n){let r={categories:{},children:{}};for(let t of e){let e=r;for(let n of t.folder||[])e.children[n]||(e.children[n]={categories:{},children:{}}),e=e.children[n];e.categories[t.category]||(e.categories[t.category]=[]),e.categories[t.category].push(t)}if(!n)return r;for(let e of t){let t=e.split(`/`).filter(Boolean),n=r;for(let e of t)n.children[e]||(n.children[e]={categories:{},children:{}}),n=n.children[e]}return r}function Lu(e){let t=Object.values(e.categories).reduce((e,t)=>e+t.length,0);for(let n of Object.values(e.children))t+=Lu(n);return t}function Ru(e,t){let n=0;for(let r of Object.values(e.categories))for(let e of r)t[e.id]>0&&(n+=1);for(let r of Object.values(e.children))n+=Ru(r,t);return n}function zu(e,t){let n=0;for(let r of Object.values(e.categories))for(let e of r)t[e.id]>0&&(n+=1);for(let r of Object.values(e.children))n+=zu(r,t);return n}function Bu(e){return e.replace(/^\d+_/,``).replace(/[_-]+/g,` `).replace(/\b\w/g,e=>e.toUpperCase())}function Vu(e){return Object.keys(e.children).sort((e,t)=>e.localeCompare(t))}function Hu(e){return Object.keys(e.categories).filter(e=>e!==`General`).sort((e,t)=>e.localeCompare(t))}function Uu(e){return Object.values(e.categories).flat().sort((e,t)=>(e.filename||``).localeCompare(t.filename||``))}var Wu=W(`<span class="inline-flex items-center justify-center w-5 h-5 rounded-full bg-green-500 text-[10px] font-bold text-white border border-green-600 shadow-sm">V</span>`),Gu=W(`<span class="inline-flex items-center justify-center w-5 h-5 rounded-full bg-orange-500 text-[10px] font-bold text-white border border-orange-600 shadow-sm">S</span>`),Ku=W(`<span class="inline-flex items-center justify-center min-w-[1.25rem] h-5 px-1.5 rounded-full bg-yellow-300 dark:bg-yellow-400 text-[10px] font-bold text-yellow-900 border border-yellow-500 shadow-sm"> </span>`),qu=W(`<span class="inline-flex items-center justify-center min-w-[1.25rem] h-5 px-1.5 rounded-full bg-sky-200 dark:bg-sky-300 text-[10px] font-bold text-sky-900 border border-sky-500 shadow-sm"> </span>`),Ju=W(`<div class="text-xs text-gray-400 dark:text-gray-500 mt-0.5"> </div>`),Yu=W(`<button><div class="leading-snug flex items-center justify-between gap-2"><span class="truncate"> </span> <span class="flex items-center gap-1 shrink-0"><!> <!> <!></span></div> <!></button>`),Xu=W(`<span class="inline-flex items-center justify-center min-w-[1.25rem] h-5 px-1.5 rounded-full bg-orange-400 dark:bg-orange-500 text-[10px] font-bold text-white border border-orange-600 shadow-sm"> </span>`),Zu=W(`<span class="inline-flex items-center justify-center min-w-[1.25rem] h-5 px-1.5 rounded-full bg-slate-400 dark:bg-slate-500 text-[10px] font-bold text-white border border-slate-600 shadow-sm"> </span>`),Qu=W(`<div class="pl-2"></div>`),$u=W(`<div class="mb-0.5"><button class="w-full flex items-center justify-between px-3 py-1.5 text-xs font-semibold text-gray-500 dark:text-gray-400 uppercase tracking-wider hover:bg-gray-50 dark:hover:bg-gray-800/60 rounded-md transition-colors"><span class="flex items-center gap-2"><span> </span> <!> <!></span> <span class="flex items-center gap-1.5"><span class="font-normal normal-case text-gray-400"> </span> <span>▸</span></span></button> <!></div>`),ed=W(`<div class="pl-3"><!></div>`),td=W(`<div class="mb-1"><button class="w-full flex items-center justify-between px-3 py-1.5 text-xs font-semibold text-violet-600 dark:text-violet-400 uppercase tracking-wider hover:bg-gray-50 dark:hover:bg-gray-800/60 rounded-md transition-colors"><span class="flex items-center gap-2 min-w-0"><span class="truncate"> </span> <!> <!></span> <span class="flex items-center gap-1.5"><span class="font-normal normal-case text-gray-400"> </span> <span>▸</span></span></button> <!></div>`),nd=W(`<!> <!>`,1),rd=W(`<!> <!> <!>`,1);function id(e,t){Ge(t,!0);let n=(e,n=f)=>{let r=P(()=>$.annotationCounts[n().id]||0),i=P(()=>$.fileAttachmentCounts[n().id]||0),a=P(()=>c(n()));var o=Yu(),l=R(o),u=R(l),d=R(u,!0);N(u);var p=B(u,2),m=R(p),h=e=>{var t=Wu();V(e=>J(t,`title`,e),[()=>Y(`sidebar.status_to_validate`)]),G(e,t)},g=e=>{var t=Gu();V(e=>J(t,`title`,e),[()=>Y(`sidebar.status_superseeded`)]),G(e,t)};q(m,e=>{H(a)===`V`?e(h):H(a)===`S`&&e(g,1)});var _=B(m,2),v=e=>{var t=Ku(),n=R(t,!0);N(t),V(e=>{J(t,`title`,e),K(n,H(r))},[()=>s(H(r),`sidebar.annotation_badge`)]),G(e,t)};q(_,e=>{H(r)>0&&!$.markerHidden&&e(v)});var y=B(_,2),b=e=>{var t=qu(),n=R(t,!0);N(t),V(e=>{J(t,`title`,e),K(n,H(i))},[()=>s(H(i),`sidebar.file_attachment_badge`)]),G(e,t)};q(y,e=>{H(i)>0&&!$.hideAttachments&&e(b)}),N(p),N(l);var x=B(l,2),S=e=>{var t=Ju(),r=R(t,!0);N(t),V(()=>K(r,n().formattedDate)),G(e,t)};q(x,e=>{n().formattedDate&&e(S)}),N(o),V(()=>{J(o,`id`,`item-${n().id??``}`),hi(o,1,`doc-item w-full text-left px-3 py-1.5 rounded-md text-sm transition-colors text-gray-700 dark:text-gray-300 hover:bg-gray-50 dark:hover:bg-gray-800/60 ${n().id===$.currentDocId?`active`:``}`),K(d,n().title)}),U(`click`,o,()=>t.onopen(n().id)),G(e,o)},r=(e,r=f)=>{let i=P(()=>a(r())),o=P(()=>$.expandedCategories.has(H(i))),c=P(()=>t.node.categories[r()]),l=P(()=>H(c).reduce((e,t)=>e+ +($.annotationCounts[t.id]>0),0)),u=P(()=>H(c).reduce((e,t)=>e+ +($.fileAttachmentCounts[t.id]>0),0));var d=$u(),p=R(d),m=R(p),h=R(m),g=R(h,!0);N(h);var _=B(h,2),v=e=>{var t=Xu(),n=R(t,!0);N(t),V(e=>{J(t,`title`,e),K(n,H(l))},[()=>s(H(l),`sidebar.annotated_docs_badge`)]),G(e,t)};q(_,e=>{H(l)>0&&!$.markerHidden&&e(v)});var y=B(_,2),b=e=>{var t=Zu(),n=R(t,!0);N(t),V(e=>{J(t,`title`,e),K(n,H(u))},[()=>s(H(u),`sidebar.file_attached_docs_badge`)]),G(e,t)};q(y,e=>{H(u)>0&&!$.hideAttachments&&e(b)}),N(m);var x=B(m,2),S=R(x),C=R(S,!0);N(S);var w=B(S,2);N(x),N(p);var T=B(p,2),E=e=>{var t=Qu();$r(t,21,()=>H(c),e=>e.id,(e,t)=>{n(e,()=>H(t))}),N(t),G(e,t)};q(T,e=>{H(o)&&e(E)}),N(d),V(()=>{K(g,r()),K(C,H(c).length),hi(w,1,`transition-transform duration-200 ${H(o)?`rotate-90`:``}`)}),U(`click`,p,()=>$.toggleCategory(H(i))),G(e,d)},i=(e,n=f)=>{let r=P(()=>o(n())),i=P(()=>$.expandedFolders.has(H(r))),a=P(()=>t.node.children[n()]),c=P(()=>Lu(H(a))),l=P(()=>Ru(H(a),$.annotationCounts)),u=P(()=>zu(H(a),$.fileAttachmentCounts));var d=td(),p=R(d),m=R(p),h=R(m),g=R(h);N(h);var _=B(h,2),v=e=>{var t=Xu(),n=R(t,!0);N(t),V(e=>{J(t,`title`,e),K(n,H(l))},[()=>s(H(l),`sidebar.annotated_docs_badge`)]),G(e,t)};q(_,e=>{H(l)>0&&!$.markerHidden&&e(v)});var y=B(_,2),b=e=>{var t=Zu(),n=R(t,!0);N(t),V(e=>{J(t,`title`,e),K(n,H(u))},[()=>s(H(u),`sidebar.file_attached_docs_badge`)]),G(e,t)};q(y,e=>{H(u)>0&&!$.hideAttachments&&e(b)}),N(m);var x=B(m,2),S=R(x),C=R(S,!0);N(S);var w=B(S,2);N(x),N(p);var T=B(p,2),E=e=>{var r=ed(),i=R(r);{let e=P(()=>[...t.folderPath,n()]);id(i,{get node(){return H(a)},get folderPath(){return H(e)},get onopen(){return t.onopen}})}N(r),G(e,r)};q(T,e=>{H(i)&&e(E)}),N(d),V(e=>{J(h,`title`,n()),K(g,`📁 ${e??``}`),K(C,H(c)),hi(w,1,`transition-transform duration-200 ${H(i)?`rotate-90`:``}`)},[()=>Bu(n())]),U(`click`,p,()=>$.toggleFolder(H(r))),G(e,d)};function a(e){return[...t.folderPath,e].join(`|`)}function o(e){return[...t.folderPath,e].join(`|`)}function s(e,t){return`${e} ${Y(t)}${e>1?`s`:``}`}function c(e){if(!$.highlightStatusState)return null;let t=String($.docStatuses[e.id]||``).trim().toLowerCase();return t===`to be validated`?`V`:$.highlightStatusState===2&&t===`superseeded`?`S`:null}var l=Ur(),u=z(l),d=e=>{var r=nd(),a=z(r);$r(a,17,()=>Uu(t.node),e=>e.id,(e,t)=>{n(e,()=>H(t))}),$r(B(a,2),16,()=>Vu(t.node),e=>e,(e,t)=>{i(e,()=>t)}),G(e,r)},p=e=>{var n=rd(),a=z(n),o=e=>{r(e,()=>`General`)};q(a,e=>{t.node.categories.General&&e(o)});var s=B(a,2);$r(s,16,()=>Vu(t.node),e=>e,(e,t)=>{i(e,()=>t)}),$r(B(s,2),16,()=>Hu(t.node),e=>e,(e,t)=>{r(e,()=>t)}),G(e,n)};q(u,e=>{$.hideCategories?e(d):e(p,-1)}),G(e,l),Ke()}Nr([`click`]);var ad=W(`<p class="px-4 py-8 text-sm text-gray-400 text-center"> </p>`),od=W(`<aside><div class="sticky top-0 z-10 bg-white dark:bg-gray-900 p-3 border-b border-gray-100 dark:border-gray-800"><div class="relative sm:hidden"><input type="search" class="w-full pl-8 pr-3 py-1.5 text-sm rounded-lg border border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 text-gray-900 dark:text-gray-100 placeholder:text-gray-400 focus:outline-none focus:ring-2 focus:ring-blue-500"/> <span class="absolute left-2.5 top-2 text-gray-400 text-sm pointer-events-none">🔍</span></div> <div class="flex items-center justify-between mt-2 sm:mt-0"><p class="text-xs text-gray-400 dark:text-gray-500"> </p> <div class="flex items-center gap-2"><button><i class="fa-solid fa-certificate"></i></button> <button><i class="fa-solid fa-paperclip"></i></button> <button><i class="fa-solid fa-tags"></i></button> <button class="text-gray-400 hover:text-blue-500 dark:text-gray-500 dark:hover:text-blue-400 transition-colors leading-none"><i class="fa-solid fa-file-export"></i></button> <button class="text-gray-400 hover:text-blue-500 dark:text-gray-500 dark:hover:text-blue-400 transition-colors leading-none"><i class="fa-solid fa-folder-plus"></i></button> <button class="text-gray-400 hover:text-blue-500 dark:text-gray-500 dark:hover:text-blue-400 transition-colors leading-none"><i class="fa-solid fa-file-circle-plus"></i></button></div></div></div> <nav data-testid="category-tree" class="flex-1 py-2 space-y-0.5"><!></nav> <div aria-hidden="true"></div></aside>`);function sd(e,t){Ge(t,!0);let n=P(()=>Iu($.filteredDocs,$.allFolderPaths,!$.searchQuery)),r=P(()=>$.filteredDocs.length),i=P(()=>$.filteredDocs.length===0&&$.allFolderPaths.length===0),a=`ld-sidebar-w`,o=F(null),s=F(!1),c=F(null);On(()=>{let e=parseInt(localStorage.getItem(a)||``,10);Number.isFinite(e)&&I(o,Math.max(200,Math.min(600,e)),!0)});function l(e){e.preventDefault();let t=e.clientX,n=H(c).getBoundingClientRect().width;I(s,!0),document.body.style.cursor=`col-resize`,document.body.style.userSelect=`none`;let r=e=>{I(o,Math.max(200,Math.min(600,n+e.clientX-t)),!0)},i=()=>{if(document.removeEventListener(`mousemove`,r),document.removeEventListener(`mouseup`,i),document.body.style.cursor=``,document.body.style.userSelect=``,I(s,!1),H(o)!=null)try{localStorage.setItem(a,String(H(o)))}catch{}};document.addEventListener(`mousemove`,r),document.addEventListener(`mouseup`,i)}var u=od(),d=R(u),f=R(d),p=R(f);Ei(p),Pe(2),N(f);var m=B(f,2),h=R(m),g=R(h);N(h);var _=B(h,2),v=R(_),y=B(v,2),b=B(y,2),x=B(b,2),S=B(x,2),C=B(S,2);N(_),N(m),N(d);var w=B(d,2),T=R(w),E=e=>{var t=ad(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`sidebar.no_docs`)]),G(e,t)},D=e=>{id(e,{get node(){return H(n)},folderPath:[],get onopen(){return t.onopen}})};q(T,e=>{H(i)?e(E):e(D,-1)}),N(w);var ee=B(w,2);N(u),Li(u,e=>I(c,e),()=>H(c)),V((e,t,n,i,a,c,l)=>{hi(u,1,`no-print ${H(o)==null?`w-72`:``} shrink-0 flex flex-col border-r border-gray-200 dark:border-gray-800 bg-white dark:bg-gray-900 overflow-y-auto relative`),_i(u,H(o)==null?``:`width:${H(o)}px`),J(p,`placeholder`,e),Di(p,$.searchQuery),K(g,`${H(r)??``} document${H(r)===1?``:`s`}`),J(v,`title`,t),hi(v,1,`hover:opacity-80 transition-colors leading-none ${$.highlightStatusState===0?`text-gray-400 dark:text-gray-500`:$.highlightStatusState===1?`text-green-500 dark:text-green-400`:`text-orange-500 dark:text-orange-400`}`),J(y,`title`,n),hi(y,1,`transition-colors leading-none ${$.hideAttachments?`text-gray-400 dark:text-gray-500`:`text-blue-500 dark:text-blue-400`}`),J(b,`title`,i),hi(b,1,`transition-colors leading-none ${$.hideCategories?`text-gray-400 dark:text-gray-500`:`text-blue-500 dark:text-blue-400`}`),J(x,`title`,a),J(S,`title`,c),J(C,`title`,l),hi(ee,1,`absolute top-0 right-[-2px] w-1.5 h-full cursor-col-resize z-20 select-none transition-colors ${H(s)?`bg-blue-500/55`:`hover:bg-blue-500/35`}`)},[()=>Y(`nav.search_mobile_placeholder`),()=>Y(`nav.toggle_status_highlight`),()=>Y(`nav.toggle_attachments`),()=>Y(`nav.toggle_categories`),()=>Y(`nav.export`),()=>Y(`nav.new_folder`),()=>Y(`nav.new_document`)]),U(`input`,p,e=>t.onsearch(e.target.value)),U(`click`,v,()=>$.cycleHighlightStatus()),U(`click`,y,()=>$.toggleHideAttachments()),U(`click`,b,()=>$.toggleHideCategories()),U(`click`,x,function(...e){t.onexport?.apply(this,e)}),U(`click`,S,function(...e){t.onnewfolder?.apply(this,e)}),U(`click`,C,function(...e){t.onnewdoc?.apply(this,e)}),U(`mousedown`,ee,l),G(e,u),Ke()}Nr([`input`,`click`,`mousedown`]);var cd=`(?:<!--\\s*table-(?:style|border|color):\\s*[a-z][a-z0-9_-]*\\s*-->\\n+){0,3}(?:\\|[^\\n]*\\|\\n)\\|[ \\t:|-]*-[ \\t:|-]*\\|(?:\\n\\|[^\\n]*\\|)*`;function ld(){return cd}var ud=new Set([`compact`,`striped`]),dd=new Set([`bordered`,`borderless`]),fd=new Set([`bordered`,`borderless`]),pd=new Set([`info`,`success`,`warning`,`danger`,`note`]);function md(e){let t=null,n=null,r=null,i=/<!--\s*table-(style|border|color):\s*([a-z][a-z0-9_-]*)\s*-->/g,a;for(;a=i.exec(e||``);){let[,e,i]=a;e===`style`&&ud.has(i)&&(t=i),e===`style`&&fd.has(i)&&(n=i),e===`border`&&dd.has(i)&&(n=i),e===`color`&&pd.has(i)&&(r=i)}return{style:t,border:n,color:r}}function hd(e){let t=typeof e==`string`?e.trim():``,n=RegExp(`^(?:<!--\\s*table-(?:style|border|color):\\s*[a-z][a-z0-9_-]*\\s*-->\\n+){0,3}`);return md(t.match(n)?.[0]||``)}function gd(e){let t=md([e?.style?`<!-- table-style: ${e.style} -->`:``,e?.border?`<!-- table-border: ${e.border} -->`:``,e?.color?`<!-- table-color: ${e.color} -->`:``].filter(Boolean).join(`
11
11
  `)),n=[];return t.style&&n.push(`<!-- table-style: ${t.style} -->`),t.border===`bordered`&&n.push(`<!-- table-border: bordered -->`),t.color&&n.push(`<!-- table-color: ${t.color} -->`),n.join(`
12
12
  `)}function _d(e){return e.trim().split(`|`).slice(1,-1).map(e=>e.trim())}function vd(e){let t=_d(e);return t.length>0&&t.every(e=>/^:?-+:?$/.test(e.replace(/\s+/g,``)))}function yd(e){let t=(typeof e==`string`?e.trim():``).replace(RegExp(`^(?:<!--\\s*table-(?:style|border|color):\\s*[a-z][a-z0-9_-]*\\s*-->\\n+){0,3}`),``).split(`
13
- `).filter(e=>/^\|.*\|$/.test(e.trim()));return t.length>=2&&/^\|.*\|$/.test(t[0].trim())&&vd(t[1])}function bd(e){if(typeof e!=`string`)return[];let t=[],n=RegExp(`((?:<!--\\s*table-(?:style|border|color):\\s*[a-z][a-z0-9_-]*\\s*-->\\n+){0,3})(\\|[^\\n]*\\|\\n\\|[ \\t:|-]*-[ \\t:|-]*\\|)`,`g`),r;for(;r=n.exec(e);)t.push(md(r[1]||``));return t}var xd=`<svg viewBox="0 0 16 16" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="5" width="8" height="9" rx="1.5"/><path d="M3 11V3a1 1 0 0 1 1-1h7"/></svg>`,Sd=`<svg viewBox="0 0 16 16" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><path d="M3 8.5 6.5 12 13 4.5"/></svg>`;function Cd(e,t,n){e.innerHTML=t,wd(e,n.content),Td(e),e.querySelectorAll(`h1, h2, h3, h4, h5, h6`).forEach(e=>{e.id||=(e.textContent||``).toLowerCase().replace(/[^\w\s-]/g,``).trim().replace(/\s+/g,`-`)}),e.querySelectorAll(`pre code.language-mermaid`).forEach(e=>{let t=e.textContent||``,n=document.createElement(`div`);n.className=`mermaid my-4`,n.textContent=t,e.closest(`pre`)?.replaceWith(n)}),window.mermaid&&e.querySelector(`.mermaid`)&&window.mermaid.run({nodes:e.querySelectorAll(`.mermaid`)}),e.querySelectorAll(`pre code`).forEach(e=>{window.hljs?.highlightElement(e)}),Ed(e,n.t),Dd(e,n.codeBlockMaxHeight,n.t),e.querySelectorAll(`a[href]`).forEach(e=>{let t=e.getAttribute(`href`),r=t&&t.match(/[?&]doc=([^&#]+)/);if(!r)return;let i=t.indexOf(`#`),a=i===-1?null:t.slice(i+1);e.addEventListener(`click`,e=>{e.preventDefault(),n.onDocLink(decodeURIComponent(r[1]),a)})}),e.querySelectorAll(`a[href^="#"]`).forEach(e=>{let t=e.getAttribute(`href`);!t||t.length<2||e.addEventListener(`click`,e=>{e.preventDefault(),n.onAnchor(t.slice(1))})}),e.querySelectorAll(`table`).forEach(e=>{let t=document.createElement(`div`);t.className=`overflow-x-auto`,e.parentNode?.insertBefore(t,e),t.appendChild(e)})}function wd(e,t){let n=bd(typeof t==`string`?t:``);e.querySelectorAll(`table`).forEach((e,t)=>{let r=n[t];r&&(r.style&&(e.classList.add(`table-style-${r.style}`),e.dataset.tableStyle=r.style),r.border&&(e.classList.add(`table-border-${r.border}`),e.dataset.tableBorder=r.border),r.color&&(e.classList.add(`table-color-${r.color}`),e.dataset.tableColor=r.color))})}function Td(e){e.querySelectorAll(`table th, table td`).forEach(e=>{(e.textContent||``).trim()===``&&(e.textContent=`\xA0`)})}function Ed(e,t){let n=t(`doc.code_copy`)||`Copy`,r=t(`doc.code_copied`)||`Copied!`;e.querySelectorAll(`pre`).forEach(e=>{let t=e.querySelector(`code`);if(!t||e.querySelector(`.ld-code-copy`))return;let i=document.createElement(`button`);i.type=`button`,i.className=`ld-code-copy`,i.title=n,i.setAttribute(`aria-label`,n),i.innerHTML=xd,i.addEventListener(`click`,async e=>{e.preventDefault(),e.stopPropagation();try{await navigator.clipboard.writeText(t.innerText)}catch{let e=document.createElement(`textarea`);e.value=t.innerText,e.style.position=`fixed`,e.style.opacity=`0`,document.body.appendChild(e),e.select();try{document.execCommand(`copy`)}catch{}document.body.removeChild(e)}i.classList.add(`ld-copied`),i.title=r,i.innerHTML=Sd,setTimeout(()=>{i.classList.remove(`ld-copied`),i.title=n,i.innerHTML=xd},1500)}),e.appendChild(i)})}function Dd(e,t,n){if(typeof t!=`number`||t<=0)return;let r=n(`doc.code_show_more`)||`▾ Show more`,i=n(`doc.code_show_less`)||`▴ Show less`;e.querySelectorAll(`pre`).forEach(e=>{if(!e.querySelector(`code`)||e.scrollHeight<=t+8)return;e.classList.add(`ld-collapsible`);let n=document.createElement(`button`);n.type=`button`,n.className=`ld-code-toggle`,n.textContent=r,n.addEventListener(`click`,t=>{t.preventDefault(),n.textContent=e.classList.toggle(`ld-expanded`)?i:r}),e.appendChild(n)})}var Od=`background:rgba(250,204,21,0.5);border-radius:2px;cursor:pointer;padding:0 1px;`;function kd(e,t,n){e.querySelectorAll(`mark[data-annotation-id]`).forEach(e=>{let t=e.parentNode;t.replaceChild(document.createTextNode(e.textContent||``),e),t.normalize()});for(let n of t)jd(e,n);e.querySelectorAll(`mark[data-annotation-id]`).forEach(e=>{(e.textContent||``).trim()||e.remove()}),n&&Ad(e,!1)}function Ad(e,t){e.querySelectorAll(`mark[data-annotation-id]`).forEach(e=>{let n=e;n.style.background=t?`rgba(250,204,21,0.5)`:`transparent`,n.style.cursor=t?`pointer`:`default`,n.style.pointerEvents=t?`auto`:`none`})}function jd(e,t){let n=(t.selectedText||``).replace(/\s+/g,` `).trim(),r=(t.contextBefore||``).replace(/\s+/g,` `).trim(),i=(t.contextAfter||``).replace(/\s+/g,` `).trim();if(!n)return;let a=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),o=e=>e.split(/\s+/).filter(Boolean).map(a).join(`\\s+`),s=e.textContent||``,c=o(n),l=null;if(r||i){let e=(r?o(r)+`\\s*`:``)+`(`+c+`)`+(i?`\\s*`+o(i):``);try{l=new RegExp(e,`d`).exec(s)}catch{}}if(!l)try{l=RegExp(`(`+c+`)`,`d`).exec(s)}catch{return}let u=l&&l.indices;if(!l||!u||!u[1])return;let[d,f]=u[1],p=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),m=[],h=0;for(;p.nextNode();){let e=p.currentNode,t=e.nodeValue.length,n=h,r=h+t;if(h=r,r<=d)continue;if(n>=f)break;let i=Math.max(0,d-n),a=Math.min(t,f-n);i<a&&m.push({node:e,start:i,end:a})}for(let{node:e,start:n,end:r}of m){let i=e;n>0&&n<i.nodeValue.length&&(i=i.splitText(n));let a=r-n;a>0&&a<i.nodeValue.length&&i.splitText(a);let o=document.createElement(`mark`);o.setAttribute(`data-annotation-id`,t.id),o.setAttribute(`style`,Od),i.parentNode.insertBefore(o,i),o.appendChild(i)}}var Md=W(`<div class="fixed z-50 w-80 bg-yellow-50 dark:bg-yellow-900/80 border-2 border-yellow-300 dark:border-yellow-600 rounded-xl shadow-2xl p-4 flex flex-col gap-3"><div class="text-xs font-semibold text-yellow-700 dark:text-yellow-300 flex items-center gap-2"><span>✎</span><span> </span></div> <div class="text-xs text-yellow-800 dark:text-yellow-200 bg-yellow-100 dark:bg-yellow-800/50 rounded px-2 py-1 italic max-h-16 overflow-y-auto border border-yellow-200 dark:border-yellow-700"> </div> <textarea rows="4" class="w-full text-sm rounded-lg border border-yellow-300 dark:border-yellow-600 bg-white dark:bg-yellow-950 text-gray-900 dark:text-gray-100 px-3 py-2 focus:outline-none focus:ring-2 focus:ring-yellow-400 resize-none"></textarea> <div class="flex justify-end gap-2"><button class="text-sm px-3 py-1.5 rounded-lg border border-yellow-300 dark:border-yellow-600 text-yellow-700 dark:text-yellow-300 hover:bg-yellow-100 dark:hover:bg-yellow-800 transition-colors"> </button> <button class="text-sm px-4 py-1.5 rounded-lg bg-yellow-400 hover:bg-yellow-500 dark:bg-yellow-600 dark:hover:bg-yellow-500 text-yellow-900 dark:text-white font-semibold transition-colors"> </button></div></div>`),Nd=W(`<div class="text-xs font-semibold text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-700 rounded px-2 py-1"> </div>`),Pd=W(`<div class="fixed z-50 w-80 bg-yellow-50 dark:bg-yellow-900/80 border-2 border-yellow-300 dark:border-yellow-600 rounded-xl shadow-2xl p-4 flex flex-col gap-2"><div class="text-xs font-semibold text-yellow-700 dark:text-yellow-300 flex items-center gap-2"><span>✎</span><span class="font-normal text-yellow-600 dark:text-yellow-400"> </span></div> <!> <div class="text-sm text-gray-800 dark:text-gray-100 whitespace-pre-wrap max-h-48 overflow-y-auto"> </div> <div class="flex justify-end pt-1 border-t border-yellow-200 dark:border-yellow-700"><button class="text-xs px-3 py-1.5 rounded-lg border border-red-200 dark:border-red-700 text-red-500 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/40 transition-colors flex items-center gap-1"> </button></div></div>`),Fd=W(`<div class="fixed z-50 w-72 bg-white dark:bg-gray-900 border border-red-200 dark:border-red-700 rounded-xl shadow-2xl p-4 flex flex-col gap-3"><p class="text-sm text-gray-700 dark:text-gray-200"> </p> <div class="flex justify-end gap-2"><button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-1.5 rounded-lg bg-red-500 hover:bg-red-600 text-white font-semibold transition-colors"> </button></div></div>`),Id=W(`<button> </button>`),Ld=W(`<div class="fixed top-14 right-0 w-10 flex flex-col items-center py-2 gap-2 z-40 overflow-y-auto" style="max-height: calc(100vh - 3.5rem)"></div>`),Rd=W(`<!> <!> <!> <!>`,1);function zd(e,t){Ge(t,!0);let n=F(L([])),r=F(null),i=F(``),a=F(null),o=F(null),s=F(L([])),c=null;function l(e,t,n=320,r=260){let i=window.innerWidth,a=window.innerHeight,o=e;return o+n>i-16&&(o=i-n-16),o<8&&(o=8),{x:o,y:Math.min(t,a-r)}}async function u(e){I(n,[],!0);try{I(n,await fetch(`/api/annotations/`+encodeURIComponent(e)).then(e=>e.json()),!0)}catch{I(n,[],!0)}d()}function d(){t.contentEl&&(kd(t.contentEl,H(n),$.markerHidden),f())}On(()=>{t.contentEl&&Ad(t.contentEl,!$.markerHidden)});function f(){if(!t.contentEl){I(s,[],!0);return}I(s,H(n).map(e=>({id:e.id,note:e.note.length>60?e.note.slice(0,60)+`…`:e.note,orphan:!t.contentEl.querySelector(`mark[data-annotation-id="${e.id}"]`)})),!0)}function p(){if(!$.markerActive||H(r)||!t.contentEl)return;let e=window.getSelection();if(!e||e.isCollapsed||!e.toString().trim()||!t.contentEl.contains(e.anchorNode))return;let n=e.getRangeAt(0),a=document.createRange();a.selectNodeContents(t.contentEl),a.setEnd(n.startContainer,n.startOffset);let o=a.toString().length,s=n.toString(),c=t.contentEl.textContent||``,u=e=>e.replace(/\s+/g,` `).trim(),d=u(s),f=u(c.slice(Math.max(0,o-30),o)),p=u(c.slice(o+s.length,o+s.length+30)),m=n.getBoundingClientRect(),h=l(m.left,m.bottom+8);I(r,{x:h.x,y:h.y,preview:d.length>120?d.slice(0,120)+`…`:d,selectedText:d,contextBefore:f,contextAfter:p},!0),I(i,``)}function m(){I(r,null),window.getSelection()?.removeAllRanges()}async function h(){if(!H(r)||!t.docId)return;let e=H(i).trim();if(e)try{let i=await fetch(`/api/annotations/`+encodeURIComponent(t.docId),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({selectedText:H(r).selectedText,contextBefore:H(r).contextBefore,contextAfter:H(r).contextAfter,note:e})}).then(e=>e.json());I(n,[...H(n),i],!0),m(),d(),$.annotationCounts={...$.annotationCounts,[t.docId]:($.annotationCounts[t.docId]||0)+1}}catch{}}On(()=>{if(!t.contentEl)return;let e=t.contentEl,r=e=>{let t=e.target.closest(`mark[data-annotation-id]`);if(!t)return;let r=H(n).find(e=>e.id===t.dataset.annotationId);r&&g(r,t)},i=e=>{let t=e;t.target.closest(`mark[data-annotation-id]`)&&(t.relatedTarget&&t.relatedTarget.closest?.(`mark[data-annotation-id]`)||_())};return e.addEventListener(`mouseover`,r),e.addEventListener(`mouseout`,i),()=>{e.removeEventListener(`mouseover`,r),e.removeEventListener(`mouseout`,i)}});function g(e,n){c&&clearTimeout(c);let r=!t.contentEl?.querySelector(`mark[data-annotation-id="${e.id}"]`),i=n.getBoundingClientRect(),o=l(i.left,i.bottom+8);I(a,{ann:e,x:o.x,y:o.y,orphan:r},!0)}function _(){c=window.setTimeout(()=>{I(a,null)},300)}function v(){H(a)&&(I(o,{id:H(a).ann.id,x:H(a).x,y:H(a).y},!0),I(a,null))}async function y(){if(!H(o)||!t.docId)return;let e=H(o).id;try{await fetch(`/api/annotations/${encodeURIComponent(t.docId)}/${e}`,{method:`DELETE`}),I(n,H(n).filter(t=>t.id!==e),!0),I(o,null),d();let r=($.annotationCounts[t.docId]||0)-1,i={...$.annotationCounts};r<=0?delete i[t.docId]:i[t.docId]=r,$.annotationCounts=i}catch{}}function b(e,t){return e.getBoundingClientRect().top+t.scrollTop-t.getBoundingClientRect().top}function x(e,r){let i=t.contentEl?.querySelector(`mark[data-annotation-id="${e}"]`),a=document.getElementById(`home-content-area`);if(i&&a)a.scrollTo({top:b(i,a)-120,behavior:`smooth`});else{let t=H(n).find(t=>t.id===e);t&&g(t,r.currentTarget)}}function S(e,r){c&&clearTimeout(c);let i=H(n).find(t=>t.id===e);if(!i)return;let a=t.contentEl?.querySelector(`mark[data-annotation-id="${e}"]`),o=document.getElementById(`home-content-area`);if(!a||!o){g(i,r.currentTarget);return}o.scrollTo({top:b(a,o)-o.clientHeight/2,behavior:`smooth`});let s,l=()=>{clearTimeout(s),s=window.setTimeout(()=>{o.removeEventListener(`scroll`,l),g(i,a)},80)};o.addEventListener(`scroll`,l),s=window.setTimeout(()=>{o.removeEventListener(`scroll`,l),g(i,a)},600)}function C(e){let t=H(a)?.ann.id===e.id;return e.orphan?t?`#b91c1c`:`#ef4444`:t?`#f97316`:`#facc15`}function w(e){return new Date(e).toLocaleDateString(`fr-FR`,{day:`2-digit`,month:`short`,year:`numeric`})}var T={load:u,apply:d},E=Rd();Mr(`mouseup`,an,p);var D=z(E),ee=e=>{var t=Md(),n=R(t),a=B(R(n)),o=R(a,!0);N(a),N(n);var s=B(n,2),c=R(s,!0);N(s);var l=B(s,2);vn(l),_n(l,!0);var u=B(l,2),d=R(u),f=R(d,!0);N(d);var p=B(d,2),g=R(p,!0);N(p),N(u),N(t),V((e,n,i,a)=>{_i(t,`left:${H(r).x??``}px;top:${H(r).y??``}px`),K(o,e),K(c,H(r).preview),J(l,`placeholder`,n),K(f,i),K(g,a)},[()=>Y(`annotation.title`),()=>Y(`annotation.placeholder`),()=>Y(`common.cancel`),()=>Y(`annotation.save_btn`)]),Mi(l,()=>H(i),e=>I(i,e)),U(`click`,d,m),U(`click`,p,h),G(e,t)};q(D,e=>{H(r)&&e(ee)});var O=B(D,2),te=e=>{var t=Pd(),n=R(t),r=B(R(n)),i=R(r,!0);N(r),N(n);var o=B(n,2),s=e=>{var t=Nd(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`annotation.orphan`)]),G(e,t)};q(o,e=>{H(a).orphan&&e(s)});var l=B(o,2),u=R(l,!0);N(l);var d=B(l,2),f=R(d),p=R(f,!0);N(f),N(d),N(t),V((e,n)=>{_i(t,`left:${H(a).x??``}px;top:${H(a).y??``}px`),K(i,e),K(u,H(a).ann.note),K(p,n)},[()=>w(H(a).ann.createdAt),()=>Y(`annotation.delete_btn`)]),Mr(`mouseenter`,t,()=>{c&&clearTimeout(c)}),Mr(`mouseleave`,t,_),U(`click`,f,v),G(e,t)};q(O,e=>{H(a)&&e(te)});var k=B(O,2),ne=e=>{var t=Fd(),n=R(t),r=R(n,!0);N(n);var i=B(n,2),a=R(i),s=R(a,!0);N(a);var c=B(a,2),l=R(c,!0);N(c),N(i),N(t),V((e,n,i)=>{_i(t,`left:${H(o).x??``}px;top:${H(o).y??``}px`),K(r,e),K(s,n),K(l,i)},[()=>Y(`annotation.confirm_delete`),()=>Y(`common.cancel`),()=>Y(`annotation.confirm_btn`)]),U(`click`,a,()=>I(o,null)),U(`click`,c,y),G(e,t)};q(k,e=>{H(o)&&e(ne)});var re=B(k,2),ie=e=>{var t=Ld();$r(t,21,()=>H(s),e=>e.id,(e,t)=>{var n=Id(),r=R(n,!0);N(n),V((e,i)=>{J(n,`title`,e),hi(n,1,`w-8 h-8 rounded border-2 shadow text-xs flex items-center justify-center transition-colors shrink-0 ${H(t).orphan?`border-red-600 text-white`:`border-yellow-500`}`),_i(n,`background:${i??``}`),K(r,H(t).orphan?`⚠`:`✎`)},[()=>H(t).orphan?`${Y(`annotation.orphan`)}\n\n${H(t).note}`:H(t).note,()=>C(H(t))]),U(`click`,n,e=>x(H(t).id,e)),Mr(`mouseenter`,n,e=>S(H(t).id,e)),Mr(`mouseleave`,n,_),G(e,n)}),N(t),G(e,t)};return q(re,e=>{H(s).length>0&&!$.markerHidden&&e(ie)}),G(e,E),Ke(T)}Nr([`click`]);var Bd=`#dc2626`,Vd=`#eab308`,Hd=`#16a34a`;function Ud(e){let t=Math.max(0,Math.min(1,e))*100;return t>80?Hd:t>=60?Vd:t>=40?`#f97316`:Bd}function Wd(e){let t=Math.max(0,Math.min(1,e))*100;return t>=100?Hd:t<30?Bd:t<60?`linear-gradient(to right, ${Bd} 0%, ${Bd} 60%, ${Vd} 100%)`:t<80?`linear-gradient(to right, ${Bd} 0%, ${Vd} 40%, ${Vd} 100%)`:`linear-gradient(to right, ${Vd} 0%, ${Hd} 40%, ${Hd} 100%)`}var Gd=new class{#e;get report(){return H(this.#e)}set report(e){I(this.#e,e,!0)}constructor(){this.#e=F(null)}async load(e){if(!e)return this.report=null,null;try{let t=await fetch(`/api/metadata/`+encodeURIComponent(e));if(!t.ok)throw Error(t.statusText);this.report=await t.json()}catch{this.report=null}return this.report}async refresh(e){let t=await fetch(`/api/metadata/`+encodeURIComponent(e)+`/refresh`,{method:`POST`});if(!t.ok)throw Error(t.statusText);this.report=await t.json()}async addPath(e,t){let n=await fetch(`/api/metadata/`+encodeURIComponent(e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error||n.statusText)}this.report=await n.json()}async removePath(e,t){let n=await fetch(`/api/metadata/`+encodeURIComponent(e),{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t})});if(!n.ok)throw Error(n.statusText);this.report=await n.json()}},Kd=W(`<div data-testid="accuracy-gauge" class="no-print mt-5 flex items-center gap-3 mr-auto w-full sm:w-80 cursor-pointer select-none"><span class="text-xs text-gray-500 dark:text-gray-400 shrink-0"> </span> <div class="flex-1 h-4 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden"><div class="h-full w-full transition-all"></div></div> <span data-testid="accuracy-gauge-value" class="text-xs font-semibold shrink-0 tabular-nums"> </span></div>`);function qd(e,t){Ge(t,!0);let n=P(()=>Gd.report),r=P(()=>H(n)?Math.round(H(n).accuracy*100):0),i=P(()=>H(n)?Y(`accuracy.tooltip`).replace(`{unchanged}`,String(H(n).unchanged)).replace(`{modified}`,String(H(n).modified)).replace(`{missing}`,String(H(n).missing)).replace(`{total}`,String(H(n).total)):``);var a=Ur(),o=z(a),s=e=>{var a=Kd(),o=R(a),s=R(o,!0);N(o);var c=B(o,2),l=R(c);N(c);var u=B(c,2),d=R(u);N(u),N(a),V((e,t,n)=>{J(a,`title`,H(i)),K(s,e),_i(l,`background:${t??``}`),_i(u,`color:${n??``}`),K(d,`${H(r)??``}%`)},[()=>Y(`accuracy.label`),()=>Wd(H(n).accuracy),()=>Ud(H(n).accuracy)]),U(`click`,a,function(...e){t.onopen?.apply(this,e)}),G(e,a)};q(o,e=>{H(n)&&H(n).total>0&&e(s)}),G(e,a),Ke()}Nr([`click`]);var Jd=/^(\s*(?:\*\*status:\*\*|status:)\s*).+?\s*$/im;function Yd(e){if(typeof e!=`string`)return null;let t=e.match(/^---\s*\n([\s\S]*?)\n---/);if(!t)return null;let n=t[1].match(/^\s*(?:\*\*status:\*\*|status:)\s*(.+?)\s*$/im);return n?n[1].trim():null}function Xd(e,t){return e.replace(Jd,`$1${t}`)}function Zd(e){return/%5BWORKLOG%5D/i.test(e)}var Qd=W(`<div data-testid="metadata-readonly-banner" class="text-xs text-amber-800 dark:text-amber-200 bg-amber-50 dark:bg-amber-900/30 border-l-4 border-amber-500 rounded-r px-3 py-2"> </div>`),$d=W(`<div class="px-3 py-4 text-center text-xs text-gray-400"> </div>`),ef=W(`<span class="inline-flex items-center gap-1 text-xs font-semibold px-2 py-0.5 rounded-full bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300"><i class="fa-solid fa-check"></i> </span>`),tf=W(`<span class="inline-flex items-center gap-1 text-xs font-semibold px-2 py-0.5 rounded-full bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300"><i class="fa-solid fa-triangle-exclamation"></i> </span>`),nf=W(`<span class="inline-flex items-center gap-1 text-xs font-semibold px-2 py-0.5 rounded-full bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300"><i class="fa-solid fa-circle-xmark"></i> </span>`),rf=W(`<button class="metadata-row-remove text-xs px-2 py-1 rounded-lg border border-red-200 dark:border-red-700 text-red-500 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/40 transition-colors"><i class="fa-solid fa-trash"></i></button>`),af=W(`<div class="flex items-center gap-2 px-3 py-2 border-b border-gray-100 dark:border-gray-800"><div class="flex-1 min-w-0"><div class="text-sm font-mono truncate text-gray-800 dark:text-gray-200"> </div></div> <!> <!></div>`),of=W(`<div class="flex items-center gap-2 flex-wrap"><button data-testid="metadata-add-btn" class="text-sm px-3 py-1.5 rounded-lg border border-blue-200 dark:border-blue-700 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/30 transition-colors"><i class="fa-solid fa-plus"></i> </button> <button data-testid="metadata-refresh-btn" class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"><i class="fa-solid fa-arrows-rotate"></i> </button></div>`),sf=W(`<div class="px-3 py-2 text-xs text-gray-400"> </div>`),cf=W(`<div class="px-3 py-2 text-xs text-red-500"> </div>`),lf=W(`<button class="w-full text-left px-3 py-1.5 text-sm hover:bg-gray-50 dark:hover:bg-gray-800 flex items-center gap-2"><i class="fa-solid fa-folder text-yellow-500"></i> <span class="truncate"> </span></button>`),uf=W(`<button class="w-full text-left px-3 py-1.5 text-sm hover:bg-blue-50 dark:hover:bg-blue-900/30 flex items-center gap-2"><i class="fa-solid fa-file text-gray-400"></i> <span class="truncate"> </span> <i class="fa-solid fa-plus ml-auto text-blue-500 text-xs"></i></button>`),df=W(`<!> <!>`,1),ff=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-56 overflow-y-auto divide-y divide-gray-100 dark:divide-gray-800"><!></div></div>`),pf=W(`<p class="text-xs text-red-500"> </p>`),mf=W(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50"><div data-testid="metadata-modal" class="bg-white dark:bg-gray-900 rounded-xl shadow-xl w-full max-w-2xl mx-4 p-6 space-y-4"><div class="flex items-start justify-between gap-4"><div><h3 class="text-base font-semibold text-gray-900 dark:text-gray-50"><i class="fa-solid fa-code-compare mr-1"></i> </h3> <p class="text-xs text-gray-500 dark:text-gray-400 mt-1"> </p></div> <button class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 transition-colors"><i class="fa-solid fa-xmark text-lg"></i></button></div> <div class="text-xs text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-800 rounded-lg px-3 py-2"></div> <!> <div data-testid="metadata-list" class="border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden"><div class="max-h-64 overflow-y-auto"><!></div></div> <!> <!> <!> <div class="flex justify-end"><button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button></div></div></div>`);function hf(e,t){Ge(t,!0);let n=P(()=>Gd.report),r=P(()=>Yd(t.content)===`SuperSeeded`),i=F(``),a=F(!1),o=F(!1),s=F(``),c=F(null),l=F(L([])),u=F(L([])),d=F(!1),f=F(``);On(()=>{t.open||(I(o,!1),I(s,``),I(i,``))});function p(e){I(i,Y(`common.error_prefix`)+e),setTimeout(()=>{I(i,``)},5e3)}function m(){return!H(n)||H(n).total===0?``:`<span class="font-semibold">${Math.round(H(n).accuracy*100)}%</span> · ${H(n).unchanged}/${H(n).total} ${Y(`metadata.status.unchanged`)} · ${H(n).modified} ${Y(`metadata.status.modified`)} · ${H(n).missing} ${Y(`metadata.status.missing`)}`}async function h(){I(a,!0);try{await Gd.refresh(t.docId)}catch(e){p(e instanceof Error?e.message:String(e))}finally{I(a,!1)}}async function g(e){try{await Gd.removePath(t.docId,e),H(o)&&y(H(s))}catch(e){p(e instanceof Error?e.message:String(e))}}async function _(e){try{await Gd.addPath(t.docId,e),H(o)&&y(H(s))}catch(e){p(e instanceof Error?e.message:String(e))}}function v(){I(o,!H(o)),H(o)&&y(``)}async function y(e){I(d,!0),I(f,``);try{let t=await fetch(`/api/browse-source?path=`+encodeURIComponent(e||``));if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error||t.statusText)}let r=await t.json();I(s,r.current||``,!0),I(c,r.parent,!0),I(l,r.dirs||[],!0);let i=new Set((H(n)?.items||[]).map(e=>e.path));I(u,(r.files||[]).filter(e=>!i.has(e.path)),!0)}catch(e){I(f,e instanceof Error?e.message:String(e),!0)}finally{I(d,!1)}}function b(){H(c)!==null&&y(H(c))}var x=Ur(),S=z(x),C=e=>{var p=mf(),x=R(p),S=R(x),C=R(S),w=R(C),T=B(R(w));N(w);var E=B(w,2),D=R(E,!0);N(E),N(C);var ee=B(C,2);N(S);var O=B(S,2);ai(O,m,!0),N(O);var te=B(O,2),k=e=>{var t=Qd(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`metadata.readonly_banner`)]),G(e,t)};q(te,e=>{H(r)&&e(k)});var ne=B(te,2),re=R(ne),ie=R(re),ae=e=>{var t=$d(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`metadata.empty`)]),G(e,t)},oe=e=>{var t=Ur();$r(z(t),17,()=>H(n).items,e=>e.path,(e,t)=>{var n=af(),i=R(n),a=R(i),o=R(a,!0);N(a),N(i);var s=B(i,2),c=e=>{var t=ef(),n=B(R(t));N(t),V(e=>K(n,` ${e??``}`),[()=>Y(`metadata.status.unchanged`)]),G(e,t)},l=e=>{var t=tf(),n=B(R(t));N(t),V(e=>K(n,` ${e??``}`),[()=>Y(`metadata.status.modified`)]),G(e,t)},u=e=>{var t=nf(),n=B(R(t));N(t),V(e=>K(n,` ${e??``}`),[()=>Y(`metadata.status.missing`)]),G(e,t)};q(s,e=>{H(t).status===`unchanged`?e(c):H(t).status===`modified`?e(l,1):e(u,-1)});var d=B(s,2),f=e=>{var n=rf();V(e=>J(n,`title`,e),[()=>Y(`metadata.remove`)]),U(`click`,n,()=>g(H(t).path)),G(e,n)};q(d,e=>{H(r)||e(f)}),N(n),V(()=>{J(a,`title`,H(t).path),K(o,H(t).path)}),G(e,n)}),G(e,t)};q(ie,e=>{!H(n)||H(n).items.length===0?e(ae):e(oe,-1)}),N(re),N(ne);var se=B(ne,2),ce=e=>{var t=of(),n=R(t),r=B(R(n));N(n);var i=B(n,2),o=B(R(i));N(i),N(t),V((e,t)=>{K(r,` ${e??``}`),i.disabled=H(a),K(o,` ${t??``}`)},[()=>Y(`metadata.add`),()=>Y(`metadata.refresh`)]),U(`click`,n,v),U(`click`,i,h),G(e,t)};q(se,e=>{H(r)||e(ce)});var le=B(se,2),ue=e=>{var t=ff(),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 p=B(n,2),m=R(p),h=e=>{var t=sf(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.loading`)]),G(e,t)},g=e=>{var t=cf(),n=R(t,!0);N(t),V(()=>K(n,H(f))),G(e,t)},v=e=>{var t=sf(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.empty_dir`)]),G(e,t)},x=e=>{var t=df(),n=z(t);$r(n,17,()=>H(l),e=>e.path,(e,t)=>{var n=lf(),r=B(R(n),2),i=R(r,!0);N(r),N(n),V(()=>K(i,H(t).name)),U(`click`,n,()=>y(H(t).path)),G(e,n)}),$r(B(n,2),17,()=>H(u),e=>e.path,(e,t)=>{var n=uf(),r=B(R(n),2),i=R(r,!0);N(r),Pe(2),N(n),V(()=>K(i,H(t).name)),U(`click`,n,()=>_(H(t).path)),G(e,n)}),G(e,t)};q(m,e=>{H(d)?e(h):H(f)?e(g,1):H(l).length===0&&H(u).length===0?e(v,2):e(x,-1)}),N(p),N(t),V(e=>{r.disabled=H(c)===null,K(i,e),K(o,H(s)?`/`+H(s):`/ (sourceRoot)`)},[()=>Y(`common.up`)]),U(`click`,r,b),G(e,t)};q(le,e=>{H(o)&&e(ue)});var de=B(le,2),fe=e=>{var t=pf(),n=R(t,!0);N(t),V(()=>K(n,H(i))),G(e,t)};q(de,e=>{H(i)&&e(fe)});var pe=B(de,2),me=R(pe),he=R(me,!0);N(me),N(pe),N(x),N(p),V((e,t,n,r)=>{K(T,` ${e??``}`),K(D,t),J(ee,`title`,n),K(he,r)},[()=>Y(`metadata.title`),()=>Y(`metadata.subtitle`),()=>Y(`common.close`),()=>Y(`common.close`)]),U(`click`,p,e=>{e.target===e.currentTarget&&t.onclose()}),U(`click`,ee,function(...e){t.onclose?.apply(this,e)}),U(`click`,me,function(...e){t.onclose?.apply(this,e)}),G(e,p)};q(S,e=>{t.open&&e(C)}),G(e,x),Ke()}Nr([`click`]);var gf=[`heading`,`collapsible`,`link`,`doc-link`,`anchor-link`,`anchor-doc-link`,`ordered-list`,`unordered-list`,`code-block`,`blockquote`,`image`,`table`,`tree`,`diagram`,`colored-section`,`colored-text`,`emojis`,`attachment`],_f={"heading-1":`heading`,"heading-2":`heading`,"heading-3":`heading`,"heading-4":`heading`};function vf(e){return _f[e]||e}var yf={"heading-1":`fa-solid fa-heading`,"heading-2":`fa-solid fa-heading`,"heading-3":`fa-solid fa-heading`,"heading-4":`fa-solid fa-heading`,separator:`fa-solid fa-minus`,collapsible:`fa-solid fa-caret-right`,"unordered-list":`fa-solid fa-list-ul`,"ordered-list":`fa-solid fa-list-ol`,tree:`fa-solid fa-folder-tree`,"colored-text":`fa-solid fa-highlighter`,"colored-section":`fa-solid fa-fill-drip`,blockquote:`fa-solid fa-quote-right`,"code-block":`fa-solid fa-code`,table:`fa-solid fa-table-cells`,link:`fa-solid fa-link`,"doc-link":`fa-solid fa-file-lines`,"anchor-link":`fa-solid fa-anchor`,"anchor-doc-link":`fa-solid fa-anchor`,image:`fa-solid fa-image`,diagram:`fa-solid fa-diagram-project`,emojis:`fa-solid fa-face-smile`,attachment:`fa-solid fa-paperclip`,"local-search":`fa-solid fa-magnifying-glass`},bf=[{key:`structure`,labelKey:`snippet.picker_cat_structure`,types:[`heading-1`,`heading-2`,`heading-3`,`heading-4`,`separator`,`collapsible`]},{key:`lists-code-data`,labelKey:`snippet.picker_cat_lists_code_data`,types:[`unordered-list`,`ordered-list`,`tree`,`code-block`,`table`,`diagram`]},{key:`rich-text`,labelKey:`snippet.picker_cat_rich_text`,types:[`colored-text`,`colored-section`,`blockquote`,`emojis`,`local-search`]},{key:`links-media`,labelKey:`snippet.picker_cat_links_media`,types:[`link`,`doc-link`,`anchor-link`,`anchor-doc-link`,`image`,`attachment`]}],xf={blueLight:{card:`border-sky-200 dark:border-sky-800 bg-sky-50 dark:bg-sky-950/40 hover:bg-sky-100 dark:hover:bg-sky-900/50 hover:border-sky-300 dark:hover:border-sky-700`,icon:`text-sky-700 dark:text-sky-300`},blue:{card:`border-blue-200 dark:border-blue-800 bg-blue-50 dark:bg-blue-950/40 hover:bg-blue-100 dark:hover:bg-blue-900/50 hover:border-blue-300 dark:hover:border-blue-700`,icon:`text-blue-700 dark:text-blue-300`},blueDark:{card:`border-indigo-200 dark:border-indigo-800 bg-indigo-50 dark:bg-indigo-950/40 hover:bg-indigo-100 dark:hover:bg-indigo-900/50 hover:border-indigo-300 dark:hover:border-indigo-700`,icon:`text-indigo-700 dark:text-indigo-300`},blueDarker:{card:`border-blue-300 dark:border-blue-700 bg-blue-100 dark:bg-blue-900/50 hover:bg-blue-200 dark:hover:bg-blue-800/60 hover:border-blue-400 dark:hover:border-blue-600`,icon:`text-blue-900 dark:text-blue-100`},gray:{card:`border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 hover:border-gray-300 dark:hover:border-gray-600`,icon:`text-gray-700 dark:text-gray-200`},violet:{card:`border-violet-200 dark:border-violet-800 bg-violet-50 dark:bg-violet-950/40 hover:bg-violet-100 dark:hover:bg-violet-900/50 hover:border-violet-300 dark:hover:border-violet-700`,icon:`text-violet-700 dark:text-violet-300`},green:{card:`border-emerald-200 dark:border-emerald-800 bg-emerald-50 dark:bg-emerald-950/40 hover:bg-emerald-100 dark:hover:bg-emerald-900/50 hover:border-emerald-300 dark:hover:border-emerald-700`,icon:`text-emerald-700 dark:text-emerald-300`},greenDark:{card:`border-green-300 dark:border-green-700 bg-green-100 dark:bg-green-900/50 hover:bg-green-200 dark:hover:bg-green-800/60 hover:border-green-400 dark:hover:border-green-600`,icon:`text-green-900 dark:text-green-100`},teal:{card:`border-teal-200 dark:border-teal-800 bg-teal-50 dark:bg-teal-950/40 hover:bg-teal-100 dark:hover:bg-teal-900/50 hover:border-teal-300 dark:hover:border-teal-700`,icon:`text-teal-700 dark:text-teal-300`},dark:{card:`border-slate-300 dark:border-slate-600 bg-slate-100 dark:bg-slate-800 hover:bg-slate-200 dark:hover:bg-slate-700 hover:border-slate-400 dark:hover:border-slate-500`,icon:`text-slate-900 dark:text-slate-100`},orange:{card:`border-orange-200 dark:border-orange-800 bg-orange-50 dark:bg-orange-950/40 hover:bg-orange-100 dark:hover:bg-orange-900/50 hover:border-orange-300 dark:hover:border-orange-700`,icon:`text-orange-700 dark:text-orange-300`},orangeLight:{card:`border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/40 hover:bg-amber-100 dark:hover:bg-amber-900/50 hover:border-amber-300 dark:hover:border-amber-700`,icon:`text-amber-700 dark:text-amber-300`},orangeDark:{card:`border-orange-300 dark:border-orange-700 bg-orange-100 dark:bg-orange-900/50 hover:bg-orange-200 dark:hover:bg-orange-800/60 hover:border-orange-400 dark:hover:border-orange-600`,icon:`text-orange-900 dark:text-orange-100`},red:{card:`border-red-200 dark:border-red-800 bg-red-50 dark:bg-red-950/40 hover:bg-red-100 dark:hover:bg-red-900/50 hover:border-red-300 dark:hover:border-red-700`,icon:`text-red-700 dark:text-red-300`},pink:{card:`border-pink-200 dark:border-pink-800 bg-pink-50 dark:bg-pink-950/40 hover:bg-pink-100 dark:hover:bg-pink-900/50 hover:border-pink-300 dark:hover:border-pink-700`,icon:`text-pink-700 dark:text-pink-300`},amber:{card:`border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/40 hover:bg-amber-100 dark:hover:bg-amber-900/50 hover:border-amber-300 dark:hover:border-amber-700`,icon:`text-amber-700 dark:text-amber-300`},yellow:{card:`border-yellow-300 dark:border-yellow-700 bg-yellow-100 dark:bg-yellow-900/50 hover:bg-yellow-200 dark:hover:bg-yellow-800/60 hover:border-yellow-400 dark:hover:border-yellow-600`,icon:`text-yellow-700 dark:text-yellow-200`},indigo:{card:`border-indigo-200 dark:border-indigo-800 bg-indigo-50 dark:bg-indigo-950/40 hover:bg-indigo-100 dark:hover:bg-indigo-900/50 hover:border-indigo-300 dark:hover:border-indigo-700`,icon:`text-indigo-700 dark:text-indigo-300`},cyan:{card:`border-cyan-200 dark:border-cyan-800 bg-cyan-50 dark:bg-cyan-950/40 hover:bg-cyan-100 dark:hover:bg-cyan-900/50 hover:border-cyan-300 dark:hover:border-cyan-700`,icon:`text-cyan-700 dark:text-cyan-300`}},Sf={"heading-1":`blueLight`,"heading-2":`blue`,"heading-3":`blueDark`,"heading-4":`blueDarker`,separator:`gray`,collapsible:`dark`,"unordered-list":`green`,"ordered-list":`greenDark`,tree:`cyan`,"code-block":`dark`,table:`orange`,diagram:`red`,"colored-text":`pink`,"colored-section":`violet`,blockquote:`gray`,link:`orangeLight`,"doc-link":`orange`,"anchor-link":`orangeDark`,"anchor-doc-link":`orangeDark`,image:`amber`,attachment:`orange`,emojis:`yellow`,"local-search":`cyan`},Cf={"heading-1":`snippet.heading_1`,"heading-2":`snippet.heading_2`,"heading-3":`snippet.heading_3`,"heading-4":`snippet.heading_4`,separator:`snippet.separator`,collapsible:`snippet.collapsible`,"unordered-list":`snippet.bullet_list`,"ordered-list":`snippet.numbered_list`,tree:`snippet.tree`,"colored-text":`snippet.colored_text`,"colored-section":`snippet.colored_section`,blockquote:`snippet.blockquote`,"code-block":`snippet.code_block`,table:`snippet.table`,link:`snippet.link`,"doc-link":`snippet.link_doc`,"anchor-link":`snippet.link_anchor`,"anchor-doc-link":`snippet.link_doc_anchor`,image:`snippet.image`,diagram:`snippet.diagram`,emojis:`snippet.emojis`,attachment:`snippet.attachment`,"local-search":`snippet.local_search`},wf={info:{bg:`#eff6ff`,border:`#3b82f6`,text:`#1e3a5f`},success:{bg:`#f0fdf4`,border:`#22c55e`,text:`#14532d`},warning:{bg:`#fffbeb`,border:`#f59e0b`,text:`#451a03`},danger:{bg:`#fef2f2`,border:`#ef4444`,text:`#450a0a`},note:{bg:`#f5f3ff`,border:`#8b5cf6`,text:`#2e1065`},neutral:{bg:`#f9fafb`,border:`#6b7280`,text:`#111827`}},Tf=[{label:`snippet.emoji_cat_smileys`,emojis:[{e:`😀`,t:`grin grinning smile sourire happy heureux`},{e:`😃`,t:`smiley joy joie sourire happy`},{e:`😄`,t:`smile sourire happy heureux joie`},{e:`😁`,t:`beaming grin sourire dents`},{e:`😆`,t:`laugh rire lol`},{e:`😅`,t:`sweat transpire rire nerveux`},{e:`🤣`,t:`rofl lol mdr rire`},{e:`😂`,t:`joy larmes tears rire lol`},{e:`🙂`,t:`slight smile sourire`},{e:`🙃`,t:`upside renverse inverse`},{e:`😉`,t:`wink clin oeil`},{e:`😊`,t:`blush rougir sourire`},{e:`😇`,t:`angel ange halo innocent`},{e:`🥰`,t:`love amour coeur heart smile`},{e:`😍`,t:`heart eyes amoureux love amour`},{e:`🤩`,t:`star stars etoile wow`},{e:`😘`,t:`kiss bisou`},{e:`😋`,t:`yum miam savoureux langue`},{e:`😛`,t:`tongue langue`},{e:`😜`,t:`wink tongue langue clin`},{e:`🤪`,t:`crazy fou zany`},{e:`😝`,t:`tongue langue squinting`},{e:`🤗`,t:`hug calin embrasser`},{e:`🤔`,t:`think reflexion reflechir pense`},{e:`🤨`,t:`raised brow sourcil suspicious`},{e:`😐`,t:`neutral neutre`},{e:`😑`,t:`expressionless impassible`},{e:`😒`,t:`unamused decu blase`},{e:`🙄`,t:`roll eyes yeux ciel`},{e:`😬`,t:`grimace`},{e:`😌`,t:`relieved soulage`},{e:`😔`,t:`pensive pensif triste sad`},{e:`😪`,t:`sleepy sommeil fatigue`},{e:`😴`,t:`sleep dormir zzz`},{e:`🤤`,t:`drool bave`},{e:`😷`,t:`mask masque malade`},{e:`🤒`,t:`sick malade fever fievre`},{e:`🤕`,t:`hurt blesse bandage`},{e:`🤢`,t:`nausea nausee`},{e:`🤮`,t:`vomit vomir malade`},{e:`🤧`,t:`sneeze eternue rhume`},{e:`🥵`,t:`hot chaud transpire`},{e:`🥶`,t:`cold froid gele`},{e:`🥴`,t:`woozy ivre`},{e:`😵`,t:`dizzy dead mort vertige`},{e:`🤯`,t:`explode tete mind blown`},{e:`🤠`,t:`cowboy chapeau`},{e:`🥳`,t:`party fete anniversaire birthday`},{e:`😎`,t:`cool sunglasses lunettes`},{e:`🤓`,t:`nerd geek`},{e:`🧐`,t:`monocle curious`},{e:`😕`,t:`confused confus`},{e:`😟`,t:`worried inquiet`},{e:`🙁`,t:`frown triste`},{e:`☹️`,t:`sad triste frown`},{e:`😮`,t:`surprised surpris open mouth`},{e:`😯`,t:`hushed`},{e:`😲`,t:`astonished etonne`},{e:`😳`,t:`flushed gene rougeur`},{e:`🥺`,t:`pleading supplier chien`},{e:`😦`,t:`frown open mouth`},{e:`😧`,t:`anguish angoisse`},{e:`😨`,t:`fear peur`},{e:`😰`,t:`anxious anxieux stress`},{e:`😥`,t:`sad disappointed decu`},{e:`😢`,t:`cry pleurer larme`},{e:`😭`,t:`cry pleurer loud bawling`},{e:`😱`,t:`scream cri peur horror`},{e:`😖`,t:`confounded`},{e:`😣`,t:`persevere effort`},{e:`😞`,t:`disappointed decu`},{e:`😓`,t:`sweat transpire fatigue`},{e:`😩`,t:`weary fatigue las`},{e:`😫`,t:`tired fatigue`},{e:`🥱`,t:`yawn baille`},{e:`😤`,t:`triumph huff vapeur nez`},{e:`😠`,t:`angry colere fache`},{e:`😡`,t:`rage colere rouge`},{e:`🤬`,t:`curse insulte jure`},{e:`😈`,t:`devil diable smiling`},{e:`👿`,t:`imp diable`},{e:`💀`,t:`skull mort death crane`},{e:`☠️`,t:`crossbones pirate mort death`},{e:`💩`,t:`poop caca merde`},{e:`🤡`,t:`clown`},{e:`👻`,t:`ghost fantome`},{e:`👽`,t:`alien extraterrestre`},{e:`🤖`,t:`robot ia ai`},{e:`🎃`,t:`pumpkin halloween citrouille`},{e:`😺`,t:`cat chat`},{e:`😸`,t:`cat chat grin`},{e:`😹`,t:`cat chat joy`},{e:`😻`,t:`cat chat love amour heart`},{e:`😼`,t:`cat chat wry`},{e:`😽`,t:`cat chat kiss`},{e:`🙀`,t:`cat chat fear peur`},{e:`😿`,t:`cat chat cry pleurer`},{e:`😾`,t:`cat chat angry colere`}]},{label:`snippet.emoji_cat_gestures`,emojis:[{e:`👍`,t:`thumbs up pouce ok bien like`},{e:`👎`,t:`thumbs down pouce bas dislike`},{e:`👌`,t:`ok parfait`},{e:`✌️`,t:`victory victoire peace paix`},{e:`🤞`,t:`fingers crossed doigts croises`},{e:`🤟`,t:`love you`},{e:`🤘`,t:`rock horns metal cornes`},{e:`🤙`,t:`call appelle hang loose`},{e:`👈`,t:`left gauche pointing`},{e:`👉`,t:`right droite pointing`},{e:`👆`,t:`up haut pointing`},{e:`👇`,t:`down bas pointing`},{e:`☝️`,t:`one index up haut`},{e:`✋`,t:`stop hand main raised`},{e:`🤚`,t:`back hand main`},{e:`🖐️`,t:`hand main splayed`},{e:`🖖`,t:`vulcan spock star trek`},{e:`👋`,t:`wave bonjour hello salut goodbye`},{e:`🤝`,t:`handshake accord deal poignee`},{e:`🙏`,t:`pray priere merci thanks please`},{e:`💪`,t:`muscle fort biceps strong`},{e:`🦾`,t:`mechanical arm bras prothese`},{e:`👏`,t:`clap applaud bravo applaudir`},{e:`🙌`,t:`raise hands hourra celebrate`},{e:`👐`,t:`open hands`},{e:`🤲`,t:`palms up paumes`},{e:`🤜`,t:`fist poing right`},{e:`🤛`,t:`fist poing left`},{e:`✊`,t:`fist poing leve`},{e:`👊`,t:`fist punch poing frapper`},{e:`🤏`,t:`pinch petit small`},{e:`🤌`,t:`italian pinched`},{e:`🖕`,t:`middle finger doigt honneur`},{e:`✍️`,t:`write ecrire hand main`},{e:`🦶`,t:`foot pied`},{e:`🦵`,t:`leg jambe`},{e:`👂`,t:`ear oreille`},{e:`🦻`,t:`ear hearing appareil auditif`},{e:`👃`,t:`nose nez`},{e:`🧠`,t:`brain cerveau mind`},{e:`👀`,t:`eyes yeux regarder`},{e:`👁️`,t:`eye oeil`},{e:`👄`,t:`mouth bouche`},{e:`👅`,t:`tongue langue`},{e:`🦷`,t:`tooth dent`},{e:`🫀`,t:`heart anatomic coeur organe`},{e:`🫁`,t:`lungs poumons`}]},{label:`snippet.emoji_cat_hearts`,emojis:[{e:`❤️`,t:`heart coeur red rouge love amour`},{e:`🧡`,t:`orange heart coeur`},{e:`💛`,t:`yellow heart coeur jaune`},{e:`💚`,t:`green heart coeur vert`},{e:`💙`,t:`blue heart coeur bleu`},{e:`💜`,t:`purple heart coeur violet`},{e:`🖤`,t:`black heart coeur noir`},{e:`🤍`,t:`white heart coeur blanc`},{e:`🤎`,t:`brown heart coeur marron`},{e:`💔`,t:`broken heart coeur brise rupture`},{e:`❤️‍🔥`,t:`heart fire feu passion`},{e:`❤️‍🩹`,t:`heart mending coeur reparation`},{e:`💖`,t:`sparkling heart coeur brillant`},{e:`💕`,t:`two hearts coeurs`},{e:`💘`,t:`arrow heart cupid cupidon`},{e:`💝`,t:`ribbon heart cadeau`},{e:`💞`,t:`revolving hearts coeurs`},{e:`💟`,t:`heart decoration`},{e:`💌`,t:`love letter lettre enveloppe`},{e:`💋`,t:`kiss mark bisou levres`},{e:`❣️`,t:`heart exclamation`},{e:`💯`,t:`hundred 100 cent perfect parfait`},{e:`✨`,t:`sparkles etincelles magic magique brillant`},{e:`⭐`,t:`star etoile`},{e:`🌟`,t:`glowing star etoile`},{e:`💫`,t:`dizzy star vertige etoile`},{e:`🔥`,t:`fire feu hot flamme`},{e:`💥`,t:`boom explosion collision`},{e:`⚡`,t:`lightning eclair thunder tonnerre fast`},{e:`💢`,t:`anger colere symbol`},{e:`💨`,t:`dash vent wind fast vitesse`},{e:`💦`,t:`drops gouttes sweat eau`},{e:`💤`,t:`zzz sleep dormir sommeil`},{e:`🕳️`,t:`hole trou`},{e:`💭`,t:`thought pensee bulle`},{e:`🗯️`,t:`right anger bubble`},{e:`💬`,t:`speech bulle dialogue chat`}]},{label:`snippet.emoji_cat_objects`,emojis:[{e:`💻`,t:`laptop ordinateur computer portable`},{e:`🖥️`,t:`desktop computer ordinateur bureau`},{e:`⌨️`,t:`keyboard clavier`},{e:`🖱️`,t:`mouse souris`},{e:`💾`,t:`floppy disquette save sauvegarder`},{e:`💿`,t:`disk cd optical`},{e:`📀`,t:`dvd`},{e:`📱`,t:`phone mobile telephone smartphone`},{e:`📲`,t:`phone call mobile incoming`},{e:`☎️`,t:`telephone vintage`},{e:`📞`,t:`receiver combine phone`},{e:`📟`,t:`pager`},{e:`📠`,t:`fax`},{e:`🔋`,t:`battery batterie pile`},{e:`🔌`,t:`plug prise electrique`},{e:`💡`,t:`bulb idee idea light lumiere ampoule`},{e:`🔦`,t:`flashlight torche lampe`},{e:`🕯️`,t:`candle bougie`},{e:`📷`,t:`camera appareil photo`},{e:`📸`,t:`camera flash photo`},{e:`📹`,t:`video camera`},{e:`🎥`,t:`movie film cinema camera`},{e:`🎞️`,t:`film reel pellicule`},{e:`📽️`,t:`projector projecteur`},{e:`⏰`,t:`alarm reveil clock horloge`},{e:`⏱️`,t:`stopwatch chrono chronometre`},{e:`⏲️`,t:`timer minuteur`},{e:`🕰️`,t:`mantel clock horloge`},{e:`⌛`,t:`hourglass sablier done`},{e:`⏳`,t:`hourglass sablier flow running`},{e:`📡`,t:`satellite antenne`},{e:`🔭`,t:`telescope astronomie`},{e:`🔬`,t:`microscope science`},{e:`💊`,t:`pill pilule medicine medicament`},{e:`💉`,t:`syringe seringue injection vaccin`},{e:`🩹`,t:`bandage pansement`},{e:`🩺`,t:`stethoscope medecin`},{e:`🧪`,t:`tube eprouvette chimie chemistry`},{e:`🧬`,t:`dna adn gene`},{e:`🔍`,t:`search magnify loupe rechercher find left`},{e:`🔎`,t:`search magnify loupe rechercher find right`},{e:`🗝️`,t:`key cle old`},{e:`🔑`,t:`key cle`},{e:`🔐`,t:`lock key cle cadenas`},{e:`🔒`,t:`lock cadenas verrouille secure`},{e:`🔓`,t:`unlock cadenas ouvert`},{e:`🛡️`,t:`shield bouclier protection`},{e:`🔨`,t:`hammer marteau`},{e:`⚒️`,t:`tools outils hammer pick`},{e:`🛠️`,t:`tools outils hammer wrench`},{e:`🔧`,t:`wrench cle anglaise`},{e:`🔩`,t:`nut bolt ecrou`},{e:`⚙️`,t:`gear settings parametres engrenage config`},{e:`🪛`,t:`screwdriver tournevis`},{e:`🪝`,t:`hook crochet`},{e:`🧰`,t:`toolbox caisse outils`},{e:`🧲`,t:`magnet aimant`},{e:`🧱`,t:`brick brique`},{e:`⛏️`,t:`pick pioche`},{e:`🪓`,t:`axe hache`}]},{label:`snippet.emoji_cat_office`,emojis:[{e:`📝`,t:`memo note ecrire write`},{e:`✏️`,t:`pencil crayon`},{e:`🖊️`,t:`pen stylo bille`},{e:`🖋️`,t:`fountain pen stylo plume`},{e:`🖌️`,t:`paintbrush pinceau`},{e:`🖍️`,t:`crayon feutre`},{e:`📐`,t:`triangle ruler equerre`},{e:`📏`,t:`ruler regle`},{e:`📎`,t:`paperclip trombone attach`},{e:`🖇️`,t:`linked paperclips trombones`},{e:`📌`,t:`pushpin punaise`},{e:`📍`,t:`pin location lieu`},{e:`✂️`,t:`scissors ciseaux cut couper`},{e:`🗂️`,t:`card index dividers onglets`},{e:`📁`,t:`folder dossier`},{e:`📂`,t:`open folder dossier ouvert`},{e:`🗃️`,t:`card box boite fiches`},{e:`🗄️`,t:`file cabinet archive armoire`},{e:`📋`,t:`clipboard presse papier`},{e:`📃`,t:`page curl document`},{e:`📄`,t:`document page`},{e:`📜`,t:`scroll parchemin`},{e:`📰`,t:`newspaper journal presse`},{e:`🗞️`,t:`rolled newspaper journal`},{e:`📓`,t:`notebook carnet cahier`},{e:`📔`,t:`notebook decorated carnet`},{e:`📒`,t:`ledger registre`},{e:`📕`,t:`book rouge red ferme`},{e:`📗`,t:`book vert green`},{e:`📘`,t:`book bleu blue`},{e:`📙`,t:`book orange`},{e:`📚`,t:`books livres bibliotheque`},{e:`📖`,t:`open book livre ouvert`},{e:`🔖`,t:`bookmark marque page signet`},{e:`🏷️`,t:`label tag etiquette`},{e:`💼`,t:`briefcase mallette attache case business`},{e:`🗒️`,t:`spiral note notepad`},{e:`🗓️`,t:`spiral calendar calendrier`},{e:`📅`,t:`calendar calendrier date`},{e:`📆`,t:`tear off calendar calendrier`},{e:`🗑️`,t:`trash poubelle delete supprimer can`},{e:`🪣`,t:`bucket seau`},{e:`📦`,t:`package colis box boite`},{e:`📫`,t:`mailbox boite lettres closed flag up`},{e:`📪`,t:`mailbox boite lettres closed flag down`},{e:`📬`,t:`mailbox open boite lettres flag up`},{e:`📭`,t:`mailbox open boite lettres flag down`},{e:`📮`,t:`postbox boite aux lettres`},{e:`✉️`,t:`envelope enveloppe`},{e:`📧`,t:`email courriel mail at`},{e:`📨`,t:`email incoming recu`},{e:`📩`,t:`email arrow envoi`},{e:`📤`,t:`outbox envoyer sent`},{e:`📥`,t:`inbox recevoir`},{e:`📊`,t:`bar chart graphique barres histogramme`},{e:`📈`,t:`chart up tendance hausse croissance`},{e:`📉`,t:`chart down baisse decroissance`}]},{label:`snippet.emoji_cat_symbols`,emojis:[{e:`🆕`,t:`new nouveau nouvelle brand fresh neuf`},{e:`♻️`,t:`existing existant existante recycle recycler reuse reutiliser`},{e:`✅`,t:`check ok valide coche green`},{e:`☑️`,t:`check ballot case`},{e:`✔️`,t:`check coche mark`},{e:`❌`,t:`cross error erreur red rouge croix ko`},{e:`✖️`,t:`multiply multiplier cross`},{e:`❎`,t:`cross square button`},{e:`⚠️`,t:`warning attention danger`},{e:`ℹ️`,t:`info information`},{e:`❓`,t:`question red interrogation`},{e:`❔`,t:`question white interrogation`},{e:`❗`,t:`exclamation important red`},{e:`❕`,t:`exclamation white`},{e:`‼️`,t:`double exclamation`},{e:`⁉️`,t:`exclamation question`},{e:`🚀`,t:`rocket fusee launch lancer`},{e:`🎉`,t:`party popper tada fete celebration`},{e:`🎊`,t:`confetti ball fete`},{e:`🏆`,t:`trophy trophee winner`},{e:`🥇`,t:`gold medal medaille or first`},{e:`🥈`,t:`silver medal medaille argent second`},{e:`🥉`,t:`bronze medal medaille third`},{e:`🏅`,t:`medal medaille sports`},{e:`🎖️`,t:`military medal medaille`},{e:`🎯`,t:`target cible dart`},{e:`🎁`,t:`gift cadeau present`},{e:`🔔`,t:`bell cloche notify notification`},{e:`🔕`,t:`bell off muted silence`},{e:`📢`,t:`loudspeaker annonce public`},{e:`📣`,t:`megaphone porte voix`},{e:`📯`,t:`postal horn cor`},{e:`➕`,t:`plus add heavy`},{e:`➖`,t:`minus moins heavy`},{e:`➗`,t:`divide division`},{e:`♾️`,t:`infinity infini`},{e:`💲`,t:`dollar sign dollars money argent`},{e:`💱`,t:`currency exchange change devise`},{e:`©️`,t:`copyright`},{e:`®️`,t:`registered`},{e:`™️`,t:`trademark marque`},{e:`↔️`,t:`left right arrow fleche horizontal`},{e:`↕️`,t:`up down arrow fleche vertical`},{e:`↖️`,t:`up left arrow fleche`},{e:`↗️`,t:`up right arrow fleche`},{e:`↘️`,t:`down right arrow fleche`},{e:`↙️`,t:`down left arrow fleche`},{e:`⬅️`,t:`left arrow fleche gauche`},{e:`➡️`,t:`right arrow fleche droite`},{e:`⬆️`,t:`up arrow fleche haut`},{e:`⬇️`,t:`down arrow fleche bas`},{e:`🔃`,t:`clockwise vertical arrows`},{e:`🔄`,t:`counterclockwise arrows reload refresh recharger`},{e:`🔁`,t:`repeat loop boucle`},{e:`🔂`,t:`repeat single once`},{e:`🔀`,t:`shuffle melange random`},{e:`🔼`,t:`up button triangle`},{e:`🔽`,t:`down button triangle`},{e:`⏫`,t:`fast up double triangle`},{e:`⏬`,t:`fast down double triangle`},{e:`⏪`,t:`rewind back`},{e:`⏩`,t:`fast forward avance`},{e:`⏭️`,t:`next track suivant`},{e:`⏮️`,t:`previous track precedent`},{e:`⏯️`,t:`play pause`},{e:`▶️`,t:`play lecture`},{e:`⏸️`,t:`pause`},{e:`⏹️`,t:`stop`},{e:`⏺️`,t:`record enregistrer`},{e:`⏏️`,t:`eject ejecter`},{e:`🎵`,t:`music note musique`},{e:`🎶`,t:`music notes musique`},{e:`🔈`,t:`speaker low bas`},{e:`🔉`,t:`speaker medium moyen`},{e:`🔊`,t:`speaker loud fort haut son sound`},{e:`🔇`,t:`muted mute silence`},{e:`📶`,t:`signal antenne bars`},{e:`🛜`,t:`wireless wifi`},{e:`🔗`,t:`link lien chain`},{e:`⛓️`,t:`chains chaine`},{e:`🏁`,t:`finish flag checkered fin arrivee`},{e:`🚩`,t:`flag drapeau triangular`},{e:`🏳️`,t:`white flag drapeau blanc`},{e:`🏴`,t:`black flag drapeau noir`},{e:`🏳️‍🌈`,t:`rainbow lgbt pride drapeau arc en ciel`},{e:`🏳️‍⚧️`,t:`trans drapeau transgender`},{e:`🏴‍☠️`,t:`pirate drapeau jolly roger`}]}],Ef=[`1. Élément 1`,`2. Élément 2`,` 1. Sous-élément 2.1`,` 2. Sous-élément 2.2`,`3. Élément 3`,` 1. Sous-élément 3.1`,` 1. Sous-sous-élément 3.1.1`].join(`
13
+ `).filter(e=>/^\|.*\|$/.test(e.trim()));return t.length>=2&&/^\|.*\|$/.test(t[0].trim())&&vd(t[1])}function bd(e){if(typeof e!=`string`)return[];let t=[],n=RegExp(`((?:<!--\\s*table-(?:style|border|color):\\s*[a-z][a-z0-9_-]*\\s*-->\\n+){0,3})(\\|[^\\n]*\\|\\n\\|[ \\t:|-]*-[ \\t:|-]*\\|)`,`g`),r;for(;r=n.exec(e);)t.push(md(r[1]||``));return t}var xd=`<svg viewBox="0 0 16 16" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.5" stroke-linecap="round" stroke-linejoin="round"><rect x="5" y="5" width="8" height="9" rx="1.5"/><path d="M3 11V3a1 1 0 0 1 1-1h7"/></svg>`,Sd=`<svg viewBox="0 0 16 16" width="18" height="18" fill="none" stroke="currentColor" stroke-width="1.75" stroke-linecap="round" stroke-linejoin="round"><path d="M3 8.5 6.5 12 13 4.5"/></svg>`;function Cd(e,t,n){e.innerHTML=t,wd(e,n.content),Td(e),e.querySelectorAll(`h1, h2, h3, h4, h5, h6`).forEach(e=>{e.id||=(e.textContent||``).toLowerCase().replace(/[^\w\s-]/g,``).trim().replace(/\s+/g,`-`)}),e.querySelectorAll(`pre code.language-mermaid`).forEach(e=>{let t=e.textContent||``,n=document.createElement(`div`);n.className=`mermaid my-4`,n.textContent=t,e.closest(`pre`)?.replaceWith(n)}),window.mermaid&&e.querySelector(`.mermaid`)&&window.mermaid.run({nodes:e.querySelectorAll(`.mermaid`)}),e.querySelectorAll(`pre code`).forEach(e=>{window.hljs?.highlightElement(e)}),Ed(e,n.t),Dd(e,n.codeBlockMaxHeight,n.t),e.querySelectorAll(`a[href]`).forEach(e=>{let t=e.getAttribute(`href`),r=t&&t.match(/[?&]doc=([^&#]+)/);if(!r)return;let i=t.indexOf(`#`),a=i===-1?null:t.slice(i+1);e.addEventListener(`click`,e=>{e.preventDefault(),n.onDocLink(decodeURIComponent(r[1]),a)})}),e.querySelectorAll(`a[href^="#"]`).forEach(e=>{let t=e.getAttribute(`href`);!t||t.length<2||e.addEventListener(`click`,e=>{e.preventDefault(),n.onAnchor(t.slice(1))})}),e.querySelectorAll(`table`).forEach(e=>{let t=document.createElement(`div`);t.className=`overflow-x-auto`,e.parentNode?.insertBefore(t,e),t.appendChild(e)})}function wd(e,t){let n=bd(typeof t==`string`?t:``);e.querySelectorAll(`table`).forEach((e,t)=>{let r=n[t];r&&(r.style&&(e.classList.add(`table-style-${r.style}`),e.dataset.tableStyle=r.style),r.border&&(e.classList.add(`table-border-${r.border}`),e.dataset.tableBorder=r.border),r.color&&(e.classList.add(`table-color-${r.color}`),e.dataset.tableColor=r.color))})}function Td(e){e.querySelectorAll(`table th, table td`).forEach(e=>{(e.textContent||``).trim()===``&&(e.textContent=`\xA0`)})}function Ed(e,t){let n=t(`doc.code_copy`)||`Copy`,r=t(`doc.code_copied`)||`Copied!`;e.querySelectorAll(`pre`).forEach(e=>{let t=e.querySelector(`code`);if(!t||e.querySelector(`.ld-code-copy`))return;let i=document.createElement(`button`);i.type=`button`,i.className=`ld-code-copy`,i.title=n,i.setAttribute(`aria-label`,n),i.innerHTML=xd,i.addEventListener(`click`,async e=>{e.preventDefault(),e.stopPropagation();try{await navigator.clipboard.writeText(t.innerText)}catch{let e=document.createElement(`textarea`);e.value=t.innerText,e.style.position=`fixed`,e.style.opacity=`0`,document.body.appendChild(e),e.select();try{document.execCommand(`copy`)}catch{}document.body.removeChild(e)}i.classList.add(`ld-copied`),i.title=r,i.innerHTML=Sd,setTimeout(()=>{i.classList.remove(`ld-copied`),i.title=n,i.innerHTML=xd},1500)}),e.appendChild(i)})}function Dd(e,t,n){if(typeof t!=`number`||t<=0)return;let r=n(`doc.code_show_more`)||`▾ Show more`,i=n(`doc.code_show_less`)||`▴ Show less`;e.querySelectorAll(`pre`).forEach(e=>{if(!e.querySelector(`code`)||e.scrollHeight<=t+8)return;e.classList.add(`ld-collapsible`);let n=document.createElement(`button`);n.type=`button`,n.className=`ld-code-toggle`,n.textContent=r,n.addEventListener(`click`,t=>{t.preventDefault(),n.textContent=e.classList.toggle(`ld-expanded`)?i:r}),e.appendChild(n)})}var Od=`background:rgba(250,204,21,0.5);border-radius:2px;cursor:pointer;padding:0 1px;`;function kd(e,t,n){e.querySelectorAll(`mark[data-annotation-id]`).forEach(e=>{let t=e.parentNode;t.replaceChild(document.createTextNode(e.textContent||``),e),t.normalize()});for(let n of t)jd(e,n);e.querySelectorAll(`mark[data-annotation-id]`).forEach(e=>{(e.textContent||``).trim()||e.remove()}),n&&Ad(e,!1)}function Ad(e,t){e.querySelectorAll(`mark[data-annotation-id]`).forEach(e=>{let n=e;n.style.background=t?`rgba(250,204,21,0.5)`:`transparent`,n.style.cursor=t?`pointer`:`default`,n.style.pointerEvents=t?`auto`:`none`})}function jd(e,t){let n=(t.selectedText||``).replace(/\s+/g,` `).trim(),r=(t.contextBefore||``).replace(/\s+/g,` `).trim(),i=(t.contextAfter||``).replace(/\s+/g,` `).trim();if(!n)return;let a=e=>e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`),o=e=>e.split(/\s+/).filter(Boolean).map(a).join(`\\s+`),s=e.textContent||``,c=o(n),l=null;if(r||i){let e=(r?o(r)+`\\s*`:``)+`(`+c+`)`+(i?`\\s*`+o(i):``);try{l=new RegExp(e,`d`).exec(s)}catch{}}if(!l)try{l=RegExp(`(`+c+`)`,`d`).exec(s)}catch{return}let u=l&&l.indices;if(!l||!u||!u[1])return;let[d,f]=u[1],p=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),m=[],h=0;for(;p.nextNode();){let e=p.currentNode,t=e.nodeValue.length,n=h,r=h+t;if(h=r,r<=d)continue;if(n>=f)break;let i=Math.max(0,d-n),a=Math.min(t,f-n);i<a&&m.push({node:e,start:i,end:a})}for(let{node:e,start:n,end:r}of m){let i=e;n>0&&n<i.nodeValue.length&&(i=i.splitText(n));let a=r-n;a>0&&a<i.nodeValue.length&&i.splitText(a);let o=document.createElement(`mark`);o.setAttribute(`data-annotation-id`,t.id),o.setAttribute(`style`,Od),i.parentNode.insertBefore(o,i),o.appendChild(i)}}var Md=W(`<div class="fixed z-50 w-80 bg-yellow-50 dark:bg-yellow-900/80 border-2 border-yellow-300 dark:border-yellow-600 rounded-xl shadow-2xl p-4 flex flex-col gap-3"><div class="text-xs font-semibold text-yellow-700 dark:text-yellow-300 flex items-center gap-2"><span>✎</span><span> </span></div> <div class="text-xs text-yellow-800 dark:text-yellow-200 bg-yellow-100 dark:bg-yellow-800/50 rounded px-2 py-1 italic max-h-16 overflow-y-auto border border-yellow-200 dark:border-yellow-700"> </div> <textarea rows="4" class="w-full text-sm rounded-lg border border-yellow-300 dark:border-yellow-600 bg-white dark:bg-yellow-950 text-gray-900 dark:text-gray-100 px-3 py-2 focus:outline-none focus:ring-2 focus:ring-yellow-400 resize-none"></textarea> <div class="flex justify-end gap-2"><button class="text-sm px-3 py-1.5 rounded-lg border border-yellow-300 dark:border-yellow-600 text-yellow-700 dark:text-yellow-300 hover:bg-yellow-100 dark:hover:bg-yellow-800 transition-colors"> </button> <button class="text-sm px-4 py-1.5 rounded-lg bg-yellow-400 hover:bg-yellow-500 dark:bg-yellow-600 dark:hover:bg-yellow-500 text-yellow-900 dark:text-white font-semibold transition-colors"> </button></div></div>`),Nd=W(`<div class="text-xs font-semibold text-red-600 dark:text-red-400 bg-red-50 dark:bg-red-900/30 border border-red-200 dark:border-red-700 rounded px-2 py-1"> </div>`),Pd=W(`<div class="fixed z-50 w-80 bg-yellow-50 dark:bg-yellow-900/80 border-2 border-yellow-300 dark:border-yellow-600 rounded-xl shadow-2xl p-4 flex flex-col gap-2"><div class="text-xs font-semibold text-yellow-700 dark:text-yellow-300 flex items-center gap-2"><span>✎</span><span class="font-normal text-yellow-600 dark:text-yellow-400"> </span></div> <!> <div class="text-sm text-gray-800 dark:text-gray-100 whitespace-pre-wrap max-h-48 overflow-y-auto"> </div> <div class="flex justify-end pt-1 border-t border-yellow-200 dark:border-yellow-700"><button class="text-xs px-3 py-1.5 rounded-lg border border-red-200 dark:border-red-700 text-red-500 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/40 transition-colors flex items-center gap-1"> </button></div></div>`),Fd=W(`<div class="fixed z-50 w-72 bg-white dark:bg-gray-900 border border-red-200 dark:border-red-700 rounded-xl shadow-2xl p-4 flex flex-col gap-3"><p class="text-sm text-gray-700 dark:text-gray-200"> </p> <div class="flex justify-end gap-2"><button class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button> <button class="text-sm px-4 py-1.5 rounded-lg bg-red-500 hover:bg-red-600 text-white font-semibold transition-colors"> </button></div></div>`),Id=W(`<button> </button>`),Ld=W(`<div class="fixed top-14 right-0 w-10 flex flex-col items-center py-2 gap-2 z-40 overflow-y-auto" style="max-height: calc(100vh - 3.5rem)"></div>`),Rd=W(`<!> <!> <!> <!>`,1);function zd(e,t){Ge(t,!0);let n=F(L([])),r=F(null),i=F(``),a=F(null),o=F(null),s=F(L([])),c=null;Vi(()=>{let e=document.getElementById(`home-content-area`);if(!e)return;let t=()=>{c&&clearTimeout(c),I(a,null)};return e.addEventListener(`scroll`,t,{passive:!0}),()=>e.removeEventListener(`scroll`,t)});function l(e,t,n=320,r=260){let i=window.innerWidth,a=window.innerHeight,o=e;return o+n>i-16&&(o=i-n-16),o<8&&(o=8),{x:o,y:Math.min(t,a-r)}}async function u(e){I(n,[],!0);try{I(n,await fetch(`/api/annotations/`+encodeURIComponent(e)).then(e=>e.json()),!0)}catch{I(n,[],!0)}d()}function d(){t.contentEl&&(kd(t.contentEl,H(n),$.markerHidden),f())}On(()=>{t.contentEl&&Ad(t.contentEl,!$.markerHidden)});function f(){if(!t.contentEl){I(s,[],!0);return}I(s,H(n).map(e=>({id:e.id,note:e.note.length>60?e.note.slice(0,60)+`…`:e.note,orphan:!t.contentEl.querySelector(`mark[data-annotation-id="${e.id}"]`)})),!0)}function p(){if(!$.markerActive||H(r)||!t.contentEl)return;let e=window.getSelection();if(!e||e.isCollapsed||!e.toString().trim()||!t.contentEl.contains(e.anchorNode))return;let n=e.getRangeAt(0),a=document.createRange();a.selectNodeContents(t.contentEl),a.setEnd(n.startContainer,n.startOffset);let o=a.toString().length,s=n.toString(),c=t.contentEl.textContent||``,u=e=>e.replace(/\s+/g,` `).trim(),d=u(s),f=u(c.slice(Math.max(0,o-30),o)),p=u(c.slice(o+s.length,o+s.length+30)),m=n.getBoundingClientRect(),h=l(m.left,m.bottom+8);I(r,{x:h.x,y:h.y,preview:d.length>120?d.slice(0,120)+`…`:d,selectedText:d,contextBefore:f,contextAfter:p},!0),I(i,``)}function m(){I(r,null),window.getSelection()?.removeAllRanges()}async function h(){if(!H(r)||!t.docId)return;let e=H(i).trim();if(e)try{let i=await fetch(`/api/annotations/`+encodeURIComponent(t.docId),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({selectedText:H(r).selectedText,contextBefore:H(r).contextBefore,contextAfter:H(r).contextAfter,note:e})}).then(e=>e.json());I(n,[...H(n),i],!0),m(),d(),$.annotationCounts={...$.annotationCounts,[t.docId]:($.annotationCounts[t.docId]||0)+1}}catch{}}On(()=>{if(!t.contentEl)return;let e=t.contentEl,r=e=>{let t=e.target.closest(`mark[data-annotation-id]`);if(!t)return;let r=H(n).find(e=>e.id===t.dataset.annotationId);r&&g(r,t)},i=e=>{let t=e;t.target.closest(`mark[data-annotation-id]`)&&(t.relatedTarget&&t.relatedTarget.closest?.(`mark[data-annotation-id]`)||_())};return e.addEventListener(`mouseover`,r),e.addEventListener(`mouseout`,i),()=>{e.removeEventListener(`mouseover`,r),e.removeEventListener(`mouseout`,i)}});function g(e,n){c&&clearTimeout(c);let r=!t.contentEl?.querySelector(`mark[data-annotation-id="${e.id}"]`),i=n.getBoundingClientRect(),o=l(i.left,i.bottom+8);I(a,{ann:e,x:o.x,y:o.y,orphan:r},!0)}function _(){c=window.setTimeout(()=>{I(a,null)},1500)}function v(){H(a)&&(I(o,{id:H(a).ann.id,x:H(a).x,y:H(a).y},!0),I(a,null))}async function y(){if(!H(o)||!t.docId)return;let e=H(o).id;try{await fetch(`/api/annotations/${encodeURIComponent(t.docId)}/${e}`,{method:`DELETE`}),I(n,H(n).filter(t=>t.id!==e),!0),I(o,null),d();let r=($.annotationCounts[t.docId]||0)-1,i={...$.annotationCounts};r<=0?delete i[t.docId]:i[t.docId]=r,$.annotationCounts=i}catch{}}function b(e,t){return e.getBoundingClientRect().top+t.scrollTop-t.getBoundingClientRect().top}function x(e,t){let n=e.parentElement;for(;n&&n!==t;)n.tagName===`DETAILS`&&(n.open=!0),n=n.parentElement}function S(e,r){let i=t.contentEl?.querySelector(`mark[data-annotation-id="${e}"]`),o=document.getElementById(`home-content-area`);if(i&&o){if(H(a)?.ann.id===e){c&&clearTimeout(c);return}x(i,o),o.scrollTo({top:b(i,o)-o.clientHeight/2,behavior:`smooth`})}else{let t=H(n).find(t=>t.id===e);t&&g(t,r.currentTarget)}}function C(e,r){c&&clearTimeout(c);let i=H(n).find(t=>t.id===e);if(!i)return;let a=t.contentEl?.querySelector(`mark[data-annotation-id="${e}"]`),o=document.getElementById(`home-content-area`);if(!a||!o){g(i,r.currentTarget);return}x(a,o),o.scrollTo({top:b(a,o)-o.clientHeight/2,behavior:`smooth`});let s,l=()=>{clearTimeout(s),s=window.setTimeout(()=>{o.removeEventListener(`scroll`,l),g(i,a)},80)};o.addEventListener(`scroll`,l),s=window.setTimeout(()=>{o.removeEventListener(`scroll`,l),g(i,a)},600)}function w(e){let t=H(a)?.ann.id===e.id;return e.orphan?t?`#b91c1c`:`#ef4444`:t?`#f97316`:`#facc15`}function T(e){return new Date(e).toLocaleDateString(`fr-FR`,{day:`2-digit`,month:`short`,year:`numeric`})}var E={load:u,apply:d},D=Rd();Mr(`mouseup`,an,p);var ee=z(D),O=e=>{var t=Md(),n=R(t),a=B(R(n)),o=R(a,!0);N(a),N(n);var s=B(n,2),c=R(s,!0);N(s);var l=B(s,2);vn(l),_n(l,!0);var u=B(l,2),d=R(u),f=R(d,!0);N(d);var p=B(d,2),g=R(p,!0);N(p),N(u),N(t),V((e,n,i,a)=>{_i(t,`left:${H(r).x??``}px;top:${H(r).y??``}px`),K(o,e),K(c,H(r).preview),J(l,`placeholder`,n),K(f,i),K(g,a)},[()=>Y(`annotation.title`),()=>Y(`annotation.placeholder`),()=>Y(`common.cancel`),()=>Y(`annotation.save_btn`)]),Mi(l,()=>H(i),e=>I(i,e)),U(`click`,d,m),U(`click`,p,h),G(e,t)};q(ee,e=>{H(r)&&e(O)});var te=B(ee,2),k=e=>{var t=Pd(),n=R(t),r=B(R(n)),i=R(r,!0);N(r),N(n);var o=B(n,2),s=e=>{var t=Nd(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`annotation.orphan`)]),G(e,t)};q(o,e=>{H(a).orphan&&e(s)});var l=B(o,2),u=R(l,!0);N(l);var d=B(l,2),f=R(d),p=R(f,!0);N(f),N(d),N(t),V((e,n)=>{_i(t,`left:${H(a).x??``}px;top:${H(a).y??``}px`),K(i,e),K(u,H(a).ann.note),K(p,n)},[()=>T(H(a).ann.createdAt),()=>Y(`annotation.delete_btn`)]),Mr(`mouseenter`,t,()=>{c&&clearTimeout(c)}),Mr(`mouseleave`,t,_),U(`click`,f,v),G(e,t)};q(te,e=>{H(a)&&e(k)});var ne=B(te,2),re=e=>{var t=Fd(),n=R(t),r=R(n,!0);N(n);var i=B(n,2),a=R(i),s=R(a,!0);N(a);var c=B(a,2),l=R(c,!0);N(c),N(i),N(t),V((e,n,i)=>{_i(t,`left:${H(o).x??``}px;top:${H(o).y??``}px`),K(r,e),K(s,n),K(l,i)},[()=>Y(`annotation.confirm_delete`),()=>Y(`common.cancel`),()=>Y(`annotation.confirm_btn`)]),U(`click`,a,()=>I(o,null)),U(`click`,c,y),G(e,t)};q(ne,e=>{H(o)&&e(re)});var ie=B(ne,2),ae=e=>{var t=Ld();$r(t,21,()=>H(s),e=>e.id,(e,t)=>{var n=Id(),r=R(n,!0);N(n),V((e,i)=>{J(n,`title`,e),hi(n,1,`w-8 h-8 rounded border-2 shadow text-xs flex items-center justify-center transition-colors shrink-0 ${H(t).orphan?`border-red-600 text-white`:`border-yellow-500`}`),_i(n,`background:${i??``}`),K(r,H(t).orphan?`⚠`:`✎`)},[()=>H(t).orphan?`${Y(`annotation.orphan`)}\n\n${H(t).note}`:H(t).note,()=>w(H(t))]),U(`click`,n,e=>S(H(t).id,e)),Mr(`mouseenter`,n,e=>C(H(t).id,e)),Mr(`mouseleave`,n,_),G(e,n)}),N(t),G(e,t)};return q(ie,e=>{H(s).length>0&&!$.markerHidden&&e(ae)}),G(e,D),Ke(E)}Nr([`click`]);var Bd=`#dc2626`,Vd=`#eab308`,Hd=`#16a34a`;function Ud(e){let t=Math.max(0,Math.min(1,e))*100;return t>80?Hd:t>=60?Vd:t>=40?`#f97316`:Bd}function Wd(e){let t=Math.max(0,Math.min(1,e))*100;return t>=100?Hd:t<30?Bd:t<60?`linear-gradient(to right, ${Bd} 0%, ${Bd} 60%, ${Vd} 100%)`:t<80?`linear-gradient(to right, ${Bd} 0%, ${Vd} 40%, ${Vd} 100%)`:`linear-gradient(to right, ${Vd} 0%, ${Hd} 40%, ${Hd} 100%)`}var Gd=new class{#e;get report(){return H(this.#e)}set report(e){I(this.#e,e,!0)}constructor(){this.#e=F(null)}async load(e){if(!e)return this.report=null,null;try{let t=await fetch(`/api/metadata/`+encodeURIComponent(e));if(!t.ok)throw Error(t.statusText);this.report=await t.json()}catch{this.report=null}return this.report}async refresh(e){let t=await fetch(`/api/metadata/`+encodeURIComponent(e)+`/refresh`,{method:`POST`});if(!t.ok)throw Error(t.statusText);this.report=await t.json()}async addPath(e,t){let n=await fetch(`/api/metadata/`+encodeURIComponent(e),{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t})});if(!n.ok){let e=await n.json().catch(()=>({}));throw Error(e.error||n.statusText)}this.report=await n.json()}async removePath(e,t){let n=await fetch(`/api/metadata/`+encodeURIComponent(e),{method:`DELETE`,headers:{"Content-Type":`application/json`},body:JSON.stringify({path:t})});if(!n.ok)throw Error(n.statusText);this.report=await n.json()}},Kd=W(`<div data-testid="accuracy-gauge" class="no-print mt-5 flex items-center gap-3 mr-auto w-full sm:w-80 cursor-pointer select-none"><span class="text-xs text-gray-500 dark:text-gray-400 shrink-0"> </span> <div class="flex-1 h-4 rounded-full bg-gray-200 dark:bg-gray-700 overflow-hidden"><div class="h-full w-full transition-all"></div></div> <span data-testid="accuracy-gauge-value" class="text-xs font-semibold shrink-0 tabular-nums"> </span></div>`);function qd(e,t){Ge(t,!0);let n=P(()=>Gd.report),r=P(()=>H(n)?Math.round(H(n).accuracy*100):0),i=P(()=>H(n)?Y(`accuracy.tooltip`).replace(`{unchanged}`,String(H(n).unchanged)).replace(`{modified}`,String(H(n).modified)).replace(`{missing}`,String(H(n).missing)).replace(`{total}`,String(H(n).total)):``);var a=Ur(),o=z(a),s=e=>{var a=Kd(),o=R(a),s=R(o,!0);N(o);var c=B(o,2),l=R(c);N(c);var u=B(c,2),d=R(u);N(u),N(a),V((e,t,n)=>{J(a,`title`,H(i)),K(s,e),_i(l,`background:${t??``}`),_i(u,`color:${n??``}`),K(d,`${H(r)??``}%`)},[()=>Y(`accuracy.label`),()=>Wd(H(n).accuracy),()=>Ud(H(n).accuracy)]),U(`click`,a,function(...e){t.onopen?.apply(this,e)}),G(e,a)};q(o,e=>{H(n)&&H(n).total>0&&e(s)}),G(e,a),Ke()}Nr([`click`]);var Jd=/^(\s*(?:\*\*status:\*\*|status:)\s*).+?\s*$/im;function Yd(e){if(typeof e!=`string`)return null;let t=e.match(/^---\s*\n([\s\S]*?)\n---/);if(!t)return null;let n=t[1].match(/^\s*(?:\*\*status:\*\*|status:)\s*(.+?)\s*$/im);return n?n[1].trim():null}function Xd(e,t){return e.replace(Jd,`$1${t}`)}function Zd(e){return/%5BWORKLOG%5D/i.test(e)}var Qd=W(`<div data-testid="metadata-readonly-banner" class="text-xs text-amber-800 dark:text-amber-200 bg-amber-50 dark:bg-amber-900/30 border-l-4 border-amber-500 rounded-r px-3 py-2"> </div>`),$d=W(`<div class="px-3 py-4 text-center text-xs text-gray-400"> </div>`),ef=W(`<span class="inline-flex items-center gap-1 text-xs font-semibold px-2 py-0.5 rounded-full bg-green-100 text-green-700 dark:bg-green-900/40 dark:text-green-300"><i class="fa-solid fa-check"></i> </span>`),tf=W(`<span class="inline-flex items-center gap-1 text-xs font-semibold px-2 py-0.5 rounded-full bg-amber-100 text-amber-700 dark:bg-amber-900/40 dark:text-amber-300"><i class="fa-solid fa-triangle-exclamation"></i> </span>`),nf=W(`<span class="inline-flex items-center gap-1 text-xs font-semibold px-2 py-0.5 rounded-full bg-red-100 text-red-700 dark:bg-red-900/40 dark:text-red-300"><i class="fa-solid fa-circle-xmark"></i> </span>`),rf=W(`<button class="metadata-row-remove text-xs px-2 py-1 rounded-lg border border-red-200 dark:border-red-700 text-red-500 dark:text-red-400 hover:bg-red-50 dark:hover:bg-red-900/40 transition-colors"><i class="fa-solid fa-trash"></i></button>`),af=W(`<div class="flex items-center gap-2 px-3 py-2 border-b border-gray-100 dark:border-gray-800"><div class="flex-1 min-w-0"><div class="text-sm font-mono truncate text-gray-800 dark:text-gray-200"> </div></div> <!> <!></div>`),of=W(`<div class="flex items-center gap-2 flex-wrap"><button data-testid="metadata-add-btn" class="text-sm px-3 py-1.5 rounded-lg border border-blue-200 dark:border-blue-700 text-blue-600 dark:text-blue-400 hover:bg-blue-50 dark:hover:bg-blue-900/30 transition-colors"><i class="fa-solid fa-plus"></i> </button> <button data-testid="metadata-refresh-btn" class="text-sm px-3 py-1.5 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"><i class="fa-solid fa-arrows-rotate"></i> </button></div>`),sf=W(`<div class="px-3 py-2 text-xs text-gray-400"> </div>`),cf=W(`<div class="px-3 py-2 text-xs text-red-500"> </div>`),lf=W(`<button class="w-full text-left px-3 py-1.5 text-sm hover:bg-gray-50 dark:hover:bg-gray-800 flex items-center gap-2"><i class="fa-solid fa-folder text-yellow-500"></i> <span class="truncate"> </span></button>`),uf=W(`<button class="w-full text-left px-3 py-1.5 text-sm hover:bg-blue-50 dark:hover:bg-blue-900/30 flex items-center gap-2"><i class="fa-solid fa-file text-gray-400"></i> <span class="truncate"> </span> <i class="fa-solid fa-plus ml-auto text-blue-500 text-xs"></i></button>`),df=W(`<!> <!>`,1),ff=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-56 overflow-y-auto divide-y divide-gray-100 dark:divide-gray-800"><!></div></div>`),pf=W(`<p class="text-xs text-red-500"> </p>`),mf=W(`<div class="fixed inset-0 z-50 flex items-center justify-center bg-black/50"><div data-testid="metadata-modal" class="bg-white dark:bg-gray-900 rounded-xl shadow-xl w-full max-w-2xl mx-4 p-6 space-y-4"><div class="flex items-start justify-between gap-4"><div><h3 class="text-base font-semibold text-gray-900 dark:text-gray-50"><i class="fa-solid fa-code-compare mr-1"></i> </h3> <p class="text-xs text-gray-500 dark:text-gray-400 mt-1"> </p></div> <button class="text-gray-400 hover:text-gray-600 dark:hover:text-gray-200 transition-colors"><i class="fa-solid fa-xmark text-lg"></i></button></div> <div class="text-xs text-gray-600 dark:text-gray-300 bg-gray-50 dark:bg-gray-800 rounded-lg px-3 py-2"></div> <!> <div data-testid="metadata-list" class="border border-gray-200 dark:border-gray-700 rounded-lg overflow-hidden"><div class="max-h-64 overflow-y-auto"><!></div></div> <!> <!> <!> <div class="flex justify-end"><button class="text-sm px-4 py-2 rounded-lg border border-gray-200 dark:border-gray-700 text-gray-600 dark:text-gray-400 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors"> </button></div></div></div>`);function hf(e,t){Ge(t,!0);let n=P(()=>Gd.report),r=P(()=>Yd(t.content)===`SuperSeeded`),i=F(``),a=F(!1),o=F(!1),s=F(``),c=F(null),l=F(L([])),u=F(L([])),d=F(!1),f=F(``);On(()=>{t.open||(I(o,!1),I(s,``),I(i,``))});function p(e){I(i,Y(`common.error_prefix`)+e),setTimeout(()=>{I(i,``)},5e3)}function m(){return!H(n)||H(n).total===0?``:`<span class="font-semibold">${Math.round(H(n).accuracy*100)}%</span> · ${H(n).unchanged}/${H(n).total} ${Y(`metadata.status.unchanged`)} · ${H(n).modified} ${Y(`metadata.status.modified`)} · ${H(n).missing} ${Y(`metadata.status.missing`)}`}async function h(){I(a,!0);try{await Gd.refresh(t.docId)}catch(e){p(e instanceof Error?e.message:String(e))}finally{I(a,!1)}}async function g(e){try{await Gd.removePath(t.docId,e),H(o)&&y(H(s))}catch(e){p(e instanceof Error?e.message:String(e))}}async function _(e){try{await Gd.addPath(t.docId,e),H(o)&&y(H(s))}catch(e){p(e instanceof Error?e.message:String(e))}}function v(){I(o,!H(o)),H(o)&&y(``)}async function y(e){I(d,!0),I(f,``);try{let t=await fetch(`/api/browse-source?path=`+encodeURIComponent(e||``));if(!t.ok){let e=await t.json().catch(()=>({}));throw Error(e.error||t.statusText)}let r=await t.json();I(s,r.current||``,!0),I(c,r.parent,!0),I(l,r.dirs||[],!0);let i=new Set((H(n)?.items||[]).map(e=>e.path));I(u,(r.files||[]).filter(e=>!i.has(e.path)),!0)}catch(e){I(f,e instanceof Error?e.message:String(e),!0)}finally{I(d,!1)}}function b(){H(c)!==null&&y(H(c))}var x=Ur(),S=z(x),C=e=>{var p=mf(),x=R(p),S=R(x),C=R(S),w=R(C),T=B(R(w));N(w);var E=B(w,2),D=R(E,!0);N(E),N(C);var ee=B(C,2);N(S);var O=B(S,2);ai(O,m,!0),N(O);var te=B(O,2),k=e=>{var t=Qd(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`metadata.readonly_banner`)]),G(e,t)};q(te,e=>{H(r)&&e(k)});var ne=B(te,2),re=R(ne),ie=R(re),ae=e=>{var t=$d(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`metadata.empty`)]),G(e,t)},oe=e=>{var t=Ur();$r(z(t),17,()=>H(n).items,e=>e.path,(e,t)=>{var n=af(),i=R(n),a=R(i),o=R(a,!0);N(a),N(i);var s=B(i,2),c=e=>{var t=ef(),n=B(R(t));N(t),V(e=>K(n,` ${e??``}`),[()=>Y(`metadata.status.unchanged`)]),G(e,t)},l=e=>{var t=tf(),n=B(R(t));N(t),V(e=>K(n,` ${e??``}`),[()=>Y(`metadata.status.modified`)]),G(e,t)},u=e=>{var t=nf(),n=B(R(t));N(t),V(e=>K(n,` ${e??``}`),[()=>Y(`metadata.status.missing`)]),G(e,t)};q(s,e=>{H(t).status===`unchanged`?e(c):H(t).status===`modified`?e(l,1):e(u,-1)});var d=B(s,2),f=e=>{var n=rf();V(e=>J(n,`title`,e),[()=>Y(`metadata.remove`)]),U(`click`,n,()=>g(H(t).path)),G(e,n)};q(d,e=>{H(r)||e(f)}),N(n),V(()=>{J(a,`title`,H(t).path),K(o,H(t).path)}),G(e,n)}),G(e,t)};q(ie,e=>{!H(n)||H(n).items.length===0?e(ae):e(oe,-1)}),N(re),N(ne);var se=B(ne,2),ce=e=>{var t=of(),n=R(t),r=B(R(n));N(n);var i=B(n,2),o=B(R(i));N(i),N(t),V((e,t)=>{K(r,` ${e??``}`),i.disabled=H(a),K(o,` ${t??``}`)},[()=>Y(`metadata.add`),()=>Y(`metadata.refresh`)]),U(`click`,n,v),U(`click`,i,h),G(e,t)};q(se,e=>{H(r)||e(ce)});var le=B(se,2),ue=e=>{var t=ff(),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 p=B(n,2),m=R(p),h=e=>{var t=sf(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.loading`)]),G(e,t)},g=e=>{var t=cf(),n=R(t,!0);N(t),V(()=>K(n,H(f))),G(e,t)},v=e=>{var t=sf(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.empty_dir`)]),G(e,t)},x=e=>{var t=df(),n=z(t);$r(n,17,()=>H(l),e=>e.path,(e,t)=>{var n=lf(),r=B(R(n),2),i=R(r,!0);N(r),N(n),V(()=>K(i,H(t).name)),U(`click`,n,()=>y(H(t).path)),G(e,n)}),$r(B(n,2),17,()=>H(u),e=>e.path,(e,t)=>{var n=uf(),r=B(R(n),2),i=R(r,!0);N(r),Pe(2),N(n),V(()=>K(i,H(t).name)),U(`click`,n,()=>_(H(t).path)),G(e,n)}),G(e,t)};q(m,e=>{H(d)?e(h):H(f)?e(g,1):H(l).length===0&&H(u).length===0?e(v,2):e(x,-1)}),N(p),N(t),V(e=>{r.disabled=H(c)===null,K(i,e),K(o,H(s)?`/`+H(s):`/ (sourceRoot)`)},[()=>Y(`common.up`)]),U(`click`,r,b),G(e,t)};q(le,e=>{H(o)&&e(ue)});var de=B(le,2),fe=e=>{var t=pf(),n=R(t,!0);N(t),V(()=>K(n,H(i))),G(e,t)};q(de,e=>{H(i)&&e(fe)});var pe=B(de,2),me=R(pe),he=R(me,!0);N(me),N(pe),N(x),N(p),V((e,t,n,r)=>{K(T,` ${e??``}`),K(D,t),J(ee,`title`,n),K(he,r)},[()=>Y(`metadata.title`),()=>Y(`metadata.subtitle`),()=>Y(`common.close`),()=>Y(`common.close`)]),U(`click`,p,e=>{e.target===e.currentTarget&&t.onclose()}),U(`click`,ee,function(...e){t.onclose?.apply(this,e)}),U(`click`,me,function(...e){t.onclose?.apply(this,e)}),G(e,p)};q(S,e=>{t.open&&e(C)}),G(e,x),Ke()}Nr([`click`]);var gf=[`heading`,`collapsible`,`link`,`doc-link`,`anchor-link`,`anchor-doc-link`,`ordered-list`,`unordered-list`,`code-block`,`blockquote`,`image`,`table`,`tree`,`diagram`,`colored-section`,`colored-text`,`emojis`,`attachment`],_f={"heading-1":`heading`,"heading-2":`heading`,"heading-3":`heading`,"heading-4":`heading`};function vf(e){return _f[e]||e}var yf={"heading-1":`fa-solid fa-heading`,"heading-2":`fa-solid fa-heading`,"heading-3":`fa-solid fa-heading`,"heading-4":`fa-solid fa-heading`,separator:`fa-solid fa-minus`,collapsible:`fa-solid fa-caret-right`,"unordered-list":`fa-solid fa-list-ul`,"ordered-list":`fa-solid fa-list-ol`,tree:`fa-solid fa-folder-tree`,"colored-text":`fa-solid fa-highlighter`,"colored-section":`fa-solid fa-fill-drip`,blockquote:`fa-solid fa-quote-right`,"code-block":`fa-solid fa-code`,table:`fa-solid fa-table-cells`,link:`fa-solid fa-link`,"doc-link":`fa-solid fa-file-lines`,"anchor-link":`fa-solid fa-anchor`,"anchor-doc-link":`fa-solid fa-anchor`,image:`fa-solid fa-image`,diagram:`fa-solid fa-diagram-project`,emojis:`fa-solid fa-face-smile`,attachment:`fa-solid fa-paperclip`,"local-search":`fa-solid fa-magnifying-glass`},bf=[{key:`structure`,labelKey:`snippet.picker_cat_structure`,types:[`heading-1`,`heading-2`,`heading-3`,`heading-4`,`separator`,`collapsible`]},{key:`lists-code-data`,labelKey:`snippet.picker_cat_lists_code_data`,types:[`unordered-list`,`ordered-list`,`tree`,`code-block`,`table`,`diagram`]},{key:`rich-text`,labelKey:`snippet.picker_cat_rich_text`,types:[`colored-text`,`colored-section`,`blockquote`,`emojis`,`local-search`]},{key:`links-media`,labelKey:`snippet.picker_cat_links_media`,types:[`link`,`doc-link`,`anchor-link`,`anchor-doc-link`,`image`,`attachment`]}],xf={blueLight:{card:`border-sky-200 dark:border-sky-800 bg-sky-50 dark:bg-sky-950/40 hover:bg-sky-100 dark:hover:bg-sky-900/50 hover:border-sky-300 dark:hover:border-sky-700`,icon:`text-sky-700 dark:text-sky-300`},blue:{card:`border-blue-200 dark:border-blue-800 bg-blue-50 dark:bg-blue-950/40 hover:bg-blue-100 dark:hover:bg-blue-900/50 hover:border-blue-300 dark:hover:border-blue-700`,icon:`text-blue-700 dark:text-blue-300`},blueDark:{card:`border-indigo-200 dark:border-indigo-800 bg-indigo-50 dark:bg-indigo-950/40 hover:bg-indigo-100 dark:hover:bg-indigo-900/50 hover:border-indigo-300 dark:hover:border-indigo-700`,icon:`text-indigo-700 dark:text-indigo-300`},blueDarker:{card:`border-blue-300 dark:border-blue-700 bg-blue-100 dark:bg-blue-900/50 hover:bg-blue-200 dark:hover:bg-blue-800/60 hover:border-blue-400 dark:hover:border-blue-600`,icon:`text-blue-900 dark:text-blue-100`},gray:{card:`border-gray-200 dark:border-gray-700 bg-gray-50 dark:bg-gray-800 hover:bg-gray-100 dark:hover:bg-gray-700 hover:border-gray-300 dark:hover:border-gray-600`,icon:`text-gray-700 dark:text-gray-200`},violet:{card:`border-violet-200 dark:border-violet-800 bg-violet-50 dark:bg-violet-950/40 hover:bg-violet-100 dark:hover:bg-violet-900/50 hover:border-violet-300 dark:hover:border-violet-700`,icon:`text-violet-700 dark:text-violet-300`},green:{card:`border-emerald-200 dark:border-emerald-800 bg-emerald-50 dark:bg-emerald-950/40 hover:bg-emerald-100 dark:hover:bg-emerald-900/50 hover:border-emerald-300 dark:hover:border-emerald-700`,icon:`text-emerald-700 dark:text-emerald-300`},greenDark:{card:`border-green-300 dark:border-green-700 bg-green-100 dark:bg-green-900/50 hover:bg-green-200 dark:hover:bg-green-800/60 hover:border-green-400 dark:hover:border-green-600`,icon:`text-green-900 dark:text-green-100`},teal:{card:`border-teal-200 dark:border-teal-800 bg-teal-50 dark:bg-teal-950/40 hover:bg-teal-100 dark:hover:bg-teal-900/50 hover:border-teal-300 dark:hover:border-teal-700`,icon:`text-teal-700 dark:text-teal-300`},dark:{card:`border-slate-300 dark:border-slate-600 bg-slate-100 dark:bg-slate-800 hover:bg-slate-200 dark:hover:bg-slate-700 hover:border-slate-400 dark:hover:border-slate-500`,icon:`text-slate-900 dark:text-slate-100`},orange:{card:`border-orange-200 dark:border-orange-800 bg-orange-50 dark:bg-orange-950/40 hover:bg-orange-100 dark:hover:bg-orange-900/50 hover:border-orange-300 dark:hover:border-orange-700`,icon:`text-orange-700 dark:text-orange-300`},orangeLight:{card:`border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/40 hover:bg-amber-100 dark:hover:bg-amber-900/50 hover:border-amber-300 dark:hover:border-amber-700`,icon:`text-amber-700 dark:text-amber-300`},orangeDark:{card:`border-orange-300 dark:border-orange-700 bg-orange-100 dark:bg-orange-900/50 hover:bg-orange-200 dark:hover:bg-orange-800/60 hover:border-orange-400 dark:hover:border-orange-600`,icon:`text-orange-900 dark:text-orange-100`},red:{card:`border-red-200 dark:border-red-800 bg-red-50 dark:bg-red-950/40 hover:bg-red-100 dark:hover:bg-red-900/50 hover:border-red-300 dark:hover:border-red-700`,icon:`text-red-700 dark:text-red-300`},pink:{card:`border-pink-200 dark:border-pink-800 bg-pink-50 dark:bg-pink-950/40 hover:bg-pink-100 dark:hover:bg-pink-900/50 hover:border-pink-300 dark:hover:border-pink-700`,icon:`text-pink-700 dark:text-pink-300`},amber:{card:`border-amber-200 dark:border-amber-800 bg-amber-50 dark:bg-amber-950/40 hover:bg-amber-100 dark:hover:bg-amber-900/50 hover:border-amber-300 dark:hover:border-amber-700`,icon:`text-amber-700 dark:text-amber-300`},yellow:{card:`border-yellow-300 dark:border-yellow-700 bg-yellow-100 dark:bg-yellow-900/50 hover:bg-yellow-200 dark:hover:bg-yellow-800/60 hover:border-yellow-400 dark:hover:border-yellow-600`,icon:`text-yellow-700 dark:text-yellow-200`},indigo:{card:`border-indigo-200 dark:border-indigo-800 bg-indigo-50 dark:bg-indigo-950/40 hover:bg-indigo-100 dark:hover:bg-indigo-900/50 hover:border-indigo-300 dark:hover:border-indigo-700`,icon:`text-indigo-700 dark:text-indigo-300`},cyan:{card:`border-cyan-200 dark:border-cyan-800 bg-cyan-50 dark:bg-cyan-950/40 hover:bg-cyan-100 dark:hover:bg-cyan-900/50 hover:border-cyan-300 dark:hover:border-cyan-700`,icon:`text-cyan-700 dark:text-cyan-300`}},Sf={"heading-1":`blueLight`,"heading-2":`blue`,"heading-3":`blueDark`,"heading-4":`blueDarker`,separator:`gray`,collapsible:`dark`,"unordered-list":`green`,"ordered-list":`greenDark`,tree:`cyan`,"code-block":`dark`,table:`orange`,diagram:`red`,"colored-text":`pink`,"colored-section":`violet`,blockquote:`gray`,link:`orangeLight`,"doc-link":`orange`,"anchor-link":`orangeDark`,"anchor-doc-link":`orangeDark`,image:`amber`,attachment:`orange`,emojis:`yellow`,"local-search":`cyan`},Cf={"heading-1":`snippet.heading_1`,"heading-2":`snippet.heading_2`,"heading-3":`snippet.heading_3`,"heading-4":`snippet.heading_4`,separator:`snippet.separator`,collapsible:`snippet.collapsible`,"unordered-list":`snippet.bullet_list`,"ordered-list":`snippet.numbered_list`,tree:`snippet.tree`,"colored-text":`snippet.colored_text`,"colored-section":`snippet.colored_section`,blockquote:`snippet.blockquote`,"code-block":`snippet.code_block`,table:`snippet.table`,link:`snippet.link`,"doc-link":`snippet.link_doc`,"anchor-link":`snippet.link_anchor`,"anchor-doc-link":`snippet.link_doc_anchor`,image:`snippet.image`,diagram:`snippet.diagram`,emojis:`snippet.emojis`,attachment:`snippet.attachment`,"local-search":`snippet.local_search`},wf={info:{bg:`#eff6ff`,border:`#3b82f6`,text:`#1e3a5f`},success:{bg:`#f0fdf4`,border:`#22c55e`,text:`#14532d`},warning:{bg:`#fffbeb`,border:`#f59e0b`,text:`#451a03`},danger:{bg:`#fef2f2`,border:`#ef4444`,text:`#450a0a`},note:{bg:`#f5f3ff`,border:`#8b5cf6`,text:`#2e1065`},neutral:{bg:`#f9fafb`,border:`#6b7280`,text:`#111827`}},Tf=[{label:`snippet.emoji_cat_smileys`,emojis:[{e:`😀`,t:`grin grinning smile sourire happy heureux`},{e:`😃`,t:`smiley joy joie sourire happy`},{e:`😄`,t:`smile sourire happy heureux joie`},{e:`😁`,t:`beaming grin sourire dents`},{e:`😆`,t:`laugh rire lol`},{e:`😅`,t:`sweat transpire rire nerveux`},{e:`🤣`,t:`rofl lol mdr rire`},{e:`😂`,t:`joy larmes tears rire lol`},{e:`🙂`,t:`slight smile sourire`},{e:`🙃`,t:`upside renverse inverse`},{e:`😉`,t:`wink clin oeil`},{e:`😊`,t:`blush rougir sourire`},{e:`😇`,t:`angel ange halo innocent`},{e:`🥰`,t:`love amour coeur heart smile`},{e:`😍`,t:`heart eyes amoureux love amour`},{e:`🤩`,t:`star stars etoile wow`},{e:`😘`,t:`kiss bisou`},{e:`😋`,t:`yum miam savoureux langue`},{e:`😛`,t:`tongue langue`},{e:`😜`,t:`wink tongue langue clin`},{e:`🤪`,t:`crazy fou zany`},{e:`😝`,t:`tongue langue squinting`},{e:`🤗`,t:`hug calin embrasser`},{e:`🤔`,t:`think reflexion reflechir pense`},{e:`🤨`,t:`raised brow sourcil suspicious`},{e:`😐`,t:`neutral neutre`},{e:`😑`,t:`expressionless impassible`},{e:`😒`,t:`unamused decu blase`},{e:`🙄`,t:`roll eyes yeux ciel`},{e:`😬`,t:`grimace`},{e:`😌`,t:`relieved soulage`},{e:`😔`,t:`pensive pensif triste sad`},{e:`😪`,t:`sleepy sommeil fatigue`},{e:`😴`,t:`sleep dormir zzz`},{e:`🤤`,t:`drool bave`},{e:`😷`,t:`mask masque malade`},{e:`🤒`,t:`sick malade fever fievre`},{e:`🤕`,t:`hurt blesse bandage`},{e:`🤢`,t:`nausea nausee`},{e:`🤮`,t:`vomit vomir malade`},{e:`🤧`,t:`sneeze eternue rhume`},{e:`🥵`,t:`hot chaud transpire`},{e:`🥶`,t:`cold froid gele`},{e:`🥴`,t:`woozy ivre`},{e:`😵`,t:`dizzy dead mort vertige`},{e:`🤯`,t:`explode tete mind blown`},{e:`🤠`,t:`cowboy chapeau`},{e:`🥳`,t:`party fete anniversaire birthday`},{e:`😎`,t:`cool sunglasses lunettes`},{e:`🤓`,t:`nerd geek`},{e:`🧐`,t:`monocle curious`},{e:`😕`,t:`confused confus`},{e:`😟`,t:`worried inquiet`},{e:`🙁`,t:`frown triste`},{e:`☹️`,t:`sad triste frown`},{e:`😮`,t:`surprised surpris open mouth`},{e:`😯`,t:`hushed`},{e:`😲`,t:`astonished etonne`},{e:`😳`,t:`flushed gene rougeur`},{e:`🥺`,t:`pleading supplier chien`},{e:`😦`,t:`frown open mouth`},{e:`😧`,t:`anguish angoisse`},{e:`😨`,t:`fear peur`},{e:`😰`,t:`anxious anxieux stress`},{e:`😥`,t:`sad disappointed decu`},{e:`😢`,t:`cry pleurer larme`},{e:`😭`,t:`cry pleurer loud bawling`},{e:`😱`,t:`scream cri peur horror`},{e:`😖`,t:`confounded`},{e:`😣`,t:`persevere effort`},{e:`😞`,t:`disappointed decu`},{e:`😓`,t:`sweat transpire fatigue`},{e:`😩`,t:`weary fatigue las`},{e:`😫`,t:`tired fatigue`},{e:`🥱`,t:`yawn baille`},{e:`😤`,t:`triumph huff vapeur nez`},{e:`😠`,t:`angry colere fache`},{e:`😡`,t:`rage colere rouge`},{e:`🤬`,t:`curse insulte jure`},{e:`😈`,t:`devil diable smiling`},{e:`👿`,t:`imp diable`},{e:`💀`,t:`skull mort death crane`},{e:`☠️`,t:`crossbones pirate mort death`},{e:`💩`,t:`poop caca merde`},{e:`🤡`,t:`clown`},{e:`👻`,t:`ghost fantome`},{e:`👽`,t:`alien extraterrestre`},{e:`🤖`,t:`robot ia ai`},{e:`🎃`,t:`pumpkin halloween citrouille`},{e:`😺`,t:`cat chat`},{e:`😸`,t:`cat chat grin`},{e:`😹`,t:`cat chat joy`},{e:`😻`,t:`cat chat love amour heart`},{e:`😼`,t:`cat chat wry`},{e:`😽`,t:`cat chat kiss`},{e:`🙀`,t:`cat chat fear peur`},{e:`😿`,t:`cat chat cry pleurer`},{e:`😾`,t:`cat chat angry colere`}]},{label:`snippet.emoji_cat_gestures`,emojis:[{e:`👍`,t:`thumbs up pouce ok bien like`},{e:`👎`,t:`thumbs down pouce bas dislike`},{e:`👌`,t:`ok parfait`},{e:`✌️`,t:`victory victoire peace paix`},{e:`🤞`,t:`fingers crossed doigts croises`},{e:`🤟`,t:`love you`},{e:`🤘`,t:`rock horns metal cornes`},{e:`🤙`,t:`call appelle hang loose`},{e:`👈`,t:`left gauche pointing`},{e:`👉`,t:`right droite pointing`},{e:`👆`,t:`up haut pointing`},{e:`👇`,t:`down bas pointing`},{e:`☝️`,t:`one index up haut`},{e:`✋`,t:`stop hand main raised`},{e:`🤚`,t:`back hand main`},{e:`🖐️`,t:`hand main splayed`},{e:`🖖`,t:`vulcan spock star trek`},{e:`👋`,t:`wave bonjour hello salut goodbye`},{e:`🤝`,t:`handshake accord deal poignee`},{e:`🙏`,t:`pray priere merci thanks please`},{e:`💪`,t:`muscle fort biceps strong`},{e:`🦾`,t:`mechanical arm bras prothese`},{e:`👏`,t:`clap applaud bravo applaudir`},{e:`🙌`,t:`raise hands hourra celebrate`},{e:`👐`,t:`open hands`},{e:`🤲`,t:`palms up paumes`},{e:`🤜`,t:`fist poing right`},{e:`🤛`,t:`fist poing left`},{e:`✊`,t:`fist poing leve`},{e:`👊`,t:`fist punch poing frapper`},{e:`🤏`,t:`pinch petit small`},{e:`🤌`,t:`italian pinched`},{e:`🖕`,t:`middle finger doigt honneur`},{e:`✍️`,t:`write ecrire hand main`},{e:`🦶`,t:`foot pied`},{e:`🦵`,t:`leg jambe`},{e:`👂`,t:`ear oreille`},{e:`🦻`,t:`ear hearing appareil auditif`},{e:`👃`,t:`nose nez`},{e:`🧠`,t:`brain cerveau mind`},{e:`👀`,t:`eyes yeux regarder`},{e:`👁️`,t:`eye oeil`},{e:`👄`,t:`mouth bouche`},{e:`👅`,t:`tongue langue`},{e:`🦷`,t:`tooth dent`},{e:`🫀`,t:`heart anatomic coeur organe`},{e:`🫁`,t:`lungs poumons`}]},{label:`snippet.emoji_cat_hearts`,emojis:[{e:`❤️`,t:`heart coeur red rouge love amour`},{e:`🧡`,t:`orange heart coeur`},{e:`💛`,t:`yellow heart coeur jaune`},{e:`💚`,t:`green heart coeur vert`},{e:`💙`,t:`blue heart coeur bleu`},{e:`💜`,t:`purple heart coeur violet`},{e:`🖤`,t:`black heart coeur noir`},{e:`🤍`,t:`white heart coeur blanc`},{e:`🤎`,t:`brown heart coeur marron`},{e:`💔`,t:`broken heart coeur brise rupture`},{e:`❤️‍🔥`,t:`heart fire feu passion`},{e:`❤️‍🩹`,t:`heart mending coeur reparation`},{e:`💖`,t:`sparkling heart coeur brillant`},{e:`💕`,t:`two hearts coeurs`},{e:`💘`,t:`arrow heart cupid cupidon`},{e:`💝`,t:`ribbon heart cadeau`},{e:`💞`,t:`revolving hearts coeurs`},{e:`💟`,t:`heart decoration`},{e:`💌`,t:`love letter lettre enveloppe`},{e:`💋`,t:`kiss mark bisou levres`},{e:`❣️`,t:`heart exclamation`},{e:`💯`,t:`hundred 100 cent perfect parfait`},{e:`✨`,t:`sparkles etincelles magic magique brillant`},{e:`⭐`,t:`star etoile`},{e:`🌟`,t:`glowing star etoile`},{e:`💫`,t:`dizzy star vertige etoile`},{e:`🔥`,t:`fire feu hot flamme`},{e:`💥`,t:`boom explosion collision`},{e:`⚡`,t:`lightning eclair thunder tonnerre fast`},{e:`💢`,t:`anger colere symbol`},{e:`💨`,t:`dash vent wind fast vitesse`},{e:`💦`,t:`drops gouttes sweat eau`},{e:`💤`,t:`zzz sleep dormir sommeil`},{e:`🕳️`,t:`hole trou`},{e:`💭`,t:`thought pensee bulle`},{e:`🗯️`,t:`right anger bubble`},{e:`💬`,t:`speech bulle dialogue chat`}]},{label:`snippet.emoji_cat_objects`,emojis:[{e:`💻`,t:`laptop ordinateur computer portable`},{e:`🖥️`,t:`desktop computer ordinateur bureau`},{e:`⌨️`,t:`keyboard clavier`},{e:`🖱️`,t:`mouse souris`},{e:`💾`,t:`floppy disquette save sauvegarder`},{e:`💿`,t:`disk cd optical`},{e:`📀`,t:`dvd`},{e:`📱`,t:`phone mobile telephone smartphone`},{e:`📲`,t:`phone call mobile incoming`},{e:`☎️`,t:`telephone vintage`},{e:`📞`,t:`receiver combine phone`},{e:`📟`,t:`pager`},{e:`📠`,t:`fax`},{e:`🔋`,t:`battery batterie pile`},{e:`🔌`,t:`plug prise electrique`},{e:`💡`,t:`bulb idee idea light lumiere ampoule`},{e:`🔦`,t:`flashlight torche lampe`},{e:`🕯️`,t:`candle bougie`},{e:`📷`,t:`camera appareil photo`},{e:`📸`,t:`camera flash photo`},{e:`📹`,t:`video camera`},{e:`🎥`,t:`movie film cinema camera`},{e:`🎞️`,t:`film reel pellicule`},{e:`📽️`,t:`projector projecteur`},{e:`⏰`,t:`alarm reveil clock horloge`},{e:`⏱️`,t:`stopwatch chrono chronometre`},{e:`⏲️`,t:`timer minuteur`},{e:`🕰️`,t:`mantel clock horloge`},{e:`⌛`,t:`hourglass sablier done`},{e:`⏳`,t:`hourglass sablier flow running`},{e:`📡`,t:`satellite antenne`},{e:`🔭`,t:`telescope astronomie`},{e:`🔬`,t:`microscope science`},{e:`💊`,t:`pill pilule medicine medicament`},{e:`💉`,t:`syringe seringue injection vaccin`},{e:`🩹`,t:`bandage pansement`},{e:`🩺`,t:`stethoscope medecin`},{e:`🧪`,t:`tube eprouvette chimie chemistry`},{e:`🧬`,t:`dna adn gene`},{e:`🔍`,t:`search magnify loupe rechercher find left`},{e:`🔎`,t:`search magnify loupe rechercher find right`},{e:`🗝️`,t:`key cle old`},{e:`🔑`,t:`key cle`},{e:`🔐`,t:`lock key cle cadenas`},{e:`🔒`,t:`lock cadenas verrouille secure`},{e:`🔓`,t:`unlock cadenas ouvert`},{e:`🛡️`,t:`shield bouclier protection`},{e:`🔨`,t:`hammer marteau`},{e:`⚒️`,t:`tools outils hammer pick`},{e:`🛠️`,t:`tools outils hammer wrench`},{e:`🔧`,t:`wrench cle anglaise`},{e:`🔩`,t:`nut bolt ecrou`},{e:`⚙️`,t:`gear settings parametres engrenage config`},{e:`🪛`,t:`screwdriver tournevis`},{e:`🪝`,t:`hook crochet`},{e:`🧰`,t:`toolbox caisse outils`},{e:`🧲`,t:`magnet aimant`},{e:`🧱`,t:`brick brique`},{e:`⛏️`,t:`pick pioche`},{e:`🪓`,t:`axe hache`}]},{label:`snippet.emoji_cat_office`,emojis:[{e:`📝`,t:`memo note ecrire write`},{e:`✏️`,t:`pencil crayon`},{e:`🖊️`,t:`pen stylo bille`},{e:`🖋️`,t:`fountain pen stylo plume`},{e:`🖌️`,t:`paintbrush pinceau`},{e:`🖍️`,t:`crayon feutre`},{e:`📐`,t:`triangle ruler equerre`},{e:`📏`,t:`ruler regle`},{e:`📎`,t:`paperclip trombone attach`},{e:`🖇️`,t:`linked paperclips trombones`},{e:`📌`,t:`pushpin punaise`},{e:`📍`,t:`pin location lieu`},{e:`✂️`,t:`scissors ciseaux cut couper`},{e:`🗂️`,t:`card index dividers onglets`},{e:`📁`,t:`folder dossier`},{e:`📂`,t:`open folder dossier ouvert`},{e:`🗃️`,t:`card box boite fiches`},{e:`🗄️`,t:`file cabinet archive armoire`},{e:`📋`,t:`clipboard presse papier`},{e:`📃`,t:`page curl document`},{e:`📄`,t:`document page`},{e:`📜`,t:`scroll parchemin`},{e:`📰`,t:`newspaper journal presse`},{e:`🗞️`,t:`rolled newspaper journal`},{e:`📓`,t:`notebook carnet cahier`},{e:`📔`,t:`notebook decorated carnet`},{e:`📒`,t:`ledger registre`},{e:`📕`,t:`book rouge red ferme`},{e:`📗`,t:`book vert green`},{e:`📘`,t:`book bleu blue`},{e:`📙`,t:`book orange`},{e:`📚`,t:`books livres bibliotheque`},{e:`📖`,t:`open book livre ouvert`},{e:`🔖`,t:`bookmark marque page signet`},{e:`🏷️`,t:`label tag etiquette`},{e:`💼`,t:`briefcase mallette attache case business`},{e:`🗒️`,t:`spiral note notepad`},{e:`🗓️`,t:`spiral calendar calendrier`},{e:`📅`,t:`calendar calendrier date`},{e:`📆`,t:`tear off calendar calendrier`},{e:`🗑️`,t:`trash poubelle delete supprimer can`},{e:`🪣`,t:`bucket seau`},{e:`📦`,t:`package colis box boite`},{e:`📫`,t:`mailbox boite lettres closed flag up`},{e:`📪`,t:`mailbox boite lettres closed flag down`},{e:`📬`,t:`mailbox open boite lettres flag up`},{e:`📭`,t:`mailbox open boite lettres flag down`},{e:`📮`,t:`postbox boite aux lettres`},{e:`✉️`,t:`envelope enveloppe`},{e:`📧`,t:`email courriel mail at`},{e:`📨`,t:`email incoming recu`},{e:`📩`,t:`email arrow envoi`},{e:`📤`,t:`outbox envoyer sent`},{e:`📥`,t:`inbox recevoir`},{e:`📊`,t:`bar chart graphique barres histogramme`},{e:`📈`,t:`chart up tendance hausse croissance`},{e:`📉`,t:`chart down baisse decroissance`}]},{label:`snippet.emoji_cat_symbols`,emojis:[{e:`🆕`,t:`new nouveau nouvelle brand fresh neuf`},{e:`♻️`,t:`existing existant existante recycle recycler reuse reutiliser`},{e:`✅`,t:`check ok valide coche green`},{e:`☑️`,t:`check ballot case`},{e:`✔️`,t:`check coche mark`},{e:`❌`,t:`cross error erreur red rouge croix ko`},{e:`✖️`,t:`multiply multiplier cross`},{e:`❎`,t:`cross square button`},{e:`⚠️`,t:`warning attention danger`},{e:`ℹ️`,t:`info information`},{e:`❓`,t:`question red interrogation`},{e:`❔`,t:`question white interrogation`},{e:`❗`,t:`exclamation important red`},{e:`❕`,t:`exclamation white`},{e:`‼️`,t:`double exclamation`},{e:`⁉️`,t:`exclamation question`},{e:`🚀`,t:`rocket fusee launch lancer`},{e:`🎉`,t:`party popper tada fete celebration`},{e:`🎊`,t:`confetti ball fete`},{e:`🏆`,t:`trophy trophee winner`},{e:`🥇`,t:`gold medal medaille or first`},{e:`🥈`,t:`silver medal medaille argent second`},{e:`🥉`,t:`bronze medal medaille third`},{e:`🏅`,t:`medal medaille sports`},{e:`🎖️`,t:`military medal medaille`},{e:`🎯`,t:`target cible dart`},{e:`🎁`,t:`gift cadeau present`},{e:`🔔`,t:`bell cloche notify notification`},{e:`🔕`,t:`bell off muted silence`},{e:`📢`,t:`loudspeaker annonce public`},{e:`📣`,t:`megaphone porte voix`},{e:`📯`,t:`postal horn cor`},{e:`➕`,t:`plus add heavy`},{e:`➖`,t:`minus moins heavy`},{e:`➗`,t:`divide division`},{e:`♾️`,t:`infinity infini`},{e:`💲`,t:`dollar sign dollars money argent`},{e:`💱`,t:`currency exchange change devise`},{e:`©️`,t:`copyright`},{e:`®️`,t:`registered`},{e:`™️`,t:`trademark marque`},{e:`↔️`,t:`left right arrow fleche horizontal`},{e:`↕️`,t:`up down arrow fleche vertical`},{e:`↖️`,t:`up left arrow fleche`},{e:`↗️`,t:`up right arrow fleche`},{e:`↘️`,t:`down right arrow fleche`},{e:`↙️`,t:`down left arrow fleche`},{e:`⬅️`,t:`left arrow fleche gauche`},{e:`➡️`,t:`right arrow fleche droite`},{e:`⬆️`,t:`up arrow fleche haut`},{e:`⬇️`,t:`down arrow fleche bas`},{e:`🔃`,t:`clockwise vertical arrows`},{e:`🔄`,t:`counterclockwise arrows reload refresh recharger`},{e:`🔁`,t:`repeat loop boucle`},{e:`🔂`,t:`repeat single once`},{e:`🔀`,t:`shuffle melange random`},{e:`🔼`,t:`up button triangle`},{e:`🔽`,t:`down button triangle`},{e:`⏫`,t:`fast up double triangle`},{e:`⏬`,t:`fast down double triangle`},{e:`⏪`,t:`rewind back`},{e:`⏩`,t:`fast forward avance`},{e:`⏭️`,t:`next track suivant`},{e:`⏮️`,t:`previous track precedent`},{e:`⏯️`,t:`play pause`},{e:`▶️`,t:`play lecture`},{e:`⏸️`,t:`pause`},{e:`⏹️`,t:`stop`},{e:`⏺️`,t:`record enregistrer`},{e:`⏏️`,t:`eject ejecter`},{e:`🎵`,t:`music note musique`},{e:`🎶`,t:`music notes musique`},{e:`🔈`,t:`speaker low bas`},{e:`🔉`,t:`speaker medium moyen`},{e:`🔊`,t:`speaker loud fort haut son sound`},{e:`🔇`,t:`muted mute silence`},{e:`📶`,t:`signal antenne bars`},{e:`🛜`,t:`wireless wifi`},{e:`🔗`,t:`link lien chain`},{e:`⛓️`,t:`chains chaine`},{e:`🏁`,t:`finish flag checkered fin arrivee`},{e:`🚩`,t:`flag drapeau triangular`},{e:`🏳️`,t:`white flag drapeau blanc`},{e:`🏴`,t:`black flag drapeau noir`},{e:`🏳️‍🌈`,t:`rainbow lgbt pride drapeau arc en ciel`},{e:`🏳️‍⚧️`,t:`trans drapeau transgender`},{e:`🏴‍☠️`,t:`pirate drapeau jolly roger`}]}],Ef=[`1. Élément 1`,`2. Élément 2`,` 1. Sous-élément 2.1`,` 2. Sous-élément 2.2`,`3. Élément 3`,` 1. Sous-élément 3.1`,` 1. Sous-sous-élément 3.1.1`].join(`
14
14
  `),Df=[`- Élément 1`,`- Élément 2`,` - Sous-élément 2.1`,` - Sous-élément 2.2`,`- Élément 3`,` - Sous-élément 3.1`,` - Sous-sous-élément 3.1.1`].join(`
15
15
  `);function Of(){return Ef}function kf(){return Df}function Af(){return/^1\. .*(?:\n(?![ \t]*$)(?:\d+\. .*| {3,}.*|(?!(?:[-*+] |#{1,6}\s|>|```|~~~|\|)).+))*/gm}function jf(){return/^[-*+] .*(?:\n(?![ \t]*$)(?:[-*+] .*| {2,}.*|(?!(?:\d+\. |#{1,6}\s|>|```|~~~|\|)).+))*/gm}function Mf(e){return/^1\. /.test((e||``).trim())}function Nf(e){return/^[-*+] /.test((e||``).trim())}function Pf(e){return(e||``).split(`
16
16
  `).filter(e=>e.trim())}function Ff(e){let t=e||Of();if(/^\s*\d+\.\s+/m.test(t))return Pf(t).join(`
@@ -79,16 +79,16 @@ Texte`};case`link`:return{text:Ce(`snip-link-text`),textFallback:Y(`snippet.link
79
79
  <div id="ld-local-search-results" class="hidden">
80
80
  <div id="ld-local-search-title" class="px-3 py-1.5 text-xs font-medium text-gray-500 dark:text-gray-400 border-b border-gray-100 dark:border-gray-800"></div>
81
81
  <ol id="ld-local-search-list" class="max-h-40 overflow-y-auto divide-y divide-gray-100 dark:divide-gray-800 list-none m-0 p-0"></ol>
82
- </div>`,t.appendChild(s),t.classList.remove(`hidden`);let c=s.querySelector(`#ld-local-search-input`),l=s.querySelector(`#ld-local-search-clear`),u=s.querySelector(`#ld-local-search-results`),d=s.querySelector(`#ld-local-search-title`),f=s.querySelector(`#ld-local-search-list`),p=null;function m(){e.querySelectorAll(`mark.ld-local-mark`).forEach(e=>{let t=e.parentNode;for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}),e.normalize()}function h(e,t){let n=new Set;t.includes(e)&&n.add(e);let r=Fp(e.length);if(r===0)return n;let a=e[0];for(let t of i)t!==e&&(Math.abs(t.length-e.length)>r||e.length>=3&&t[0]!==a||Pp(e,t,r)<=r&&n.add(t));return n}function g(t){if(m(),!t){u.classList.add(`hidden`),l.classList.add(`hidden`),f.innerHTML=``;return}l.classList.remove(`hidden`);let r=Np(t),i=r.split(` `).filter(Boolean);if(!i.length){u.classList.add(`hidden`);return}let a=Np(e.textContent||``),o=i.map(e=>h(e,a));if(!o.some(e=>e.size>0)){d.textContent=n(`local_search.no_results`)||`No matches found.`,f.innerHTML=``,u.classList.remove(`hidden`);return}let s=new Set;o.forEach((e,t)=>{e.forEach(e=>{let n=e===i[t];s.add(n?e:`\\b`+Lp(e)+`\\b`)})});let c=Array.from(s).sort((e,t)=>t.length-e.length),p=RegExp(`(`+c.map(e=>e.startsWith(`\\b`)?e:Lp(e)).join(`|`)+`)`,`g`),g=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){return e.parentElement&&e.parentElement.closest(`mark`)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),v=[];for(;g.nextNode();)v.push(g.currentNode);let y=0,b=new Map;v.forEach(e=>{let t=e.textContent||``,{normalized:n,map:r}=Mp(t);if(!n)return;let i=[],a;for(p.lastIndex=0;(a=p.exec(n))!==null;){if(a[0].length===0){p.lastIndex++;continue}i.push({start:a.index,end:a.index+a[0].length,term:a[0]})}if(!i.length)return;let s=e.parentElement?.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre, blockquote`)||e.parentElement,c=``,l=0;i.forEach(e=>{let n=r[e.start],i=r[e.end];if(!(n<l)&&(c+=Ip(t.slice(l,n)),c+=`<mark class="ld-local-mark" id="ld-local-match-${y++}">${Ip(t.slice(n,i))}</mark>`,l=i,s)){b.has(s)||b.set(s,new Set);let t=b.get(s);o.forEach((n,r)=>{n.has(e.term)&&t.add(r)})}}),c+=Ip(t.slice(l));let u=document.createElement(`span`);u.innerHTML=c,e.parentNode.replaceChild(u,e)});let x=i.length,S=[];for(let[e,t]of b.entries())t.size===x&&S.push(e);let C;if(S.length>0){let t=new Set(S);C=Array.from(e.querySelectorAll(`mark.ld-local-mark`)).filter(e=>{let n=e.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre, blockquote`)||e.parentElement;return t.has(n)})}else C=Array.from(e.querySelectorAll(`mark.ld-local-mark`));if(!C.length){d.textContent=n(`local_search.no_results`)||`No matches found.`,f.innerHTML=``,u.classList.remove(`hidden`);return}d.textContent=(C.length===1?n(`local_search.count_singular`)||`{count} match`:n(`local_search.count_plural`)||`{count} matches`).replace(`{count}`,String(C.length)),f.innerHTML=C.map((e,t)=>{let n=e.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre, blockquote`)||e.parentElement,i=(n?n.textContent||``:e.textContent||``).trim(),a=Np(i),s=-1;for(let e of o)for(let t of e){let e=a.indexOf(t);e>=0&&(s<0||e<s)&&(s=e)}s<0&&(s=a.indexOf(r.split(` `)[0])),s<0&&(s=0);let c=Math.max(0,s-40),l=Math.min(i.length,s+80),u=(c>0?`…`:``)+i.slice(c,l)+(l<i.length?`…`:``);return`<li><button type="button" data-target="${e.id}" class="ld-local-item w-full text-left px-3 py-1.5 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors text-xs"><span class="text-gray-400 font-mono mr-2">${t+1}.</span>${Ip(u)}</button></li>`}).join(``),u.classList.remove(`hidden`),f.querySelectorAll(`.ld-local-item`).forEach(e=>{e.addEventListener(`click`,()=>_(e.dataset.target))})}function _(t){let n=document.getElementById(t),r=document.getElementById(`home-content-area`);if(!n||!r)return;let i=n.parentElement;for(;i&&i!==r;)i.tagName===`DETAILS`&&!i.open&&(i.open=!0),i=i.parentElement;e.querySelectorAll(`mark.ld-local-mark.ld-local-active`).forEach(e=>e.classList.remove(`ld-local-active`)),n.classList.add(`ld-local-active`),f.querySelectorAll(`.ld-local-item`).forEach(e=>{e.classList.toggle(`ld-local-item-active`,e.dataset.target===t)});let a=document.querySelector(`#home-doc-view header`),o=a?a.getBoundingClientRect().height:0,s=n.getBoundingClientRect().top,c=r.getBoundingClientRect().top,l=o+(r.clientHeight-o)/3;r.scrollTop+=s-c-l}c.addEventListener(`input`,()=>{p&&clearTimeout(p),p=window.setTimeout(()=>g(c.value.trim()),250)}),l.addEventListener(`click`,()=>{c.value=``,g(``),c.focus()}),c.addEventListener(`keydown`,e=>{e.key===`Escape`&&(c.value=``,g(``),c.blur())})}function zp(e,t){let n=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),r=[];for(;n.nextNode();)r.push(n.currentNode);let i=RegExp(`(${t.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)})`,`gi`),a=0;r.forEach(e=>{if(!(e.textContent||``).toLowerCase().includes(t.toLowerCase()))return;let n=document.createElement(`span`);n.innerHTML=(e.textContent||``).replace(i,e=>`<mark id="match-${a++}">${e}</mark>`),e.parentNode.replaceChild(n,e)});let o=[];return e.querySelectorAll(`mark[id^='match-']`).forEach(e=>{let n=((e.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre`)||e.parentElement).textContent||``).trim(),r=n.toLowerCase().indexOf(t.toLowerCase()),i=Math.max(0,r-40),a=Math.min(n.length,r+t.length+40),s=(i>0?`…`:``)+n.slice(i,a)+(a<n.length?`…`:``);o.push({id:e.id,snippet:s})}),o}function Bp(e){let t=document.getElementById(e),n=document.getElementById(`home-content-area`);if(!t||!n)return;let r=t.parentElement;for(;r&&r!==n;)r.tagName===`DETAILS`&&!r.open&&(r.open=!0),r=r.parentElement;document.querySelectorAll(`mark.match-active`).forEach(e=>e.classList.remove(`match-active`)),t.classList.add(`match-active`);let i=document.querySelector(`#home-doc-view header`),a=i?i.getBoundingClientRect().height:0,o=t.getBoundingClientRect().top,s=n.getBoundingClientRect().top,c=a+(n.clientHeight-a)/3;n.scrollTop+=o-s-c}var Vp=new Set([`anchor-doc-link`,`doc-link`,`anchor-link`,`image`,`link`,`collapsible`,`colored-text`,`colored-section`,`tree`,`code-block`,`table`,`blockquote`,`separator`,`ordered-list`,`unordered-list`,`heading-1`,`heading-2`,`heading-3`,`heading-4`]),Hp={table:{labelKey:`snippet.inline_edit_btn_table`,iconClass:`fa-solid fa-table-cells`},"code-block":{labelKey:`snippet.inline_edit_btn_code_block`,iconClass:`fa-solid fa-code`},blockquote:{labelKey:`snippet.inline_edit_btn_blockquote`,iconClass:`fa-solid fa-quote-right`},"ordered-list":{labelKey:`snippet.inline_edit_btn_ordered_list`,iconClass:`fa-solid fa-list-ol`},"unordered-list":{labelKey:`snippet.inline_edit_btn_unordered_list`,iconClass:`fa-solid fa-list-ul`},tree:{labelKey:`snippet.inline_edit_btn_tree`,iconClass:`fa-solid fa-folder-tree`},"colored-section":{labelKey:`snippet.inline_edit_btn_colored_section`,iconClass:`fa-solid fa-fill-drip`},"colored-text":{labelKey:`snippet.inline_edit_btn_colored_text`,iconClass:`fa-solid fa-highlighter`},collapsible:{labelKey:`snippet.inline_edit_btn_collapsible`,iconClass:`fa-solid fa-caret-right`},link:{labelKey:`snippet.inline_edit_btn_link`,iconClass:`fa-solid fa-link`},"doc-link":{labelKey:`snippet.inline_edit_btn_doc_link`,iconClass:`fa-solid fa-file-lines`},"anchor-link":{labelKey:`snippet.inline_edit_btn_anchor_link`,iconClass:`fa-solid fa-anchor`},"anchor-doc-link":{labelKey:`snippet.inline_edit_btn_anchor_doc_link`,iconClass:`fa-solid fa-anchor`},image:{labelKey:`snippet.inline_edit_btn_image`,iconClass:`fa-solid fa-image`},separator:{labelKey:`snippet.inline_edit_btn_separator`,iconClass:`fa-solid fa-minus`},"heading-1":{labelKey:`snippet.inline_edit_btn_heading_1`,iconClass:`fa-solid fa-heading`},"heading-2":{labelKey:`snippet.inline_edit_btn_heading_2`,iconClass:`fa-solid fa-heading`},"heading-3":{labelKey:`snippet.inline_edit_btn_heading_3`,iconClass:`fa-solid fa-heading`},"heading-4":{labelKey:`snippet.inline_edit_btn_heading_4`,iconClass:`fa-solid fa-heading`}};function Up(e){return Hp[e]||{labelKey:`snippet.inline_edit_btn`,iconClass:`fa-solid fa-pen-to-square`}}var Wp={table:`snippet.inline_delete_btn_table`,"code-block":`snippet.inline_delete_btn_code_block`,blockquote:`snippet.inline_delete_btn_blockquote`,"ordered-list":`snippet.inline_delete_btn_ordered_list`,"unordered-list":`snippet.inline_delete_btn_unordered_list`,tree:`snippet.inline_delete_btn_tree`,"colored-section":`snippet.inline_delete_btn_colored_section`,"colored-text":`snippet.inline_delete_btn_colored_text`,collapsible:`snippet.inline_delete_btn_collapsible`,link:`snippet.inline_delete_btn_link`,"doc-link":`snippet.inline_delete_btn_doc_link`,"anchor-link":`snippet.inline_delete_btn_anchor_link`,"anchor-doc-link":`snippet.inline_delete_btn_anchor_doc_link`,image:`snippet.inline_delete_btn_image`,separator:`snippet.inline_delete_btn_separator`,"heading-1":`snippet.inline_delete_btn_heading_1`,"heading-2":`snippet.inline_delete_btn_heading_2`,"heading-3":`snippet.inline_delete_btn_heading_3`,"heading-4":`snippet.inline_delete_btn_heading_4`};function Gp(e){return{labelKey:Wp[e]||`snippet.inline_delete_btn`,iconClass:`fa-solid fa-trash`}}var Kp=[{types:[`collapsible`],selector:`details`},{types:[`colored-section`],selector:`div[style*="border-left"]`},{types:[`colored-text`],selector:`span[style*="color"]`},{types:[`tree`,`code-block`],selector:`pre`},{types:[`table`],selector:`table`},{types:[`blockquote`],selector:`blockquote`},{types:[`separator`],selector:`hr`},{types:[`ordered-list`],selector:`ol`},{types:[`unordered-list`],selector:`ul`},{types:[`heading-1`],selector:`h1`},{types:[`heading-2`],selector:`h2`},{types:[`heading-3`],selector:`h3`},{types:[`heading-4`],selector:`h4`},{types:[`image`],selector:`img`},{types:[`anchor-doc-link`,`doc-link`,`anchor-link`,`link`],selector:`a[href]`}],qp=null;function Jp(e,t){return e.start===t.start&&e.end===t.end?!0:e.start>=t.start&&e.end<=t.end||t.start>=e.start&&t.end<=e.end?!1:e.start<t.end&&t.start<e.end}function Yp(e,t,n){if(!n||!n.trim())return;let r=Op(n);if(!r||!Vp.has(r))return;let i={start:t,end:t+n.length,type:r};e.some(e=>Jp(e,i))||e.push(i)}function Xp(e,t,n,r=0){let i;for(;i=n.exec(t);){let t=i[r];Yp(e,i.index+(r>0?i[0].indexOf(t):0),t),i[0].length===0&&(n.lastIndex+=1)}}function Zp(e,t){let n=t;for(;n>0&&e[n-1]!==`
83
- `;)--n;let r=e.slice(n,t);return/^[ \t]+$/.test(r)?r:``}function Qp(e,t){let n=/```[\s\S]*?```/g,r;for(;r=n.exec(t);){let i=r[0];if(!i.trim()){i.length===0&&(n.lastIndex+=1);continue}let a=Op(i);if(!a||!Vp.has(a))continue;let o=Zp(t,r.index),s={start:r.index-o.length,end:r.index+i.length,type:a,indent:o};e.some(e=>Jp(e,s))||e.push(s)}}function $p(e){let t=[];Xp(t,e,/<details[\s\S]*?<\/details>/gi),Xp(t,e,/<div\b[^>]*border-left[^>]*>[\s\S]*?<\/div>/gi),Qp(t,e),Xp(t,e,/(?:^|\n\n)(#{1,4} [^\n]+)/g,1),Xp(t,e,/<span\b[^>]*color:[^>]*>[\s\S]*?<\/span>/gi),Xp(t,e,RegExp(`(?:^|\\n)((`+ld()+`))`,`g`),1),Xp(t,e,/^> .*(?:\n>.*)*/gm),Xp(t,e,Af()),Xp(t,e,jf()),Xp(t,e,/!\[[^\]\n]*\]\([^)]+\)/g),Xp(t,e,/\[[^\]\n]+\]\([^)]+\)/g);let n=e.match(/^---\s*\n[\s\S]*?\n---/);return Xp(t,e,/^---$/gm),t.filter(e=>e.type===`separator`?!n||e.start>n[0].length:!0).sort((e,t)=>e.start-t.start)}function em(e,t){return Array.from(e.querySelectorAll(t)).filter(e=>!e.parentElement.closest(`ol, ul`))}function tm(e,t){e.querySelectorAll(`[data-inline-snippet-index]`).forEach(e=>{e.removeAttribute(`data-inline-snippet-index`),e.classList.remove(`ld-inline-snippet-target`)});for(let{types:n,selector:r}of Kp){let i=t.filter(e=>n.includes(e.type));if(!i.length)continue;let a=r===`ol`||r===`ul`?em(e,r):Array.from(e.querySelectorAll(r)),o=Math.min(i.length,a.length);for(let e=0;e<o;e+=1)a[e].dataset.inlineSnippetIndex=String(t.indexOf(i[e])),a[e].classList.add(`ld-inline-snippet-target`)}}function nm(){qp&&=(qp.remove(),null)}function rm(e,t){nm();let n=Array.isArray(t)?t:[t],r=n[0]||{},i=document.createElement(`div`);i.id=`inline-snippet-popup`,r.dataAction&&(i.dataset.action=r.dataAction),r.dataType&&(i.dataset.snippetType=r.dataType),i.className=`fixed z-50 flex flex-col rounded-lg border border-blue-200 dark:border-blue-800 bg-white dark:bg-gray-900 shadow-lg p-1`,i.style.position=`fixed`,i.style.display=`flex`,i.style.flexDirection=`column`,i.style.width=`max-content`,i.style.zIndex=`50`;for(let e of n){let t=e.dataAction===`delete`,n=document.createElement(`button`);n.type=`button`,e.dataAction&&(n.dataset.action=e.dataAction),n.className=`inline-flex items-center gap-2 rounded-md px-3 py-2 text-sm font-semibold `+(t?`text-red-700 dark:text-red-300 hover:bg-red-50 dark:hover:bg-red-900/30`:`text-blue-700 dark:text-blue-300 hover:bg-blue-50 dark:hover:bg-blue-900/30`);let r=document.createElement(`i`);r.className=e.iconClass,r.setAttribute(`aria-hidden`,`true`);let a=document.createElement(`span`);a.textContent=Y(e.labelKey),n.append(r,a),n.addEventListener(`click`,t=>{t.preventDefault(),t.stopPropagation(),nm(),e.onActivate()}),i.appendChild(n)}document.body.appendChild(i);let a=i.getBoundingClientRect(),o=Math.min(window.innerWidth-a.width-8,Math.max(8,e.clientX)),s=Math.max(8,e.clientY-a.height-8);i.style.left=`${o}px`,i.style.top=`${s}px`,qp=i}function im(e,t){let n=t instanceof Element?t:null;for(;n&&n.parentElement&&n.parentElement!==e;)n=n.parentElement;return!n||n===e||n.parentElement!==e?null:n}function am(e,t){if(typeof t!=`number`)return null;let n=Array.from(e.children);if(!n.length)return null;let r=null,i=null;for(let e of n){let n=e.getBoundingClientRect();if(n.bottom<t)r=e;else if(n.top>t)i||=e;else return e}return r||i}function om(e,t,n){if(t.matches(`[data-inline-snippet-index]`)){let e=n[Number(t.dataset.inlineSnippetIndex)];if(e)return e.end}let r=null,i=Array.from(t.querySelectorAll(`[data-inline-snippet-index]`));if(i.length>0){let e=-1;for(let t of i){let r=n[Number(t.dataset.inlineSnippetIndex)];r&&r.end>e&&(e=r.end)}e>=0&&(r=e)}else{let n=(t.textContent||``).trim();if(n){let t=n.split(`
82
+ </div>`,t.appendChild(s),t.classList.remove(`hidden`);let c=s.querySelector(`#ld-local-search-input`),l=s.querySelector(`#ld-local-search-clear`),u=s.querySelector(`#ld-local-search-results`),d=s.querySelector(`#ld-local-search-title`),f=s.querySelector(`#ld-local-search-list`),p=null;function m(){e.querySelectorAll(`mark.ld-local-mark`).forEach(e=>{let t=e.parentNode;for(;e.firstChild;)t.insertBefore(e.firstChild,e);t.removeChild(e)}),e.normalize()}function h(e,t){let n=new Set;t.includes(e)&&n.add(e);let r=Fp(e.length);if(r===0)return n;let a=e[0];for(let t of i)t!==e&&(Math.abs(t.length-e.length)>r||e.length>=3&&t[0]!==a||Pp(e,t,r)<=r&&n.add(t));return n}function g(t){if(m(),!t){u.classList.add(`hidden`),l.classList.add(`hidden`),f.innerHTML=``;return}l.classList.remove(`hidden`);let r=Np(t),i=r.split(` `).filter(Boolean);if(!i.length){u.classList.add(`hidden`);return}let a=Np(e.textContent||``),o=i.map(e=>h(e,a));if(!o.some(e=>e.size>0)){d.textContent=n(`local_search.no_results`)||`No matches found.`,f.innerHTML=``,u.classList.remove(`hidden`);return}let s=new Set;o.forEach((e,t)=>{e.forEach(e=>{let n=e===i[t];s.add(n?e:`\\b`+Lp(e)+`\\b`)})});let c=Array.from(s).sort((e,t)=>t.length-e.length),p=RegExp(`(`+c.map(e=>e.startsWith(`\\b`)?e:Lp(e)).join(`|`)+`)`,`g`),g=document.createTreeWalker(e,NodeFilter.SHOW_TEXT,{acceptNode(e){return e.parentElement&&e.parentElement.closest(`mark`)?NodeFilter.FILTER_REJECT:NodeFilter.FILTER_ACCEPT}}),v=[];for(;g.nextNode();)v.push(g.currentNode);let y=0,b=new Map;v.forEach(e=>{let t=e.textContent||``,{normalized:n,map:r}=Mp(t);if(!n)return;let i=[],a;for(p.lastIndex=0;(a=p.exec(n))!==null;){if(a[0].length===0){p.lastIndex++;continue}i.push({start:a.index,end:a.index+a[0].length,term:a[0]})}if(!i.length)return;let s=e.parentElement?.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre, blockquote`)||e.parentElement,c=``,l=0;i.forEach(e=>{let n=r[e.start],i=r[e.end];if(!(n<l)&&(c+=Ip(t.slice(l,n)),c+=`<mark class="ld-local-mark" id="ld-local-match-${y++}">${Ip(t.slice(n,i))}</mark>`,l=i,s)){b.has(s)||b.set(s,new Set);let t=b.get(s);o.forEach((n,r)=>{n.has(e.term)&&t.add(r)})}}),c+=Ip(t.slice(l));let u=document.createElement(`span`);u.innerHTML=c,e.parentNode.replaceChild(u,e)});let x=i.length,S=[];for(let[e,t]of b.entries())t.size===x&&S.push(e);let C;if(S.length>0){let t=new Set(S);C=Array.from(e.querySelectorAll(`mark.ld-local-mark`)).filter(e=>{let n=e.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre, blockquote`)||e.parentElement;return t.has(n)})}else C=Array.from(e.querySelectorAll(`mark.ld-local-mark`));if(!C.length){d.textContent=n(`local_search.no_results`)||`No matches found.`,f.innerHTML=``,u.classList.remove(`hidden`);return}d.textContent=(C.length===1?n(`local_search.count_singular`)||`{count} match`:n(`local_search.count_plural`)||`{count} matches`).replace(`{count}`,String(C.length)),f.innerHTML=C.map((e,t)=>{let n=e.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre, blockquote`)||e.parentElement,i=(n?n.textContent||``:e.textContent||``).trim(),a=Np(i),s=-1;for(let e of o)for(let t of e){let e=a.indexOf(t);e>=0&&(s<0||e<s)&&(s=e)}s<0&&(s=a.indexOf(r.split(` `)[0])),s<0&&(s=0);let c=Math.max(0,s-40),l=Math.min(i.length,s+80),u=(c>0?`…`:``)+i.slice(c,l)+(l<i.length?`…`:``);return`<li><button type="button" data-target="${e.id}" class="ld-local-item w-full text-left px-3 py-1.5 hover:bg-gray-50 dark:hover:bg-gray-800 transition-colors text-xs"><span class="text-gray-400 font-mono mr-2">${t+1}.</span>${Ip(u)}</button></li>`}).join(``),u.classList.remove(`hidden`),f.querySelectorAll(`.ld-local-item`).forEach(e=>{e.addEventListener(`click`,()=>_(e.dataset.target))})}function _(t){let n=document.getElementById(t),r=document.getElementById(`home-content-area`);if(!n||!r)return;let i=n.parentElement;for(;i&&i!==r;)i.tagName===`DETAILS`&&!i.open&&(i.open=!0),i=i.parentElement;e.querySelectorAll(`mark.ld-local-mark.ld-local-active`).forEach(e=>e.classList.remove(`ld-local-active`)),n.classList.add(`ld-local-active`),f.querySelectorAll(`.ld-local-item`).forEach(e=>{e.classList.toggle(`ld-local-item-active`,e.dataset.target===t)});let a=document.querySelector(`#home-doc-view header`),o=a?a.getBoundingClientRect().height:0,s=n.getBoundingClientRect().top,c=r.getBoundingClientRect().top,l=o+(r.clientHeight-o)/3;r.scrollTop+=s-c-l}c.addEventListener(`input`,()=>{p&&clearTimeout(p),p=window.setTimeout(()=>g(c.value.trim()),250)}),l.addEventListener(`click`,()=>{c.value=``,g(``),c.focus()}),c.addEventListener(`keydown`,e=>{e.key===`Escape`&&(c.value=``,g(``),c.blur())})}var zp=e=>e.normalize(`NFC`).normalize(`NFD`).replace(/[̀-ͯ]/g,``).toLowerCase();function Bp(e,t){let n=zp(t);if(!n)return[];let r=document.createTreeWalker(e,NodeFilter.SHOW_TEXT),i=[];for(;r.nextNode();)i.push(r.currentNode);let a=0;i.forEach(e=>{let t=(e.textContent||``).normalize(`NFC`),r=zp(t);if(!r.includes(n))return;let i=``,o=0;for(;o<=r.length;){let e=r.indexOf(n,o);if(e===-1){i+=t.slice(o);break}i+=t.slice(o,e),i+=`<mark id="match-${a++}">${t.slice(e,e+n.length)}</mark>`,o=e+n.length}let s=document.createElement(`span`);s.innerHTML=i,e.parentNode.replaceChild(s,e)});let o=[];return e.querySelectorAll(`mark[id^='match-']`).forEach(e=>{let r=((e.closest(`p, li, td, h1, h2, h3, h4, h5, h6, pre`)||e.parentElement).textContent||``).trim(),i=zp(r).indexOf(n),a=Math.max(0,i-40),s=Math.min(r.length,i+t.length+40),c=(a>0?`…`:``)+r.slice(a,s)+(s<r.length?`…`:``);o.push({id:e.id,snippet:c})}),o}function Vp(e){let t=document.getElementById(e),n=document.getElementById(`home-content-area`);if(!t||!n)return;let r=t.parentElement;for(;r&&r!==n;)r.tagName===`DETAILS`&&!r.open&&(r.open=!0),r=r.parentElement;document.querySelectorAll(`mark.match-active`).forEach(e=>e.classList.remove(`match-active`)),t.classList.add(`match-active`);let i=document.querySelector(`#home-doc-view header`),a=i?i.getBoundingClientRect().height:0,o=t.getBoundingClientRect().top,s=n.getBoundingClientRect().top,c=a+(n.clientHeight-a)/3;n.scrollTop+=o-s-c}var Hp=new Set([`anchor-doc-link`,`doc-link`,`anchor-link`,`image`,`link`,`collapsible`,`colored-text`,`colored-section`,`tree`,`code-block`,`table`,`blockquote`,`separator`,`ordered-list`,`unordered-list`,`heading-1`,`heading-2`,`heading-3`,`heading-4`]),Up={table:{labelKey:`snippet.inline_edit_btn_table`,iconClass:`fa-solid fa-table-cells`},"code-block":{labelKey:`snippet.inline_edit_btn_code_block`,iconClass:`fa-solid fa-code`},blockquote:{labelKey:`snippet.inline_edit_btn_blockquote`,iconClass:`fa-solid fa-quote-right`},"ordered-list":{labelKey:`snippet.inline_edit_btn_ordered_list`,iconClass:`fa-solid fa-list-ol`},"unordered-list":{labelKey:`snippet.inline_edit_btn_unordered_list`,iconClass:`fa-solid fa-list-ul`},tree:{labelKey:`snippet.inline_edit_btn_tree`,iconClass:`fa-solid fa-folder-tree`},"colored-section":{labelKey:`snippet.inline_edit_btn_colored_section`,iconClass:`fa-solid fa-fill-drip`},"colored-text":{labelKey:`snippet.inline_edit_btn_colored_text`,iconClass:`fa-solid fa-highlighter`},collapsible:{labelKey:`snippet.inline_edit_btn_collapsible`,iconClass:`fa-solid fa-caret-right`},link:{labelKey:`snippet.inline_edit_btn_link`,iconClass:`fa-solid fa-link`},"doc-link":{labelKey:`snippet.inline_edit_btn_doc_link`,iconClass:`fa-solid fa-file-lines`},"anchor-link":{labelKey:`snippet.inline_edit_btn_anchor_link`,iconClass:`fa-solid fa-anchor`},"anchor-doc-link":{labelKey:`snippet.inline_edit_btn_anchor_doc_link`,iconClass:`fa-solid fa-anchor`},image:{labelKey:`snippet.inline_edit_btn_image`,iconClass:`fa-solid fa-image`},separator:{labelKey:`snippet.inline_edit_btn_separator`,iconClass:`fa-solid fa-minus`},"heading-1":{labelKey:`snippet.inline_edit_btn_heading_1`,iconClass:`fa-solid fa-heading`},"heading-2":{labelKey:`snippet.inline_edit_btn_heading_2`,iconClass:`fa-solid fa-heading`},"heading-3":{labelKey:`snippet.inline_edit_btn_heading_3`,iconClass:`fa-solid fa-heading`},"heading-4":{labelKey:`snippet.inline_edit_btn_heading_4`,iconClass:`fa-solid fa-heading`}};function Wp(e){return Up[e]||{labelKey:`snippet.inline_edit_btn`,iconClass:`fa-solid fa-pen-to-square`}}var Gp={table:`snippet.inline_delete_btn_table`,"code-block":`snippet.inline_delete_btn_code_block`,blockquote:`snippet.inline_delete_btn_blockquote`,"ordered-list":`snippet.inline_delete_btn_ordered_list`,"unordered-list":`snippet.inline_delete_btn_unordered_list`,tree:`snippet.inline_delete_btn_tree`,"colored-section":`snippet.inline_delete_btn_colored_section`,"colored-text":`snippet.inline_delete_btn_colored_text`,collapsible:`snippet.inline_delete_btn_collapsible`,link:`snippet.inline_delete_btn_link`,"doc-link":`snippet.inline_delete_btn_doc_link`,"anchor-link":`snippet.inline_delete_btn_anchor_link`,"anchor-doc-link":`snippet.inline_delete_btn_anchor_doc_link`,image:`snippet.inline_delete_btn_image`,separator:`snippet.inline_delete_btn_separator`,"heading-1":`snippet.inline_delete_btn_heading_1`,"heading-2":`snippet.inline_delete_btn_heading_2`,"heading-3":`snippet.inline_delete_btn_heading_3`,"heading-4":`snippet.inline_delete_btn_heading_4`};function Kp(e){return{labelKey:Gp[e]||`snippet.inline_delete_btn`,iconClass:`fa-solid fa-trash`}}var qp=[{types:[`collapsible`],selector:`details`},{types:[`colored-section`],selector:`div[style*="border-left"]`},{types:[`colored-text`],selector:`span[style*="color"]`},{types:[`tree`,`code-block`],selector:`pre`},{types:[`table`],selector:`table`},{types:[`blockquote`],selector:`blockquote`},{types:[`separator`],selector:`hr`},{types:[`ordered-list`],selector:`ol`},{types:[`unordered-list`],selector:`ul`},{types:[`heading-1`],selector:`h1`},{types:[`heading-2`],selector:`h2`},{types:[`heading-3`],selector:`h3`},{types:[`heading-4`],selector:`h4`},{types:[`image`],selector:`img`},{types:[`anchor-doc-link`,`doc-link`,`anchor-link`,`link`],selector:`a[href]`}],Jp=null;function Yp(e,t){return e.start===t.start&&e.end===t.end?!0:e.start>=t.start&&e.end<=t.end||t.start>=e.start&&t.end<=e.end?!1:e.start<t.end&&t.start<e.end}function Xp(e,t,n){if(!n||!n.trim())return;let r=Op(n);if(!r||!Hp.has(r))return;let i={start:t,end:t+n.length,type:r};e.some(e=>Yp(e,i))||e.push(i)}function Zp(e,t,n,r=0){let i;for(;i=n.exec(t);){let t=i[r];Xp(e,i.index+(r>0?i[0].indexOf(t):0),t),i[0].length===0&&(n.lastIndex+=1)}}function Qp(e,t){let n=t;for(;n>0&&e[n-1]!==`
83
+ `;)--n;let r=e.slice(n,t);return/^[ \t]+$/.test(r)?r:``}function $p(e,t){let n=/```[\s\S]*?```/g,r;for(;r=n.exec(t);){let i=r[0];if(!i.trim()){i.length===0&&(n.lastIndex+=1);continue}let a=Op(i);if(!a||!Hp.has(a))continue;let o=Qp(t,r.index),s={start:r.index-o.length,end:r.index+i.length,type:a,indent:o};e.some(e=>Yp(e,s))||e.push(s)}}function em(e){let t=[];Zp(t,e,/<details[\s\S]*?<\/details>/gi),Zp(t,e,/<div\b[^>]*border-left[^>]*>[\s\S]*?<\/div>/gi),$p(t,e),Zp(t,e,/(?:^|\n\n)(#{1,4} [^\n]+)/g,1),Zp(t,e,/<span\b[^>]*color:[^>]*>[\s\S]*?<\/span>/gi),Zp(t,e,RegExp(`(?:^|\\n)((`+ld()+`))`,`g`),1),Zp(t,e,/^> .*(?:\n>.*)*/gm),Zp(t,e,Af()),Zp(t,e,jf()),Zp(t,e,/!\[[^\]\n]*\]\([^)]+\)/g),Zp(t,e,/\[[^\]\n]+\]\([^)]+\)/g);let n=e.match(/^---\s*\n[\s\S]*?\n---/);return Zp(t,e,/^---$/gm),t.filter(e=>e.type===`separator`?!n||e.start>n[0].length:!0).sort((e,t)=>e.start-t.start)}function tm(e,t){return Array.from(e.querySelectorAll(t)).filter(e=>!e.parentElement.closest(`ol, ul`))}function nm(e,t){e.querySelectorAll(`[data-inline-snippet-index]`).forEach(e=>{e.removeAttribute(`data-inline-snippet-index`),e.classList.remove(`ld-inline-snippet-target`)});for(let{types:n,selector:r}of qp){let i=t.filter(e=>n.includes(e.type));if(!i.length)continue;let a=r===`ol`||r===`ul`?tm(e,r):Array.from(e.querySelectorAll(r)),o=Math.min(i.length,a.length);for(let e=0;e<o;e+=1)a[e].dataset.inlineSnippetIndex=String(t.indexOf(i[e])),a[e].classList.add(`ld-inline-snippet-target`)}}function rm(){Jp&&=(Jp.remove(),null)}function im(e,t){rm();let n=Array.isArray(t)?t:[t],r=n[0]||{},i=document.createElement(`div`);i.id=`inline-snippet-popup`,r.dataAction&&(i.dataset.action=r.dataAction),r.dataType&&(i.dataset.snippetType=r.dataType),i.className=`fixed z-50 flex flex-col rounded-lg border border-blue-200 dark:border-blue-800 bg-white dark:bg-gray-900 shadow-lg p-1`,i.style.position=`fixed`,i.style.display=`flex`,i.style.flexDirection=`column`,i.style.width=`max-content`,i.style.zIndex=`50`;for(let e of n){let t=e.dataAction===`delete`,n=document.createElement(`button`);n.type=`button`,e.dataAction&&(n.dataset.action=e.dataAction),n.className=`inline-flex items-center gap-2 rounded-md px-3 py-2 text-sm font-semibold `+(t?`text-red-700 dark:text-red-300 hover:bg-red-50 dark:hover:bg-red-900/30`:`text-blue-700 dark:text-blue-300 hover:bg-blue-50 dark:hover:bg-blue-900/30`);let r=document.createElement(`i`);r.className=e.iconClass,r.setAttribute(`aria-hidden`,`true`);let a=document.createElement(`span`);a.textContent=Y(e.labelKey),n.append(r,a),n.addEventListener(`click`,t=>{t.preventDefault(),t.stopPropagation(),rm(),e.onActivate()}),i.appendChild(n)}document.body.appendChild(i);let a=i.getBoundingClientRect(),o=Math.min(window.innerWidth-a.width-8,Math.max(8,e.clientX)),s=Math.max(8,e.clientY-a.height-8);i.style.left=`${o}px`,i.style.top=`${s}px`,Jp=i}function am(e,t){let n=t instanceof Element?t:null;for(;n&&n.parentElement&&n.parentElement!==e;)n=n.parentElement;return!n||n===e||n.parentElement!==e?null:n}function om(e,t){if(typeof t!=`number`)return null;let n=Array.from(e.children);if(!n.length)return null;let r=null,i=null;for(let e of n){let n=e.getBoundingClientRect();if(n.bottom<t)r=e;else if(n.top>t)i||=e;else return e}return r||i}function sm(e,t,n){if(t.matches(`[data-inline-snippet-index]`)){let e=n[Number(t.dataset.inlineSnippetIndex)];if(e)return e.end}let r=null,i=Array.from(t.querySelectorAll(`[data-inline-snippet-index]`));if(i.length>0){let e=-1;for(let t of i){let r=n[Number(t.dataset.inlineSnippetIndex)];r&&r.end>e&&(e=r.end)}e>=0&&(r=e)}else{let n=(t.textContent||``).trim();if(n){let t=n.split(`
84
84
  `)[0].trim().slice(0,60);if(t){let n=e.indexOf(t);n>=0&&(r=n)}}}if(r===null)return null;let a=e.indexOf(`
85
85
 
86
- `,r);return a>=0?a:e.length}function sm(e,t,n){if(t.matches(`[data-inline-snippet-index]`)){let e=n[Number(t.dataset.inlineSnippetIndex)];if(e)return e.start}let r=Array.from(t.querySelectorAll(`[data-inline-snippet-index]`));if(r.length>0){let e=1/0;for(let t of r){let r=n[Number(t.dataset.inlineSnippetIndex)];r&&r.start<e&&(e=r.start)}if(e<1/0)return e}let i=(t.textContent||``).trim();if(i){let t=i.split(`
87
- `)[0].trim().slice(0,60);if(t){let n=e.indexOf(t);if(n>=0)return n}}return null}function cm(e,t,n,r,i){let a=im(t,n)||am(t,i);if(!a)return e.length;let o=om(e,a,r);if(o!==null)return o;let s=a.previousElementSibling;for(;s;){let t=om(e,s,r);if(t!==null){let n=e.indexOf(`
86
+ `,r);return a>=0?a:e.length}function cm(e,t,n){if(t.matches(`[data-inline-snippet-index]`)){let e=n[Number(t.dataset.inlineSnippetIndex)];if(e)return e.start}let r=Array.from(t.querySelectorAll(`[data-inline-snippet-index]`));if(r.length>0){let e=1/0;for(let t of r){let r=n[Number(t.dataset.inlineSnippetIndex)];r&&r.start<e&&(e=r.start)}if(e<1/0)return e}let i=(t.textContent||``).trim();if(i){let t=i.split(`
87
+ `)[0].trim().slice(0,60);if(t){let n=e.indexOf(t);if(n>=0)return n}}return null}function lm(e,t,n,r,i){let a=am(t,n)||om(t,i);if(!a)return e.length;let o=sm(e,a,r);if(o!==null)return o;let s=a.previousElementSibling;for(;s;){let t=sm(e,s,r);if(t!==null){let n=e.indexOf(`
88
88
 
89
- `,t+1);return n>=0?n:e.length}s=s.previousElementSibling}let c=a.nextElementSibling;for(;c;){let t=sm(e,c,r);if(t!==null){let n=e.lastIndexOf(`
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 lm(e,t,n){if(!e||typeof t!=`string`)return()=>{};let r=$p(t);tm(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=Up(e.type),o=Gp(e.type);rm(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=cm(t,e,i.target,r,i.clientY);o!==null&&(i.preventDefault(),rm(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(),rm(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=>{qp&&!qp.contains(e.target)&&nm()},c=e=>{e.key===`Escape`&&nm()};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),nm(),e.querySelectorAll(`[data-inline-snippet-index]`).forEach(e=>{e.removeAttribute(`data-inline-snippet-index`),e.classList.remove(`ld-inline-snippet-target`)})}}var um=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>`),dm=W(`<span class="text-xs text-gray-400 dark:text-gray-500"> </span>`),fm=W(`<span> </span>`),pm=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>`),mm=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>`),hm=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>`),gm=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>`),_m=W(`<span class="text-gray-300 dark:text-gray-600 mx-1">·</span>`),vm=W(`<!> <button class="text-blue-600 dark:text-blue-400 hover:underline"> </button>`,1),ym=W(`<div class="no-print mt-2 flex flex-wrap gap-1 text-xs"></div>`),bm=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>`),xm=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>`),Sm=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>`),Cm=W(`<div id="doc-content" data-testid="doc-content"></div>`),wm=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>`),Tm=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),Em=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>`),Dm=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>`),Om=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>`),km=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 Am(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?zp(H(r),n):[],!0),H(p)&&Rp(H(r),H(p),Y),f=lm(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(`![image](/images/${r})`,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=km();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=um(),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=dm(),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=pm(),n=R(t),r=e=>{var t=fm(),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=gm(),a=R(i),o=e=>{var t=mm(),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,hm())};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=ym();$r(r,21,n,Yr,(e,n,r)=>{var i=vm(),a=z(i),o=e=>{G(e,_m())};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=xm(),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=bm(),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,()=>Bp(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=Sm();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=Cm();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=Tm(),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=wm(),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=Em(),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=Dm(),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=Om(),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 jm=W(`<p class="px-3 py-4 text-xs text-gray-400 text-center"> </p>`),Mm=W(`<p class="px-3 py-3 text-xs text-red-400 text-center"> </p>`),Nm=W(`<p class="px-3 py-3 text-xs text-gray-400 text-center"> </p>`),Pm=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">&#128193;</span> <span class="truncate text-gray-700 dark:text-gray-300"> </span></button>`),Fm=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>`),Im=W(`<p class="text-xs text-red-500"> </p>`),Lm=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 Rm(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=Lm(),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=Fm(),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=jm(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.loading`)]),G(e,t)},m=e=>{var t=Mm(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`modal.new_folder.error_loading`)]),G(e,t)},h=e=>{var t=Nm(),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=Pm(),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=Im(),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 zm=W(`<option></option>`),Bm=W(`<p class="px-3 py-4 text-xs text-gray-400 text-center"> </p>`),Vm=W(`<p class="px-3 py-4 text-xs text-red-400 text-center"> </p>`),Hm=W(`<p class="px-3 py-3 text-xs text-gray-400 text-center"> </p>`),Um=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">&#128193;</span> <span class="text-gray-700 dark:text-gray-300 truncate"> </span></button>`),Wm=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>`),Gm=W(`<p class="text-xs text-red-500"> </p>`),Km=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">&#10133; <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">&#128193; <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 qm(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=Km(),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=zm(),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=Wm(),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=Bm(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.loading`)]),G(e,t)},u=e=>{var t=Vm(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.cannot_read_dir`)]),G(e,t)},g=e=>{var t=Hm(),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=Um(),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=Gm(),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 Jm=W(`<p class="text-sm text-gray-400 py-2"> </p>`),Ym=W(`<p class="text-sm text-red-500"> </p>`),Xm=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>`),Zm=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>`),Qm=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>`),$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 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>`),eh=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 th(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,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}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;">&#128193; ${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 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(`![image](/images/${r})`,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">&#128193;</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">&#128193;</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">&#10133; <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">&#128193; <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,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`).replace(/"/g,`&quot;`).replace(/'/g,`&#39;`)}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;">&#128193; ${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">
@@ -131,13 +131,13 @@ Texte`};case`link`:return{text:Ce(`snip-link-text`),textFallback:Y(`snippet.link
131
131
  setTimeout(() => window.print(), 800);
132
132
  <\/script>
133
133
  </body>
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=eh(),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=Zm(),n=R(t),r=R(n),c=e=>{var t=Jm(),n=R(t,!0);N(t),V(e=>K(n,e),[()=>Y(`common.loading`)]),G(e,t)},l=e=>{var t=Ym(),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=Xm(),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=Qm(),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=$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),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=Qm(),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 nh=W(`<p class="px-3 py-4 text-xs text-gray-400 text-center"> </p>`),rh=W(`<p> </p>`),ih=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">&#128193;</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>`),ah=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">&#128196;</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>`),oh=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">&#8593; 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>`),sh=W(`<label class="flex items-center gap-1.5 text-xs text-gray-700 dark:text-gray-300 cursor-pointer"><input type="checkbox"/> </label>`),ch=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">&#128193;</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>`),lh=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">&#10003; Select: <span class="font-mono"> </span></button>`),uh=W(`<!> <!>`,1),dh=W(`<div> </div>`),fh=W(`<div> </div> <div> </div> <div> </div> <!>`,1),ph=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>`),mh=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>`),hh=W(`<p class="absolute inset-0 flex items-center justify-center text-gray-400 dark:text-gray-500 text-sm animate-pulse"> </p>`),gh=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>`),_h=W(`<div class="text-gray-400 text-center py-2">—</div>`),vh=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>`),yh=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">&#128193; <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">&#128193; <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 bh(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=yh(),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=oh(),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=nh(),n=R(t,!0);N(t),V(()=>K(n,H(ge))),G(e,t)},l=e=>{var t=rh(),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=ih(),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=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`,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=sh(),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=oh(),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=nh(),n=R(t,!0);N(t),V(()=>K(n,H(Te))),G(e,t)},l=e=>{var t=uh(),n=z(t),r=e=>{var t=rh(),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=ch(),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=lh(),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=mh(),n=R(t),r=R(n),i=e=>{var t=fh(),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=dh(),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=ph(),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=hh(),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=vh(),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=gh(),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,_h())};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 xh=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),Sh=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>`),Ch=W(`<p class="p-8 text-red-500"> </p>`),wh=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>`),Th=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 Eh(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=Th(),w=z(C),T=R(w);ua(T,{get title(){return H(u)},subtitle:``,actions:e=>{var t=xh(),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=Sh(),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=Ch(),n=R(t,!0);N(t),V(()=>K(n,H(c))),G(e,t)},i=e=>{Am(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=wh(),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);Rm(ne,{get open(){return H(n)},onclose:()=>I(n,!1),onsuccess:S});var re=B(ne,2);qm(re,{get open(){return H(r)},onclose:()=>I(r,!1),onsuccess:async e=>{await S(),y(e)}});var ie=B(re,2);th(ie,{get open(){return H(i)},onclose:()=>I(i,!1)}),bh(B(ie,2),{get open(){return H(a)},onclose:()=>I(a,!1)}),G(e,C),Ke()}Nr([`click`,`input`]);var Dh=`modulepreload`,Oh=function(e){return`/`+e},kh={},Ah=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=Oh(t,n),t in kh)return;kh[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`:Dh,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)})},jh=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.
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">&#128193;</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">&#128196;</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">&#8593; 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">&#128193;</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">&#10003; 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">&#128193; <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">&#128193; <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 Mh(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 Ah(async()=>{let{initDiagram:e}=await import(`./main-DHEytvxK.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=jh(),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 Nh={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 Ph(){Nh.isDirty=!0,document.getElementById(`btnSave`).disabled=!1}var Fh=`custom-shape`,Ih=`custom-shape:`,Lh=[{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 Rh(e){return typeof e==`string`&&e.startsWith(`custom-shape:`)}function zh(e){return Rh(e)?e.slice(13):null}function Bh(e){return e&&Nh.customShapeDefs&&Nh.customShapeDefs.get(e)||null}function Vh(e){let t=Bh(e);return[t&&t.width||65,t&&t.height||65]}function Hh(e){let t=Bh(e);return t&&Array.isArray(t.anchors)&&t.anchors.length?t.anchors:Lh}function Uh(e){let t=Bh(e);return t&&[`center`,`below`,`above`,`right`,`left`].includes(t.labelPlacement)?t.labelPlacement:`below`}async function Wh(){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:[];Nh.customShapeLibraries=n,Nh.customShapeDefs=new Map,n.forEach(e=>{(e.shapes||[]).forEach(e=>Nh.customShapeDefs.set(e.id,e))})}catch{Nh.customShapeLibraries=[],Nh.customShapeDefs=new Map}}function Gh(){let e=document.getElementById(`customShapeBar`),t=document.getElementById(`customShapeBarBody`);if(!e||!t)return;t.innerHTML=``;let n=(Nh.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:`${Ih}${e.id}`}}))}),t.appendChild(n)})}function Kh(){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=>({"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`})[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(Lh)}}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-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=>({"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`})[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)}">
141
141
  <button class="btn btn-danger !h-7 !px-0">×</button>
142
- `;let[s,c,u]=o.querySelectorAll(`input`);s.addEventListener(`input`,()=>{t.id=s.value.trim()||`p${n+1}`,b()}),c.addEventListener(`input`,()=>{t.x=l(Number(c.value)/100),b()}),u.addEventListener(`input`,()=>{t.y=l(Number(u.value)/100),b()}),o.querySelector(`button`).addEventListener(`click`,()=>{i.anchors=i.anchors.filter(e=>e!==t),b()}),e.anchorList.appendChild(o)})}function x(t,n){let r=e.previewStage.getBoundingClientRect();t.x=l((n.clientX-r.left)/r.width),t.y=l((n.clientY-r.top)/r.height)}let S=[],C=(e,t,n,r)=>{e.addEventListener(t,n,r),S.push(()=>e.removeEventListener(t,n,r))};return C(e.previewStage,`pointermove`,e=>{if(!a||!i)return;let t=i.anchors.find(e=>e.id===a);t&&(x(t,e),b())}),C(window,`pointerup`,()=>{a=null}),C(e.previewStage,`click`,e=>{if(e.target.closest(`.anchor-dot`)||a||!i)return;let t={id:`p${(i.anchors||[]).length+1}`,x:.5,y:.5};x(t,e),i.anchors=[...i.anchors||[],t],b()}),C(document.getElementById(`btnAddLibrary`),`click`,async()=>{let e={id:o(`lib`),name:`New library`,shapes:[]};t.libraries.push(e),n=e.id,r=null,i=h(),g(),await m()}),C(e.librarySelect,`change`,()=>{n=e.librarySelect.value,r=s()?.shapes[0]?.id||null,i=c()?structuredClone(c()):h(),g()}),C(e.libraryName,`change`,async()=>{let t=s();t&&(t.name=e.libraryName.value.trim()||t.name,_(),await m())}),C(document.getElementById(`btnNewShape`),`click`,()=>{r=null,i=h(),g()}),C(document.getElementById(`btnDeleteShape`),`click`,async()=>{let e=s();!e||!r||(e.shapes=e.shapes.filter(e=>e.id!==r),r=e.shapes[0]?.id||null,i=c()?structuredClone(c()):h(),g(),await m())}),C(document.getElementById(`btnDefaultAnchors`),`click`,()=>{i.anchors=structuredClone(Lh),b()}),C(document.getElementById(`btnClearAnchors`),`click`,()=>{i.anchors=[],b()}),C(document.getElementById(`btnSaveShape`),`click`,async()=>{let t=s();if(!t||!i||!i.imageSrc)return;i.name=e.shapeName.value.trim()||`Untitled shape`,i.width=Math.max(16,Math.min(1200,Math.round(Number(e.shapeWidth.value)||65))),i.height=Math.max(16,Math.min(1200,Math.round(Number(e.shapeHeight.value)||65))),i.labelPlacement=u(e.labelPlacement.value),i.showInDiagram=e.shapeShowInDiagram.checked;let n=t.shapes.findIndex(e=>e.id===i.id);n>=0?t.shapes[n]=structuredClone(i):t.shapes.push(structuredClone(i)),r=i.id,g(),await m()}),[`shapeName`,`shapeWidth`,`shapeHeight`,`labelPlacement`,`shapeShowInDiagram`].forEach(t=>{C(document.getElementById(t),`input`,()=>{i.name=e.shapeName.value,i.width=Number(e.shapeWidth.value)||65,i.height=Number(e.shapeHeight.value)||65,i.labelPlacement=u(e.labelPlacement.value),i.showInDiagram=e.shapeShowInDiagram.checked})}),C(e.imageFile,`change`,async()=>{let t=e.imageFile.files&&e.imageFile.files[0];if(!t||!i)return;let n=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(r.result),r.onerror=n,r.readAsDataURL(t)}),r=(t.name.split(`.`).pop()||`png`).toLowerCase().replace(/[^a-z0-9]/g,``)||`png`,a=t.name.replace(/\.[^.]+$/,``).slice(0,60),o=await(await fetch(`/api/images/upload`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:n,ext:r,name:a})})).json();i.imageSrc=`/images/${o.filename}`,(!e.shapeName.value||e.shapeName.value===`New shape`)&&(i.name=a||i.name),y()}),p(),()=>{S.forEach(e=>e()),S.length=0}}var qh=W(`<div class="ld-shape-editor h-screen overflow-hidden bg-gray-50 text-gray-900"><header class="h-12 border-b border-gray-200 bg-white flex items-center gap-2 px-3"><button class="btn">← Back</button> <h1 class="text-sm font-semibold">Shape editor</h1> <span id="saveState" class="ml-auto text-xs text-gray-500"></span></header> <main class="h-[calc(100vh-3rem)] grid grid-cols-[17rem_1fr] overflow-hidden"><aside class="border-r border-gray-200 bg-white flex flex-col min-h-0"><div class="p-3 border-b border-gray-200 space-y-2"><label class="block text-xs font-semibold text-gray-500">Library</label> <div class="flex gap-2"><select id="librarySelect" class="field flex-1"></select> <button id="btnAddLibrary" class="btn">+</button></div> <input id="libraryName" class="field w-full" placeholder="Library name"/></div> <div class="p-3 border-b border-gray-200 flex gap-2"><button id="btnNewShape" class="btn btn-primary flex-1">New shape</button> <button id="btnDeleteShape" class="btn btn-danger">Delete</button></div> <div id="shapeList" class="flex-1 overflow-y-auto p-2 space-y-1"></div></aside> <section class="min-w-0 min-h-0 overflow-y-auto p-5"><div class="grid grid-cols-[minmax(20rem,34rem)_minmax(20rem,1fr)] gap-5 items-start"><div class="space-y-3"><div id="previewStage"><img id="previewImage" alt=""/></div> <p class="text-xs text-gray-500">Click on the image to add an anchor. Drag anchors to refine their
143
- position.</p></div> <div class="space-y-4"><div class="grid grid-cols-2 gap-3"><label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Shape name</span> <input id="shapeName" class="field w-full" placeholder="Shape name"/></label> <label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Image / SVG</span> <input id="imageFile" type="file" accept="image/*,.svg" class="block w-full text-sm"/></label> <label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Width</span> <input id="shapeWidth" type="number" min="16" max="1200" class="field w-full"/></label> <label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Height</span> <input id="shapeHeight" type="number" min="16" max="1200" class="field w-full"/></label> <label class="space-y-1 col-span-2"><span class="block text-xs font-semibold text-gray-500">Text placement</span> <select id="labelPlacement" class="field w-full"><option> </option><option> </option><option> </option><option> </option><option> </option></select></label> <label class="col-span-2 flex items-start gap-2 rounded-md border border-gray-200 bg-white px-2 py-2 text-sm"><input id="shapeShowInDiagram" type="checkbox" class="mt-0.5 h-4 w-4 rounded border-gray-300 text-blue-600"/> <span class="space-y-0.5"><span class="block font-semibold text-gray-700"> </span> <span class="block text-xs text-gray-500"> </span></span></label></div> <div class="flex flex-wrap gap-2"><button id="btnDefaultAnchors" class="btn">Use 8 default anchors</button> <button id="btnClearAnchors" class="btn">Clear anchors</button> <button id="btnSaveShape" class="btn btn-primary">Save shape</button></div> <div><div class="flex items-center justify-between mb-2"><h2 class="text-xs font-semibold uppercase tracking-wide text-gray-500">Anchors</h2> <span id="anchorCount" class="text-xs text-gray-500"></span></div> <div id="anchorList" class="space-y-1"></div></div></div></div></section></main></div>`);function Jh(e,t){Ge(t,!1),Vi(async()=>{try{await fa((await fetch(`/api/config`).then(e=>e.json())).language||`en`)}catch{await fa(`en`)}return Kh()}),Ri();var n=qh(),r=R(n),i=R(r);Pe(4),N(r);var a=B(r,2),o=B(R(a),2),s=R(o),c=B(R(s),2),l=R(c),u=B(R(l),8),d=B(R(u),2),f=R(d),p=R(f,!0);N(f),f.value=f.__value=`below`;var m=B(f),h=R(m,!0);N(m),m.value=m.__value=`above`;var g=B(m),_=R(g,!0);N(g),g.value=g.__value=`right`;var v=B(g),y=R(v,!0);N(v),v.value=v.__value=`left`;var b=B(v),x=R(b,!0);N(b),b.value=b.__value=`center`,N(d),N(u);var S=B(u,2),C=B(R(S),2),w=R(C),T=R(w,!0);N(w);var E=B(w,2),D=R(E,!0);N(E),N(C),N(S),N(l),Pe(4),N(c),N(s),N(o),N(a),N(n),V((e,t,n,r,i,a,o)=>{K(p,e),K(h,t),K(_,n),K(y,r),K(x,i),K(T,a),K(D,o)},[()=>Y(`shape_editor.label_placement.below`),()=>Y(`shape_editor.label_placement.above`),()=>Y(`shape_editor.label_placement.right`),()=>Y(`shape_editor.label_placement.left`),()=>Y(`shape_editor.label_placement.center`),()=>Y(`shape_editor.show_in_diagram_label`),()=>Y(`shape_editor.show_in_diagram_hint`)]),U(`click`,i,()=>history.back()),G(e,n),Ke()}Nr([`click`]);var Yh=W(`<p style="padding:2rem"> </p>`);function Xh(e,t){Ge(t,!0);function n(e){return e.length>1?e.replace(/\/+$/,``):e}let r=F(L(n(window.location.pathname)));window.addEventListener(`popstate`,()=>{I(r,n(window.location.pathname),!0)}),On(()=>{H(r)===`/blueprint`?document.documentElement.setAttribute(`data-blueprint`,``):document.documentElement.removeAttribute(`data-blueprint`)});function i(e){history.pushState(null,``,e),I(r,n(e),!0)}var a=Ur(),o=z(a),s=e=>{Ca(e,{navigate:i})},c=e=>{ao(e,{})},l=e=>{Sl(e,{})},u=e=>{Fl(e,{})},d=e=>{hu(e,{navigate:i})},f=e=>{Tu(e,{})},p=e=>{Mh(e,{})},m=e=>{Jh(e,{})},h=e=>{Eh(e,{})},g=e=>{var t=Yh(),n=R(t);N(t),V(()=>K(n,`Route "${H(r)??``}" — not yet migrated.`)),G(e,t)};q(o,e=>{H(r)===`/admin`?e(s):H(r)===`/blueprint`?e(c,1):H(r)===`/workspace`?e(l,2):H(r)===`/files`?e(u,3):H(r)===`/context`?e(d,4):H(r)===`/agents`?e(f,5):H(r)===`/diagram`?e(p,6):H(r)===`/shape-editor`?e(m,7):H(r)===`/`?e(h,8):e(g,-1)}),G(e,a),Ke()}Wr(Xh,{target:document.getElementById(`app`)});export{Bh as a,Wh as c,Nh as d,fa as f,Vh as i,Gh as l,zh as n,Uh as o,Y as p,Hh as r,Rh as s,Fh as t,Ph as u};
142
+ `;let[s,c,u]=o.querySelectorAll(`input`);s.addEventListener(`input`,()=>{t.id=s.value.trim()||`p${n+1}`,b()}),c.addEventListener(`input`,()=>{t.x=l(Number(c.value)/100),b()}),u.addEventListener(`input`,()=>{t.y=l(Number(u.value)/100),b()}),o.querySelector(`button`).addEventListener(`click`,()=>{i.anchors=i.anchors.filter(e=>e!==t),b()}),e.anchorList.appendChild(o)})}function x(t,n){let r=e.previewStage.getBoundingClientRect();t.x=l((n.clientX-r.left)/r.width),t.y=l((n.clientY-r.top)/r.height)}let S=[],C=(e,t,n,r)=>{e.addEventListener(t,n,r),S.push(()=>e.removeEventListener(t,n,r))};return C(e.previewStage,`pointermove`,e=>{if(!a||!i)return;let t=i.anchors.find(e=>e.id===a);t&&(x(t,e),b())}),C(window,`pointerup`,()=>{a=null}),C(e.previewStage,`click`,e=>{if(e.target.closest(`.anchor-dot`)||a||!i)return;let t={id:`p${(i.anchors||[]).length+1}`,x:.5,y:.5};x(t,e),i.anchors=[...i.anchors||[],t],b()}),C(document.getElementById(`btnAddLibrary`),`click`,async()=>{let e={id:o(`lib`),name:`New library`,shapes:[]};t.libraries.push(e),n=e.id,r=null,i=h(),g(),await m()}),C(e.librarySelect,`change`,()=>{n=e.librarySelect.value,r=s()?.shapes[0]?.id||null,i=c()?structuredClone(c()):h(),g()}),C(e.libraryName,`change`,async()=>{let t=s();t&&(t.name=e.libraryName.value.trim()||t.name,_(),await m())}),C(document.getElementById(`btnNewShape`),`click`,()=>{r=null,i=h(),g()}),C(document.getElementById(`btnDeleteShape`),`click`,async()=>{let e=s();!e||!r||(e.shapes=e.shapes.filter(e=>e.id!==r),r=e.shapes[0]?.id||null,i=c()?structuredClone(c()):h(),g(),await m())}),C(document.getElementById(`btnDefaultAnchors`),`click`,()=>{i.anchors=structuredClone(Rh),b()}),C(document.getElementById(`btnClearAnchors`),`click`,()=>{i.anchors=[],b()}),C(document.getElementById(`btnSaveShape`),`click`,async()=>{let t=s();if(!t||!i||!i.imageSrc)return;i.name=e.shapeName.value.trim()||`Untitled shape`,i.width=Math.max(16,Math.min(1200,Math.round(Number(e.shapeWidth.value)||65))),i.height=Math.max(16,Math.min(1200,Math.round(Number(e.shapeHeight.value)||65))),i.labelPlacement=u(e.labelPlacement.value),i.showInDiagram=e.shapeShowInDiagram.checked;let n=t.shapes.findIndex(e=>e.id===i.id);n>=0?t.shapes[n]=structuredClone(i):t.shapes.push(structuredClone(i)),r=i.id,g(),await m()}),[`shapeName`,`shapeWidth`,`shapeHeight`,`labelPlacement`,`shapeShowInDiagram`].forEach(t=>{C(document.getElementById(t),`input`,()=>{i.name=e.shapeName.value,i.width=Number(e.shapeWidth.value)||65,i.height=Number(e.shapeHeight.value)||65,i.labelPlacement=u(e.labelPlacement.value),i.showInDiagram=e.shapeShowInDiagram.checked})}),C(e.imageFile,`change`,async()=>{let t=e.imageFile.files&&e.imageFile.files[0];if(!t||!i)return;let n=await new Promise((e,n)=>{let r=new FileReader;r.onload=()=>e(r.result),r.onerror=n,r.readAsDataURL(t)}),r=(t.name.split(`.`).pop()||`png`).toLowerCase().replace(/[^a-z0-9]/g,``)||`png`,a=t.name.replace(/\.[^.]+$/,``).slice(0,60),o=await(await fetch(`/api/images/upload`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({data:n,ext:r,name:a})})).json();i.imageSrc=`/images/${o.filename}`,(!e.shapeName.value||e.shapeName.value===`New shape`)&&(i.name=a||i.name),y()}),p(),()=>{S.forEach(e=>e()),S.length=0}}var Jh=W(`<div class="ld-shape-editor h-screen overflow-hidden bg-gray-50 text-gray-900"><header class="h-12 border-b border-gray-200 bg-white flex items-center gap-2 px-3"><button class="btn">← Back</button> <h1 class="text-sm font-semibold">Shape editor</h1> <span id="saveState" class="ml-auto text-xs text-gray-500"></span></header> <main class="h-[calc(100vh-3rem)] grid grid-cols-[17rem_1fr] overflow-hidden"><aside class="border-r border-gray-200 bg-white flex flex-col min-h-0"><div class="p-3 border-b border-gray-200 space-y-2"><label class="block text-xs font-semibold text-gray-500">Library</label> <div class="flex gap-2"><select id="librarySelect" class="field flex-1"></select> <button id="btnAddLibrary" class="btn">+</button></div> <input id="libraryName" class="field w-full" placeholder="Library name"/></div> <div class="p-3 border-b border-gray-200 flex gap-2"><button id="btnNewShape" class="btn btn-primary flex-1">New shape</button> <button id="btnDeleteShape" class="btn btn-danger">Delete</button></div> <div id="shapeList" class="flex-1 overflow-y-auto p-2 space-y-1"></div></aside> <section class="min-w-0 min-h-0 overflow-y-auto p-5"><div class="grid grid-cols-[minmax(20rem,34rem)_minmax(20rem,1fr)] gap-5 items-start"><div class="space-y-3"><div id="previewStage"><img id="previewImage" alt=""/></div> <p class="text-xs text-gray-500">Click on the image to add an anchor. Drag anchors to refine their
143
+ position.</p></div> <div class="space-y-4"><div class="grid grid-cols-2 gap-3"><label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Shape name</span> <input id="shapeName" class="field w-full" placeholder="Shape name"/></label> <label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Image / SVG</span> <input id="imageFile" type="file" accept="image/*,.svg" class="block w-full text-sm"/></label> <label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Width</span> <input id="shapeWidth" type="number" min="16" max="1200" class="field w-full"/></label> <label class="space-y-1"><span class="block text-xs font-semibold text-gray-500">Height</span> <input id="shapeHeight" type="number" min="16" max="1200" class="field w-full"/></label> <label class="space-y-1 col-span-2"><span class="block text-xs font-semibold text-gray-500">Text placement</span> <select id="labelPlacement" class="field w-full"><option> </option><option> </option><option> </option><option> </option><option> </option></select></label> <label class="col-span-2 flex items-start gap-2 rounded-md border border-gray-200 bg-white px-2 py-2 text-sm"><input id="shapeShowInDiagram" type="checkbox" class="mt-0.5 h-4 w-4 rounded border-gray-300 text-blue-600"/> <span class="space-y-0.5"><span class="block font-semibold text-gray-700"> </span> <span class="block text-xs text-gray-500"> </span></span></label></div> <div class="flex flex-wrap gap-2"><button id="btnDefaultAnchors" class="btn">Use 8 default anchors</button> <button id="btnClearAnchors" class="btn">Clear anchors</button> <button id="btnSaveShape" class="btn btn-primary">Save shape</button></div> <div><div class="flex items-center justify-between mb-2"><h2 class="text-xs font-semibold uppercase tracking-wide text-gray-500">Anchors</h2> <span id="anchorCount" class="text-xs text-gray-500"></span></div> <div id="anchorList" class="space-y-1"></div></div></div></div></section></main></div>`);function Yh(e,t){Ge(t,!1),Vi(async()=>{try{await fa((await fetch(`/api/config`).then(e=>e.json())).language||`en`)}catch{await fa(`en`)}return qh()}),Ri();var n=Jh(),r=R(n),i=R(r);Pe(4),N(r);var a=B(r,2),o=B(R(a),2),s=R(o),c=B(R(s),2),l=R(c),u=B(R(l),8),d=B(R(u),2),f=R(d),p=R(f,!0);N(f),f.value=f.__value=`below`;var m=B(f),h=R(m,!0);N(m),m.value=m.__value=`above`;var g=B(m),_=R(g,!0);N(g),g.value=g.__value=`right`;var v=B(g),y=R(v,!0);N(v),v.value=v.__value=`left`;var b=B(v),x=R(b,!0);N(b),b.value=b.__value=`center`,N(d),N(u);var S=B(u,2),C=B(R(S),2),w=R(C),T=R(w,!0);N(w);var E=B(w,2),D=R(E,!0);N(E),N(C),N(S),N(l),Pe(4),N(c),N(s),N(o),N(a),N(n),V((e,t,n,r,i,a,o)=>{K(p,e),K(h,t),K(_,n),K(y,r),K(x,i),K(T,a),K(D,o)},[()=>Y(`shape_editor.label_placement.below`),()=>Y(`shape_editor.label_placement.above`),()=>Y(`shape_editor.label_placement.right`),()=>Y(`shape_editor.label_placement.left`),()=>Y(`shape_editor.label_placement.center`),()=>Y(`shape_editor.show_in_diagram_label`),()=>Y(`shape_editor.show_in_diagram_hint`)]),U(`click`,i,()=>history.back()),G(e,n),Ke()}Nr([`click`]);var Xh=W(`<p style="padding:2rem"> </p>`);function Zh(e,t){Ge(t,!0);function n(e){return e.length>1?e.replace(/\/+$/,``):e}let r=F(L(n(window.location.pathname)));window.addEventListener(`popstate`,()=>{I(r,n(window.location.pathname),!0)}),On(()=>{H(r)===`/blueprint`?document.documentElement.setAttribute(`data-blueprint`,``):document.documentElement.removeAttribute(`data-blueprint`)});function i(e){history.pushState(null,``,e),I(r,n(e),!0)}var a=Ur(),o=z(a),s=e=>{Ca(e,{navigate:i})},c=e=>{ao(e,{})},l=e=>{Sl(e,{})},u=e=>{Fl(e,{})},d=e=>{hu(e,{navigate:i})},f=e=>{Tu(e,{})},p=e=>{Nh(e,{})},m=e=>{Yh(e,{})},h=e=>{Dh(e,{})},g=e=>{var t=Xh(),n=R(t);N(t),V(()=>K(n,`Route "${H(r)??``}" — not yet migrated.`)),G(e,t)};q(o,e=>{H(r)===`/admin`?e(s):H(r)===`/blueprint`?e(c,1):H(r)===`/workspace`?e(l,2):H(r)===`/files`?e(u,3):H(r)===`/context`?e(d,4):H(r)===`/agents`?e(f,5):H(r)===`/diagram`?e(p,6):H(r)===`/shape-editor`?e(m,7):H(r)===`/`?e(h,8):e(g,-1)}),G(e,a),Ke()}Wr(Zh,{target:document.getElementById(`app`)});export{Vh as a,Gh as c,Ph as d,fa as f,Hh as i,Kh as l,Bh as n,Wh as o,Y as p,Uh as r,zh as s,Ih as t,Fh as u};