@inkeep/open-knowledge 0.0.0-dev-20260501144307 → 0.0.0-dev-20260501150416
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +5 -5
- package/dist/constants-CGiUuTdz.mjs +2 -0
- package/dist/{dist-B-uWyCj3.mjs → dist-B969m3rv.mjs} +1 -1
- package/dist/{dist-WQbZIrx7.mjs → dist-BR3nldpO.mjs} +2 -2
- package/dist/{dist-CUghvkAf.mjs → dist-oDoSs1Bl.mjs} +7 -7
- package/dist/index.mjs +1 -1
- package/dist/init-0WpsEJer.mjs +1 -0
- package/dist/{init-DpiVQYhQ.mjs → init-B3ijkT7_.mjs} +3 -3
- package/dist/init-BRl7X3F9.mjs +1 -0
- package/dist/{init-qoXDcT6N.mjs → init-Czgpyj7J.mjs} +2 -2
- package/dist/{loader-BEUtMT2_.mjs → loader-Dk5RaTzD.mjs} +2 -2
- package/dist/loader-Jnb82Nxh.mjs +1 -0
- package/dist/paths-NLm46qS1.mjs +2 -0
- package/dist/paths-s1VdY11r.mjs +1 -0
- package/dist/{preview-BIrbsSSc.mjs → preview-BkLJiEZ1.mjs} +2 -2
- package/dist/preview-DFbaN55s.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-C3KENqJ7.js → ActivityModeContent-BASIn1jX.js} +1 -1
- package/dist/public/assets/DocumentContext-CSOslMNT.js +37 -0
- package/dist/public/assets/{GraphPanel-YIuSwj1X.js → GraphPanel-D2ZevzyI.js} +2 -2
- package/dist/public/assets/OutlinePanel-D_xYEkm6.js +2 -0
- package/dist/public/assets/SettingsPane-o4hmcrlw.js +6 -0
- package/dist/public/assets/{SourceEditor-DGIgtF_h.js → SourceEditor-Bw3inYl7.js} +2 -2
- package/dist/public/assets/{config-validation-events-Dlj9dOCp.js → config-validation-events-mqmIrycG.js} +1 -1
- package/dist/public/assets/{index-DiLfeu2w.css → index-CKzUuzYV.css} +1 -1
- package/dist/public/assets/index-CRwvkGXF.js +1848 -0
- package/dist/public/assets/{target-navigation-intent-BeUCdVKa.js → target-navigation-intent-1238Z_HW.js} +1 -1
- package/dist/public/assets/{toggle-group-CyBGhndP.js → toggle-group-C5MXNna8.js} +3 -3
- package/dist/public/assets/{tooltip-FdwzzIbl.js → tooltip-CzI9zWJi.js} +1 -1
- package/dist/public/index.html +8 -8
- package/dist/{server-Bc0tGxRk.mjs → server-Cb1yd7Zc.mjs} +2 -2
- package/dist/src-BtSrIQfg.mjs +1 -0
- package/dist/start-RBQezJG7.mjs +1 -0
- package/dist/{start-BSqokDQs.mjs → start-_eaR3T65.mjs} +2 -2
- package/package.json +2 -2
- package/dist/constants-D4b3yFb4.mjs +0 -2
- package/dist/init-CleqrmS6.mjs +0 -1
- package/dist/init-D1vMwuMO.mjs +0 -1
- package/dist/loader-CwvZAVlq.mjs +0 -1
- package/dist/paths-B1biT3Kh.mjs +0 -2
- package/dist/paths-BQoQfIvS.mjs +0 -1
- package/dist/preview-BNMytxTe.mjs +0 -1
- package/dist/public/assets/DocumentContext-gM6_1mHt.js +0 -34
- package/dist/public/assets/SettingsPane-tlYUoGwR.js +0 -6
- package/dist/public/assets/clipboard-CW1hOwDY.js +0 -5
- package/dist/public/assets/index-n9oW9uU-.js +0 -1848
- package/dist/src-CGZcpVS_.mjs +0 -1
- package/dist/start-C7hQj_dW.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as e}from"./toggle-group-
|
|
1
|
+
import{f as e}from"./toggle-group-C5MXNna8.js";import{S as t}from"./button-Dyz7QGIk.js";var n=t(`arrow-up-right`,[[`path`,{d:`M7 7h10v10`,key:`1tivn9`}],[`path`,{d:`M7 17 17 7`,key:`1vkiza`}]]),r=t(`globe`,[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]);function i(e){switch(e.kind){case`doc`:return`doc`;case`folder`:case`folder-index`:return`folder`;case`missing`:return`missing`}}function a(t,n){let r=e(t,n);return{resolvedTarget:r,hashDocName:r.target,displayState:i(r)}}export{r as n,n as r,a as t};
|
|
@@ -368,7 +368,7 @@ ${t.slice(l+2)}`,d+=1;else break}t.push({indent:l,number:parseInt(s,10),content:
|
|
|
368
368
|
`)].join(`
|
|
369
369
|
`);case`REMOVED_KEY`:{let t=e.path.join(`.`),n=[`${e.source?`Removed key at ${e.source.file}:${e.source.line}:${e.source.column}`:`Removed key in configuration`}: ${t}`,e.redirect];if(e.source?.snippet&&e.source.snippet.length>0)for(let t of e.source.snippet.split(`
|
|
370
370
|
`))n.push(` ${t}`);return n.join(`
|
|
371
|
-
`)}case`WRITE_ERROR`:return`Failed to write config file: ${e.detail}`;case`UNKNOWN`:return e.message??`Unknown error.`}}function Q$(e){let t=e;for(let e=0;e<16;e++){if(t==null||t?._zod?.def?.shape!==void 0)return t;let e=t?._zod?.def?.innerType;if(e===void 0)return t;t=e}return t}function $$(e,t){let n=e;for(let e of t){n=Q$(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function e1(e,t){let n=$$(e,t);if(n!==void 0)return WE(n)}var t1=2e3;function n1(e){let t=Date.now();for(let[n,r]of e.entries()){let i=r;i.timestamp&&t-i.timestamp>3e4&&e.delete(n)}}function r1(e,t){for(let[,n]of e.entries()){let e=n;if(e.timestamp&&e.timestamp>t)return!0}return!1}var i1=`__system__`,a1=`__config__/project`,o1=`__user__/config.yml`;Object.freeze([a1,o1]);var s1=[`incoming`,`outgoing`,`both`];function c1(e){return s1.includes(e)}var l1=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],u1=[`video/mp4`,`video/webm`,`video/ogg`],d1=[`audio/mpeg`,`audio/wav`,`audio/ogg`],f1=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),p1=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),m1=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),h1=`wikiembed`,g1=`toast`,_1=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`,`pdf`,`mp4`,`webm`,`mov`,`m4v`,`mkv`,`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),v1=uD.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3}}}}),y1=CD.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}}}),b1=_D.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}}}),x1=hh.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),S1=/^---\r?\n([\s\S]*?\r?\n)?---(\r?\n|$)/;function C1(e){let t=e.match(S1);return t?{frontmatter:t[0],body:e.slice(t[0].length)}:{frontmatter:``,body:e}}function w1(e){if(e===``)return``;let t=e.match(S1);return t?(t[1]??``).replace(/\r?\n$/,``):e}var T1=TD.extend({priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`}}}}),E1=DD.extend({priority:60,addAttributes(){return{...this.parent?.(),headingStyle:{default:`atx`}}}}),D1=cg.create({name:`htmlBlock`,group:`block`,atom:!0,priority:60,addAttributes(){return{content:{default:``}}},parseHTML(){return[{tag:`div[data-html-block]`}]},renderHTML({node:e}){return[`div`,{"data-html-block":``,class:`html-block`},e.attrs.content]}}),O1=cg.create({name:`jsxComponent`,group:`block`,atom:!1,content:`block*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{componentName:{default:``},kind:{default:`element`},attributes:{default:[]},sourceRaw:{default:``},sourceDirty:{default:!1},props:{default:{}}}},parseHTML(){return[{tag:`div[data-jsx-component]`,getAttrs:e=>typeof e==`string`?!1:{componentName:e.getAttribute(`data-component-name`)||``,sourceRaw:e.getAttribute(`data-source-raw`)||``}}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-jsx-component":``,"data-component-name":e.componentName,"data-source-raw":e.sourceRaw},0]},addCommands(){return{insertJsxComponent:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{sourceRaw:e}})}}}),k1=cg.create({name:`jsxInline`,group:`inline`,inline:!0,atom:!1,content:`text*`,isolating:!1,selectable:!0,priority:60,addAttributes(){return{}},parseHTML(){return[{tag:`span[data-jsx-inline]`}]},renderHTML(){return[`span`,{"data-jsx-inline":``},0]}}),A1=Hk.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:e=>{try{let t=new URL(e,`https://placeholder.invalid`).protocol.toLowerCase();return![`javascript:`,`data:`,`vbscript:`].includes(t)}catch{return!1}},validate:()=>!0,shouldAutoLink:()=>!0}},addAttributes(){return{...this.parent?.(),linkStyle:{default:`inline`,rendered:!1},refLabel:{default:null,rendered:!1},sourceForm:{default:null,rendered:!1},target:{default:null,rendered:!1},anchor:{default:null,rendered:!1},alias:{default:null,rendered:!1}}}}),j1=cg.create({name:`linkRefDef`,group:`block`,atom:!0,priority:60,addAttributes(){return{label:{default:``},href:{default:``},title:{default:null}}},parseHTML(){return[{tag:`div[data-link-ref-def]`}]},renderHTML({node:e}){let{label:t,href:n,title:r}=e.attrs;return[`div`,{"data-link-ref-def":``,class:`link-ref-def`},r?`[${t}]: ${n} "${r}"`:`[${t}]: ${n}`]}});function M1(e){return e.type.name===`list`&&!e.attrs.ordered}function N1(e){return e.type.name===`list`&&!!e.attrs.ordered}function P1(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function F1(e,t,n,r,i,a,o){let s=Up(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?Vs(r)(e,t):!1}if(s){if(!t)return!0;let{tr:n}=e;return n.setNodeMarkup(s.pos,void 0,{...s.node.attrs,...a}),o!==void 0&&s.node.forEach((e,t)=>{if(e.type.name===`listItem`){let r=s.pos+1+t;n.setNodeMarkup(r,void 0,{...e.attrs,...o??{}})}}),t(n),!0}return Rs(n,a)(e,void 0)?t?Rs(n,a)(e,n=>{if(o){let t=n.mapping.map(e.selection.$from.pos),r=n.doc.resolve(t);for(let e=r.depth;e>0;e--){let t=r.node(e);if(t.type.name===`listItem`){n.setNodeMarkup(r.before(e),void 0,{...t.attrs,...o});break}}}t(n)}):!0:!1}var I1=cg.create({name:`list`,group:`block list`,content:`listItem+`,priority:60,addAttributes(){return{ordered:{default:!1},start:{default:1},spread:{default:!1},bulletMarker:{default:null},listMarkerDelimiter:{default:null}}},parseHTML(){return[{tag:`ul`,getAttrs:()=>({ordered:!1})},{tag:`ol`,getAttrs:e=>({ordered:!0,start:e.getAttribute(`start`)?Number(e.getAttribute(`start`)):1})}]},renderHTML({node:e,HTMLAttributes:t}){let n=e.attrs.ordered?`ol`:`ul`,r={};return e.attrs.ordered&&e.attrs.start!==1&&(r.start=e.attrs.start),[n,$p(t,r),0]},addCommands(){return{toggleBulletList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:F1(e,t,n,r,e=>M1(e)&&!P1(e),{ordered:!1},{checked:null})},toggleOrderedList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:F1(e,t,n,r,e=>N1(e),{ordered:!0},{checked:null})},toggleTaskList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:F1(e,t,n,r,e=>M1(e)&&P1(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[Uh({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]})}),Uh({find:/^\s*(\d+)([.)])\s$/,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]})}),new sh({find:/^\s*[-*+]\s\[([ xX])\]\s$/,handler:({state:e,range:t,match:n})=>{let r=e.schema.nodes.list;if(!r)return null;let i=n[1]!==` `,a=e.tr.delete(t.from,t.to),o=a.doc.resolve(t.from).blockRange();if(!o)return null;let s=Ga(o,r,{ordered:!1});if(!s)return null;a.wrap(o,s);let c=a.doc.resolve(a.mapping.map(t.from));for(let e=c.depth;e>0;e--){let t=c.node(e);if(t.type.name===`listItem`){a.setNodeMarkup(c.before(e),void 0,{...t.attrs,checked:i});break}}}})]},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList(),"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),L1=cg.create({name:`listItem`,content:`paragraph block*`,defining:!0,priority:60,addAttributes(){return{checked:{default:null},spread:{default:!1}}},parseHTML(){return[{tag:`li`,getAttrs:e=>{let t=e.querySelector(`input[type="checkbox"]`);return{checked:t?t.checked:null}}}]},renderHTML({node:e,HTMLAttributes:t}){return e.attrs.checked===null?[`li`,$p(t),0]:[`li`,$p(t,{"data-type":`taskItem`,"data-checked":e.attrs.checked?`true`:`false`}),[`label`,{contenteditable:`false`},[`input`,{type:`checkbox`,...e.attrs.checked?{checked:`checked`}:{}}]],[`div`,0]]},addNodeView(){return({node:e,getPos:t,editor:n,HTMLAttributes:r})=>{let i=document.createElement(`li`);Object.entries($p(r,e.attrs.checked===null?{}:{"data-type":`taskItem`,"data-checked":String(!!e.attrs.checked)})).forEach(([e,t])=>{t!=null&&i.setAttribute(e,String(t))});let a=null,o=null,s=document.createElement(`div`);return e.attrs.checked!==null&&(a=document.createElement(`label`),a.contentEditable=`false`,o=document.createElement(`input`),o.type=`checkbox`,o.checked=!!e.attrs.checked,n.isEditable||(o.disabled=!0),o.addEventListener(`change`,()=>{let r=t();r===void 0||typeof r!=`number`||n.view.dispatch(n.view.state.tr.setNodeMarkup(r,void 0,{...e.attrs,checked:o?.checked??!1}))}),a.appendChild(o),i.appendChild(a)),i.appendChild(s),{dom:i,contentDOM:s,update(t){return t.type!==e.type||t.attrs.checked!==null!=(e.attrs.checked!==null)?!1:(o&&t.attrs.checked!==null&&(o.checked=!!t.attrs.checked,i.setAttribute(`data-checked`,String(!!t.attrs.checked))),e=t,!0)}}}},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.sinkListItem(this.name);return!1},"Shift-Tab":()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.liftListItem(this.name);return!1}}}}),R1=I1,z1=L1,B1=cg.create({name:`rawMdxFallback`,group:`block`,atom:!1,content:`text*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{reason:{default:``},originalSpan:{default:{start:0,end:0}}}},parseHTML(){return[{tag:`div[data-raw-mdx-fallback]`,getAttrs:e=>typeof e==`string`?!1:{reason:e.getAttribute(`data-reason`)||``}}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-raw-mdx-fallback":``,"data-raw-badge":`raw`,"data-reason":e.reason,contenteditable:`false`,class:`raw-mdx-fallback`},0]},addNodeView(){return({HTMLAttributes:e})=>{let t=document.createElement(`div`);t.setAttribute(`data-raw-mdx-fallback`,``),t.setAttribute(`data-raw-badge`,`raw`),t.setAttribute(`contenteditable`,`false`),t.classList.add(`raw-mdx-fallback`),e.reason&&t.setAttribute(`data-reason`,e.reason);let n=document.createElement(`pre`);return n.classList.add(`raw-mdx-fallback-content`),n.setAttribute(`contenteditable`,`false`),t.appendChild(n),{dom:t,contentDOM:n,ignoreMutation:()=>!0}}}}),V1=iM.extend({excludes:``}),H1=hh.create({name:`sourceLiteral`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceRaw:{default:``}}},parseHTML(){return[{tag:`span[data-source-literal]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-source-literal":``,...e},0]}}),U1=sM.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}}});function W1(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function G1(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var K1=cg.create({name:`wikiLink`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:W1(e.getAttribute(`data-alias`)),anchor:W1(e.getAttribute(`data-anchor`)),resolved:e.getAttribute(`data-resolved`)===`true`}},{tag:`a.wiki-link[data-target]`,priority:100,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-target`)??``;return t?{target:t,alias:W1(e.getAttribute(`data-alias`)),anchor:W1(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=W1(e.attrs.alias),i=W1(e.attrs.anchor),a=e.attrs.resolved===!0;return[`span`,{...t,"data-wiki-link":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,"data-resolved":a?`true`:`false`},G1({target:n,alias:r,anchor:i})]}});function q1(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function J1(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var Y1=cg.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolvedSrc:{default:null,rendered:!1,parseHTML:()=>null}}},parseHTML(){let e=e=>typeof e==`string`||!e.hasAttribute(`data-wiki-embed`)?!1:{target:e.getAttribute(`data-target`)||``,alias:W1(e.getAttribute(`data-alias`)),anchor:W1(e.getAttribute(`data-anchor`))};return[{tag:`img[data-wiki-embed]`,getAttrs:e,priority:100},{tag:`a[data-wiki-embed]`,getAttrs:e,priority:100}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=W1(e.attrs.alias),i=W1(e.attrs.anchor),a=W1(e.attrs.resolvedSrc),o=q1(n);if(f1.has(o))return[`img`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,src:a??n,alt:r??n}];let s=a??n;return[`a`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,href:i?`${s}#${i}`:s,target:`_blank`,rel:`noopener noreferrer`},J1({target:n,alias:r,anchor:i})]}}),X1=[O1,B1,k1,K1,Y1,R1,z1,y1,b1,V1,v1,E1,U1,A1,D1,j1,T1,x1,H1,LN.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,italic:!1,bold:!1,code:!1,codeBlock:!1,heading:!1,horizontalRule:!1,hardBreak:!1,link:!1}),Qj.configure({resizable:!0}),zj,Rj,Lj,qk.configure({inline:!0}),Gk];function Z1(e,t){let n=encodeURIComponent(t.prompt),r=encodeURIComponent(t.projectDir),i=encodeURIComponent(t.docPath);return`claude://${e.mode}/new?q=${n}&folder=${r}&file=${i}`}function Q1(e){return`codex://new?prompt=${encodeURIComponent(e.prompt)}&path=${encodeURIComponent(e.projectDir)}`}function $1(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t<0?e:e.substring(t+1)}function e0(e){return`cursor://anysphere.cursor-deeplink/prompt?text=${encodeURIComponent(encodeURIComponent(e.prompt))}&workspace=${encodeURIComponent($1(e.projectDir))}&mode=agent`}function t0(e){return`Open Knowledge doc: ${e.relativePath}. Use the open-knowledge MCP tool for backlinks and related context.`}function n0(e){return`https://claude.ai/new?q=${encodeURIComponent(e)}`}var r0=/notionvc:/i,i0=()=>e=>{a0(e)&&(o0(e),s0(e))};function a0(e){if(!(`children`in e)||!Array.isArray(e.children))return!1;for(let t of e.children){if(t.type===`comment`){let e=String(t.value??``);if(r0.test(e))return!0}if(t.type===`element`&&a0(t))return!0}return!1}function o0(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&o0(t);let t=[];for(let n of e.children){if(n.type!==`text`){t.push(n);continue}let e=String(n.value??``);if(!e.includes(`
|
|
371
|
+
`)}case`WRITE_ERROR`:return`Failed to write config file: ${e.detail}`;case`UNKNOWN`:return e.message??`Unknown error.`}}function Q$(e){let t=e;for(let e=0;e<16;e++){if(t==null||t?._zod?.def?.shape!==void 0)return t;let e=t?._zod?.def?.innerType;if(e===void 0)return t;t=e}return t}function $$(e,t){let n=e;for(let e of t){n=Q$(n);let t=n?._zod?.def?.shape;if(!t||(n=t[String(e)],n===void 0))return}return n}function e1(e,t){let n=$$(e,t);if(n!==void 0)return WE(n)}var t1=2e3;function n1(e){let t=Date.now();for(let[n,r]of e.entries()){let i=r;i.timestamp&&t-i.timestamp>3e4&&e.delete(n)}}function r1(e,t){for(let[,n]of e.entries()){let e=n;if(e.timestamp&&e.timestamp>t)return!0}return!1}var i1=`__system__`,a1=`__config__/project`,o1=`__user__/config.yml`;Object.freeze([a1,o1]);var s1=[`incoming`,`outgoing`,`both`];function c1(e){return s1.includes(e)}var l1=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],u1=[`video/mp4`,`video/webm`,`video/ogg`],d1=[`audio/mpeg`,`audio/wav`,`audio/ogg`],f1=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),p1=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),m1=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),h1=`wikiembed`,g1=`toast`,_1=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`,`pdf`,`mp4`,`webm`,`mov`,`m4v`,`mkv`,`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),v1=uD.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3}}}}),y1=CD.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}}}),b1=_D.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}}}),x1=hh.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),S1=/^---\r?\n([\s\S]*?\r?\n)?---(\r?\n|$)/;function C1(e){let t=e.match(S1);return t?{frontmatter:t[0],body:e.slice(t[0].length)}:{frontmatter:``,body:e}}function w1(e){if(e===``)return``;let t=e.match(S1);return t?(t[1]??``).replace(/\r?\n$/,``):e}var T1=TD.extend({priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`}}}}),E1=DD.extend({priority:60,addAttributes(){return{...this.parent?.(),headingStyle:{default:`atx`}}}}),D1=cg.create({name:`htmlBlock`,group:`block`,atom:!0,priority:60,addAttributes(){return{content:{default:``}}},parseHTML(){return[{tag:`div[data-html-block]`}]},renderHTML({node:e}){return[`div`,{"data-html-block":``,class:`html-block`},e.attrs.content]}}),O1=cg.create({name:`jsxComponent`,group:`block`,atom:!1,content:`block*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{componentName:{default:``},kind:{default:`element`},attributes:{default:[]},sourceRaw:{default:``},sourceDirty:{default:!1},props:{default:{}}}},parseHTML(){return[{tag:`div[data-jsx-component]`,getAttrs:e=>typeof e==`string`?!1:{componentName:e.getAttribute(`data-component-name`)||``,sourceRaw:e.getAttribute(`data-source-raw`)||``}}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-jsx-component":``,"data-component-name":e.componentName,"data-source-raw":e.sourceRaw},0]},addCommands(){return{insertJsxComponent:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{sourceRaw:e}})}}}),k1=cg.create({name:`jsxInline`,group:`inline`,inline:!0,atom:!1,content:`text*`,isolating:!1,selectable:!0,priority:60,addAttributes(){return{}},parseHTML(){return[{tag:`span[data-jsx-inline]`}]},renderHTML(){return[`span`,{"data-jsx-inline":``},0]}}),A1=Hk.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:e=>{try{let t=new URL(e,`https://placeholder.invalid`).protocol.toLowerCase();return![`javascript:`,`data:`,`vbscript:`].includes(t)}catch{return!1}},validate:()=>!0,shouldAutoLink:()=>!0}},addAttributes(){return{...this.parent?.(),linkStyle:{default:`inline`,rendered:!1},refLabel:{default:null,rendered:!1},sourceForm:{default:null,rendered:!1},target:{default:null,rendered:!1},anchor:{default:null,rendered:!1},alias:{default:null,rendered:!1}}}}),j1=cg.create({name:`linkRefDef`,group:`block`,atom:!0,priority:60,addAttributes(){return{label:{default:``},href:{default:``},title:{default:null}}},parseHTML(){return[{tag:`div[data-link-ref-def]`}]},renderHTML({node:e}){let{label:t,href:n,title:r}=e.attrs;return[`div`,{"data-link-ref-def":``,class:`link-ref-def`},r?`[${t}]: ${n} "${r}"`:`[${t}]: ${n}`]}});function M1(e){return e.type.name===`list`&&!e.attrs.ordered}function N1(e){return e.type.name===`list`&&!!e.attrs.ordered}function P1(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function F1(e,t,n,r,i,a,o){let s=Up(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?Vs(r)(e,t):!1}if(s){if(!t)return!0;let{tr:n}=e;return n.setNodeMarkup(s.pos,void 0,{...s.node.attrs,...a}),o!==void 0&&s.node.forEach((e,t)=>{if(e.type.name===`listItem`){let r=s.pos+1+t;n.setNodeMarkup(r,void 0,{...e.attrs,...o??{}})}}),t(n),!0}return Rs(n,a)(e,void 0)?t?Rs(n,a)(e,n=>{if(o){let t=n.mapping.map(e.selection.$from.pos),r=n.doc.resolve(t);for(let e=r.depth;e>0;e--){let t=r.node(e);if(t.type.name===`listItem`){n.setNodeMarkup(r.before(e),void 0,{...t.attrs,...o});break}}}t(n)}):!0:!1}var I1=cg.create({name:`list`,group:`block list`,content:`listItem+`,priority:60,addAttributes(){return{ordered:{default:!1},start:{default:1},spread:{default:!1},bulletMarker:{default:null},listMarkerDelimiter:{default:null}}},parseHTML(){return[{tag:`ul`,getAttrs:()=>({ordered:!1})},{tag:`ol`,getAttrs:e=>({ordered:!0,start:e.getAttribute(`start`)?Number(e.getAttribute(`start`)):1})}]},renderHTML({node:e,HTMLAttributes:t}){let n=e.attrs.ordered?`ol`:`ul`,r={};return e.attrs.ordered&&e.attrs.start!==1&&(r.start=e.attrs.start),[n,$p(t,r),0]},addCommands(){return{toggleBulletList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:F1(e,t,n,r,e=>M1(e)&&!P1(e),{ordered:!1},{checked:null})},toggleOrderedList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:F1(e,t,n,r,e=>N1(e),{ordered:!0},{checked:null})},toggleTaskList:()=>({state:e,dispatch:t})=>{let n=e.schema.nodes.list,r=e.schema.nodes.listItem;return!n||!r?!1:F1(e,t,n,r,e=>M1(e)&&P1(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[Uh({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]})}),Uh({find:/^\s*(\d+)([.)])\s$/,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]})}),new sh({find:/^\s*[-*+]\s\[([ xX])\]\s$/,handler:({state:e,range:t,match:n})=>{let r=e.schema.nodes.list;if(!r)return null;let i=n[1]!==` `,a=e.tr.delete(t.from,t.to),o=a.doc.resolve(t.from).blockRange();if(!o)return null;let s=Ga(o,r,{ordered:!1});if(!s)return null;a.wrap(o,s);let c=a.doc.resolve(a.mapping.map(t.from));for(let e=c.depth;e>0;e--){let t=c.node(e);if(t.type.name===`listItem`){a.setNodeMarkup(c.before(e),void 0,{...t.attrs,checked:i});break}}}})]},addKeyboardShortcuts(){return{"Mod-Shift-8":()=>this.editor.commands.toggleBulletList(),"Mod-Shift-7":()=>this.editor.commands.toggleOrderedList(),"Mod-Shift-9":()=>this.editor.commands.toggleTaskList()}}}),L1=cg.create({name:`listItem`,content:`paragraph block*`,defining:!0,priority:60,addAttributes(){return{checked:{default:null},spread:{default:!1}}},parseHTML(){return[{tag:`li`,getAttrs:e=>{let t=e.querySelector(`input[type="checkbox"]`);return{checked:t?t.checked:null}}}]},renderHTML({node:e,HTMLAttributes:t}){return e.attrs.checked===null?[`li`,$p(t),0]:[`li`,$p(t,{"data-type":`taskItem`,"data-checked":e.attrs.checked?`true`:`false`}),[`label`,{contenteditable:`false`},[`input`,{type:`checkbox`,...e.attrs.checked?{checked:`checked`}:{}}]],[`div`,0]]},addNodeView(){return({node:e,getPos:t,editor:n,HTMLAttributes:r})=>{let i=document.createElement(`li`);Object.entries($p(r,e.attrs.checked===null?{}:{"data-type":`taskItem`,"data-checked":String(!!e.attrs.checked)})).forEach(([e,t])=>{t!=null&&i.setAttribute(e,String(t))});let a=null,o=null,s=document.createElement(`div`);return e.attrs.checked!==null&&(a=document.createElement(`label`),a.contentEditable=`false`,o=document.createElement(`input`),o.type=`checkbox`,o.checked=!!e.attrs.checked,n.isEditable||(o.disabled=!0),o.addEventListener(`change`,()=>{let r=t();r===void 0||typeof r!=`number`||n.view.dispatch(n.view.state.tr.setNodeMarkup(r,void 0,{...e.attrs,checked:o?.checked??!1}))}),a.appendChild(o),i.appendChild(a)),i.appendChild(s),{dom:i,contentDOM:s,update(t){return t.type!==e.type||t.attrs.checked!==null!=(e.attrs.checked!==null)?!1:(o&&t.attrs.checked!==null&&(o.checked=!!t.attrs.checked,i.setAttribute(`data-checked`,String(!!t.attrs.checked))),e=t,!0)}}}},addKeyboardShortcuts(){return{Enter:()=>this.editor.commands.splitListItem(this.name),Tab:()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.sinkListItem(this.name);return!1},"Shift-Tab":()=>{let{$from:e}=this.editor.state.selection;for(let t=e.depth;t>0;t--)if(e.node(t).type.name===`listItem`)return this.editor.commands.liftListItem(this.name);return!1}}}}),R1=I1,z1=L1,B1=cg.create({name:`rawMdxFallback`,group:`block`,atom:!1,content:`text*`,isolating:!0,selectable:!0,defining:!0,priority:60,addAttributes(){return{reason:{default:``},originalSpan:{default:{start:0,end:0}}}},parseHTML(){let e=e=>typeof e==`string`?!1:{reason:e.getAttribute(`data-reason`)||``};return[{tag:`div[data-raw-mdx-fallback]`,getAttrs:e},{tag:`pre[data-raw-mdx-fallback]`,getAttrs:e}]},renderHTML({HTMLAttributes:e}){return[`div`,{"data-raw-mdx-fallback":``,"data-raw-badge":`raw`,"data-reason":e.reason,contenteditable:`false`,class:`raw-mdx-fallback`},0]},addNodeView(){return({HTMLAttributes:e})=>{let t=document.createElement(`div`);t.setAttribute(`data-raw-mdx-fallback`,``),t.setAttribute(`data-raw-badge`,`raw`),t.setAttribute(`contenteditable`,`false`),t.classList.add(`raw-mdx-fallback`),e.reason&&t.setAttribute(`data-reason`,e.reason);let n=document.createElement(`pre`);return n.classList.add(`raw-mdx-fallback-content`),n.setAttribute(`contenteditable`,`false`),t.appendChild(n),{dom:t,contentDOM:n,ignoreMutation:()=>!0}}}}),V1=iM.extend({excludes:``}),H1=hh.create({name:`sourceLiteral`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceRaw:{default:``}}},parseHTML(){return[{tag:`span[data-source-literal]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-source-literal":``,...e},0]}}),U1=sM.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}}});function W1(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function G1(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var K1=cg.create({name:`wikiLink`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:W1(e.getAttribute(`data-alias`)),anchor:W1(e.getAttribute(`data-anchor`)),resolved:e.getAttribute(`data-resolved`)===`true`}},{tag:`a.wiki-link[data-target]`,priority:100,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-target`)??``;return t?{target:t,alias:W1(e.getAttribute(`data-alias`)),anchor:W1(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=W1(e.attrs.alias),i=W1(e.attrs.anchor),a=e.attrs.resolved===!0;return[`span`,{...t,"data-wiki-link":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,"data-resolved":a?`true`:`false`},G1({target:n,alias:r,anchor:i})]}});function q1(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function J1(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}var Y1=cg.create({name:`wikiLinkEmbed`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolvedSrc:{default:null,rendered:!1,parseHTML:()=>null}}},parseHTML(){let e=e=>typeof e==`string`||!e.hasAttribute(`data-wiki-embed`)?!1:{target:e.getAttribute(`data-target`)||``,alias:W1(e.getAttribute(`data-alias`)),anchor:W1(e.getAttribute(`data-anchor`))};return[{tag:`img[data-wiki-embed]`,getAttrs:e,priority:100},{tag:`a[data-wiki-embed]`,getAttrs:e,priority:100}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=W1(e.attrs.alias),i=W1(e.attrs.anchor),a=W1(e.attrs.resolvedSrc),o=q1(n);if(f1.has(o))return[`img`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,src:a??n,alt:r??n}];let s=a??n;return[`a`,{...t,"data-wiki-embed":``,"data-target":n,"data-alias":r??``,"data-anchor":i??``,href:i?`${s}#${i}`:s,target:`_blank`,rel:`noopener noreferrer`},J1({target:n,alias:r,anchor:i})]}}),X1=[O1,B1,k1,K1,Y1,R1,z1,y1,b1,V1,v1,E1,U1,A1,D1,j1,T1,x1,H1,LN.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,italic:!1,bold:!1,code:!1,codeBlock:!1,heading:!1,horizontalRule:!1,hardBreak:!1,link:!1}),Qj.configure({resizable:!0}),zj,Rj,Lj,qk.configure({inline:!0}),Gk];function Z1(e,t){let n=encodeURIComponent(t.prompt),r=encodeURIComponent(t.projectDir),i=encodeURIComponent(t.docPath);return`claude://${e.mode}/new?q=${n}&folder=${r}&file=${i}`}function Q1(e){return`codex://new?prompt=${encodeURIComponent(e.prompt)}&path=${encodeURIComponent(e.projectDir)}`}function $1(e){let t=Math.max(e.lastIndexOf(`/`),e.lastIndexOf(`\\`));return t<0?e:e.substring(t+1)}function e0(e){return`cursor://anysphere.cursor-deeplink/prompt?text=${encodeURIComponent(encodeURIComponent(e.prompt))}&workspace=${encodeURIComponent($1(e.projectDir))}&mode=agent`}function t0(e){return`Open Knowledge doc: ${e.relativePath}. Use the open-knowledge MCP tool for backlinks and related context.`}function n0(e){return`https://claude.ai/new?q=${encodeURIComponent(e)}`}var r0=/notionvc:/i,i0=()=>e=>{a0(e)&&(o0(e),s0(e))};function a0(e){if(!(`children`in e)||!Array.isArray(e.children))return!1;for(let t of e.children){if(t.type===`comment`){let e=String(t.value??``);if(r0.test(e))return!0}if(t.type===`element`&&a0(t))return!0}return!1}function o0(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&o0(t);let t=[];for(let n of e.children){if(n.type!==`text`){t.push(n);continue}let e=String(n.value??``);if(!e.includes(`
|
|
372
372
|
`)){t.push(n);continue}let r=e.split(`
|
|
373
373
|
`);for(let e=0;e<r.length;e++)r[e]&&t.push({type:`text`,value:r[e]??``}),e<r.length-1&&t.push({type:`element`,tagName:`br`,properties:{},children:[]})}e.children=t}function s0(e){if(!(!(`children`in e)||!Array.isArray(e.children))){e.children=e.children.filter(e=>e.type===`comment`?!r0.test(String(e.value??``)):!0);for(let t of e.children)t.type===`element`&&s0(t)}}var c0=new Set([`Apple-tab-span`,`Apple-converted-space`,`Apple-style-span`]),l0=()=>e=>{u0(e)};function u0(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&u0(t);e.children=e.children.flatMap(e=>{if(e.type!==`element`)return[e];let t=e;return d0(t)?[]:f0(t)?t.children:[t]})}}function d0(e){if(e.tagName!==`meta`)return!1;let t=e.properties?.name,n=e.properties?.content;return t===`Generator`&&typeof n==`string`&&/Cocoa/i.test(n)}function f0(e){if(e.tagName!==`span`)return!1;let t=e.properties?.className;return Array.isArray(t)?t.length>0&&t.every(e=>c0.has(String(e))):!1}var p0=`docs-internal-guid-`;function m0(e,t){let n=e.children[t];!n||n.type!==`element`||e.children.splice(t,1,...n.children)}var h0=()=>e=>{g0(e)};function g0(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&g0(t);let t=0;for(;t<e.children.length;){let n=e.children[t];if(!n||n.type!==`element`){t++;continue}let r=n;if(_0(r)||v0(r)){m0(e,t);continue}t++}}function _0(e){if(e.tagName!==`b`)return!1;let t=e.properties?.id;return typeof t==`string`&&t.startsWith(p0)}function v0(e){if(e.tagName!==`div`||e.properties?.dir!==`ltr`)return!1;let t=e.children.filter(e=>e.type===`element`);return t.length===1?t[0]?.tagName===`table`:!1}var y0=new Set([`commit-link`,`user-mention`,`team-mention`,`issue-link`]),b0=()=>e=>{x0(e)};function x0(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&x0(t);for(let t of e.children)t.type===`element`&&S0(t)}}function S0(e){if(!e.properties)return;for(let t of Object.keys(e.properties))t.startsWith(`dataHovercard`)&&delete e.properties[t];let t=e.properties.className;if(Array.isArray(t)){let n=t.filter(e=>!y0.has(String(e)));n.length===0?delete e.properties.className:e.properties.className=n}}var C0=/^gmail_/,w0=()=>e=>{T0(e)};function T0(e){if(!(`children`in e)||!Array.isArray(e.children))return;for(let t of e.children)t.type===`element`&&T0(t);let t=0;for(;t<e.children.length;){let n=e.children[t];if(n.type!==`element`){t++;continue}let r=n;if(r.tagName===`div`&&E0(r,`gmail_quote`)&&(r.tagName=`blockquote`),D0(r),O0(r)){e.children.splice(t,1,...r.children);continue}t++}}function E0(e,t){let n=e.properties?.className;return Array.isArray(n)?n.some(e=>String(e)===t):!1}function D0(e){let t=e.properties?.className;if(!Array.isArray(t))return;let n=t.filter(e=>!C0.test(String(e)));n.length===0?delete e.properties?.className:e.properties&&(e.properties.className=n)}function O0(e){if(e.tagName!==`div`||e.properties?.dir!==`ltr`)return!1;let t=e.properties?.className;return t!=null&&!(Array.isArray(t)&&t.length===0)?!1:e.children.filter(e=>e.type===`element`).length<=1}var k0=()=>e=>{A0(e)};function A0(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&A0(t);e.children=e.children.flatMap(e=>{if(e.type!==`element`)return[e];let t=e;return t.tagName===`google-sheets-html-origin`?t.children:t.tagName===`style`?[]:(j0(t),[t])})}}function j0(e){if(e.properties)for(let t of Object.keys(e.properties))t.startsWith(`dataSheets`)&&delete e.properties[t]}var M0=[`o:`,`w:`,`m:`,`v:`,`u1:`],N0=/^Mso[A-Z]/,P0=/^\s*\[if\s+[^\]]*\]/,F0=()=>e=>{I0(e)};function I0(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&I0(t);e.children=e.children.flatMap(e=>{if(e.type===`comment`){let t=String(e.value??``);return P0.test(t)?[]:[e]}if(e.type!==`element`)return[e];let t=e;return L0(t)?[]:(R0(t),[t])})}}function L0(e){return M0.some(t=>e.tagName.startsWith(t))}function R0(e){let t=e.properties;if(!t)return;let n=t.className;if(Array.isArray(n)){let e=n.filter(e=>typeof e==`string`&&!N0.test(e));e.length===0?delete t.className:t.className=e}else typeof n==`string`&&N0.test(n)&&delete t.className;let r=t.style;typeof r==`string`&&/mso-/i.test(r)&&delete t.style;for(let e of Object.keys(t))if(e.startsWith(`xmlns:`)){let n=e.slice(6);M0.some(e=>e===`${n}:`)&&delete t[e]}}var z0=/^c-(message_kit__|message__|compose|timestamp)/,B0=()=>e=>{V0(e)};function V0(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&V0(t);e.children=e.children.flatMap(e=>{if(e.type!==`element`)return[e];let t=e;return H0(t)?[]:(U0(t),[t])})}}function H0(e){let t=e.properties?.className;return Array.isArray(t)?t.some(e=>String(e)===`c-timestamp`||String(e).startsWith(`c-timestamp`)):!1}function U0(e){let t=e.properties?.className;if(!Array.isArray(t))return;let n=t.filter(e=>!z0.test(String(e)));n.length===0?delete e.properties?.className:e.properties&&(e.properties.className=n)}var W0=()=>e=>{G0(e)};function G0(e){if(!(!(`children`in e)||!Array.isArray(e.children))){for(let t of e.children)t.type===`element`&&G0(t);for(let t=0;t<e.children.length;t++){let n=e.children[t];if(n.type!==`element`)continue;let r=n;K0(r)&&(e.children[t]=J0(r))}}}function K0(e){if(e.tagName!==`div`)return!1;let t=e.children.filter(e=>e.type===`element`&&e.tagName===`div`);return t.length<2?!1:t.some(e=>q0(e))}function q0(e){for(let t of e.children){if(t.type!==`element`)continue;let e=t,n=e.properties?.style;if(typeof n==`string`&&/color\s*:/i.test(n)||q0(e))return!0}return!1}function J0(e){return{type:`element`,tagName:`pre`,properties:{},children:[{type:`element`,tagName:`code`,properties:{},children:[{type:`text`,value:e.children.filter(e=>e.type===`element`&&e.tagName===`div`).map(e=>Y0(e)).join(`
|
|
374
374
|
`)}]}]}}function Y0(e){let t=``;for(let n of e.children)n.type===`text`?t+=n.value??``:n.type===`element`&&(t+=Y0(n));return t}var X0=class extends Error{htmlBytes;maxBytes;constructor(e,t){super(`HTML payload (${e} bytes) exceeds htmlToMdast ceiling (${t} bytes); falling through to plain text`),this.name=`HtmlPayloadTooLargeError`,this.htmlBytes=e,this.maxBytes=t}},Z0=[h0,F0,l0,w0,i0,W0,k0,B0,b0];function Q0(e,t){let n=t?.maxBytes??5242880;if(e.length>n)throw new X0(e.length,n);let r=SJ().use(kz,{fragment:!0});for(let e of Z0)r.use(e);for(let e of t?.additionalCleanupPlugins??[])r.use(e);r.use(AH);let i=r.parse(e);return r.runSync(i)}function $0(e){return String(SJ().use(pJ).use(mJ).stringify(e))}function e2(e,t){let n=Array.isArray(e.attrs.attributes)?e.attrs.attributes.filter(e=>typeof e==`object`&&!!e&&`type`in e):[],r=e.attrs.props??{},i=new Map,a=new Set;if(t)for(let e of t)e.omitOnDefault===!0&&`defaultValue`in e&&e.defaultValue!==void 0&&i.set(e.name,e.defaultValue),e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&a.add(e.name);for(let[e,t]of Object.entries(r)){let r=n.findIndex(t=>t.type===`mdxJsxAttribute`&&t.name===e);if(i.has(e)&&Object.is(i.get(e),t)){r>=0&&n.splice(r,1);continue}if(a.has(e)&&t===``){r>=0&&n.splice(r,1);continue}let o=t2(e,t);r>=0?n[r]=o:n.push(o)}return n}function t2(e,t){if(t===!0)return{type:`mdxJsxAttribute`,name:e,value:null};if(t===!1)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}};if(t==null)return{type:`mdxJsxAttribute`,name:e,value:null};if(typeof t==`string`)return{type:`mdxJsxAttribute`,name:e,value:t};if(typeof t==`number`)return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:JSON.stringify(t)}};if(typeof t==`object`){let n;try{n=JSON.stringify(t)}catch{n=String(t)}return{type:`mdxJsxAttribute`,name:e,value:{type:`mdxJsxAttributeValueExpression`,value:n}}}return{type:`mdxJsxAttribute`,name:e,value:String(t)}}function n2(e,t,n,r){return{type:`mdxJsxFlowElement`,name:e,attributes:e2(t,r),children:n.all(t),data:{}}}var r2=[{name:`type`,type:`enum`,enumValues:[`note`,`tip`,`important`,`warning`,`caution`],defaultValue:`note`,required:!1,description:`GFM alert variant`},{name:`title`,type:`string`,required:!1,description:`Optional heading shown above the body`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Lightbulb`)"},{name:`color`,type:`string`,required:!1,advanced:!0,description:"Optional accent color override (hex — e.g. `#F05032`)"},{name:`collapsible`,type:`boolean`,required:!1,defaultValue:!1,advanced:!0,description:"Render as a foldable `<details>` (Obsidian `[!TYPE]+/-`)"},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,description:`When collapsible, start in the open state`},{name:`children`,type:`reactnode`,required:!0,description:`Callout content`}],i2=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Image source URL`,accept:l1,autoFocus:!0},{name:`alt`,type:`string`,required:!1,defaultValue:``,description:`Alt text`},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Image width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Image height`},{name:`srcset`,type:`string`,required:!1,advanced:!0,description:`Responsive image candidate set (e.g. "x.png 1x, y.png 2x")`},{name:`sizes`,type:`string`,required:!1,advanced:!0,description:`Responsive image sizes hint paired with srcset`},{name:`loading`,type:`enum`,enumValues:[`eager`,`lazy`],defaultValue:`lazy`,required:!1,advanced:!0,omitOnDefault:!0,description:`Native img loading strategy (defaults to lazy)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`decoding`,type:`enum`,enumValues:[`sync`,`async`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Hint for how the browser should decode the image`},{name:`fetchpriority`,type:`enum`,enumValues:[`high`,`low`,`auto`],defaultValue:`auto`,required:!1,advanced:!0,omitOnDefault:!0,description:`Resource fetch priority hint`},{name:`crossorigin`,type:`enum`,enumValues:[`anonymous`,`use-credentials`],required:!1,advanced:!0,description:`CORS mode for the image fetch`},{name:`referrerpolicy`,type:`string`,required:!1,advanced:!0,description:`Referrer policy for the image fetch (HTML referrerpolicy values)`}],a2=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Video source URL`,accept:u1,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 video controls (defaults to true)`},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`poster`,type:`string`,required:!1,advanced:!0,description:`Poster image URL shown before playback`},{name:`width`,type:`number`,required:!1,advanced:!0,description:`Video width`},{name:`height`,type:`number`,required:!1,advanced:!0,description:`Video height`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`},{name:`playsinline`,type:`boolean`,required:!1,advanced:!0,description:`Play inline on iOS rather than entering fullscreen`},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the video to preload`}],o2=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Audio source URL`,accept:d1,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 audio controls (defaults to true)`},{name:`autoplay`,type:`boolean`,required:!1,advanced:!0,description:`Begin playback as soon as possible (usually requires muted)`},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Native HTML title attribute (tooltip)`},{name:`muted`,type:`boolean`,required:!1,advanced:!0,description:`Mute audio on load`},{name:`loop`,type:`boolean`,required:!1,advanced:!0,description:`Restart from the beginning when playback ends`},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the audio to preload`}],s2=[{name:`title`,type:`string`,required:!0,description:`Accordion heading shown inside the <summary>`},{name:`defaultOpen`,type:`boolean`,required:!1,defaultValue:!1,description:`When true, the accordion renders expanded on initial load`},{name:`icon`,type:`string`,required:!1,advanced:!0,description:"Custom lucide icon override (e.g. `lucide:Rocket`)"},{name:`description`,type:`string`,required:!1,advanced:!0,description:`Optional subtitle rendered below the title inside <summary>`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#advanced-options`)"},{name:`name`,type:`string`,required:!1,advanced:!0,description:`HTML5 <details name=> group — siblings with the same name are mutually exclusive`}],c2=[r2[0],r2[1],r2[4],r2[5],r2[6]],l2=[i2[0],i2[1],i2[7]],u2=[s2[0],s2[1],s2[4],s2[5]],d2=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Alt text (Obsidian alias syntax: `![[file.png|alt text]]`)"}],f2=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[clip.mp4|title]]`)"}],p2=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[song.mp3|title]]`)"}];function m2(e){return e.replace(/&/g,`&`).replace(/"/g,`"`).replace(/</g,`<`).replace(/>/g,`>`)}function h2(e){return e.replace(/&/g,`&`).replace(/</g,`<`).replace(/>/g,`>`)}function g2(e){let t=e.attrs.props,n=t?.target??``,r=typeof t?.alias==`string`&&t.alias.length>0?t.alias:null,i=typeof t?.anchor==`string`&&t.anchor.length>0?t.anchor:null,a=r??(i?`${n}#${i}`:n);return{type:`wikiLinkEmbed`,value:a,data:{target:n,anchor:i,alias:r},children:[{type:`text`,value:a}]}}var _2=[{name:`Callout`,surface:`canonical`,hasChildren:!0,props:r2,icon:`MessageSquareWarning`,category:`content`,displayName:`Callout`,description:`GFM alert / admonition with 5 type variants (note, tip, important, warning, caution)`,searchTerms:[`note`,`warning`,`tip`,`important`,`caution`,`alert`,`admonition`],serialize:(e,t)=>n2(`Callout`,e,t,r2)},{name:`img`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:i2,icon:`Image`,category:`media`,displayName:`Image`,description:`Image with click-to-zoom and HTML-native attributes`,searchTerms:[`image`,`zoom`,`picture`,`photo`],placeholder:{label:`Add an image`},serialize:(e,t)=>n2(`img`,e,t,i2)},{name:`video`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:a2,icon:`SquarePlay`,category:`media`,displayName:`Video`,description:`HTML5 video player with native controls`,searchTerms:[`video`,`media`,`player`,`mp4`,`webm`,`movie`],placeholder:{label:`Add a video`},serialize:(e,t)=>n2(`video`,e,t,a2)},{name:`audio`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:o2,icon:`Volume2`,category:`media`,displayName:`Audio`,description:`HTML5 audio player with native controls`,searchTerms:[`audio`,`sound`,`music`,`mp3`,`podcast`,`player`],placeholder:{label:`Add audio`},serialize:(e,t)=>n2(`audio`,e,t,o2)},{name:`Accordion`,surface:`canonical`,hasChildren:!0,props:s2,icon:`ChevronRight`,category:`content`,displayName:`Accordion`,description:"Standalone expand/collapse via native HTML5 <details>/<summary>. Group siblings with the `name` prop for exclusive-accordion UX.",searchTerms:[`toggle`,`accordion`,`expandable`,`details`,`disclosure`,`collapse`,`fold`],serialize:(e,t)=>n2(`Accordion`,e,t,s2)},{name:`GFMCallout`,surface:`compat`,hasChildren:!0,props:c2,icon:`MessageSquareWarning`,category:`content`,displayName:`GFM Callout`,description:"GFM blockquote alert (`> [!NOTE]`) — read-only compat. Preserves `> [!NOTE]` syntax on round-trip; insert a fresh Callout block for the full prop surface.",rendersAs:`Callout`,translateProps:e=>e,serialize:(e,t)=>{let n=e.attrs.props,r=new Set([`note`,`tip`,`important`,`warning`,`caution`]),i=n?.type??`note`;return{type:`blockquote`,children:[{type:`html`,value:`[!${(r.has(i.toLowerCase())?i:`note`).toUpperCase()}]${n?.collapsible?n.defaultOpen===!1?`-`:`+`:``}${n?.title?` ${n.title}`:``}`},...t.all(e).filter(e=>{if(e.type!==`paragraph`)return!0;let t=e;return Array.isArray(t.children)&&t.children.length>0})]}}},{name:`CommonMarkImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:l2,icon:`Image`,category:`media`,displayName:`CommonMark Image`,description:'CommonMark image (``) — read-only compat. Preserves `` syntax on round-trip; insert a fresh Image block for the full HTML-native attribute surface (srcset, sizes, decoding, etc.).',rendersAs:`img`,translateProps:e=>e,serialize:e=>{let t=e.attrs.props;return{type:`paragraph`,children:[{type:`image`,url:t?.src??``,alt:t?.alt??``,title:t?.title??null}]}}},{name:`WikiEmbedImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:d2,icon:`ZoomIn`,category:`media`,displayName:`Wiki Embed Image`,description:"Obsidian-style `![[file.png]]` wiki-embed — read-only compat. Edit the alt-text via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`img`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,alt:t??n}},serialize:g2},{name:`WikiEmbedVideo`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:f2,icon:`Film`,category:`media`,displayName:`Wiki Embed Video`,description:"Obsidian-style `![[clip.mp4]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`video`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??n}},serialize:g2},{name:`WikiEmbedAudio`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:p2,icon:`Volume2`,category:`media`,displayName:`Wiki Embed Audio`,description:"Obsidian-style `![[song.mp3]]` wiki-embed — read-only compat. Edit the title via the alias slot; the embed target / anchor stay on the prop bag and round-trip byte-identical.",rendersAs:`audio`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``;return{src:e.src,title:t??n}},serialize:g2},{name:`HtmlDetailsAccordion`,surface:`compat`,hasChildren:!0,props:u2,icon:`ChevronRight`,category:`content`,displayName:`HTML5 Details`,description:"HTML5 `<details><summary>` collapsible — read-only compat. Preserves `<details>` syntax on round-trip; insert a fresh Accordion block for icon / description / group-name props.",rendersAs:`Accordion`,translateProps:e=>e,serialize:(e,t)=>{let n=e.attrs.props,r=n?.defaultOpen?` open`:``,i=n?.name?` name="${m2(n.name)}"`:``,a=n?.id?` id="${m2(n.id)}"`:``,o=n?.title?.trim(),s=o?`<summary>${h2(o)}</summary>`:``;return{type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:[],children:t.all(e),data:{htmlBoundary:{opener:`<details${r}${i}${a}>\n${s}`,closer:`</details>`}}}}}],v2={name:`*`,surface:`canonical`,hasChildren:!0,props:[],description:`Unregistered component — children editable as markdown`,serialize:(e,t)=>n2(e.attrs.componentName||`*`,e,t)};function y2(){let e=new Map;e.set(`*`,v2);for(let t of _2)e.set(t.name,t);return{get(t){return e.get(t)},getOrWildcard(t){return e.get(t)??e.get(`*`)},set(t,n){e.set(t,n)},has(t){return e.has(t)},entries(){return e.entries()}}}var b2={parseFallback:{blockLevel:0,wholeDoc:0},jsxRenderFailure:{},jsxAutoConvertFailed:{},jsxAutoConvertSucceeded:{},jsxPropDropped:{},jsxMoveFailed:{},jsxStuckCopyFailed:{},jsxStuckDeleteFailed:{}};function x2(){b2.parseFallback.blockLevel++}function S2(){b2.parseFallback.wholeDoc++}function C2(e){b2.jsxRenderFailure[e]=(b2.jsxRenderFailure[e]??0)+1}function w2(e){b2.jsxAutoConvertFailed[e]=(b2.jsxAutoConvertFailed[e]??0)+1}function T2(e){b2.jsxAutoConvertSucceeded[e]=(b2.jsxAutoConvertSucceeded[e]??0)+1}function E2(e){b2.jsxPropDropped[e]=(b2.jsxPropDropped[e]??0)+1}function D2(e){b2.jsxMoveFailed[e]=(b2.jsxMoveFailed[e]??0)+1}function O2(e){b2.jsxStuckCopyFailed[e]=(b2.jsxStuckCopyFailed[e]??0)+1}function k2(e){b2.jsxStuckDeleteFailed[e]=(b2.jsxStuckDeleteFailed[e]??0)+1}var A2=/^(`{3,}|~{3,})/gm;function j2(e){let t=[],n=null;for(let r of e.matchAll(A2)){let e=r[1],i=r.index;n?e[0]===n.marker[0]&&e.length>=n.marker.length&&(t.push([n.offset,i+r[0].length]),n=null):n={marker:e,offset:i}}return n&&t.push([n.offset,e.length]),t}function M2(e,t){return t.some(([t,n])=>e>=t&&e<n)}var N2=/^[ \t]{0,3}\[([^\]]+)\]:\s*(\S+)(\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\s*$/gm;function P2(e){let t=j2(e),n=[];for(let r of e.matchAll(N2))M2(r.index,t)||n.push(r[0].trimEnd());return n.length>0?`${n.join(`
|
|
@@ -390,5 +390,5 @@ ${t.slice(l+2)}`,d+=1;else break}t.push({indent:l,number:parseInt(s,10),content:
|
|
|
390
390
|
`);l.push(m)}n.bulletCurrent=o,n.bulletLastUsed=s;let f=e.spread?`
|
|
391
391
|
|
|
392
392
|
`:`
|
|
393
|
-
`;return l.join(f)},mdxJsxFlowElement(e,t,n,r){let i=e,a=i.data?.sourceRaw;if(typeof a==`string`)return a;let o=i.data?.htmlBoundary;if(o&&typeof o.opener==`string`&&typeof o.closer==`string`){let e=n.containerFlow({type:`root`,children:i.children??[]},r);return`${o.opener}\n\n${e}\n\n${o.closer}`}let s=i.name??``,c=A3(i.attributes??[]);if(!i.children||i.children.length===0)return s?c?`<${s} ${c} />`:`<${s} />`:``;let l=c?`<${s} ${c}>`:`<${s}>`,u=`</${s}>`;return`${l}\n\n${n.containerFlow({type:`root`,children:i.children},r)}\n\n${u}`},mdxJsxTextElement(e){let t=e.data?.sourceRaw;return typeof t==`string`?t:`<${e.name??``}/>`},rawMdxFallback(e){return e.value??``}};function A3(e){let t=[];for(let n of e){if(n.type===`mdxJsxExpressionAttribute`){t.push(`{${n.value}}`);continue}let e=n.name;if(n.value===null||n.value===void 0){t.push(e);continue}if(typeof n.value==`string`){if(n.value.includes(`"`)){let r=n.value.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`);t.push(`${e}={"${r}"}`)}else t.push(`${e}="${n.value}"`);continue}t.push(`${e}={${n.value.value}}`)}return t.join(` `)}function j3(e){if(!e)return``;let t=0,n=!0;for(let r of e)r===`(`?t++:r===`)`&&(t--,t<0&&(n=!1));return t!==0&&(n=!1),n?e:e.replace(/[\\()]/g,`\\$&`)}function M3(e){return e.replace(/(?<!\\)&(?=[A-Za-z][A-Za-z0-9]*;|#[0-9]+;|#[xX][0-9A-Fa-f]+;)/g,`\\&`)}function N3(e,t,n){let r=e.unsafe;e.unsafe=r.filter(e=>!(e.character===`&`&&e.after===`[#A-Za-z]`||e.character===`<`||e.character===`[`||e.character===`(`));let i;try{i=e.safe(t,n)}finally{e.unsafe=r}return M3(i)}var P3=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};constructor(e){this.schema=lm(e.extensions),this.handlers=U3(this.schema,this.parseCtx);let{nodeHandlers:t,markHandlers:n}=W3(this.schema);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=w3({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=T3({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers,toMarkdownHandlers:k3})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return E3(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?D3(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?L2(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e){let t;try{t=this.schema.nodeFromJSON(e)}catch(t){let n=`MarkdownManager.serialize() failed: schema rejected JSONContent (type=${e.type}, childCount=${e.content?.length??0})`;throw Error(n,{cause:t})}return O3(t,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}},F3=y2();function I3(e,t){let n=new Map;for(let e of t)n.set(e.name,e);let r={};for(let t of e){if(t.type===`mdxJsxExpressionAttribute`)continue;let e=t.name,i=n.get(e);if(t.value===null||t.value===void 0){r[e]=!0;continue}if(typeof t.value==`string`){if(i?.type===`number`){let n=Number(t.value);r[e]=Number.isNaN(n)?t.value:n}else i?.type===`boolean`?r[e]=t.value===`true`:r[e]=t.value;continue}let a=t.value.value;try{r[e]=JSON.parse(a)}catch{r[e]=a}}return r}function L3(e){let t=!1;return e.descendants(e=>t||e.type.name===`jsxInline`?!1:e.type.name===`jsxComponent`&&e.attrs.sourceDirty?(t=!0,!1):!0),t}function R3(e){return e.attrs.sourceDirty||L3(e)}function z3(e){if(e.type!==`paragraph`)return!1;let t=e.children??[];return t.length===0?!0:t.every(e=>e.type===`text`&&e.value===``)}function B3(e){if(e.length===0)return{type:`inlineCode`,value:``};if(e.every(e=>e.type===`text`))return{type:`inlineCode`,value:e.map(e=>e.value).join(``)};if(e.length===1&&`children`in e[0]){let t=e[0];return{...t,children:[B3(t.children)]}}return{type:`inlineCode`,value:V3(e)}}function V3(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=V3(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}var H3=f1;function U3(e,t){let n=e.nodes,r=e.marks,i={};n.paragraph&&(i.paragraph=(e,t,r)=>{let i=r.all(e).flat(),a=i.some(e=>e?.isBlock&&!e?.isInline),o=i.some(e=>e?.isInline||e?.isText||e?.isTextblock);if(a&&!o)return i.length===1?i[0]:i;if(a&&o){let e=i.filter(e=>!e?.isBlock||e?.isInline),t=i.filter(e=>e?.isBlock&&!e?.isInline),r=[],a=n.paragraph.createAndFill(null,e.length>0?e:null);return a&&r.push(a),r.push(...t),r.length===1?r[0]:r}return n.paragraph.createAndFill(null,i.length>0?i:null)}),n.blockquote&&(i.blockquote=GJ(n.blockquote)),n.table&&(i.table=GJ(n.table)),n.tableRow&&(i.tableRow=GJ(n.tableRow)),n.tableCell&&(i.tableCell=(e=>(t,r,i)=>{let a=i.all(t).flat();if(a.length>0&&n.paragraph){let t=n.paragraph.create(null,a);return e.createAndFill(null,[t])}return e.createAndFill(null,null)})(n.tableCell),n.tableHeader),n.image&&(i.image=e=>n.image.createAndFill({src:e.url??``,alt:e.alt??null,title:e.title??null}),i.imageReference=e=>n.image.createAndFill({src:``,alt:e.alt??null,title:null})),r.escapeMark&&(i.text=t=>{let n=t.value??``,i=typeof t.data?.sourceRaw==`string`?t.data.sourceRaw:null;if(!n&&!i)return null;if(i){let t=n.replaceAll(`\xA0`,` `);return r.sourceLiteral?e.text(t,[r.sourceLiteral.create({sourceRaw:i})]):e.text(t)}let a=t.data?.escapedChars;if(!a?.length)return e.text(n.replaceAll(`\xA0`,` `));let o=[],s=0;for(let{offset:t}of a){if(t>s){let r=n.slice(s,t).replaceAll(`\xA0`,` `);r&&o.push(e.text(r))}if(t<n.length){let i=n[t].replaceAll(`\xA0`,` `);o.push(e.text(i,[r.escapeMark.create()])),s=t+1}}if(s<n.length){let t=n.slice(s).replaceAll(`\xA0`,` `);t&&o.push(e.text(t))}return o.length===1?o[0]:o}),r.code&&(i.inlineCode=t=>e.text(t.value,[r.code.create()]));let a=r.strike??r.delete;if(a&&(i.delete=KJ(a)),r.emphasis&&(i.emphasis=KJ(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=KJ(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=GJ(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`}))),n.codeBlock&&(i.code=t=>{let r=t.value?[e.text(t.value)]:[];return n.codeBlock.createAndFill({language:t.lang??null,meta:t.meta??null,fenceDelimiter:t.data?.sourceFenceChar??"`",fenceLength:t.data?.sourceFenceLength??3},r)}),n.thematicBreak&&(i.thematicBreak=e=>n.thematicBreak.createAndFill({sourceRaw:e.data?.sourceRaw??`---`})),n.hardBreak&&(i.break=e=>n.hardBreak.createAndFill({hardBreakStyle:e.data?.sourceStyle??`spaces`})),n.list&&(i.list=GJ(n.list,e=>({ordered:!!e.ordered,start:e.start??1,spread:!!e.spread,bulletMarker:e.data?.bulletMarker??null,listMarkerDelimiter:e.data?.listMarkerDelimiter??null}))),n.listItem&&(i.listItem=GJ(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread}))),r.link){let t=r.sourceLiteral;i.link=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[](${n.url??``})`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.url??``,title:n.title??null,linkStyle:n.data?.sourceStyle??`inline`,refLabel:null});return o.map(e=>e.mark(s.addToSet(e.marks)))},i.linkReference=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[${n.label??``}][${n.identifier??``}]`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:``,title:null,linkStyle:n.referenceType??`shortcut`,refLabel:n.label??n.identifier??null});return o.map(e=>e.mark(s.addToSet(e.marks)))}}n.htmlBlock&&(i.html=e=>n.htmlBlock.createAndFill({content:e.value??``}));let o=n.linkDefinition??n.linkRefDef;if(o){let e=!!o.spec.attrs?.url,t=!!o.spec.attrs?.href,n=!!o.spec.attrs?.identifier;i.definition=r=>{let i={title:r.title??null};return n&&(i.identifier=r.identifier??``),i.label=r.label??r.identifier??``,e?i.url=r.url??``:t&&(i.href=r.url??``),o.createAndFill(i)}}if(n.jsxComponent){let t=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,r,i)=>{let a=e.name??``,o=F3.getOrWildcard(a),s=I3(e.attributes,o.props),c=i.all(e).flat();return n.jsxComponent.createAndFill({componentName:a,kind:`element`,attributes:e.attributes,sourceRaw:t(e.data)??``,sourceDirty:!1,props:s},c.length?c:void 0)},n.jsxInline?i.mdxJsxTextElement=r=>{let i=t(r.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}:i.mdxJsxTextElement=e=>n.jsxComponent.createAndFill({sourceRaw:t(e.data)??``}),i.mdxFlowExpression=e=>{let r=t(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:r,sourceDirty:!1})},i.mdxTextExpression=n=>{let r=t(n.data)??`{${n.value??``}}`;return e.text(r)}}n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=q1(o),{resolveEmbed:u,sourcePath:d}=t.current,f=u&&d?u(o,d)??null:null,p=f?`/${f}`:o,m=a?.type===`paragraph`&&Array.isArray(a.children)&&a.children.length===1;if(m&&H3.has(l)&&n.jsxComponent&&F3.has(`WikiEmbedImage`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedImage`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,alt:s??o,target:o,anchor:c,alias:s}});if(m&&p1.has(l)&&n.jsxComponent&&F3.has(`WikiEmbedVideo`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedVideo`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&m1.has(l)&&n.jsxComponent&&F3.has(`WikiEmbedAudio`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedAudio`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});let h=s||(c?`${o}#${c}`:o);if(_1.has(l)&&r.link){let t=r.link.create({href:p,title:null,linkStyle:`inline`,refLabel:null,sourceForm:`wikiembed`,target:o,anchor:c,alias:s});return e.text(h,[t])}if(r.link){let t=r.link.create({href:o,title:null,linkStyle:`inline`,refLabel:null});return e.text(h,[t])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")});let s=t=>{let r=t.value??t.type;return n.rawMdxFallback?(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled block mdast: ${t.type}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled block mdast: ${t.type}`},r?[e.text(r)]:null)):null},c=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),e.text(t.value??t.type));return i.math||=s,i.inlineMath||=c,i.footnoteReference||=c,i.rawMdxFallbackMdast=t=>{if(!n.rawMdxFallback)return null;let r=t.position?{start:t.position.start?.offset??0,end:t.position.end?.offset??0}:{start:0,end:0};return console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.originalType,reason:`Unhandled mdast: ${t.originalType}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function W3(e){let t={},n={},r=e.nodes,i=e.marks;if(r.paragraph&&(t.paragraph=ZJ(`paragraph`)),r.blockquote&&(t.blockquote=ZJ(`blockquote`)),r.heading&&(t.heading=ZJ(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle}}))),r.codeBlock&&(t.codeBlock=e=>({type:`code`,lang:e.attrs.language??null,meta:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength}})),r.thematicBreak&&(t.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),r.hardBreak&&(t.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle}})),r.list&&(t.list=ZJ(`list`,e=>({ordered:e.attrs.ordered??!1,start:e.attrs.ordered?e.attrs.start??1:null,spread:e.attrs.spread??!1,data:{bulletMarker:e.attrs.bulletMarker,listMarkerDelimiter:e.attrs.listMarkerDelimiter}}))),r.listItem&&(t.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&z3(r[0])?r.slice(1):r;return{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,children:i}}),r.table&&(t.table=ZJ(`table`)),r.tableRow&&(t.tableRow=ZJ(`tableRow`)),r.tableCell&&(t.tableCell=ZJ(`tableCell`)),r.tableHeader&&(t.tableHeader=ZJ(`tableCell`)),r.image&&(t.image=e=>({type:`image`,url:e.attrs.src,alt:e.attrs.alt,title:e.attrs.title})),r.htmlBlock&&(t.htmlBlock=e=>({type:`html`,value:e.attrs.content})),r.linkDefinition??r.linkRefDef){let e=r.linkDefinition?`linkDefinition`:`linkRefDef`;t[e]=e=>({type:`definition`,identifier:e.attrs.identifier??e.attrs.label??``,label:e.attrs.label??e.attrs.identifier??``,url:e.attrs.url??e.attrs.href??``,title:e.attrs.title})}if(r.jsxComponent&&(t.jsxComponent=(e,t,n)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let r=e.attrs.componentName||null,i=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!R3(e)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:r,attributes:i,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:F3.getOrWildcard(r??`*`).serialize(e,{all:e=>n.all(e),registry:F3,serializeChildren:()=>{throw Error(`SerializeContext.serializeChildren is not available in the PM→mdast handler. Compat descriptors that need markdown-byte body rendering must emit a marker mdast node and let the to-markdown handler render the body via state.containerFlow.`)}})}),r.rawMdxFallback&&(t.rawMdxFallback=e=>{let t=e.textContent??``,n=typeof e.attrs.reason==`string`?e.attrs.reason:``,r=e.attrs.originalSpan;return{type:`rawMdxFallback`,value:t,data:{reason:n,originalSpan:r&&typeof r==`object`&&`start`in r&&`end`in r?{start:Number(r.start)||0,end:Number(r.end)||0}:{start:0,end:0}}}}),r.jsxInline&&(t.jsxInline=e=>{let t=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:null,attributes:[],children:[],data:{sourceRaw:String(t)}}}),r.wikiLink&&(t.wikiLink=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLink`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),r.wikiLinkEmbed&&(t.wikiLinkEmbed=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),i.emphasis&&(n.emphasis=QJ(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.strong&&(n.strong=QJ(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.code&&(n.code=(e,t,n)=>B3(n)),i.strike??i.delete){let e=i.strike?`strike`:`delete`;n[e]=QJ(`delete`)}return i.link&&(n.link=(e,t,n)=>{if(e.attrs.sourceForm===`wikiembed`){let t=typeof e.attrs.target==`string`&&e.attrs.target.length>0?e.attrs.target:e.attrs.href??``,n=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,r=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}let r=e.attrs.linkStyle;return r===`autolink`?{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}}:r===`inline`||!r?{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n}:{type:`linkReference`,identifier:(e.attrs.refLabel??``).toLowerCase(),label:e.attrs.refLabel,referenceType:r,children:n}}),i.escapeMark&&(n.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data=t.data??{},t.data.escapedChars=t.data.escapedChars??[];for(let e=0;e<t.value.length;e++)t.data.escapedChars.push({offset:e,char:t.value[e]})}return n.length===1?n[0]:n}),i.sourceLiteral&&(n.sourceLiteral=(e,t,n)=>{let r=typeof e.attrs.sourceRaw==`string`?e.attrs.sourceRaw:``;if(n.length===1&&n[0]?.type===`text`){let e=n[0];return e.data=e.data??{},e.data.sourceRaw=r||e.value,e}return{type:`text`,value:r,data:{sourceRaw:r}}}),{nodeHandlers:t,markHandlers:n}}var G3=/\p{M}+/gu,K3=/[^\p{L}\p{N}]+/gu,q3=/^-+|-+$/g;function J3(e){return e.trim().normalize(`NFKD`).replace(G3,``).toLowerCase().replace(K3,`-`).replace(q3,``)}function Y3(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function X3(e,t){let n=J3(e);return n?Y3(n,t):``}var Z3=new Set([`img`,`video`,`audio`]);function Q3(e){let t=e.name;if(!t||!Z3.has(t))return null;let n={};for(let t of e.attributes){if(t.type!==`mdxJsxAttribute`)return null;if(t.value===null)n[t.name]=!0;else if(typeof t.value==`string`)n[t.name]=t.value;else return null}return{type:`element`,tagName:t,properties:n,children:[]}}function $3(e,t){let n=J3(e);return t?`#${n}-${J3(t)}`:`#${n}`}var e6={wikiLink:(e,t)=>{let n=t,{target:r,anchor:i,alias:a}=n.data,o={type:`element`,tagName:`a`,properties:{className:[`wiki-link`],dataTarget:r,dataAnchor:i??``,dataAlias:a??``,href:$3(r,i)},children:n.children.length>0?e.all(n):[{type:`text`,value:n.value}]};return e.patch(t,o),e.applyData(t,o)},wikiLinkEmbed:(e,t)=>{let n=t,{target:r,anchor:i,alias:a}=n.data,o={type:`element`,tagName:`a`,properties:{className:[`wiki-embed`],dataTarget:r,dataAnchor:i??``,dataAlias:a??``,href:$3(r,i)},children:n.children.length>0?e.all(n):[{type:`text`,value:n.value}]};return e.patch(t,o),e.applyData(t,o)},mdxJsxFlowElement:(e,t)=>{let n=t,r=Q3(n);if(r)return e.patch(t,r),e.applyData(t,r);let i={type:`element`,tagName:`pre`,properties:{className:[`mdx-component`]},children:[{type:`element`,tagName:`code`,properties:{},children:[{type:`text`,value:typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:``}]}]};return e.patch(t,i),e.applyData(t,i)},mdxJsxTextElement:(e,t)=>{let n=t,r=Q3(n);if(r)return e.patch(t,r),e.applyData(t,r);let i={type:`element`,tagName:`span`,properties:{className:[`mdx-inline`]},children:[{type:`text`,value:typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:``}]};return e.patch(t,i),e.applyData(t,i)},rawMdxFallback:(e,t)=>{let n=t,r=n.data.reason||`unknown`,i=n.value||``,a={type:`comment`,value:` Parse error: ${r.replace(/--/g,`—`)} `},o={type:`element`,tagName:`pre`,properties:{className:[`mdx-fallback`]},children:[{type:`element`,tagName:`code`,properties:{},children:[{type:`text`,value:i}]}]};return e.patch(t,o),[a,e.applyData(t,o)]}},t6=/^(https?:|mailto:|tel:|ftp:|sms:|\/|#|\?|\.\/|\.\.\/)/i;function n6(e){let t=e.trim();return t===``?!0:t6.test(t)}var r6=()=>e=>{jB(e,`element`,e=>{let t=e.tagName.toLowerCase(),n=e.properties;if(n){if(t===`a`||t===`area`||t===`link`||t===`base`){let e=n.href;typeof e==`string`&&!n6(e)&&delete n.href}if(t===`img`||t===`iframe`||t===`script`||t===`embed`||t===`source`||t===`audio`||t===`video`||t===`track`){let e=n.src;typeof e==`string`&&!n6(e)&&delete n.src}if(t===`form`){let e=n.action;typeof e==`string`&&!n6(e)&&delete n.action}}})};function i6(e){let t=SJ().use(cX).use(yY,[`yaml`]).use(t3).use(pJ).use(S3).use(P$,{handlers:e6}).use(r6).use(qQ);return String(t.processSync(e))}var a6=iE({ok:_E(!0),serverInstanceId:z().min(1),currentBranch:z().min(1).optional(),currentDiskAckSVs:pE(z().min(1),z().min(1)).optional()}).loose(),o6=iE({id:z().min(1),display_name:z().min(1),display_email:z(),source:hE([`git-config`,`synthesized`]),created_at:z().min(1)}).loose(),s6=`server-info`,c6=`branch-switched`,l6=`disk-ack`,u6=`config-validation-rejected`,d6=hE([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`]),f6=iE({v:_E(1),ch:_E(s6),seq:WT(),serverInstanceId:z().min(1),currentBranch:z().min(1).optional()}).loose(),p6=iE({v:_E(1),ch:_E(c6),seq:WT(),branch:z().min(1)}).loose(),m6=iE({v:_E(1),ch:d6,seq:WT()}).loose(),h6=iE({v:_E(1),ch:_E(l6),seq:WT(),docName:z().min(1),sv:z().min(1)}).loose(),g6=iE({v:_E(1),ch:_E(u6),seq:WT(),docName:z().min(1),error:Y$}).loose();new F$.default,new F$.default;var _6=iE({path:nE(sE([z(),WT()])),message:z(),issueCode:z()});lE(`code`,[iE({code:_E(`SCHEMA_INVALID`),issues:nE(_6)}),iE({code:_E(`WRITE_ERROR`),detail:z()})]);function v6(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}function y6(e){if(e.code!==`SCHEMA_INVALID`)return{};let t={};for(let n of e.issues){let e=n.path[0];typeof e==`string`&&(t[e]=t[e]?`${t[e]}; ${n.message}`:n.message)}return t}hE([`text`,`number`,`boolean`,`date`,`list`]);var b6=sE([z(),WT(),JT(),nE(z())]),x6=/^\d{4}-\d{2}-\d{2}$/;function S6(e){return typeof e==`string`&&x6.test(e)}function C6(e){return Array.isArray(e)?`list`:typeof e==`boolean`?`boolean`:typeof e==`number`?`number`:S6(e)?`date`:`text`}var w6=pE(z(),b6),T6=pE(z(),sE([b6,XT()])),E6={defaultKeyType:`PLAIN`,defaultStringType:`PLAIN`,lineWidth:0};function D6(e){return e===``?``:`---\n${e.endsWith(`
|
|
394
|
-
`)?e.slice(0,-1):e}\n---\n`}var O6=65536;function k6(e){let t=e.match(S1);return t?{fenced:t[0],body:e.slice(t[0].length)}:{fenced:``,body:e}}function A6(e){if(e.trim()===``)return{doc:new Uv({}),map:{}};let t;try{t=$y(e,{uniqueKeys:!1})}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new Uv({}),map:null,parseError:`parse threw: ${t}`}}if(t.errors.length>0)return{doc:t,map:null,parseError:t.errors[0]?.message??`yaml parse errors`};let n;try{n=t.toJS()}catch(e){let n=e instanceof Error?e.message:String(e);return{doc:t,map:null,parseError:`toJS threw: ${n}`}}if(typeof n!=`object`||!n||Array.isArray(n))return{doc:t,map:null,parseError:`top-level value is not a mapping`};let r=w6.safeParse(n);if(!r.success){let e=r.error.issues[0],n=e&&Array.isArray(e.path)?e.path.join(`.`):``,i=e?.message??`unknown`;return{doc:t,map:null,parseError:n?`value at "${n}" failed schema: ${i}`:`schema validation failed: ${i}`}}return{doc:t,map:r.data}}function j6(e){return e===``?{doc:new Uv({}),map:{}}:A6(w1(e))}function M6(e){let{fenced:t}=k6(e),{map:n,parseError:r}=j6(t);return{map:n??{},parseError:r}}function N6(e){let{fenced:t}=k6(e);if(t===``)return[];let{doc:n,map:r}=j6(t);return r===null?[]:L6(n)}function P6(e){return typeof e==`object`&&!!e&&`key`in e}function F6(e){let t=e.key;return typeof t==`string`?t:t&&typeof t==`object`&&`value`in t&&typeof t.value==`string`?t.value:null}function I6(e,t){let n=e.key;if(typeof n==`string`){e.key=t;return}if(n&&typeof n==`object`){n.value=t;return}e.key=t}function L6(e){let t=e.contents;if(!t||!(`items`in t)||!Array.isArray(t.items))return[];let n=[];for(let e of t.items){if(!P6(e))continue;let t=F6(e);t!==null&&n.push(t)}return n}var R6=`frontmatter`;function z6(e){if(e.contents==null||!(`items`in e.contents)){let t=e.createNode({});return e.contents=t,t}return e.contents}function B6(e){let t=e.contents;return!t||!(`items`in t)||(t.items?.length??0)===0?``:D6(e.toString(E6))}function V6(e){let t=new TextEncoder().encode(e).byteLength;return t>65536?{kind:`region_too_large`,bytes:t,limit:O6}:null}function H6(e,t){if(Object.hasOwn(t,R6))return{ok:!1,error:{kind:`reserved_key`,key:R6}};let{doc:n,map:r}=j6(e);if(r===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};try{z6(n);for(let[e,r]of Object.entries(t)){if(r===null){n.delete(e);continue}let t=b6.safeParse(r);if(!t.success)return{ok:!1,error:{kind:`invalid_value`,key:e,reason:t.error.issues[0]?.message??`invalid value`}};n.set(e,t.data)}let e=B6(n),r=V6(e);return r?{ok:!1,error:r}:{ok:!0,nextFenced:e}}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function U6(e,t,n,r={}){if(t===R6||n===R6)return{ok:!1,error:{kind:`reserved_key`,key:R6}};let{doc:i,map:a}=j6(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};if(t===n)return{ok:!0,nextFenced:e};let o=i.contents;if(!o||!(`items`in o)||!Array.isArray(o.items))return{ok:!1,error:{kind:`unknown_key`,key:t}};let s=o.items.find(e=>P6(e)&&F6(e)===t);if(!s)return{ok:!1,error:{kind:`unknown_key`,key:t}};if(!r.allowDuplicate&&o.items.some(e=>P6(e)&&e!==s&&F6(e)===n))return{ok:!1,error:{kind:`duplicate_target`,key:n}};try{I6(s,n);let e=B6(i),t=V6(e);return t?{ok:!1,error:t}:{ok:!0,nextFenced:e}}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function W6(e,t){let{doc:n,map:r}=j6(e);if(r===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let i=n.contents;if(!i||!(`items`in i)||!Array.isArray(i.items))return{ok:!0,nextFenced:e};let a=L6(n);if(a.length!==t.length||!G6(a,t))return{ok:!1,error:{kind:`reorder_mismatch`,expected:a,got:[...t]}};try{let e=i.items.filter(P6),r=[];for(let n of t){let i=e.findIndex(e=>F6(e)===n);if(i===-1)return{ok:!1,error:{kind:`reorder_mismatch`,expected:a,got:[...t]}};let[o]=e.splice(i,1);o&&r.push(o)}i.items=r;let o=B6(n),s=V6(o);return s?{ok:!1,error:s}:{ok:!0,nextFenced:o}}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function G6(e,t){let n=new Map;for(let t of e)n.set(t,(n.get(t)??0)+1);for(let e of t){let t=(n.get(e)??0)-1;if(t<0)return!1;n.set(e,t)}for(let e of n.values())if(e!==0)return!1;return!0}var K6=Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`form-write`})}),q6=`frontmatter`;function J6(e){return{ok:!1,error:e}}function Y6(e){return{ok:!0,...e}}function X6(e){return{ok:!0,...e}}function Z6(e){return{ok:!0,...e}}function Q6(e){switch(e.kind){case`unknown_key`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:`unknown key '${e.key}'`,issueCode:`unknown_key`}]};case`duplicate_target`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:`key '${e.key}' already exists`,issueCode:`duplicate_target`}]};case`invalid_value`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:e.reason,issueCode:`invalid_value`}]};case`reserved_key`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:`'${e.key}' is a reserved frontmatter key`,issueCode:`reserved_key`}]};case`reorder_mismatch`:return{code:`WRITE_ERROR`,detail:`reorder list does not match current keys (state changed mid-drag)`};case`region_too_large`:return{code:`SCHEMA_INVALID`,issues:[{path:[],message:`Frontmatter region exceeds ${O6}-byte limit (would be ${e.bytes})`,issueCode:`region_too_large`}]};case`parse_failed`:return{code:`WRITE_ERROR`,detail:`Frontmatter YAML is malformed; fix in source mode to commit (${e.reason})`}}}function $6(e,t){if(e.parseError!==t.parseError||e.keys.length!==t.keys.length)return!1;for(let n=0;n<e.keys.length;n++)if(e.keys[n]!==t.keys[n])return!1;for(let n of e.keys)if(!e8(e.map[n],t.map[n]))return!1;return!0}function e8(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return!1}function t8(e){let t=e.toString();return{snapshot:n8(t),raw:t}}function n8(e){let{map:t,parseError:n}=M6(e);return{map:t,keys:N6(e),parseError:n}}function r8(e){let t=e.document,n=t.getText(`source`),r=new Set,i=t8(n),a=i.snapshot,o=k6(i.raw).fenced,s=!1;function c(e=!1){if(s)return;let t,i;try{let e=t8(n);t=e.snapshot,i=e.raw}catch(e){console.warn(`[bindFrontmatterDoc] readSnapshotFromYText threw:`,e);return}if(!(!e&&$6(a,t))){a=t,o=k6(i).fenced;for(let e of r)try{e(t)}catch(e){console.warn(`[bindFrontmatterDoc] listener threw:`,e)}}}let l=e=>{s||i8(e,o.length)&&c()};n.observe(l),e.on(`synced`,u);function u(){c(!0)}function d(e){let r;return t.transact(()=>{let{fenced:t}=k6(n.toString());r=e(t),r.ok&&r.nextFenced!==t&&(n.delete(0,t.length),r.nextFenced!==``&&n.insert(0,r.nextFenced))},K6),r??{ok:!1,error:{kind:`parse_failed`,reason:`commit transact produced no result`}}}function f(e){if(s)return J6({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});if(Object.hasOwn(e,q6))return J6({code:`SCHEMA_INVALID`,issues:[{path:[q6],message:`'${q6}' is a reserved frontmatter key`,issueCode:`reserved_key`}]});let t=T6.safeParse(e);if(!t.success)return J6({code:`SCHEMA_INVALID`,issues:t.error.issues.map(v6)});let n=t.data,r=Object.keys(n),i=d(e=>H6(e,n));return i.ok?Y6({appliedKeys:r}):J6(Q6(i.error))}function p(e,t,n={}){if(s)return J6({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let r=d(r=>U6(r,e,t,n));return r.ok?X6({oldKey:e,newKey:t}):J6(Q6(r.error))}function m(e){if(s)return J6({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let t=d(t=>W6(t,e));return t.ok?Z6({orderedKeys:[...e]}):J6(Q6(t.error))}return{current(){return t8(n).snapshot},patch(e){return f(e)},rename(e,t,n){return p(e,t,n)},reorder(e){return m(e)},subscribe(e){return r.add(e),()=>{r.delete(e)}},dispose(){s||(s=!0,n.unobserve(l),e.off(`synced`,u),r.clear())}}}function i8(e,t){if(t===0)return!0;let n=0;for(let r of e.delta){if(typeof r.retain==`number`){n+=r.retain;continue}if(typeof r.insert==`string`){if(n<t)return!0;n+=r.insert.length;continue}if(r.insert!==void 0){if(n<t)return!0;n+=1;continue}if(typeof r.delete==`number`&&n<t)return!0}return!1}var a8=new F$.default;a8.Match_Threshold=.5;var o8=class extends Error{chunksCompleted;totalChunks;bytesWritten;bytesRemaining;cause;constructor(e,t){let n=e instanceof Error?e.message:typeof e==`string`?e:`unknown error`;super(`chunked insert failed after ${t.chunksCompleted}/${t.totalChunks} chunks (${t.bytesWritten} bytes written, ${t.bytesRemaining} bytes lost): ${n}`),this.name=`ChunkedInsertError`,this.chunksCompleted=t.chunksCompleted,this.totalChunks=t.totalChunks,this.bytesWritten=t.bytesWritten,this.bytesRemaining=t.bytesRemaining,this.cause=e}};async function s8(e,t,n,r,i={}){let a=i.thresholdBytes??512e3,o=i.chunkSizeBytes??51200,s=i.origin,c=i.yieldFn??c8,l=i.resolveOffset??(e=>e);if(r.length<=a){e.transact(()=>{t.insert(n,r)},s);return}let u=Math.ceil(r.length/o),d=0,f=n,p=0,m=0;for(;d<r.length;){let n=Math.min(d+o,r.length),i=r.slice(d,n);try{let n=l(f);e.transact(()=>{t.insert(n,i)},s)}catch(e){throw new o8(e,{chunksCompleted:p,totalChunks:u,bytesWritten:m,bytesRemaining:r.length-d})}p++,m+=i.length,f+=i.length,d=n,d<r.length&&await c()}}function c8(){return new Promise(e=>{let t=globalThis;t.document?.hidden!==!0&&typeof t.requestAnimationFrame==`function`?t.requestAnimationFrame(()=>e()):setTimeout(()=>e(),0)})}function l8(){let e=!1,t=``,n=0;return r=>{let i=u8(r);return e?(i&&i.char===t&&i.len>=n&&!i.hasInfo&&(e=!1,t=``,n=0),!0):i?(e=!0,t=i.char,n=i.len,!0):!1}}function u8(e){let t=(e.endsWith(`\r`)?e.slice(0,-1):e).match(/^ {0,3}([`~])(\1{2,})(.*)$/);return t?{char:t[1],len:1+t[2].length,hasInfo:t[3].trim()!==``}:null}var d8=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],f8={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`},p8={cursor:`#FFFFFF`,windsurf:`#FFFFFF`},m8=[`#f0ece3`,`#fff5e1`,`#f9e1db`,`#f5def7`,`#ece2fb`,`#dce8fa`,`#DBF3FB`];function h8(e,t=d8){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}function g8(e){let t=e.trim();if(!t)return`?`;let n=t.split(/[-\s]+/).filter(Boolean);if(!n.length)return`?`;if(n.length>=2)return n.slice(0,2).map(e=>e[0]??``).join(``).toUpperCase();let r=n[0],i=[r[0]];for(let e=1;e<r.length&&i.length<2;e++){let t=r[e-1],n=r[e];t===t.toLowerCase()&&n===n.toUpperCase()&&n!==n.toLowerCase()&&i.push(n)}return i.length>=2?i.join(``).toUpperCase():r.slice(0,2).toUpperCase()}function _8(e){let t=e.trim();if(!t)return e;if(t.includes(` `)||!/[-_]/.test(t))return t;let n=t.split(/[-_]+/).filter(Boolean);return n.length?n.map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `):t}var v8={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,copilot:`github`,cline:`cline`};function y8(e){return e?v8[e]??`bot`:`bot`}function b8(e){let t=parseInt(e.slice(1,3),16)/255,n=parseInt(e.slice(3,5),16)/255,r=parseInt(e.slice(5,7),16)/255,i=Math.max(t,n,r),a=Math.min(t,n,r),o=(i+a)/2;if(i===a)return[0,0,o*100];let s=i-a,c=o>.5?s/(2-i-a):s/(i+a),l;return l=i===t?((n-r)/s+(n<r?6:0))/6:i===n?((r-t)/s+2)/6:((t-n)/s+4)/6,[l*360,c*100,o*100]}function x8(e,t,n){let r=t/100,i=n/100,a=r*Math.min(i,1-i),o=t=>{let n=(t+e/30)%12,r=i-a*Math.max(Math.min(n-3,9-n,1),-1);return Math.round(255*r).toString(16).padStart(2,`0`)};return`#${o(0)}${o(8)}${o(4)}`}function S8(e){let[t]=b8(e);return x8(t,45,32)}var C8=[`Curious`,`Brave`,`Clever`,`Swift`,`Gentle`,`Bright`,`Wise`,`Bold`,`Calm`,`Keen`],w8=[`Bird`,`Cat`,`Dog`,`Fish`,`Mouse`,`Rabbit`,`Shrimp`,`Snail`,`Squirrel`,`Turtle`],T8=`ok-user-name-v3`,E8=`ok-user-color-v3`;function D8(e){return e[Math.floor(Math.random()*e.length)]}function O8(){return`${D8(C8)} ${D8(w8)}`}function k8(){return D8(m8)}function A8(e){try{return localStorage.getItem(e)}catch{return null}}function j8(e,t){try{localStorage.setItem(e,t)}catch{}}function M8(){let e=new URLSearchParams(window.location.search).get(`coeditor`)||`standalone`,t=crypto.randomUUID(),n=A8(T8),r=A8(E8);return n||(n=O8(),j8(T8,n)),r||(r=k8(),j8(E8,r)),{name:n,color:r,coeditor:e,tabId:t}}function N8(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`/`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1):null,o=(i.split(`?`)[0]??``).trim();if(!o)return null;let s=(o.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(s){let e=(s[1]??``).toLowerCase();if(e!==`md`&&e!==`mdx`)return null}let c=o.toLowerCase(),l=c.endsWith(`.mdx`)?o.slice(0,-4):c.endsWith(`.md`)?o.slice(0,-3):o,u=t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of l.split(`/`))if(e===`..`){if(u.length===0)return null;u.pop()}else e!==`.`&&e!==``&&u.push(e);return u.length===0?null:{docName:u.join(`/`),anchor:a||null}}var P8=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function F8(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function I8(e){return e.split(`/`).filter(Boolean)}function L8(e){let t=e.trim();return P8.test(t)||t.startsWith(`//`)}function R8(e,t){let n=e.trim();if(!n)return null;if(n.startsWith(`#`)){let e=n.slice(1).trim();return e?{kind:`anchor`,anchor:e}:null}let r=N8(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};if(L8(n)||n.startsWith(`/`))return{kind:`external`,url:n};let i=F8(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function z8(e,t){let n=e.trim();return n?L8(n)?{kind:`external`,url:t?`${n}#${t}`:n}:{kind:`doc`,docName:n,anchor:t?.trim()||null}:null}function B8(e,t){let n=e.trim();if(!n||P8.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=((r>=0?n.slice(0,r):n).split(`?`)[0]??``).trim();if(!i)return null;let a=i.startsWith(`/`),o=a?i.slice(1):i,s=a?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of o.split(`/`))if(e===`..`){if(s.length===0)return null;s.pop()}else e!==`.`&&e!==``&&s.push(e);return s.length===0?null:s.join(`/`)}function V8(e,t,n=null){let r=I8(e);r.pop();let i=I8(t),a=0;for(;a<r.length&&a<i.length&&r[a]===i[a];)a+=1;let o=r.slice(a).map(()=>`..`),s=i.slice(a),c=[...o,...s].join(`/`);return c||=i.at(-1)??t,!c.startsWith(`./`)&&!c.startsWith(`../`)&&(c=`./${c}`),`${c}.md${n?`#${n}`:``}`}function H8(e){return e.trim().replace(/^\.\/+/,``).replace(/^\/+/,``).replace(/\.mdx?$/i,``)}function U8(e){let t=H8(e),n=t.lastIndexOf(`/`);return{initialDir:n>0?t.slice(0,n):``,suggestedName:`${n>=0?t.slice(n+1):t||`untitled`}.md`}}function W8(e){if(!e)return[];let t=e.split(`/`).filter(Boolean),n=[];for(let e=1;e<t.length;e++)n.push(t.slice(0,e).join(`/`));return n}function G8(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t>0?e.slice(0,t):``}function K8(e){return H8(e).replace(/\/+$/g,``)}function q8(e){let t=new Set;for(let n of e)for(let e of W8(n))t.add(e);return t}function J8(e,t){if(!t)return;let n=J3(e);if(n)return t.get(n)}function Y8(e,t){let n=K8(e);if(!n)return{kind:`missing`,target:n};if(t.pages.has(n))return{kind:`doc`,target:n,docName:n};let r=J8(n,t.pagesBySlug);if(r)return{kind:`doc`,target:r,docName:r};let i=`${n}/index`;if(t.pages.has(i))return{kind:`folder-index`,target:n,folderPath:n,docName:i,noteKind:`canonical-index`};let a=n.split(`/`).pop(),o=a?`${n}/${a}`:null;return o&&t.pages.has(o)?{kind:`folder-index`,target:n,folderPath:n,docName:o,noteKind:`legacy-folder-note`}:(t.folderPaths??q8(t.pages)).has(n)?{kind:`folder`,target:n,folderPath:n}:{kind:`missing`,target:n}}function X8(e){switch(e.kind){case`doc`:case`folder-index`:return e.docName;case`missing`:return e.target;case`folder`:return null}}function Z8(e){if(!e.startsWith(`#/`))return null;let t=e.slice(2),n=t.indexOf(`?`),r=n>=0?t.slice(0,n):t;if(!r)return null;try{return r.split(`/`).map(decodeURIComponent).join(`/`)}catch{return r}}function Q8(e,t){let n=`#/${e}`;return t?`${n}?anchor=${encodeURIComponent(t)}`:n}var $8=null,e5=new Set;function t5(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function n5(e,t){return e===null?!1:e===t?!0:t5(e.pages,t.pages)&&t5(e.folderPaths,t.folderPaths)}function r5(e,t){let n=new Map;for(let r of e){let e=t(r);e&&!n.has(e)&&n.set(e,r)}return n}function i5(){return $8}function a5(e){if(!n5($8,e)){$8=e;for(let t of[...e5])try{t(e)}catch(e){console.error(`[page-list-cache] subscriber threw:`,e)}}}function o5(e){if(e5.add(e),$8!==null)try{e($8)}catch(e){console.error(`[page-list-cache] subscriber threw on replay:`,e)}return()=>{e5.delete(e)}}var s5=`open-knowledge:documents-changed`,c5=new Set(d6.options);function l5(e){return e===void 0||!Array.isArray(e)?[`files`]:[...new Set(e.filter(e=>c5.has(e)))]}function u5(e=[`files`]){window.dispatchEvent(new CustomEvent(s5,{detail:{channels:l5(e)}}))}function d5(e){let t=t=>{e(l5(t instanceof CustomEvent?t.detail?.channels:void 0))};return window.addEventListener(s5,t),()=>window.removeEventListener(s5,t)}var f5=(0,C.createContext)(null);function p5(e,t){if(t.size===0)return new Set(e);let n=new Set(e);for(let e of t)n.add(e);return n}function m5(e,t){if(e.size===0)return new Set;let n=new Set;for(let r of e)t.has(r)||n.add(r);return n}function h5(e,t){let n=new Map(e);for(let e of t)n.has(e)||n.set(e,e);return n}async function g5(){let e=await fetch(`/api/pages`);if(!e.ok)throw Error(`/api/pages responded with ${e.status}`);let t=await e.json();return Array.isArray(t.pages)?t.pages:[]}function _5(e){console.error(`[PageListContext] Failed to load pages:`,e)}function v5(e){let t=(0,Sf.c)(36),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=new Set,t[0]=r):r=t[0];let[i,a]=(0,C.useState)(r),o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=new Map,t[1]=o):o=t[1];let[s,c]=(0,C.useState)(o),l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=new Map,t[2]=l):l=t[2];let[u,d]=(0,C.useState)(l),f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=new Set,t[3]=f):f=t[3];let[p,m]=(0,C.useState)(f),[h,g]=(0,C.useState)(!0),[_,v]=(0,C.useState)(null),y=(0,C.useRef)(0),b;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(){let e=y.current+=1;g(!0),g5().then(t=>{if(e!==y.current)return;let n=new Set(t.map(x5));a(n),c(new Map(t.map(b5))),d(new Map(t.map(y5))),m(e=>m5(e,n)),v(null)}).catch(t=>{e===y.current&&(_5(t),v(t instanceof Error?t.message:`Failed to load pages`))}).finally(()=>{e===y.current&&g(!1)})},t[4]=b):b=t[4];let x=b,S;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(e){m(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n}),v(null)},t[5]=S):S=t[5];let w=S,T,E;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{x();let e=()=>{document.visibilityState===`visible`&&x()};window.addEventListener(`focus`,e),window.addEventListener(`visibilitychange`,e);let t=d5(e=>{e.includes(`files`)&&x()});return()=>{window.removeEventListener(`focus`,e),window.removeEventListener(`visibilitychange`,e),t()}},E=[],t[6]=T,t[7]=E):(T=t[6],E=t[7]),(0,C.useEffect)(T,E);let ee,D,te,ne,re;if(t[8]!==p||t[9]!==u||t[10]!==s||t[11]!==i){ne=p5(i,p);let e;t[17]!==p||t[18]!==s?(e=h5(s,p),t[17]=p,t[18]=s,t[19]=e):e=t[19],te=e,D=u,ee=q8(ne),re=r5(ne,J3),t[8]=p,t[9]=u,t[10]=s,t[11]=i,t[12]=ee,t[13]=D,t[14]=te,t[15]=ne,t[16]=re}else ee=t[12],D=t[13],te=t[14],ne=t[15],re=t[16];let ie=re,O,ae;t[20]!==ee||t[21]!==ne||t[22]!==ie?(O=()=>{a5({pages:ne,folderPaths:ee,pagesBySlug:ie})},ae=[ne,ee,ie],t[20]=ee,t[21]=ne,t[22]=ie,t[23]=O,t[24]=ae):(O=t[23],ae=t[24]),(0,C.useEffect)(O,ae);let oe;t[25]!==_||t[26]!==ee||t[27]!==h||t[28]!==D||t[29]!==te||t[30]!==ne||t[31]!==ie?(oe={pages:ne,pagesBySlug:ie,pageTitles:te,pageMeta:D,folderPaths:ee,loading:h,error:_,refetch:x,addPage:w},t[25]=_,t[26]=ee,t[27]=h,t[28]=D,t[29]=te,t[30]=ne,t[31]=ie,t[32]=oe):oe=t[32];let se;return t[33]!==n||t[34]!==oe?(se=(0,k.jsx)(f5,{value:oe,children:n}),t[33]=n,t[34]=oe,t[35]=se):se=t[35],se}function y5(e){return[e.docName,{size:e.size,modified:e.modified,docExt:e.docExt}]}function b5(e){return[e.docName,e.title]}function x5(e){return e.docName}function S5(){let e=(0,C.use)(f5);if(!e)throw Error(`usePageList must be used within <PageListProvider />`);return e}var C5=v(`group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted`,segmented:`text-muted-foreground hover:bg-muted-foreground/10 data-[state=on]:bg-background data-[state=on]:shadow-sm data-[state=on]:text-foreground dark:data-[state=on]:bg-muted`},size:{default:`h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,sm:`h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`}},defaultVariants:{variant:`default`,size:`default`}}),w5=C.createContext({size:`default`,variant:`default`,spacing:0,orientation:`horizontal`});function T5(e){let t=(0,Sf.c)(29),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({className:r,variant:c,size:a,spacing:o,orientation:s,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=o===void 0?0:o,u=s===void 0?`horizontal`:s,d;t[8]===l?d=t[9]:(d={"--gap":l},t[8]=l,t[9]=d);let f=d,p;t[10]===r?p=t[11]:(p=h(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch`,r),t[10]=r,t[11]=p);let m;t[12]!==u||t[13]!==a||t[14]!==l||t[15]!==c?(m={variant:c,size:a,spacing:l,orientation:u},t[12]=u,t[13]=a,t[14]=l,t[15]=c,t[16]=m):m=t[16];let g;t[17]!==n||t[18]!==m?(g=(0,k.jsx)(w5.Provider,{value:m,children:n}),t[17]=n,t[18]=m,t[19]=g):g=t[19];let _;return t[20]!==u||t[21]!==i||t[22]!==a||t[23]!==l||t[24]!==f||t[25]!==p||t[26]!==g||t[27]!==c?(_=(0,k.jsx)(Kr,{"data-slot":`toggle-group`,"data-variant":c,"data-size":a,"data-spacing":l,"data-orientation":u,style:f,className:p,...i,children:g}),t[20]=u,t[21]=i,t[22]=a,t[23]=l,t[24]=f,t[25]=p,t[26]=g,t[27]=c,t[28]=_):_=t[28],_}function E5(e){let t=(0,Sf.c)(19),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,variant:a,size:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?`default`:a,c=o===void 0?`default`:o,l=C.use(w5),u=l.variant||s,d=l.size||c,f=l.spacing,p;t[6]!==r||t[7]!==l.size||t[8]!==l.variant||t[9]!==c||t[10]!==s?(p=h(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t text-muted-foreground data-[state=on]:text-foreground`,C5({variant:l.variant||s,size:l.size||c}),r),t[6]=r,t[7]=l.size,t[8]=l.variant,t[9]=c,t[10]=s,t[11]=p):p=t[11];let m;return t[12]!==n||t[13]!==l.spacing||t[14]!==i||t[15]!==u||t[16]!==d||t[17]!==p?(m=(0,k.jsx)(qr,{"data-slot":`toggle-group-item`,"data-variant":u,"data-size":d,"data-spacing":f,className:p,...i,children:n}),t[12]=n,t[13]=l.spacing,t[14]=i,t[15]=u,t[16]=d,t[17]=p,t[18]=m):m=t[18],m}export{R8 as $,qh as $t,m8 as A,ir as An,c1 as At,a6 as B,hn as Bn,J3 as Bt,f6 as C,j as Cn,E2 as Ct,g1 as D,ar as Dn,C6 as Dt,o8 as E,hr as En,k2 as Et,P3 as F,Sn as Fn,M6 as Ft,V$ as G,le as Gn,_E as Gt,_1 as H,me as Hn,hA as Ht,s1 as I,gn as In,B8 as It,Z1 as J,zh as Jt,r8 as K,re as Kn,iE as Kt,o6 as L,vn as Ln,$$ as Lt,f1 as M,yn as Mn,$0 as Mt,O1 as N,mn as Nn,W1 as Nt,h1 as O,sr as On,L8 as Ot,A1 as P,fn as Pn,N6 as Pt,s8 as Q,og as Qt,B1 as R,bn as Rn,X1 as Rt,h6 as S,vi as Sn,D2 as St,o1 as T,Dr as Tn,O2 as Tt,K1 as U,pe as Un,JE as Ut,p1 as V,_n as Vn,NN as Vt,Y1 as W,de as Wn,WE as Wt,e0 as X,jm as Xt,Q1 as Y,wh as Yt,V8 as Z,lg as Zt,p8 as _,jo as _n,Q0 as _t,u5 as a,Jh as an,y2 as at,g6 as b,la as bn,w2 as bt,o5 as c,Pm as cn,q1 as ct,X8 as d,Ed as dn,_8 as dt,em as en,z8 as et,Y8 as f,Io as fn,X3 as ft,f8 as g,M as gn,r1 as gt,H8 as h,$o as hn,G1 as ht,S5 as i,Mm as in,l8 as it,X0 as j,Hn as jn,i6 as jt,t1 as k,or as kn,X$ as kt,Z8 as l,ag as ln,F8 as lt,U8 as m,Xo as mn,e1 as mt,E5 as n,dm as nn,t0 as nt,d5 as o,Yf as on,S8 as ot,G8 as p,P as pn,M8 as pt,n0 as q,ne as qn,z as qt,v5 as r,fm as rn,g8 as rt,i5 as s,$p as sn,n1 as st,T5 as t,lm as tn,h8 as tt,Q8 as u,Cd as un,y6 as ut,m1 as v,N as vn,Z$ as vt,a1 as w,Or as wn,C2 as wt,m6 as x,A as xn,T2 as xt,p6 as y,Da as yn,y8 as yt,i1 as z,pn as zn,C1 as zt};
|
|
393
|
+
`;return l.join(f)},mdxJsxFlowElement(e,t,n,r){let i=e,a=i.data?.sourceRaw;if(typeof a==`string`)return a;let o=i.data?.htmlBoundary;if(o&&typeof o.opener==`string`&&typeof o.closer==`string`){let e=n.containerFlow({type:`root`,children:i.children??[]},r);return`${o.opener}\n\n${e}\n\n${o.closer}`}let s=i.name??``,c=A3(i.attributes??[]);if(!i.children||i.children.length===0)return s?c?`<${s} ${c} />`:`<${s} />`:``;let l=c?`<${s} ${c}>`:`<${s}>`,u=`</${s}>`;return`${l}\n\n${n.containerFlow({type:`root`,children:i.children},r)}\n\n${u}`},mdxJsxTextElement(e){let t=e.data?.sourceRaw;return typeof t==`string`?t:`<${e.name??``}/>`},rawMdxFallback(e){return e.value??``}};function A3(e){let t=[];for(let n of e){if(n.type===`mdxJsxExpressionAttribute`){t.push(`{${n.value}}`);continue}let e=n.name;if(n.value===null||n.value===void 0){t.push(e);continue}if(typeof n.value==`string`){if(n.value.includes(`"`)){let r=n.value.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`);t.push(`${e}={"${r}"}`)}else t.push(`${e}="${n.value}"`);continue}t.push(`${e}={${n.value.value}}`)}return t.join(` `)}function j3(e){if(!e)return``;let t=0,n=!0;for(let r of e)r===`(`?t++:r===`)`&&(t--,t<0&&(n=!1));return t!==0&&(n=!1),n?e:e.replace(/[\\()]/g,`\\$&`)}function M3(e){return e.replace(/(?<!\\)&(?=[A-Za-z][A-Za-z0-9]*;|#[0-9]+;|#[xX][0-9A-Fa-f]+;)/g,`\\&`)}function N3(e,t,n){let r=e.unsafe;e.unsafe=r.filter(e=>!(e.character===`&`&&e.after===`[#A-Za-z]`||e.character===`<`||e.character===`[`||e.character===`(`));let i;try{i=e.safe(t,n)}finally{e.unsafe=r}return M3(i)}var P3=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};constructor(e){this.schema=lm(e.extensions),this.handlers=U3(this.schema,this.parseCtx);let{nodeHandlers:t,markHandlers:n}=W3(this.schema);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=w3({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=T3({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers,toMarkdownHandlers:k3})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return E3(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?D3(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?L2(e,{parse:e=>this.parse(e,t)}):{type:`doc`,content:[{type:`paragraph`,content:[]}]}}serialize(e){let t;try{t=this.schema.nodeFromJSON(e)}catch(t){let n=`MarkdownManager.serialize() failed: schema rejected JSONContent (type=${e.type}, childCount=${e.content?.length??0})`;throw Error(n,{cause:t})}return O3(t,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}},F3=y2();function I3(e,t){let n=new Map;for(let e of t)n.set(e.name,e);let r={};for(let t of e){if(t.type===`mdxJsxExpressionAttribute`)continue;let e=t.name,i=n.get(e);if(t.value===null||t.value===void 0){r[e]=!0;continue}if(typeof t.value==`string`){if(i?.type===`number`){let n=Number(t.value);r[e]=Number.isNaN(n)?t.value:n}else i?.type===`boolean`?r[e]=t.value===`true`:r[e]=t.value;continue}let a=t.value.value;try{r[e]=JSON.parse(a)}catch{r[e]=a}}return r}function L3(e){let t=!1;return e.descendants(e=>t||e.type.name===`jsxInline`?!1:e.type.name===`jsxComponent`&&e.attrs.sourceDirty?(t=!0,!1):!0),t}function R3(e){return e.attrs.sourceDirty||L3(e)}function z3(e){if(e.type!==`paragraph`)return!1;let t=e.children??[];return t.length===0?!0:t.every(e=>e.type===`text`&&e.value===``)}function B3(e){if(e.length===0)return{type:`inlineCode`,value:``};if(e.every(e=>e.type===`text`))return{type:`inlineCode`,value:e.map(e=>e.value).join(``)};if(e.length===1&&`children`in e[0]){let t=e[0];return{...t,children:[B3(t.children)]}}return{type:`inlineCode`,value:V3(e)}}function V3(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=V3(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}var H3=f1;function U3(e,t){let n=e.nodes,r=e.marks,i={};n.paragraph&&(i.paragraph=(e,t,r)=>{let i=r.all(e).flat(),a=i.some(e=>e?.isBlock&&!e?.isInline),o=i.some(e=>e?.isInline||e?.isText||e?.isTextblock);if(a&&!o)return i.length===1?i[0]:i;if(a&&o){let e=i.filter(e=>!e?.isBlock||e?.isInline),t=i.filter(e=>e?.isBlock&&!e?.isInline),r=[],a=n.paragraph.createAndFill(null,e.length>0?e:null);return a&&r.push(a),r.push(...t),r.length===1?r[0]:r}return n.paragraph.createAndFill(null,i.length>0?i:null)}),n.blockquote&&(i.blockquote=GJ(n.blockquote)),n.table&&(i.table=GJ(n.table)),n.tableRow&&(i.tableRow=GJ(n.tableRow)),n.tableCell&&(i.tableCell=(e=>(t,r,i)=>{let a=i.all(t).flat();if(a.length>0&&n.paragraph){let t=n.paragraph.create(null,a);return e.createAndFill(null,[t])}return e.createAndFill(null,null)})(n.tableCell),n.tableHeader),n.image&&(i.image=e=>n.image.createAndFill({src:e.url??``,alt:e.alt??null,title:e.title??null}),i.imageReference=e=>n.image.createAndFill({src:``,alt:e.alt??null,title:null})),r.escapeMark&&(i.text=t=>{let n=t.value??``,i=typeof t.data?.sourceRaw==`string`?t.data.sourceRaw:null;if(!n&&!i)return null;if(i){let t=n.replaceAll(`\xA0`,` `);return r.sourceLiteral?e.text(t,[r.sourceLiteral.create({sourceRaw:i})]):e.text(t)}let a=t.data?.escapedChars;if(!a?.length)return e.text(n.replaceAll(`\xA0`,` `));let o=[],s=0;for(let{offset:t}of a){if(t>s){let r=n.slice(s,t).replaceAll(`\xA0`,` `);r&&o.push(e.text(r))}if(t<n.length){let i=n[t].replaceAll(`\xA0`,` `);o.push(e.text(i,[r.escapeMark.create()])),s=t+1}}if(s<n.length){let t=n.slice(s).replaceAll(`\xA0`,` `);t&&o.push(e.text(t))}return o.length===1?o[0]:o}),r.code&&(i.inlineCode=t=>e.text(t.value,[r.code.create()]));let a=r.strike??r.delete;if(a&&(i.delete=KJ(a)),r.emphasis&&(i.emphasis=KJ(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=KJ(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=GJ(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`}))),n.codeBlock&&(i.code=t=>{let r=t.value?[e.text(t.value)]:[];return n.codeBlock.createAndFill({language:t.lang??null,meta:t.meta??null,fenceDelimiter:t.data?.sourceFenceChar??"`",fenceLength:t.data?.sourceFenceLength??3},r)}),n.thematicBreak&&(i.thematicBreak=e=>n.thematicBreak.createAndFill({sourceRaw:e.data?.sourceRaw??`---`})),n.hardBreak&&(i.break=e=>n.hardBreak.createAndFill({hardBreakStyle:e.data?.sourceStyle??`spaces`})),n.list&&(i.list=GJ(n.list,e=>({ordered:!!e.ordered,start:e.start??1,spread:!!e.spread,bulletMarker:e.data?.bulletMarker??null,listMarkerDelimiter:e.data?.listMarkerDelimiter??null}))),n.listItem&&(i.listItem=GJ(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread}))),r.link){let t=r.sourceLiteral;i.link=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[](${n.url??``})`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:n.url??``,title:n.title??null,linkStyle:n.data?.sourceStyle??`inline`,refLabel:null});return o.map(e=>e.mark(s.addToSet(e.marks)))},i.linkReference=(n,i,a)=>{if((n.children??[]).length===0){let r=typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:`[${n.label??``}][${n.identifier??``}]`;return r?t?e.text(r,[t.create({sourceRaw:r})]):e.text(r):null}let o=a.all(n).flat(),s=r.link.create({href:``,title:null,linkStyle:n.referenceType??`shortcut`,refLabel:n.label??n.identifier??null});return o.map(e=>e.mark(s.addToSet(e.marks)))}}n.htmlBlock&&(i.html=e=>n.htmlBlock.createAndFill({content:e.value??``}));let o=n.linkDefinition??n.linkRefDef;if(o){let e=!!o.spec.attrs?.url,t=!!o.spec.attrs?.href,n=!!o.spec.attrs?.identifier;i.definition=r=>{let i={title:r.title??null};return n&&(i.identifier=r.identifier??``),i.label=r.label??r.identifier??``,e?i.url=r.url??``:t&&(i.href=r.url??``),o.createAndFill(i)}}if(n.jsxComponent){let t=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,r,i)=>{let a=e.name??``,o=F3.getOrWildcard(a),s=I3(e.attributes,o.props),c=i.all(e).flat();return n.jsxComponent.createAndFill({componentName:a,kind:`element`,attributes:e.attributes,sourceRaw:t(e.data)??``,sourceDirty:!1,props:s},c.length?c:void 0)},n.jsxInline?i.mdxJsxTextElement=r=>{let i=t(r.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}:i.mdxJsxTextElement=e=>n.jsxComponent.createAndFill({sourceRaw:t(e.data)??``}),i.mdxFlowExpression=e=>{let r=t(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:r,sourceDirty:!1})},i.mdxTextExpression=n=>{let r=t(n.data)??`{${n.value??``}}`;return e.text(r)}}n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=q1(o),{resolveEmbed:u,sourcePath:d}=t.current,f=u&&d?u(o,d)??null:null,p=f?`/${f}`:o,m=a?.type===`paragraph`&&Array.isArray(a.children)&&a.children.length===1;if(m&&H3.has(l)&&n.jsxComponent&&F3.has(`WikiEmbedImage`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedImage`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,alt:s??o,target:o,anchor:c,alias:s}});if(m&&p1.has(l)&&n.jsxComponent&&F3.has(`WikiEmbedVideo`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedVideo`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});if(m&&m1.has(l)&&n.jsxComponent&&F3.has(`WikiEmbedAudio`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedAudio`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,title:s??o,target:o,anchor:c,alias:s}});let h=s||(c?`${o}#${c}`:o);if(_1.has(l)&&r.link){let t=r.link.create({href:p,title:null,linkStyle:`inline`,refLabel:null,sourceForm:`wikiembed`,target:o,anchor:c,alias:s});return e.text(h,[t])}if(r.link){let t=r.link.create({href:o,title:null,linkStyle:`inline`,refLabel:null});return e.text(h,[t])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")});let s=t=>{let r=t.value??t.type;return n.rawMdxFallback?(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled block mdast: ${t.type}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled block mdast: ${t.type}`},r?[e.text(r)]:null)):null},c=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),e.text(t.value??t.type));return i.math||=s,i.inlineMath||=c,i.footnoteReference||=c,i.rawMdxFallbackMdast=t=>{if(!n.rawMdxFallback)return null;let r=t.position?{start:t.position.start?.offset??0,end:t.position.end?.offset??0}:{start:0,end:0};return console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.originalType,reason:`Unhandled mdast: ${t.originalType}`})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function W3(e){let t={},n={},r=e.nodes,i=e.marks;if(r.paragraph&&(t.paragraph=ZJ(`paragraph`)),r.blockquote&&(t.blockquote=ZJ(`blockquote`)),r.heading&&(t.heading=ZJ(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle}}))),r.codeBlock&&(t.codeBlock=e=>({type:`code`,lang:e.attrs.language??null,meta:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength}})),r.thematicBreak&&(t.thematicBreak=e=>({type:`thematicBreak`,data:{sourceRaw:e.attrs.sourceRaw}})),r.hardBreak&&(t.hardBreak=e=>({type:`break`,data:{sourceStyle:e.attrs.hardBreakStyle}})),r.list&&(t.list=ZJ(`list`,e=>({ordered:e.attrs.ordered??!1,start:e.attrs.ordered?e.attrs.start??1:null,spread:e.attrs.spread??!1,data:{bulletMarker:e.attrs.bulletMarker,listMarkerDelimiter:e.attrs.listMarkerDelimiter}}))),r.listItem&&(t.listItem=(e,t,n)=>{let r=n.all(e),i=r.length>1&&z3(r[0])?r.slice(1):r;return{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,children:i}}),r.table&&(t.table=ZJ(`table`)),r.tableRow&&(t.tableRow=ZJ(`tableRow`)),r.tableCell&&(t.tableCell=ZJ(`tableCell`)),r.tableHeader&&(t.tableHeader=ZJ(`tableCell`)),r.image&&(t.image=e=>({type:`image`,url:e.attrs.src,alt:e.attrs.alt,title:e.attrs.title})),r.htmlBlock&&(t.htmlBlock=e=>({type:`html`,value:e.attrs.content})),r.linkDefinition??r.linkRefDef){let e=r.linkDefinition?`linkDefinition`:`linkRefDef`;t[e]=e=>({type:`definition`,identifier:e.attrs.identifier??e.attrs.label??``,label:e.attrs.label??e.attrs.identifier??``,url:e.attrs.url??e.attrs.href??``,title:e.attrs.title})}if(r.jsxComponent&&(t.jsxComponent=(e,t,n)=>{if(e.attrs.kind===`expression`)return{type:`html`,value:e.attrs.sourceRaw??``};let r=e.attrs.componentName||null,i=Array.isArray(e.attrs.attributes)?e.attrs.attributes:[];return!R3(e)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:r,attributes:i,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:F3.getOrWildcard(r??`*`).serialize(e,{all:e=>n.all(e),registry:F3,serializeChildren:()=>{throw Error(`SerializeContext.serializeChildren is not available in the PM→mdast handler. Compat descriptors that need markdown-byte body rendering must emit a marker mdast node and let the to-markdown handler render the body via state.containerFlow.`)}})}),r.rawMdxFallback&&(t.rawMdxFallback=e=>{let t=e.textContent??``,n=typeof e.attrs.reason==`string`?e.attrs.reason:``,r=e.attrs.originalSpan;return{type:`rawMdxFallback`,value:t,data:{reason:n,originalSpan:r&&typeof r==`object`&&`start`in r&&`end`in r?{start:Number(r.start)||0,end:Number(r.end)||0}:{start:0,end:0}}}}),r.jsxInline&&(t.jsxInline=e=>{let t=e.attrs.sourceRaw||e.textContent||``;return{type:`mdxJsxTextElement`,name:null,attributes:[],children:[],data:{sourceRaw:String(t)}}}),r.wikiLink&&(t.wikiLink=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLink`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),r.wikiLinkEmbed&&(t.wikiLinkEmbed=e=>{let t=e.attrs.target??``,n=e.attrs.anchor??null,r=e.attrs.alias??null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}),i.emphasis&&(n.emphasis=QJ(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.strong&&(n.strong=QJ(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.code&&(n.code=(e,t,n)=>B3(n)),i.strike??i.delete){let e=i.strike?`strike`:`delete`;n[e]=QJ(`delete`)}return i.link&&(n.link=(e,t,n)=>{if(e.attrs.sourceForm===`wikiembed`){let t=typeof e.attrs.target==`string`&&e.attrs.target.length>0?e.attrs.target:e.attrs.href??``,n=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,r=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,i=r||(n?`${t}#${n}`:t);return{type:`wikiLinkEmbed`,value:i,data:{target:t,anchor:n,alias:r},children:[{type:`text`,value:i}]}}let r=e.attrs.linkStyle;return r===`autolink`?{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}}:r===`inline`||!r?{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n}:{type:`linkReference`,identifier:(e.attrs.refLabel??``).toLowerCase(),label:e.attrs.refLabel,referenceType:r,children:n}}),i.escapeMark&&(n.escapeMark=(e,t,n)=>{for(let e of n)if(e.type===`text`&&e.value){let t=e;t.data=t.data??{},t.data.escapedChars=t.data.escapedChars??[];for(let e=0;e<t.value.length;e++)t.data.escapedChars.push({offset:e,char:t.value[e]})}return n.length===1?n[0]:n}),i.sourceLiteral&&(n.sourceLiteral=(e,t,n)=>{let r=typeof e.attrs.sourceRaw==`string`?e.attrs.sourceRaw:``;if(n.length===1&&n[0]?.type===`text`){let e=n[0];return e.data=e.data??{},e.data.sourceRaw=r||e.value,e}return{type:`text`,value:r,data:{sourceRaw:r}}}),{nodeHandlers:t,markHandlers:n}}var G3=/\p{M}+/gu,K3=/[^\p{L}\p{N}]+/gu,q3=/^-+|-+$/g;function J3(e){return e.trim().normalize(`NFKD`).replace(G3,``).toLowerCase().replace(K3,`-`).replace(q3,``)}function Y3(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function X3(e,t){let n=J3(e);return n?Y3(n,t):``}var Z3=new Set([`img`,`video`,`audio`]);function Q3(e){let t=e.name;if(!t||!Z3.has(t))return null;let n={};for(let t of e.attributes){if(t.type!==`mdxJsxAttribute`)return null;let e=t.name.toLowerCase();if(!(e.length>=3&&e.startsWith(`on`)))if(t.value===null)n[t.name]=!0;else if(typeof t.value==`string`)n[t.name]=t.value;else return null}return{type:`element`,tagName:t,properties:n,children:[]}}function $3(e,t){let n=J3(e);return t?`#${n}-${J3(t)}`:`#${n}`}var e6={wikiLink:(e,t)=>{let n=t,{target:r,anchor:i,alias:a}=n.data,o={type:`element`,tagName:`a`,properties:{className:[`wiki-link`],dataTarget:r,dataAnchor:i??``,dataAlias:a??``,href:$3(r,i)},children:n.children.length>0?e.all(n):[{type:`text`,value:n.value}]};return e.patch(t,o),e.applyData(t,o)},wikiLinkEmbed:(e,t)=>{let n=t,{target:r,anchor:i,alias:a}=n.data,o={type:`element`,tagName:`a`,properties:{className:[`wiki-embed`],dataTarget:r,dataAnchor:i??``,dataAlias:a??``,href:$3(r,i)},children:n.children.length>0?e.all(n):[{type:`text`,value:n.value}]};return e.patch(t,o),e.applyData(t,o)},mdxJsxFlowElement:(e,t)=>{let n=t,r=Q3(n);if(r)return e.patch(t,r),e.applyData(t,r);let i={type:`element`,tagName:`pre`,properties:{className:[`mdx-component`]},children:[{type:`element`,tagName:`code`,properties:{},children:[{type:`text`,value:typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:``}]}]};return e.patch(t,i),e.applyData(t,i)},mdxJsxTextElement:(e,t)=>{let n=t,r=Q3(n);if(r)return e.patch(t,r),e.applyData(t,r);let i={type:`element`,tagName:`span`,properties:{className:[`mdx-inline`],dataJsxInline:``},children:[{type:`text`,value:typeof n.data?.sourceRaw==`string`?n.data.sourceRaw:``}]};return e.patch(t,i),e.applyData(t,i)},rawMdxFallback:(e,t)=>{let n=t,r=n.data.reason||`unknown`,i=n.value||``,a=r.replace(/--/g,`—`),o={type:`comment`,value:` Parse error: ${a} `},s={type:`element`,tagName:`pre`,properties:{className:[`mdx-fallback`],dataRawMdxFallback:``,dataReason:a},children:[{type:`element`,tagName:`code`,properties:{},children:[{type:`text`,value:i}]}]};return e.patch(t,s),[o,e.applyData(t,s)]}},t6=[`https`,`http`,`mailto`,`tel`,`ftp`,`sms`],n6=t6.map(e=>`${e}:`).join(`|`),r6=RegExp(`^(?:${n6}|\\/|#|\\?|\\.\\/|\\.\\.\\/)`,`i`);function i6(e){let t=e.trim();return t===``?!0:r6.test(t)}function a6(e){let t=e.trim();if(t===``)return!0;let n=t.indexOf(`:`);if(n===-1)return!0;let r=t.indexOf(`/`),i=t.indexOf(`?`),a=t.indexOf(`#`);return n>Math.min(r===-1?1/0:r,i===-1?1/0:i,a===-1?1/0:a)}var o6=()=>e=>{jB(e,`element`,e=>{let t=e.tagName.toLowerCase(),n=e.properties;if(n){if(t===`a`||t===`area`||t===`link`||t===`base`){let e=n.href;typeof e==`string`&&!i6(e)&&delete n.href}if(t===`img`||t===`iframe`||t===`script`||t===`embed`||t===`source`||t===`audio`||t===`video`||t===`track`){let e=n.src;typeof e==`string`&&!i6(e)&&delete n.src}if(t===`form`){let e=n.action;typeof e==`string`&&!i6(e)&&delete n.action}}})};function s6(e){let t=SJ().use(cX).use(yY,[`yaml`]).use(t3).use(pJ).use(S3).use(P$,{handlers:e6}).use(o6).use(qQ);return String(t.processSync(e))}var c6=iE({ok:_E(!0),serverInstanceId:z().min(1),currentBranch:z().min(1).optional(),currentDiskAckSVs:pE(z().min(1),z().min(1)).optional()}).loose(),l6=iE({id:z().min(1),display_name:z().min(1),display_email:z(),source:hE([`git-config`,`synthesized`]),created_at:z().min(1)}).loose(),u6=`server-info`,d6=`branch-switched`,f6=`disk-ack`,p6=`config-validation-rejected`,m6=hE([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`]),h6=iE({v:_E(1),ch:_E(u6),seq:WT(),serverInstanceId:z().min(1),currentBranch:z().min(1).optional()}).loose(),g6=iE({v:_E(1),ch:_E(d6),seq:WT(),branch:z().min(1)}).loose(),_6=iE({v:_E(1),ch:m6,seq:WT()}).loose(),v6=iE({v:_E(1),ch:_E(f6),seq:WT(),docName:z().min(1),sv:z().min(1)}).loose(),y6=iE({v:_E(1),ch:_E(p6),seq:WT(),docName:z().min(1),error:Y$}).loose();new F$.default,new F$.default;var b6=iE({path:nE(sE([z(),WT()])),message:z(),issueCode:z()});lE(`code`,[iE({code:_E(`SCHEMA_INVALID`),issues:nE(b6)}),iE({code:_E(`WRITE_ERROR`),detail:z()})]);function x6(e){return{path:e.path.map(e=>typeof e==`symbol`?String(e):e),message:e.message,issueCode:e.code}}function S6(e){if(e.code!==`SCHEMA_INVALID`)return{};let t={};for(let n of e.issues){let e=n.path[0];typeof e==`string`&&(t[e]=t[e]?`${t[e]}; ${n.message}`:n.message)}return t}hE([`text`,`number`,`boolean`,`date`,`list`]);var C6=sE([z(),WT(),JT(),nE(z())]),w6=/^\d{4}-\d{2}-\d{2}$/;function T6(e){return typeof e==`string`&&w6.test(e)}function E6(e){return Array.isArray(e)?`list`:typeof e==`boolean`?`boolean`:typeof e==`number`?`number`:T6(e)?`date`:`text`}var D6=pE(z(),C6),O6=pE(z(),sE([C6,XT()])),k6={defaultKeyType:`PLAIN`,defaultStringType:`PLAIN`,lineWidth:0};function A6(e){return e===``?``:`---\n${e.endsWith(`
|
|
394
|
+
`)?e.slice(0,-1):e}\n---\n`}var j6=65536;function M6(e){let t=e.match(S1);return t?{fenced:t[0],body:e.slice(t[0].length)}:{fenced:``,body:e}}function N6(e){if(e.trim()===``)return{doc:new Uv({}),map:{}};let t;try{t=$y(e,{uniqueKeys:!1})}catch(e){let t=e instanceof Error?e.message:String(e);return{doc:new Uv({}),map:null,parseError:`parse threw: ${t}`}}if(t.errors.length>0)return{doc:t,map:null,parseError:t.errors[0]?.message??`yaml parse errors`};let n;try{n=t.toJS()}catch(e){let n=e instanceof Error?e.message:String(e);return{doc:t,map:null,parseError:`toJS threw: ${n}`}}if(typeof n!=`object`||!n||Array.isArray(n))return{doc:t,map:null,parseError:`top-level value is not a mapping`};let r=D6.safeParse(n);if(!r.success){let e=r.error.issues[0],n=e&&Array.isArray(e.path)?e.path.join(`.`):``,i=e?.message??`unknown`;return{doc:t,map:null,parseError:n?`value at "${n}" failed schema: ${i}`:`schema validation failed: ${i}`}}return{doc:t,map:r.data}}function P6(e){return e===``?{doc:new Uv({}),map:{}}:N6(w1(e))}function F6(e){let{fenced:t}=M6(e),{map:n,parseError:r}=P6(t);return{map:n??{},parseError:r}}function I6(e){let{fenced:t}=M6(e);if(t===``)return[];let{doc:n,map:r}=P6(t);return r===null?[]:B6(n)}function L6(e){return typeof e==`object`&&!!e&&`key`in e}function R6(e){let t=e.key;return typeof t==`string`?t:t&&typeof t==`object`&&`value`in t&&typeof t.value==`string`?t.value:null}function z6(e,t){let n=e.key;if(typeof n==`string`){e.key=t;return}if(n&&typeof n==`object`){n.value=t;return}e.key=t}function B6(e){let t=e.contents;if(!t||!(`items`in t)||!Array.isArray(t.items))return[];let n=[];for(let e of t.items){if(!L6(e))continue;let t=R6(e);t!==null&&n.push(t)}return n}var V6=`frontmatter`;function H6(e){if(e.contents==null||!(`items`in e.contents)){let t=e.createNode({});return e.contents=t,t}return e.contents}function U6(e){let t=e.contents;return!t||!(`items`in t)||(t.items?.length??0)===0?``:A6(e.toString(k6))}function W6(e){let t=new TextEncoder().encode(e).byteLength;return t>65536?{kind:`region_too_large`,bytes:t,limit:j6}:null}function G6(e,t){if(Object.hasOwn(t,V6))return{ok:!1,error:{kind:`reserved_key`,key:V6}};let{doc:n,map:r}=P6(e);if(r===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};try{H6(n);for(let[e,r]of Object.entries(t)){if(r===null){n.delete(e);continue}let t=C6.safeParse(r);if(!t.success)return{ok:!1,error:{kind:`invalid_value`,key:e,reason:t.error.issues[0]?.message??`invalid value`}};n.set(e,t.data)}let e=U6(n),r=W6(e);return r?{ok:!1,error:r}:{ok:!0,nextFenced:e}}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function K6(e,t,n,r={}){if(t===V6||n===V6)return{ok:!1,error:{kind:`reserved_key`,key:V6}};let{doc:i,map:a}=P6(e);if(a===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};if(t===n)return{ok:!0,nextFenced:e};let o=i.contents;if(!o||!(`items`in o)||!Array.isArray(o.items))return{ok:!1,error:{kind:`unknown_key`,key:t}};let s=o.items.find(e=>L6(e)&&R6(e)===t);if(!s)return{ok:!1,error:{kind:`unknown_key`,key:t}};if(!r.allowDuplicate&&o.items.some(e=>L6(e)&&e!==s&&R6(e)===n))return{ok:!1,error:{kind:`duplicate_target`,key:n}};try{z6(s,n);let e=U6(i),t=W6(e);return t?{ok:!1,error:t}:{ok:!0,nextFenced:e}}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function q6(e,t){let{doc:n,map:r}=P6(e);if(r===null)return{ok:!1,error:{kind:`parse_failed`,reason:`fm region unparseable`}};let i=n.contents;if(!i||!(`items`in i)||!Array.isArray(i.items))return{ok:!0,nextFenced:e};let a=B6(n);if(a.length!==t.length||!J6(a,t))return{ok:!1,error:{kind:`reorder_mismatch`,expected:a,got:[...t]}};try{let e=i.items.filter(L6),r=[];for(let n of t){let i=e.findIndex(e=>R6(e)===n);if(i===-1)return{ok:!1,error:{kind:`reorder_mismatch`,expected:a,got:[...t]}};let[o]=e.splice(i,1);o&&r.push(o)}i.items=r;let o=U6(n),s=W6(o);return s?{ok:!1,error:s}:{ok:!0,nextFenced:o}}catch(e){return{ok:!1,error:{kind:`parse_failed`,reason:`yaml@2 threw: ${e instanceof Error?e.message:String(e)}`}}}}function J6(e,t){let n=new Map;for(let t of e)n.set(t,(n.get(t)??0)+1);for(let e of t){let t=(n.get(e)??0)-1;if(t<0)return!1;n.set(e,t)}for(let e of n.values())if(e!==0)return!1;return!0}var Y6=Object.freeze({source:`local`,skipStoreHooks:!1,context:Object.freeze({origin:`form-write`})}),X6=`frontmatter`;function Z6(e){return{ok:!1,error:e}}function Q6(e){return{ok:!0,...e}}function $6(e){return{ok:!0,...e}}function e8(e){return{ok:!0,...e}}function t8(e){switch(e.kind){case`unknown_key`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:`unknown key '${e.key}'`,issueCode:`unknown_key`}]};case`duplicate_target`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:`key '${e.key}' already exists`,issueCode:`duplicate_target`}]};case`invalid_value`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:e.reason,issueCode:`invalid_value`}]};case`reserved_key`:return{code:`SCHEMA_INVALID`,issues:[{path:[e.key],message:`'${e.key}' is a reserved frontmatter key`,issueCode:`reserved_key`}]};case`reorder_mismatch`:return{code:`WRITE_ERROR`,detail:`reorder list does not match current keys (state changed mid-drag)`};case`region_too_large`:return{code:`SCHEMA_INVALID`,issues:[{path:[],message:`Frontmatter region exceeds ${j6}-byte limit (would be ${e.bytes})`,issueCode:`region_too_large`}]};case`parse_failed`:return{code:`WRITE_ERROR`,detail:`Frontmatter YAML is malformed; fix in source mode to commit (${e.reason})`}}}function n8(e,t){if(e.parseError!==t.parseError||e.keys.length!==t.keys.length)return!1;for(let n=0;n<e.keys.length;n++)if(e.keys[n]!==t.keys[n])return!1;for(let n of e.keys)if(!r8(e.map[n],t.map[n]))return!1;return!0}function r8(e,t){if(e===t)return!0;if(Array.isArray(e)&&Array.isArray(t)){if(e.length!==t.length)return!1;for(let n=0;n<e.length;n++)if(e[n]!==t[n])return!1;return!0}return!1}function i8(e){let t=e.toString();return{snapshot:a8(t),raw:t}}function a8(e){let{map:t,parseError:n}=F6(e);return{map:t,keys:I6(e),parseError:n}}function o8(e){let t=e.document,n=t.getText(`source`),r=new Set,i=i8(n),a=i.snapshot,o=M6(i.raw).fenced,s=!1;function c(e=!1){if(s)return;let t,i;try{let e=i8(n);t=e.snapshot,i=e.raw}catch(e){console.warn(`[bindFrontmatterDoc] readSnapshotFromYText threw:`,e);return}if(!(!e&&n8(a,t))){a=t,o=M6(i).fenced;for(let e of r)try{e(t)}catch(e){console.warn(`[bindFrontmatterDoc] listener threw:`,e)}}}let l=e=>{s||s8(e,o.length)&&c()};n.observe(l),e.on(`synced`,u);function u(){c(!0)}function d(e){let r;return t.transact(()=>{let{fenced:t}=M6(n.toString());r=e(t),r.ok&&r.nextFenced!==t&&(n.delete(0,t.length),r.nextFenced!==``&&n.insert(0,r.nextFenced))},Y6),r??{ok:!1,error:{kind:`parse_failed`,reason:`commit transact produced no result`}}}function f(e){if(s)return Z6({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});if(Object.hasOwn(e,X6))return Z6({code:`SCHEMA_INVALID`,issues:[{path:[X6],message:`'${X6}' is a reserved frontmatter key`,issueCode:`reserved_key`}]});let t=O6.safeParse(e);if(!t.success)return Z6({code:`SCHEMA_INVALID`,issues:t.error.issues.map(x6)});let n=t.data,r=Object.keys(n),i=d(e=>G6(e,n));return i.ok?Q6({appliedKeys:r}):Z6(t8(i.error))}function p(e,t,n={}){if(s)return Z6({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let r=d(r=>K6(r,e,t,n));return r.ok?$6({oldKey:e,newKey:t}):Z6(t8(r.error))}function m(e){if(s)return Z6({code:`WRITE_ERROR`,detail:`FrontmatterBinding has been disposed`});let t=d(t=>q6(t,e));return t.ok?e8({orderedKeys:[...e]}):Z6(t8(t.error))}return{current(){return i8(n).snapshot},patch(e){return f(e)},rename(e,t,n){return p(e,t,n)},reorder(e){return m(e)},subscribe(e){return r.add(e),()=>{r.delete(e)}},dispose(){s||(s=!0,n.unobserve(l),e.off(`synced`,u),r.clear())}}}function s8(e,t){if(t===0)return!0;let n=0;for(let r of e.delta){if(typeof r.retain==`number`){n+=r.retain;continue}if(typeof r.insert==`string`){if(n<t)return!0;n+=r.insert.length;continue}if(r.insert!==void 0){if(n<t)return!0;n+=1;continue}if(typeof r.delete==`number`&&n<t)return!0}return!1}var c8=new F$.default;c8.Match_Threshold=.5;var l8=class extends Error{chunksCompleted;totalChunks;bytesWritten;bytesRemaining;cause;constructor(e,t){let n=e instanceof Error?e.message:typeof e==`string`?e:`unknown error`;super(`chunked insert failed after ${t.chunksCompleted}/${t.totalChunks} chunks (${t.bytesWritten} bytes written, ${t.bytesRemaining} bytes lost): ${n}`),this.name=`ChunkedInsertError`,this.chunksCompleted=t.chunksCompleted,this.totalChunks=t.totalChunks,this.bytesWritten=t.bytesWritten,this.bytesRemaining=t.bytesRemaining,this.cause=e}};async function u8(e,t,n,r,i={}){let a=i.thresholdBytes??512e3,o=i.chunkSizeBytes??51200,s=i.origin,c=i.yieldFn??d8,l=i.resolveOffset??(e=>e);if(r.length<=a){e.transact(()=>{t.insert(n,r)},s);return}let u=Math.ceil(r.length/o),d=0,f=n,p=0,m=0;for(;d<r.length;){let n=Math.min(d+o,r.length),i=r.slice(d,n);try{let n=l(f);e.transact(()=>{t.insert(n,i)},s)}catch(e){throw new l8(e,{chunksCompleted:p,totalChunks:u,bytesWritten:m,bytesRemaining:r.length-d})}p++,m+=i.length,f+=i.length,d=n,d<r.length&&await c()}}function d8(){return new Promise(e=>{let t=globalThis;t.document?.hidden!==!0&&typeof t.requestAnimationFrame==`function`?t.requestAnimationFrame(()=>e()):setTimeout(()=>e(),0)})}function f8(){let e=!1,t=``,n=0;return r=>{let i=p8(r);return e?(i&&i.char===t&&i.len>=n&&!i.hasInfo&&(e=!1,t=``,n=0),!0):i?(e=!0,t=i.char,n=i.len,!0):!1}}function p8(e){let t=(e.endsWith(`\r`)?e.slice(0,-1):e).match(/^ {0,3}([`~])(\1{2,})(.*)$/);return t?{char:t[1],len:1+t[2].length,hasInfo:t[3].trim()!==``}:null}var m8=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],h8={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`},g8={cursor:`#FFFFFF`,windsurf:`#FFFFFF`},_8=[`#f0ece3`,`#fff5e1`,`#f9e1db`,`#f5def7`,`#ece2fb`,`#dce8fa`,`#DBF3FB`];function v8(e,t=m8){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}function y8(e){let t=e.trim();if(!t)return`?`;let n=t.split(/[-\s]+/).filter(Boolean);if(!n.length)return`?`;if(n.length>=2)return n.slice(0,2).map(e=>e[0]??``).join(``).toUpperCase();let r=n[0],i=[r[0]];for(let e=1;e<r.length&&i.length<2;e++){let t=r[e-1],n=r[e];t===t.toLowerCase()&&n===n.toUpperCase()&&n!==n.toLowerCase()&&i.push(n)}return i.length>=2?i.join(``).toUpperCase():r.slice(0,2).toUpperCase()}function b8(e){let t=e.trim();if(!t)return e;if(t.includes(` `)||!/[-_]/.test(t))return t;let n=t.split(/[-_]+/).filter(Boolean);return n.length?n.map(e=>e.charAt(0).toUpperCase()+e.slice(1).toLowerCase()).join(` `):t}var x8={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,copilot:`github`,cline:`cline`};function S8(e){return e?x8[e]??`bot`:`bot`}function C8(e){let t=parseInt(e.slice(1,3),16)/255,n=parseInt(e.slice(3,5),16)/255,r=parseInt(e.slice(5,7),16)/255,i=Math.max(t,n,r),a=Math.min(t,n,r),o=(i+a)/2;if(i===a)return[0,0,o*100];let s=i-a,c=o>.5?s/(2-i-a):s/(i+a),l;return l=i===t?((n-r)/s+(n<r?6:0))/6:i===n?((r-t)/s+2)/6:((t-n)/s+4)/6,[l*360,c*100,o*100]}function w8(e,t,n){let r=t/100,i=n/100,a=r*Math.min(i,1-i),o=t=>{let n=(t+e/30)%12,r=i-a*Math.max(Math.min(n-3,9-n,1),-1);return Math.round(255*r).toString(16).padStart(2,`0`)};return`#${o(0)}${o(8)}${o(4)}`}function T8(e){let[t]=C8(e);return w8(t,45,32)}var E8=[`Curious`,`Brave`,`Clever`,`Swift`,`Gentle`,`Bright`,`Wise`,`Bold`,`Calm`,`Keen`],D8=[`Bird`,`Cat`,`Dog`,`Fish`,`Mouse`,`Rabbit`,`Shrimp`,`Snail`,`Squirrel`,`Turtle`],O8=`ok-user-name-v3`,k8=`ok-user-color-v3`;function A8(e){return e[Math.floor(Math.random()*e.length)]}function j8(){return`${A8(E8)} ${A8(D8)}`}function M8(){return A8(_8)}function N8(e){try{return localStorage.getItem(e)}catch{return null}}function P8(e,t){try{localStorage.setItem(e,t)}catch{}}function F8(){let e=new URLSearchParams(window.location.search).get(`coeditor`)||`standalone`,t=crypto.randomUUID(),n=N8(O8),r=N8(k8);return n||(n=j8(),P8(O8,n)),r||(r=M8(),P8(k8,r)),{name:n,color:r,coeditor:e,tabId:t}}function I8(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||n.startsWith(`//`)||n.startsWith(`/`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=r>=0?n.slice(0,r):n,a=r>=0?n.slice(r+1):null,o=(i.split(`?`)[0]??``).trim();if(!o)return null;let s=(o.split(`/`).pop()??``).match(/\.([a-z0-9]+)$/i);if(s){let e=(s[1]??``).toLowerCase();if(e!==`md`&&e!==`mdx`)return null}let c=o.toLowerCase(),l=c.endsWith(`.mdx`)?o.slice(0,-4):c.endsWith(`.md`)?o.slice(0,-3):o,u=t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of l.split(`/`))if(e===`..`){if(u.length===0)return null;u.pop()}else e!==`.`&&e!==``&&u.push(e);return u.length===0?null:{docName:u.join(`/`),anchor:a||null}}var L8=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function R8(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function z8(e){return e.split(`/`).filter(Boolean)}function B8(e){let t=e.trim();return L8.test(t)||t.startsWith(`//`)}function V8(e,t){let n=e.trim();if(!n)return null;if(n.startsWith(`#`)){let e=n.slice(1).trim();return e?{kind:`anchor`,anchor:e}:null}let r=I8(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};if(B8(n)||n.startsWith(`/`))return{kind:`external`,url:n};let i=R8(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function H8(e,t){let n=e.trim();return n?B8(n)?{kind:`external`,url:t?`${n}#${t}`:n}:{kind:`doc`,docName:n,anchor:t?.trim()||null}:null}function U8(e,t){let n=e.trim();if(!n||L8.test(n)||n.startsWith(`//`)||n.startsWith(`#`))return null;let r=n.indexOf(`#`),i=((r>=0?n.slice(0,r):n).split(`?`)[0]??``).trim();if(!i)return null;let a=i.startsWith(`/`),o=a?i.slice(1):i,s=a?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of o.split(`/`))if(e===`..`){if(s.length===0)return null;s.pop()}else e!==`.`&&e!==``&&s.push(e);return s.length===0?null:s.join(`/`)}function W8(e,t,n=null){let r=z8(e);r.pop();let i=z8(t),a=0;for(;a<r.length&&a<i.length&&r[a]===i[a];)a+=1;let o=r.slice(a).map(()=>`..`),s=i.slice(a),c=[...o,...s].join(`/`);return c||=i.at(-1)??t,!c.startsWith(`./`)&&!c.startsWith(`../`)&&(c=`./${c}`),`${c}.md${n?`#${n}`:``}`}function G8(e){return e.trim().replace(/^\.\/+/,``).replace(/^\/+/,``).replace(/\.mdx?$/i,``)}function K8(e){let t=G8(e),n=t.lastIndexOf(`/`);return{initialDir:n>0?t.slice(0,n):``,suggestedName:`${n>=0?t.slice(n+1):t||`untitled`}.md`}}function q8(e){if(!e)return[];let t=e.split(`/`).filter(Boolean),n=[];for(let e=1;e<t.length;e++)n.push(t.slice(0,e).join(`/`));return n}function J8(e){if(!e)return``;let t=e.lastIndexOf(`/`);return t>0?e.slice(0,t):``}function Y8(e){return G8(e).replace(/\/+$/g,``)}function X8(e){let t=new Set;for(let n of e)for(let e of q8(n))t.add(e);return t}function Z8(e,t){if(!t)return;let n=J3(e);if(n)return t.get(n)}function Q8(e,t){let n=Y8(e);if(!n)return{kind:`missing`,target:n};if(t.pages.has(n))return{kind:`doc`,target:n,docName:n};let r=Z8(n,t.pagesBySlug);if(r)return{kind:`doc`,target:r,docName:r};let i=`${n}/index`;if(t.pages.has(i))return{kind:`folder-index`,target:n,folderPath:n,docName:i,noteKind:`canonical-index`};let a=n.split(`/`).pop(),o=a?`${n}/${a}`:null;return o&&t.pages.has(o)?{kind:`folder-index`,target:n,folderPath:n,docName:o,noteKind:`legacy-folder-note`}:(t.folderPaths??X8(t.pages)).has(n)?{kind:`folder`,target:n,folderPath:n}:{kind:`missing`,target:n}}function $8(e){switch(e.kind){case`doc`:case`folder-index`:return e.docName;case`missing`:return e.target;case`folder`:return null}}function e5(e){if(!e.startsWith(`#/`))return null;let t=e.slice(2),n=t.indexOf(`?`),r=n>=0?t.slice(0,n):t;if(!r)return null;try{return r.split(`/`).map(decodeURIComponent).join(`/`)}catch{return r}}function t5(e,t){let n=`#/${e}`;return t?`${n}?anchor=${encodeURIComponent(t)}`:n}var n5=null,r5=new Set;function i5(e,t){if(e===t)return!0;if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function a5(e,t){return e===null?!1:e===t?!0:i5(e.pages,t.pages)&&i5(e.folderPaths,t.folderPaths)}function o5(e,t){let n=new Map;for(let r of e){let e=t(r);e&&!n.has(e)&&n.set(e,r)}return n}function s5(){return n5}function c5(e){if(!a5(n5,e)){n5=e;for(let t of[...r5])try{t(e)}catch(e){console.error(`[page-list-cache] subscriber threw:`,e)}}}function l5(e){if(r5.add(e),n5!==null)try{e(n5)}catch(e){console.error(`[page-list-cache] subscriber threw on replay:`,e)}return()=>{r5.delete(e)}}var u5=`open-knowledge:documents-changed`,d5=new Set(m6.options);function f5(e){return e===void 0||!Array.isArray(e)?[`files`]:[...new Set(e.filter(e=>d5.has(e)))]}function p5(e=[`files`]){window.dispatchEvent(new CustomEvent(u5,{detail:{channels:f5(e)}}))}function m5(e){let t=t=>{e(f5(t instanceof CustomEvent?t.detail?.channels:void 0))};return window.addEventListener(u5,t),()=>window.removeEventListener(u5,t)}var h5=(0,C.createContext)(null);function g5(e,t){if(t.size===0)return new Set(e);let n=new Set(e);for(let e of t)n.add(e);return n}function _5(e,t){if(e.size===0)return new Set;let n=new Set;for(let r of e)t.has(r)||n.add(r);return n}function v5(e,t){let n=new Map(e);for(let e of t)n.has(e)||n.set(e,e);return n}async function y5(){let e=await fetch(`/api/pages`);if(!e.ok)throw Error(`/api/pages responded with ${e.status}`);let t=await e.json();return Array.isArray(t.pages)?t.pages:[]}function b5(e){console.error(`[PageListContext] Failed to load pages:`,e)}function x5(e){let t=(0,Sf.c)(36),{children:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=new Set,t[0]=r):r=t[0];let[i,a]=(0,C.useState)(r),o;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(o=new Map,t[1]=o):o=t[1];let[s,c]=(0,C.useState)(o),l;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(l=new Map,t[2]=l):l=t[2];let[u,d]=(0,C.useState)(l),f;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(f=new Set,t[3]=f):f=t[3];let[p,m]=(0,C.useState)(f),[h,g]=(0,C.useState)(!0),[_,v]=(0,C.useState)(null),y=(0,C.useRef)(0),b;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(b=function(){let e=y.current+=1;g(!0),y5().then(t=>{if(e!==y.current)return;let n=new Set(t.map(w5));a(n),c(new Map(t.map(C5))),d(new Map(t.map(S5))),m(e=>_5(e,n)),v(null)}).catch(t=>{e===y.current&&(b5(t),v(t instanceof Error?t.message:`Failed to load pages`))}).finally(()=>{e===y.current&&g(!1)})},t[4]=b):b=t[4];let x=b,S;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(S=function(e){m(t=>{if(t.has(e))return t;let n=new Set(t);return n.add(e),n}),v(null)},t[5]=S):S=t[5];let w=S,T,E;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(T=()=>{x();let e=()=>{document.visibilityState===`visible`&&x()};window.addEventListener(`focus`,e),window.addEventListener(`visibilitychange`,e);let t=m5(e=>{e.includes(`files`)&&x()});return()=>{window.removeEventListener(`focus`,e),window.removeEventListener(`visibilitychange`,e),t()}},E=[],t[6]=T,t[7]=E):(T=t[6],E=t[7]),(0,C.useEffect)(T,E);let ee,D,te,ne,re;if(t[8]!==p||t[9]!==u||t[10]!==s||t[11]!==i){ne=g5(i,p);let e;t[17]!==p||t[18]!==s?(e=v5(s,p),t[17]=p,t[18]=s,t[19]=e):e=t[19],te=e,D=u,ee=X8(ne),re=o5(ne,J3),t[8]=p,t[9]=u,t[10]=s,t[11]=i,t[12]=ee,t[13]=D,t[14]=te,t[15]=ne,t[16]=re}else ee=t[12],D=t[13],te=t[14],ne=t[15],re=t[16];let ie=re,O,ae;t[20]!==ee||t[21]!==ne||t[22]!==ie?(O=()=>{c5({pages:ne,folderPaths:ee,pagesBySlug:ie})},ae=[ne,ee,ie],t[20]=ee,t[21]=ne,t[22]=ie,t[23]=O,t[24]=ae):(O=t[23],ae=t[24]),(0,C.useEffect)(O,ae);let oe;t[25]!==_||t[26]!==ee||t[27]!==h||t[28]!==D||t[29]!==te||t[30]!==ne||t[31]!==ie?(oe={pages:ne,pagesBySlug:ie,pageTitles:te,pageMeta:D,folderPaths:ee,loading:h,error:_,refetch:x,addPage:w},t[25]=_,t[26]=ee,t[27]=h,t[28]=D,t[29]=te,t[30]=ne,t[31]=ie,t[32]=oe):oe=t[32];let se;return t[33]!==n||t[34]!==oe?(se=(0,k.jsx)(h5,{value:oe,children:n}),t[33]=n,t[34]=oe,t[35]=se):se=t[35],se}function S5(e){return[e.docName,{size:e.size,modified:e.modified,docExt:e.docExt}]}function C5(e){return[e.docName,e.title]}function w5(e){return e.docName}function T5(){let e=(0,C.use)(h5);if(!e)throw Error(`usePageList must be used within <PageListProvider />`);return e}var E5=v(`group/toggle inline-flex items-center justify-center gap-1 rounded-lg text-sm font-medium whitespace-nowrap transition-all outline-none hover:bg-muted hover:text-foreground focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-destructive/20 aria-pressed:bg-muted data-[state=on]:bg-muted dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4`,{variants:{variant:{default:`bg-transparent`,outline:`border border-input bg-transparent hover:bg-muted`,segmented:`text-muted-foreground hover:bg-muted-foreground/10 data-[state=on]:bg-background data-[state=on]:shadow-sm data-[state=on]:text-foreground dark:data-[state=on]:bg-muted`},size:{default:`h-8 min-w-8 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`,sm:`h-7 min-w-7 rounded-[min(var(--radius-md),12px)] px-2.5 text-[0.8rem] has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3.5`,lg:`h-9 min-w-9 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2`}},defaultVariants:{variant:`default`,size:`default`}}),D5=C.createContext({size:`default`,variant:`default`,spacing:0,orientation:`horizontal`});function O5(e){let t=(0,Sf.c)(29),n,r,i,a,o,s,c;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5],s=t[6],c=t[7]):({className:r,variant:c,size:a,spacing:o,orientation:s,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o,t[6]=s,t[7]=c);let l=o===void 0?0:o,u=s===void 0?`horizontal`:s,d;t[8]===l?d=t[9]:(d={"--gap":l},t[8]=l,t[9]=d);let f=d,p;t[10]===r?p=t[11]:(p=h(`group/toggle-group flex w-fit flex-row items-center gap-[--spacing(var(--gap))] rounded-lg data-[size=sm]:rounded-[min(var(--radius-md),10px)] data-vertical:flex-col data-vertical:items-stretch`,r),t[10]=r,t[11]=p);let m;t[12]!==u||t[13]!==a||t[14]!==l||t[15]!==c?(m={variant:c,size:a,spacing:l,orientation:u},t[12]=u,t[13]=a,t[14]=l,t[15]=c,t[16]=m):m=t[16];let g;t[17]!==n||t[18]!==m?(g=(0,k.jsx)(D5.Provider,{value:m,children:n}),t[17]=n,t[18]=m,t[19]=g):g=t[19];let _;return t[20]!==u||t[21]!==i||t[22]!==a||t[23]!==l||t[24]!==f||t[25]!==p||t[26]!==g||t[27]!==c?(_=(0,k.jsx)(Kr,{"data-slot":`toggle-group`,"data-variant":c,"data-size":a,"data-spacing":l,"data-orientation":u,style:f,className:p,...i,children:g}),t[20]=u,t[21]=i,t[22]=a,t[23]=l,t[24]=f,t[25]=p,t[26]=g,t[27]=c,t[28]=_):_=t[28],_}function k5(e){let t=(0,Sf.c)(19),n,r,i,a,o;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4],o=t[5]):({className:r,children:n,variant:a,size:o,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=o);let s=a===void 0?`default`:a,c=o===void 0?`default`:o,l=C.use(D5),u=l.variant||s,d=l.size||c,f=l.spacing,p;t[6]!==r||t[7]!==l.size||t[8]!==l.variant||t[9]!==c||t[10]!==s?(p=h(`shrink-0 group-data-[spacing=0]/toggle-group:rounded-none group-data-[spacing=0]/toggle-group:px-2 focus:z-10 focus-visible:z-10 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-end]:pr-1.5 group-data-[spacing=0]/toggle-group:has-data-[icon=inline-start]:pl-1.5 group-data-horizontal/toggle-group:data-[spacing=0]:first:rounded-l-lg group-data-vertical/toggle-group:data-[spacing=0]:first:rounded-t-lg group-data-horizontal/toggle-group:data-[spacing=0]:last:rounded-r-lg group-data-vertical/toggle-group:data-[spacing=0]:last:rounded-b-lg group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:border-l-0 group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:border-t-0 group-data-horizontal/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-l group-data-vertical/toggle-group:data-[spacing=0]:data-[variant=outline]:first:border-t text-muted-foreground data-[state=on]:text-foreground`,E5({variant:l.variant||s,size:l.size||c}),r),t[6]=r,t[7]=l.size,t[8]=l.variant,t[9]=c,t[10]=s,t[11]=p):p=t[11];let m;return t[12]!==n||t[13]!==l.spacing||t[14]!==i||t[15]!==u||t[16]!==d||t[17]!==p?(m=(0,k.jsx)(qr,{"data-slot":`toggle-group-item`,"data-variant":u,"data-size":d,"data-spacing":f,className:p,...i,children:n}),t[12]=n,t[13]=l.spacing,t[14]=i,t[15]=u,t[16]=d,t[17]=p,t[18]=m):m=t[18],m}export{W8 as $,jm as $t,_8 as A,ar as An,B8 as At,r6 as B,vn as Bn,$$ as Bt,h6 as C,la as Cn,T2 as Ct,g1 as D,Or as Dn,O2 as Dt,l8 as E,j as En,C2 as Et,P3 as F,yn as Fn,$0 as Ft,K1 as G,me as Gn,hA as Gt,c6 as H,pn as Hn,C1 as Ht,s1 as I,mn as In,W1 as It,o8 as J,le as Jn,_E as Jt,Y1 as K,pe as Kn,JE as Kt,l6 as L,fn as Ln,I6 as Lt,f1 as M,or as Mn,c1 as Mt,O1 as N,ir as Nn,a6 as Nt,h1 as O,Dr as On,k2 as Ot,A1 as P,Hn as Pn,s6 as Pt,e0 as Q,wh as Qt,B1 as R,Sn as Rn,F6 as Rt,v6 as S,Da as Sn,w2 as St,o1 as T,vi as Tn,E2 as Tt,p1 as U,hn as Un,J3 as Ut,i1 as V,bn as Vn,X1 as Vt,_1 as W,_n as Wn,NN as Wt,Z1 as X,ne as Xn,z as Xt,n0 as Y,re as Yn,iE as Yt,Q1 as Z,zh as Zt,g8 as _,Xo as _n,G1 as _t,p5 as a,dm as an,y8 as at,y6 as b,jo as bn,Z$ as bt,l5 as c,Jh as cn,T8 as ct,$8 as d,Pm as dn,R8 as dt,lg as en,u8 as et,Q8 as f,ag as fn,S6 as ft,h8 as g,P as gn,e1 as gt,G8 as h,Io as hn,F8 as ht,T5 as i,lm as in,t0 as it,X0 as j,sr as jn,X$ as jt,t1 as k,hr as kn,E6 as kt,e5 as l,Yf as ln,n1 as lt,K8 as m,Ed as mn,X3 as mt,k5 as n,qh as nn,H8 as nt,m5 as o,fm as on,f8 as ot,J8 as p,Cd as pn,b8 as pt,V$ as q,de as qn,WE as qt,x5 as r,em as rn,v8 as rt,s5 as s,Mm as sn,y2 as st,O5 as t,og as tn,V8 as tt,t5 as u,$p as un,q1 as ut,m1 as v,$o as vn,r1 as vt,a1 as w,A as wn,D2 as wt,_6 as x,N as xn,S8 as xt,g6 as y,M as yn,Q0 as yt,t6 as z,gn as zn,U8 as zt};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./compiler-runtime-Y11fyRVL.js";import{An as i,
|
|
1
|
+
import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./compiler-runtime-Y11fyRVL.js";import{An as i,Mn as a,Nn as o,Pn as s,jn as c}from"./toggle-group-C5MXNna8.js";import{a as l,b as u,c as d,d as f,i as p,l as m,m as h,p as g,r as _,s as ee,v}from"./button-Dyz7QGIk.js";var y=e(t(),1),b=n(),x=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),S=`VisuallyHidden`,C=y.forwardRef((e,t)=>(0,b.jsx)(h.span,{...e,ref:t,style:{...x,...e.style}}));C.displayName=S;var w=C,[T,E]=g(`Tooltip`,[s]),D=s(),O=`TooltipProvider`,k=700,A=`tooltip.open`,[te,j]=T(O),M=e=>{let{__scopeTooltip:t,delayDuration:n=k,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=y.useRef(!0),s=y.useRef(!1),c=y.useRef(0);return y.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,b.jsx)(te,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:y.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:y.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:y.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};M.displayName=O;var N=`Tooltip`,[P,F]=T(N),I=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:s,delayDuration:c}=e,l=j(N,e.__scopeTooltip),u=D(t),[d,f]=y.useState(null),p=ee(),h=y.useRef(0),g=s??l.disableHoverableContent,_=c??l.delayDuration,v=y.useRef(!1),[x,S]=m({prop:r,defaultProp:i??!1,onChange:e=>{e?(l.onOpen(),document.dispatchEvent(new CustomEvent(A))):l.onClose(),a?.(e)},caller:N}),C=y.useMemo(()=>x?v.current?`delayed-open`:`instant-open`:`closed`,[x]),w=y.useCallback(()=>{window.clearTimeout(h.current),h.current=0,v.current=!1,S(!0)},[S]),T=y.useCallback(()=>{window.clearTimeout(h.current),h.current=0,S(!1)},[S]),E=y.useCallback(()=>{window.clearTimeout(h.current),h.current=window.setTimeout(()=>{v.current=!0,S(!0),h.current=0},_)},[_,S]);return y.useEffect(()=>()=>{h.current&&=(window.clearTimeout(h.current),0)},[]),(0,b.jsx)(o,{...u,children:(0,b.jsx)(P,{scope:t,contentId:p,open:x,stateAttribute:C,trigger:d,onTriggerChange:f,onTriggerEnter:y.useCallback(()=>{l.isOpenDelayedRef.current?E():w()},[l.isOpenDelayedRef,E,w]),onTriggerLeave:y.useCallback(()=>{g?T():(window.clearTimeout(h.current),h.current=0)},[T,g]),onOpen:w,onClose:T,disableHoverableContent:g,children:n})})};I.displayName=N;var L=`TooltipTrigger`,R=y.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,a=F(L,n),o=j(L,n),s=D(n),c=u(t,y.useRef(null),a.onTriggerChange),l=y.useRef(!1),d=y.useRef(!1),p=y.useCallback(()=>l.current=!1,[]);return y.useEffect(()=>()=>document.removeEventListener(`pointerup`,p),[p]),(0,b.jsx)(i,{asChild:!0,...s,children:(0,b.jsx)(h.button,{"aria-describedby":a.open?a.contentId:void 0,"data-state":a.stateAttribute,...r,ref:c,onPointerMove:f(e.onPointerMove,e=>{e.pointerType!==`touch`&&!d.current&&!o.isPointerInTransitRef.current&&(a.onTriggerEnter(),d.current=!0)}),onPointerLeave:f(e.onPointerLeave,()=>{a.onTriggerLeave(),d.current=!1}),onPointerDown:f(e.onPointerDown,()=>{a.open&&a.onClose(),l.current=!0,document.addEventListener(`pointerup`,p,{once:!0})}),onFocus:f(e.onFocus,()=>{l.current||a.onOpen()}),onBlur:f(e.onBlur,a.onClose),onClick:f(e.onClick,a.onClose)})})});R.displayName=L;var z=`TooltipPortal`,[B,V]=T(z,{forceMount:void 0}),H=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=F(z,t);return(0,b.jsx)(B,{scope:t,forceMount:n,children:(0,b.jsx)(d,{present:n||a.open,children:(0,b.jsx)(p,{asChild:!0,container:i,children:r})})})};H.displayName=z;var U=`TooltipContent`,W=y.forwardRef((e,t)=>{let n=V(U,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=F(U,e.__scopeTooltip);return(0,b.jsx)(d,{present:r||o.open,children:o.disableHoverableContent?(0,b.jsx)(Y,{side:i,...a,ref:t}):(0,b.jsx)(G,{side:i,...a,ref:t})})}),G=y.forwardRef((e,t)=>{let n=F(U,e.__scopeTooltip),r=j(U,e.__scopeTooltip),i=y.useRef(null),a=u(t,i),[o,s]=y.useState(null),{trigger:c,onClose:l}=n,d=i.current,{onPointerInTransitChange:f}=r,p=y.useCallback(()=>{s(null),f(!1)},[f]),m=y.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=re(r,ne(r,n.getBoundingClientRect())),a=ie(t.getBoundingClientRect());s(oe([...i,...a])),f(!0)},[f]);return y.useEffect(()=>()=>p(),[p]),y.useEffect(()=>{if(c&&d){let e=e=>m(e,d),t=e=>m(e,c);return c.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[c,d,m,p]),y.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||d?.contains(t),i=!ae(n,o);r?p():i&&(p(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,d,o,l,p]),(0,b.jsx)(Y,{...e,ref:a})}),[K,q]=T(N,{isInside:!1}),J=v(`TooltipContent`),Y=y.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:o,onPointerDownOutside:s,...c}=e,u=F(U,n),d=D(n),{onClose:f}=u;return y.useEffect(()=>(document.addEventListener(A,f),()=>document.removeEventListener(A,f)),[f]),y.useEffect(()=>{if(u.trigger){let e=e=>{e.target?.contains(u.trigger)&&f()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[u.trigger,f]),(0,b.jsx)(l,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:o,onPointerDownOutside:s,onFocusOutside:e=>e.preventDefault(),onDismiss:f,children:(0,b.jsxs)(a,{"data-state":u.stateAttribute,...d,...c,ref:t,style:{...c.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,b.jsx)(J,{children:r}),(0,b.jsx)(K,{scope:n,isInside:!0,children:(0,b.jsx)(w,{id:u.contentId,role:`tooltip`,children:i||r})})]})})});W.displayName=U;var X=`TooltipArrow`,Z=y.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=D(n);return q(X,n).isInside?null:(0,b.jsx)(c,{...i,...r,ref:t})});Z.displayName=X;function ne(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function re(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function ie(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function ae(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function oe(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),se(t)}function se(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var Q=M,ce=I,le=R,ue=H,de=W,fe=Z,$=r();function pe(e){let t=(0,$.c)(6),n,r;t[0]===e?(n=t[1],r=t[2]):({delayDuration:r,...n}=e,t[0]=e,t[1]=n,t[2]=r);let i=r===void 0?0:r,a;return t[3]!==i||t[4]!==n?(a=(0,b.jsx)(Q,{"data-slot":`tooltip-provider`,delayDuration:i,...n}),t[3]=i,t[4]=n,t[5]=a):a=t[5],a}function me(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,b.jsx)(ce,{"data-slot":`tooltip`,...n}),t[2]=n,t[3]=r),r}function he(e){let t=(0,$.c)(4),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r;return t[2]===n?r=t[3]:(r=(0,b.jsx)(le,{"data-slot":`tooltip-trigger`,...n}),t[2]=n,t[3]=r),r}function ge(e){let t=(0,$.c)(13),n,r,i,a;t[0]===e?(n=t[1],r=t[2],i=t[3],a=t[4]):({className:r,sideOffset:a,children:n,...i}=e,t[0]=e,t[1]=n,t[2]=r,t[3]=i,t[4]=a);let o=a===void 0?0:a,s;t[5]===r?s=t[6]:(s=_(`z-50 inline-flex w-fit max-w-xs origin-(--radix-tooltip-content-transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95`,r),t[5]=r,t[6]=s);let c;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,b.jsx)(fe,{className:`z-50 size-2.5 translate-y-[calc(-50%_-_2px)] rotate-45 rounded-[2px] bg-foreground fill-foreground`}),t[7]=c):c=t[7];let l;return t[8]!==n||t[9]!==i||t[10]!==o||t[11]!==s?(l=(0,b.jsx)(ue,{children:(0,b.jsxs)(de,{"data-slot":`tooltip-content`,sideOffset:o,className:s,...i,children:[n,c]})}),t[8]=n,t[9]=i,t[10]=o,t[11]=s,t[12]=l):l=t[12],l}export{he as i,ge as n,pe as r,me as t};
|
package/dist/public/index.html
CHANGED
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
nothing for the formatter to reindent.
|
|
21
21
|
-->
|
|
22
22
|
<script>(() => { let mode = 'wysiwyg'; try { const raw = localStorage.getItem('ok-editor-mode-v1'); if (raw === 'wysiwyg' || raw === 'source') mode = raw; } catch {} window.__OK_EDITOR_MODE__ = mode; })();</script>
|
|
23
|
-
<script type="module" crossorigin src="./assets/index-
|
|
23
|
+
<script type="module" crossorigin src="./assets/index-CRwvkGXF.js"></script>
|
|
24
24
|
<link rel="modulepreload" crossorigin href="./assets/chunk-DECur_0Z.js">
|
|
25
25
|
<link rel="modulepreload" crossorigin href="./assets/trace-api-CbLDdnQA.js">
|
|
26
26
|
<link rel="modulepreload" crossorigin href="./assets/propagation-api-LnD10wq2.js">
|
|
@@ -29,19 +29,19 @@
|
|
|
29
29
|
<link rel="modulepreload" crossorigin href="./assets/dist-oNAFjGrp.js">
|
|
30
30
|
<link rel="modulepreload" crossorigin href="./assets/compiler-runtime-Y11fyRVL.js">
|
|
31
31
|
<link rel="modulepreload" crossorigin href="./assets/button-Dyz7QGIk.js">
|
|
32
|
-
<link rel="modulepreload" crossorigin href="./assets/toggle-group-
|
|
32
|
+
<link rel="modulepreload" crossorigin href="./assets/toggle-group-C5MXNna8.js">
|
|
33
33
|
<link rel="modulepreload" crossorigin href="./assets/dist-RVD4DzGH.js">
|
|
34
34
|
<link rel="modulepreload" crossorigin href="./assets/dialog-FUclf-NK.js">
|
|
35
|
-
<link rel="modulepreload" crossorigin href="./assets/DocumentContext-
|
|
35
|
+
<link rel="modulepreload" crossorigin href="./assets/DocumentContext-CSOslMNT.js">
|
|
36
36
|
<link rel="modulepreload" crossorigin href="./assets/panel-DT62BXGr.js">
|
|
37
|
-
<link rel="modulepreload" crossorigin href="./assets/
|
|
37
|
+
<link rel="modulepreload" crossorigin href="./assets/OutlinePanel-D_xYEkm6.js">
|
|
38
38
|
<link rel="modulepreload" crossorigin href="./assets/circle-check-C-DpX4dU.js">
|
|
39
|
-
<link rel="modulepreload" crossorigin href="./assets/config-validation-events-
|
|
40
|
-
<link rel="modulepreload" crossorigin href="./assets/tooltip-
|
|
39
|
+
<link rel="modulepreload" crossorigin href="./assets/config-validation-events-mqmIrycG.js">
|
|
40
|
+
<link rel="modulepreload" crossorigin href="./assets/tooltip-CzI9zWJi.js">
|
|
41
41
|
<link rel="modulepreload" crossorigin href="./assets/agent-presence-BxT9uQ-C.js">
|
|
42
|
-
<link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-
|
|
42
|
+
<link rel="modulepreload" crossorigin href="./assets/target-navigation-intent-1238Z_HW.js">
|
|
43
43
|
<link rel="modulepreload" crossorigin href="./assets/mcp-consent-store-BBTXqzE6.js">
|
|
44
|
-
<link rel="stylesheet" crossorigin href="./assets/index-
|
|
44
|
+
<link rel="stylesheet" crossorigin href="./assets/index-CKzUuzYV.css">
|
|
45
45
|
</head>
|
|
46
46
|
|
|
47
47
|
<body class="antialiased">
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{$ as e,Lt as t,X as n,Z as r,et as i,it as a,nt as o,rt as s,tt as c}from"./dist-
|
|
1
|
+
import{$ as e,Lt as t,X as n,Z as r,et as i,it as a,nt as o,rt as s,tt as c}from"./dist-oDoSs1Bl.mjs";import{dirname as l,isAbsolute as u,resolve as d}from"node:path";import{existsSync as f,readFileSync as p,renameSync as m,unlinkSync as h}from"node:fs";import{homedir as g}from"node:os";import{mkdir as _,rename as v,writeFile as y}from"node:fs/promises";var b=t();function x(e){return`https://unpkg.com/@inkeep/open-knowledge@latest/dist/schemas/${n}/${e===`user`?`config.user.schema.json`:`config.project.schema.json`}`}function S(e){return`# yaml-language-server: $schema=${x(e)}\n`}function C(e,t,n){return d(e===`user`?n??g():u(t)?t:d(t),`.ok`,`config.yml`)}function w(e){return{ok:!1,error:e}}function T(e){return{ok:!0,...e}}async function E(e,t){let n=`${e}.tmp.${crypto.randomUUID()}`;try{await y(n,t,{encoding:`utf-8`,mode:420}),await v(n,e)}catch(e){try{h(n)}catch{}throw e}}async function D(e){return s(`config.patch`,{"config.scope":e.scope,"config.transport":`fs`},async t=>{let n=await O(e);return t.setAttribute(`config.outcome`,n.ok?`success`:`rejected`),n.ok||t.setAttribute(`config.error.code`,n.error.code),n})}async function O(t){let{cwd:n,scope:s,patch:c,homedirOverride:u,firstWriteHeader:d}=t,m=C(s,n,u),h=``,g=!1;if(f(m)){g=!0;try{h=p(m,`utf-8`)}catch(e){return w({code:`WRITE_ERROR`,detail:`Could not read existing config: ${e instanceof Error?e.message:String(e)}`})}}let v=(0,b.parseDocument)(h);if(v.errors.length>0)return w({code:`YAML_PARSE`,detail:v.errors.map(e=>e.message).join(`; `)});if(v.contents===null)v.contents=v.createNode({});else if(!(0,b.isMap)(v.contents))return w({code:`YAML_PARSE`,detail:`Top-level YAML value must be a mapping (object), got ${(0,b.isSeq)(v.contents)?`sequence`:`scalar`}`});let y=i(v,c),x=v.toJSON(),D=a(`config.validate`,{"config.scope":s,"config.validation.layer":`L2`},t=>{let n=r.safeParse(x);if(t.setAttribute(`config.outcome`,n.success?`success`:`rejected`),!n.success)for(let t of n.error.issues)e(`config.validation.issue`,{"issue.path":t.path.map(e=>String(e)).join(`.`),"issue.message":t.message});return n});if(!D.success)return w({code:`SCHEMA_INVALID`,issues:D.error.issues.map(o)});let O=v.toString();if(!g){let e=d===void 0?S(s):d??``;e.length>0&&(O=`${e.endsWith(`
|
|
2
2
|
`)?e:`${e}\n`}${O}`)}try{await _(l(m),{recursive:!0})}catch(e){return w({code:`WRITE_ERROR`,detail:`Could not create parent directory for ${m}: ${e instanceof Error?e.message:String(e)}`})}try{await E(m,O)}catch(e){return w({code:`WRITE_ERROR`,detail:`Could not write ${m}: ${e instanceof Error?e.message:String(e)}`})}return T({effective:D.data,appliedPaths:y,path:m,created:!g})}function k(e){if(!f(e))return[];let t=(0,b.parseDocument)(p(e,`utf-8`));if(t.errors.length>0)return[];let n=t.toJSON();if(!n||typeof n!=`object`||Array.isArray(n))return[];let r=n.folders;return Array.isArray(r)?r:[]}function A(e){return{ok:!1,error:e}}function j(e){return{ok:!0,...e}}async function M(e){let t=e.scope??`project`,n=C(t,e.cwd,e.homedirOverride),r;try{r=k(n)}catch(e){return A({code:`WRITE_ERROR`,detail:`Could not read current folders: ${e instanceof Error?e.message:String(e)}`})}let i=r.map(e=>({match:e.match,frontmatter:{...e.frontmatter}}));for(let t of e.rules){let e=t.new_match??t.match,n=i.findIndex(e=>e.match===t.match);if(t.new_match!==void 0&&t.new_match!==t.match){if(n>=0){let e=i.findIndex((e,r)=>r!==n&&e.match===t.new_match);e>=0&&i.splice(e,1);let r=e>=0&&e<n?n-1:n;i[r]={match:t.new_match,frontmatter:{...t.frontmatter}}}else{let n=i.findIndex(t=>t.match===e);n>=0?i[n]={match:e,frontmatter:{...t.frontmatter}}:i.push({match:e,frontmatter:{...t.frontmatter}})}continue}n>=0?i[n]={match:t.match,frontmatter:{...t.frontmatter}}:i.push({match:t.match,frontmatter:{...t.frontmatter}})}let a=await D({cwd:e.cwd,scope:t,patch:{folders:i},homedirOverride:e.homedirOverride});return a.ok?j({effective:a.effective,appliedPaths:a.appliedPaths,path:a.path,created:a.created}):A(a.error)}function N(e,t){let n=P(`user`,t),r=P(`project`,t),i=new Map;for(let t of e){let e=t.join(`.`);i.set(e,{user:F(n,t),project:F(r,t)})}return i}function P(e,t){let n=C(e,t.cwd,t.homedirOverride);if(!f(n))return null;let r;try{r=p(n,`utf-8`)}catch(t){return t.code!==`ENOENT`&&console.warn(`[inspectConfigPaths] could not read ${e} config at ${n}: ${t.message??t}`),null}let i=(0,b.parseDocument)(r);return i.errors.length>0?(console.warn(`[inspectConfigPaths] ${e} config at ${n} has YAML parse errors; treating as absent for scope inference`),null):i.toJSON()}function F(e,t){if(t.length===0)return e!=null;let n=e;for(let e of t){if(n==null)return!1;if(Array.isArray(n)&&typeof e==`number`){n=n[e];continue}if(typeof n==`object`){let t=String(e);if(!(t in n))return!1;n=n[t];continue}return!1}return n!==void 0}function I(e,t,n,r){return e.success?{code:`UNKNOWN`,message:`unexpected success in error path`}:{code:`SCHEMA_INVALID`,issues:e.error.issues.map(e=>{let i=e.path.map(e=>typeof e==`symbol`?String(e):e),a=c({file:r,source:n,doc:t,path:i});return{path:i,message:e.message,issueCode:e.code,...a===void 0?{}:{source:a}}})}}function L(e,t,n){let r=`${e}.invalid-${t.replace(/[:.]/g,`-`)}`;try{return m(e,r),r}catch(t){n(`[config] Could not sideline invalid config file ${e} → ${r}: ${t instanceof Error?t.message:String(t)}. File left in place; using schema defaults.`);return}}function R(e){let{absPath:t,sideline:n=!0,timestamp:i=new Date().toISOString()}=e,a=e.warn??(e=>console.warn(e)),o=r.parse({});if(!f(t))return{valid:!0,value:o,source:void 0};let s;try{s=p(t,`utf-8`)}catch(e){let n=e instanceof Error?e.message:String(e);return a(`[config] Could not read ${t}: ${n}. Using schema defaults.`),{valid:!1,value:o,error:{code:`UNKNOWN`,message:`Read failed: ${n}`}}}let c=(0,b.parseDocument)(s);if(c.errors.length>0){let e=c.errors.map(e=>e.message).join(`; `);a(`[config] ${t} contains invalid YAML (${e}). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let r=n?L(t,i,a):void 0;return{valid:!1,value:o,error:{code:`YAML_PARSE`,detail:e},...r===void 0?{}:{sidelinedTo:r}}}let l=c.toJSON()??{},u=r.safeParse(l);if(!u.success){let e=I(u,c,s,t);a(`[config] ${t} fails schema validation (${u.error.issues.length} issue(s)). Using schema defaults.`+(n?``:` Pass-through mode: file left in place.`));let r=n?L(t,i,a):void 0;return{valid:!1,value:o,error:e,...r===void 0?{}:{sidelinedTo:r}}}return{valid:!0,value:u.data,source:t}}export{D as a,C as i,N as n,R as r,M as t};
|
|
3
|
-
//# sourceMappingURL=server-
|
|
3
|
+
//# sourceMappingURL=server-Cb1yd7Zc.mjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./loader-Dk5RaTzD.mjs";import"./init-B3ijkT7_.mjs";export{};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{o as e}from"./start-_eaR3T65.mjs";export{e as startCommand};
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{t as e}from"./esm-wByiX8MO.mjs";import{i as t}from"./constants-
|
|
2
|
-
//# sourceMappingURL=start-
|
|
1
|
+
import{t as e}from"./esm-wByiX8MO.mjs";import{i as t}from"./constants-CGiUuTdz.mjs";import{spawn as n}from"node:child_process";import{join as r}from"node:path";import{closeSync as i,existsSync as a,mkdirSync as o,openSync as s}from"node:fs";import{setTimeout as c}from"node:timers/promises";function l(){let e=process.execPath,t=process.argv[1];return t?{command:e,prefixArgs:[t]}:(console.warn(`[self-spawn] process.argv[1] is empty — falling back to \`npx @inkeep/open-knowledge\`. This re-introduces the version-drift surface that re-exec was fixing. Observed argv: ${JSON.stringify(process.argv)}`),{command:`npx`,prefixArgs:[`@inkeep/open-knowledge`]})}function u(e){return e.uiLock?e.isAlive(e.uiLock.pid)?{action:`skip`,reason:`alive`,pid:e.uiLock.pid,port:e.uiLock.port}:{action:`spawn`,reason:`stale`,stalePid:e.uiLock.pid}:{action:`spawn`,reason:`absent`}}function d(e){a(e.lockDir)||o(e.lockDir,{recursive:!0});let t=s(r(e.lockDir,`last-spawn-error.log`),`w`),c=e.spawn??n,{PORT:u,...d}=process.env,f=l();try{let n=c(f.command,[...f.prefixArgs,...e.args??[`ui`]],{detached:!0,stdio:[`ignore`,`ignore`,t],cwd:e.cwd,env:d});return n.unref(),n}finally{try{i(t)}catch{}}}async function f(e){let t=e.now()+e.timeoutMs;for(;e.now()<t;){let t=e.readUiLock();if(t&&t.port>0)return t.port;await e.sleep(e.pollIntervalMs)}let n=e.readUiLock();return n&&n.port>0?n.port:null}function p(e){let t=e.sigtermGraceMs??1e4,n=e.sigtermPollIntervalMs??200,r=e.sleep??(e=>c(e));return async()=>{try{let i=e.readUiLock();if(i&&e.isAlive(i.pid))try{e.killPid(i.pid,`SIGTERM`),e.log?.info({pid:i.pid,port:i.port},`idle-shutdown: SIGTERM UI sibling`);let a=Date.now()+t;for(;Date.now()<a&&e.isAlive(i.pid);)await r(n);if(e.isAlive(i.pid))try{e.killPid(i.pid,`SIGKILL`),e.log?.warn({pid:i.pid,graceMs:t},`idle-shutdown: SIGTERM grace expired — escalated to SIGKILL`)}catch(t){e.log?.error({pid:i.pid,err:t instanceof Error?t.message:String(t)},`idle-shutdown: SIGKILL failed`)}}catch(t){e.log?.warn({pid:i.pid,err:t instanceof Error?t.message:String(t)},`idle-shutdown: failed to SIGTERM UI sibling`)}}catch(t){e.log?.warn({err:t instanceof Error?t.message:String(t)},`idle-shutdown: UI lookup failed; proceeding with destroy`)}await e.destroy()}}async function m(e){let{config:t,cwd:n}=e,r=e.skipAutoInit??!1,i=e.skipUiAutoSpawn??!1,a=e.idleThresholdMs??18e5,{existsSync:o,mkdirSync:s}=await import(`node:fs`),{resolve:l}=await import(`node:path`),{bootServer:m,ensureProjectGit:h,getLogger:g,isProcessAlive:_,readUiLock:v}=await import(`./dist-B969m3rv.mjs`),{resolveContentDir:y}=await import(`./paths-s1VdY11r.mjs`),b=e.log??g(`start`),x=y(t,n);o(x)||(s(x,{recursive:!0}),b.info({contentDir:x},`Created content directory`));let S=!o(l(n,`.ok`)),C=r?void 0:async()=>{try{let{initContent:e}=await import(`./init-BRl7X3F9.mjs`),t=e(n);return S||t.created.length>0||t.updated.length>0}catch(e){return console.warn(`Auto-init failed:`,e instanceof Error?e.message:e),!1}},w=!1,T=l(x,`.ok`),E=t.server.openOnAgentEdit?()=>{if(w)return;let e=v(T);if(!e||e.port<=0||!_(e.pid))return;w=!0;let t=`http://localhost:${e.port}`;import(`./open-browser-hvFa-TeR.mjs`).then(({openBrowser:e})=>e(t)).catch(()=>{})}:void 0,D=null,O=await m({contentDir:x,projectDir:n,contentRoot:t.content.dir,port:e.port,host:t.server.host,quiet:!1,onAgentWrite:E,localOpCliArgs:[process.execPath,process.argv[1]],attachUiSibling:!0,idleShutdownMs:a,skipAutoInit:r,autoInitFn:C,ensureProjectGitFn:r?void 0:()=>h(n),spawnUiSiblingFn:async({lockDir:t})=>{if(D=u({uiLock:v(t),isAlive:_}),D.action===`spawn`&&!i)try{d({lockDir:t,cwd:n,spawn:e.spawn}),b.info({reason:D.reason},`[start] auto-spawned ok ui sibling`)}catch(e){console.warn(`[start] failed to auto-spawn ok ui: ${e instanceof Error?e.message:String(e)}`)}else D.action===`skip`&&b.info({port:D.port,pid:D.pid},`UI already running at port ${D.port}`)},idleShutdownHandler:e=>p({readUiLock:()=>v(O.lockDir),isAlive:_,killPid:(e,t)=>{process.kill(e,t)},destroy:e,log:b}),log:b});D||={action:`skip`,reason:`alive`,pid:0,port:0};let k=D,A=null;if(k.action===`skip`)A=k.port>0?k.port:null;else if(!i){let t=e.uiBindTimeoutMs??3e3;A=await f({readUiLock:()=>v(O.lockDir),now:Date.now,sleep:e=>c(e),timeoutMs:t,pollIntervalMs:50}),A===null&&b.warn({timeoutMs:t},`[start] ok ui did not bind within timeout — banner falls back to API URL`)}return{httpServer:O.httpServer,destroy:O.destroy,lockDir:O.lockDir,contentDir:x,port:O.port,ready:O.ready,degraded:O.degraded,uiSpawnDecision:D,resolvedUiPort:A,didAutoInit:O.didAutoInit,didGitInit:O.didGitInit}}function h(n){return new e(`start`).description(`Start the knowledge base collab server`).option(`-p, --port <port>`,`Server port`,void 0).option(`-H, --host <host>`,`Server host`,void 0).option(`--open`,`Open browser after start`).option(`--no-init`,`Skip auto-scaffolding of .ok/`).action(async e=>{let{renderBanner:r}=await import(`./banner-DoFNyNUH.mjs`),{dim:i,error:a,info:o,warning:s}=await import(`./colors-CswooXAS.mjs`),c=n(),l=process.cwd();e.host!==void 0&&(c.server.host=e.host);let u=e.port===void 0?void 0:Number(e.port),d=process.env.PORT?Number(process.env.PORT):void 0,f=u??d,p;try{p=await m({config:c,cwd:l,port:f,skipAutoInit:e.init===!1})}catch(e){let{ProjectGitInitError:t}=await import(`./dist-B969m3rv.mjs`);e instanceof t&&(console.error(a(`open-knowledge requires git to initialize a parent repo. Install git or run 'git init' yourself, then re-run.`)),e.stderr&&console.error(i(e.stderr.trim())),process.exit(1)),console.error(`${a(`Failed to start:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exit(1)}let h=!1,g=async e=>{if(!h){h=!0,console.log(i(`\nShutting down (${e})...`));try{await p.destroy()}catch(e){console.error(`${a(`destroy() failed:`)} ${e instanceof Error?e.stack??e.message:String(e)}`),process.exitCode=1}process.exit(process.exitCode??0)}};process.once(`SIGINT`,()=>{g(`SIGINT`)}),process.once(`SIGTERM`,()=>{g(`SIGTERM`)});let _=`http://${c.server.host}:${p.port}`,v=c.server.host===`0.0.0.0`||c.server.host===`::`?`http://0.0.0.0:${p.port}`:void 0,y=p.resolvedUiPort,b=y!==null&&y>0?`http://${c.server.host}:${y}`:_;console.log(r({name:`open-knowledge`,version:t,localUrl:b,apiUrl:b===_?void 0:_,networkUrl:v})),p.didAutoInit&&(console.log(` ${o(`✓`)} Scaffolded .ok/ (first run)`),console.log(` ${i("Tip: Run `open-knowledge init` to register MCP tools for Claude Code")}\n`));let x={"shadow-repo":`Version history and branch-switch safety unavailable`,"file-watcher":`External file changes will not sync to the editor`,"head-watcher":`Git branch switches may cause document inconsistency`};p.ready.then(async()=>{if(p.degraded.length>0){console.log();for(let e of p.degraded){let t=x[e]??`${e} (check server logs for details)`;console.warn(` ${s(`⚠`)} ${s(e)}: ${i(t)}`)}console.log()}if(p.didAutoInit||p.didGitInit)if(p.didGitInit&&console.log(`\n ${o(`✓`)} Initialized git repo at ${l}/.git/ (default branch: main)`),p.didAutoInit)try{let{previewContent:e,formatPreviewBlock:t}=await import(`./preview-DFbaN55s.mjs`),n=e({projectDir:l,contentDir:p.contentDir});console.log(`\n${t(n,l)}\n`)}catch(e){console.warn(`Content preview unavailable: ${e instanceof Error?e.message:String(e)}`)}else console.log();if(e.open){let{openBrowser:e}=await import(`./open-browser-hvFa-TeR.mjs`);e(b)}}).catch(e=>{console.error(` ${a(`Server initialization failed:`)} ${e instanceof Error?e.message:String(e)}`)})})}export{d as a,u as i,m as n,h as o,p as r,l as s,f as t};
|
|
2
|
+
//# sourceMappingURL=start-_eaR3T65.mjs.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inkeep/open-knowledge",
|
|
3
|
-
"version": "0.0.0-dev-
|
|
3
|
+
"version": "0.0.0-dev-20260501150416",
|
|
4
4
|
"private": false,
|
|
5
5
|
"type": "module",
|
|
6
6
|
"exports": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"build:assets": "bun run build:app && bun run build:skill-asset && bun run build:notices && bun run build:schema",
|
|
39
39
|
"build": "bun run build:cli && bun run build:assets",
|
|
40
40
|
"postinstall": "node scripts/postinstall.mjs",
|
|
41
|
-
"test": "bun
|
|
41
|
+
"test": "bun test",
|
|
42
42
|
"typecheck": "tsc --noEmit",
|
|
43
43
|
"prepublishOnly": "bash ../../scripts/check-notices-clean.sh && bun run build && bun run test"
|
|
44
44
|
},
|
package/dist/init-CleqrmS6.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{o as e}from"./init-DpiVQYhQ.mjs";export{e as runInit};
|
package/dist/init-D1vMwuMO.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as e}from"./init-qoXDcT6N.mjs";export{e as initContent};
|
package/dist/loader-CwvZAVlq.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e}from"./loader-BEUtMT2_.mjs";export{e as loadConfig};
|
package/dist/paths-B1biT3Kh.mjs
DELETED
package/dist/paths-BQoQfIvS.mjs
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./paths-B1biT3Kh.mjs";export{t as resolveContentDir,e as resolveLockDir};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{n as e,t}from"./preview-BIrbsSSc.mjs";export{t as formatPreviewBlock,e as previewContent};
|