@inkeep/open-knowledge 0.4.0-beta.19 → 0.4.0-beta.20

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.
Files changed (36) hide show
  1. package/dist/assets/skills/open-knowledge/SKILL.md +1 -1
  2. package/dist/cli.mjs +5 -5
  3. package/dist/constants-DTqDNUS7.mjs +2 -0
  4. package/dist/{dist-RAy2NfOX.mjs → dist-Bfxmzk9L.mjs} +2 -2
  5. package/dist/{dist-DfIz2LcA.mjs → dist-Cp4ojTBN.mjs} +2 -2
  6. package/dist/{dist-CeydCXIY.mjs → dist-tZe2rFf6.mjs} +1 -1
  7. package/dist/index.mjs +1 -1
  8. package/dist/{init-qh1HubtR.mjs → init-Bzm3Bj4h.mjs} +3 -3
  9. package/dist/init-IWUnv882.mjs +1 -0
  10. package/dist/{loader-DMES5Z4K.mjs → loader--zxukDZu.mjs} +2 -2
  11. package/dist/loader-DQvI2UUK.mjs +1 -0
  12. package/dist/preview-BHYdZs7Y.mjs +1 -0
  13. package/dist/{preview-CZdt-b-O.mjs → preview-XajysOgG.mjs} +2 -2
  14. package/dist/public/assets/{ActivityModeContent-WITVydyg.js → ActivityModeContent-yyI5Ntgt.js} +1 -1
  15. package/dist/public/assets/{DocumentContext-FwLaR_pb.js → DocumentContext-CYTEDpXo.js} +14 -14
  16. package/dist/public/assets/{GraphPanel-BYxZ6mOr.js → GraphPanel-BcD5weL7.js} +1 -1
  17. package/dist/public/assets/{OutlinePanel-DktI5hU_.js → OutlinePanel-CF0ZjNeY.js} +1 -1
  18. package/dist/public/assets/{SettingsPane-CEKKjs0_.js → SettingsPane-Dm4UYL47.js} +1 -1
  19. package/dist/public/assets/{SourceEditor-B7V3PE4E.js → SourceEditor-BUirRa42.js} +1 -1
  20. package/dist/public/assets/{config-validation-events-ZEbhIRmP.js → config-validation-events-DzZGJLSM.js} +1 -1
  21. package/dist/public/assets/{doc-hash-CfmBVnag.js → doc-hash-DHxBgWbt.js} +1 -1
  22. package/dist/public/assets/{index-uWtLvm2S.js → index-5PB1Kr-b.js} +77 -77
  23. package/dist/public/assets/{index-C-Lx_3XB.css → index-C9d50jCr.css} +1 -1
  24. package/dist/public/assets/{target-navigation-intent-CNDuSbLi.js → target-navigation-intent-CnzRZgNc.js} +1 -1
  25. package/dist/public/assets/{tooltip-csUfbEtd.js → tooltip-BKAA9nHy.js} +1 -1
  26. package/dist/public/index.html +8 -8
  27. package/dist/src-BQP6s1V9.mjs +1 -0
  28. package/dist/{start-Dxso0_dy.mjs → start-BX5MJMSW.mjs} +2 -2
  29. package/dist/start-BwVlC9Wk.mjs +1 -0
  30. package/package.json +1 -1
  31. package/dist/constants-3O7IbmRt.mjs +0 -2
  32. package/dist/init-Bf3i3xIz.mjs +0 -1
  33. package/dist/loader-CTQL6JBJ.mjs +0 -1
  34. package/dist/preview-Dy00IGYn.mjs +0 -1
  35. package/dist/src-D0mZ2vS1.mjs +0 -1
  36. package/dist/start-CMpdhTp5.mjs +0 -1
@@ -321,7 +321,7 @@ $2`).split(`
321
321
  `)].join(`
322
322
  `);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(`
323
323
  `))n.push(` ${t}`);return n.join(`
324
- `)}case`WRITE_ERROR`:return`Failed to write config file: ${e.detail}`;case`OKIGNORE_INVALID`:return e.lineNumber===void 0?`.okignore: ${e.detail}`:`.okignore line ${e.lineNumber}: ${e.detail}`;case`UNKNOWN`:return e.message??`Unknown error.`}}const kW=`__system__`,AW=1,jW=`__config__/project`,MW=`__user__/config.yml`,NW=`__local__/project`,PW=`__config__/okignore`,FW=Object.freeze([jW,NW,MW,PW]),IW=`Ov23liqlSd0V1MwR6rhI`,LW=[`incoming`,`outgoing`,`both`];function RW(e){return LW.includes(e)}const zW=`localhost`,BW=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],VW=[`video/mp4`,`video/webm`,`video/ogg`],HW=[`audio/mpeg`,`audio/wav`,`audio/ogg`],UW=[`application/pdf`],WW=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),GW=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),KW=new Set([`pdf`]),qW=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),JW=new Set(`exe.bat.cmd.ps1.com.msi.vbs.js.jse.wsf.wsh.hta.sh.command.csh.ksh.bash.zsh.fish.desktop.action.workflow.html.htm.svg.xml.mhtml.svgz.dmg.pkg.mpkg.scpt.applescript.terminal.prefpane.webloc.inetloc.fileloc.jar.appimage.deb.rpm.msix.appx.ipa.apk.pif.scr.lnk.url`.split(`.`)),YW=new Set(`png.jpg.jpeg.gif.webp.avif.svg.apng.heic.heif.tiff.bmp.ico.pdf.mp4.webm.mov.m4v.mkv.avi.flv.wmv.mpeg.mpg.mp3.wav.ogg.m4a.flac.aac.opus.zip.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.csv.txt.rtf.json`.split(`.`)),XW=new Set(`png.jpg.jpeg.gif.webp.avif.apng.heic.heif.tiff.bmp.ico.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus`.split(`.`)),ZW=`same-dir`,QW=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`,`pdf`,`mp4`,`webm`,`mov`,`m4v`,`mkv`,`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),$W=[`png`,`jpg`,`jpeg`],eG=[`mp4`];function tG(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}tG(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,$W,WW),tG(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,eG,GW);const nG=new Set($W),rG=new Set(eG);tG(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...$W,...eG])],XW);function iG(e){let t=e.toLowerCase().replace(/^\./,``);return nG.has(t)?`image`:rG.has(t)?`video`:null}const aG=Wb.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3},meta:{default:null},sourceStyle:{default:`fenced`}}}}),oG=rx.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}},addInputRules(){return[Sb({find:Qb,type:this.type,getAttributes:{sourceDelimiter:`*`}}),Sb({find:ex,type:this.type,getAttributes:{sourceDelimiter:`_`}})]}}),sG=Zb.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}},addInputRules(){return[Sb({find:Kb,type:this.type,getAttributes:{sourceDelimiter:`**`}}),Sb({find:Jb,type:this.type,getAttributes:{sourceDelimiter:`__`}})]}}),cG=tb.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),lG=ax.extend({priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`}}}}),uG=sx.extend({priority:60,addAttributes(){return{...this.parent?.(),headingStyle:{default:`atx`},sourceTrailingHashes:{default:null},sourceUnderlineLength:{default:null}}}}),dG=R.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]}}),fG=R.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}})}}}),pG=R.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]}}),mG=[`https`,`http`,`mailto`,`tel`,`ftp`,`sms`],hG=mG.map(e=>`${e}:`).join(`|`);RegExp(`^(?:${hG}|\\/|#|\\?|\\.\\/|\\.\\.\\/)`,`i`);const gG=new Set(mG.map(e=>`${e}:`));function _G(e){try{let t=new URL(e,`https://placeholder.invalid`);return gG.has(t.protocol.toLowerCase())}catch{return!1}}const vG=yx.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:_G,validate:_G,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},sourceUrlForm:{default:null,rendered:!1},sourceTitleMarker:{default:null,rendered:!1}}}}),yG=R.create({name:`linkRefDef`,group:`block`,atom:!0,priority:60,addAttributes(){return{label:{default:``},href:{default:``},title:{default:null},sourceLayout:{default:null},sourceTitleMarker:{default:null}}},parseHTML(){return[{tag:`div[data-link-ref-def]`}]},renderHTML({node:e}){let{label:t,href:n,title:r}=e.attrs,i=r?`[${t}]: ${n} "${r}"`:`[${t}]: ${n}`;return[`div`,{"data-link-ref-def":``,class:`link-ref-def`},i]}});function bG(e){return e.type.name===`list`&&!e.attrs.ordered}function xG(e){return e.type.name===`list`&&!!e.attrs.ordered}function SG(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function CG(e,t,n,r,i,a,o){let s=Iv(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?Nf(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 Af(n,a)(e,void 0)?t?Af(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}const wG=R.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,Kv(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:CG(e,t,n,r,e=>bG(e)&&!SG(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:CG(e,t,n,r,e=>xG(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:CG(e,t,n,r,e=>bG(e)&&SG(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[Tb({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]})}),Tb({find:/^\s*(\d+)([.)])\s$/,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]})}),new qy({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=Gu(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()}}}),TG=R.create({name:`listItem`,content:`paragraph block*`,defining:!0,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`,Kv(t),0]:[`li`,Kv(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(Kv(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}}}}),EG=wG,DG=TG,OG=R.create({name:`mathInline`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{formula:{default:``},id:{default:null},language:{default:`latex`}}},parseHTML(){return[{tag:`span[data-math-inline]`,getAttrs:e=>typeof e==`string`?!1:{formula:e.getAttribute(`data-formula`)||``,id:e.getAttribute(`id`)||null,language:e.getAttribute(`data-language`)||`latex`}}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-math-inline":``,"data-formula":e.formula,"data-language":e.language,...e.id?{id:e.id}:{}}]},addCommands(){return{insertMathInline:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{formula:e}})}}}),kG=R.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}}}}),AG=MC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),jG=IC.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1}}}}),MG=R.create({name:`commentBlock`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}},sourceLayout:{default:`block`,parseHTML:e=>e.getAttribute(`data-source-layout`)===`inline`?`inline`:`block`,renderHTML:e=>e.sourceLayout===`inline`?{"data-source-layout":`inline`}:{}}}},parseHTML(){return[{tag:`aside[data-comment-block]`},{tag:`aside.comment-block`}]},renderHTML({HTMLAttributes:e}){return[`aside`,{"data-comment-block":``,"data-clipboard-omit":`true`,class:`comment-block`,style:`display: none;`,...e},0]},addCommands(){return{setCommentBlock:()=>({commands:e})=>e.wrapIn(this.name),toggleCommentBlock:()=>({commands:e})=>e.toggleWrap(this.name),unsetCommentBlock:()=>({commands:e})=>e.lift(this.name)}}}),NG=tb.create({name:`comment`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}}}},parseHTML(){return[{tag:`span[data-comment-mark]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-comment-mark":``,"data-clipboard-omit":`true`,class:`comment-mark`,style:`display: none;`,...e},0]},addCommands(){return{setComment:()=>({commands:e})=>e.setMark(this.name),toggleComment:()=>({commands:e})=>e.toggleMark(this.name),unsetComment:()=>({commands:e})=>e.unsetMark(this.name)}}}),PG=R.create({name:`footnoteDefinition`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){let e=e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}};return[{tag:`aside[data-footnote-def]`,getAttrs:e},{tag:`aside.footnote-def`,getAttrs:e}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.identifier??``);return[`aside`,{...t,"data-footnote-def":``,"data-footnote-id":n,id:`fn-${n}`,class:`footnote-def`},[`div`,{class:`footnote-body`},0],[`a`,{href:`#fnref-${n}`,class:`footnote-backref`,contentEditable:`false`,"aria-label":`Back to reference`},`↩`]]},addCommands(){return{insertFootnoteDefinition:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e},content:[{type:`paragraph`}]})}}}),FG=R.create({name:`footnoteReference`,group:`inline`,inline:!0,atom:!0,selectable:!0,draggable:!1,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){return[{tag:`sup[data-footnote-ref]`,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}}}]},renderHTML({node:e}){let t=String(e.attrs.identifier??``);return[`sup`,{id:`fnref-${t}`,"data-footnote-ref":``,"data-footnote-id":t,class:`footnote-ref`},[`a`,{href:`#fn-${t}`,class:`footnote-ref-link`},`[${t}]`]]},addCommands(){return{insertFootnoteReference:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e}})}}}),IG=R.create({name:`imageReference`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{alt:{default:``},label:{default:``},identifier:{default:``},referenceType:{default:`shortcut`}}},parseHTML(){return[{tag:`img[data-image-reference]`}]},renderHTML({node:e}){let{alt:t,label:n,referenceType:r}=e.attrs,i=t||n;return[`img`,{"data-image-reference":``,"data-reference-type":r,"data-label":n,alt:i}]}}),LG=tb.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]}});function RG(e,t){if(typeof e!=`string`||typeof t!=`string`||/[\x00-\x1F\x7F]/.test(e))return!1;let n=e.replaceAll(`\xA0`,` `),r=t.replaceAll(`\xA0`,` `);return n===r?!0:zG(n)===r}function zG(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}const BG=kC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null}}}}),VG=R.create({name:`tag`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{value:{default:``}}},parseHTML(){return[{tag:`a[data-tag]`,getAttrs:e=>typeof e==`string`?!1:{value:e.getAttribute(`data-tag`)||``}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.value??``);return[`a`,{...t,"data-tag":n,href:`#tag/${n}`,class:`tag`},`#${n}`]},addCommands(){return{insertTag:e=>({chain:t})=>t().insertContent({type:`tag`,attrs:{value:e}}).run()}}}),HG=/^(?:---|—-|___\s|\*\*\*\s)$/;function UG(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}const WG=zC.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[Cb({find:HG,type:this.type,getAttributes:e=>({sourceRaw:UG(e)})})]}});function GG(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function KG(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const qG=R.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:GG(e.getAttribute(`data-alias`)),anchor:GG(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:GG(e.getAttribute(`data-alias`)),anchor:GG(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=GG(e.attrs.alias),i=GG(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`},KG({target:n,alias:r,anchor:i})]}});function JG(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function YG(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const XG=[fG,kG,pG,OG,qG,R.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:GG(e.getAttribute(`data-alias`)),anchor:GG(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=GG(e.attrs.alias),i=GG(e.attrs.anchor),a=GG(e.attrs.resolvedSrc),o=JG(n);if(WW.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`},YG({target:n,alias:r,anchor:i})]}}),VG,EG,DG,oG,sG,jG,aG,AG,uG,WG,vG,dG,yG,lG,cG,LG,pT.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,blockquote:!1,dropcursor:{color:`color-mix(in oklch, var(--primary) 50%, transparent)`,width:2}}),BG.configure({resizable:!0}),gC,hC,mC,wx.configure({inline:!0}),IG,Sx,NG,MG,FG,PG],ZG=/^[a-zA-Z][\w/-]*$/;function QG(e){return e.startsWith(`#`)?e.slice(1):e}function $G(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function eK(e){if(!e||e.trim()===``)return[];let{map:t}=tW(e);if(!t)return[];let n=$G(t.tags),r=[];for(let e of n){let t=QG(e);ZG.test(t)?r.push(t):console.warn(`[frontmatter-tags] dropping invalid tag entry: ${JSON.stringify(e)}`)}return r}function tK(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=nK(e,t);r>=0?n[r]=o:n.push(o)}return n}function nK(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 rK(e,t,n,r){return{type:`mdxJsxFlowElement`,name:e,attributes:tK(t,r),children:n.all(t),data:{}}}const iK=[{name:`type`,type:`enum`,enumValues:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`],defaultValue:`note`,required:!1,description:`Callout 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`}],aK=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Image source URL`,accept:BW,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)`}],oK=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Video source URL`,accept:VW,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`}],sK=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Audio source URL`,accept:HW,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`}],cK=[{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`}],lK=[iK[0],iK[1],iK[4],iK[5],iK[6]],uK=[aK[0],aK[1],aK[7]],dK=[cK[0],cK[1],cK[4],cK[5]],fK=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Alt text (Obsidian alias syntax: `![[file.png|alt text]]`)"}],pK=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[clip.mp4|title]]`)"}],mK=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[song.mp3|title]]`)"}],hK=[{name:`formula`,type:`string`,required:!0,autoFocus:!0,description:`LaTeX math source (rendered with KaTeX in the browser)`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#eq-pythagoras`)"},{name:`language`,type:`string`,required:!1,advanced:!0,description:"Forward-compat hint for the math source language (default `latex`). Reserved for future MathJax / Typst / AsciiMath substrates."}],gK=[hK[0]],_K=[hK[0]],vK=[{name:`chart`,type:`string`,required:!0,autoFocus:!0,description:`Mermaid chart source (graph / flowchart / sequenceDiagram / class / state / etc.)`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#system-arch-diagram`)"},{name:`theme`,type:`enum`,enumValues:[`default`,`dark`,`forest`,`neutral`],defaultValue:`default`,required:!1,advanced:!0,description:"Mermaid theme — default ships only `default` styling; alternates land alongside theme-switching infrastructure"}],yK=[vK[0]],bK=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[doc.pdf|title]]`)"}],xK=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`PDF source URL`,accept:UW,autoFocus:!0},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Accessible label for the embedded PDF viewer`},{name:`anchor`,type:`string`,required:!1,advanced:!0,description:"PDF viewer parameters as a single URL-fragment string (e.g. `page=3&height=600`)"}];function SK(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function CK(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function wK(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}]}}const TK=[{name:`Callout`,surface:`canonical`,hasChildren:!0,props:iK,icon:`MessageSquareWarning`,category:`content`,displayName:`Callout`,description:`Alert / admonition with 15 type variants — 5 GFM (note, tip, important, warning, caution) plus 10 Obsidian-parity (abstract, info, todo, success, question, failure, danger, bug, example, quote)`,searchTerms:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`,`alert`,`admonition`,`callout`],serialize:(e,t)=>rK(`Callout`,e,t,iK)},{name:`img`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:aK,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)=>rK(`img`,e,t,aK)},{name:`video`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:oK,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)=>rK(`video`,e,t,oK)},{name:`audio`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:sK,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)=>rK(`audio`,e,t,sK)},{name:`Pdf`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:xK,icon:`FileText`,category:`media`,displayName:`PDF`,description:"Embedded PDF viewer (`#page=N` to open at page N, `#height=N` for viewer height)",searchTerms:[`pdf`,`document`,`embed`,`pdfjs`],placeholder:{label:`Add a PDF`},serialize:(e,t)=>rK(`Pdf`,e,t,xK)},{name:`Accordion`,surface:`canonical`,hasChildren:!0,props:cK,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)=>rK(`Accordion`,e,t,cK)},{name:`Math`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:hK,icon:`Sigma`,category:`content`,displayName:`Math`,description:`Block math equation rendered with KaTeX from a LaTeX source string`,searchTerms:[`math`,`latex`,`equation`,`formula`,`katex`,`tex`],serialize:(e,t)=>rK(`Math`,e,t,hK)},{name:`Mermaid`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:vK,icon:`Workflow`,category:`content`,displayName:`Mermaid`,description:`Diagram rendered from Mermaid source (flowchart, sequence, class, state, ER, gantt, pie)`,searchTerms:[`mermaid`,`diagram`,`flowchart`,`graph`,`sequence`,`sequencediagram`,`class`,`state`,`er`,`erdiagram`,`gantt`,`pie`,`chart`],serialize:(e,t)=>rK(`Mermaid`,e,t,vK)},{name:`GFMCallout`,surface:`compat`,hasChildren:!0,props:lK,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`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`]),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:uK,icon:`Image`,category:`media`,displayName:`CommonMark Image`,description:'CommonMark image (`![alt](src "title")`) — read-only compat. Preserves `![alt](src)` 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:fK,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:wK},{name:`WikiEmbedVideo`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:pK,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:wK},{name:`WikiEmbedAudio`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:mK,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:wK},{name:`WikiEmbedPdf`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:bK,icon:`FileText`,category:`media`,displayName:`Wiki Embed PDF`,description:"Obsidian-style `![[doc.pdf]]` wiki-embed — read-only compat. Renders through the `Pdf` canonical (pdfjs-dist multi-page canvas viewer with custom toolbar). Edit the title via the alias slot; `#page=N` scrolls the matching `<canvas>` slot into view on first render, `#height=N` sizes the scroll container.",rendersAs:`Pdf`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``,r=typeof e.anchor==`string`?e.anchor:``;return{src:e.src,title:t??n,anchor:r}},serialize:wK},{name:`HtmlDetailsAccordion`,surface:`compat`,hasChildren:!0,props:dK,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="${SK(n.name)}"`:``,a=n?.id?` id="${SK(n.id)}"`:``,o=n?.title?.trim(),s=o?`<summary>${CK(o)}</summary>`:``;return{type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:[],children:t.all(e),data:{htmlBoundary:{opener:`<details${r}${i}${a}>\n${s}`,closer:`</details>`}}}}},{name:`DollarMath`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:gK,icon:`Sigma`,category:`content`,displayName:`Dollar Math`,description:"Block math via `$$…$$` syntax — read-only compat. Preserves `$$…$$` form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`math`,value:e.attrs.props?.formula??``})},{name:`MathFence`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:_K,icon:`Sigma`,category:`content`,displayName:`Math Fence`,description:"Block math via ` ```math ` fenced code syntax — read-only compat. Preserves the fence form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`code`,lang:`math`,meta:null,value:e.attrs.props?.formula??``})},{name:`MermaidFence`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:yK,icon:`Workflow`,category:`content`,displayName:`Mermaid Fence`,description:"Mermaid diagram via ` ```mermaid ` fenced code syntax — read-only compat. Preserves the fence form on round-trip; insert a fresh Mermaid block for the full prop surface (id, theme).",rendersAs:`Mermaid`,translateProps:e=>e,serialize:e=>({type:`code`,lang:`mermaid`,meta:null,value:e.attrs.props?.chart??``})}],EK={name:`*`,surface:`canonical`,hasChildren:!0,props:[],description:`Unregistered component — children editable as markdown`,serialize:(e,t)=>rK(e.attrs.componentName||`*`,e,t)};function DK(){let e=new Map;e.set(`*`,EK);for(let t of TK)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()}}}function OK(){let e=globalThis;return e.__okYpsCounters||={block:0,inline:0},e.__okYpsCounters}const kK={parseFallback:{blockLevel:0,wholeDoc:0},jsxRenderFailure:{},jsxAutoConvertFailed:{},jsxAutoConvertSucceeded:{},jsxPropDropped:{},jsxMoveFailed:{},jsxStuckCopyFailed:{},jsxStuckDeleteFailed:{}};function AK(){kK.parseFallback.blockLevel++}function jK(){kK.parseFallback.wholeDoc++}function MK(){let e=OK();return{parseFallback:{...kK.parseFallback},ypsMismatch:{block:e.block,inline:e.inline},jsxRenderFailure:{...kK.jsxRenderFailure},jsxAutoConvertFailed:{...kK.jsxAutoConvertFailed},jsxAutoConvertSucceeded:{...kK.jsxAutoConvertSucceeded},jsxPropDropped:{...kK.jsxPropDropped},jsxMoveFailed:{...kK.jsxMoveFailed},jsxStuckCopyFailed:{...kK.jsxStuckCopyFailed},jsxStuckDeleteFailed:{...kK.jsxStuckDeleteFailed}}}const NK=/^(`{3,}|~{3,})/gm;function PK(e){let t=[],n=null;for(let r of e.matchAll(NK)){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 FK(e,t){return t.some(([t,n])=>e>=t&&e<n)}const IK=/^[ \t]{0,3}\[([^\]]+)\]:\s*(\S+)(\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\s*$/gm;function LK(e){let t=PK(e),n=[];for(let r of e.matchAll(IK))FK(r.index,t)||n.push(r[0].trimEnd());return n.length>0?`${n.join(`
324
+ `)}case`WRITE_ERROR`:return`Failed to write config file: ${e.detail}`;case`OKIGNORE_INVALID`:return e.lineNumber===void 0?`.okignore: ${e.detail}`:`.okignore line ${e.lineNumber}: ${e.detail}`;case`UNKNOWN`:return e.message??`Unknown error.`}}const kW=`__system__`,AW=1,jW=`__config__/project`,MW=`__user__/config.yml`,NW=`__local__/project`,PW=`__config__/okignore`,FW=Object.freeze([jW,NW,MW,PW]),IW=`Ov23liqlSd0V1MwR6rhI`,LW=[`incoming`,`outgoing`,`both`];function RW(e){return LW.includes(e)}const zW=`localhost`,BW=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],VW=[`video/mp4`,`video/webm`,`video/ogg`],HW=[`audio/mpeg`,`audio/wav`,`audio/ogg`],UW=[`application/pdf`],WW=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),GW=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),KW=new Set([`pdf`]),qW=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),JW=new Set(`exe.bat.cmd.ps1.com.msi.vbs.js.jse.wsf.wsh.hta.sh.command.csh.ksh.bash.zsh.fish.desktop.action.workflow.html.htm.svg.xml.mhtml.svgz.dmg.pkg.mpkg.scpt.applescript.terminal.prefpane.webloc.inetloc.fileloc.jar.appimage.deb.rpm.msix.appx.ipa.apk.pif.scr.lnk.url`.split(`.`)),YW=new Set(`png.jpg.jpeg.gif.webp.avif.svg.apng.heic.heif.tiff.bmp.ico.pdf.mp4.webm.mov.m4v.mkv.avi.flv.wmv.mpeg.mpg.mp3.wav.ogg.m4a.flac.aac.opus.zip.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.csv.txt.rtf.json`.split(`.`)),XW=new Set(`png.jpg.jpeg.gif.webp.avif.apng.heic.heif.tiff.bmp.ico.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus`.split(`.`)),ZW=`same-dir`,QW=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`,`pdf`,`mp4`,`webm`,`mov`,`m4v`,`mkv`,`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),$W=[`png`,`jpg`,`jpeg`],eG=[`mp4`];function tG(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}tG(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,$W,WW),tG(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,eG,GW);const nG=new Set($W),rG=new Set(eG);tG(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...$W,...eG])],XW);function iG(e){let t=e.toLowerCase().replace(/^\./,``);return nG.has(t)?`image`:rG.has(t)?`video`:null}const aG=Wb.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3},meta:{default:null},sourceStyle:{default:`fenced`}}}}),oG=rx.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}},addInputRules(){return[Sb({find:Qb,type:this.type,getAttributes:{sourceDelimiter:`*`}}),Sb({find:ex,type:this.type,getAttributes:{sourceDelimiter:`_`}})]}}),sG=Zb.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}},addInputRules(){return[Sb({find:Kb,type:this.type,getAttributes:{sourceDelimiter:`**`}}),Sb({find:Jb,type:this.type,getAttributes:{sourceDelimiter:`__`}})]}}),cG=tb.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),lG=ax.extend({priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`}}}}),uG=sx.extend({priority:60,addAttributes(){return{...this.parent?.(),headingStyle:{default:`atx`},sourceTrailingHashes:{default:null},sourceUnderlineLength:{default:null}}}}),dG=R.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]}}),fG=R.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}})}}}),pG=R.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]}}),mG=[`https`,`http`,`mailto`,`tel`,`ftp`,`sms`],hG=mG.map(e=>`${e}:`).join(`|`);RegExp(`^(?:${hG}|\\/|#|\\?|\\.\\/|\\.\\.\\/)`,`i`);const gG=new Set(mG.map(e=>`${e}:`));function _G(e){try{let t=new URL(e,`https://placeholder.invalid`);return gG.has(t.protocol.toLowerCase())}catch{return!1}}const vG=yx.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:_G,validate:_G,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},sourceUrlForm:{default:null,rendered:!1},sourceTitleMarker:{default:null,rendered:!1}}}}),yG=R.create({name:`linkRefDef`,group:`block`,atom:!0,priority:60,addAttributes(){return{label:{default:``},href:{default:``},title:{default:null},sourceLayout:{default:null},sourceTitleMarker:{default:null}}},parseHTML(){return[{tag:`div[data-link-ref-def]`}]},renderHTML({node:e}){let{label:t,href:n,title:r}=e.attrs,i=r?`[${t}]: ${n} "${r}"`:`[${t}]: ${n}`;return[`div`,{"data-link-ref-def":``,class:`link-ref-def`},i]}});function bG(e){return e.type.name===`list`&&!e.attrs.ordered}function xG(e){return e.type.name===`list`&&!!e.attrs.ordered}function SG(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function CG(e,t,n,r,i,a,o){let s=Iv(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?Nf(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 Af(n,a)(e,void 0)?t?Af(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}const wG=R.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,Kv(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:CG(e,t,n,r,e=>bG(e)&&!SG(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:CG(e,t,n,r,e=>xG(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:CG(e,t,n,r,e=>bG(e)&&SG(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[Tb({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]})}),Tb({find:/^\s*(\d+)([.)])\s$/,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]})}),new qy({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=Gu(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()}}}),TG=R.create({name:`listItem`,content:`paragraph block*`,defining:!0,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`,Kv(t),0]:[`li`,Kv(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(Kv(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}}}}),EG=wG,DG=TG,OG=R.create({name:`mathInline`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{formula:{default:``},id:{default:null},language:{default:`latex`}}},parseHTML(){return[{tag:`span[data-math-inline]`,getAttrs:e=>typeof e==`string`?!1:{formula:e.getAttribute(`data-formula`)||``,id:e.getAttribute(`id`)||null,language:e.getAttribute(`data-language`)||`latex`}}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-math-inline":``,"data-formula":e.formula,"data-language":e.language,...e.id?{id:e.id}:{}}]},addCommands(){return{insertMathInline:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{formula:e}})}}}),kG=R.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}}}}),AG=MC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),jG=IC.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1}}}}),MG=R.create({name:`commentBlock`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}},sourceLayout:{default:`block`,parseHTML:e=>e.getAttribute(`data-source-layout`)===`inline`?`inline`:`block`,renderHTML:e=>e.sourceLayout===`inline`?{"data-source-layout":`inline`}:{}}}},parseHTML(){return[{tag:`aside[data-comment-block]`},{tag:`aside.comment-block`}]},renderHTML({HTMLAttributes:e}){return[`aside`,{"data-comment-block":``,"data-clipboard-omit":`true`,class:`comment-block`,style:`display: none;`,...e},0]},addCommands(){return{setCommentBlock:()=>({commands:e})=>e.wrapIn(this.name),toggleCommentBlock:()=>({commands:e})=>e.toggleWrap(this.name),unsetCommentBlock:()=>({commands:e})=>e.lift(this.name)}}}),NG=tb.create({name:`comment`,priority:10,excludes:``,inclusive:!1,addAttributes(){return{sourceForm:{default:`percent`,parseHTML:e=>e.getAttribute(`data-source-form`)===`html`?`html`:`percent`,renderHTML:e=>e.sourceForm===`html`?{"data-source-form":`html`}:{}}}},parseHTML(){return[{tag:`span[data-comment-mark]`}]},renderHTML({HTMLAttributes:e}){return[`span`,{"data-comment-mark":``,"data-clipboard-omit":`true`,class:`comment-mark`,style:`display: none;`,...e},0]},addCommands(){return{setComment:()=>({commands:e})=>e.setMark(this.name),toggleComment:()=>({commands:e})=>e.toggleMark(this.name),unsetComment:()=>({commands:e})=>e.unsetMark(this.name)}}}),PG=R.create({name:`footnoteDefinition`,group:`block`,content:`block+`,defining:!0,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){let e=e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}};return[{tag:`aside[data-footnote-def]`,getAttrs:e},{tag:`aside.footnote-def`,getAttrs:e}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.identifier??``);return[`aside`,{...t,"data-footnote-def":``,"data-footnote-id":n,id:`fn-${n}`,class:`footnote-def`},[`div`,{class:`footnote-body`},0],[`a`,{href:`#fnref-${n}`,class:`footnote-backref`,contentEditable:`false`,"aria-label":`Back to reference`},`↩`]]},addCommands(){return{insertFootnoteDefinition:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e},content:[{type:`paragraph`}]})}}}),FG=R.create({name:`footnoteReference`,group:`inline`,inline:!0,atom:!0,selectable:!0,draggable:!1,priority:60,addAttributes(){return{identifier:{default:``},label:{default:null}}},parseHTML(){return[{tag:`sup[data-footnote-ref]`,getAttrs:e=>{if(typeof e==`string`)return!1;let t=e.getAttribute(`data-footnote-id`)||``;return{identifier:t,label:t||null}}}]},renderHTML({node:e}){let t=String(e.attrs.identifier??``);return[`sup`,{id:`fnref-${t}`,"data-footnote-ref":``,"data-footnote-id":t,class:`footnote-ref`},[`a`,{href:`#fn-${t}`,class:`footnote-ref-link`},`[${t}]`]]},addCommands(){return{insertFootnoteReference:e=>({commands:t})=>t.insertContent({type:this.name,attrs:{identifier:e,label:e}})}}}),IG=R.create({name:`imageReference`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{alt:{default:``},label:{default:``},identifier:{default:``},referenceType:{default:`shortcut`}}},parseHTML(){return[{tag:`img[data-image-reference]`}]},renderHTML({node:e}){let{alt:t,label:n,referenceType:r}=e.attrs,i=t||n;return[`img`,{"data-image-reference":``,"data-reference-type":r,"data-label":n,alt:i}]}}),LG=tb.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]}});function RG(e,t){if(typeof e!=`string`||typeof t!=`string`||/[\x00-\x1F\x7F]/.test(e))return!1;let n=e.replaceAll(`\xA0`,` `),r=t.replaceAll(`\xA0`,` `);return n===r?!0:zG(n)===r}function zG(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}const BG=kC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null}}}}),VG=R.create({name:`tag`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{value:{default:``}}},parseHTML(){return[{tag:`a[data-tag]`,getAttrs:e=>typeof e==`string`?!1:{value:e.getAttribute(`data-tag`)||``}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.value??``);return[`a`,{...t,"data-tag":n,href:`#tag/${n}`,class:`tag`},`#${n}`]},addCommands(){return{insertTag:e=>({chain:t})=>t().insertContent({type:`tag`,attrs:{value:e}}).run()}}}),HG=/^(?:---|—-|___\s|\*\*\*\s)$/;function UG(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}const WG=zC.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[Cb({find:HG,type:this.type,getAttributes:e=>({sourceRaw:UG(e)})})]}});function GG(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function KG(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const qG=R.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:GG(e.getAttribute(`data-alias`)),anchor:GG(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:GG(e.getAttribute(`data-alias`)),anchor:GG(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=GG(e.attrs.alias),i=GG(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`},KG({target:n,alias:r,anchor:i})]}});function JG(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function YG(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const XG=[fG,kG,pG,OG,qG,R.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:GG(e.getAttribute(`data-alias`)),anchor:GG(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=GG(e.attrs.alias),i=GG(e.attrs.anchor),a=GG(e.attrs.resolvedSrc),o=JG(n);if(WW.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`},YG({target:n,alias:r,anchor:i})]}}),VG,EG,DG,oG,sG,jG,aG,AG,uG,WG,vG,dG,yG,lG,cG,LG,pT.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,blockquote:!1,dropcursor:{color:`color-mix(in oklch, var(--primary) 50%, transparent)`,width:2}}),BG.configure({resizable:!0}),gC,hC,mC,wx.configure({inline:!0}),IG,Sx,NG,MG,FG,PG],ZG=/^[a-zA-Z][\w/-]*$/;function QG(e){return e.startsWith(`#`)?e.slice(1):e}function $G(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function eK(e){if(!e||e.trim()===``)return[];let{map:t}=tW(e);if(!t)return[];let n=$G(t.tags),r=[];for(let e of n){let t=QG(e);ZG.test(t)?r.push(t):console.warn(`[frontmatter-tags] dropping invalid tag entry: ${JSON.stringify(e)}`)}return r}function tK(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=nK(e,t);r>=0?n[r]=o:n.push(o)}return n}function nK(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 rK(e,t,n,r){return{type:`mdxJsxFlowElement`,name:e,attributes:tK(t,r),children:n.all(t),data:{}}}const iK=[{name:`type`,type:`enum`,enumValues:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`],defaultValue:`note`,required:!1,description:`Callout 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`}],aK=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Image source URL`,accept:BW,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)`},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`}],oK=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Video source URL`,accept:VW,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`}],sK=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Audio source URL`,accept:HW,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`}],cK=[{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`}],lK=[iK[0],iK[1],iK[4],iK[5],iK[6]],uK=[aK[0],aK[1],aK[7]],dK=[cK[0],cK[1],cK[4],cK[5]],fK=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Alt text (Obsidian alias syntax: `![[file.png|alt text]]`)"}],pK=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[clip.mp4|title]]`)"}],mK=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[song.mp3|title]]`)"}],hK=[{name:`formula`,type:`string`,required:!0,autoFocus:!0,description:`LaTeX math source (rendered with KaTeX in the browser)`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#eq-pythagoras`)"},{name:`language`,type:`string`,required:!1,advanced:!0,description:"Forward-compat hint for the math source language (default `latex`). Reserved for future MathJax / Typst / AsciiMath substrates."}],gK=[hK[0]],_K=[hK[0]],vK=[{name:`chart`,type:`string`,required:!0,autoFocus:!0,description:`Mermaid chart source (graph / flowchart / sequenceDiagram / class / state / etc.)`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#system-arch-diagram`)"},{name:`theme`,type:`enum`,enumValues:[`default`,`dark`,`forest`,`neutral`],defaultValue:`default`,required:!1,advanced:!0,description:"Mermaid theme — default ships only `default` styling; alternates land alongside theme-switching infrastructure"}],yK=[vK[0]],bK=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[doc.pdf|title]]`)"}],xK=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`PDF source URL`,accept:UW,autoFocus:!0},{name:`title`,type:`string`,required:!1,advanced:!0,description:`Accessible label for the embedded PDF viewer`},{name:`anchor`,type:`string`,required:!1,advanced:!0,description:"PDF viewer parameters as a single URL-fragment string (e.g. `page=3&height=600`)"}];function SK(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function CK(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function wK(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}]}}const TK=[{name:`Callout`,surface:`canonical`,hasChildren:!0,props:iK,icon:`MessageSquareWarning`,category:`content`,displayName:`Callout`,description:`Alert / admonition with 15 type variants — 5 GFM (note, tip, important, warning, caution) plus 10 Obsidian-parity (abstract, info, todo, success, question, failure, danger, bug, example, quote)`,searchTerms:[`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`,`alert`,`admonition`,`callout`],serialize:(e,t)=>rK(`Callout`,e,t,iK)},{name:`img`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:aK,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)=>rK(`img`,e,t,aK)},{name:`video`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:oK,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)=>rK(`video`,e,t,oK)},{name:`audio`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:sK,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)=>rK(`audio`,e,t,sK)},{name:`Pdf`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:xK,icon:`FileText`,category:`media`,displayName:`PDF`,description:"Embedded PDF viewer (`#page=N` to open at page N, `#height=N` for viewer height)",searchTerms:[`pdf`,`document`,`embed`,`pdfjs`],placeholder:{label:`Add a PDF`},serialize:(e,t)=>rK(`Pdf`,e,t,xK)},{name:`Accordion`,surface:`canonical`,hasChildren:!0,props:cK,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)=>rK(`Accordion`,e,t,cK)},{name:`Math`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:hK,icon:`Sigma`,category:`content`,displayName:`Math`,description:`Block math equation rendered with KaTeX from a LaTeX source string`,searchTerms:[`math`,`latex`,`equation`,`formula`,`katex`,`tex`],serialize:(e,t)=>rK(`Math`,e,t,hK)},{name:`Mermaid`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:vK,icon:`Workflow`,category:`content`,displayName:`Mermaid`,description:`Diagram rendered from Mermaid source (flowchart, sequence, class, state, ER, gantt, pie)`,searchTerms:[`mermaid`,`diagram`,`flowchart`,`graph`,`sequence`,`sequencediagram`,`class`,`state`,`er`,`erdiagram`,`gantt`,`pie`,`chart`],serialize:(e,t)=>rK(`Mermaid`,e,t,vK)},{name:`GFMCallout`,surface:`compat`,hasChildren:!0,props:lK,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`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`]),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:uK,icon:`Image`,category:`media`,displayName:`CommonMark Image`,description:'CommonMark image (`![alt](src "title")`) — read-only compat. Preserves `![alt](src)` 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:fK,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:wK},{name:`WikiEmbedVideo`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:pK,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:wK},{name:`WikiEmbedAudio`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:mK,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:wK},{name:`WikiEmbedPdf`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:bK,icon:`FileText`,category:`media`,displayName:`Wiki Embed PDF`,description:"Obsidian-style `![[doc.pdf]]` wiki-embed — read-only compat. Renders through the `Pdf` canonical (pdfjs-dist multi-page canvas viewer with custom toolbar). Edit the title via the alias slot; `#page=N` scrolls the matching `<canvas>` slot into view on first render, `#height=N` sizes the scroll container.",rendersAs:`Pdf`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.target==`string`?e.target:``,r=typeof e.anchor==`string`?e.anchor:``;return{src:e.src,title:t??n,anchor:r}},serialize:wK},{name:`HtmlDetailsAccordion`,surface:`compat`,hasChildren:!0,props:dK,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="${SK(n.name)}"`:``,a=n?.id?` id="${SK(n.id)}"`:``,o=n?.title?.trim(),s=o?`<summary>${CK(o)}</summary>`:``;return{type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:[],children:t.all(e),data:{htmlBoundary:{opener:`<details${r}${i}${a}>\n${s}`,closer:`</details>`}}}}},{name:`DollarMath`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:gK,icon:`Sigma`,category:`content`,displayName:`Dollar Math`,description:"Block math via `$$…$$` syntax — read-only compat. Preserves `$$…$$` form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`math`,value:e.attrs.props?.formula??``})},{name:`MathFence`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:_K,icon:`Sigma`,category:`content`,displayName:`Math Fence`,description:"Block math via ` ```math ` fenced code syntax — read-only compat. Preserves the fence form on round-trip; insert a fresh Math block for the full prop surface (id, language).",rendersAs:`Math`,translateProps:e=>e,serialize:e=>({type:`code`,lang:`math`,meta:null,value:e.attrs.props?.formula??``})},{name:`MermaidFence`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:yK,icon:`Workflow`,category:`content`,displayName:`Mermaid Fence`,description:"Mermaid diagram via ` ```mermaid ` fenced code syntax — read-only compat. Preserves the fence form on round-trip; insert a fresh Mermaid block for the full prop surface (id, theme).",rendersAs:`Mermaid`,translateProps:e=>e,serialize:e=>({type:`code`,lang:`mermaid`,meta:null,value:e.attrs.props?.chart??``})}],EK={name:`*`,surface:`canonical`,hasChildren:!0,props:[],description:`Unregistered component — children editable as markdown`,serialize:(e,t)=>rK(e.attrs.componentName||`*`,e,t)};function DK(){let e=new Map;e.set(`*`,EK);for(let t of TK)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()}}}function OK(){let e=globalThis;return e.__okYpsCounters||={block:0,inline:0},e.__okYpsCounters}const kK={parseFallback:{blockLevel:0,wholeDoc:0},jsxRenderFailure:{},jsxAutoConvertFailed:{},jsxAutoConvertSucceeded:{},jsxPropDropped:{},jsxMoveFailed:{},jsxStuckCopyFailed:{},jsxStuckDeleteFailed:{}};function AK(){kK.parseFallback.blockLevel++}function jK(){kK.parseFallback.wholeDoc++}function MK(){let e=OK();return{parseFallback:{...kK.parseFallback},ypsMismatch:{block:e.block,inline:e.inline},jsxRenderFailure:{...kK.jsxRenderFailure},jsxAutoConvertFailed:{...kK.jsxAutoConvertFailed},jsxAutoConvertSucceeded:{...kK.jsxAutoConvertSucceeded},jsxPropDropped:{...kK.jsxPropDropped},jsxMoveFailed:{...kK.jsxMoveFailed},jsxStuckCopyFailed:{...kK.jsxStuckCopyFailed},jsxStuckDeleteFailed:{...kK.jsxStuckDeleteFailed}}}const NK=/^(`{3,}|~{3,})/gm;function PK(e){let t=[],n=null;for(let r of e.matchAll(NK)){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 FK(e,t){return t.some(([t,n])=>e>=t&&e<n)}const IK=/^[ \t]{0,3}\[([^\]]+)\]:\s*(\S+)(\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\s*$/gm;function LK(e){let t=PK(e),n=[];for(let r of e.matchAll(IK))FK(r.index,t)||n.push(r[0].trimEnd());return n.length>0?`${n.join(`
325
325
  `)}\n\n`:``}function RK(e,t){let n={startMs:typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),calls:0};return VK(e,t.parse,0,n)}function zK(e){return e.calls>=1e3?!0:(typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now())-e.startMs>=500}function BK(e){return e instanceof Error?{name:e.name,message:e.message.slice(0,500),stack:e.stack?.split(`
326
326
  `).slice(0,4).join(`
327
327
  `)}:{name:`UnknownError`,message:String(e??`unknown`).slice(0,500)}}function VK(e,t,n,r){if(n>20)return jK(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`MAX_SPLIT_DEPTH exceeded`})),XK(e);if(r){if(zK(r))return jK(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`parse budget exhausted`,calls:r.calls})),XK(e);r.calls+=1}try{return t(e)}catch(i){let a=HK(i),o=BK(i);if(a===void 0){if(n===0){let n=YK(e,t,i,r);if(n)return n}return jK(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:o.message,error:o})),XK(e)}AK(),console.warn(JSON.stringify({event:`mdx-block-fallback`,offset:a,reason:o.message,error:o}));try{let i=qK(e,a),s=e.slice(0,i.start),c=e.slice(i.start,i.end),l=e.slice(i.end),u=s.trim()?VK(s,t,n+1,r):{type:`doc`,content:[]},d=l.trim()?VK(LK(s)+l,t,n+1,r):{type:`doc`,content:[]},f={type:`rawMdxFallback`,attrs:{reason:o.message,originalSpan:{start:i.start,end:i.end}},content:c?[{type:`text`,text:c}]:[]},p=[...u.content??[],f,...d.content??[]];return{type:`doc`,content:p.length>0?p:[{type:`paragraph`,content:[]}]}}catch(t){jK();let n=BK(t);return console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`Recovery failed: ${n.message}`,recoveryPath:`block-split-then-rejoin`,error:n,originalError:o})),XK(e)}}}function HK(e){if(!e||typeof e!=`object`)return;let t=e;if(t.place&&typeof t.place.offset==`number`)return t.place.offset;if(t.place?.start&&typeof t.place.start.offset==`number`)return t.place.start.offset;if(t.position&&typeof t.position.offset==`number`)return t.position.offset;if(t.position?.start&&typeof t.position.start.offset==`number`)return t.position.start.offset}function UK(e,t){let n=/\n\s*\n/g,r=null;for(let i of e.matchAll(n)){if(i.index>=t)break;r=i.index+i[0].length}return r}function WK(e,t){for(let n of e.matchAll(/\n\s*\n/g))if(n.index>=t)return n.index;return null}function GK(e,t){let n=[];for(let r of e.matchAll(/<(\/?)([A-Z][A-Za-z0-9.]*)/g)){let i=r.index;if(FK(i,t))continue;let a=r[1]===`/`,o=r[2],s=i+r[0].length,c=Math.min(e.length,s+32768),l=!1,u=0,d=-1,f=!1;for(let t=s;t<c;t++){let n=e[t];if(l){n===`"`&&(l=!1),n===`\\`&&t+1<c&&t++;continue}if(n===`"`){l=!0;continue}if(n===`{`){u++;continue}if(n===`}`&&u>0){u--;continue}if(!(u>0)&&n===`>`){d=t,t>0&&e[t-1]===`/`&&(f=!0);break}}if(d===-1)continue;let p=d+1;a?n.push({kind:`close`,name:o,start:i,end:p}):f?n.push({kind:`self-close`,name:o,start:i,end:p}):n.push({kind:`open`,name:o,start:i,end:p})}return n}function KK(e){let t=GK(e,PK(e)),n=[],r=[];for(let i of t){if(i.kind===`self-close`)continue;if(i.kind===`open`){n.push(i);continue}let t=-1;for(let e=n.length-1;e>=0;e--)if(n[e].name===i.name){t=e;break}if(t!==-1){for(let a=n.length-1;a>t;a--){let t=n[a],o=WK(e,t.start)??e.length;r.push({start:t.start,end:Math.min(i.start,o),source:`unmatched`})}r.push({start:n[t].start,end:i.end,source:`pair`}),n.length=t}}for(let t of n){let n=WK(e,t.start)??e.length;r.push({start:t.start,end:Math.min(e.length,n),source:`unmatched`})}return r}function qK(e,t){let n=KK(e),r=null;for(let e of n)e.start<=t&&t<=e.end&&(!r||e.end-e.start<r.end-r.start)&&(r=e);return r?{start:r.start,end:r.end}:{start:UK(e,t)??0,end:WK(e,t)??e.length}}function JK(e){let t=PK(e),n=/\n[ \t]*\n/g,r=[0];for(let i of e.matchAll(n)){let e=i.index;FK(e,t)||r.push(e+i[0].length)}r.push(e.length);let i=[];for(let t=0;t<r.length-1;t++){let n=r[t],a=r[t+1];if(a<=n)continue;let o=e.slice(n,a);o.trim()&&i.push({src:o,start:n,end:a})}return i}function YK(e,t,n,r){let i=JK(e);if(i.length<2)return null;let a=[],o=!1,s=``;for(let e of i){if(r&&zK(r))break;r&&(r.calls+=1);let i=s+e.src;try{let n=t(i).content??[];s+=LK(e.src);let r=n.filter(e=>e.type!==`paragraph`||Array.isArray(e.content)&&e.content.length>0);if(r.length===0&&n.length>0){o=!0;continue}a.push(...r),o=!0}catch(t){AK();let r=t?.message?.slice(0,200)??`unknown block error`,i=n?.message?.slice(0,160)??`unknown`;console.warn(JSON.stringify({event:`mdx-block-fallback`,offset:e.start,reason:`Per-block recovery after position-less error: ${i}`,blockError:r,blockErrorName:t?.name})),a.push({type:`rawMdxFallback`,attrs:{reason:r,originalSpan:{start:e.start,end:e.end}},content:[{type:`text`,text:e.src}]})}}return o?{type:`doc`,content:a.length>0?a:[{type:`paragraph`,content:[]}]}:null}function XK(e){return{type:`doc`,content:[{type:`paragraph`,content:[{type:`text`,text:e}]}]}}const ZK=/<([a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>]+)>/g,QK=/<!--[\s\S]*?-->/g,$K=/<\/([a-z][a-z0-9]*)\s*>/g,eq=/<([a-z][a-z0-9]*)(\s[^>]*)?\/?>/g,tq=new Set([`img`,`video`,`audio`]),nq=new Set([`mark`]),rq=/<\/([A-Z][A-Za-z0-9.]*)>/g;function iq(e,t){let n=0,r=e.length;for(;n<r;){let i=n+r>>>1;e[i]<t?n=i+1:r=i}return n}function aq(e){let t=new Map,n=new RegExp(rq.source,`g`),r=n.exec(e);for(;r!==null;){let i=t.get(r[1]);i?i.push(r.index):t.set(r[1],[r.index]),r=n.exec(e)}return t}function oq(e){let t=[],n=/\n\s*\n/g,r=n.exec(e);for(;r!==null;)t.push(r.index),r=n.exec(e);return t}function sq(e){let t=[],n=e.indexOf(`/>`);for(;n!==-1;)t.push(n),n=e.indexOf(`/>`,n+2);return t}function cq(e){let t=e;t=t.replace(QK,e=>e.replace(/</g,``).replace(/>/g,``)),t=t.replace(ZK,(e,t)=>`${t.replaceAll(`:`,``).replaceAll(`@`,``)}`),t=t.replace($K,(e,t)=>nq.has(t)?e:e.replace(/</g,``).replace(/>/g,``)),t=t.replace(eq,(e,t)=>tq.has(t)&&e.endsWith(`/>`)||nq.has(t)?e:t[0]===t[0].toLowerCase()&&t[0]!==t[0].toUpperCase()?e.replace(/</g,``).replace(/>/g,``):e),t=t.replace(/<>/g,``);let n=aq(t),r=oq(t),i=sq(t);t=t.replace(/</g,(e,a)=>{let o=t.slice(a,a+256);if(o[1]===`/`)return/^<\/[a-zA-Z][a-zA-Z0-9.]*[ \t]*>/.test(o)?e:``;let s=/^<([a-z][a-z0-9]*)([^>]*)\/>/.exec(o);if(s&&tq.has(s[1]))return e;let c=/^<([a-z][a-z0-9]*)([\s/>])/.exec(o);if(c&&nq.has(c[1])){let n=c[1];return o.startsWith(`<${n}/>`)||t.indexOf(`</${n}>`,a)!==-1?e:``}let l=/^<([A-Z][a-zA-Z0-9.]*)[\s/>]/.exec(o);if(!l)return``;let u=l[1],d=iq(r,a),f=iq(i,d<r.length?r[d]:t.length);if(f>0){let n=i[f-1];if(n>a){let r=a+l[0].length-1;if(!t.slice(r,n).replace(/"[^"]*"|'[^']*'/g,``).includes(`/`))return e}}let p=n.get(u);return p&&iq(p,a)<p.length?e:``});{let e=[],n=[];for(let r=0;r<t.length;r++){if(t[r]===`
@@ -356,4 +356,4 @@ $2`).split(`
356
356
  `:`
357
357
  `;return l.join(f)},table(e,t,n,r){let i=n.enter(`table`),a=[],o=e.children??[];for(let e of o){let t=e.children??[],i=[];for(let e of t){let t=n.enter(`tableCell`),a=n.enter(`phrasing`),o=n.containerPhrasing(e,{...r,before:` `,after:` `});a(),t(),i.push(o)}a.push(i)}i();let s=e.align??[],c=e.data?.sourceDashCounts,l=a[0]?.length??0,u=a.slice(1).reduce((e,t)=>Math.max(e,t.length),0),d=Math.max(l,u,s.length),f=[];for(let e=0;e<d;e++){let t=s[e],n=``,r=``;t===`center`?(n=`:`,r=`:`):t===`left`?n=`:`:t===`right`&&(r=`:`);let i=c?.[e],a=typeof i==`number`&&i>=1?i:1;f.push(n+`-`.repeat(a)+r)}let p=e=>{let t=[...e];for(;t.length<d;)t.push(``);return`| ${t.join(` | `)} |`};if(a.length===0)return p(f);let m=[];m.push(p(a[0])),m.push(p(f));for(let e=1;e<a.length;e++)m.push(p(a[e]));return m.join(`
358
358
  `)},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=ZJ(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}`},mark(e,t,n,r){let i=n.createTracker(r),a=n.enter(`mark`),o=i.move(`==`);return o+=n.containerPhrasing(e,{before:o,after:`==`,...i.current()}),o+=i.move(`==`),a(),o},comment(e,t,n,r){let i=e.data?.sourceForm,a=i===`html`?`<!-- `:`%%`,o=i===`html`?` -->`:`%%`,s=n.createTracker(r),c=n.enter(`comment`),l=s.move(a);return l+=n.containerPhrasing(e,{before:l,after:o,...s.current()}),l+=s.move(o),c(),l},commentBlock(e,t,n,r){let i=n.createTracker(r),a=n.enter(`commentBlock`),o=e.children??[],s=e.data?.sourceForm,c=e.data?.sourceLayout,l=o.length===1&&o[0]?.type===`paragraph`;if(s===`html`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`<!-- `,after:` -->`,...i.current()});return a(),`<!-- ${t} -->`}if(c===`inline`&&l){let e=o[0],t=n.containerPhrasing(e,{before:`%% `,after:` %%`,...i.current()});return a(),`%% ${t} %%`}let u=n.containerFlow(e,i.current());return a(),`%%\n\n${u}\n\n%%`},mdxJsxTextElement(e){let t=e.data?.sourceRaw;if(typeof t==`string`)return t;let n=e.name??``,r=ZJ(e.attributes??[]);return r?`<${n} ${r} />`:`<${n}/>`},rawMdxFallback(e){return e.value??``},blockquote(e,t,n,r){let i=n.enter(`blockquote`),a=n.createTracker(r);a.move(`> `),a.shift(2);let o=n.containerFlow(e,a.current());i();let s=e.data?.sourceMarkerSpacings,c=0;return n.indentLines(o,(e,t,n)=>n?`>`:s?.[c++]===`none`?`>${e}`:`> ${e}`)}};function ZJ(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 QJ(e,t,n=` `){return t===`single`?`${n}'${e.replace(/'/g,`\\'`)}'`:t===`paren`?`${n}(${e.replace(/[()]/g,`\\$&`)})`:`${n}"${e.replace(/"/g,`\\"`)}"`}function $J(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 eY(e){return e.replace(/(?<!\\)&(?=[A-Za-z][A-Za-z0-9]*;|#[0-9]+;|#[xX][0-9A-Fa-f]+;)/g,`\\&`)}function tY(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===`(`||e.character==="`"));let i;try{i=e.safe(t,n)}finally{e.unsafe=r}return eY(i)}var nY=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};constructor(e){this.schema=ny(e.extensions),this.handlers=fY(this.schema,this.parseCtx);let{nodeHandlers:t,markHandlers:n}=pY(this.schema);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=GJ({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=KJ({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers,toMarkdownHandlers:XJ})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return qJ(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?JJ(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?RK(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 YJ(t,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}};const rY=DK();function iY(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 aY(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 oY(e){return e.attrs.sourceDirty||aY(e)}function sY(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 cY(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),Object.keys(n).length===0?e:{...e,data:n}}function lY(e,t){if(e.length===0)return cY({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return cY({type:`inlineCode`,value:e.map(e=>e.value).join(``)},t);if(e.length===1&&`children`in e[0]){let n=e[0];return{...n,children:[lY(n.children,t)]}}return cY({type:`inlineCode`,value:uY(e)},t)}function uY(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=uY(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}const dY=WW;function fY(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=dL(n.blockquote,e=>({sourceMarkerSpacings:e.data?.sourceMarkerSpacings??null}))),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.tableRow&&(i.tableRow=dL(n.tableRow)),n.table&&n.tableRow&&n.tableCell&&(i.table=(e,t,r)=>{let i=e.align??[],a=e.children??[],o=[];for(let e=0;e<a.length;e++){let t=a[e];if(t.type!==`tableRow`)continue;let s=t.children??[],c=[];for(let t=0;t<s.length;t++){let a=s[t];if(a.type!==`tableCell`)continue;let o=r.all(a).flat(),l=o.length>0&&n.paragraph?[n.paragraph.create(null,o)]:null,u=i[t]??null,d=(e===0&&n.tableHeader?n.tableHeader:n.tableCell).createAndFill({align:u},l);d&&c.push(d)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null;return n.table.createAndFill({sourceDashCounts:s},o.length>0?o:null)}),n.image&&(i.image=e=>n.image.createAndFill({src:e.url??``,alt:e.alt??null,title:e.title??null}),n.imageReference?i.imageReference=e=>n.imageReference.createAndFill({alt:e.alt??``,label:e.label??e.identifier??``,identifier:e.identifier??``,referenceType:e.referenceType??`shortcut`}):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({sourceFenceChar:t.data?.sourceFenceChar??"`",sourceFenceLength:typeof t.data?.sourceFenceLength==`number`?t.data.sourceFenceLength:1})]));let a=r.strike??r.delete;if(a&&(i.delete=fL(a)),r.highlight&&(i.mark=fL(r.highlight)),r.comment&&(i.comment=fL(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=dL(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=fL(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=fL(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=dL(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null}))),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,sourceStyle:t.data?.sourceStyle??`fenced`},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=dL(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=dL(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,sourceUrlForm:n.data?.sourceUrlForm??null,sourceTitleMarker:n.data?.sourceTitleMarker??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,r=!!o.spec.attrs?.sourceLayout,a=!!o.spec.attrs?.sourceTitleMarker;i.definition=i=>{let s={title:i.title??null};return n&&(s.identifier=i.identifier??``),s.label=i.label??i.identifier??``,e?s.url=i.url??``:t&&(s.href=i.url??``),r&&(s.sourceLayout=i.data?.sourceLayout??null),a&&(s.sourceTitleMarker=i.data?.sourceTitleMarker??null),o.createAndFill(s)}}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=rY.getOrWildcard(a),s=iY(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)};let r=(e,t)=>{let n=e.attributes?.find(e=>e.type===`mdxJsxAttribute`&&e.name===t);return n&&typeof n.value==`string`?n.value:null};i.mdxJsxTextElement=i=>{if(i.name===`InlineMath`&&n.mathInline){let e=r(i,`formula`)??``,t=r(i,`id`);return n.mathInline.create({formula:e,id:t??null})}if(i.name===`Tag`&&n.tag){let e=r(i,`value`)??``;return n.tag.create({value:e})}if(n.jsxInline){let r=t(i.data)??``;return n.jsxInline.createAndFill({},r?[e.text(r)]:null)}return n.jsxComponent.createAndFill({sourceRaw:t(i.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.tag&&(i.tag=e=>n.tag.createAndFill({value:e.value})),n.wikiLinkEmbed&&(i.wikiLinkEmbed=(i,a)=>{let o=i.data?.target??``,s=i.data?.alias??null,c=i.data?.anchor??null,l=JG(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&&dY.has(l)&&n.jsxComponent&&rY.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&&GW.has(l)&&n.jsxComponent&&rY.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&&qW.has(l)&&n.jsxComponent&&rY.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}});if(m&&KW.has(l)&&n.jsxComponent&&rY.has(`WikiEmbedPdf`))return n.jsxComponent.createAndFill({componentName:`WikiEmbedPdf`,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(QW.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 n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``})),i.math||=s,i.inlineMath||=c,n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=c,n.footnoteDefinition&&(i.footnoteDefinition=dL(n.footnoteDefinition,e=>{let t=e;return{identifier:t.identifier,label:t.label??t.identifier}})),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 pY(e){let t={},n={},r=e.nodes,i=e.marks;if(r.paragraph&&(t.paragraph=_L(`paragraph`)),r.blockquote&&(t.blockquote=_L(`blockquote`,e=>{let t=e.attrs.sourceMarkerSpacings,n={};return Array.isArray(t)&&t.length>0&&(n.sourceMarkerSpacings=t),Object.keys(n).length>0?{data:n}:{}})),r.heading&&(t.heading=_L(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0}}))),r.codeBlock&&(t.codeBlock=e=>{let t=e.attrs.sourceStyle===`indented`?`indented`:`fenced`;return{type:`code`,lang:t===`indented`?null:e.attrs.language??null,meta:t===`indented`?null:e.attrs.meta??null,value:e.textContent??``,data:{sourceFenceChar:e.attrs.fenceDelimiter,sourceFenceLength:e.attrs.fenceLength,sourceStyle:t}}}),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=_L(`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&&sY(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=(e,t,n)=>{let r=n.all(e),i=[],a=e.firstChild;a&&a.forEach(e=>{let t=e.attrs.align;i.push(t===`left`||t===`right`||t===`center`?t:null)});let o=r.filter(e=>e.type===`tableRow`),s=e.attrs.sourceDashCounts,c=Array.isArray(s)&&s.length>0?{sourceDashCounts:s}:void 0,l={type:`table`,align:i,children:o};return c&&(l.data=c),l}),r.tableRow&&(t.tableRow=_L(`tableRow`)),r.tableCell&&(t.tableCell=_L(`tableCell`)),r.tableHeader&&(t.tableHeader=_L(`tableCell`)),r.image&&(t.image=e=>({type:`image`,url:e.attrs.src,alt:e.attrs.alt,title:e.attrs.title})),r.imageReference&&(t.imageReference=e=>{let t=e.attrs.label??``,n=e.attrs.identifier??t;return{type:`imageReference`,alt:e.attrs.alt??``,identifier:n,label:t||n,referenceType:e.attrs.referenceType??`shortcut`}}),r.htmlBlock&&(t.htmlBlock=e=>({type:`html`,value:e.attrs.content})),r.linkDefinition??r.linkRefDef){let e=r.linkDefinition?`linkDefinition`:`linkRefDef`;t[e]=e=>{let t={},n=e.attrs.sourceLayout;(n===`multiline`||n===`inline`)&&(t.sourceLayout=n);let r=e.attrs.sourceTitleMarker;(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r);let i={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};return Object.keys(t).length>0&&(i.data=t),i}}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!oY(e)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:r,attributes:i,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:rY.getOrWildcard(r??`*`).serialize(e,{all:e=>n.all(e),registry:rY,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.mathInline&&(t.mathInline=e=>{let t=e.attrs.formula??``,n=e.attrs.id;return typeof n==`string`&&n.length>0?{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]}:{type:`inlineMath`,value: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.tag&&(t.tag=e=>({type:`tag`,value:String(e.attrs.value??``)})),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=vL(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.strong&&(n.strong=vL(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.code&&(n.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return lY(n,{sourceFenceChar:r,sourceFenceLength:i})}),i.strike??i.delete){let e=i.strike?`strike`:`delete`;n[e]=vL(`delete`)}return i.highlight&&(n.highlight=vL(`mark`)),i.comment&&(n.comment=vL(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),r.commentBlock&&(t.commentBlock=_L(`commentBlock`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`,sourceLayout:e.attrs.sourceLayout===`inline`?`inline`:`block`}}))),r.footnoteReference&&(t.footnoteReference=e=>{let t=String(e.attrs.identifier??``);return{type:`footnoteReference`,identifier:t,label:e.attrs.label?String(e.attrs.label):t}}),r.footnoteDefinition&&(t.footnoteDefinition=_L(`footnoteDefinition`,e=>({identifier:String(e.attrs.identifier??``),label:e.attrs.label?String(e.attrs.label):String(e.attrs.identifier??``)}))),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;if(r===`autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`autolink`}};if(r===`gfm-autolink`)return{type:`link`,url:e.attrs.href??``,title:null,children:n,data:{sourceStyle:`gfm-autolink`}};if(r===`inline`||!r){let t={};e.attrs.sourceUrlForm===`angle-bracketed`&&(t.sourceUrlForm=`angle-bracketed`);let r=e.attrs.sourceTitleMarker;return(r===`single`||r===`double`||r===`paren`)&&(t.sourceTitleMarker=r),{type:`link`,url:e.attrs.href??``,title:e.attrs.title??null,children:n,...Object.keys(t).length>0?{data:t}:{}}}return{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],t=r||e.value;return RG(t,e.value)&&(e.data=e.data??{},e.data.sourceRaw=t),e}return{type:`text`,value:n.filter(e=>e.type===`text`).map(e=>e.value??``).join(``)||r}}),{nodeHandlers:t,markHandlers:n}}const mY=/\p{M}+/gu,hY=/[^\p{L}\p{N}]+/gu,gY=/^-+|-+$/g;function _Y(e){return e.trim().normalize(`NFKD`).replace(mY,``).toLowerCase().replace(hY,`-`).replace(gY,``)}function vY(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function yY(e,t){let n=_Y(e);return n?vY(n,t):``}Ps({ok:qs(!0),serverInstanceId:j().min(1),currentBranch:j().min(1).optional(),currentDiskAckSVs:Us(j().min(1),j().min(1)).optional()}).loose(),Ps({id:j().min(1),display_name:j().min(1),display_email:j(),source:Gs([`git-config`,`synthesized`]),created_at:j().min(1)}).loose();const bY=`server-info`,xY=`branch-switched`,SY=`disk-ack`,CY=`config-validation-rejected`,wY=`config-ignore-nested-error`,TY=Gs([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`]),EY=Ps({v:qs(1),ch:qs(bY),seq:vs(),serverInstanceId:j().min(1),currentBranch:j().min(1).optional()}).loose(),DY=Ps({v:qs(1),ch:qs(xY),seq:vs(),branch:j().min(1)}).loose(),OY=Ps({v:qs(1),ch:TY,seq:vs()}).loose(),kY=Ps({v:qs(1),ch:qs(SY),seq:vs(),docName:j().min(1),sv:j().min(1)}).loose(),AY=Ps({v:qs(1),ch:qs(CY),seq:vs(),docName:j().min(1),error:EW}).loose(),jY=Ps({v:qs(1),ch:qs(wY),seq:vs(),path:j().min(1),error:j().min(1)}).loose(),MY={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},NY=new WeakMap;function PY(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function FY(e){return e.trim().toLowerCase()}function IY(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function LY(e){return e.split(`/`).filter(Boolean).join(` `)}function RY(e){let t=IY(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0;return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:LY(e.path),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}function zY(e){let t=XH({schema:MY});return e.length>0&&sU(t,e),t}function BY(e){let t={documents:e};return NY.set(t,zY(e)),t}function VY(e){let t=NY.get(e);if(t)return t;let n=zY(e.documents);return NY.set(e,n),n}function HY(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`]:[`page`,`folder`]}function UY(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function WY(e,t){let n=FY(t);if(!n)return 0;let r=FY(e.title),i=FY(e.name),a=FY(e.path),o=a.split(`/`);return r===n||i===n?700:a===n?650:r.startsWith(n)||i.startsWith(n)?600:o.some(e=>e.startsWith(n))?550:r.includes(n)||i.includes(n)?500:a.includes(n)?450:-1}function GY(e){let t=e.map(e=>e.modifiedTs).filter(e=>Number.isFinite(e)&&e>0);if(t.length===0)return new Map;let n=1/0,r=-1/0;for(let e of t)e<n&&(n=e),e>r&&(r=e);let i=Math.max(1,r-n);return new Map(e.map(e=>[e.id,e.modifiedTs>0?(e.modifiedTs-n)/i*50:0]))}function KY(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function qY(e){return e===`full_text`?{title:8,name:7,path:5,pathSegments:4,content:1}:e===`autocomplete`?{title:10,name:9,path:5,pathSegments:4}:{title:8,name:7,path:5,pathSegments:4}}function JY(e,t){return FY(t).length<4?0:e===`full_text`?1:0}function YY(e,t,n={}){let r=n.intent??`omnibar`,i=PY(n.limit),a=new Set(n.scopes??HY(r)),o=e.documents.filter(e=>UY(e,a)),s=FY(t);if(!s)return o.slice().sort((e,t)=>e.path.localeCompare(t.path)).slice(0,i).map(e=>({document:e,score:0,signals:{lexical:0,fullText:0,recency:0}}));let c=LU(VY(e),{term:s,properties:KY(r),boost:qY(r),tolerance:JY(r,s),limit:Math.max(i*4,40)}),l=new Map(c.hits.filter(e=>UY(e.document,a)).map(e=>[e.document.id,e.score])),u=GY(o),d=new Map;for(let e of o)WY(e,s)>=0&&d.set(e.id,e);for(let e of c.hits)UY(e.document,a)&&d.set(e.document.id,e.document);return[...d.values()].map(e=>{let t=Math.max(0,WY(e,s)),n=l.get(e.id)??0,r=u.get(e.id)??0;return{document:e,score:t+n*20+r,signals:{lexical:t,fullText:n,recency:r}}}).sort((e,t)=>e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score).slice(0,i)}const XY=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),ZY=globalThis;ZY[XY]===void 0&&(ZY[XY]=yi());const QY=ZY[XY],$Y=[`.ok`,`skill-state.yml`],eX=[`claude-cowork`,`cli-hosts`],tX=[`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`],nX=/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,rX=Fs({version:j().regex(nX,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(QY,{description:`Recorded skill version for this target.`}),recordedAt:To().register(QY,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:Gs(tX).register(QY,{description:`Install-source surface that recorded this entry.`}).optional()}),iX=Fs({schema:qs(1).register(QY,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:Fs({"claude-cowork":rX.optional(),"cli-hosts":rX.optional()}).register(QY,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({})});function aX(){return{schema:1,targets:{}}}function oX(){let e=!1,t=``,n=0;return r=>{let i=sX(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 sX(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}const cX=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],lX={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`};function uX(e,t=cX){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}const dX={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,copilot:`github`,cline:`cline`};function fX(e){return e?dX[e]??`bot`:`bot`}function pX(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}}const mX=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function hX(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function gX(e){let t=e.trim();return mX.test(t)||t.startsWith(`//`)}function _X(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=pX(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};if(gX(n)||n.startsWith(`/`))return{kind:`external`,url:n};let i=hX(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function vX(e,t){let n=e.trim();if(!n)return null;if(gX(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=hX(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function yX(e,t){let n=e.trim();if(!n||mX.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 bX(e){let t=e;return t.startsWith(`./`)&&(t=t.slice(2)),t.startsWith(`/`)&&(t=t.slice(1)),t}function xX(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function SX(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function CX(e){return e.split(`/`).filter(e=>e!==``)}function wX(e,t){let n=SX(t);return e===``||n===e?!0:n.startsWith(`${e}/`)}function TX(e,t){let n=SX(t);if(e===n)return 0;let r=e===``?n:n.slice(e.length+1);return r===``?0:CX(r).length}function EX(e,t){let n=CX(e),r=CX(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return n.length-i+(r.length-i)}function DX(){let e=new Map;function t(t){let n=bX(t);if(n===``)return;let r=xX(n);if(r===``)return;let i=r.toLowerCase(),a=e.get(i);if(!a){e.set(i,[n]);return}a.includes(n)||a.push(n)}function n(t){let n=bX(t),r=xX(n).toLowerCase(),i=e.get(r);if(!i)return;let a=i.indexOf(n);a!==-1&&(i.splice(a,1),i.length===0&&e.delete(r))}function r(e,r){n(e),t(r)}function i(t,n){let r=t.toLowerCase(),i=e.get(r);if(!i||i.length===0)return null;if(i.length===1)return i[0];let a=SX(bX(n)),o=[],s=[];for(let e of i)wX(a,e)?o.push(e):s.push(e);return o.length>0?(e=>{let t=e[0],n=TX(a,t);for(let r=1;r<e.length;r++){let i=e[r],o=TX(a,i);(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(o):(e=>{let t=e[0],n=EX(a,SX(t));for(let r=1;r<e.length;r++){let i=e[r],o=EX(a,SX(i));(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(s)}function a(){let t=new Map;for(let[n,r]of e)t.set(n,[...r]);return t}function o(){e.clear()}return{add:t,remove:n,rename:r,resolveEmbed:i,clear:o,snapshot:a,size:()=>e.size}}function OX(e){if(!e)return[];let t=e.split(`/`),n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);return n}function kX(e,t){if(e.size===0)return new Set;if(t===``)return new Set(e);let n=new Set,r=`${t}/`;for(let i of e)(i===t||i.startsWith(r))&&n.add(i);return n}export{fX as $,Oa as $t,eX as A,Gs as At,oX as B,vs as Bt,IW as C,Uc as Ct,nY as D,kc as Dt,XW as E,Oc as Et,GU as F,hc as Ft,vW as G,j as Gt,BY as H,Zs as Ht,_X as I,zs as It,eK as J,es as Jt,aX as K,Ls as Kt,vX as L,Vs as Lt,kW as M,Es as Mt,iX as N,Ms as Nt,LW as O,_s as Ot,KU as P,Ss as Pt,OW as Q,Da as Qt,uX as R,qs as Rt,ZW as S,Lc as St,JW as T,Fc as Tt,RY as U,vc as Ut,uJ as V,Ps as Vt,yW as W,Us as Wt,MK as X,Co as Xt,yY as Y,To as Yt,KG as Z,Yi as Zt,FW as _,M as _t,DY as a,Zt as an,$U as at,NW as b,Wc as bt,OY as c,A as cn,pX as ct,xY as d,$e as dn,QU as dt,Ur as en,DW as et,wY as f,kX as ft,AW as g,Gd as gt,bY as h,ny as ht,fW as i,Yt as in,_W as it,nX as j,ws as jt,$Y as k,Xs as kt,kY as l,O as ln,YY as lt,SY as m,eW as mt,YW as n,Gt as nn,iG as nt,jY as o,Ct as on,aW as ot,CY as p,_Y as pt,OX as q,Os as qt,oW as r,qt as rn,cW as rt,AY as s,k as sn,yX as st,lX as t,nr as tn,RW as tt,EY as u,et as un,XG as ut,PW as v,zc as vt,zW as w,Rc as wt,MW as x,Ac as xt,jW as y,Ec as yt,DX as z,Fs as zt};
359
- //# sourceMappingURL=dist-DfIz2LcA.mjs.map
359
+ //# sourceMappingURL=dist-Cp4ojTBN.mjs.map
@@ -1 +1 @@
1
- import{$ as e,A as t,M as n,O as r,R as i,g as a,tt as o}from"./dist-DfIz2LcA.mjs";import{_ as s,a as c,c as l,d as u,f as d,g as f,i as p,l as m,m as h,n as g,o as _,p as v,r as y,s as b,t as x,u as S}from"./server-lock-D7DXNVql-BRVVzA6T.mjs";import{$ as C,$n as w,$t as T,A as E,An as D,At as O,B as k,Bn as A,Bt as j,C as M,Cn as N,Ct as P,D as F,Dn as I,Dt as L,E as R,En as z,Et as B,F as V,Fn as H,Ft as U,G as W,Gn as G,Gt as K,H as q,Hn as J,Ht as Y,I as X,In as Z,It as Q,J as $,Jn as ee,Jt as te,K as ne,Kn as re,Kt as ie,L as ae,Ln as oe,Lt as se,M as ce,Mn as le,Mt as ue,N as de,Nn as fe,Nt as pe,O as me,On as he,Ot as ge,P as _e,Pn as ve,Pt as ye,Q as be,Qn as xe,Qt as Se,R as Ce,Rn as we,Rt as Te,S as Ee,Sn as De,St as Oe,T as ke,Tn as Ae,Tt as je,U as Me,Un as Ne,Ut as Pe,V as Fe,Vn as Ie,Vt as Le,W as Re,Wn as ze,Wt as Be,X as Ve,Xn as He,Xt as Ue,Y as We,Yn as Ge,Yt as Ke,Z as qe,Zn as Je,Zt as Ye,_ as Xe,_n as Ze,_t as Qe,a as $e,an as et,ar as tt,at as nt,b as rt,bn as it,bt as at,c as ot,cn as st,ct,d as lt,dn as ut,dt,en as ft,er as pt,et as mt,f as ht,fn as gt,ft as _t,g as vt,gn as yt,gt as bt,h as xt,hn as St,hr as Ct,ht as wt,i as Tt,in as Et,ir as Dt,it as Ot,j as kt,jn as At,jt,k as Mt,kn as Nt,kt as Pt,l as Ft,ln as It,lt as Lt,m as Rt,mn as zt,mr as Bt,mt as Vt,n as Ht,nn as Ut,nr as Wt,nt as Gt,o as Kt,on as qt,ot as Jt,p as Yt,pn as Xt,pt as Zt,q as Qt,qn as $t,qt as en,r as tn,rn as nn,rr as rn,rt as an,s as on,sn,st as cn,t as ln,tn as un,tr as dn,tt as fn,u as pn,un as mn,ut as hn,v as gn,vn as _n,vt as vn,w as yn,wn as bn,wt as xn,x as Sn,xn as Cn,xt as wn,y as Tn,yn as En,yt as Dn,z as On,zn as kn,zt as An}from"./dist-RAy2NfOX.mjs";export{ln as AGENT_ID_MAX_LEN,Ht as AGENT_ID_RE,tn as AGENT_WRITE_ORIGIN,Tt as AgentFocusBroadcaster,$e as AgentPresenceBroadcaster,Kt as AgentSessionCapacityError,on as AgentSessionManager,ot as BacklinkIndex,Ft as CC1Broadcaster,a as CC1_CONTRACT_VERSION,pn as CONFLICT_MARKER_RE,lt as CURSOR_BUNDLE_PATHS_BY_PLATFORM,ht as ConfigSchema,Yt as DEFAULT_CHECKPOINT_RETENTION,Rt as FILE_SYSTEM_WRITER,xt as FILE_WATCHER_ORIGIN,vt as GIT_UPSTREAM_WRITER,Bt as GitDirAccessError,Xe as HOCUSPOCUS_AUTH_REJECTION_REASONS,gn as HocuspocusAuthRejection,Tn as HocuspocusAuthTokenSchema,rt as INSTALLED_AGENTS_SCHEMES,Sn as LIVE_DERIVED_INDEX_DEBOUNCE_MS,Ee as LOG_MD_TEMPLATE,M as MANAGED_RENAME_ORIGIN,yn as MAX_AGENT_SESSIONS,ke as MCP_CONNECTION_ID_HEADER,R as MCP_SERVER_NAME,F as MISSING_OK_CONFIG_MESSAGE,Ct as MalformedGitPointerError,me as McpLogger,Mt as MissingOkConfigError,E as OBSERVER_SYNC_ORIGIN,r as ORPHAN_MODES,kt as PinoLogger,x as ProcessLockCollisionError,ce as ProjectGitInitError,de as ROLLBACK_ORIGIN,g as RUNTIME_VERSION,_e as SERVICE_WRITER,V as SKILL_INSTALL_EVENTS_FILE_REL,t as SKILL_STATE_TARGETS,X as STARTER_FOLDERS,ae as STARTER_FOLDER_FRONTMATTER_FILENAME,Ce as STARTER_TEMPLATES,On as STATE_MANIFEST_FILENAME,y as STATE_SCHEMA_VERSION,n as SYSTEM_DOC_NAME,k as SeedPrerequisiteError,Fe as SeedRootDirError,p as ServerLockCollisionError,q as StateManifestError,Me as TagIndex,Re as UiLockCollisionError,c as acquireProcessLock,_ as acquireServerLock,W as acquireUiLock,ne as applyAgentMarkdownWrite,Qt as applyExternalChange,$ as applySeed,We as assertCompatibleStateManifest,Ve as assertNeverDiskEvent,qe as attachIdleShutdown,be as bootServer,C as buildAndOpenSkill,mt as buildExecResult,fn as buildReadResult,Gt as buildSkillZip,an as buildStarterFolderFrontmatterYaml,Ot as buildWipTree,nt as classifyEvents,Jt as clearContributors,i as colorFromSeed,cn as commitUpstreamImport,ct as commitWip,Lt as commitWipFromTree,hn as containsConflictMarkers,dt as contentHash,_t as contributorCount,Zt as createApiExtension,Vt as createAssetServeMiddleware,wt as createContentFilter,bt as createContentFilterAsync,Qe as createExternalChangeHandler,vn as createLiveDerivedIndexExtension,Dn as createMcpHttpHandler,at as createOsProbe,wn as createPersistenceExtension,Oe as createServer,P as createServerObserverExtension,xn as createTestLogger,je as detectClaudeDesktopPresence,B as detectProjectShape,L as ensureProjectGit,ge as evictStaleTrackerEntries,Pt as extractWikiLinksFromMarkdown,O as formatContributors,jt as gcCheckpointRefs,ue as getCurrentMcpLogger,pe as getLocalDir,ye as getLogger,U as getMeter,Q as getMetrics,se as getTracer,Te as handleCollabSocketError,An as handleSpawnCursor,e as iconFromClientName,j as incrementCollabSocketFilteredError,Le as incrementServerObserverFire,Y as initShadowRepo,Pe as initTelemetry,Be as installTestLoggers,K as installUserSkill,ie as isAllowedApiOrigin,en as isAllowedWorkspaceHostHeader,te as isConfigDoc,Ke as isHocuspocusAuthRejectionReason,Ue as isLoopbackAddress,o as isOrphanMode,Ye as isPairedWriteOrigin,Se as isPathWithinDir,b as isProcessAlive,T as isSelfWrite,ft as isSystemDoc,l as isValidLockPid,un as lastKnownHash,Ut as listRescueCheckpoints,nn as loadPrincipal,m as lockFilePath,Et as loggerFactory,et as mountMcpAndApi,qt as parseHocuspocusAuthToken,sn as parseKeepaliveConnectionId,st as pathToDocName,It as planSeed,mn as readAllTargets,ut as readBranchFromHead,S as readProcessLock,u as readProcessLockDetailed,d as readServerLock,gt as readServerPackageVersion,Xt as readSkillInstallStateSnapshot,zt as readStateManifest,St as readTargetRecordedAt,yt as readTargetVersion,Ze as readUiLock,_n as reconcile,En as recordContributor,it as recordSkillInstallEvent,Cn as registerWrite,v as releaseProcessLock,h as releaseServerLock,De as releaseUiLock,N as removeLastKnownHash,bn as resetMetrics,Ae as resolveBundledSkillDir,z as resolveContentDir,I as resolveCursorBinaryDefault,he as resolveCursorSpawnInvocation,Nt as resolveLockDir,D as resolvePackageVersion,At as rewriteMarkdownLinksForDocumentRename,le as rewriteWikiLinksForDocumentRename,fe as runAuthReposSubprocess,ve as runAuthStatusSubprocess,H as runCloneSubprocess,Z as runDeviceFlowSubprocess,oe as runWithMcpLogger,we as safeContentPath,kn as safeSubdir,A as safetyCheckpoint,Ie as saveInMemoryCheckpoint,J as saveVersion,Ne as seedBasenameIndex,ze as setActiveSpanAttributes,G as shadowGit,re as shutdownTelemetry,$t as splitMarkdownBlocks,ee as startWatcher,Ge as toBroadcasterKey,He as updateLastKnownHash,f as updateProcessLockPort,s as updateServerLockPort,Je as updateUiLockPort,xe as validateAgentId,w as validateCloneInputs,pt as validateSkillZip,dn as withSpan,Wt as withSpanSync,rn as writeStateManifest,Dt as writeTargetVersion,tt as writeTracker};
1
+ import{$ as e,A as t,M as n,O as r,R as i,g as a,tt as o}from"./dist-Cp4ojTBN.mjs";import{_ as s,a as c,c as l,d as u,f as d,g as f,i as p,l as m,m as h,n as g,o as _,p as v,r as y,s as b,t as x,u as S}from"./server-lock-D7DXNVql-BRVVzA6T.mjs";import{$ as C,$n as w,$t as T,A as E,An as D,At as O,B as k,Bn as A,Bt as j,C as M,Cn as N,Ct as P,D as F,Dn as I,Dt as L,E as R,En as z,Et as B,F as V,Fn as H,Ft as U,G as W,Gn as G,Gt as K,H as q,Hn as J,Ht as Y,I as X,In as Z,It as Q,J as $,Jn as ee,Jt as te,K as ne,Kn as re,Kt as ie,L as ae,Ln as oe,Lt as se,M as ce,Mn as le,Mt as ue,N as de,Nn as fe,Nt as pe,O as me,On as he,Ot as ge,P as _e,Pn as ve,Pt as ye,Q as be,Qn as xe,Qt as Se,R as Ce,Rn as we,Rt as Te,S as Ee,Sn as De,St as Oe,T as ke,Tn as Ae,Tt as je,U as Me,Un as Ne,Ut as Pe,V as Fe,Vn as Ie,Vt as Le,W as Re,Wn as ze,Wt as Be,X as Ve,Xn as He,Xt as Ue,Y as We,Yn as Ge,Yt as Ke,Z as qe,Zn as Je,Zt as Ye,_ as Xe,_n as Ze,_t as Qe,a as $e,an as et,ar as tt,at as nt,b as rt,bn as it,bt as at,c as ot,cn as st,ct,d as lt,dn as ut,dt,en as ft,er as pt,et as mt,f as ht,fn as gt,ft as _t,g as vt,gn as yt,gt as bt,h as xt,hn as St,hr as Ct,ht as wt,i as Tt,in as Et,ir as Dt,it as Ot,j as kt,jn as At,jt,k as Mt,kn as Nt,kt as Pt,l as Ft,ln as It,lt as Lt,m as Rt,mn as zt,mr as Bt,mt as Vt,n as Ht,nn as Ut,nr as Wt,nt as Gt,o as Kt,on as qt,ot as Jt,p as Yt,pn as Xt,pt as Zt,q as Qt,qn as $t,qt as en,r as tn,rn as nn,rr as rn,rt as an,s as on,sn,st as cn,t as ln,tn as un,tr as dn,tt as fn,u as pn,un as mn,ut as hn,v as gn,vn as _n,vt as vn,w as yn,wn as bn,wt as xn,x as Sn,xn as Cn,xt as wn,y as Tn,yn as En,yt as Dn,z as On,zn as kn,zt as An}from"./dist-Bfxmzk9L.mjs";export{ln as AGENT_ID_MAX_LEN,Ht as AGENT_ID_RE,tn as AGENT_WRITE_ORIGIN,Tt as AgentFocusBroadcaster,$e as AgentPresenceBroadcaster,Kt as AgentSessionCapacityError,on as AgentSessionManager,ot as BacklinkIndex,Ft as CC1Broadcaster,a as CC1_CONTRACT_VERSION,pn as CONFLICT_MARKER_RE,lt as CURSOR_BUNDLE_PATHS_BY_PLATFORM,ht as ConfigSchema,Yt as DEFAULT_CHECKPOINT_RETENTION,Rt as FILE_SYSTEM_WRITER,xt as FILE_WATCHER_ORIGIN,vt as GIT_UPSTREAM_WRITER,Bt as GitDirAccessError,Xe as HOCUSPOCUS_AUTH_REJECTION_REASONS,gn as HocuspocusAuthRejection,Tn as HocuspocusAuthTokenSchema,rt as INSTALLED_AGENTS_SCHEMES,Sn as LIVE_DERIVED_INDEX_DEBOUNCE_MS,Ee as LOG_MD_TEMPLATE,M as MANAGED_RENAME_ORIGIN,yn as MAX_AGENT_SESSIONS,ke as MCP_CONNECTION_ID_HEADER,R as MCP_SERVER_NAME,F as MISSING_OK_CONFIG_MESSAGE,Ct as MalformedGitPointerError,me as McpLogger,Mt as MissingOkConfigError,E as OBSERVER_SYNC_ORIGIN,r as ORPHAN_MODES,kt as PinoLogger,x as ProcessLockCollisionError,ce as ProjectGitInitError,de as ROLLBACK_ORIGIN,g as RUNTIME_VERSION,_e as SERVICE_WRITER,V as SKILL_INSTALL_EVENTS_FILE_REL,t as SKILL_STATE_TARGETS,X as STARTER_FOLDERS,ae as STARTER_FOLDER_FRONTMATTER_FILENAME,Ce as STARTER_TEMPLATES,On as STATE_MANIFEST_FILENAME,y as STATE_SCHEMA_VERSION,n as SYSTEM_DOC_NAME,k as SeedPrerequisiteError,Fe as SeedRootDirError,p as ServerLockCollisionError,q as StateManifestError,Me as TagIndex,Re as UiLockCollisionError,c as acquireProcessLock,_ as acquireServerLock,W as acquireUiLock,ne as applyAgentMarkdownWrite,Qt as applyExternalChange,$ as applySeed,We as assertCompatibleStateManifest,Ve as assertNeverDiskEvent,qe as attachIdleShutdown,be as bootServer,C as buildAndOpenSkill,mt as buildExecResult,fn as buildReadResult,Gt as buildSkillZip,an as buildStarterFolderFrontmatterYaml,Ot as buildWipTree,nt as classifyEvents,Jt as clearContributors,i as colorFromSeed,cn as commitUpstreamImport,ct as commitWip,Lt as commitWipFromTree,hn as containsConflictMarkers,dt as contentHash,_t as contributorCount,Zt as createApiExtension,Vt as createAssetServeMiddleware,wt as createContentFilter,bt as createContentFilterAsync,Qe as createExternalChangeHandler,vn as createLiveDerivedIndexExtension,Dn as createMcpHttpHandler,at as createOsProbe,wn as createPersistenceExtension,Oe as createServer,P as createServerObserverExtension,xn as createTestLogger,je as detectClaudeDesktopPresence,B as detectProjectShape,L as ensureProjectGit,ge as evictStaleTrackerEntries,Pt as extractWikiLinksFromMarkdown,O as formatContributors,jt as gcCheckpointRefs,ue as getCurrentMcpLogger,pe as getLocalDir,ye as getLogger,U as getMeter,Q as getMetrics,se as getTracer,Te as handleCollabSocketError,An as handleSpawnCursor,e as iconFromClientName,j as incrementCollabSocketFilteredError,Le as incrementServerObserverFire,Y as initShadowRepo,Pe as initTelemetry,Be as installTestLoggers,K as installUserSkill,ie as isAllowedApiOrigin,en as isAllowedWorkspaceHostHeader,te as isConfigDoc,Ke as isHocuspocusAuthRejectionReason,Ue as isLoopbackAddress,o as isOrphanMode,Ye as isPairedWriteOrigin,Se as isPathWithinDir,b as isProcessAlive,T as isSelfWrite,ft as isSystemDoc,l as isValidLockPid,un as lastKnownHash,Ut as listRescueCheckpoints,nn as loadPrincipal,m as lockFilePath,Et as loggerFactory,et as mountMcpAndApi,qt as parseHocuspocusAuthToken,sn as parseKeepaliveConnectionId,st as pathToDocName,It as planSeed,mn as readAllTargets,ut as readBranchFromHead,S as readProcessLock,u as readProcessLockDetailed,d as readServerLock,gt as readServerPackageVersion,Xt as readSkillInstallStateSnapshot,zt as readStateManifest,St as readTargetRecordedAt,yt as readTargetVersion,Ze as readUiLock,_n as reconcile,En as recordContributor,it as recordSkillInstallEvent,Cn as registerWrite,v as releaseProcessLock,h as releaseServerLock,De as releaseUiLock,N as removeLastKnownHash,bn as resetMetrics,Ae as resolveBundledSkillDir,z as resolveContentDir,I as resolveCursorBinaryDefault,he as resolveCursorSpawnInvocation,Nt as resolveLockDir,D as resolvePackageVersion,At as rewriteMarkdownLinksForDocumentRename,le as rewriteWikiLinksForDocumentRename,fe as runAuthReposSubprocess,ve as runAuthStatusSubprocess,H as runCloneSubprocess,Z as runDeviceFlowSubprocess,oe as runWithMcpLogger,we as safeContentPath,kn as safeSubdir,A as safetyCheckpoint,Ie as saveInMemoryCheckpoint,J as saveVersion,Ne as seedBasenameIndex,ze as setActiveSpanAttributes,G as shadowGit,re as shutdownTelemetry,$t as splitMarkdownBlocks,ee as startWatcher,Ge as toBroadcasterKey,He as updateLastKnownHash,f as updateProcessLockPort,s as updateServerLockPort,Je as updateUiLockPort,xe as validateAgentId,w as validateCloneInputs,pt as validateSkillZip,dn as withSpan,Wt as withSpanSync,rn as writeStateManifest,Dt as writeTargetVersion,tt as writeTracker};
package/dist/index.mjs CHANGED
@@ -1 +1 @@
1
- import{c as e,d as t,i as n,l as r,s as i,t as a,u as o}from"./init-qh1HubtR.mjs";import{t as s}from"./loader-DMES5Z4K.mjs";import"./src-D0mZ2vS1.mjs";export{r as ALL_EDITOR_IDS,o as EDITOR_TARGETS,a as detectInstalledEditors,t as initContent,s as loadConfig,n as readExistingMcpEntry,i as writeEditorMcpConfig,e as writeUserMcpConfigs};
1
+ import{c as e,d as t,i as n,l as r,s as i,t as a,u as o}from"./init-Bzm3Bj4h.mjs";import{t as s}from"./loader--zxukDZu.mjs";import"./src-BQP6s1V9.mjs";export{r as ALL_EDITOR_IDS,o as EDITOR_TARGETS,a as detectInstalledEditors,t as initContent,s as loadConfig,n as readExistingMcpEntry,i as writeEditorMcpConfig,e as writeUserMcpConfigs};
@@ -1,4 +1,4 @@
1
- import{i as e,o as t,t as n}from"./chunk-FK9Q3tQk.mjs";import{r,t as i}from"./esm-CEs3LWY3.mjs";import{bt as a,vt as o}from"./dist-DfIz2LcA.mjs";import{Dt as s,E as c,Gt as l,M as u,Tn as d,Tt as f}from"./dist-RAy2NfOX.mjs";import{n as p,t as m}from"./constants-3O7IbmRt.mjs";import{t as h}from"./is-object-DF0ZeuvD.mjs";import{i as g,o as _,r as v,s as y,t as b}from"./colors-BNufdynn.mjs";import{t as x}from"./preview-CZdt-b-O.mjs";import S,{basename as C,dirname as w,isAbsolute as T,join as E,posix as ee,relative as D,resolve as O,sep as k,win32 as te}from"node:path";import{cpSync as ne,existsSync as A,lstatSync as re,mkdirSync as j,readFileSync as M,realpathSync as ie,rmSync as ae,writeFileSync as N}from"node:fs";import P from"node:process";import{homedir as F}from"node:os";import{AsyncLocalStorage as oe,AsyncResource as se}from"node:async_hooks";import{stripVTControlCharacters as ce,styleText as I}from"node:util";import*as le from"node:readline";function ue(){return P.platform.startsWith(`win`)?!!P.env.CI||!!P.env.WT_SESSION||!!P.env.TERMINUS_SUBLIME||P.env.ConEmuTask===`{cmd::Cmder}`||P.env.TERM_PROGRAM===`Terminus-Sublime`||P.env.TERM_PROGRAM===`vscode`||P.env.TERM===`xterm-256color`||P.env.TERM===`alacritty`||P.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:P.env.TERM!==`linux`}const de={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},fe={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},pe={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},me={...de,...fe},he={...de,...pe},L=ue()?me:he;Object.entries(fe);var ge=n(((t,n)=>{n.exports=i;function r(t){let n={defaultWidth:0,output:process.stdout,tty:e(`tty`)};return t?(Object.keys(n).forEach(function(e){t[e]||(t[e]=n[e])}),t):n}function i(e){let t=r(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}));const _e=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),ve=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,ye=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,be=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,xe=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Se=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Ce=/\t{1,1000}/y,we=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,Te=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Ee=/\p{M}+/gu,De={limit:1/0,ellipsis:``},Oe=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?Oe(i,De,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Te,l],[be,0],[xe,o],[Ce,s],[we,c],[Se,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(Ee,``)){let t=e.codePointAt(0)||0;if(S=ve(t)?2:ye(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===Se?_e(e.slice(p,n.lastIndex)):n===we?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},ke={limit:1/0,ellipsis:``,ellipsisWidth:0},R=(e,t={})=>Oe(e,ke,t).width,Ae=`]8;;`,je=RegExp(`(?:\\[(?<code>\\d+)m|\\${Ae}(?<uri>.*))`,`y`),Me=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},Ne=e=>`[${e}m`,Pe=e=>`${Ae}${e}`,Fe=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:R(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=R(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===`›`)&&(i=!0,a=t.startsWith(Ae,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Ie=e=>{let t=e.split(` `),n=t.length;for(;n&&!R(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Le=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=R(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=R(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),Fe(s,r,t),c=R(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){Fe(s,r,t),c=R(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){Fe(s,r,t),c=R(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Ie(e)));let l=s.join(`
1
+ import{i as e,o as t,t as n}from"./chunk-FK9Q3tQk.mjs";import{r,t as i}from"./esm-CEs3LWY3.mjs";import{bt as a,vt as o}from"./dist-Cp4ojTBN.mjs";import{Dt as s,E as c,Gt as l,M as u,Tn as d,Tt as f}from"./dist-Bfxmzk9L.mjs";import{n as p,t as m}from"./constants-DTqDNUS7.mjs";import{t as h}from"./is-object-DF0ZeuvD.mjs";import{i as g,o as _,r as v,s as y,t as b}from"./colors-BNufdynn.mjs";import{t as x}from"./preview-XajysOgG.mjs";import S,{basename as C,dirname as w,isAbsolute as T,join as E,posix as ee,relative as D,resolve as O,sep as k,win32 as te}from"node:path";import{cpSync as ne,existsSync as A,lstatSync as re,mkdirSync as j,readFileSync as M,realpathSync as ie,rmSync as ae,writeFileSync as N}from"node:fs";import P from"node:process";import{homedir as F}from"node:os";import{AsyncLocalStorage as oe,AsyncResource as se}from"node:async_hooks";import{stripVTControlCharacters as ce,styleText as I}from"node:util";import*as le from"node:readline";function ue(){return P.platform.startsWith(`win`)?!!P.env.CI||!!P.env.WT_SESSION||!!P.env.TERMINUS_SUBLIME||P.env.ConEmuTask===`{cmd::Cmder}`||P.env.TERM_PROGRAM===`Terminus-Sublime`||P.env.TERM_PROGRAM===`vscode`||P.env.TERM===`xterm-256color`||P.env.TERM===`alacritty`||P.env.TERMINAL_EMULATOR===`JetBrains-JediTerm`:P.env.TERM!==`linux`}const de={circleQuestionMark:`(?)`,questionMarkPrefix:`(?)`,square:`█`,squareDarkShade:`▓`,squareMediumShade:`▒`,squareLightShade:`░`,squareTop:`▀`,squareBottom:`▄`,squareLeft:`▌`,squareRight:`▐`,squareCenter:`■`,bullet:`●`,dot:`․`,ellipsis:`…`,pointerSmall:`›`,triangleUp:`▲`,triangleUpSmall:`▴`,triangleDown:`▼`,triangleDownSmall:`▾`,triangleLeftSmall:`◂`,triangleRightSmall:`▸`,home:`⌂`,heart:`♥`,musicNote:`♪`,musicNoteBeamed:`♫`,arrowUp:`↑`,arrowDown:`↓`,arrowLeft:`←`,arrowRight:`→`,arrowLeftRight:`↔`,arrowUpDown:`↕`,almostEqual:`≈`,notEqual:`≠`,lessOrEqual:`≤`,greaterOrEqual:`≥`,identical:`≡`,infinity:`∞`,subscriptZero:`₀`,subscriptOne:`₁`,subscriptTwo:`₂`,subscriptThree:`₃`,subscriptFour:`₄`,subscriptFive:`₅`,subscriptSix:`₆`,subscriptSeven:`₇`,subscriptEight:`₈`,subscriptNine:`₉`,oneHalf:`½`,oneThird:`⅓`,oneQuarter:`¼`,oneFifth:`⅕`,oneSixth:`⅙`,oneEighth:`⅛`,twoThirds:`⅔`,twoFifths:`⅖`,threeQuarters:`¾`,threeFifths:`⅗`,threeEighths:`⅜`,fourFifths:`⅘`,fiveSixths:`⅚`,fiveEighths:`⅝`,sevenEighths:`⅞`,line:`─`,lineBold:`━`,lineDouble:`═`,lineDashed0:`┄`,lineDashed1:`┅`,lineDashed2:`┈`,lineDashed3:`┉`,lineDashed4:`╌`,lineDashed5:`╍`,lineDashed6:`╴`,lineDashed7:`╶`,lineDashed8:`╸`,lineDashed9:`╺`,lineDashed10:`╼`,lineDashed11:`╾`,lineDashed12:`−`,lineDashed13:`–`,lineDashed14:`‐`,lineDashed15:`⁃`,lineVertical:`│`,lineVerticalBold:`┃`,lineVerticalDouble:`║`,lineVerticalDashed0:`┆`,lineVerticalDashed1:`┇`,lineVerticalDashed2:`┊`,lineVerticalDashed3:`┋`,lineVerticalDashed4:`╎`,lineVerticalDashed5:`╏`,lineVerticalDashed6:`╵`,lineVerticalDashed7:`╷`,lineVerticalDashed8:`╹`,lineVerticalDashed9:`╻`,lineVerticalDashed10:`╽`,lineVerticalDashed11:`╿`,lineDownLeft:`┐`,lineDownLeftArc:`╮`,lineDownBoldLeftBold:`┓`,lineDownBoldLeft:`┒`,lineDownLeftBold:`┑`,lineDownDoubleLeftDouble:`╗`,lineDownDoubleLeft:`╖`,lineDownLeftDouble:`╕`,lineDownRight:`┌`,lineDownRightArc:`╭`,lineDownBoldRightBold:`┏`,lineDownBoldRight:`┎`,lineDownRightBold:`┍`,lineDownDoubleRightDouble:`╔`,lineDownDoubleRight:`╓`,lineDownRightDouble:`╒`,lineUpLeft:`┘`,lineUpLeftArc:`╯`,lineUpBoldLeftBold:`┛`,lineUpBoldLeft:`┚`,lineUpLeftBold:`┙`,lineUpDoubleLeftDouble:`╝`,lineUpDoubleLeft:`╜`,lineUpLeftDouble:`╛`,lineUpRight:`└`,lineUpRightArc:`╰`,lineUpBoldRightBold:`┗`,lineUpBoldRight:`┖`,lineUpRightBold:`┕`,lineUpDoubleRightDouble:`╚`,lineUpDoubleRight:`╙`,lineUpRightDouble:`╘`,lineUpDownLeft:`┤`,lineUpBoldDownBoldLeftBold:`┫`,lineUpBoldDownBoldLeft:`┨`,lineUpDownLeftBold:`┥`,lineUpBoldDownLeftBold:`┩`,lineUpDownBoldLeftBold:`┪`,lineUpDownBoldLeft:`┧`,lineUpBoldDownLeft:`┦`,lineUpDoubleDownDoubleLeftDouble:`╣`,lineUpDoubleDownDoubleLeft:`╢`,lineUpDownLeftDouble:`╡`,lineUpDownRight:`├`,lineUpBoldDownBoldRightBold:`┣`,lineUpBoldDownBoldRight:`┠`,lineUpDownRightBold:`┝`,lineUpBoldDownRightBold:`┡`,lineUpDownBoldRightBold:`┢`,lineUpDownBoldRight:`┟`,lineUpBoldDownRight:`┞`,lineUpDoubleDownDoubleRightDouble:`╠`,lineUpDoubleDownDoubleRight:`╟`,lineUpDownRightDouble:`╞`,lineDownLeftRight:`┬`,lineDownBoldLeftBoldRightBold:`┳`,lineDownLeftBoldRightBold:`┯`,lineDownBoldLeftRight:`┰`,lineDownBoldLeftBoldRight:`┱`,lineDownBoldLeftRightBold:`┲`,lineDownLeftRightBold:`┮`,lineDownLeftBoldRight:`┭`,lineDownDoubleLeftDoubleRightDouble:`╦`,lineDownDoubleLeftRight:`╥`,lineDownLeftDoubleRightDouble:`╤`,lineUpLeftRight:`┴`,lineUpBoldLeftBoldRightBold:`┻`,lineUpLeftBoldRightBold:`┷`,lineUpBoldLeftRight:`┸`,lineUpBoldLeftBoldRight:`┹`,lineUpBoldLeftRightBold:`┺`,lineUpLeftRightBold:`┶`,lineUpLeftBoldRight:`┵`,lineUpDoubleLeftDoubleRightDouble:`╩`,lineUpDoubleLeftRight:`╨`,lineUpLeftDoubleRightDouble:`╧`,lineUpDownLeftRight:`┼`,lineUpBoldDownBoldLeftBoldRightBold:`╋`,lineUpDownBoldLeftBoldRightBold:`╈`,lineUpBoldDownLeftBoldRightBold:`╇`,lineUpBoldDownBoldLeftRightBold:`╊`,lineUpBoldDownBoldLeftBoldRight:`╉`,lineUpBoldDownLeftRight:`╀`,lineUpDownBoldLeftRight:`╁`,lineUpDownLeftBoldRight:`┽`,lineUpDownLeftRightBold:`┾`,lineUpBoldDownBoldLeftRight:`╂`,lineUpDownLeftBoldRightBold:`┿`,lineUpBoldDownLeftBoldRight:`╃`,lineUpBoldDownLeftRightBold:`╄`,lineUpDownBoldLeftBoldRight:`╅`,lineUpDownBoldLeftRightBold:`╆`,lineUpDoubleDownDoubleLeftDoubleRightDouble:`╬`,lineUpDoubleDownDoubleLeftRight:`╫`,lineUpDownLeftDoubleRightDouble:`╪`,lineCross:`╳`,lineBackslash:`╲`,lineSlash:`╱`},fe={tick:`✔`,info:`ℹ`,warning:`⚠`,cross:`✘`,squareSmall:`◻`,squareSmallFilled:`◼`,circle:`◯`,circleFilled:`◉`,circleDotted:`◌`,circleDouble:`◎`,circleCircle:`ⓞ`,circleCross:`ⓧ`,circlePipe:`Ⓘ`,radioOn:`◉`,radioOff:`◯`,checkboxOn:`☒`,checkboxOff:`☐`,checkboxCircleOn:`ⓧ`,checkboxCircleOff:`Ⓘ`,pointer:`❯`,triangleUpOutline:`△`,triangleLeft:`◀`,triangleRight:`▶`,lozenge:`◆`,lozengeOutline:`◇`,hamburger:`☰`,smiley:`㋡`,mustache:`෴`,star:`★`,play:`▶`,nodejs:`⬢`,oneSeventh:`⅐`,oneNinth:`⅑`,oneTenth:`⅒`},pe={tick:`√`,info:`i`,warning:`‼`,cross:`×`,squareSmall:`□`,squareSmallFilled:`■`,circle:`( )`,circleFilled:`(*)`,circleDotted:`( )`,circleDouble:`( )`,circleCircle:`(○)`,circleCross:`(×)`,circlePipe:`(│)`,radioOn:`(*)`,radioOff:`( )`,checkboxOn:`[×]`,checkboxOff:`[ ]`,checkboxCircleOn:`(×)`,checkboxCircleOff:`( )`,pointer:`>`,triangleUpOutline:`∆`,triangleLeft:`◄`,triangleRight:`►`,lozenge:`♦`,lozengeOutline:`◊`,hamburger:`≡`,smiley:`☺`,mustache:`┌─┐`,star:`✶`,play:`►`,nodejs:`♦`,oneSeventh:`1/7`,oneNinth:`1/9`,oneTenth:`1/10`},me={...de,...fe},he={...de,...pe},L=ue()?me:he;Object.entries(fe);var ge=n(((t,n)=>{n.exports=i;function r(t){let n={defaultWidth:0,output:process.stdout,tty:e(`tty`)};return t?(Object.keys(n).forEach(function(e){t[e]||(t[e]=n[e])}),t):n}function i(e){let t=r(e);if(t.output.getWindowSize)return t.output.getWindowSize()[0]||t.defaultWidth;if(t.tty.getWindowSize)return t.tty.getWindowSize()[1]||t.defaultWidth;if(t.output.columns)return t.output.columns;if(process.env.CLI_WIDTH){let e=parseInt(process.env.CLI_WIDTH,10);if(!isNaN(e)&&e!==0)return e}return t.defaultWidth}}));const _e=(()=>{let e=/[\uD800-\uDBFF][\uDC00-\uDFFF]/g;return t=>{let n=0;for(e.lastIndex=0;e.test(t);)n+=1;return t.length-n}})(),ve=e=>e===12288||e>=65281&&e<=65376||e>=65504&&e<=65510,ye=e=>e===8987||e===9001||e>=12272&&e<=12287||e>=12289&&e<=12350||e>=12441&&e<=12543||e>=12549&&e<=12591||e>=12593&&e<=12686||e>=12688&&e<=12771||e>=12783&&e<=12830||e>=12832&&e<=12871||e>=12880&&e<=19903||e>=65040&&e<=65049||e>=65072&&e<=65106||e>=65108&&e<=65126||e>=65128&&e<=65131||e>=127488&&e<=127490||e>=127504&&e<=127547||e>=127552&&e<=127560||e>=131072&&e<=196605||e>=196608&&e<=262141,be=/[\u001b\u009b][[()#;?]*(?:[0-9]{1,4}(?:;[0-9]{0,4})*)?[0-9A-ORZcf-nqry=><]|\u001b\]8;[^;]*;.*?(?:\u0007|\u001b\u005c)/y,xe=/[\x00-\x08\x0A-\x1F\x7F-\x9F]{1,1000}/y,Se=/(?:(?![\uFF61-\uFF9F\uFF00-\uFFEF])[\p{Script=Han}\p{Script=Hiragana}\p{Script=Katakana}\p{Script=Hangul}\p{Script=Tangut}]){1,1000}/uy,Ce=/\t{1,1000}/y,we=/[\u{1F1E6}-\u{1F1FF}]{2}|\u{1F3F4}[\u{E0061}-\u{E007A}]{2}[\u{E0030}-\u{E0039}\u{E0061}-\u{E007A}]{1,3}\u{E007F}|(?:\p{Emoji}\uFE0F\u20E3?|\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation})(?:\u200D(?:\p{Emoji_Modifier_Base}\p{Emoji_Modifier}?|\p{Emoji_Presentation}|\p{Emoji}\uFE0F\u20E3?))*/uy,Te=/(?:[\x20-\x7E\xA0-\xFF](?!\uFE0F)){1,1000}/y,Ee=/\p{M}+/gu,De={limit:1/0,ellipsis:``},Oe=(e,t={},n={})=>{let r=t.limit??1/0,i=t.ellipsis??``,a=t?.ellipsisWidth??(i?Oe(i,De,n).width:0),o=n.controlWidth??0,s=n.tabWidth??8,c=n.emojiWidth??2,l=n.regularWidth??1,u=n.wideWidth??2,d=[[Te,l],[be,0],[xe,o],[Ce,s],[we,c],[Se,u]],f=0,p=0,m=e.length,h=0,g=!1,_=m,v=Math.max(0,r-a),y=0,b=0,x=0,S=0;outer:for(;;){if(b>y||p>=m&&p>f){let t=e.slice(y,b)||e.slice(f,p);h=0;for(let e of t.replaceAll(Ee,``)){let t=e.codePointAt(0)||0;if(S=ve(t)?2:ye(t)?u:l,x+S>v&&(_=Math.min(_,Math.max(y,f)+h)),x+S>r){g=!0;break outer}h+=e.length,x+=S}y=b=0}if(p>=m)break outer;for(let t=0,n=d.length;t<n;t++){let[n,i]=d[t];if(n.lastIndex=p,n.test(e)){if(h=n===Se?_e(e.slice(p,n.lastIndex)):n===we?1:n.lastIndex-p,S=h*i,x+S>v&&(_=Math.min(_,p+Math.floor((v-x)/i))),x+S>r){g=!0;break outer}x+=S,y=f,b=p,p=f=n.lastIndex;continue outer}}p+=1}return{width:g?v:x,index:g?_:m,truncated:g,ellipsed:g&&r>=a}},ke={limit:1/0,ellipsis:``,ellipsisWidth:0},R=(e,t={})=>Oe(e,ke,t).width,Ae=`]8;;`,je=RegExp(`(?:\\[(?<code>\\d+)m|\\${Ae}(?<uri>.*))`,`y`),Me=e=>{if(e>=30&&e<=37||e>=90&&e<=97)return 39;if(e>=40&&e<=47||e>=100&&e<=107)return 49;if(e===1||e===2)return 22;if(e===3)return 23;if(e===4)return 24;if(e===7)return 27;if(e===8)return 28;if(e===9)return 29;if(e===0)return 0},Ne=e=>`[${e}m`,Pe=e=>`${Ae}${e}`,Fe=(e,t,n)=>{let r=t[Symbol.iterator](),i=!1,a=!1,o=e.at(-1),s=o===void 0?0:R(o),c=r.next(),l=r.next(),u=0;for(;!c.done;){let o=c.value,d=R(o);s+d<=n?e[e.length-1]+=o:(e.push(o),s=0),(o===`\x1B`||o===`›`)&&(i=!0,a=t.startsWith(Ae,u+1)),i?a?o===`\x07`&&(i=!1,a=!1):o===`m`&&(i=!1):(s+=d,s===n&&!l.done&&(e.push(``),s=0)),c=l,l=r.next(),u+=o.length}o=e.at(-1),!s&&o!==void 0&&o.length&&e.length>1&&(e[e.length-2]+=e.pop())},Ie=e=>{let t=e.split(` `),n=t.length;for(;n&&!R(t[n-1]);)n--;return n===t.length?e:t.slice(0,n).join(` `)+t.slice(n).join(``)},Le=(e,t,n={})=>{if(n.trim!==!1&&e.trim()===``)return``;let r=``,i,a,o=e.split(` `),s=[``],c=0;for(let e=0;e<o.length;e++){let r=o[e];if(n.trim!==!1){let e=s.at(-1)??``,t=e.trimStart();e.length!==t.length&&(s[s.length-1]=t,c=R(t))}e!==0&&(c>=t&&(n.wordWrap===!1||n.trim===!1)&&(s.push(``),c=0),(c||n.trim===!1)&&(s[s.length-1]+=` `,c++));let i=R(r);if(n.hard&&i>t){let e=t-c,n=1+Math.floor((i-e-1)/t);Math.floor((i-1)/t)<n&&s.push(``),Fe(s,r,t),c=R(s.at(-1)??``);continue}if(c+i>t&&c&&i){if(n.wordWrap===!1&&c<t){Fe(s,r,t),c=R(s.at(-1)??``);continue}s.push(``),c=0}if(c+i>t&&n.wordWrap===!1){Fe(s,r,t),c=R(s.at(-1)??``);continue}s[s.length-1]+=r,c+=i}n.trim!==!1&&(s=s.map(e=>Ie(e)));let l=s.join(`
2
2
  `),u=!1;for(let e=0;e<l.length;e++){let t=l[e];if(r+=t,u)u=!1;else if(u=t>=`\ud800`&&t<=`\udbff`,u)continue;if(t===`\x1B`||t===`›`){je.lastIndex=e+1;let t=je.exec(l)?.groups;if(t?.code!==void 0){let e=Number.parseFloat(t.code);i=e===39?void 0:e}else t?.uri!==void 0&&(a=t.uri.length===0?void 0:t.uri)}if(l[e+1]===`
3
3
  `){a&&(r+=Pe(``));let e=i?Me(i):void 0;i&&e&&(r+=Ne(e))}else t===`
4
4
  `&&(i&&Me(i)&&(r+=Ne(i)),a&&(r+=Pe(a)))}return r},Re=/\r?\n/;function ze(e,t,n){return String(e).normalize().split(Re).map(e=>Le(e,t,n)).join(`
@@ -404,5 +404,5 @@ last-spawn-error.log
404
404
  `)?n:`${n}\n`,`utf-8`)}function ar(e,t){let n;try{n=ie(t)}catch{n=O(t)}let r;try{r=re(e)}catch(e){if(e.code!==`ENOENT`)throw e}if(r?.isSymbolicLink())throw Error(`Refusing to write through a symbolic link at ${e}. Remove the symlink and re-run \`ok init\`, or pass \`--no-mcp\` to skip MCP config writes.`);let i=w(e);for(;i.length>1&&i!==k;){let t;try{t=ie(i)}catch(e){if(e.code===`ENOENT`){i=w(i);continue}throw e}let r=D(n,t);if(r===``||!r.startsWith(`..`)&&!T(r))return;throw Error(`Refusing to write at ${e}: ancestor ${i} resolves to ${t}, which is outside the project directory ${n}. A symbolic link in the path likely escapes the project. Remove the symlink and re-run, or pass \`--no-mcp\`.`)}}const or=e=>e!==`project`,sr=e=>e!==`user`;async function cr(){let e=await $t({message:`Where should the MCP server be configured?
405
405
  `,required:!1,theme:{icon:{checked:`[x]`,unchecked:`[ ]`}},choices:[{name:`User-level (~/.claude.json, ~/.cursor/mcp.json, …)`,value:`user`,checked:!0},{name:`Project-level (.mcp.json, .cursor/mcp.json, …)`,value:`project`,checked:!0}]});return e.includes(`user`)&&e.includes(`project`)?`both`:e.includes(`user`)?`user`:e.includes(`project`)?`project`:null}async function lr(e){return e.mcp===!1?null:e.scope?e.scope:e.isTTY??process.stdout.isTTY?(e.promptFn??cr)():`both`}const ur=`0.0.1`,dr=`open-knowledge-ui`;function fr(e,t={}){let n=E(e,`.claude`,`launch.json`),r=t.mode===`dev`?{name:dr,runtimeExecutable:`node`,runtimeArgs:[Hn(),`ui`],port:3e3}:{name:dr,runtimeExecutable:`npx`,runtimeArgs:[`@inkeep/open-knowledge`,`ui`],port:3e3};try{if(ar(n,e),!A(n))return j(w(n),{recursive:!0}),N(n,`${JSON.stringify({version:ur,configurations:[r]},null,2)}\n`,`utf-8`),{action:`created`,configPath:n};let t=M(n,`utf-8`).trim(),i=t?JSON.parse(t):{};if(!h(i))return{action:`failed`,configPath:n,error:`launch.json root is not an object`};let a=Array.isArray(i.configurations)?i.configurations:[],o=a.findIndex(e=>h(e)&&e.name===dr);o>=0?a[o]=r:a.push(r);let s={...i,version:i.version??ur,configurations:a};return N(n,`${JSON.stringify(s,null,2)}\n`,`utf-8`),{action:o>=0?`merged`:`created`,configPath:n}}catch(e){return{action:`failed`,configPath:n,error:e instanceof Error?e.message:String(e)}}}function pr(e,t,n){try{return A(e.detectPath?.(t,n)??w(e.configPath(t,n)))}catch{return!1}}function $(e,t,n,r,i){let a=e.serverName(t),o;try{o=i??e.configPath(t,r)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:``,serverName:a,error:t instanceof Error?t.message:String(t)}}if(!i&&!n.skipAvailabilityCheck&&!pr(e,t,r))return{editorId:e.id,label:e.label,action:`skipped-missing`,configPath:o,serverName:a};if(i!==void 0)try{ar(o,t)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t),configScope:`project`}}let s;try{s=e.format===`toml`?nr(o):tr(o)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t)}}let c=s[e.topLevelKey]??{},l=c[a],u;try{u=e.buildEntry(t,n)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t)}}let d={...s,[e.topLevelKey]:{...c,[a]:u}};try{e.format===`toml`?ir(o,d):rr(o,d)}catch(t){return{editorId:e.id,label:e.label,action:`failed`,configPath:o,serverName:a,error:t instanceof Error?t.message:String(t)}}return{editorId:e.id,label:e.label,action:l===void 0?`written`:`overwritten`,configPath:o,serverName:a,...i===void 0?{}:{configScope:`project`}}}function mr(e,t){let n=e.projectSkillPath?.(t);if(!n)return{editorId:e.id,label:e.label,action:`skipped-unsupported`,path:``};try{let r=d(),i=w(n);ar(i,t);let a=A(n)?`overwritten`:`written`;return ae(i,{recursive:!0,force:!0}),j(w(i),{recursive:!0}),ne(r,i,{recursive:!0}),{editorId:e.id,label:e.label,action:a,path:n}}catch(t){return{editorId:e.id,label:e.label,action:`failed`,path:n,error:t instanceof Error?t.message:String(t)}}}function hr(e,t){let n=e.projectConfigPath?.(t);if(!(!n||!A(n)))return{editorId:e.id,label:e.label,path:n}}async function gr(e){let t=er(e.editors),n={mode:`published`,cliPath:e.cliPath,skipAvailabilityCheck:!0};return t.map(t=>$(t,``,n,e.home))}function _r(e,t,n){let r;try{r=e.configPath(t,n)}catch{return null}let i;try{i=e.format===`toml`?nr(r):tr(r)}catch{return null}let a=i[e.topLevelKey];if(!h(a))return null;let o=a[e.serverName(t)];return h(o)?o:null}async function vr(e={}){let t=O(e.cwd??process.cwd()),n={mode:e.devMcp?`dev`:`published`},r=await s(t),i;try{i=Rn(t)}catch(n){let i=Q.claude.configPath(t,e.home);return{contentCreated:[],contentUpdated:[],contentSkipped:[],editors:[],projectSkills:[],legacyProjectConfigs:[],didGitInit:r.didInit,claudeDesktopDetected:!1,mcpAction:`failed`,mcpPath:i,mcpError:`Content scaffolding failed: ${n instanceof Error?n.message:String(n)}`}}let a=await lr({scope:e.scope,mcp:e.mcp,isTTY:e.isTTY,promptFn:e.promptFn}),o=e.editors??br(t,e.home),c=e.editors??zn.filter(e=>Q[e].projectConfigPath!==void 0),u=er(o),d=er(c),p=e.mcp===!1||a===null,m=Array.from(new Map([...u,...p?[]:d].map(e=>[e.id,e])).values()),h=u.filter(n=>pr(n,t,e.home)),g=[],_=[],v=new Set;for(let r of m){if(p){let n=``;try{n=r.configPath(t,e.home)}catch{}g.push({editorId:r.id,label:r.label,action:`skipped-flag`,configPath:n,serverName:r.serverName(t)});continue}if(or(a)&&u.includes(r)&&g.push($(r,t,n,e.home)),sr(a)&&d.includes(r)&&r.projectConfigPath){let i=r.projectConfigPath(t),a=$(r,t,n,e.home,i);g.push(a),(a.action===`written`||a.action===`overwritten`)&&(v.add(i),_.push(mr(r,t)))}}let y=!p&&a!==null&&sr(a)?d.filter(e=>!e.projectConfigPath).map(e=>e.label):void 0,b=p?[]:h.map(e=>hr(e,t)).filter(e=>e!==void 0).filter(e=>!v.has(e.path)),x=h.some(e=>e.id===`claude`)&&!p?fr(t,n):void 0,S=await(e.installUserSkill??l)({home:e.home}),C=f({home:e.home}),w=p?`skipped-flag`:`skipped-missing`,T=g.find(e=>e.editorId===`claude`)??g[0]??{action:w,configPath:Q.claude.configPath(t,e.home)};return{contentCreated:i.created,contentUpdated:i.updated,contentSkipped:i.skipped,editors:g,projectSkills:_,legacyProjectConfigs:b,launchJson:x,skillInstall:S,didGitInit:r.didInit,claudeDesktopDetected:C,mcpAction:T.action,mcpPath:T.configPath,mcpError:`error`in T?T.error:void 0,projectScopeUnsupportedLabels:y}}function yr(e,t){let n=[],r=e.editors.some(e=>e.action===`written`||e.action===`overwritten`),i=e.editors.some(e=>e.action===`failed`)||e.projectSkills.some(e=>e.action===`failed`),a=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-flag`),o=e.editors.length>0&&e.editors.every(e=>e.action===`skipped-missing`),s=e=>{let n=e.configPath.startsWith(t)?D(t,e.configPath):e.configPath;switch(e.action){case`created`:return` app preview server ${n} configured for Claude Code Desktop embedded browser`;case`merged`:return` app preview server ${n} updated for Claude Code Desktop embedded browser`;case`failed`:return` app preview server ${n} FAILED: ${e.error}`}};e.didGitInit&&n.push(`Initialized git repo at ${t}/.git/ (default branch: main)`);let c=E(t,`.ok`);if(e.contentCreated.length>0||e.contentUpdated.length>0?(n.push(b(`Content scaffolded at ${c}/`)),e.contentCreated.length>0&&n.push(` Created: ${e.contentCreated.join(`, `)}`),e.contentUpdated.length>0&&n.push(` Updated: ${e.contentUpdated.join(`, `)}`)):n.push(b(`Content already present at ${c}/`)),e.contentSkipped.length>0&&n.push(` Skipped (already exist): ${e.contentSkipped.join(`, `)}`),n.push(``),e.mcpError&&e.editors.length===0)n.push(`Warning: ${e.mcpError}`);else if(e.editors.length===0)if(n.push(b(`MCP server configuration:`)),e.mcpAction===`skipped-flag`)n.push(` MCP config not written — use without --no-mcp to configure editors`);else if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}else n.push(` No supported editor config directories detected; skipped MCP registration`);else if(a)n.push(`MCP config not written — use without --no-mcp to configure editors`);else if(o)n.push(b(`MCP server configuration:`)),n.push(` No supported editor config directories detected; skipped MCP registration`);else{n.push(b(`MCP server configuration:`));for(let r of e.editors){let i=r.configPath.startsWith(t)?D(t,r.configPath):r.configPath.replace(/^\/Users\/[^/]+/,`~`),a=r.serverName===`open-knowledge`?``:` (${r.serverName})`,o=r.configScope===`project`?` (project)`:``,c=`${r.label}${o}`,l=` `.repeat(Math.max(1,20-c.length)),u=r.editorId===`claude-desktop`&&(r.action===`written`||r.action===`overwritten`)?` — quit and relaunch Claude Desktop to activate`:``;switch(r.action){case`written`:n.push(` ${c}${l}${i} ${_(`registered`)}${a}${u}`);break;case`overwritten`:n.push(` ${c}${l}${i} ${_(`updated`)}${a}${u}`);break;case`skipped-missing`:n.push(` ${c}${l}${i} config root missing; skipped`);break;case`failed`:n.push(` ${c}${l}${i} ${v(`FAILED`)}: ${r.error}`);break;case`skipped-flag`:break}r.editorId===`claude`&&e.launchJson&&n.push(s(e.launchJson))}if(e.projectScopeUnsupportedLabels&&e.projectScopeUnsupportedLabels.length>0){let t=e.projectScopeUnsupportedLabels.join(`, `),r=e.projectScopeUnsupportedLabels.length===1?`does`:`do`;n.push(` ${t} ${r} not support project-level config; skipped`)}}if(e.projectSkills.length>0){n.push(``),n.push(b(`Project-local skills:`));for(let r of e.projectSkills){let e=`${r.label} (project)`,i=` `.repeat(Math.max(1,20-e.length)),a=r.path?D(t,r.path):``;switch(r.action){case`written`:n.push(` ${e}${i}${a} ${_(`installed`)}`);break;case`overwritten`:n.push(` ${e}${i}${a} ${_(`updated`)}`);break;case`skipped-unsupported`:n.push(` ${e}${i}no known project skill surface; skipped`);break;case`failed`:n.push(` ${e}${i}${a} ${v(`FAILED`)}: ${r.error}`);break}}}if(i&&(n.push(``),n.push(`For failed editors, add the MCP server entry or project skill manually. See:`),n.push(` https://github.com/inkeep/open-knowledge#mcp-setup`)),e.legacyProjectConfigs.length>0){n.push(``),n.push(`Project MCP configs found:`);for(let r of e.legacyProjectConfigs)n.push(` ${r.label} ${D(t,r.path)}`);n.push(` These project-local files may override the global config. Remove them if you want fully user-scoped MCP setup in this project.`)}if(e.skillInstall)switch(n.push(``),n.push(b(`User-global skill:`)),e.skillInstall){case`installed`:n.push(` open-knowledge ${_(`installed to detected agent hosts`)} via \`npx skills\``);break;case`skip-current`:n.push(` open-knowledge ${_(`already installed at current version`)}`);break;case`failed`:n.push(` ${y(`open-knowledge install failed — MCP still configured; run manually:`)}`),n.push(` ${y(` npx skills@~1.5.0 add <bundled-path> --agent '*' -g -y --copy`)}`);break}if(e.claudeDesktopDetected&&(n.push(``),n.push(`Claude Desktop App detected. To enable in Claude Chat & Cowork, run: ${b(`ok install-skill`)}`)),e.preview?(n.push(``),n.push(x(e.preview,t))):e.previewWarning&&(n.push(``),n.push(`Content preview unavailable: ${e.previewWarning}`)),r){let t=new Set,r=e.editors.filter(e=>e.action===`written`||e.action===`overwritten`).filter(e=>!t.has(e.editorId)&&t.add(e.editorId)).map(e=>e.label);n.push(``),n.push(`${_(`✓`)} ${b(`Next steps:`)}`),n.push(` 1. Open your editor (${g(r.join(` / `))})`),n.push(` 2. Approve the MCP server when prompted`),n.push(` 3. (Optional) scaffold the starter knowledge-base structure:`),n.push(` - ${g(`ok seed`)}`),n.push(` 4. Use the three MCP workflow tools as you build the wiki:`),n.push(` - ${g(`mcp__open-knowledge__ingest`)} — capture an external source`),n.push(` - ${g(`mcp__open-knowledge__research`)} — gather sources and write findings`),n.push(` - ${g(`mcp__open-knowledge__consolidate`)} — promote research to canonical articles`)}return n.join(`
406
406
  `)}function br(e,t){let n=[];for(let r of zn)pr(Q[r],e,t)&&n.push(r);return n}function xr(){return new i(`init`).description(`Scaffold .ok/ in the current directory and register the MCP server for your editor(s)`).option(`--mcp`,`Register the MCP server for selected editors (default: true)`,!0).option(`--no-mcp`,`Scaffold the .ok/ directory but do not touch MCP config`).option(`--dev-mcp`,`Register a local dev MCP entry using node + packages/cli/dist/cli.mjs with debug logging`).addOption(new r(`--scope <scope>`,`Write MCP config at user level, project level, or both`).choices([`user`,`project`,`both`])).action(async e=>{let t=process.cwd(),n;try{n=await vr({cwd:t,mcp:e.mcp,devMcp:e.devMcp,scope:e.scope})}catch(e){if(e instanceof u){process.stderr.write(`open-knowledge requires git to initialize a parent repo. Install git or run 'git init' yourself, then re-run.
407
- `),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}try{let{previewContent:e}=await import(`./preview-Dy00IGYn.mjs`),{loadConfig:r}=await import(`./loader-CTQL6JBJ.mjs`),{resolveContentDir:i}=await import(`./dist-CeydCXIY.mjs`),{config:a}=r(t),o=i(a,t);n.preview=e({projectDir:t,contentDir:o})}catch(e){n.previewWarning=e instanceof Error?e.message:String(e)}process.stdout.write(`${yr(n,t)}\n`),(n.editors.some(e=>e.action===`failed`)||n.mcpAction===`failed`)&&(process.exitCode=1)})}export{L as S,ot as _,lr as a,ze as b,gr as c,Rn as d,rt as f,nt as g,it as h,_r as i,zn as l,tt as m,yr as n,vr as o,et as p,xr as r,$ as s,br as t,Q as u,Ze as v,ge as x,Be as y};
408
- //# sourceMappingURL=init-qh1HubtR.mjs.map
407
+ `),e.stderr&&process.stderr.write(`${e.stderr.trim()}\n`),process.exitCode=1;return}throw e}try{let{previewContent:e}=await import(`./preview-BHYdZs7Y.mjs`),{loadConfig:r}=await import(`./loader-DQvI2UUK.mjs`),{resolveContentDir:i}=await import(`./dist-tZe2rFf6.mjs`),{config:a}=r(t),o=i(a,t);n.preview=e({projectDir:t,contentDir:o})}catch(e){n.previewWarning=e instanceof Error?e.message:String(e)}process.stdout.write(`${yr(n,t)}\n`),(n.editors.some(e=>e.action===`failed`)||n.mcpAction===`failed`)&&(process.exitCode=1)})}export{L as S,ot as _,lr as a,ze as b,gr as c,Rn as d,rt as f,nt as g,it as h,_r as i,zn as l,tt as m,yr as n,vr as o,et as p,xr as r,$ as s,br as t,Q as u,Ze as v,ge as x,Be as y};
408
+ //# sourceMappingURL=init-Bzm3Bj4h.mjs.map
@@ -0,0 +1 @@
1
+ import{o as e}from"./init-Bzm3Bj4h.mjs";export{e as runInit};
@@ -1,4 +1,4 @@
1
- import{Ct as e,Q as t,dn as n}from"./dist-DfIz2LcA.mjs";import{dr as r,f as i}from"./dist-RAy2NfOX.mjs";import{t as a}from"./constants-3O7IbmRt.mjs";import{t as o}from"./is-object-DF0ZeuvD.mjs";import{resolve as s}from"node:path";import{existsSync as c,readFileSync as l}from"node:fs";import{homedir as u}from"node:os";var d=n();function f(e,t){let n={...e};for(let r of Object.keys(t)){let i=e[r],a=t[r];o(a)&&o(i)?n[r]=f(i,a):a!==void 0&&(n[r]=a)}return n}function p(e){if(!c(e))return{value:null,path:e,source:null,doc:null};let t;try{t=l(e,`utf-8`)}catch(t){return console.warn(`[config] Failed to read ${e}: ${t instanceof Error?t.message:t}`),{value:null,path:e,source:null,doc:null}}let n=(0,d.parseDocument)(t);if(n.errors.length>0)return console.warn(`[config] Failed to parse ${e}: ${n.errors.map(e=>e.message).join(`; `)}`),{value:null,path:e,source:t,doc:null};let r=n.toJSON();return o(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}const m=[`include`,`exclude`];function h(e){let t="Run `ok config migrate` to strip the obsolete key from config.yml automatically, or remove it by hand.";return e===`exclude`?[`Move these patterns to .okignore at the project root (gitignore syntax, 1:1 migration).`,t].join(` `):[`content.include has been removed.`,`For subdirectory scoping, set content.dir in .ok/config.yml instead.`,`For pattern-based filtering, use .okignore (gitignore syntax — exclude-only; do not copy include patterns directly).`,t].join(` `)}function g(t){let n=t.value;if(!o(n))return[];let r=n.content;if(!o(r))return[];let i=[];for(let n of m)if(n in r){let r=[`content`,n],a;t.doc!==null&&t.source!==null&&(a=e({file:t.path,source:t.source,doc:t.doc,path:r})),i.push({code:`REMOVED_KEY`,path:r,redirect:h(n),...a===void 0?{}:{source:a}})}return i}function _(t,n){return t.map(t=>{let r=t.path.map(e=>typeof e==`symbol`?String(e):e),i={path:r,message:t.message,issueCode:t.code};if(n.doc!==null&&n.source!==null){let t=e({file:n.path,source:n.source,doc:n.doc,path:r});if(t!==void 0)return{...i,source:t}}return i})}function v(e){let n=e??process.cwd(),o=[],c=s(u(),`.ok`,a),l=r({absPath:c}),d={};l.valid&&l.source!==void 0?(d=f(d,l.value),o.push(c)):l.valid;let m=s(n,`.ok`,a),h=p(m);if(h.value!==null){let e=g(h);if(e.length>0)throw Error(e.map(t).join(`
1
+ import{Ct as e,Q as t,dn as n}from"./dist-Cp4ojTBN.mjs";import{dr as r,f as i}from"./dist-Bfxmzk9L.mjs";import{t as a}from"./constants-DTqDNUS7.mjs";import{t as o}from"./is-object-DF0ZeuvD.mjs";import{resolve as s}from"node:path";import{existsSync as c,readFileSync as l}from"node:fs";import{homedir as u}from"node:os";var d=n();function f(e,t){let n={...e};for(let r of Object.keys(t)){let i=e[r],a=t[r];o(a)&&o(i)?n[r]=f(i,a):a!==void 0&&(n[r]=a)}return n}function p(e){if(!c(e))return{value:null,path:e,source:null,doc:null};let t;try{t=l(e,`utf-8`)}catch(t){return console.warn(`[config] Failed to read ${e}: ${t instanceof Error?t.message:t}`),{value:null,path:e,source:null,doc:null}}let n=(0,d.parseDocument)(t);if(n.errors.length>0)return console.warn(`[config] Failed to parse ${e}: ${n.errors.map(e=>e.message).join(`; `)}`),{value:null,path:e,source:t,doc:null};let r=n.toJSON();return o(r)?{value:r,path:e,source:t,doc:n}:{value:null,path:e,source:t,doc:n}}const m=[`include`,`exclude`];function h(e){let t="Run `ok config migrate` to strip the obsolete key from config.yml automatically, or remove it by hand.";return e===`exclude`?[`Move these patterns to .okignore at the project root (gitignore syntax, 1:1 migration).`,t].join(` `):[`content.include has been removed.`,`For subdirectory scoping, set content.dir in .ok/config.yml instead.`,`For pattern-based filtering, use .okignore (gitignore syntax — exclude-only; do not copy include patterns directly).`,t].join(` `)}function g(t){let n=t.value;if(!o(n))return[];let r=n.content;if(!o(r))return[];let i=[];for(let n of m)if(n in r){let r=[`content`,n],a;t.doc!==null&&t.source!==null&&(a=e({file:t.path,source:t.source,doc:t.doc,path:r})),i.push({code:`REMOVED_KEY`,path:r,redirect:h(n),...a===void 0?{}:{source:a}})}return i}function _(t,n){return t.map(t=>{let r=t.path.map(e=>typeof e==`symbol`?String(e):e),i={path:r,message:t.message,issueCode:t.code};if(n.doc!==null&&n.source!==null){let t=e({file:n.path,source:n.source,doc:n.doc,path:r});if(t!==void 0)return{...i,source:t}}return i})}function v(e){let n=e??process.cwd(),o=[],c=s(u(),`.ok`,a),l=r({absPath:c}),d={};l.valid&&l.source!==void 0?(d=f(d,l.value),o.push(c)):l.valid;let m=s(n,`.ok`,a),h=p(m);if(h.value!==null){let e=g(h);if(e.length>0)throw Error(e.map(t).join(`
2
2
 
3
3
  `));d=f(d,h.value),o.push(m)}y(d,[`upload`,`maxBytes`],`streaming uploads have no user-facing cap`),y(d,[`github`,`oauthAppClientId`],`use the OPEN_KNOWLEDGE_GITHUB_CLIENT_ID env var instead`),y(d,[`server`,`host`],`use the --host flag or HOST env var instead`),y(d,[`server`,`openOnAgentEdit`]),y(d,[`mcp`,`autoStart`],`to disable auto-start, set OK_MCP_AUTOSTART=0`),y(d,[`mcp`,`tools`,`read_document`,`historyDepth`]),y(d,[`mcp`,`tools`,`grep`,`maxResults`]),y(d,[`mcp`,`tools`,`search`,`maxResults`]);let v=i.safeParse(d);if(!v.success){let e={code:`SCHEMA_INVALID`,issues:_(v.error.issues,h)};throw Error(t(e))}return{config:v.data,sources:o}}function y(e,t,n){let r=e;for(let e=0;e<t.length-1;e++){if(!o(r))return;r=r[t[e]]}if(!o(r))return;let i=t[t.length-1];if(r[i]===void 0)return;let a=t.join(`.`);console.warn(`[config] ${a} is no longer user-configurable; ${n??`the value is hardcoded in @inkeep/open-knowledge-core`}. Remove the key to silence this warning.`)}export{v as t};
4
- //# sourceMappingURL=loader-DMES5Z4K.mjs.map
4
+ //# sourceMappingURL=loader--zxukDZu.mjs.map
@@ -0,0 +1 @@
1
+ import{t as e}from"./loader--zxukDZu.mjs";export{e as loadConfig};
@@ -0,0 +1 @@
1
+ import{n as e,t}from"./preview-XajysOgG.mjs";export{t as formatPreviewBlock,e as previewContent};
@@ -1,3 +1,3 @@
1
- import{ht as e}from"./dist-RAy2NfOX.mjs";import"./constants-3O7IbmRt.mjs";import{join as t,relative as n}from"node:path";import{existsSync as r,lstatSync as i,readdirSync as a,realpathSync as o,statSync as s}from"node:fs";function c(r){let{projectDir:c,contentDir:l,sampleCap:u=5}=r,d=[],f=[];try{i(l)}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[`cannot access content directory ${l}: ${e instanceof Error?e.message:String(e)}`]}}let p;try{p=e({projectDir:c,contentDir:l})}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[e instanceof Error?e.message:String(e)]}}function m(e){let r;try{r=a(e,{withFileTypes:!0})}catch(t){let r=t instanceof Error?t.message:String(t);d.push(`could not read directory ${n(l,e)||`.`}: ${r}`);return}for(let i of r){let r=t(e,i.name);if(i.isSymbolicLink()){let e;try{e=o(r)}catch(e){let t=e.code;t===`ENOENT`||t===`ELOOP`?d.push(`broken or cyclic symlink: ${n(l,r)}`):d.push(`cannot resolve symlink ${n(l,r)}: ${t??`unknown error`}`);continue}let t;try{t=s(e)}catch{continue}if(t.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(t.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}else if(i.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(i.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}}return m(l),{totalCount:f.length,sample:f.slice(0,u),contentDir:l,warnings:d}}function l(e,i){let a=[],o=n(i,e.contentDir),s=o===``?`./`:`./${o}`;if(a.push(`Content:`),a.push(` Found ${e.totalCount} markdown files in ${s}`),e.sample.length>0){let t=e.sample.join(`, `),n=e.totalCount>e.sample.length?`, …`:``;a.push(` Sample: ${t}${n}`)}if(e.warnings.length>0)for(let t of e.warnings)a.push(` Warning: ${t}`);return a.push(``),r(t(i,`.ok`,`config.yml`))?(a.push(` To adjust scope, add patterns to .okignore at the project root.`),a.push(` To change the content root, edit .ok/config.yml → content.dir.`)):a.push(" Run `open-knowledge init` to scaffold config + .okignore."),a.push(``),a.push(` Re-check anytime: open-knowledge preview`),a.join(`
1
+ import{ht as e}from"./dist-Bfxmzk9L.mjs";import"./constants-DTqDNUS7.mjs";import{join as t,relative as n}from"node:path";import{existsSync as r,lstatSync as i,readdirSync as a,realpathSync as o,statSync as s}from"node:fs";function c(r){let{projectDir:c,contentDir:l,sampleCap:u=5}=r,d=[],f=[];try{i(l)}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[`cannot access content directory ${l}: ${e instanceof Error?e.message:String(e)}`]}}let p;try{p=e({projectDir:c,contentDir:l})}catch(e){return{totalCount:0,sample:[],contentDir:l,warnings:[e instanceof Error?e.message:String(e)]}}function m(e){let r;try{r=a(e,{withFileTypes:!0})}catch(t){let r=t instanceof Error?t.message:String(t);d.push(`could not read directory ${n(l,e)||`.`}: ${r}`);return}for(let i of r){let r=t(e,i.name);if(i.isSymbolicLink()){let e;try{e=o(r)}catch(e){let t=e.code;t===`ENOENT`||t===`ELOOP`?d.push(`broken or cyclic symlink: ${n(l,r)}`):d.push(`cannot resolve symlink ${n(l,r)}: ${t??`unknown error`}`);continue}let t;try{t=s(e)}catch{continue}if(t.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(t.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}else if(i.isDirectory()){let e=n(l,r);if(p.isDirExcluded(e))continue;m(r)}else if(i.isFile()){let e=n(l,r);if(p.isExcluded(e))continue;f.push(e)}}}return m(l),{totalCount:f.length,sample:f.slice(0,u),contentDir:l,warnings:d}}function l(e,i){let a=[],o=n(i,e.contentDir),s=o===``?`./`:`./${o}`;if(a.push(`Content:`),a.push(` Found ${e.totalCount} markdown files in ${s}`),e.sample.length>0){let t=e.sample.join(`, `),n=e.totalCount>e.sample.length?`, …`:``;a.push(` Sample: ${t}${n}`)}if(e.warnings.length>0)for(let t of e.warnings)a.push(` Warning: ${t}`);return a.push(``),r(t(i,`.ok`,`config.yml`))?(a.push(` To adjust scope, add patterns to .okignore at the project root.`),a.push(` To change the content root, edit .ok/config.yml → content.dir.`)):a.push(" Run `open-knowledge init` to scaffold config + .okignore."),a.push(``),a.push(` Re-check anytime: open-knowledge preview`),a.join(`
2
2
  `)}export{c as n,l as t};
3
- //# sourceMappingURL=preview-CZdt-b-O.mjs.map
3
+ //# sourceMappingURL=preview-XajysOgG.mjs.map