@inkeep/open-knowledge 0.15.1-beta.6 → 0.15.1-beta.8

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 (49) hide show
  1. package/dist/assets/skills/discovery/SKILL.md +1 -1
  2. package/dist/assets/skills/project/SKILL.md +2 -2
  3. package/dist/cli.mjs +39 -39
  4. package/dist/constants-BVR2lBMG.mjs +2 -0
  5. package/dist/dist-By70vg0t.mjs +1 -0
  6. package/dist/{dist-Bl_tym1Z.mjs → dist-CTSVLMDV.mjs} +9 -9
  7. package/dist/{gh-detect-DRHds4VZ.mjs → gh-detect-wbzQ2Z5B.mjs} +2 -2
  8. package/dist/index.mjs +1 -1
  9. package/dist/init-CouVGATa.mjs +1 -0
  10. package/dist/{init-Bjqbi7tq.mjs → init-aYL9jcNv.mjs} +4 -4
  11. package/dist/{loader-BkYww0cx.mjs → loader-CWI8ks9W.mjs} +3 -3
  12. package/dist/loader-m_58dShD.mjs +1 -0
  13. package/dist/preview-D3Z-uBc0.mjs +1 -0
  14. package/dist/{preview-D9LzF-Fr.mjs → preview-D8NePS8S.mjs} +2 -2
  15. package/dist/public/assets/{ActivityModeContent-CcoGE_xm.js → ActivityModeContent-Csy-lYtm.js} +1 -1
  16. package/dist/public/assets/{DocumentContext-BYFYD2OR.js → DocumentContext-C8n-fc7S.js} +1 -1
  17. package/dist/public/assets/{GraphPanel-B-5AaMRg.js → GraphPanel-DXELWJD9.js} +1 -1
  18. package/dist/public/assets/{OpenInAgentMenuRequestContext-Df4A0AvJ.js → OpenInAgentMenuRequestContext-BqvKATfT.js} +1 -1
  19. package/dist/public/assets/{SettingsDialogBody-DEjtbwaA.js → SettingsDialogBody-BM8EOX42.js} +1 -1
  20. package/dist/public/assets/{SourceEditor-DLdOP88L.js → SourceEditor-CPuDd_gu.js} +1 -1
  21. package/dist/public/assets/{TerminalPanel-yOVM28DS.js → TerminalPanel-CDbNsVll.js} +1 -1
  22. package/dist/public/assets/{config-validation-events-CRgM6DHS.js → config-validation-events-Dom3HCUM.js} +1 -1
  23. package/dist/public/assets/{dist-CVCWWNPG.js → dist-y6LKqPoG.js} +147 -146
  24. package/dist/public/assets/index-5V9bJ3LG.css +1 -0
  25. package/dist/public/assets/{index-H6g-q9oP.js → index-COE4tg_p.js} +92 -92
  26. package/dist/public/assets/{keyboard-shortcuts-Bg9IdvnR.js → keyboard-shortcuts-DNu_Qz96.js} +1 -1
  27. package/dist/public/assets/{prop-types-BSgyUl9p.js → prop-types-CDQJyL6r.js} +1 -1
  28. package/dist/public/assets/{target-navigation-intent-BMIQLSDV.js → target-navigation-intent-Bveb0MPP.js} +1 -1
  29. package/dist/public/index.html +9 -9
  30. package/dist/{repair-launch-json-hXlTjsfs.mjs → repair-launch-json-DXLiy3_c.mjs} +2 -2
  31. package/dist/{repair-mcp-configs-h-6B0X-K.mjs → repair-mcp-configs-DB8b3UTm.mjs} +2 -2
  32. package/dist/repair-skills-BQnVB088.mjs +1 -0
  33. package/dist/{repair-skills-GcwKI4g2.mjs → repair-skills-M719vrZS.mjs} +2 -2
  34. package/dist/{server-lock-BpjJj3OD-CrZDl-wH.mjs → server-lock-BpjJj3OD-DlYx_Xz-.mjs} +26 -26
  35. package/dist/server-lock-CyhBidkz-DUTkjNDG.mjs +1 -0
  36. package/dist/{src-BJmU1xUi.mjs → src-S9W6ORmK.mjs} +2 -2
  37. package/dist/{start-DL_BorjL.mjs → start-8EN9Ekcs.mjs} +2 -2
  38. package/dist/start-_FVQvoNg.mjs +1 -0
  39. package/dist/{write-project-skill-DyOqNMyv.mjs → write-project-skill-CD8uXqFq.mjs} +2 -2
  40. package/package.json +1 -1
  41. package/dist/constants-CzR7h6sJ.mjs +0 -2
  42. package/dist/dist-CPY1U8Js.mjs +0 -1
  43. package/dist/init-U6l1ZhLC.mjs +0 -1
  44. package/dist/loader-DTHLxJVE.mjs +0 -1
  45. package/dist/preview-BQT50xLD.mjs +0 -1
  46. package/dist/public/assets/index-BztJojW-.css +0 -1
  47. package/dist/repair-skills-B4UCaBBt.mjs +0 -1
  48. package/dist/server-lock-CyhBidkz-DXuuHDkK.mjs +0 -1
  49. package/dist/start-83Z5Rbjk.mjs +0 -1
@@ -326,7 +326,7 @@ $2`).split(`
326
326
  `),T=v.split(`
327
327
  `),E=Math.min(w.length,T.length);for(let e=0;e<E;e++){let t=w[e]??``,r=T[e]??``;if(t!==r&&C(t)===C(r)&&/^[ \t]*\d+[.)]\s/.test(t)){n.push(`ordered-list-marker-number`);break}}return(/[ \t]\n/.test(_)||/[ \t]\n/.test(v))&&n.push(`trailing-whitespace`),(/[ \t]$/.test(_)||/[ \t]$/.test(v))&&(n.includes(`trailing-whitespace`)||n.push(`trailing-whitespace`)),(/\n{3,}/.test(_)||/\n{3,}/.test(v))&&n.push(`blank-line-collapse`),_.endsWith(`
328
328
  `)!==v.endsWith(`
329
- `)&&n.push(`trailing-newline`),n}const FG={setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e),now:()=>Date.now()},IG={"emphasis-around-code":`pm-model-caused`,bom:`parser-caused`,crlf:`parser-caused`,"commonmark-escape":`parser-caused`,"leading-newline":`parser-caused`,"paragraph-continuation-indent":`parser-caused`,"doc-start-thematic":`parser-caused`,"block-separator-collapse":`serializer-caused`,"table-align-row-spacing":`serializer-caused`,"row-no-trailing-pipe":`serializer-caused`,"ordered-list-marker-number":`serializer-caused`,"list-indent-canonical":`serializer-caused`,"trailing-whitespace":`serializer-caused`,"blank-line-collapse":`serializer-caused`,"trailing-newline":`serializer-caused`};function LG(e){return IG[e]}function RG(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e.charCodeAt(r)!==t.charCodeAt(r))return r;return e.length===t.length?-1:n}let zG=null;function BG(e){zG=e}function VG(e,t,n,r){if(!zG||e.length===0)return;let i=RG(t,n),a=new Date().toISOString();for(let t of e)zG({timestamp:a,className:t,documentName:r,codeUnitPosition:i,severity:LG(t)})}const HG=1,UG={protocol:`x-ok-client-protocol`,runtime:`x-ok-client-runtime`,kind:`x-ok-client-kind`};function WG({kind:e,runtimeVersion:t}){return{[UG.protocol]:`1`,[UG.runtime]:t,[UG.kind]:e}}const GG=`__system__`,KG=1,qG=`__config__/project`,JG=`__user__/config.yml`,YG=`__local__/project`,XG=`__config__/okignore`,ZG=Object.freeze([qG,YG,JG,XG]),QG=new Set(Object.keys({sh:`bash`,zsh:`bash`,bash:`bash`,c:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,"c++":`cpp`,h:`c`,hh:`cpp`,hpp:`cpp`,cs:`csharp`,css:`css`,less:`less`,scss:`scss`,sass:`scss`,diff:`diff`,patch:`diff`,go:`go`,gql:`graphql`,graphql:`graphql`,ini:`ini`,cfg:`ini`,conf:`ini`,properties:`ini`,java:`java`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,jsonc:`json`,kt:`kotlin`,kts:`kotlin`,lua:`lua`,makefile:`makefile`,md:`markdown`,mdx:`markdown`,m:`objectivec`,mm:`objectivec`,pl:`perl`,pm:`perl`,php:`php`,phtml:`php`,py:`python`,pyi:`python`,pyx:`python`,r:`r`,rb:`ruby`,rs:`rust`,sql:`sql`,swift:`swift`,ts:`typescript`,tsx:`typescript`,xml:`xml`,yaml:`yaml`,yml:`yaml`})),$G=`epoch`,eK=512*1024,tK=[`claude`,`claude-desktop`,`cursor`,`codex`],nK={claude:`Claude`,"claude-desktop":`Claude Desktop`,cursor:`Cursor`,codex:`Codex`},rK={cursor:/\bCursor(?:\([^)]+\))?\/\d/,codex:/\bCodex(?:\([^)]+\))?\/\d/,"claude-desktop":/\bClaude(?:\([^)]+\))?\/\d/},iK=`Ov23liqlSd0V1MwR6rhI`,aK=[`incoming`,`outgoing`,`both`];function oK(e){return aK.includes(e)}const sK=1e4,cK=`last-spawn-error.log`,lK=[{id:`chart`,title:`Chart`,description:`A bar chart whose series colors track the OK chart palette.`,html:`<div style="font-family:system-ui,sans-serif;padding:20px;color:var(--foreground)">
329
+ `)&&n.push(`trailing-newline`),n}const FG={setTimeout:(e,t)=>globalThis.setTimeout(e,t),clearTimeout:e=>globalThis.clearTimeout(e),now:()=>Date.now()},IG={"emphasis-around-code":`pm-model-caused`,bom:`parser-caused`,crlf:`parser-caused`,"commonmark-escape":`parser-caused`,"leading-newline":`parser-caused`,"paragraph-continuation-indent":`parser-caused`,"doc-start-thematic":`parser-caused`,"block-separator-collapse":`serializer-caused`,"table-align-row-spacing":`serializer-caused`,"row-no-trailing-pipe":`serializer-caused`,"ordered-list-marker-number":`serializer-caused`,"list-indent-canonical":`serializer-caused`,"trailing-whitespace":`serializer-caused`,"blank-line-collapse":`serializer-caused`,"trailing-newline":`serializer-caused`};function LG(e){return IG[e]}function RG(e,t){let n=Math.min(e.length,t.length);for(let r=0;r<n;r++)if(e.charCodeAt(r)!==t.charCodeAt(r))return r;return e.length===t.length?-1:n}let zG=null;function BG(e){zG=e}function VG(e,t,n,r){if(!zG||e.length===0)return;let i=RG(t,n),a=new Date().toISOString();for(let t of e)zG({timestamp:a,className:t,documentName:r,codeUnitPosition:i,severity:LG(t)})}const HG=1,UG={protocol:`x-ok-client-protocol`,runtime:`x-ok-client-runtime`,kind:`x-ok-client-kind`};function WG({kind:e,runtimeVersion:t}){return{[UG.protocol]:`1`,[UG.runtime]:t,[UG.kind]:e}}const GG=`__system__`,KG=1,qG=`__config__/project`,JG=`__user__/config.yml`,YG=`__local__/project`,XG=`__config__/okignore`,ZG=Object.freeze([qG,YG,JG,XG]),QG=new Set(Object.keys({sh:`bash`,zsh:`bash`,bash:`bash`,c:`c`,cc:`cpp`,cpp:`cpp`,cxx:`cpp`,"c++":`cpp`,h:`c`,hh:`cpp`,hpp:`cpp`,cs:`csharp`,css:`css`,less:`less`,scss:`scss`,sass:`scss`,diff:`diff`,patch:`diff`,go:`go`,gql:`graphql`,graphql:`graphql`,ini:`ini`,cfg:`ini`,conf:`ini`,properties:`ini`,java:`java`,js:`javascript`,jsx:`javascript`,mjs:`javascript`,cjs:`javascript`,jsonc:`json`,kt:`kotlin`,kts:`kotlin`,lua:`lua`,makefile:`makefile`,md:`markdown`,mdx:`markdown`,m:`objectivec`,mm:`objectivec`,pl:`perl`,pm:`perl`,php:`php`,phtml:`php`,py:`python`,pyi:`python`,pyx:`python`,r:`r`,rb:`ruby`,rs:`rust`,sql:`sql`,swift:`swift`,ts:`typescript`,tsx:`typescript`,xml:`xml`,yaml:`yaml`,yml:`yaml`})),$G=[`.mdx`,`.md`],eK=`epoch`,tK=512*1024,nK=[`claude`,`claude-desktop`,`cursor`,`codex`],rK={claude:`Claude`,"claude-desktop":`Claude Desktop`,cursor:`Cursor`,codex:`Codex`},iK={cursor:/\bCursor(?:\([^)]+\))?\/\d/,codex:/\bCodex(?:\([^)]+\))?\/\d/,"claude-desktop":/\bClaude(?:\([^)]+\))?\/\d/},aK=`Ov23liqlSd0V1MwR6rhI`,oK=[`incoming`,`outgoing`,`both`];function sK(e){return oK.includes(e)}const cK=1e4,lK=`last-spawn-error.log`,uK=[{id:`chart`,title:`Chart`,description:`A bar chart whose series colors track the OK chart palette.`,html:`<div style="font-family:system-ui,sans-serif;padding:20px;color:var(--foreground)">
330
330
  <h3 style="margin:0 0 14px;font-size:15px;font-weight:600">Revenue by region</h3>
331
331
  <div id="bars" style="display:flex;align-items:flex-end;gap:14px;height:170px"></div>
332
332
  <script>
@@ -388,24 +388,24 @@ $2`).split(`
388
388
  out.textContent = '$' + Number(amt.value).toLocaleString();
389
389
  });
390
390
  <\/script>
391
- </div>`}];function uK(e){return["```html preview",e.html,"```"].join(`
392
- `)}const dK=[{name:`--chart-1`,light:`oklch(0.62 0.19 259)`,dark:`oklch(0.72 0.14 259)`},{name:`--chart-2`,light:`oklch(0.58 0.14 145)`,dark:`oklch(0.73 0.13 145)`},{name:`--chart-3`,light:`oklch(0.62 0.15 70)`,dark:`oklch(0.77 0.14 70)`},{name:`--chart-4`,light:`oklch(0.55 0.18 290)`,dark:`oklch(0.72 0.16 290)`},{name:`--chart-5`,light:`oklch(0.58 0.21 25)`,dark:`oklch(0.72 0.2 25)`},{name:`--primary`,light:`oklch(0.6321 0.1983 259.59)`,dark:`#69a3ff`},{name:`--primary-foreground`,light:`oklch(0.985 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--background`,light:`oklch(1 0 0)`,dark:`oklch(0.145 0 0)`},{name:`--card`,light:`oklch(1 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--card-foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--muted-foreground`,light:`oklch(0.556 0 0)`,dark:`oklch(0.708 0 0)`},{name:`--border`,light:`oklch(0.922 0 0)`,dark:`oklch(1 0 0 / 10%)`},{name:`--destructive`,light:`oklch(0.577 0.245 27.325)`,dark:`oklch(0.704 0.191 22.216)`},{name:`--radius`,light:`0.625rem`,dark:`0.625rem`}],fK=`localhost`,pK=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],mK=[`video/mp4`,`video/webm`,`video/ogg`],hK=[`audio/mpeg`,`audio/wav`,`audio/ogg`],gK=[`application/pdf`],_K=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),vK=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),yK=new Set([`pdf`]),bK=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),xK=new Set(`pdf.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),SK=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(`.`)),CK=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.7z.tar.gz.rar.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.doc.xls.ppt.odt.ods.odp.pages.numbers.key.epub.mobi.csv.tsv.txt.rtf.json.yaml.yml.xml.toml.lock.gpx.html.htm`.split(`.`)),wK=new Set([`html`,`htm`]),TK=`sandbox allow-scripts; connect-src 'none'`,EK=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.json.toml.lock`.split(`.`)),DK=`same-dir`,OK=new Set(`png.jpg.jpeg.gif.webp.avif.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),kK=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],AK=[`mp4`,`webm`,`mov`,`m4v`],jK=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],MK=[`pdf`],NK=[`json`,`toml`,`lock`];function PK(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}PK(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,kK,_K),PK(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,AK,vK),PK(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,jK,bK),PK(`SIDEBAR_PDF_ASSET_EXTENSIONS`,MK,yK),PK(`FILE_ATTACHMENT_EXTENSIONS`,[...xK],OK),PK(`WIKI_EMBED_EXTENSIONS`,[...OK],CK);const FK=new Set(kK),IK=new Set(AK),LK=new Set(jK),RK=new Set(MK),zK=new Set(NK);PK(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...kK,...AK,...jK,...MK,...NK])],EK);const BK=new Set([`base`,`canvas`]),VK=new Set([...CK,...BK]);function HK(e){let t=e.toLowerCase().replace(/^\./,``);return FK.has(t)?`image`:IK.has(t)?`video`:LK.has(t)?`audio`:RK.has(t)?`pdf`:zK.has(t)||BK.has(t)||QG.has(t)?`text`:null}const UK=Ex.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3},meta:{default:null},sourceStyle:{default:`fenced`},sourceClosingFenceLength:{default:null,rendered:!1},sourceFenceIndent:{default:null,rendered:!1},sourceInfoPadding:{default:null,rendered:!1},sourceIndents:{default:null,rendered:!1}}}}),WK=zx.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}},addInputRules(){return[rx({find:Px,type:this.type,getAttributes:{sourceDelimiter:`*`}}),rx({find:Ix,type:this.type,getAttributes:{sourceDelimiter:`_`}})]}}),GK=Nx.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}},addInputRules(){return[rx({find:Ox,type:this.type,getAttributes:{sourceDelimiter:`**`}}),rx({find:Ax,type:this.type,getAttributes:{sourceDelimiter:`__`}})]}}),KK=Ib.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),qK=bx.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`}]})}}}),JK=bx.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}})}}}),YK=Vx.extend({priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`}}}}),XK=Ux.extend({priority:60,addAttributes(){return{...this.parent?.(),headingStyle:{default:`atx`},sourceTrailingHashes:{default:null},sourceUnderlineLength:{default:null},sourceContiguousNext:{default:!1},sourceLeadingIndent:{default:null,rendered:!1},sourceInteriorSpacing:{default:null,rendered:!1}}}}),ZK=bx.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]}});function QK(e){if(typeof e!=`string`||!e.startsWith(`/`))return e;let t=globalThis.window?.okDesktop?.config?.apiOrigin;return typeof t==`string`&&t?t+e:e}const $K=Gx.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceUrl:{default:null,rendered:!1}}},renderHTML({HTMLAttributes:e}){let t=Dy(this.options.HTMLAttributes,e);return typeof t.src==`string`&&(t.src=QK(t.src)),[`img`,t]}}),eq=bx.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}})}}}),tq=bx.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]}}),nq=[`https`,`http`,`mailto`,`tel`,`ftp`,`sms`],rq=nq.map(e=>`${e}:`).join(`|`);RegExp(`^(?:${rq}|\\/|#|\\?|\\.\\/|\\.\\.\\/)`,`i`);function iq(e){let t=e.trim();if(t===``)return!0;let n=t.indexOf(`:`);if(n===-1)return!0;let r=t.indexOf(`/`),i=t.indexOf(`?`),a=t.indexOf(`#`);return n>Math.min(r===-1?1/0:r,i===-1?1/0:i,a===-1?1/0:a)}const aq=new Set(nq.map(e=>`${e}:`));function oq(e){try{let t=new URL(e,`https://placeholder.invalid`);return aq.has(t.protocol.toLowerCase())}catch{return!1}}const sq=rS.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:oq,validate:oq,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}}}}),cq=bx.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 lq(e){return e.type.name===`list`&&!e.attrs.ordered}function uq(e){return e.type.name===`list`&&!!e.attrs.ordered}function dq(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function fq(e,t,n,r,i,a,o){let s=_y(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?mp(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 dp(n,a)(e,void 0)?t?dp(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 pq=bx.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,Dy(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:fq(e,t,n,r,e=>lq(e)&&!dq(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:fq(e,t,n,r,e=>uq(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:fq(e,t,n,r,e=>lq(e)&&dq(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[ox({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]})}),ox({find:/^\s*(\d+)([.)])\s$/,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]})}),new Ob({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=Ed(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()}}}),mq=bx.create({name:`listItem`,content:`paragraph block*`,defining:!0,addAttributes(){return{checked:{default:null},spread:{default:!1},sourceMarkerSpacing:{default:null,rendered:!1},sourceOrdinal:{default:null,rendered:!1},sourceCheckboxChar:{default:null,rendered:!1},sourceContinuationIndent:{default:null,rendered:!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`,Dy(t),0]:[`li`,Dy(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(Dy(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}}}}),hq=pq,gq=mq,_q=bx.create({name:`mathInline`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{formula:{default:``},id:{default:null},language:{default:`latex`},sourceDelimiter:{default:null,rendered:!1}}},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}})}}}),vq=bx.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}}}}),yq=mw.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),bq=vw.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1},sourcePadded:{default:!1,rendered:!1}}}}),xq=bx.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)}}}),Sq=Ib.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)}}}),Cq=Gb.create({name:`docFidelity`,addGlobalAttributes(){return[{types:[`doc`],attributes:{sourceDocBoundary:{default:null,rendered:!1}}}]}}),wq=bx.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}]}}),Tq=new Map([[32,` `],[9,` `]]);function Eq(e){let t=/^&#(x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);$/.exec(e);if(!t)return null;let n=t[1],r=n[0]===`x`||n[0]===`X`,i=Number.parseInt(r?n.slice(1):n,r?16:10);return Number.isNaN(i)?null:i}function Dq(e){let t=Eq(e);return t!==null&&Tq.has(t)}function Oq(e){let t=Eq(e);return t===null?null:Tq.get(t)??null}const kq=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function Aq(e){kq.lastIndex=0;let t=e.match(kq);if(t===null||t.join(``)!==e)return null;let n=``;for(let e of t){let t=Oq(e);if(t===null)return null;n+=t}return n}const jq=Ib.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 Mq(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||Nq(n)===r?!0:Aq(n)===r}function Nq(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}const Pq=iT.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`~~`,rendered:!1}}}}),Fq=dw.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null},sourceOuterPipes:{default:null,rendered:!1},sourceAlignmentPadding:{default:null,rendered:!1}}}}),Iq=XC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),Lq=ZC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),Rq=bx.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()}}}),zq=/^(?:---|—-|___\s|\*\*\*\s)$/;function Bq(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}const Vq=xw.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[ix({find:zq,type:this.type,getAttributes:e=>({sourceRaw:Bq(e)})})]}});function Hq(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function Uq(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const Wq=bx.create({name:`wikiLink`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1},sourceTarget:{default:null,rendered:!1},sourceAnchor:{default:null,rendered:!1},sourceAlias:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:Hq(e.getAttribute(`data-alias`)),anchor:Hq(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:Hq(e.getAttribute(`data-alias`)),anchor:Hq(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=Hq(e.attrs.alias),i=Hq(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`},Uq({target:n,alias:r,anchor:i})]}});function Gq(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function Kq(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const qq=[eq,vq,tq,_q,Wq,bx.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:Hq(e.getAttribute(`data-alias`)),anchor:Hq(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=Hq(e.attrs.alias),i=Hq(e.attrs.anchor),a=Hq(e.attrs.resolvedSrc),o=Gq(n);if(_K.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`},Kq({target:n,alias:r,anchor:i})]}}),Rq,hq,gq,WK,GK,Pq,bq,UK,yq,XK,Vq,sq,ZK,cq,YK,KK,Cq,jq,XT.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,italic:!1,bold:!1,strike:!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}}),Fq.configure({resizable:!0}),QC,Lq,Iq,$K.configure({inline:!0}),wq,oS,Sq,xq,JK,qK],Jq=/^[a-zA-Z0-9][\w/-]*$/;function Yq(e){return e.startsWith(`#`)?e.slice(1):e}function Xq(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function Zq(e){if(!e||e.trim()===``)return[];let{map:t}=qW(e);if(!t)return[];let n=Xq(t.tags),r=[];for(let e of n){let t=Yq(e);Jq.test(t)&&r.push(t)}return r}function Qq(e){if(e.length===0)return{ok:!1,reason:`docName must not be empty`};if(e.trim().length===0)return{ok:!1,reason:`docName must not be blank (whitespace only)`};if(e!==e.trim())return{ok:!1,reason:`docName must not have leading or trailing whitespace`};for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return{ok:!1,reason:`docName must not contain control characters`}}if(e.includes(`..`)||e.startsWith(`/`)||e.includes(`\\`))return{ok:!1,reason:`docName must not contain "..", a leading "/", or a backslash`};for(let t of e.split(`/`)){if(t.length===0)return{ok:!1,reason:`docName must not contain empty path segments (no leading, trailing, or doubled "/")`};if(t.startsWith(`.`))return{ok:!1,reason:`docName path segments must not start with "." (hidden files are not addressable)`}}return{ok:!0}}function $q(e){return e.split(`/`).some(e=>e.startsWith(`.`))}function eJ(e,t){let n=Qq(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}const tJ=k().superRefine(eJ).optional(),nJ={agentId:k().optional(),agentName:k().optional(),colorSeed:k().optional(),clientName:k().optional(),clientVersion:k().optional(),label:k().optional()},rJ=k().optional(),iJ=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,aJ=$s(`kind`,[N({kind:F(`doc`),docPath:k().min(1)}).loose(),N({kind:F(`folder`),folderPath:k()}).loose()]),oJ=P([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`]),sJ=$s(`ok`,[N({ok:F(!0),shareUrl:k().min(1),sharedUrl:k().min(1),branch:k().min(1)}).loose(),N({ok:F(!1),error:oJ,branch:k().min(1).optional()}).loose()]),cJ=P([`user`,`org`]),lJ=N({login:k().min(1),kind:cJ,avatarUrl:k().optional()}).loose(),uJ=P([`auth-required`,`network`]),dJ=$s(`ok`,[N({ok:F(!0),owners:M(lJ)}).loose(),N({ok:F(!1),error:uJ}).loose()]),fJ=$s(`ok`,[N({ok:F(!0),available:j()}).loose(),N({ok:F(!1),error:uJ}).loose()]),pJ=P([`public`,`private`]),mJ=N({owner:k().min(1),name:k().min(1),visibility:pJ,description:k().optional()}).loose(),hJ=P([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),gJ=$s(`ok`,[N({ok:F(!0),ownerLogin:k().min(1),repoName:k().min(1),cloneUrl:k().min(1),defaultBranch:k().min(1)}).loose(),N({ok:F(!1),error:hJ}).loose()]);function _J(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}const vJ=e=>e.refine(_J,`invalid branch name`);function yJ(e){if(e==null)return!1;let t=e instanceof Error?e.message:String(e);return/couldn'?t find remote ref|Remote branch .+ not found/i.test(t)}const bJ={shareTargetExists:j(),dirtyConflicts:N({conflicts:j(),files:M(k().min(1))}).loose(),branchIsLocal:j()},xJ=$s(`detached`,[N({detached:F(!1),currentBranch:k().min(1).nullable(),currentHeadSha:Bs(),...bJ}).loose(),N({detached:F(!0),currentBranch:Bs(),currentHeadSha:k().min(1),...bJ}).loose()]),SJ=N({branch:vJ(k().min(1)),principalId:k().optional()}).loose(),CJ=P([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`]),wJ=$s(`ok`,[N({ok:F(!0)}).loose(),N({ok:F(!1),reason:CJ,files:M(k().min(1)).optional(),otherWorktreePath:k().min(1).optional()}).loose()]),TJ=N({serverInstanceId:k().min(1),currentBranch:k().min(1).optional(),currentDiskAckSVs:rc(k().min(1),k().min(1)).optional()}).loose(),EJ=N({id:k().min(1),display_name:k().min(1),display_email:k(),source:P([`git-config`,`synthesized`]),created_at:k().min(1)}).loose(),DJ=N({collabUrl:k().nullable(),previewUrl:k().nullable(),port:A(),paneTarget:k().nullable(),singleFile:j().default(!1)}).loose(),OJ=P(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:frontmatter-malformed.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:disk-divergence.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:no-conflict-tracked.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:single-file-mode.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed`.split(`.`));function kJ(e){throw Error(`Unexpected ProblemType variant: ${JSON.stringify(e)}`)}const AJ=N({type:OJ,title:k().min(1),status:A().int().min(400).max(599),instance:k().regex(iJ,`instance must be urn:uuid:<uuid>`).optional(),detail:k().optional()}).loose(),jJ=N({parentDocName:k().min(1),agentId:k().min(1).optional(),agentName:k().min(1).optional()}).loose(),MJ=N({src:k().min(1),path:k().min(1).optional(),deduped:j().optional()}).loose(),NJ=N({url:k().min(1),dir:k().min(1),branch:k().min(1).refine(_J,`invalid branch name`).optional()}).loose(),PJ=N({type:F(`error`),problem:AJ}).loose();function FJ(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}if(r>=0){let e=n[r];if(e.type===`mdxJsxAttribute`&&e.value!=null&&typeof e.value==`object`&&e.value.type===`mdxJsxAttributeValueExpression`&&IJ(e.value.value,t))continue}let o=LJ(e,t);r>=0?n[r]=o:n.push(o)}return n}function IJ(e,t){try{return JSON.stringify(JSON.parse(e))===JSON.stringify(t)}catch{return!1}}function LJ(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 RJ(e,t,n,r){return{type:`mdxJsxFlowElement`,name:e,attributes:FJ(t,r),children:n.all(t),data:{}}}const zJ=/^[A-Za-z0-9]{20,}$/,BJ=/^(?:\d+s?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function VJ(e){let t=e.toLowerCase();return t===`loom.com`||t===`www.loom.com`}function HJ(e){let t=e.pathname.match(/^\/(?:share|embed)\/([A-Za-z0-9]+)\/?$/);if(!t)return null;let n=t[1]??``;return zJ.test(n)?n:null}function UJ(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!VJ(t.hostname))return null;let n=HJ(t);if(!n)return null;let r=t.searchParams.get(`t`);return{id:n,startRaw:r&&r.length>0&&BJ.test(r)?r:null}}function WJ(e){return UJ(e)!==null}function GJ(e){let t=e.toLowerCase();return t===`vimeo.com`||t===`www.vimeo.com`||t===`player.vimeo.com`}function KJ(e){if(typeof e!=`string`||e.length===0)return!1;let t;try{t=new URL(e)}catch{return!1}return t.protocol!==`http:`&&t.protocol!==`https:`?!1:GJ(t.hostname)}const qJ=/^[A-Za-z0-9_-]{11}$/;function JJ(e){let t=e.toLowerCase();return t===`youtube.com`||t===`www.youtube.com`||t===`m.youtube.com`||t===`music.youtube.com`||t===`youtu.be`||t===`youtube-nocookie.com`||t===`www.youtube-nocookie.com`}function YJ(e){if(e.length===0)return null;if(/^[0-9]+$/.test(e)){let t=Number.parseInt(e,10);return t>0?t:null}let t=e.match(/^(?:([0-9]+)h)?(?:([0-9]+)m)?(?:([0-9]+)s?)?$/);if(!t)return null;let n=t[1]?Number.parseInt(t[1],10):0,r=t[2]?Number.parseInt(t[2],10):0,i=t[3]?Number.parseInt(t[3],10):0,a=n*3600+r*60+i;return a>0?a:null}function XJ(e){if(e.hostname.toLowerCase()===`youtu.be`){let t=e.pathname.replace(/^\//,``).split(`/`)[0]??``;return qJ.test(t)?t:null}if(e.pathname===`/watch`){let t=e.searchParams.get(`v`)??``;return qJ.test(t)?t:null}let t=e.pathname.match(/^\/(?:embed|shorts|v)\/([A-Za-z0-9_-]{11})\/?$/);return t?t[1]??null:null}function ZJ(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!JJ(t.hostname))return null;let n=XJ(t);if(!n)return null;let r=t.searchParams.get(`t`)??t.searchParams.get(`start`)??``;return{id:n,startSeconds:r.length>0?YJ(r):null,noCookie:t.hostname.toLowerCase().endsWith(`youtube-nocookie.com`)}}const QJ=[{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`)",iconPicker:!0},{name:`color`,type:`string`,required:!1,advanced:!0,description:"Optional accent color override (hex — e.g. `#F05032`)",colorPicker:!0},{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`,hideWhen:e=>e.collapsible!==!0},{name:`children`,type:`reactnode`,required:!0,description:`Callout content`}],$J=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Image source URL`,accept:pK,autoFocus:!0},{name:`alt`,type:`string`,required:!0,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`,hidden:!0}],eY=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Embedded page URL (must start with http:// or https://)`,autoFocus:!0},{name:`title`,type:`string`,required:!1,description:`Iframe title (accessible label for screen readers)`},{name:`width`,type:`string`,required:!1,advanced:!0,description:`Embed width as a CSS length (e.g. "100%", "640px")`,cssLengthInput:!0},{name:`height`,type:`string`,required:!1,advanced:!0,description:`Embed height as a CSS length (e.g. "26rem", "480px")`,cssLengthInput:!0},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],tY=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Video source URL`,accept:mK,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 video controls (defaults to true)`,hideWhen:e=>typeof e.src==`string`&&(KJ(e.src)||WJ(e.src))},{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`,accept:pK,hideWhen:e=>typeof e.src==`string`&&(KJ(e.src)||WJ(e.src))},{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`,hideWhen:e=>typeof e.src==`string`&&WJ(e.src)},{name:`playsinline`,type:`boolean`,required:!1,advanced:!0,description:`Play inline on iOS rather than entering fullscreen`,hideWhen:e=>typeof e.src==`string`&&(KJ(e.src)||WJ(e.src))},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the video to preload`,hideWhen:e=>typeof e.src==`string`&&(ZJ(e.src)!==null||KJ(e.src)||WJ(e.src))},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],nY=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Audio source URL`,accept:hK,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`}],rY=[{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`)",iconPicker:!0},{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`}],iY=[QJ[0],QJ[1],QJ[4],QJ[5],QJ[6]],aY=[$J[0],$J[1],$J[7]],oY=[rY[0],rY[1],rY[4],rY[5]],sY=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Alt text (Obsidian alias syntax: `![[file.png|alt text]]`)"}],cY=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[clip.mp4|title]]`)"}],lY=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[song.mp3|title]]`)"}],uY=[{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#install-tabs`)"}],dY=[{name:`label`,type:`string`,required:!0,autoFocus:!0,defaultValue:`Tab`,description:`Tab strip label — shown in the clickable pill at the top`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#tab-npm`)"}],fY=[{name:`formula`,type:`string`,required:!0,autoFocus:!0,language:`latex`,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."}],pY=[fY[0]],mY=[fY[0]],hY=[{name:`chart`,type:`string`,required:!0,hidden:!0,description:`Mermaid chart source (graph / flowchart / sequenceDiagram / class / state / etc.)`}],gY=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Display name override (Obsidian alias syntax: `![[file.zip|label]]`)"}],_Y=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`File URL`,accept:[`*/*`],autoFocus:!0}],vY=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`PDF source URL`,accept:gK,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`)"}],yY=[{name:`src`,type:`string`,required:!0,description:"Path of the source doc, extension-less (e.g. `api-spec`).",autoFocus:!0},{name:`anchor`,type:`string`,required:!0,description:"Id of the `<MirrorSource>` block within the source doc."}],bY=[{name:`id`,type:`string`,required:!0,description:"Stable id agents and authors use to reference this block from `<Mirror>` elsewhere.",autoFocus:!0},{name:`children`,type:`reactnode`,required:!0,description:`Block content this MirrorSource owns — paragraphs, callouts, code, nested JSX, anything.`}];function xY(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function SY(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function CY(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 wY=[{name:`Callout`,surface:`canonical`,hasChildren:!0,props:QJ,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)=>RJ(`Callout`,e,t,QJ)},{name:`img`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:$J,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)=>RJ(`img`,e,t,$J)},{name:`video`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:tY,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)=>RJ(`video`,e,t,tY)},{name:`audio`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:nY,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)=>RJ(`audio`,e,t,nY)},{name:`Pdf`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:vY,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)=>RJ(`Pdf`,e,t,vY)},{name:`File`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:_Y,icon:`Paperclip`,category:`media`,displayName:`File`,description:`Downloadable file attachment — inline row with name + size + download link`,searchTerms:[`file`,`attachment`,`download`,`document`,`zip`,`docx`,`doc`],placeholder:{label:`Add a file`},serialize:(e,t)=>RJ(`File`,e,t,_Y)},{name:`Embed`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:eY,icon:`AppWindow`,category:`media`,displayName:`Embed`,description:'Inline web embed (iframe) — drop a URL, get a resizable preview pane. For YouTube / Vimeo / Loom prefer `<video src="…">` (player props, click-facade); `<Embed>` auto-rewrites watch URLs as a fallback.',searchTerms:[`embed`,`iframe`,`website`,`page`,`inline`,`frame`,`preview`],placeholder:{label:`Embed a URL`},serialize:(e,t)=>RJ(`Embed`,e,t,eY)},{name:`Accordion`,surface:`canonical`,hasChildren:!0,props:rY,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`],exampleBody:`Body content revealed when the accordion is expanded.`,serialize:(e,t)=>RJ(`Accordion`,e,t,rY)},{name:`Tabs`,surface:`canonical`,hasChildren:!0,emptyChildName:`Tab`,props:uY,icon:`LayoutPanelTop`,category:`content`,displayName:`Tabs`,description:"Horizontal tab strip + active panel below. Each `<Tab>` child is one panel; clickable pills at the top switch the active one. Active selection is ephemeral (resets on reload).",searchTerms:[`tabs`,`tabbed`,`panels`,`tabgroup`,`switcher`],exampleBody:`<Tab label="One">Body of the first tab panel.</Tab>
393
- <Tab label="Two">Body of the second tab panel.</Tab>`,serialize:(e,t)=>RJ(`Tabs`,e,t,uY)},{name:`Tab`,surface:`canonical`,hasChildren:!0,props:dY,icon:`PanelTop`,category:`content`,displayName:`Tab`,description:"A single tab panel inside a `<Tabs>` container — carries the strip label and the block-content body.",searchTerms:[`tab`,`panel`],exampleBody:"Panel content — must be nested inside a `<Tabs>` parent.",serialize:(e,t)=>RJ(`Tab`,e,t,dY)},{name:`Math`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:fY,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)=>RJ(`Math`,e,t,fY)},{name:`MermaidFence`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:hY,icon:`Workflow`,category:`content`,displayName:`Mermaid`,description:"Diagram rendered from Mermaid source (flowchart, sequence, class, state, ER, gantt, pie). Authored exclusively as ` ```mermaid ` fenced code.",searchTerms:[`mermaid`,`diagram`,`flowchart`,`graph`,`sequence`,`sequencediagram`,`class`,`state`,`er`,`erdiagram`,`gantt`,`pie`,`chart`],serialize:e=>({type:`code`,lang:`mermaid`,meta:null,value:e.attrs.props?.chart??``})},{name:`Mirror`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:yY,icon:`CopyPlus`,category:`content`,displayName:`Mirror`,description:"Render a read-only copy of a `<MirrorSource>` block from another doc. Use to keep the same content in sync across multiple docs without copy-paste — edits land at the source, every Mirror reflects the change.",searchTerms:[`mirror`,`sync`,`synced`,`transclude`,`embed`,`reference`,`shared block`],serialize:(e,t)=>RJ(`Mirror`,e,t,yY)},{name:`MirrorSource`,surface:`canonical`,hasChildren:!0,props:bY,icon:`GitBranch`,category:`content`,displayName:`Mirror Source`,description:'Mark a block as the source of truth for content that appears in multiple docs. Wrap any block content; `<Mirror src="…" anchor="<id>">` references render this verbatim read-only at every call-site. Edit here, propagate everywhere.',searchTerms:[`mirror source`,`sync source`,`source block`,`master block`,`shared`],exampleBody:"Authoritative content lives inside this block — edits here propagate to every `<Mirror>` that references this id.",serialize:(e,t)=>RJ(`MirrorSource`,e,t,bY)},{name:`GFMCallout`,surface:`compat`,hasChildren:!0,props:iY,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:aY,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?.sourceUrl??t?.src??``,alt:t?.alt??``,title:t?.title??null}]}}},{name:`WikiEmbedImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:sY,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:CY},{name:`WikiEmbedVideo`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:cY,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:CY},{name:`WikiEmbedAudio`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:lY,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:CY},{name:`WikiEmbedFile`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:gY,icon:`Paperclip`,category:`media`,displayName:`Wiki Embed File`,description:"Obsidian-style `![[file.zip]]` wiki-embed — read-only compat for arbitrary downloadable attachments. Renders through the `File` canonical (inline row with file-up icon + bold name + optional dim size). Edit the display name via the alias slot.",rendersAs:`File`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.size==`string`&&e.size.length>0?e.size:null;return{src:e.src,name:t??void 0,size:n??void 0}},serialize:CY},{name:`HtmlDetailsAccordion`,surface:`compat`,hasChildren:!0,props:oY,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="${xY(n.name)}"`:``,a=n?.id?` id="${xY(n.id)}"`:``,o=n?.title?.trim(),s=o?`<summary>${SY(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:pY,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:mY,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??``})}],TY={name:`*`,surface:`canonical`,hasChildren:!0,props:[],description:`Unregistered component — children editable as markdown`,serialize:(e,t)=>RJ(e.attrs.componentName||`*`,e,t)};function EY(){let e=new Map;e.set(`*`,TY);for(let t of wY)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 DY(){let e=globalThis;return e.__okYpsCounters||={block:0,inline:0},e.__okYpsCounters}const OY={parseFallback:{blockLevel:0,wholeDoc:0,wholeDocBudget:0},jsxRenderFailure:{},jsxAutoConvertFailed:{},jsxAutoConvertSucceeded:{},jsxPropDropped:{},jsxMoveFailed:{},jsxStuckCopyFailed:{},jsxStuckDeleteFailed:{},jsxPopoverCloseRestoreFailed:{},jsxKeyboardDeleteFailed:{},blockGripClickSelectFailed:{},jsxArrowNodeSelectFailed:{}};function kY(){OY.parseFallback.blockLevel++}function AY(){OY.parseFallback.wholeDoc++}function jY(){OY.parseFallback.wholeDocBudget++}function MY(){let e=DY();return{parseFallback:{...OY.parseFallback},ypsMismatch:{block:e.block,inline:e.inline},jsxRenderFailure:{...OY.jsxRenderFailure},jsxAutoConvertFailed:{...OY.jsxAutoConvertFailed},jsxAutoConvertSucceeded:{...OY.jsxAutoConvertSucceeded},jsxPropDropped:{...OY.jsxPropDropped},jsxMoveFailed:{...OY.jsxMoveFailed},jsxStuckCopyFailed:{...OY.jsxStuckCopyFailed},jsxStuckDeleteFailed:{...OY.jsxStuckDeleteFailed},jsxPopoverCloseRestoreFailed:{...OY.jsxPopoverCloseRestoreFailed},jsxKeyboardDeleteFailed:{...OY.jsxKeyboardDeleteFailed},blockGripClickSelectFailed:{...OY.blockGripClickSelectFailed},jsxArrowNodeSelectFailed:{...OY.jsxArrowNodeSelectFailed}}}const NY=/^(`{3,}|~{3,})/gm;function PY(e){let t=[],n=null;for(let r of e.matchAll(NY)){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 FY(e,t){return t.some(([t,n])=>e>=t&&e<n)}const IY=/^[ \t]{0,3}\[([^\]]+)\]:\s*(\S+)(\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\s*$/gm;function LY(e){let t=PY(e),n=[];for(let r of e.matchAll(IY))FY(r.index,t)||n.push(r[0].trimEnd());return n.length>0?`${n.join(`
394
- `)}\n\n`:``}function RY(e,t){let n={startMs:typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),calls:0};return VY(e,t.parse,0,n)}function zY(e){return e.calls>=1e3?!0:(typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now())-e.startMs>=500}function BY(e){return e instanceof Error?{name:e.name,message:e.message.slice(0,500),stack:e.stack?.split(`
391
+ </div>`}];function dK(e){return["```html preview",e.html,"```"].join(`
392
+ `)}const fK=[{name:`--chart-1`,light:`oklch(0.62 0.19 259)`,dark:`oklch(0.72 0.14 259)`},{name:`--chart-2`,light:`oklch(0.58 0.14 145)`,dark:`oklch(0.73 0.13 145)`},{name:`--chart-3`,light:`oklch(0.62 0.15 70)`,dark:`oklch(0.77 0.14 70)`},{name:`--chart-4`,light:`oklch(0.55 0.18 290)`,dark:`oklch(0.72 0.16 290)`},{name:`--chart-5`,light:`oklch(0.58 0.21 25)`,dark:`oklch(0.72 0.2 25)`},{name:`--primary`,light:`oklch(0.6321 0.1983 259.59)`,dark:`#69a3ff`},{name:`--primary-foreground`,light:`oklch(0.985 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--background`,light:`oklch(1 0 0)`,dark:`oklch(0.145 0 0)`},{name:`--card`,light:`oklch(1 0 0)`,dark:`oklch(0.205 0 0)`},{name:`--card-foreground`,light:`oklch(0.145 0 0)`,dark:`oklch(0.985 0 0)`},{name:`--muted-foreground`,light:`oklch(0.556 0 0)`,dark:`oklch(0.708 0 0)`},{name:`--border`,light:`oklch(0.922 0 0)`,dark:`oklch(1 0 0 / 10%)`},{name:`--destructive`,light:`oklch(0.577 0.245 27.325)`,dark:`oklch(0.704 0.191 22.216)`},{name:`--radius`,light:`0.625rem`,dark:`0.625rem`}],pK=`localhost`,mK=[`image/jpeg`,`image/png`,`image/gif`,`image/webp`,`image/svg+xml`],hK=[`video/mp4`,`video/webm`,`video/ogg`],gK=[`audio/mpeg`,`audio/wav`,`audio/ogg`],_K=[`application/pdf`],vK=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`,`svg`]),yK=new Set([`mp4`,`webm`,`mov`,`m4v`,`mkv`]),bK=new Set([`pdf`]),xK=new Set([`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`]),SK=new Set(`pdf.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),CK=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(`.`)),wK=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.7z.tar.gz.rar.woff.woff2.ttf.otf.eot.docx.xlsx.pptx.doc.xls.ppt.odt.ods.odp.pages.numbers.key.epub.mobi.csv.tsv.txt.rtf.json.yaml.yml.xml.toml.lock.gpx.html.htm`.split(`.`)),TK=new Set([`html`,`htm`]),EK=`sandbox allow-scripts; connect-src 'none'`,DK=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.json.toml.lock`.split(`.`)),OK=`same-dir`,kK=new Set(`png.jpg.jpeg.gif.webp.avif.svg.pdf.mp4.webm.mov.m4v.mkv.mp3.wav.ogg.m4a.flac.aac.opus.docx.xlsx.pptx.doc.xls.ppt.zip.7z.tar.gz.rar.csv.tsv.rtf.json.yaml.yml.xml.txt.pages.numbers.key.odt.ods.odp.epub.mobi`.split(`.`)),AK=[`png`,`jpg`,`jpeg`,`gif`,`webp`,`avif`],jK=[`mp4`,`webm`,`mov`,`m4v`],MK=[`mp3`,`wav`,`ogg`,`m4a`,`flac`,`aac`,`opus`],NK=[`pdf`],PK=[`json`,`toml`,`lock`];function FK(e,t,n){for(let r of t)if(!n.has(r))throw Error(`${e}: ${r} is not present in canonical upload constants`)}FK(`SIDEBAR_IMAGE_ASSET_EXTENSIONS`,AK,vK),FK(`SIDEBAR_VIDEO_ASSET_EXTENSIONS`,jK,yK),FK(`SIDEBAR_AUDIO_ASSET_EXTENSIONS`,MK,xK),FK(`SIDEBAR_PDF_ASSET_EXTENSIONS`,NK,bK),FK(`FILE_ATTACHMENT_EXTENSIONS`,[...SK],kK),FK(`WIKI_EMBED_EXTENSIONS`,[...kK],wK);const IK=new Set(AK),LK=new Set(jK),RK=new Set(MK),zK=new Set(NK),BK=new Set(PK);FK(`SIDEBAR_RENDERABLE_ASSET_EXTENSIONS`,[...new Set([...AK,...jK,...MK,...NK,...PK])],DK);const VK=new Set([`base`,`canvas`]),HK=new Set([...wK,...VK]);function UK(e){let t=e.toLowerCase().replace(/^\./,``);return IK.has(t)?`image`:LK.has(t)?`video`:RK.has(t)?`audio`:zK.has(t)?`pdf`:BK.has(t)||VK.has(t)||QG.has(t)?`text`:null}const WK=Ex.extend({priority:60,addAttributes(){return{...this.parent?.(),fenceDelimiter:{default:"`"},fenceLength:{default:3},meta:{default:null},sourceStyle:{default:`fenced`},sourceClosingFenceLength:{default:null,rendered:!1},sourceFenceIndent:{default:null,rendered:!1},sourceInfoPadding:{default:null,rendered:!1},sourceIndents:{default:null,rendered:!1}}}}),GK=zx.extend({name:`emphasis`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`*`}}},addInputRules(){return[rx({find:Px,type:this.type,getAttributes:{sourceDelimiter:`*`}}),rx({find:Ix,type:this.type,getAttributes:{sourceDelimiter:`_`}})]}}),KK=Nx.extend({name:`strong`,priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`**`}}},addInputRules(){return[rx({find:Ox,type:this.type,getAttributes:{sourceDelimiter:`**`}}),rx({find:Ax,type:this.type,getAttributes:{sourceDelimiter:`__`}})]}}),qK=Ib.create({name:`escapeMark`,priority:10,excludes:``,inclusive:!1,parseHTML(){return[{tag:`span[data-escape-mark]`}]},renderHTML(){return[`span`,{"data-escape-mark":``},0]}}),JK=bx.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`}]})}}}),YK=bx.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}})}}}),XK=Vx.extend({priority:60,addAttributes(){return{...this.parent?.(),hardBreakStyle:{default:`backslash`}}}}),ZK=Ux.extend({priority:60,addAttributes(){return{...this.parent?.(),headingStyle:{default:`atx`},sourceTrailingHashes:{default:null},sourceUnderlineLength:{default:null},sourceContiguousNext:{default:!1},sourceLeadingIndent:{default:null,rendered:!1},sourceInteriorSpacing:{default:null,rendered:!1}}}}),QK=bx.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]}});function $K(e){if(typeof e!=`string`||!e.startsWith(`/`))return e;let t=globalThis.window?.okDesktop?.config?.apiOrigin;return typeof t==`string`&&t?t+e:e}const eq=Gx.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceUrl:{default:null,rendered:!1}}},renderHTML({HTMLAttributes:e}){let t=Dy(this.options.HTMLAttributes,e);return typeof t.src==`string`&&(t.src=$K(t.src)),[`img`,t]}}),tq=bx.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}})}}}),nq=bx.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]}}),rq=[`https`,`http`,`mailto`,`tel`,`ftp`,`sms`],iq=rq.map(e=>`${e}:`).join(`|`);RegExp(`^(?:${iq}|\\/|#|\\?|\\.\\/|\\.\\.\\/)`,`i`);function aq(e){let t=e.trim();if(t===``)return!0;let n=t.indexOf(`:`);if(n===-1)return!0;let r=t.indexOf(`/`),i=t.indexOf(`?`),a=t.indexOf(`#`);return n>Math.min(r===-1?1/0:r,i===-1?1/0:i,a===-1?1/0:a)}const oq=new Set(rq.map(e=>`${e}:`));function sq(e){try{let t=new URL(e,`https://placeholder.invalid`);return oq.has(t.protocol.toLowerCase())}catch{return!1}}const cq=rS.extend({priority:60,addOptions(){return{openOnClick:!1,enableClickSelection:!1,linkOnPaste:!0,autolink:!0,protocols:[],defaultProtocol:`http`,HTMLAttributes:{target:`_blank`,rel:`noopener noreferrer`},isAllowedUri:sq,validate:sq,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}}}}),lq=bx.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 uq(e){return e.type.name===`list`&&!e.attrs.ordered}function dq(e){return e.type.name===`list`&&!!e.attrs.ordered}function fq(e){let t=!1;return e.forEach(e=>{e.type.name===`listItem`&&e.attrs.checked!==null&&(t=!0)}),t}function pq(e,t,n,r,i,a,o){let s=_y(e=>e.type.name===`list`)(e.selection);if(s&&i(s.node)){let{$from:n,$to:i}=e.selection;return n.blockRange(i)?mp(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 dp(n,a)(e,void 0)?t?dp(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 mq=bx.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,Dy(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:pq(e,t,n,r,e=>uq(e)&&!fq(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:pq(e,t,n,r,e=>dq(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:pq(e,t,n,r,e=>uq(e)&&fq(e),{ordered:!1},{checked:!1})}}},addInputRules(){return[ox({find:/^\s*([-+*])(?!\s*\[[ xX]\])\s$/,type:this.type,getAttributes:e=>({ordered:!1,bulletMarker:e[1]})}),ox({find:/^\s*(\d+)([.)])\s$/,type:this.type,getAttributes:e=>({ordered:!0,start:Number(e[1]),listMarkerDelimiter:e[2]})}),new Ob({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=Ed(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()}}}),hq=bx.create({name:`listItem`,content:`paragraph block*`,defining:!0,addAttributes(){return{checked:{default:null},spread:{default:!1},sourceMarkerSpacing:{default:null,rendered:!1},sourceOrdinal:{default:null,rendered:!1},sourceCheckboxChar:{default:null,rendered:!1},sourceContinuationIndent:{default:null,rendered:!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`,Dy(t),0]:[`li`,Dy(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(Dy(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}}}}),gq=mq,_q=hq,vq=bx.create({name:`mathInline`,group:`inline`,inline:!0,atom:!0,selectable:!0,priority:60,addAttributes(){return{formula:{default:``},id:{default:null},language:{default:`latex`},sourceDelimiter:{default:null,rendered:!1}}},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}})}}}),yq=bx.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}}}}),bq=mw.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceMarkerSpacings:{default:null}}}}),xq=vw.extend({excludes:``,addAttributes(){return{...this.parent?.(),sourceFenceChar:{default:"`"},sourceFenceLength:{default:1},sourcePadded:{default:!1,rendered:!1}}}}),Sq=bx.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)}}}),Cq=Ib.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)}}}),wq=Gb.create({name:`docFidelity`,addGlobalAttributes(){return[{types:[`doc`],attributes:{sourceDocBoundary:{default:null,rendered:!1}}}]}}),Tq=bx.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}]}}),Eq=new Map([[32,` `],[9,` `]]);function Dq(e){let t=/^&#(x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);$/.exec(e);if(!t)return null;let n=t[1],r=n[0]===`x`||n[0]===`X`,i=Number.parseInt(r?n.slice(1):n,r?16:10);return Number.isNaN(i)?null:i}function Oq(e){let t=Dq(e);return t!==null&&Eq.has(t)}function kq(e){let t=Dq(e);return t===null?null:Eq.get(t)??null}const Aq=/&#(?:x[0-9A-Fa-f]+|X[0-9A-Fa-f]+|[0-9]+);/g;function jq(e){Aq.lastIndex=0;let t=e.match(Aq);if(t===null||t.join(``)!==e)return null;let n=``;for(let e of t){let t=kq(e);if(t===null)return null;n+=t}return n}const Mq=Ib.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 Nq(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||Pq(n)===r?!0:jq(n)===r}function Pq(e){return e.replace(/\\([!-/:-@[-`{-~])/g,`$1`)}const Fq=iT.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDelimiter:{default:`~~`,rendered:!1}}}}),Iq=dw.extend({priority:60,addAttributes(){return{...this.parent?.(),sourceDashCounts:{default:null},sourceOuterPipes:{default:null,rendered:!1},sourceAlignmentPadding:{default:null,rendered:!1}}}}),Lq=XC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),Rq=ZC.extend({priority:60,addAttributes(){return{...this.parent?.(),sourcePadding:{default:null}}}}),zq=bx.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()}}}),Bq=/^(?:---|—-|___\s|\*\*\*\s)$/;function Vq(e){let t=String(e[0]??``).replace(/\s+$/,``);return t===`—-`?`---`:t}const Hq=xw.extend({name:`thematicBreak`,priority:60,addAttributes(){return{...this.parent?.(),sourceRaw:{default:`---`}}},addInputRules(){return[ix({find:Bq,type:this.type,getAttributes:e=>({sourceRaw:Vq(e)})})]}});function Uq(e){if(typeof e!=`string`)return null;let t=e.trim();return t.length>0?t:null}function Wq(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const Gq=bx.create({name:`wikiLink`,group:`inline`,inline:!0,atom:!0,priority:60,addAttributes(){return{target:{default:``},alias:{default:null},anchor:{default:null},resolved:{default:!1},sourceTarget:{default:null,rendered:!1},sourceAnchor:{default:null,rendered:!1},sourceAlias:{default:null,rendered:!1}}},parseHTML(){return[{tag:`span[data-wiki-link]`,getAttrs:e=>typeof e==`string`?!1:{target:e.getAttribute(`data-target`)||``,alias:Uq(e.getAttribute(`data-alias`)),anchor:Uq(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:Uq(e.getAttribute(`data-alias`)),anchor:Uq(e.getAttribute(`data-anchor`)),resolved:!1}:!1}}]},renderHTML({node:e,HTMLAttributes:t}){let n=String(e.attrs.target??``),r=Uq(e.attrs.alias),i=Uq(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`},Wq({target:n,alias:r,anchor:i})]}});function Kq(e){let t=e.split(`/`).pop()??e,n=t.lastIndexOf(`.`);return n<=0||n===t.length-1?``:t.slice(n+1).toLowerCase()}function qq(e){return e.alias?e.alias:e.anchor?`${e.target}#${e.anchor}`:e.target}const Jq=[tq,yq,nq,vq,Gq,bx.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:Uq(e.getAttribute(`data-alias`)),anchor:Uq(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=Uq(e.attrs.alias),i=Uq(e.attrs.anchor),a=Uq(e.attrs.resolvedSrc),o=Kq(n);if(vK.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`},qq({target:n,alias:r,anchor:i})]}}),zq,gq,_q,GK,KK,Fq,xq,WK,bq,ZK,Hq,cq,QK,lq,XK,qK,wq,Mq,XT.configure({undoRedo:!1,bulletList:!1,orderedList:!1,listItem:!1,italic:!1,bold:!1,strike:!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}}),Iq.configure({resizable:!0}),QC,Rq,Lq,eq.configure({inline:!0}),Tq,oS,Cq,Sq,YK,JK],Yq=/^[a-zA-Z0-9][\w/-]*$/;function Xq(e){return e.startsWith(`#`)?e.slice(1):e}function Zq(e){return typeof e==`string`?[e]:Array.isArray(e)?e.filter(e=>typeof e==`string`):[]}function Qq(e){if(!e||e.trim()===``)return[];let{map:t}=qW(e);if(!t)return[];let n=Zq(t.tags),r=[];for(let e of n){let t=Xq(e);Yq.test(t)&&r.push(t)}return r}function $q(e){if(e.length===0)return{ok:!1,reason:`docName must not be empty`};if(e.trim().length===0)return{ok:!1,reason:`docName must not be blank (whitespace only)`};if(e!==e.trim())return{ok:!1,reason:`docName must not have leading or trailing whitespace`};for(let t=0;t<e.length;t++){let n=e.charCodeAt(t);if(n<32||n===127)return{ok:!1,reason:`docName must not contain control characters`}}if(e.includes(`..`)||e.startsWith(`/`)||e.includes(`\\`))return{ok:!1,reason:`docName must not contain "..", a leading "/", or a backslash`};for(let t of e.split(`/`)){if(t.length===0)return{ok:!1,reason:`docName must not contain empty path segments (no leading, trailing, or doubled "/")`};if(t.startsWith(`.`))return{ok:!1,reason:`docName path segments must not start with "." (hidden files are not addressable)`}}return{ok:!0}}function eJ(e){return e.split(`/`).some(e=>e.startsWith(`.`))}function tJ(e,t){let n=$q(e);n.ok||t.addIssue({code:`custom`,message:n.reason})}const nJ=k().superRefine(tJ).optional(),rJ={agentId:k().optional(),agentName:k().optional(),colorSeed:k().optional(),clientName:k().optional(),clientVersion:k().optional(),label:k().optional()},iJ=k().optional(),aJ=/^urn:uuid:[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i,oJ=$s(`kind`,[N({kind:F(`doc`),docPath:k().min(1)}).loose(),N({kind:F(`folder`),folderPath:k()}).loose()]),sJ=P([`no-remote`,`detached-head`,`branch-not-on-origin`,`non-github-remote`,`invalid-path`]),cJ=$s(`ok`,[N({ok:F(!0),shareUrl:k().min(1),sharedUrl:k().min(1),branch:k().min(1)}).loose(),N({ok:F(!1),error:sJ,branch:k().min(1).optional()}).loose()]),lJ=P([`user`,`org`]),uJ=N({login:k().min(1),kind:lJ,avatarUrl:k().optional()}).loose(),dJ=P([`auth-required`,`network`]),fJ=$s(`ok`,[N({ok:F(!0),owners:M(uJ)}).loose(),N({ok:F(!1),error:dJ}).loose()]),pJ=$s(`ok`,[N({ok:F(!0),available:j()}).loose(),N({ok:F(!1),error:dJ}).loose()]),mJ=P([`public`,`private`]),hJ=N({owner:k().min(1),name:k().min(1),visibility:mJ,description:k().optional()}).loose(),gJ=P([`name-conflict`,`saml-sso`,`auth-required`,`push-failed`,`init-failed`,`network`,`no-project`]),_J=$s(`ok`,[N({ok:F(!0),ownerLogin:k().min(1),repoName:k().min(1),cloneUrl:k().min(1),defaultBranch:k().min(1)}).loose(),N({ok:F(!1),error:gJ}).loose()]);function vJ(e){return!(typeof e!=`string`||e.length===0||e.startsWith(`-`)||/[\x00-\x1F\x7F]/.test(e)||/\s/.test(e)||e.includes(`:`)||e.split(`/`).includes(`..`))}const yJ=e=>e.refine(vJ,`invalid branch name`);function bJ(e){if(e==null)return!1;let t=e instanceof Error?e.message:String(e);return/couldn'?t find remote ref|Remote branch .+ not found/i.test(t)}const xJ={shareTargetExists:j(),dirtyConflicts:N({conflicts:j(),files:M(k().min(1))}).loose(),branchIsLocal:j()},SJ=$s(`detached`,[N({detached:F(!1),currentBranch:k().min(1).nullable(),currentHeadSha:Bs(),...xJ}).loose(),N({detached:F(!0),currentBranch:Bs(),currentHeadSha:k().min(1),...xJ}).loose()]),CJ=N({branch:yJ(k().min(1)),principalId:k().optional()}).loose(),wJ=P([`dirty-conflict`,`branch-not-found`,`fetch-failed`,`checkout-failed`,`branch-in-other-worktree`]),TJ=$s(`ok`,[N({ok:F(!0)}).loose(),N({ok:F(!1),reason:wJ,files:M(k().min(1)).optional(),otherWorktreePath:k().min(1).optional()}).loose()]),EJ=N({serverInstanceId:k().min(1),currentBranch:k().min(1).optional(),currentDiskAckSVs:rc(k().min(1),k().min(1)).optional()}).loose(),DJ=N({id:k().min(1),display_name:k().min(1),display_email:k(),source:P([`git-config`,`synthesized`]),created_at:k().min(1)}).loose(),OJ=N({collabUrl:k().nullable(),previewUrl:k().nullable(),port:A(),paneTarget:k().nullable(),singleFile:j().default(!1)}).loose(),kJ=P(`urn:ok:error:malformed-upload.urn:ok:error:collision-exhaustion.urn:ok:error:storage-full.urn:ok:error:storage-readonly.urn:ok:error:storage-error.urn:ok:error:no-file-received.urn:ok:error:path-escape.urn:ok:error:method-not-allowed.urn:ok:error:invalid-request.urn:ok:error:payload-too-large.urn:ok:error:request-timeout.urn:ok:error:internal-server-error.urn:ok:error:loopback-required.urn:ok:error:invalid-origin.urn:ok:error:url-not-allowed.urn:ok:error:dir-outside-home.urn:ok:error:concurrent-operation.urn:ok:error:clone-failed.urn:ok:error:clone-timeout.urn:ok:error:server-start-failed.urn:ok:error:reserved-doc-name.urn:ok:error:target-not-found.urn:ok:error:stale-target.urn:ok:error:frontmatter-edit-not-supported.urn:ok:error:invalid-frontmatter-patch.urn:ok:error:frontmatter-malformed.urn:ok:error:no-active-session.urn:ok:error:too-many-agent-sessions.urn:ok:error:disk-divergence.urn:ok:error:doc-not-found.urn:ok:error:doc-already-exists.urn:ok:error:doc-not-open.urn:ok:error:rollback-not-configured.urn:ok:error:doc-not-available.urn:ok:error:backlink-index-not-configured.urn:ok:error:file-rescan-not-configured.urn:ok:error:shadow-not-configured.urn:ok:error:host-not-allowed.urn:ok:error:principal-not-available.urn:ok:error:not-found.urn:ok:error:auth-failed.urn:ok:error:no-project-dir.urn:ok:error:server-open-failed.urn:ok:error:doc-in-conflict.urn:ok:error:no-conflict-tracked.urn:ok:error:sync-not-active.urn:ok:error:project-repo-not-configured.urn:ok:error:seed-prerequisite-missing.urn:ok:error:seed-invalid-root.urn:ok:error:tag-index-not-configured.urn:ok:error:template-not-found.urn:ok:error:unsupported-asset-type.urn:ok:error:asset-not-found.urn:ok:error:single-file-mode.urn:ok:error:collab-server-not-running.urn:ok:error:gateway-timeout.urn:ok:error:cursor-not-installed.urn:ok:error:cursor-spawn-timeout.urn:ok:error:cursor-spawn-failed.urn:ok:error:handoff-target-not-installed.urn:ok:error:handoff-spawn-timeout.urn:ok:error:handoff-spawn-failed`.split(`.`));function AJ(e){throw Error(`Unexpected ProblemType variant: ${JSON.stringify(e)}`)}const jJ=N({type:kJ,title:k().min(1),status:A().int().min(400).max(599),instance:k().regex(aJ,`instance must be urn:uuid:<uuid>`).optional(),detail:k().optional()}).loose(),MJ=N({parentDocName:k().min(1),agentId:k().min(1).optional(),agentName:k().min(1).optional()}).loose(),NJ=N({src:k().min(1),path:k().min(1).optional(),deduped:j().optional()}).loose(),PJ=N({url:k().min(1),dir:k().min(1),branch:k().min(1).refine(vJ,`invalid branch name`).optional()}).loose(),FJ=N({type:F(`error`),problem:jJ}).loose();function IJ(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}if(r>=0){let e=n[r];if(e.type===`mdxJsxAttribute`&&e.value!=null&&typeof e.value==`object`&&e.value.type===`mdxJsxAttributeValueExpression`&&LJ(e.value.value,t))continue}let o=RJ(e,t);r>=0?n[r]=o:n.push(o)}return n}function LJ(e,t){try{return JSON.stringify(JSON.parse(e))===JSON.stringify(t)}catch{return!1}}function RJ(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 zJ(e,t,n,r){return{type:`mdxJsxFlowElement`,name:e,attributes:IJ(t,r),children:n.all(t),data:{}}}const BJ=/^[A-Za-z0-9]{20,}$/,VJ=/^(?:\d+s?|(?:\d+h)?(?:\d+m)?(?:\d+s)?)$/;function HJ(e){let t=e.toLowerCase();return t===`loom.com`||t===`www.loom.com`}function UJ(e){let t=e.pathname.match(/^\/(?:share|embed)\/([A-Za-z0-9]+)\/?$/);if(!t)return null;let n=t[1]??``;return BJ.test(n)?n:null}function WJ(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!HJ(t.hostname))return null;let n=UJ(t);if(!n)return null;let r=t.searchParams.get(`t`);return{id:n,startRaw:r&&r.length>0&&VJ.test(r)?r:null}}function GJ(e){return WJ(e)!==null}function KJ(e){let t=e.toLowerCase();return t===`vimeo.com`||t===`www.vimeo.com`||t===`player.vimeo.com`}function qJ(e){if(typeof e!=`string`||e.length===0)return!1;let t;try{t=new URL(e)}catch{return!1}return t.protocol!==`http:`&&t.protocol!==`https:`?!1:KJ(t.hostname)}const JJ=/^[A-Za-z0-9_-]{11}$/;function YJ(e){let t=e.toLowerCase();return t===`youtube.com`||t===`www.youtube.com`||t===`m.youtube.com`||t===`music.youtube.com`||t===`youtu.be`||t===`youtube-nocookie.com`||t===`www.youtube-nocookie.com`}function XJ(e){if(e.length===0)return null;if(/^[0-9]+$/.test(e)){let t=Number.parseInt(e,10);return t>0?t:null}let t=e.match(/^(?:([0-9]+)h)?(?:([0-9]+)m)?(?:([0-9]+)s?)?$/);if(!t)return null;let n=t[1]?Number.parseInt(t[1],10):0,r=t[2]?Number.parseInt(t[2],10):0,i=t[3]?Number.parseInt(t[3],10):0,a=n*3600+r*60+i;return a>0?a:null}function ZJ(e){if(e.hostname.toLowerCase()===`youtu.be`){let t=e.pathname.replace(/^\//,``).split(`/`)[0]??``;return JJ.test(t)?t:null}if(e.pathname===`/watch`){let t=e.searchParams.get(`v`)??``;return JJ.test(t)?t:null}let t=e.pathname.match(/^\/(?:embed|shorts|v)\/([A-Za-z0-9_-]{11})\/?$/);return t?t[1]??null:null}function QJ(e){if(typeof e!=`string`||e.length===0)return null;let t;try{t=new URL(e)}catch{return null}if(t.protocol!==`http:`&&t.protocol!==`https:`||!YJ(t.hostname))return null;let n=ZJ(t);if(!n)return null;let r=t.searchParams.get(`t`)??t.searchParams.get(`start`)??``;return{id:n,startSeconds:r.length>0?XJ(r):null,noCookie:t.hostname.toLowerCase().endsWith(`youtube-nocookie.com`)}}const $J=[{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`)",iconPicker:!0},{name:`color`,type:`string`,required:!1,advanced:!0,description:"Optional accent color override (hex — e.g. `#F05032`)",colorPicker:!0},{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`,hideWhen:e=>e.collapsible!==!0},{name:`children`,type:`reactnode`,required:!0,description:`Callout content`}],eY=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Image source URL`,accept:mK,autoFocus:!0},{name:`alt`,type:`string`,required:!0,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`,hidden:!0}],tY=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Embedded page URL (must start with http:// or https://)`,autoFocus:!0},{name:`title`,type:`string`,required:!1,description:`Iframe title (accessible label for screen readers)`},{name:`width`,type:`string`,required:!1,advanced:!0,description:`Embed width as a CSS length (e.g. "100%", "640px")`,cssLengthInput:!0},{name:`height`,type:`string`,required:!1,advanced:!0,description:`Embed height as a CSS length (e.g. "26rem", "480px")`,cssLengthInput:!0},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],nY=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Video source URL`,accept:hK,autoFocus:!0},{name:`controls`,type:`boolean`,required:!1,defaultValue:!0,advanced:!0,omitOnDefault:!0,description:`Show native HTML5 video controls (defaults to true)`,hideWhen:e=>typeof e.src==`string`&&(qJ(e.src)||GJ(e.src))},{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`,accept:mK,hideWhen:e=>typeof e.src==`string`&&(qJ(e.src)||GJ(e.src))},{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`,hideWhen:e=>typeof e.src==`string`&&GJ(e.src)},{name:`playsinline`,type:`boolean`,required:!1,advanced:!0,description:`Play inline on iOS rather than entering fullscreen`,hideWhen:e=>typeof e.src==`string`&&(qJ(e.src)||GJ(e.src))},{name:`preload`,type:`enum`,enumValues:[`none`,`metadata`,`auto`],required:!1,advanced:!0,description:`Hint for how much of the video to preload`,hideWhen:e=>typeof e.src==`string`&&(QJ(e.src)!==null||qJ(e.src)||GJ(e.src))},{name:`align`,type:`enum`,enumValues:[`center`,`left`,`right`],defaultValue:`center`,required:!1,omitOnDefault:!0,description:`Alignment within the column`,hidden:!0}],rY=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`Audio source URL`,accept:gK,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`}],iY=[{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`)",iconPicker:!0},{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`}],aY=[$J[0],$J[1],$J[4],$J[5],$J[6]],oY=[eY[0],eY[1],eY[7]],sY=[iY[0],iY[1],iY[4],iY[5]],cY=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Alt text (Obsidian alias syntax: `![[file.png|alt text]]`)"}],lY=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[clip.mp4|title]]`)"}],uY=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Title text (Obsidian alias syntax: `![[song.mp3|title]]`)"}],dY=[{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#install-tabs`)"}],fY=[{name:`label`,type:`string`,required:!0,autoFocus:!0,defaultValue:`Tab`,description:`Tab strip label — shown in the clickable pill at the top`},{name:`id`,type:`string`,required:!1,advanced:!0,description:"HTML id attribute for deep-linking (e.g. `#tab-npm`)"}],pY=[{name:`formula`,type:`string`,required:!0,autoFocus:!0,language:`latex`,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."}],mY=[pY[0]],hY=[pY[0]],gY=[{name:`chart`,type:`string`,required:!0,hidden:!0,description:`Mermaid chart source (graph / flowchart / sequenceDiagram / class / state / etc.)`}],_Y=[{name:`alias`,type:`string`,required:!1,defaultValue:``,description:"Display name override (Obsidian alias syntax: `![[file.zip|label]]`)"}],vY=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`File URL`,accept:[`*/*`],autoFocus:!0}],yY=[{name:`src`,type:`string`,required:!0,defaultValue:``,description:`PDF source URL`,accept:_K,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`)"}],bY=[{name:`src`,type:`string`,required:!0,description:"Path of the source doc, extension-less (e.g. `api-spec`).",autoFocus:!0},{name:`anchor`,type:`string`,required:!0,description:"Id of the `<MirrorSource>` block within the source doc."}],xY=[{name:`id`,type:`string`,required:!0,description:"Stable id agents and authors use to reference this block from `<Mirror>` elsewhere.",autoFocus:!0},{name:`children`,type:`reactnode`,required:!0,description:`Block content this MirrorSource owns — paragraphs, callouts, code, nested JSX, anything.`}];function SY(e){return e.replace(/&/g,`&amp;`).replace(/"/g,`&quot;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function CY(e){return e.replace(/&/g,`&amp;`).replace(/</g,`&lt;`).replace(/>/g,`&gt;`)}function wY(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 TY=[{name:`Callout`,surface:`canonical`,hasChildren:!0,props:$J,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)=>zJ(`Callout`,e,t,$J)},{name:`img`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:eY,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)=>zJ(`img`,e,t,eY)},{name:`video`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:nY,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)=>zJ(`video`,e,t,nY)},{name:`audio`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:rY,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)=>zJ(`audio`,e,t,rY)},{name:`Pdf`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:yY,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)=>zJ(`Pdf`,e,t,yY)},{name:`File`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:vY,icon:`Paperclip`,category:`media`,displayName:`File`,description:`Downloadable file attachment — inline row with name + size + download link`,searchTerms:[`file`,`attachment`,`download`,`document`,`zip`,`docx`,`doc`],placeholder:{label:`Add a file`},serialize:(e,t)=>zJ(`File`,e,t,vY)},{name:`Embed`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:tY,icon:`AppWindow`,category:`media`,displayName:`Embed`,description:'Inline web embed (iframe) — drop a URL, get a resizable preview pane. For YouTube / Vimeo / Loom prefer `<video src="…">` (player props, click-facade); `<Embed>` auto-rewrites watch URLs as a fallback.',searchTerms:[`embed`,`iframe`,`website`,`page`,`inline`,`frame`,`preview`],placeholder:{label:`Embed a URL`},serialize:(e,t)=>zJ(`Embed`,e,t,tY)},{name:`Accordion`,surface:`canonical`,hasChildren:!0,props:iY,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`],exampleBody:`Body content revealed when the accordion is expanded.`,serialize:(e,t)=>zJ(`Accordion`,e,t,iY)},{name:`Tabs`,surface:`canonical`,hasChildren:!0,emptyChildName:`Tab`,props:dY,icon:`LayoutPanelTop`,category:`content`,displayName:`Tabs`,description:"Horizontal tab strip + active panel below. Each `<Tab>` child is one panel; clickable pills at the top switch the active one. Active selection is ephemeral (resets on reload).",searchTerms:[`tabs`,`tabbed`,`panels`,`tabgroup`,`switcher`],exampleBody:`<Tab label="One">Body of the first tab panel.</Tab>
393
+ <Tab label="Two">Body of the second tab panel.</Tab>`,serialize:(e,t)=>zJ(`Tabs`,e,t,dY)},{name:`Tab`,surface:`canonical`,hasChildren:!0,props:fY,icon:`PanelTop`,category:`content`,displayName:`Tab`,description:"A single tab panel inside a `<Tabs>` container — carries the strip label and the block-content body.",searchTerms:[`tab`,`panel`],exampleBody:"Panel content — must be nested inside a `<Tabs>` parent.",serialize:(e,t)=>zJ(`Tab`,e,t,fY)},{name:`Math`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:pY,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)=>zJ(`Math`,e,t,pY)},{name:`MermaidFence`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:gY,icon:`Workflow`,category:`content`,displayName:`Mermaid`,description:"Diagram rendered from Mermaid source (flowchart, sequence, class, state, ER, gantt, pie). Authored exclusively as ` ```mermaid ` fenced code.",searchTerms:[`mermaid`,`diagram`,`flowchart`,`graph`,`sequence`,`sequencediagram`,`class`,`state`,`er`,`erdiagram`,`gantt`,`pie`,`chart`],serialize:e=>({type:`code`,lang:`mermaid`,meta:null,value:e.attrs.props?.chart??``})},{name:`Mirror`,surface:`canonical`,hasChildren:!1,isSelfClosing:!0,props:bY,icon:`CopyPlus`,category:`content`,displayName:`Mirror`,description:"Render a read-only copy of a `<MirrorSource>` block from another doc. Use to keep the same content in sync across multiple docs without copy-paste — edits land at the source, every Mirror reflects the change.",searchTerms:[`mirror`,`sync`,`synced`,`transclude`,`embed`,`reference`,`shared block`],serialize:(e,t)=>zJ(`Mirror`,e,t,bY)},{name:`MirrorSource`,surface:`canonical`,hasChildren:!0,props:xY,icon:`GitBranch`,category:`content`,displayName:`Mirror Source`,description:'Mark a block as the source of truth for content that appears in multiple docs. Wrap any block content; `<Mirror src="…" anchor="<id>">` references render this verbatim read-only at every call-site. Edit here, propagate everywhere.',searchTerms:[`mirror source`,`sync source`,`source block`,`master block`,`shared`],exampleBody:"Authoritative content lives inside this block — edits here propagate to every `<Mirror>` that references this id.",serialize:(e,t)=>zJ(`MirrorSource`,e,t,xY)},{name:`GFMCallout`,surface:`compat`,hasChildren:!0,props:aY,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:oY,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?.sourceUrl??t?.src??``,alt:t?.alt??``,title:t?.title??null}]}}},{name:`WikiEmbedImage`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:cY,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:wY},{name:`WikiEmbedVideo`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:lY,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:wY},{name:`WikiEmbedAudio`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:uY,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:wY},{name:`WikiEmbedFile`,surface:`compat`,hasChildren:!1,isSelfClosing:!0,props:_Y,icon:`Paperclip`,category:`media`,displayName:`Wiki Embed File`,description:"Obsidian-style `![[file.zip]]` wiki-embed — read-only compat for arbitrary downloadable attachments. Renders through the `File` canonical (inline row with file-up icon + bold name + optional dim size). Edit the display name via the alias slot.",rendersAs:`File`,translateProps:e=>{let t=typeof e.alias==`string`&&e.alias.length>0?e.alias:null,n=typeof e.size==`string`&&e.size.length>0?e.size:null;return{src:e.src,name:t??void 0,size:n??void 0}},serialize:wY},{name:`HtmlDetailsAccordion`,surface:`compat`,hasChildren:!0,props:sY,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="${SY(n.name)}"`:``,a=n?.id?` id="${SY(n.id)}"`:``,o=n?.title?.trim(),s=o?`<summary>${CY(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:mY,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:hY,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??``})}],EY={name:`*`,surface:`canonical`,hasChildren:!0,props:[],description:`Unregistered component — children editable as markdown`,serialize:(e,t)=>zJ(e.attrs.componentName||`*`,e,t)};function DY(){let e=new Map;e.set(`*`,EY);for(let t of TY)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 OY(){let e=globalThis;return e.__okYpsCounters||={block:0,inline:0},e.__okYpsCounters}const kY={parseFallback:{blockLevel:0,wholeDoc:0,wholeDocBudget:0},jsxRenderFailure:{},jsxAutoConvertFailed:{},jsxAutoConvertSucceeded:{},jsxPropDropped:{},jsxMoveFailed:{},jsxStuckCopyFailed:{},jsxStuckDeleteFailed:{},jsxPopoverCloseRestoreFailed:{},jsxKeyboardDeleteFailed:{},blockGripClickSelectFailed:{},jsxArrowNodeSelectFailed:{}};function AY(){kY.parseFallback.blockLevel++}function jY(){kY.parseFallback.wholeDoc++}function MY(){kY.parseFallback.wholeDocBudget++}function NY(){let e=OY();return{parseFallback:{...kY.parseFallback},ypsMismatch:{block:e.block,inline:e.inline},jsxRenderFailure:{...kY.jsxRenderFailure},jsxAutoConvertFailed:{...kY.jsxAutoConvertFailed},jsxAutoConvertSucceeded:{...kY.jsxAutoConvertSucceeded},jsxPropDropped:{...kY.jsxPropDropped},jsxMoveFailed:{...kY.jsxMoveFailed},jsxStuckCopyFailed:{...kY.jsxStuckCopyFailed},jsxStuckDeleteFailed:{...kY.jsxStuckDeleteFailed},jsxPopoverCloseRestoreFailed:{...kY.jsxPopoverCloseRestoreFailed},jsxKeyboardDeleteFailed:{...kY.jsxKeyboardDeleteFailed},blockGripClickSelectFailed:{...kY.blockGripClickSelectFailed},jsxArrowNodeSelectFailed:{...kY.jsxArrowNodeSelectFailed}}}const PY=/^(`{3,}|~{3,})/gm;function FY(e){let t=[],n=null;for(let r of e.matchAll(PY)){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 IY(e,t){return t.some(([t,n])=>e>=t&&e<n)}const LY=/^[ \t]{0,3}\[([^\]]+)\]:\s*(\S+)(\s+(?:"[^"]*"|'[^']*'|\([^)]*\)))?\s*$/gm;function RY(e){let t=FY(e),n=[];for(let r of e.matchAll(LY))IY(r.index,t)||n.push(r[0].trimEnd());return n.length>0?`${n.join(`
394
+ `)}\n\n`:``}function zY(e,t){let n={startMs:typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now(),calls:0};return HY(e,t.parse,0,n)}function BY(e){return e.calls>=1e3?!0:(typeof performance<`u`&&typeof performance.now==`function`?performance.now():Date.now())-e.startMs>=500}function VY(e){return e instanceof Error?{name:e.name,message:e.message.slice(0,500),stack:e.stack?.split(`
395
395
  `).slice(0,4).join(`
396
- `)}:{name:`UnknownError`,message:String(e??`unknown`).slice(0,500)}}function VY(e,t,n,r){if(n>20)return AY(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`MAX_SPLIT_DEPTH exceeded`})),XY(e);if(r){if(zY(r))return jY(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`parse budget exhausted`,calls:r.calls})),XY(e);r.calls+=1}try{return t(e)}catch(i){let a=HY(i),o=BY(i);if(a===void 0){if(n===0){let n=YY(e,t,i,r);if(n)return n}return AY(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:o.message,error:o})),XY(e)}kY(),console.warn(JSON.stringify({event:`mdx-block-fallback`,offset:a,reason:o.message,error:o}));try{let i=qY(e,a),s=e.slice(0,i.start),c=e.slice(i.start,i.end),l=e.slice(i.end),u=s.trim()?VY(s,t,n+1,r):{type:`doc`,content:[]},d=l.trim()?VY(LY(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){AY();let n=BY(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})),XY(e)}}}function HY(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 UY(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 WY(e,t){for(let n of e.matchAll(/\n\s*\n/g))if(n.index>=t)return n.index;return null}function GY(e,t){let n=[];for(let r of e.matchAll(/<(\/?)([A-Z][A-Za-z0-9.]*)/g)){let i=r.index;if(FY(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 KY(e){let t=GY(e,PY(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=WY(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=WY(e,t.start)??e.length;r.push({start:t.start,end:Math.min(e.length,n),source:`unmatched`})}return r}function qY(e,t){let n=KY(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:UY(e,t)??0,end:WY(e,t)??e.length}}function JY(e){let t=PY(e),n=/\n[ \t]*\n/g,r=[0];for(let i of e.matchAll(n)){let e=i.index;FY(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 YY(e,t,n,r){let i=JY(e);if(i.length<2)return null;let a=[],o=!1,s=``;for(let e of i){if(r&&zY(r))break;r&&(r.calls+=1);let i=s+e.src;try{let n=t(i).content??[];s+=LY(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){kY();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 XY(e){return{type:`doc`,content:[{type:`paragraph`,content:[{type:`text`,text:e}]}]}}const ZY=[[``,``],[``,``],[``,``],[``,``],[``,``]],QY=/[\uE000-\uE004]/,$Y=/[\uE005-\uE009]/;ZY.map(([e,t])=>({from:e,to:t}));const eX=/<([a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>]+)>/g,tX=/<!--[\s\S]*?-->/g,nX=/<\/([a-z][a-z0-9]*)\s*>/g,rX=/<([a-z][a-z0-9]*)(\s[^>]*)?\/?>/g,iX=new Set([`img`,`video`,`audio`]),aX=new Set([`mark`]),oX=/<\/([A-Z][A-Za-z0-9.]*)>/g;function sX(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 cX(e){let t=new Map,n=new RegExp(oX.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 lX(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 uX(e){let t=[],n=e.indexOf(`/>`);for(;n!==-1;)t.push(n),n=e.indexOf(`/>`,n+2);return t}function dX(e){let t=[],n=e.indexOf(`>`);for(;n!==-1;)t.push(n),n=e.indexOf(`>`,n+1);return t}const fX=1024;function pX(e,t){if(t[e-1]!==`(`||t[e-2]!==`]`)return!1;let n=e-2,r=0;for(let e=n-1;e>=0&&t[e]===`\\`;e--)r++;if(r%2==1)return!1;let i=!1,a=Math.max(0,n-fX);for(let e=n-1;e>=a;e--){let n=t[e];if(n===`
397
- `||n===`\r`||n==="`")return!1;if(n!==`[`&&n!==`]`)continue;let r=0;for(let n=e-1;n>=0&&t[n]===`\\`;n--)r++;if(r%2!=1){if(n===`]`||t[e+1]===`^`||t[e-1]===`]`)return!1;i=!0;break}}if(!i)return!1;let o=!1,s=-1,c=Math.min(t.length,e+1+fX);for(let n=e+1;n<c;n++){let e=t[n];if(e===`>`){s=n;break}if(e===`<`||e===`\\`||e===`
398
- `||e===`\r`||e===``||e===``||e===``||e===``||e===``)return!1;(e===` `||e===` `)&&(o=!0)}return s===-1||!o?!1:t[s+1]===`)`}function mX(e,t,n,r){let i=sX(n,e);if(i>=n.length)return!1;let a=n[i],o=sX(r,e);return a>=(o<r.length?r[o]:t.length)?!1:t[a-1]===`/`}function hX(e){let t=e;if(QY.test(t))for(let[e,n]of ZY)t=t.replaceAll(e,n);t=t.replace(tX,e=>e.replace(/</g,``).replace(/>/g,``)),t=t.replace(eX,(e,t)=>`${t.replaceAll(`:`,``).replaceAll(`@`,``)}`),t=t.replace(nX,(e,t)=>aX.has(t)?e:e.replace(/</g,``).replace(/>/g,``)),t=t.replace(rX,(e,t)=>iX.has(t)&&e.endsWith(`/>`)||aX.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=cX(t),r=lX(t),i=uX(t),a=dX(t);t=t.replace(/</g,(e,o)=>{if(pX(o,t))return e;let s=t.slice(o,o+256);if(s[1]===`/`)return/^<\/[a-zA-Z][a-zA-Z0-9.]*[ \t]*>/.test(s)?e:``;let c=/^<([a-z][a-z0-9]*)/.exec(s);if(c&&iX.has(c[1])&&mX(o,t,a,r))return e;let l=/^<([a-z][a-z0-9]*)([\s/>])/.exec(s);if(l&&aX.has(l[1])){let n=l[1];return s.startsWith(`<${n}/>`)||t.indexOf(`</${n}>`,o)!==-1?e:``}let u=/^<([A-Z][a-zA-Z0-9.]*)[\s/>]/.exec(s);if(!u)return``;let d=u[1],f=sX(r,o),p=sX(i,f<r.length?r[f]:t.length);if(p>0){let n=i[p-1];if(n>o){let r=o+u[0].length-1;if(!t.slice(r,n).replace(/"[^"]*"|'[^']*'/g,``).includes(`/`))return e}}let m=n.get(d);return m&&sX(m,o)<m.length?e:``});{let e=[],n=[];for(let r=0;r<t.length;r++){if(t[r]===`
396
+ `)}:{name:`UnknownError`,message:String(e??`unknown`).slice(0,500)}}function HY(e,t,n,r){if(n>20)return jY(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`MAX_SPLIT_DEPTH exceeded`})),ZY(e);if(r){if(BY(r))return MY(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:`parse budget exhausted`,calls:r.calls})),ZY(e);r.calls+=1}try{return t(e)}catch(i){let a=UY(i),o=VY(i);if(a===void 0){if(n===0){let n=XY(e,t,i,r);if(n)return n}return jY(),console.warn(JSON.stringify({event:`mdx-whole-doc-fallback`,reason:o.message,error:o})),ZY(e)}AY(),console.warn(JSON.stringify({event:`mdx-block-fallback`,offset:a,reason:o.message,error:o}));try{let i=JY(e,a),s=e.slice(0,i.start),c=e.slice(i.start,i.end),l=e.slice(i.end),u=s.trim()?HY(s,t,n+1,r):{type:`doc`,content:[]},d=l.trim()?HY(RY(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){jY();let n=VY(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})),ZY(e)}}}function UY(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 WY(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 GY(e,t){for(let n of e.matchAll(/\n\s*\n/g))if(n.index>=t)return n.index;return null}function KY(e,t){let n=[];for(let r of e.matchAll(/<(\/?)([A-Z][A-Za-z0-9.]*)/g)){let i=r.index;if(IY(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 qY(e){let t=KY(e,FY(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=GY(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=GY(e,t.start)??e.length;r.push({start:t.start,end:Math.min(e.length,n),source:`unmatched`})}return r}function JY(e,t){let n=qY(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:WY(e,t)??0,end:GY(e,t)??e.length}}function YY(e){let t=FY(e),n=/\n[ \t]*\n/g,r=[0];for(let i of e.matchAll(n)){let e=i.index;IY(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 XY(e,t,n,r){let i=YY(e);if(i.length<2)return null;let a=[],o=!1,s=``;for(let e of i){if(r&&BY(r))break;r&&(r.calls+=1);let i=s+e.src;try{let n=t(i).content??[];s+=RY(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){AY();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 ZY(e){return{type:`doc`,content:[{type:`paragraph`,content:[{type:`text`,text:e}]}]}}const QY=[[``,``],[``,``],[``,``],[``,``],[``,``]],$Y=/[\uE000-\uE004]/,eX=/[\uE005-\uE009]/;QY.map(([e,t])=>({from:e,to:t}));const tX=/<([a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>]+)>/g,nX=/<!--[\s\S]*?-->/g,rX=/<\/([a-z][a-z0-9]*)\s*>/g,iX=/<([a-z][a-z0-9]*)(\s[^>]*)?\/?>/g,aX=new Set([`img`,`video`,`audio`]),oX=new Set([`mark`]),sX=/<\/([A-Z][A-Za-z0-9.]*)>/g;function cX(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 lX(e){let t=new Map,n=new RegExp(sX.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 uX(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 dX(e){let t=[],n=e.indexOf(`/>`);for(;n!==-1;)t.push(n),n=e.indexOf(`/>`,n+2);return t}function fX(e){let t=[],n=e.indexOf(`>`);for(;n!==-1;)t.push(n),n=e.indexOf(`>`,n+1);return t}const pX=1024;function mX(e,t){if(t[e-1]!==`(`||t[e-2]!==`]`)return!1;let n=e-2,r=0;for(let e=n-1;e>=0&&t[e]===`\\`;e--)r++;if(r%2==1)return!1;let i=!1,a=Math.max(0,n-pX);for(let e=n-1;e>=a;e--){let n=t[e];if(n===`
397
+ `||n===`\r`||n==="`")return!1;if(n!==`[`&&n!==`]`)continue;let r=0;for(let n=e-1;n>=0&&t[n]===`\\`;n--)r++;if(r%2!=1){if(n===`]`||t[e+1]===`^`||t[e-1]===`]`)return!1;i=!0;break}}if(!i)return!1;let o=!1,s=-1,c=Math.min(t.length,e+1+pX);for(let n=e+1;n<c;n++){let e=t[n];if(e===`>`){s=n;break}if(e===`<`||e===`\\`||e===`
398
+ `||e===`\r`||e===``||e===``||e===``||e===``||e===``)return!1;(e===` `||e===` `)&&(o=!0)}return s===-1||!o?!1:t[s+1]===`)`}function hX(e,t,n,r){let i=cX(n,e);if(i>=n.length)return!1;let a=n[i],o=cX(r,e);return a>=(o<r.length?r[o]:t.length)?!1:t[a-1]===`/`}function gX(e){let t=e;if($Y.test(t))for(let[e,n]of QY)t=t.replaceAll(e,n);t=t.replace(nX,e=>e.replace(/</g,``).replace(/>/g,``)),t=t.replace(tX,(e,t)=>`${t.replaceAll(`:`,``).replaceAll(`@`,``)}`),t=t.replace(rX,(e,t)=>oX.has(t)?e:e.replace(/</g,``).replace(/>/g,``)),t=t.replace(iX,(e,t)=>aX.has(t)&&e.endsWith(`/>`)||oX.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=lX(t),r=uX(t),i=dX(t),a=fX(t);t=t.replace(/</g,(e,o)=>{if(mX(o,t))return e;let s=t.slice(o,o+256);if(s[1]===`/`)return/^<\/[a-zA-Z][a-zA-Z0-9.]*[ \t]*>/.test(s)?e:``;let c=/^<([a-z][a-z0-9]*)/.exec(s);if(c&&aX.has(c[1])&&hX(o,t,a,r))return e;let l=/^<([a-z][a-z0-9]*)([\s/>])/.exec(s);if(l&&oX.has(l[1])){let n=l[1];return s.startsWith(`<${n}/>`)||t.indexOf(`</${n}>`,o)!==-1?e:``}let u=/^<([A-Z][a-zA-Z0-9.]*)[\s/>]/.exec(s);if(!u)return``;let d=u[1],f=cX(r,o),p=cX(i,f<r.length?r[f]:t.length);if(p>0){let n=i[p-1];if(n>o){let r=o+u[0].length-1;if(!t.slice(r,n).replace(/"[^"]*"|'[^']*'/g,``).includes(`/`))return e}}let m=n.get(d);return m&&cX(m,o)<m.length?e:``});{let e=[],n=[];for(let r=0;r<t.length;r++){if(t[r]===`
399
399
  `){let i=t[r+1];if(i===`
400
400
  `||i===`>`){if(e.push(...n),n.length=0,i===`
401
401
  `)for(;t[r+1]===`
402
- `;)r++;continue}}if(t[r]===`{`||t[r]===`}`){let e=0;for(let n=r-1;n>=0&&t[n]===`\\`;n--)e++;if(e%2==1)continue;t[r]===`{`?n.push(r):n.length>0&&n.pop()}}if(e.push(...n),e.length>0){let n=t.split(``);for(let t of e)n[t]=``;t=n.join(``)}}return t}function gX(e){return QY.test(e)||$Y.test(e)}function _X(){return e=>{jj(e,e=>{let t=e;typeof t.value==`string`&&gX(t.value)&&(t.value=vX(t.value)),typeof t.url==`string`&&gX(t.url)&&(t.url=vX(t.url)),typeof t.title==`string`&&gX(t.title)&&(t.title=vX(t.title)),typeof t.alt==`string`&&gX(t.alt)&&(t.alt=vX(t.alt)),typeof t.lang==`string`&&gX(t.lang)&&(t.lang=vX(t.lang)),typeof t.meta==`string`&&gX(t.meta)&&(t.meta=vX(t.meta))})}}function vX(e){let t=e.replaceAll(``,`<`).replaceAll(``,`>`).replaceAll(``,`:`).replaceAll(``,`@`).replaceAll(``,`{`);if($Y.test(t))for(let[e,n]of ZY)t=t.replaceAll(n,e);return t}const yX=/&(?:[A-Za-z][A-Za-z0-9]*|#[0-9]+|#[xX][0-9A-Fa-f]+);/g;function bX(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;r--)n++;return n}function xX(e,t,n){return t.lastIndex=0,e.replace(t,(t,r)=>typeof r!=`number`||bX(e,r)%2==1?t:n(t))}function SX(e){return xX(e,yX,e=>`${e.slice(1,-1)}`)}const CX=RegExp(`([^]+)`,`g`);function wX(e){if(!e.includes(``))return{value:e,spans:[]};let t=[],n=``,r=0;CX.lastIndex=0;let i=CX.exec(e);for(;i!==null;){i.index>r&&(n+=e.slice(r,i.index));let a=`&${i[1]??``};`;t.push({offset:n.length,length:a.length,raw:a}),n+=a,r=i.index+i[0].length,i=CX.exec(e)}return r<e.length&&(n+=e.slice(r)),{value:n,spans:t}}function TX(){return e=>{jj(e,e=>{let t=e;if(typeof t.value==`string`&&t.value.includes(``)){let{value:n,spans:r}=wX(t.value);if(t.value=n,e.type===`text`&&r.length>0){let t=e;t.data??={},t.data.entityRefSpans=r}}for(let e of[`url`,`title`,`alt`,`lang`,`meta`]){let n=t[e];typeof n==`string`&&n.includes(``)&&(t[e]=wX(n).value)}})}}const EX=/\\</g;function DX(e){return xX(e,EX,e=>`${e.slice(1)}`)}function OX(){return e=>{jj(e,e=>{let t=e;typeof t.value==`string`&&t.value.includes(``)&&(t.value=t.value.split(``).join(``));for(let e of[`url`,`title`,`alt`]){let n=t[e];typeof n==`string`&&n.includes(``)&&(t[e]=n.split(``).join(``))}})}}const kX=new Set([`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`]),AX={note:`note`,tip:`tip`,important:`important`,warning:`warning`,caution:`caution`,abstract:`abstract`,info:`info`,todo:`todo`,success:`success`,question:`question`,failure:`failure`,danger:`danger`,bug:`bug`,example:`example`,quote:`quote`,summary:`abstract`,tldr:`abstract`,check:`success`,done:`success`,help:`question`,faq:`question`,fail:`failure`,missing:`failure`,error:`danger`,cite:`quote`,idea:`tip`,hint:`tip`,warn:`warning`,attention:`warning`},jX=`ok-alert`,MX=RegExp(`(?:^|\\s)${jX}-(\\w+)(?:\\s|$)`),NX=/^>\s*\[!(\w+)\]([+-])?(?:\s+(.*?))?\s*$/i;function PX(e,t){if(t<0||t>=e.length)return null;let n=e.indexOf(`
403
- `,t),r=(n===-1?e.slice(t):e.slice(t,n)).match(NX);return r?{rawType:r[1],foldableMarker:r[2]===`+`||r[2]===`-`?r[2]:null,title:r[3]?.trim()||null}:null}function FX(e){if(e.data?.hName!==`div`)return null;let t=e.data?.hProperties?.class;if(typeof t!=`string`)return null;let n=t.match(MX);return n?n[1].toLowerCase():null}function IX(e){return AX[e.toLowerCase()]??null}function LX(e,t,n,r,i=null){let a=[{type:`mdxJsxAttribute`,name:`type`,value:t}];n&&a.push({type:`mdxJsxAttribute`,name:`title`,value:n}),i&&a.push({type:`mdxJsxAttribute`,name:`data-authored-as`,value:i}),r!==null&&(a.push({type:`mdxJsxAttribute`,name:`collapsible`,value:null}),r===`+`?a.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:null}):a.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}}));let o=e.children.slice(1),s=e.position?.start.line;return{type:`mdxJsxFlowElement`,name:`GFMCallout`,attributes:a,children:n&&o.length>0&&s!==void 0&&RX(o[0],s)?o.slice(1):o,position:e.position}}function RX(e,t){if(!e||typeof e!=`object`)return!1;let n=e;if(n.type!==`paragraph`)return!1;let r=n.position?.start?.line,i=n.position?.end?.line;return r===t&&i===t}function zX(e){if(!e||typeof e!=`object`||e.type!==`paragraph`)return!1;let t=e.data?.hProperties?.class;return typeof t==`string`&&t.includes(`${jX}-title`)}function BX(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;jj(e,`blockquote`,(e,t,r)=>{if(r===void 0||typeof t!=`number`)return;let i=FX(e);if(!i)return;let a=IX(i),o=null,s=null;e.position?.start?.offset!==void 0&&(s=PX(n,e.position.start.offset),s&&(o=s.title,a||=IX(s.rawType)));let c=a??`note`,l=s&&kX.has(c)?s.foldableMarker:null,u=(()=>{if(e.position?.start?.offset!==void 0){let t=PX(n,e.position.start.offset);if(t?.rawType)return t.rawType}return i})(),d=u.toLowerCase()===c?null:u;if(!zX(e.children[0]))return;let f=LX(e,c,o,l,d);r.children[t]=f})}}const VX={markers:`*`,classPrefix:jX,matchCaseSensitive:!1,icons:new Proxy({},{get:()=>`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"></svg>`})};function HX(e,t,n,r){let i=t,a=0;for(;a<r&&i<e.length;)e[i]===`\\`&&i+1<e.length&&n[a]===e[i+1]?(i+=2,a+=1):(i+=1,a+=1);return i}function UX(e,t){let n=1,r=1;for(let i=0;i<t&&i<e.length;i++)e[i]===`
404
- `?(n+=1,r=1):r+=1;return{line:n,column:r,offset:t}}function WX(e,t,n){return{start:UX(e,t),end:UX(e,n)}}function GX(e,t,n,r){if(!e||!t.position||typeof t.position.start?.offset!=`number`)return;let i=t.position.start.offset;return WX(e,HX(e,i,t.value,n),HX(e,i,t.value,r))}const KX=/(?<!%)%%([^\n]*?[^\n%])%%(?!%)/g,qX=/<!--([\s\S]*?)-->/g;function JX(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;XX(e),jj(e,`text`,(e,t,r)=>{if(r===void 0||t==null)return;let i=e.value;if(i.indexOf(`%%`)===-1&&i.indexOf(`<!--`)===-1)return;let a=YX(i);if(a.length===0)return;let o=[],s=0;for(let t of a){if(t.start>s){let r={type:`text`,value:i.slice(s,t.start)},a=GX(n,e,s,t.start);a&&(r.position=a),o.push(r)}let r={type:`comment`,children:[{type:`text`,value:t.body}],data:{sourceForm:t.sourceForm}},a=GX(n,e,t.start,t.end);a&&(r.position=a),o.push(r),s=t.end}if(s<i.length){let t={type:`text`,value:i.slice(s)},r=GX(n,e,s,i.length);r&&(t.position=r),o.push(t)}return r.children.splice(t,1,...o),[Oj,t+o.length]})}}function YX(e){let t=[];KX.lastIndex=0;let n;for(;(n=KX.exec(e))!==null;)n[1].trim().length!==0&&t.push({start:n.index,end:n.index+n[0].length,body:n[1],sourceForm:`percent`});qX.lastIndex=0;let r;for(;(r=qX.exec(e))!==null;){let e=r[1].trim();e!==``&&t.push({start:r.index,end:r.index+r[0].length,body:e,sourceForm:`html`})}t.sort((e,t)=>e.start-t.start);let i=[],a=-1;for(let e of t)e.start<a||(i.push(e),a=e.end);return i}function XX(e){let t=e.children,n=0;for(;n<t.length;){let e=t[n];if(e.type===`paragraph`){let r=ZX(e);if(r!==null){let e=QX(r);if(e!==null){let r={type:`commentBlock`,children:[{type:`paragraph`,children:[{type:`text`,value:e}]}],data:{sourceForm:`percent`,sourceLayout:`block`}};t.splice(n,1,r),n+=1;continue}let i=$X(r);if(i!==null){let e={type:`commentBlock`,children:[{type:`paragraph`,children:[{type:`text`,value:i}]}],data:{sourceForm:`html`,sourceLayout:`inline`}};t.splice(n,1,e),n+=1;continue}}let i=eZ(e);if(i!==null){let e={type:`commentBlock`,children:[i],data:{sourceForm:`html`,sourceLayout:`inline`}};t.splice(n,1,e),n+=1;continue}let a=tZ(e);if(a!==null){let e={type:`commentBlock`,children:[a],data:{sourceForm:`percent`,sourceLayout:`inline`}};t.splice(n,1,e),n+=1;continue}}if(e.type===`paragraph`&&rZ(e)){let e=n+1;for(;e<t.length;){let n=t[e];if(n.type===`paragraph`&&rZ(n))break;e+=1}if(e<t.length&&e>n+1){let r={type:`commentBlock`,children:t.slice(n+1,e),data:{sourceForm:`percent`,sourceLayout:`block`}};t.splice(n,e-n+1,r),n+=1;continue}}n+=1}}function ZX(e){if(e.children.length!==1)return null;let t=e.children[0];return t.type===`text`?t.value:null}function QX(e){let t=e.match(/^%%\n((?:.|\n(?!\n))+?)\n%%$/);return t===null?null:t[1]}function $X(e){let t=e.trim();if(!t.startsWith(`<!--`)||!t.endsWith(`-->`))return null;let n=t.slice(4,-3);if(n.includes(`-->`)||n.includes(`<!--`))return null;let r=n.trim();return r===``?null:r}function eZ(e){if(e.children.length<2)return null;let t=e.children[0],n=e.children[e.children.length-1];if(t.type!==`text`||n.type!==`text`)return null;let r=t.value.trimStart();if(!r.startsWith(`<!--`))return null;let i=n.value.trimEnd();if(!i.endsWith(`-->`))return null;for(let t=0;t<e.children.length;t++){let n=e.children[t];if(n.type!==`text`)continue;let r=n.value;if(t===0){if(nZ(r,`<!--`)>1||nZ(r,`-->`)>0)return null}else if(t===e.children.length-1){if(nZ(r,`<!--`)>0||nZ(r,`-->`)>1)return null}else if(r.includes(`<!--`)||r.includes(`-->`))return null}let a=r.slice(4);a.startsWith(` `)&&(a=a.slice(1));let o=i.slice(0,-3);o.endsWith(` `)&&(o=o.slice(0,-1));let s=[];a.length>0&&s.push({...t,value:a});for(let t=1;t<e.children.length-1;t++)s.push(e.children[t]);return o.length>0&&s.push({...n,value:o}),s.length===0?null:{type:`paragraph`,children:s}}function tZ(e){if(e.children.length<2)return null;let t=e.children[0],n=e.children[e.children.length-1];if(t.type!==`text`||n.type!==`text`)return null;let r=t.value.trimStart();if(!r.startsWith(`%%`)||r.startsWith(`%%%`))return null;let i=n.value.trimEnd();if(!i.endsWith(`%%`)||i.endsWith(`%%%`))return null;let a=r.slice(2);a.startsWith(` `)&&(a=a.slice(1));let o=i.slice(0,-2);if(o.endsWith(` `)&&(o=o.slice(0,-1)),a.indexOf(`%%`)!==-1||o.indexOf(`%%`)!==-1)return null;for(let t=1;t<e.children.length-1;t++){let n=e.children[t];if(n.type===`text`&&n.value.indexOf(`%%`)!==-1)return null}if(!(e.children.slice(1,-1).some(e=>e.type===`text`?e.value.trim().length>0:!0)||a.trim().length>0||o.trim().length>0))return null;let s=[];a.length>0&&s.push({...t,value:a});for(let t=1;t<e.children.length-1;t++)s.push(e.children[t]);return o.length>0&&s.push({...n,value:o}),s.length===0?null:{type:`paragraph`,children:s}}function nZ(e,t){if(!t)return 0;let n=0,r=0;for(;;){let i=e.indexOf(t,r);if(i===-1)break;n+=1,r=i+t.length}return n}function rZ(e){let t=ZX(e);return t===null?!1:t.trim()===`%%`}const iZ=/^<details(\s[^>]*)?>\s*<summary>([\s\S]*?)<\/summary>([\s\S]*?)<\/details>\s*$/,aZ=/^<details(\s[^>]*)?>(?:\s*<summary>([\s\S]*?)<\/summary>)?[\s\S]*$/,oZ=/^\s*<\/details>\s*$/;function sZ(e){let t=!1,n=null,r=null;if(!e)return{defaultOpen:t,name:n,id:r};let i=/(\w+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'<>]+)))?/g,a=i.exec(e);for(;a!==null;){let o=a[1].toLowerCase(),s=a[2]??a[3]??a[4]??null;o===`open`?t=!0:o===`name`?n=s:o===`id`&&(r=s),a=i.exec(e)}return{defaultOpen:t,name:n,id:r}}function cZ(e){let t=[];return e.title!==null&&t.push({type:`mdxJsxAttribute`,name:`title`,value:e.title}),e.defaultOpen&&t.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:null}),e.name!==null&&t.push({type:`mdxJsxAttribute`,name:`name`,value:e.name}),e.id!==null&&t.push({type:`mdxJsxAttribute`,name:`id`,value:e.id}),t}function lZ(e){if(e.type!==`paragraph`)return!1;let t=e.children;return t.length===1&&t[0].type===`text`}function uZ(e){return e.children[0].value??``}function dZ(e){if(!lZ(e))return null;let t=uZ(e).match(iZ);if(!t)return null;let{defaultOpen:n,name:r,id:i}=sZ(t[1]),a=t[2].trim()||null,o=t[3].trim(),s=o?[{type:`paragraph`,children:[{type:`text`,value:o}]}]:[];return{type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:cZ({title:a,defaultOpen:n,name:r,id:i}),children:s,position:e.position}}function fZ(e,t){let n=e[t];if(!lZ(n))return null;let r=uZ(n);if(!r.startsWith(`<details`)||r.includes(`</details>`))return null;let i=r.match(aZ);if(!i)return null;let{defaultOpen:a,name:o,id:s}=sZ(i[1]),c=i[2]?.trim()||null;for(let n=t+1;n<e.length;n++){let t=e[n];if(!lZ(t))continue;let r=uZ(t);if(oZ.test(r))return{closerIdx:n,title:c,defaultOpen:a,name:o,id:s};if(r.includes(`</details>`))return null}return null}function pZ(e){let t=e.children,n=0;for(;n<t.length;){let e=t[n];if(lZ(e)){let r=dZ(e);if(r){t[n]=r,n++;continue}let i=fZ(t,n);if(i){let r=e,a=t[i.closerIdx],o=n+1,s=i.closerIdx,c=t.slice(o,s),l=r.position,u=a.position,d={type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:cZ(i),children:c,position:l&&u?{start:l.start,end:u.end}:void 0},f=i.closerIdx-n+1;t.splice(n,f,d),n++;continue}}n++}}function mZ(){return e=>{jj(e,e=>{`children`in e&&Array.isArray(e.children)&&pZ(e)})}}const hZ=/(?<!=)==(?=\S)([^\n]*?[^\s=])==(?!=)/g;function gZ(e){return e.type===`strong`||e.type===`emphasis`||e.type===`delete`||e.type===`inlineCode`}function _Z(e){return e.type===`text`||e.type===`inlineCode`?e.value.length>0?e.value.charAt(0):null:`children`in e&&Array.isArray(e.children)&&e.children.length>0?_Z(e.children[0]):null}function vZ(e){if(e.type===`text`||e.type===`inlineCode`)return e.value.length>0?e.value.slice(-1):null;if(`children`in e&&Array.isArray(e.children)&&e.children.length>0){let t=e.children;return vZ(t[t.length-1])}return null}function yZ(e){let t=e.children,n=0;for(;n<t.length;){let e=t[n];if(e.type!==`text`){n++;continue}let r=e.value,i=-1;for(let e=0;e<=r.length-2;e++){if(r.charCodeAt(e)!==61||r.charCodeAt(e+1)!==61||e>0&&r.charCodeAt(e-1)===61)continue;let a;if(e+2<r.length)a=r.charAt(e+2);else{let e=t[n+1];if(!e)continue;a=_Z(e)}if(!(a===null||/\s/.test(a))){i=e;break}}if(i===-1){n++;continue}let a=-1,o=-1,s=!1;for(let e=i+3;e<=r.length-2;e++){if(r.charCodeAt(e)!==61||r.charCodeAt(e+1)!==61)continue;let i=r.charAt(e-1);if(/[\s=]/.test(i))continue;let o;if(e+2<r.length)o=r.charAt(e+2);else{let e=t[n+1];o=e?e.type===`text`?e.value[0]??null:_Z(e):null}if(o!==`=`){a=-2;break}}if(a===-2){n++;continue}for(let e=n+1;e<t.length;e++){let n=t[e];if(n.type===`text`){for(let r=0;r<=n.value.length-2;r++){if(n.value.charCodeAt(r)!==61||n.value.charCodeAt(r+1)!==61)continue;let i;if(r>0)i=n.value.charAt(r-1);else{let n=t[e-1];i=vZ(n)}if(i===null||/[\s=]/.test(i))continue;let c;if(r+2<n.value.length)c=n.value.charAt(r+2);else{let n=t[e+1];c=n?n.type===`text`?n.value[0]??null:_Z(n):null}if(c!==`=`){a=e,o=r,s=!0;break}}if(a>=0)break}else if(!gZ(n))break}if(a<0){n++;continue}let c=t[a],l=r.slice(0,i),u=r.slice(i+2),d=c.value.slice(0,o),f=c.value.slice(o+2),p=[];u.length>0&&p.push({type:`text`,value:u});for(let e=n+1;e<a;e++)p.push(t[e]);if(d.length>0&&p.push({type:`text`,value:d}),!s){n++;continue}let m={type:`mark`,children:p},h=[];l.length>0&&h.push({type:`text`,value:l}),h.push(m),f.length>0&&h.push({type:`text`,value:f}),t.splice(n,a-n+1,...h),n+=(l.length>0?1:0)+1}}function bZ(e){if(`children`in e&&Array.isArray(e.children)){yZ(e);for(let t of e.children)bZ(t)}}function xZ(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;jj(e,`text`,(e,t,r)=>{if(r===void 0||t==null)return;let i=e.value;if(i.indexOf(`==`)===-1)return;hZ.lastIndex=0;let a=[],o;for(;(o=hZ.exec(i))!==null;)a.push(o);if(a.length===0)return;let s=[],c=0;for(let t of a){let r=t.index,a=r+t[0].length;if(r>c){let t={type:`text`,value:i.slice(c,r)},a=GX(n,e,c,r);a&&(t.position=a),s.push(t)}let o={type:`text`,value:t[1]},l=GX(n,e,r+2,a-2);l&&(o.position=l);let u={type:`mark`,children:[o]},d=GX(n,e,r,a);d&&(u.position=d),s.push(u),c=a}if(c<i.length){let t={type:`text`,value:i.slice(c)},r=GX(n,e,c,i.length);r&&(t.position=r),s.push(t)}return r.children.splice(t,1,...s),[Oj,t+s.length]}),bZ(e),jj(e,`mdxJsxTextElement`,(e,t,n)=>{if(n===void 0||t==null||e.name!==`mark`)return;let r={type:`mark`,children:e.children??[]};return n.children.splice(t,1,r),t+1})}}function SZ(){return e=>{jj(e,`paragraph`,(e,t,n)=>{if(!n||t==null||e.children.length!==1)return;let r=e.children[0];if(!r||r.type!==`image`)return;let i=CZ(r,e);n.children[t]=i})}}function CZ(e,t){let n=[{type:`mdxJsxAttribute`,name:`src`,value:e.url}];typeof e.alt==`string`&&n.push({type:`mdxJsxAttribute`,name:`alt`,value:e.alt}),e.title&&n.push({type:`mdxJsxAttribute`,name:`title`,value:e.title});let r={type:`mdxJsxFlowElement`,name:`CommonMarkImage`,attributes:n,children:[]};return t.position&&(r.position=t.position),r}const wZ=/^( {4}|\t)/;function TZ(e){let t=e.split(`
405
- `),n=!1;for(let e of t)if(e.length!==0&&(n=!0,!wZ.test(e)))return!1;return n}function EZ(e){return e.split(`
402
+ `;)r++;continue}}if(t[r]===`{`||t[r]===`}`){let e=0;for(let n=r-1;n>=0&&t[n]===`\\`;n--)e++;if(e%2==1)continue;t[r]===`{`?n.push(r):n.length>0&&n.pop()}}if(e.push(...n),e.length>0){let n=t.split(``);for(let t of e)n[t]=``;t=n.join(``)}}return t}function _X(e){return $Y.test(e)||eX.test(e)}function vX(){return e=>{jj(e,e=>{let t=e;typeof t.value==`string`&&_X(t.value)&&(t.value=yX(t.value)),typeof t.url==`string`&&_X(t.url)&&(t.url=yX(t.url)),typeof t.title==`string`&&_X(t.title)&&(t.title=yX(t.title)),typeof t.alt==`string`&&_X(t.alt)&&(t.alt=yX(t.alt)),typeof t.lang==`string`&&_X(t.lang)&&(t.lang=yX(t.lang)),typeof t.meta==`string`&&_X(t.meta)&&(t.meta=yX(t.meta))})}}function yX(e){let t=e.replaceAll(``,`<`).replaceAll(``,`>`).replaceAll(``,`:`).replaceAll(``,`@`).replaceAll(``,`{`);if(eX.test(t))for(let[e,n]of QY)t=t.replaceAll(n,e);return t}const bX=/&(?:[A-Za-z][A-Za-z0-9]*|#[0-9]+|#[xX][0-9A-Fa-f]+);/g;function xX(e,t){let n=0;for(let r=t-1;r>=0&&e[r]===`\\`;r--)n++;return n}function SX(e,t,n){return t.lastIndex=0,e.replace(t,(t,r)=>typeof r!=`number`||xX(e,r)%2==1?t:n(t))}function CX(e){return SX(e,bX,e=>`${e.slice(1,-1)}`)}const wX=RegExp(`([^]+)`,`g`);function TX(e){if(!e.includes(``))return{value:e,spans:[]};let t=[],n=``,r=0;wX.lastIndex=0;let i=wX.exec(e);for(;i!==null;){i.index>r&&(n+=e.slice(r,i.index));let a=`&${i[1]??``};`;t.push({offset:n.length,length:a.length,raw:a}),n+=a,r=i.index+i[0].length,i=wX.exec(e)}return r<e.length&&(n+=e.slice(r)),{value:n,spans:t}}function EX(){return e=>{jj(e,e=>{let t=e;if(typeof t.value==`string`&&t.value.includes(``)){let{value:n,spans:r}=TX(t.value);if(t.value=n,e.type===`text`&&r.length>0){let t=e;t.data??={},t.data.entityRefSpans=r}}for(let e of[`url`,`title`,`alt`,`lang`,`meta`]){let n=t[e];typeof n==`string`&&n.includes(``)&&(t[e]=TX(n).value)}})}}const DX=/\\</g;function OX(e){return SX(e,DX,e=>`${e.slice(1)}`)}function kX(){return e=>{jj(e,e=>{let t=e;typeof t.value==`string`&&t.value.includes(``)&&(t.value=t.value.split(``).join(``));for(let e of[`url`,`title`,`alt`]){let n=t[e];typeof n==`string`&&n.includes(``)&&(t[e]=n.split(``).join(``))}})}}const AX=new Set([`note`,`tip`,`important`,`warning`,`caution`,`abstract`,`info`,`todo`,`success`,`question`,`failure`,`danger`,`bug`,`example`,`quote`]),jX={note:`note`,tip:`tip`,important:`important`,warning:`warning`,caution:`caution`,abstract:`abstract`,info:`info`,todo:`todo`,success:`success`,question:`question`,failure:`failure`,danger:`danger`,bug:`bug`,example:`example`,quote:`quote`,summary:`abstract`,tldr:`abstract`,check:`success`,done:`success`,help:`question`,faq:`question`,fail:`failure`,missing:`failure`,error:`danger`,cite:`quote`,idea:`tip`,hint:`tip`,warn:`warning`,attention:`warning`},MX=`ok-alert`,NX=RegExp(`(?:^|\\s)${MX}-(\\w+)(?:\\s|$)`),PX=/^>\s*\[!(\w+)\]([+-])?(?:\s+(.*?))?\s*$/i;function FX(e,t){if(t<0||t>=e.length)return null;let n=e.indexOf(`
403
+ `,t),r=(n===-1?e.slice(t):e.slice(t,n)).match(PX);return r?{rawType:r[1],foldableMarker:r[2]===`+`||r[2]===`-`?r[2]:null,title:r[3]?.trim()||null}:null}function IX(e){if(e.data?.hName!==`div`)return null;let t=e.data?.hProperties?.class;if(typeof t!=`string`)return null;let n=t.match(NX);return n?n[1].toLowerCase():null}function LX(e){return jX[e.toLowerCase()]??null}function RX(e,t,n,r,i=null){let a=[{type:`mdxJsxAttribute`,name:`type`,value:t}];n&&a.push({type:`mdxJsxAttribute`,name:`title`,value:n}),i&&a.push({type:`mdxJsxAttribute`,name:`data-authored-as`,value:i}),r!==null&&(a.push({type:`mdxJsxAttribute`,name:`collapsible`,value:null}),r===`+`?a.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:null}):a.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:{type:`mdxJsxAttributeValueExpression`,value:`false`}}));let o=e.children.slice(1),s=e.position?.start.line;return{type:`mdxJsxFlowElement`,name:`GFMCallout`,attributes:a,children:n&&o.length>0&&s!==void 0&&zX(o[0],s)?o.slice(1):o,position:e.position}}function zX(e,t){if(!e||typeof e!=`object`)return!1;let n=e;if(n.type!==`paragraph`)return!1;let r=n.position?.start?.line,i=n.position?.end?.line;return r===t&&i===t}function BX(e){if(!e||typeof e!=`object`||e.type!==`paragraph`)return!1;let t=e.data?.hProperties?.class;return typeof t==`string`&&t.includes(`${MX}-title`)}function VX(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;jj(e,`blockquote`,(e,t,r)=>{if(r===void 0||typeof t!=`number`)return;let i=IX(e);if(!i)return;let a=LX(i),o=null,s=null;e.position?.start?.offset!==void 0&&(s=FX(n,e.position.start.offset),s&&(o=s.title,a||=LX(s.rawType)));let c=a??`note`,l=s&&AX.has(c)?s.foldableMarker:null,u=(()=>{if(e.position?.start?.offset!==void 0){let t=FX(n,e.position.start.offset);if(t?.rawType)return t.rawType}return i})(),d=u.toLowerCase()===c?null:u;if(!BX(e.children[0]))return;let f=RX(e,c,o,l,d);r.children[t]=f})}}const HX={markers:`*`,classPrefix:MX,matchCaseSensitive:!1,icons:new Proxy({},{get:()=>`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 16 16" width="16" height="16"></svg>`})};function UX(e,t,n,r){let i=t,a=0;for(;a<r&&i<e.length;)e[i]===`\\`&&i+1<e.length&&n[a]===e[i+1]?(i+=2,a+=1):(i+=1,a+=1);return i}function WX(e,t){let n=1,r=1;for(let i=0;i<t&&i<e.length;i++)e[i]===`
404
+ `?(n+=1,r=1):r+=1;return{line:n,column:r,offset:t}}function GX(e,t,n){return{start:WX(e,t),end:WX(e,n)}}function KX(e,t,n,r){if(!e||!t.position||typeof t.position.start?.offset!=`number`)return;let i=t.position.start.offset;return GX(e,UX(e,i,t.value,n),UX(e,i,t.value,r))}const qX=/(?<!%)%%([^\n]*?[^\n%])%%(?!%)/g,JX=/<!--([\s\S]*?)-->/g;function YX(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;ZX(e),jj(e,`text`,(e,t,r)=>{if(r===void 0||t==null)return;let i=e.value;if(i.indexOf(`%%`)===-1&&i.indexOf(`<!--`)===-1)return;let a=XX(i);if(a.length===0)return;let o=[],s=0;for(let t of a){if(t.start>s){let r={type:`text`,value:i.slice(s,t.start)},a=KX(n,e,s,t.start);a&&(r.position=a),o.push(r)}let r={type:`comment`,children:[{type:`text`,value:t.body}],data:{sourceForm:t.sourceForm}},a=KX(n,e,t.start,t.end);a&&(r.position=a),o.push(r),s=t.end}if(s<i.length){let t={type:`text`,value:i.slice(s)},r=KX(n,e,s,i.length);r&&(t.position=r),o.push(t)}return r.children.splice(t,1,...o),[Oj,t+o.length]})}}function XX(e){let t=[];qX.lastIndex=0;let n;for(;(n=qX.exec(e))!==null;)n[1].trim().length!==0&&t.push({start:n.index,end:n.index+n[0].length,body:n[1],sourceForm:`percent`});JX.lastIndex=0;let r;for(;(r=JX.exec(e))!==null;){let e=r[1].trim();e!==``&&t.push({start:r.index,end:r.index+r[0].length,body:e,sourceForm:`html`})}t.sort((e,t)=>e.start-t.start);let i=[],a=-1;for(let e of t)e.start<a||(i.push(e),a=e.end);return i}function ZX(e){let t=e.children,n=0;for(;n<t.length;){let e=t[n];if(e.type===`paragraph`){let r=QX(e);if(r!==null){let e=$X(r);if(e!==null){let r={type:`commentBlock`,children:[{type:`paragraph`,children:[{type:`text`,value:e}]}],data:{sourceForm:`percent`,sourceLayout:`block`}};t.splice(n,1,r),n+=1;continue}let i=eZ(r);if(i!==null){let e={type:`commentBlock`,children:[{type:`paragraph`,children:[{type:`text`,value:i}]}],data:{sourceForm:`html`,sourceLayout:`inline`}};t.splice(n,1,e),n+=1;continue}}let i=tZ(e);if(i!==null){let e={type:`commentBlock`,children:[i],data:{sourceForm:`html`,sourceLayout:`inline`}};t.splice(n,1,e),n+=1;continue}let a=nZ(e);if(a!==null){let e={type:`commentBlock`,children:[a],data:{sourceForm:`percent`,sourceLayout:`inline`}};t.splice(n,1,e),n+=1;continue}}if(e.type===`paragraph`&&iZ(e)){let e=n+1;for(;e<t.length;){let n=t[e];if(n.type===`paragraph`&&iZ(n))break;e+=1}if(e<t.length&&e>n+1){let r={type:`commentBlock`,children:t.slice(n+1,e),data:{sourceForm:`percent`,sourceLayout:`block`}};t.splice(n,e-n+1,r),n+=1;continue}}n+=1}}function QX(e){if(e.children.length!==1)return null;let t=e.children[0];return t.type===`text`?t.value:null}function $X(e){let t=e.match(/^%%\n((?:.|\n(?!\n))+?)\n%%$/);return t===null?null:t[1]}function eZ(e){let t=e.trim();if(!t.startsWith(`<!--`)||!t.endsWith(`-->`))return null;let n=t.slice(4,-3);if(n.includes(`-->`)||n.includes(`<!--`))return null;let r=n.trim();return r===``?null:r}function tZ(e){if(e.children.length<2)return null;let t=e.children[0],n=e.children[e.children.length-1];if(t.type!==`text`||n.type!==`text`)return null;let r=t.value.trimStart();if(!r.startsWith(`<!--`))return null;let i=n.value.trimEnd();if(!i.endsWith(`-->`))return null;for(let t=0;t<e.children.length;t++){let n=e.children[t];if(n.type!==`text`)continue;let r=n.value;if(t===0){if(rZ(r,`<!--`)>1||rZ(r,`-->`)>0)return null}else if(t===e.children.length-1){if(rZ(r,`<!--`)>0||rZ(r,`-->`)>1)return null}else if(r.includes(`<!--`)||r.includes(`-->`))return null}let a=r.slice(4);a.startsWith(` `)&&(a=a.slice(1));let o=i.slice(0,-3);o.endsWith(` `)&&(o=o.slice(0,-1));let s=[];a.length>0&&s.push({...t,value:a});for(let t=1;t<e.children.length-1;t++)s.push(e.children[t]);return o.length>0&&s.push({...n,value:o}),s.length===0?null:{type:`paragraph`,children:s}}function nZ(e){if(e.children.length<2)return null;let t=e.children[0],n=e.children[e.children.length-1];if(t.type!==`text`||n.type!==`text`)return null;let r=t.value.trimStart();if(!r.startsWith(`%%`)||r.startsWith(`%%%`))return null;let i=n.value.trimEnd();if(!i.endsWith(`%%`)||i.endsWith(`%%%`))return null;let a=r.slice(2);a.startsWith(` `)&&(a=a.slice(1));let o=i.slice(0,-2);if(o.endsWith(` `)&&(o=o.slice(0,-1)),a.indexOf(`%%`)!==-1||o.indexOf(`%%`)!==-1)return null;for(let t=1;t<e.children.length-1;t++){let n=e.children[t];if(n.type===`text`&&n.value.indexOf(`%%`)!==-1)return null}if(!(e.children.slice(1,-1).some(e=>e.type===`text`?e.value.trim().length>0:!0)||a.trim().length>0||o.trim().length>0))return null;let s=[];a.length>0&&s.push({...t,value:a});for(let t=1;t<e.children.length-1;t++)s.push(e.children[t]);return o.length>0&&s.push({...n,value:o}),s.length===0?null:{type:`paragraph`,children:s}}function rZ(e,t){if(!t)return 0;let n=0,r=0;for(;;){let i=e.indexOf(t,r);if(i===-1)break;n+=1,r=i+t.length}return n}function iZ(e){let t=QX(e);return t===null?!1:t.trim()===`%%`}const aZ=/^<details(\s[^>]*)?>\s*<summary>([\s\S]*?)<\/summary>([\s\S]*?)<\/details>\s*$/,oZ=/^<details(\s[^>]*)?>(?:\s*<summary>([\s\S]*?)<\/summary>)?[\s\S]*$/,sZ=/^\s*<\/details>\s*$/;function cZ(e){let t=!1,n=null,r=null;if(!e)return{defaultOpen:t,name:n,id:r};let i=/(\w+)(?:\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s"'<>]+)))?/g,a=i.exec(e);for(;a!==null;){let o=a[1].toLowerCase(),s=a[2]??a[3]??a[4]??null;o===`open`?t=!0:o===`name`?n=s:o===`id`&&(r=s),a=i.exec(e)}return{defaultOpen:t,name:n,id:r}}function lZ(e){let t=[];return e.title!==null&&t.push({type:`mdxJsxAttribute`,name:`title`,value:e.title}),e.defaultOpen&&t.push({type:`mdxJsxAttribute`,name:`defaultOpen`,value:null}),e.name!==null&&t.push({type:`mdxJsxAttribute`,name:`name`,value:e.name}),e.id!==null&&t.push({type:`mdxJsxAttribute`,name:`id`,value:e.id}),t}function uZ(e){if(e.type!==`paragraph`)return!1;let t=e.children;return t.length===1&&t[0].type===`text`}function dZ(e){return e.children[0].value??``}function fZ(e){if(!uZ(e))return null;let t=dZ(e).match(aZ);if(!t)return null;let{defaultOpen:n,name:r,id:i}=cZ(t[1]),a=t[2].trim()||null,o=t[3].trim(),s=o?[{type:`paragraph`,children:[{type:`text`,value:o}]}]:[];return{type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:lZ({title:a,defaultOpen:n,name:r,id:i}),children:s,position:e.position}}function pZ(e,t){let n=e[t];if(!uZ(n))return null;let r=dZ(n);if(!r.startsWith(`<details`)||r.includes(`</details>`))return null;let i=r.match(oZ);if(!i)return null;let{defaultOpen:a,name:o,id:s}=cZ(i[1]),c=i[2]?.trim()||null;for(let n=t+1;n<e.length;n++){let t=e[n];if(!uZ(t))continue;let r=dZ(t);if(sZ.test(r))return{closerIdx:n,title:c,defaultOpen:a,name:o,id:s};if(r.includes(`</details>`))return null}return null}function mZ(e){let t=e.children,n=0;for(;n<t.length;){let e=t[n];if(uZ(e)){let r=fZ(e);if(r){t[n]=r,n++;continue}let i=pZ(t,n);if(i){let r=e,a=t[i.closerIdx],o=n+1,s=i.closerIdx,c=t.slice(o,s),l=r.position,u=a.position,d={type:`mdxJsxFlowElement`,name:`HtmlDetailsAccordion`,attributes:lZ(i),children:c,position:l&&u?{start:l.start,end:u.end}:void 0},f=i.closerIdx-n+1;t.splice(n,f,d),n++;continue}}n++}}function hZ(){return e=>{jj(e,e=>{`children`in e&&Array.isArray(e.children)&&mZ(e)})}}const gZ=/(?<!=)==(?=\S)([^\n]*?[^\s=])==(?!=)/g;function _Z(e){return e.type===`strong`||e.type===`emphasis`||e.type===`delete`||e.type===`inlineCode`}function vZ(e){return e.type===`text`||e.type===`inlineCode`?e.value.length>0?e.value.charAt(0):null:`children`in e&&Array.isArray(e.children)&&e.children.length>0?vZ(e.children[0]):null}function yZ(e){if(e.type===`text`||e.type===`inlineCode`)return e.value.length>0?e.value.slice(-1):null;if(`children`in e&&Array.isArray(e.children)&&e.children.length>0){let t=e.children;return yZ(t[t.length-1])}return null}function bZ(e){let t=e.children,n=0;for(;n<t.length;){let e=t[n];if(e.type!==`text`){n++;continue}let r=e.value,i=-1;for(let e=0;e<=r.length-2;e++){if(r.charCodeAt(e)!==61||r.charCodeAt(e+1)!==61||e>0&&r.charCodeAt(e-1)===61)continue;let a;if(e+2<r.length)a=r.charAt(e+2);else{let e=t[n+1];if(!e)continue;a=vZ(e)}if(!(a===null||/\s/.test(a))){i=e;break}}if(i===-1){n++;continue}let a=-1,o=-1,s=!1;for(let e=i+3;e<=r.length-2;e++){if(r.charCodeAt(e)!==61||r.charCodeAt(e+1)!==61)continue;let i=r.charAt(e-1);if(/[\s=]/.test(i))continue;let o;if(e+2<r.length)o=r.charAt(e+2);else{let e=t[n+1];o=e?e.type===`text`?e.value[0]??null:vZ(e):null}if(o!==`=`){a=-2;break}}if(a===-2){n++;continue}for(let e=n+1;e<t.length;e++){let n=t[e];if(n.type===`text`){for(let r=0;r<=n.value.length-2;r++){if(n.value.charCodeAt(r)!==61||n.value.charCodeAt(r+1)!==61)continue;let i;if(r>0)i=n.value.charAt(r-1);else{let n=t[e-1];i=yZ(n)}if(i===null||/[\s=]/.test(i))continue;let c;if(r+2<n.value.length)c=n.value.charAt(r+2);else{let n=t[e+1];c=n?n.type===`text`?n.value[0]??null:vZ(n):null}if(c!==`=`){a=e,o=r,s=!0;break}}if(a>=0)break}else if(!_Z(n))break}if(a<0){n++;continue}let c=t[a],l=r.slice(0,i),u=r.slice(i+2),d=c.value.slice(0,o),f=c.value.slice(o+2),p=[];u.length>0&&p.push({type:`text`,value:u});for(let e=n+1;e<a;e++)p.push(t[e]);if(d.length>0&&p.push({type:`text`,value:d}),!s){n++;continue}let m={type:`mark`,children:p},h=[];l.length>0&&h.push({type:`text`,value:l}),h.push(m),f.length>0&&h.push({type:`text`,value:f}),t.splice(n,a-n+1,...h),n+=(l.length>0?1:0)+1}}function xZ(e){if(`children`in e&&Array.isArray(e.children)){bZ(e);for(let t of e.children)xZ(t)}}function SZ(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;jj(e,`text`,(e,t,r)=>{if(r===void 0||t==null)return;let i=e.value;if(i.indexOf(`==`)===-1)return;gZ.lastIndex=0;let a=[],o;for(;(o=gZ.exec(i))!==null;)a.push(o);if(a.length===0)return;let s=[],c=0;for(let t of a){let r=t.index,a=r+t[0].length;if(r>c){let t={type:`text`,value:i.slice(c,r)},a=KX(n,e,c,r);a&&(t.position=a),s.push(t)}let o={type:`text`,value:t[1]},l=KX(n,e,r+2,a-2);l&&(o.position=l);let u={type:`mark`,children:[o]},d=KX(n,e,r,a);d&&(u.position=d),s.push(u),c=a}if(c<i.length){let t={type:`text`,value:i.slice(c)},r=KX(n,e,c,i.length);r&&(t.position=r),s.push(t)}return r.children.splice(t,1,...s),[Oj,t+s.length]}),xZ(e),jj(e,`mdxJsxTextElement`,(e,t,n)=>{if(n===void 0||t==null||e.name!==`mark`)return;let r={type:`mark`,children:e.children??[]};return n.children.splice(t,1,r),t+1})}}function CZ(){return e=>{jj(e,`paragraph`,(e,t,n)=>{if(!n||t==null||e.children.length!==1)return;let r=e.children[0];if(!r||r.type!==`image`)return;let i=wZ(r,e);n.children[t]=i})}}function wZ(e,t){let n=[{type:`mdxJsxAttribute`,name:`src`,value:e.url}];typeof e.alt==`string`&&n.push({type:`mdxJsxAttribute`,name:`alt`,value:e.alt}),e.title&&n.push({type:`mdxJsxAttribute`,name:`title`,value:e.title});let r={type:`mdxJsxFlowElement`,name:`CommonMarkImage`,attributes:n,children:[]};return t.position&&(r.position=t.position),r}const TZ=/^( {4}|\t)/;function EZ(e){let t=e.split(`
405
+ `),n=!1;for(let e of t)if(e.length!==0&&(n=!0,!TZ.test(e)))return!1;return n}function DZ(e){return e.split(`
406
406
  `).map(e=>e.length===0?e:e.startsWith(` `)?e.slice(4):e.startsWith(` `)?e.slice(1):e).join(`
407
- `)}function DZ(e,t){let n=e.position;if(!n||typeof n.start.offset!=`number`||typeof n.end.offset!=`number`)return null;let r=n.start.offset,i=n.end.offset;if(r<0||i>t.length||r>=i)return null;let a=r;for(;a>0&&t[a-1]!==`
408
- `;)a--;if(a===r)return null;let o=t.slice(a,r);if(!wZ.test(o))return null;let s=t.slice(a,i);if(!TZ(s))return null;let c={start:{line:n.start.line,column:1,offset:a},end:n.end};return{type:`code`,lang:null,meta:null,value:EZ(s).replace(/\n+$/,``),position:c,data:{sourceStyle:`indented`}}}const OZ=function(){return(e,t)=>{let n=String(t.value??``);n&&jj(e,`paragraph`,(e,t,r)=>{if(!r||r.type!==`root`||t==null)return;let i=r.children[t-1];if(i&&i.type===`list`)return;let a=DZ(e,n);a&&(r.children[t]=a)})}};function kZ(e,t,n){let r={type:`mdxJsxFlowElement`,name:e,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t}],children:[]};return n&&(r.position=n),r}function AZ(){return e=>{jj(e,`math`,(e,t,n)=>{if(!n||t==null)return;let r=kZ(`DollarMath`,typeof e.value==`string`?e.value:``,e.position);n.children[t]=r}),jj(e,`code`,(e,t,n)=>{if(!n||t==null||e.lang!==`math`)return;let r=kZ(`MathFence`,typeof e.value==`string`?e.value:``,e.position);n.children[t]=r})}}const jZ=/<([a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>]+)>/g;function MZ(e,t=``){let n=[],r=!1;for(let i of e.children){if(i.type!==`text`){n.push(i);continue}let e=i.value;jZ.lastIndex=0;let a=[],o=0;for(;;){let n=jZ.exec(e);if(n===null)break;let s=n[0],c=n[1],l=n.index;if(l>o){let n={type:`text`,value:e.slice(o,l)},r=GX(t,i,o,l);r&&(n.position=r),a.push(n)}let u={type:`text`,value:c},d=GX(t,i,l+1,l+1+c.length);d&&(u.position=d);let f={type:`link`,url:c,title:null,children:[u],data:{sourceStyle:`autolink`}},p=GX(t,i,l,l+s.length);p&&(f.position=p),a.push(f),o=l+s.length,r=!0}if(a.length===0)n.push(i);else{if(o<e.length){let n={type:`text`,value:e.slice(o)},r=GX(t,i,o,e.length);r&&(n.position=r),a.push(n)}n.push(...a)}}r&&(e.children=n)}const NZ=new Set(`!"#$%&'()*+,-./:;<=>?@[\\]^_\`{|}~`.split(``));function PZ(e){let t=[],n=``;for(let r=0;r<e.length;r++){let i=e[r];if(i===`\\`&&r+1<e.length&&e[r+1]===`|`){n+=`${i}|`,r++;continue}if(i===`|`){t.push(n),n=``;continue}n+=i}return t.push(n),t}function FZ(e,t,n=!1,r){if(!t)return;let i=e.position;if(!i||typeof i.start?.offset!=`number`){n&&console.warn(`[position-slice] node type=${e.type} has no position — fidelity defaults apply`);return}let a=i.start.offset,o=i.end?.offset??a;if(a<0||o>t.length){n&&console.warn(`[position-slice] node type=${e.type} position out of bounds: start=${a} end=${o} sourceLen=${t.length}`);return}switch(e.data??={},e.type){case`text`:{let n=t.slice(a,o),r=e.value??``;if(n.length>r.length&&n.includes(`\\`)){let t=[],i=0,a=0;for(;i<n.length&&a<r.length;)n[i]===`\\`&&i+1<n.length&&NZ.has(n[i+1])&&r[a]===n[i+1]?(t.push({offset:a,char:n[i+1]}),i+=2,a+=1):(i++,a++);t.length>0&&(e.data.escapedChars=t)}n.endsWith(`\\`)&&r.endsWith(`\\`)&&(e.data.sourceRaw=n);break}case`emphasis`:{let n=t[a];(n===`*`||n===`_`)&&(e.data.sourceDelimiter=n);break}case`strong`:{let n=t.slice(a,a+2);(n===`**`||n===`__`)&&(e.data.sourceDelimiter=n);break}case`heading`:{let n=t[a],i=t.slice(a,o);if(n===`#`){if(e.data.sourceStyle=`atx`,r?.type===`root`){let n=a;for(;n>0&&t[n-1]!==`
407
+ `)}function OZ(e,t){let n=e.position;if(!n||typeof n.start.offset!=`number`||typeof n.end.offset!=`number`)return null;let r=n.start.offset,i=n.end.offset;if(r<0||i>t.length||r>=i)return null;let a=r;for(;a>0&&t[a-1]!==`
408
+ `;)a--;if(a===r)return null;let o=t.slice(a,r);if(!TZ.test(o))return null;let s=t.slice(a,i);if(!EZ(s))return null;let c={start:{line:n.start.line,column:1,offset:a},end:n.end};return{type:`code`,lang:null,meta:null,value:DZ(s).replace(/\n+$/,``),position:c,data:{sourceStyle:`indented`}}}const kZ=function(){return(e,t)=>{let n=String(t.value??``);n&&jj(e,`paragraph`,(e,t,r)=>{if(!r||r.type!==`root`||t==null)return;let i=r.children[t-1];if(i&&i.type===`list`)return;let a=OZ(e,n);a&&(r.children[t]=a)})}};function AZ(e,t,n){let r={type:`mdxJsxFlowElement`,name:e,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t}],children:[]};return n&&(r.position=n),r}function jZ(){return e=>{jj(e,`math`,(e,t,n)=>{if(!n||t==null)return;let r=AZ(`DollarMath`,typeof e.value==`string`?e.value:``,e.position);n.children[t]=r}),jj(e,`code`,(e,t,n)=>{if(!n||t==null||e.lang!==`math`)return;let r=AZ(`MathFence`,typeof e.value==`string`?e.value:``,e.position);n.children[t]=r})}}const MZ=/<([a-zA-Z][a-zA-Z0-9+.-]*:[^\s<>]+)>/g;function NZ(e,t=``){let n=[],r=!1;for(let i of e.children){if(i.type!==`text`){n.push(i);continue}let e=i.value;MZ.lastIndex=0;let a=[],o=0;for(;;){let n=MZ.exec(e);if(n===null)break;let s=n[0],c=n[1],l=n.index;if(l>o){let n={type:`text`,value:e.slice(o,l)},r=KX(t,i,o,l);r&&(n.position=r),a.push(n)}let u={type:`text`,value:c},d=KX(t,i,l+1,l+1+c.length);d&&(u.position=d);let f={type:`link`,url:c,title:null,children:[u],data:{sourceStyle:`autolink`}},p=KX(t,i,l,l+s.length);p&&(f.position=p),a.push(f),o=l+s.length,r=!0}if(a.length===0)n.push(i);else{if(o<e.length){let n={type:`text`,value:e.slice(o)},r=KX(t,i,o,e.length);r&&(n.position=r),a.push(n)}n.push(...a)}}r&&(e.children=n)}const PZ=new Set(`!"#$%&'()*+,-./:;<=>?@[\\]^_\`{|}~`.split(``));function FZ(e){let t=[],n=``;for(let r=0;r<e.length;r++){let i=e[r];if(i===`\\`&&r+1<e.length&&e[r+1]===`|`){n+=`${i}|`,r++;continue}if(i===`|`){t.push(n),n=``;continue}n+=i}return t.push(n),t}function IZ(e,t,n=!1,r){if(!t)return;let i=e.position;if(!i||typeof i.start?.offset!=`number`){n&&console.warn(`[position-slice] node type=${e.type} has no position — fidelity defaults apply`);return}let a=i.start.offset,o=i.end?.offset??a;if(a<0||o>t.length){n&&console.warn(`[position-slice] node type=${e.type} position out of bounds: start=${a} end=${o} sourceLen=${t.length}`);return}switch(e.data??={},e.type){case`text`:{let n=t.slice(a,o),r=e.value??``;if(n.length>r.length&&n.includes(`\\`)){let t=[],i=0,a=0;for(;i<n.length&&a<r.length;)n[i]===`\\`&&i+1<n.length&&PZ.has(n[i+1])&&r[a]===n[i+1]?(t.push({offset:a,char:n[i+1]}),i+=2,a+=1):(i++,a++);t.length>0&&(e.data.escapedChars=t)}n.endsWith(`\\`)&&r.endsWith(`\\`)&&(e.data.sourceRaw=n);break}case`emphasis`:{let n=t[a];(n===`*`||n===`_`)&&(e.data.sourceDelimiter=n);break}case`strong`:{let n=t.slice(a,a+2);(n===`**`||n===`__`)&&(e.data.sourceDelimiter=n);break}case`heading`:{let n=t[a],i=t.slice(a,o);if(n===`#`){if(e.data.sourceStyle=`atx`,r?.type===`root`){let n=a;for(;n>0&&t[n-1]!==`
409
409
  `;)n--;let r=t.slice(n,a);r.length>=1&&r.length<=3&&/^ +$/.test(r)&&(e.data.sourceLeadingIndent=r.length)}let n=/^#+( {2,})[^ ]/.exec(i);n&&(e.data.sourceInteriorSpacing=n[1].length);let o=/^.*?[ \t](#+)[ \t]*$/.exec(i);o&&(e.data.sourceTrailingHashes=o[1].length)}else{let t=/\n(=+)[ \t]*$/.exec(i),n=/\n(-+)[ \t]*$/.exec(i),r=t??n;r?(e.data.sourceStyle=`setext`,e.data.sourceUnderlineLength=r[1].length):e.data.sourceStyle=`atx`}break}case`blockquote`:{let n=a;for(;n>0&&t[n-1]!==`
410
410
  `;)n--;let r=!1;for(let e=n;e<a;e++)if(t[e]===`>`){r=!0;break}let i=t.slice(a,o).split(`
411
411
  `),s=[];for(let e=0;e<i.length;e++){let t=i[e];if(t.length===0)continue;if(r&&e>0)break;let n=t.replace(/^ {1,3}/,``);if(n[0]===`>`&&n.slice(1).trimEnd()!==``)if(n[1]===` `)s.push(1);else{let e=0;for(;n[1+e]===` `;)e++;s.push(e)}}s.length>0&&(e.data.sourceMarkerSpacings=s);break}case`list`:{let n=e.children?.[0];if(n?.position?.start?.offset!=null){let r=n.position.start.offset;if(r>=0&&r<t.length){let n=t[r];if(!e.ordered&&(n===`-`||n===`*`||n===`+`))e.data.bulletMarker=n;else if(e.ordered){let n=t.slice(r,Math.min(r+10,t.length)).match(/^\d+([.)])/);n&&(e.data.listMarkerDelimiter=n[1])}}}break}case`listItem`:{let n=t.slice(a,o),r=/^(?:([-+*])|(\d{1,9})[.)])( *)/.exec(n);if(!r)break;let s=r[1]?1:(r[2]?.length??0)+1,c=r[3].length;c>=2&&c<=4&&(e.data.sourceMarkerSpacing=c),r[2]&&(e.data.sourceOrdinal=Number.parseInt(r[2],10)),e.checked!=null&&/^\[([xX])\] /.exec(n.slice(s+Math.max(c,1)))?.[1]===`X`&&(e.data.sourceCheckboxChar=`X`);let l=s+(c>=2&&c<=4?c:1),u=a;for(;u>0&&t[u-1]!==`
@@ -415,15 +415,15 @@ $2`).split(`
415
415
  `),r=(e.value??``).split(`
416
416
  `);if(n.length===r.length){let t=[],i=!1,a=!0;for(let e=0;e<n.length;e++){let o=n[e],s=r[e];if(!o.endsWith(s)){a=!1;break}let c=o.slice(0,o.length-s.length);if(!/^[ \t]*$/.test(c)){a=!1;break}t.push(c),c!==(s.length>0?` `:``)&&(i=!0)}a&&i&&(e.data.sourceIndents=t)}}break}case`inlineCode`:{let n=t[a];if(n==="`"||n===`~`){e.data.sourceFenceChar=n;let r=0;for(;a+r<t.length&&t[a+r]===n;)r++;r>=1&&(e.data.sourceFenceLength=r);let i=t.slice(a+r,o-r),s=e.value??``;i!==s&&i===` ${s} `&&(e.data.sourcePadded=!0)}break}case`inlineMath`:if(t[a]===`$`){let n=0;for(;a+n<t.length&&t[a+n]===`$`;)n++;e.data.sourceDelimiter=`$`.repeat(n)}break;case`thematicBreak`:e.data.sourceRaw=t.slice(a,o);break;case`table`:{let n=t.slice(a,o),r=n.indexOf(`
417
417
  `);if(r===-1)break;let i=n.slice(r+1),s=i.indexOf(`
418
- `),c=s===-1?i:i.slice(0,s),l=c.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`),u=[];for(let e of l){let t=e.match(/-/g);u.push(t?t.length:0)}u.some(e=>e>0)&&(e.data.sourceDashCounts=u);{let t=c.trim(),n=PZ(t);n.length>0&&n[0]===``&&t.startsWith(`|`)&&n.shift(),n.length>0&&n[n.length-1]===``&&t.endsWith(`|`)&&n.pop();let r=n.every(e=>/^[-: ]+$/.test(e)),i=[];for(let e of n){let t=0;for(;t<e.length&&e[t]===` `;)t++;let n=0;for(;n<e.length-t&&e[e.length-1-n]===` `;)n++;i.push({left:t,right:n})}r&&i.length>0&&(e.data.sourceAlignmentPadding=i)}{let t=n.split(`
418
+ `),c=s===-1?i:i.slice(0,s),l=c.trim().replace(/^\|/,``).replace(/\|$/,``).split(`|`),u=[];for(let e of l){let t=e.match(/-/g);u.push(t?t.length:0)}u.some(e=>e>0)&&(e.data.sourceDashCounts=u);{let t=c.trim(),n=FZ(t);n.length>0&&n[0]===``&&t.startsWith(`|`)&&n.shift(),n.length>0&&n[n.length-1]===``&&t.endsWith(`|`)&&n.pop();let r=n.every(e=>/^[-: ]+$/.test(e)),i=[];for(let e of n){let t=0;for(;t<e.length&&e[t]===` `;)t++;let n=0;for(;n<e.length-t&&e[e.length-1-n]===` `;)n++;i.push({left:t,right:n})}r&&i.length>0&&(e.data.sourceAlignmentPadding=i)}{let t=n.split(`
419
419
  `).filter(e=>e.trim().length>0);if(t.length>=2){let n=t.map(e=>e.trimStart().startsWith(`|`)),r=t.map(e=>/(^|[^\\])\|$/.test(e.trimEnd())),i=n.every(e=>e===n[0]),a=r.every(e=>e===r[0]);if(i&&a){let t=n[0],i=r[0];(!t||!i)&&(e.data.sourceOuterPipes={leading:t,trailing:i})}}}for(let n of e.children??[]){if(n.type!==`tableRow`||!n.position)continue;let e=n.position.start.offset,r=n.position.end.offset;if(typeof e!=`number`||typeof r!=`number`)continue;let i=t.slice(e,r),a=i.indexOf(`
420
- `);a!==-1&&(i=i.slice(0,a));let o=PZ(i);o.length>0&&o[0]===``&&i.startsWith(`|`)&&o.shift(),o.length>0&&o[o.length-1]===``&&i.endsWith(`|`)&&o.pop();let s=n.children??[],c=Math.min(s.length,o.length);for(let e=0;e<c;e++){let t=s[e];if(t.type!==`tableCell`)continue;let n=o[e],r=0;for(;r<n.length&&n[r]===` `;)r++;let i=0;for(;i<n.length-r&&n[n.length-1-i]===` `;)i++;t.data||={},t.data.sourcePadding={left:r,right:i}}}break}case`link`:case`linkReference`:if(`children`in e&&e.children.length===0&&(e.data.sourceRaw=t.slice(a,o)),e.type===`link`){let n=t[a];if(n!==`[`&&n!==`<`&&!e.title)e.data.sourceStyle=`gfm-autolink`;else if(n===`[`){let n=t.slice(a,o),r=n.lastIndexOf(`](`);if(r!==-1){let t=r+2;for(;t<n.length&&(n[t]===` `||n[t]===` `);)t++;if(n[t]===`<`&&(e.data.sourceUrlForm=`angle-bracketed`),e.title!==void 0&&e.title!==null&&n[n.length-1]===`)`){let t=n.length-2;for(;t>r+1&&(n[t]===` `||n[t]===` `||n[t]===`
420
+ `);a!==-1&&(i=i.slice(0,a));let o=FZ(i);o.length>0&&o[0]===``&&i.startsWith(`|`)&&o.shift(),o.length>0&&o[o.length-1]===``&&i.endsWith(`|`)&&o.pop();let s=n.children??[],c=Math.min(s.length,o.length);for(let e=0;e<c;e++){let t=s[e];if(t.type!==`tableCell`)continue;let n=o[e],r=0;for(;r<n.length&&n[r]===` `;)r++;let i=0;for(;i<n.length-r&&n[n.length-1-i]===` `;)i++;t.data||={},t.data.sourcePadding={left:r,right:i}}}break}case`link`:case`linkReference`:if(`children`in e&&e.children.length===0&&(e.data.sourceRaw=t.slice(a,o)),e.type===`link`){let n=t[a];if(n!==`[`&&n!==`<`&&!e.title)e.data.sourceStyle=`gfm-autolink`;else if(n===`[`){let n=t.slice(a,o),r=n.lastIndexOf(`](`);if(r!==-1){let t=r+2;for(;t<n.length&&(n[t]===` `||n[t]===` `);)t++;if(n[t]===`<`&&(e.data.sourceUrlForm=`angle-bracketed`),e.title!==void 0&&e.title!==null&&n[n.length-1]===`)`){let t=n.length-2;for(;t>r+1&&(n[t]===` `||n[t]===` `||n[t]===`
421
421
  `);)t--;n[t]===`"`?e.data.sourceTitleMarker=`double`:n[t]===`'`?e.data.sourceTitleMarker=`single`:n[t]===`)`&&(e.data.sourceTitleMarker=`paren`)}}}}break;case`definition`:{let n=t.slice(a,o);if(e.data.sourceLayout=n.includes(`
422
- `)?`multiline`:`inline`,typeof e.title==`string`&&n.length>0){let t=n[n.length-1];t===`"`?e.data.sourceTitleMarker=`double`:t===`'`?e.data.sourceTitleMarker=`single`:t===`)`&&(e.data.sourceTitleMarker=`paren`)}break}case`mdxJsxFlowElement`:case`mdxJsxTextElement`:case`mdxFlowExpression`:case`mdxTextExpression`:e.data.sourceRaw=t.slice(a,o);break;case`break`:t.slice(a,o).includes(`\\`)?e.data.sourceStyle=`backslash`:e.data.sourceStyle=`spaces`;break}}function IZ(){return RegExp(`(^|\\s)#([a-zA-Z][\\w/-]*)`,`g`)}const LZ=IZ();function RZ(e,t){if(t<=0||e[t-1]!==`\\`)return!1;let n=t-1,r=0;for(;n>=0&&e[n]===`\\`;)r++,n--;return r%2==1}function zZ(e,t=``){let n=[],r=!1;for(let i of e.children){if(i.type!==`text`){n.push(i);continue}let e=i.value,a=typeof i.position?.start?.offset==`number`?i.position?.start?.offset??0:0;LZ.lastIndex=0;let o=[],s=0;for(;;){let n=LZ.exec(e);if(n===null)break;let c=n[1]??``,l=n[2]??``,u=n.index+c.length;if(t&&a>=0){let n=a,r=0,i=-1;for(;r<=u&&n<t.length;){let a=t[n]===`\\`&&n+1<t.length&&e[r]===t[n+1],o=a?n+1:n;if(r===u){i=o;break}n=a?n+2:n+1,r+=1}if(i>=0&&RZ(t,i))continue}if(u>s){let n={type:`text`,value:e.slice(s,u)},r=GX(t,i,s,u);r&&(n.position=r),o.push(n)}let d={type:`tag`,value:l},f=GX(t,i,u,u+1+l.length);f&&(d.position=f),o.push(d),s=u+1+l.length,r=!0}if(o.length===0)n.push(i);else{if(s<e.length){let n={type:`text`,value:e.slice(s)},r=GX(t,i,s,e.length);r&&(n.position=r),o.push(n)}n.push(...o)}}r&&(e.children=n)}const BZ=new Set(`root.paragraph.heading.text.emphasis.strong.blockquote.list.listItem.code.inlineCode.link.image.linkReference.imageReference.definition.html.thematicBreak.break.yaml.toml.table.tableRow.tableCell.delete.footnoteDefinition.footnoteReference.mdxFlowExpression.mdxJsxFlowElement.mdxJsxTextElement.mdxTextExpression.wikiLink.wikiLinkEmbed.tag.math.inlineMath.mark.comment.commentBlock.rawMdxFallbackMdast`.split(`.`));function VZ(e,t){if(!e||typeof e!=`object`)return null;if(typeof e.offset==`number`)return e.offset>=0&&e.offset<=t.length?e.offset:null;let{line:n,column:r}=e;if(typeof n!=`number`||typeof r!=`number`||n<1||r<1)return null;let i=0;for(let e=1;e<n;e++){let e=t.indexOf(`
422
+ `)?`multiline`:`inline`,typeof e.title==`string`&&n.length>0){let t=n[n.length-1];t===`"`?e.data.sourceTitleMarker=`double`:t===`'`?e.data.sourceTitleMarker=`single`:t===`)`&&(e.data.sourceTitleMarker=`paren`)}break}case`mdxJsxFlowElement`:case`mdxJsxTextElement`:case`mdxFlowExpression`:case`mdxTextExpression`:e.data.sourceRaw=t.slice(a,o);break;case`break`:t.slice(a,o).includes(`\\`)?e.data.sourceStyle=`backslash`:e.data.sourceStyle=`spaces`;break}}function LZ(){return RegExp(`(^|\\s)#([a-zA-Z][\\w/-]*)`,`g`)}const RZ=LZ();function zZ(e,t){if(t<=0||e[t-1]!==`\\`)return!1;let n=t-1,r=0;for(;n>=0&&e[n]===`\\`;)r++,n--;return r%2==1}function BZ(e,t=``){let n=[],r=!1;for(let i of e.children){if(i.type!==`text`){n.push(i);continue}let e=i.value,a=typeof i.position?.start?.offset==`number`?i.position?.start?.offset??0:0;RZ.lastIndex=0;let o=[],s=0;for(;;){let n=RZ.exec(e);if(n===null)break;let c=n[1]??``,l=n[2]??``,u=n.index+c.length;if(t&&a>=0){let n=a,r=0,i=-1;for(;r<=u&&n<t.length;){let a=t[n]===`\\`&&n+1<t.length&&e[r]===t[n+1],o=a?n+1:n;if(r===u){i=o;break}n=a?n+2:n+1,r+=1}if(i>=0&&zZ(t,i))continue}if(u>s){let n={type:`text`,value:e.slice(s,u)},r=KX(t,i,s,u);r&&(n.position=r),o.push(n)}let d={type:`tag`,value:l},f=KX(t,i,u,u+1+l.length);f&&(d.position=f),o.push(d),s=u+1+l.length,r=!0}if(o.length===0)n.push(i);else{if(s<e.length){let n={type:`text`,value:e.slice(s)},r=KX(t,i,s,e.length);r&&(n.position=r),o.push(n)}n.push(...o)}}r&&(e.children=n)}const VZ=new Set(`root.paragraph.heading.text.emphasis.strong.blockquote.list.listItem.code.inlineCode.link.image.linkReference.imageReference.definition.html.thematicBreak.break.yaml.toml.table.tableRow.tableCell.delete.footnoteDefinition.footnoteReference.mdxFlowExpression.mdxJsxFlowElement.mdxJsxTextElement.mdxTextExpression.wikiLink.wikiLinkEmbed.tag.math.inlineMath.mark.comment.commentBlock.rawMdxFallbackMdast`.split(`.`));function HZ(e,t){if(!e||typeof e!=`object`)return null;if(typeof e.offset==`number`)return e.offset>=0&&e.offset<=t.length?e.offset:null;let{line:n,column:r}=e;if(typeof n!=`number`||typeof r!=`number`||n<1||r<1)return null;let i=0;for(let e=1;e<n;e++){let e=t.indexOf(`
423
423
  `,i);if(e===-1)return null;i=e+1}let a=t.indexOf(`
424
- `,i),o=a===-1?t.length:a,s=i+r-1;return s<=o?s:null}function HZ(e,t){if(!e)return null;let n=VZ(e.start,t),r=VZ(e.end,t);return n===null||r===null||r<n?null:t.slice(n,r)}function UZ(e,t){let n=HZ(e.position,t);return{type:`rawMdxFallbackMdast`,originalType:e.type??`unknown`,value:n??``,unresolvedPosition:n===null,position:e.position}}function WZ(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``,r=typeof process<`u`&&process.env?.OK_DEBUG_POSITION_SLICE===`1`;jj(e,(e,t,i)=>{if(i!==void 0&&typeof t==`number`&&typeof e.type==`string`&&!BZ.has(e.type)){let r=UZ(e,n);return i.children[t]=r,Oj}if(`children`in e&&Array.isArray(e.children)){let t=e;t.children.some(e=>e.type===`text`)&&(MZ(t,n),zZ(t,n))}if(FZ(e,n,r,i),e.type===`heading`&&i!==void 0&&typeof t==`number`&&e.data?.sourceStyle===`setext`){let n=e.position?.end?.line,r=i.children[t+1],a=r?.position?.start?.line;if(r?.type===`paragraph`&&typeof n==`number`&&typeof a==`number`&&a===n+1){let t=e;t.data??={},t.data.sourceContiguousNext=!0}}})}}function GZ(e,t){let n={type:`mdxJsxFlowElement`,name:`MermaidFence`,attributes:[{type:`mdxJsxAttribute`,name:`chart`,value:e}],children:[]};return t&&(n.position=t),n}function KZ(){return e=>{jj(e,`code`,(e,t,n)=>{if(!n||t==null||e.lang!==`mermaid`)return;let r=GZ(typeof e.value==`string`?e.value:``,e.position);n.children[t]=r})}}function qZ(e,t){let n=e,r=t;return n.type===`heading`&&n.data?.sourceContiguousNext===!0&&r.type===`paragraph`}const JZ=(e,t)=>{if(qZ(e,t))return 0;let n=t.data?.sourcePrecedingBlankLines;if(typeof n==`number`&&n>=2)return n;let r=e.position,i=t.position;if(!r||!i)return;let a=i.start.line-r.end.line-1;return a>=1?a:void 0},YZ=qB(),XZ=dB(),ZZ=fB();function QZ(){let e=this.data();e.micromarkExtensions||=[],e.fromMarkdownExtensions||=[],e.toMarkdownExtensions||=[];let t=e.micromarkExtensions;t.some(e=>e===YZ)||t.push(YZ);let n=e.fromMarkdownExtensions;n.some(e=>e===XZ)||n.push(XZ);let r=e.toMarkdownExtensions;r.some(e=>e===ZZ)||r.push(ZZ)}const $Z=/(?<!\\)\$(?=\S)([^$\n]*?[^\s$])\$(?!\d)/g;function eQ(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;jj(e,`text`,(e,t,r)=>{if(r===void 0||t==null)return;let i=e.value;if(i.indexOf(`$`)===-1)return;$Z.lastIndex=0;let a=[],o;for(;(o=$Z.exec(i))!==null;)a.push(o);if(a.length===0)return;let s=[],c=0;for(let t of a){let r=t.index,a=r+t[0].length;if(r>c){let t={type:`text`,value:i.slice(c,r)},a=GX(n,e,c,r);a&&(t.position=a),s.push(t)}let o={type:`inlineMath`,value:t[1]},l=GX(n,e,r,a);l&&(o.position=l),s.push(o),c=a}if(c<i.length){let t={type:`text`,value:i.slice(c)},r=GX(n,e,c,i.length);r&&(t.position=r),s.push(t)}return r.children.splice(t,1,...s),[Oj,t+s.length]})}}const tQ={handlers:{tag:e=>`#${e.value}`},unsafe:[{character:`#`,inConstruct:[`phrasing`],before:`\\s`,after:`[a-zA-Z]`}]};function nQ(){let e=this.data();e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===tQ)||e.toMarkdownExtensions.push(tQ)}const rQ={name:`wikiLink`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===91?(e.enter(`wikiLink`),e.enter(`wikiLinkMarker`),e.consume(t),s):n(t)}function s(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),c):n(t)}function c(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkTarget`),d(t)):t===35?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),l):t===124?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),r++,c)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAnchor`),d(t)):t===124?i===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),i++,l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a===0?n(t):(e.exit(`wikiLinkAlias`),d(t)):(e.consume(t),a++,u)}function d(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),f):n(t)}function f(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLink`),t):n(r)}}},iQ={name:`wikiLinkEmbed`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===33?(e.enter(`wikiLinkEmbed`),e.enter(`wikiLinkEmbedBang`),e.consume(t),e.exit(`wikiLinkEmbedBang`),s):n(t)}function s(t){return t===91?(e.enter(`wikiLinkMarker`),e.consume(t),c):n(t)}function c(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),l):n(t)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkTarget`),f(t)):t===35?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),u):t===124?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),r++,l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAnchor`),f(t)):t===124?i===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),i++,u)}function d(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a===0?n(t):(e.exit(`wikiLinkAlias`),f(t)):(e.consume(t),a++,d)}function f(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),p):n(t)}function p(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLinkEmbed`),t):n(r)}}};function aQ(){return{text:{91:rQ,33:iQ}}}function oQ(e){this.enter({type:`wikiLink`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function sQ(e){this.enter({type:`wikiLinkEmbed`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function cQ(e){return e.stack[e.stack.length-1]}function lQ(e){let t=cQ(this),n=this.sliceSerialize(e);t.data.target=n.trim(),n!==t.data.target&&(t.data.sourceTarget=n)}function uQ(e){let t=cQ(this),n=this.sliceSerialize(e),r=n.trim();t.data.anchor=r.length?r:null,t.data.anchor!==null&&n!==r&&(t.data.sourceAnchor=n)}function dQ(e){let t=cQ(this),n=this.sliceSerialize(e),r=n.trim();t.data.alias=r.length?r:null,t.data.alias!==null&&n!==r&&(t.data.sourceAlias=n)}function fQ(e){let{target:t,anchor:n,alias:r}=e.data,i=r||(n?`${t}#${n}`:t);e.value=i,e.children=[{type:`text`,value:i}]}function pQ(e){fQ(cQ(this)),this.exit(e)}function mQ(e){fQ(cQ(this)),this.exit(e)}const hQ={enter:{wikiLink:oQ,wikiLinkEmbed:sQ},exit:{wikiLinkTarget:lQ,wikiLinkAnchor:uQ,wikiLinkAlias:dQ,wikiLink:pQ,wikiLinkEmbed:mQ}};function gQ(e,t){return typeof e==`string`&&e.trim()===t?e:t}const _Q={handlers:{wikiLink:e=>{let t=e,n=t.data?.target??``,r=t.data?.anchor,i=t.data?.alias,a=`[[${gQ(t.data?.sourceTarget,n)}`;return r&&(a+=`#${gQ(t.data?.sourceAnchor,r)}`),i&&(a+=`|${gQ(t.data?.sourceAlias,i)}`),`${a}]]`},wikiLinkEmbed:e=>{let t=e,n=t.data?.target??``,r=t.data?.anchor,i=t.data?.alias,a=`![[${n}`;return r&&(a+=`#${r}`),i&&(a+=`|${i}`),`${a}]]`}},unsafe:[{character:`[`,inConstruct:[`phrasing`]}]},vQ=aQ();function yQ(){let e=this.data();e.micromarkExtensions||=[],e.micromarkExtensions.some(e=>e===vQ)||e.micromarkExtensions.push(vQ),e.fromMarkdownExtensions||=[],e.fromMarkdownExtensions.some(e=>e===hQ)||e.fromMarkdownExtensions.push(hQ),e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===_Q)||e.toMarkdownExtensions.push(_Q)}function bQ(e){return e.children.some(e=>{let t=e.type;return t!==`yaml`&&t!==`toml`})?e:{...e,children:[...e.children,{type:`paragraph`,children:[]}]}}const xQ=[{name:`remark-parse`,plugin:Tz},{name:`remark-mdx-agnostic`,plugin:QZ},{name:`remark-gfm`,plugin:bL},{name:`remark-math`,plugin:BR,options:{singleDollarTextMath:!1}},{name:`remark-wiki-link`,plugin:yQ},{name:`remark-github-alerts`,plugin:OR,options:VX},{name:`callout-transformer`,plugin:BX},{name:`restore-from-mdx`,plugin:_X},{name:`restore-entity-refs`,plugin:TX},{name:`restore-backslash-escapes`,plugin:OX},{name:`details-accordion-promoter`,plugin:mZ},{name:`image-promoter`,plugin:SZ},{name:`indented-code-promoter`,plugin:OZ},{name:`math-promoter`,plugin:AZ},{name:`single-dollar-math-promoter`,plugin:eQ},{name:`highlight-promoter`,plugin:xZ},{name:`mermaid-promoter`,plugin:KZ},{name:`comment-promoter`,plugin:JX},{name:`merged-post-parse-walker`,plugin:WZ},{name:`ensure-non-empty-doc`,plugin:()=>bQ}];function SQ(e){let t=AL();for(let e of xQ)t=`options`in e&&e.options!==void 0?t.use(e.plugin,e.options):t.use(e.plugin);return t=t.use(eR,{schema:e.schema,handlers:e.handlers}),t.freeze(),t}function CQ(e){let t=AL().use(wR,[`yaml`]).use(bL,{tablePipeAlign:!1}).use(BR,{singleDollarTextMath:!1}).use(QZ).use(yQ).use(nQ).use(xL,{bullet:`-`,fences:!0,rule:`-`,join:[JZ],...e.toMarkdownHandlers?{handlers:e.toMarkdownHandlers}:{}});return t.freeze(),t}function wQ(e){return e.charCodeAt(0)===65279?{source:e.slice(1),hadBom:!0}:{source:e,hadBom:!1}}const TQ=/^\n+$/,EQ=/^\n{2,}$/;function DQ(e,t,n){let r,i,a,o=e.children;if(o.length>0){let e=o[0]?.position?.start?.offset;if(typeof e==`number`&&e>0){let n=t.slice(0,e);TQ.test(n)&&(r=n)}let n=o[o.length-1]?.position?.end?.offset;if(typeof n==`number`&&n<=t.length){let e=t.slice(n);EQ.test(e)&&(i=e)}let s=[],c=!1;for(let e=1;e<o.length;e++){let n=o[e-1]?.position?.end?.offset,r=o[e]?.position?.start?.offset,i=null;if(typeof n==`number`&&typeof r==`number`&&r>=n){let e=t.slice(n,r);RegExp(`^\\n{3,}$`).test(e)&&(i=e.length-1,c=!0)}s.push(i)}c&&(a=s)}if(!n&&r===void 0&&i===void 0&&!a)return;let s={...n?{bom:!0}:{},...r===void 0?{}:{leading:r},...i===void 0?{}:{trailing:i},...a?{gapBlankLines:a}:{}};return e.data??={},e.data.sourceDocBoundary=s,s}function OQ(e){if(typeof e!=`object`||!e)return;let t=e,n={};return t.bom===!0&&(n.bom=!0),typeof t.leading==`string`&&TQ.test(t.leading)&&(n.leading=t.leading),typeof t.trailing==`string`&&EQ.test(t.trailing)&&(n.trailing=t.trailing),Array.isArray(t.gapBlankLines)&&t.gapBlankLines.every(e=>e===null||typeof e==`number`&&Number.isInteger(e)&&e>=2)&&(n.gapBlankLines=t.gapBlankLines),n.bom||n.leading||n.trailing||n.gapBlankLines?n:void 0}function kQ(e,t){let{source:n,hadBom:r}=wQ(e),i=new nj(SX(hX(DX(n)))),a=t.parse(i);i.value=n;let o=t.runSync(a,i),s=DQ(o,n,r),c=t.stringify(o);return s?c.type.create({...c.attrs,sourceDocBoundary:s},c.content,c.marks):c}function AQ(e,t){let{source:n,hadBom:r}=wQ(e),i=new nj(SX(hX(DX(n)))),a=t.parse(i);i.value=n;let o=t.runSync(a,i);return DQ(o,n,r),o}function jQ(e,t,n){let r=nR(e,{schema:n.schema,nodeHandlers:n.pmNodeHandlers,markHandlers:n.pmMarkHandlers}),i=OQ(e.attrs?.sourceDocBoundary),a=i?.gapBlankLines;if(a&&a.length===r.children.length-1)for(let e=1;e<r.children.length;e++){let t=a[e-1];if(typeof t==`number`){let n=r.children[e];n.data??={},n.data.sourcePrecedingBlankLines=t}}let o=String(t.stringify(r));return i?.leading&&(o=i.leading+o),i?.trailing&&(o=o.replace(/\n+$/,``)+i.trailing),i?.bom&&(o=`\uFEFF${o}`),o}function MQ(){return typeof process>`u`||!process.env?!1:process.env.NODE_ENV===`development`||process.env.NODE_ENV===`test`}function NQ(e){let t=e.lastIndexOf(`/`);return t===-1?``:t===0?`/`:e.slice(0,t)}function PQ(e,t){let n=e?`${e}/${t}`:t,r=n.startsWith(`/`),i=[];for(let e of n.split(`/`))if(!(e===``||e===`.`)){if(e===`..`){let e=i[i.length-1];i.length>0&&e!==`..`?i.pop():r||i.push(`..`);continue}i.push(e)}let a=i.join(`/`);return r?`/${a}`:a}function FQ(e,t){if(typeof e!=`string`||e===``||!t||e.startsWith(`/`)||!iq(e))return e;let n=PQ(NQ(t),e);return n===``||n===`..`||n.startsWith(`../`)?(MQ()&&console.warn(`[resolve-image-url] doc-relative path escapes contentDir; emitting raw URL: ${e} (from sourcePath ${t})`),e):`/${n}`}const IQ=Object.assign(t$,{peek:()=>`$`}),LQ=Object.assign(n$,{peek:()=>`~`}),RQ=(()=>{for(let e of ZZ.extensions??[]){let t=e?.handlers?.mdxJsxFlowElement;if(typeof t==`function`)return t}throw Error(`mdast-util-mdx-jsx mdxJsxFlowElement to-markdown handler not found — the dirty MDX JSX serialize path cannot bind. Likely a breaking change in mdast-util-mdx-jsx (pinned in the root overrides); re-run the markdown-pipeline upgrade protocol (test:fidelity).`)})(),zQ={text(e,t,n,r){if(typeof e.data?.sourceRaw==`string`&&Mq(e.data.sourceRaw,e.value??``))return e.data.sourceRaw;if(e.data?.escapedChars?.length){let t=e.value??``,i=e.data.escapedChars,a=``,o=0;for(let{offset:e,char:s}of i)e>o&&(a+=qQ(n,t.slice(o,e),{...r,before:r.before+a,after:`\\`})),a+=`\\${s}`,o=e+1;return o<t.length&&(a+=qQ(n,t.slice(o),{...r,before:r.before+a})),a}return qQ(n,(e.value??``).replaceAll(`\xA0`,` `),r)},emphasis(e,t,n,r){let i=e.data?.sourceDelimiter??`*`,a=n.createTracker(r),o=n.enter(`emphasis`),s=a.move(i);return s+=QQ(n.containerPhrasing(e,{before:s,after:i,...a.current()}),r,i),s+=a.move(i),o(),s},strong(e,t,n,r){let i=e.data?.sourceDelimiter??`**`,a=n.createTracker(r),o=n.enter(`strong`),s=a.move(i);return s+=QQ(n.containerPhrasing(e,{before:s,after:i,...a.current()}),r,i),s+=a.move(i),o(),s},link(e,t,n,r){if(e.data?.sourceStyle===`autolink`)return`<${e.url??``}>`;if(e.data?.sourceStyle===`gfm-autolink`){let t=e.children?.length===1?e.children[0]:null;if(t?.type===`text`&&typeof t.value==`string`)return t.value}let i=n.createTracker(r),a=n.enter(`link`),o=n.enter(`label`),s=i.move(`[`);s+=i.move(n.containerPhrasing(e,{before:s,after:`](`,...i.current()})),s+=i.move(`](`),o();let c=n.enter(`destinationRaw`),l=String(e.url??``),u=e.data?.sourceUrlForm===`angle-bracketed`,d=l.startsWith(`<`)&&l.endsWith(`>`),f=u&&!d?`<${l}>`:WQ(l);if(s+=i.move(f),c(),e.title){let t=e.data?.sourceTitleMarker??`double`;s+=i.move(UQ(e.title,t))}return s+=i.move(`)`),a(),s},image(e,t,n,r){let i=n.createTracker(r),a=n.enter(`image`),o=n.enter(`label`),s=i.move(`![`);s+=i.move(n.safe(e.alt??``,{before:s,after:`](`,...i.current()})),s+=i.move(`](`),o();let c=n.enter(`destinationRaw`);if(s+=i.move(WQ(String(e.url??``))),c(),e.title){let t=n.enter(`titleQuote`);s+=i.move(` "`),s+=i.move(n.safe(e.title,{before:s,after:`"`,...i.current()})),s+=i.move(`"`),t()}return s+=i.move(`)`),a(),s},definition(e,t,n,r){let i=e.data?.sourceLayout??`inline`,a=e.data?.sourceTitleMarker??`double`,o=n.enter(`definition`),s=n.createTracker(r),c=n.enter(`label`),l=s.move(`[`);l+=s.move(n.safe(n.associationId(e),{before:l,after:`]`,...s.current()})),l+=s.move(`]:`),c();let u=i===`multiline`?`
425
- `:` `;l+=s.move(u);let d=String(e.url??``);if(!d||/[\0- ]/.test(d)){let e=n.enter(`destinationLiteral`);l+=s.move(`<`),l+=s.move(n.safe(d,{before:l,after:`>`,...s.current()})),l+=s.move(`>`),e()}else{let e=n.enter(`destinationRaw`);l+=s.move(WQ(d)),e()}if(e.title){let t=i===`multiline`?`
426
- `:` `;l+=s.move(UQ(e.title,a,t))}return o(),l},thematicBreak(e){return e.data?.sourceRaw??`---`},break(e){return e.data?.sourceStyle===`backslash`?`\\
424
+ `,i),o=a===-1?t.length:a,s=i+r-1;return s<=o?s:null}function UZ(e,t){if(!e)return null;let n=HZ(e.start,t),r=HZ(e.end,t);return n===null||r===null||r<n?null:t.slice(n,r)}function WZ(e,t){let n=UZ(e.position,t);return{type:`rawMdxFallbackMdast`,originalType:e.type??`unknown`,value:n??``,unresolvedPosition:n===null,position:e.position}}function GZ(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``,r=typeof process<`u`&&process.env?.OK_DEBUG_POSITION_SLICE===`1`;jj(e,(e,t,i)=>{if(i!==void 0&&typeof t==`number`&&typeof e.type==`string`&&!VZ.has(e.type)){let r=WZ(e,n);return i.children[t]=r,Oj}if(`children`in e&&Array.isArray(e.children)){let t=e;t.children.some(e=>e.type===`text`)&&(NZ(t,n),BZ(t,n))}if(IZ(e,n,r,i),e.type===`heading`&&i!==void 0&&typeof t==`number`&&e.data?.sourceStyle===`setext`){let n=e.position?.end?.line,r=i.children[t+1],a=r?.position?.start?.line;if(r?.type===`paragraph`&&typeof n==`number`&&typeof a==`number`&&a===n+1){let t=e;t.data??={},t.data.sourceContiguousNext=!0}}})}}function KZ(e,t){let n={type:`mdxJsxFlowElement`,name:`MermaidFence`,attributes:[{type:`mdxJsxAttribute`,name:`chart`,value:e}],children:[]};return t&&(n.position=t),n}function qZ(){return e=>{jj(e,`code`,(e,t,n)=>{if(!n||t==null||e.lang!==`mermaid`)return;let r=KZ(typeof e.value==`string`?e.value:``,e.position);n.children[t]=r})}}function JZ(e,t){let n=e,r=t;return n.type===`heading`&&n.data?.sourceContiguousNext===!0&&r.type===`paragraph`}const YZ=(e,t)=>{if(JZ(e,t))return 0;let n=t.data?.sourcePrecedingBlankLines;if(typeof n==`number`&&n>=2)return n;let r=e.position,i=t.position;if(!r||!i)return;let a=i.start.line-r.end.line-1;return a>=1?a:void 0},XZ=qB(),ZZ=dB(),QZ=fB();function $Z(){let e=this.data();e.micromarkExtensions||=[],e.fromMarkdownExtensions||=[],e.toMarkdownExtensions||=[];let t=e.micromarkExtensions;t.some(e=>e===XZ)||t.push(XZ);let n=e.fromMarkdownExtensions;n.some(e=>e===ZZ)||n.push(ZZ);let r=e.toMarkdownExtensions;r.some(e=>e===QZ)||r.push(QZ)}const eQ=/(?<!\\)\$(?=\S)([^$\n]*?[^\s$])\$(?!\d)/g;function tQ(){return(e,t)=>{let n=typeof t.value==`string`?t.value:``;jj(e,`text`,(e,t,r)=>{if(r===void 0||t==null)return;let i=e.value;if(i.indexOf(`$`)===-1)return;eQ.lastIndex=0;let a=[],o;for(;(o=eQ.exec(i))!==null;)a.push(o);if(a.length===0)return;let s=[],c=0;for(let t of a){let r=t.index,a=r+t[0].length;if(r>c){let t={type:`text`,value:i.slice(c,r)},a=KX(n,e,c,r);a&&(t.position=a),s.push(t)}let o={type:`inlineMath`,value:t[1]},l=KX(n,e,r,a);l&&(o.position=l),s.push(o),c=a}if(c<i.length){let t={type:`text`,value:i.slice(c)},r=KX(n,e,c,i.length);r&&(t.position=r),s.push(t)}return r.children.splice(t,1,...s),[Oj,t+s.length]})}}const nQ={handlers:{tag:e=>`#${e.value}`},unsafe:[{character:`#`,inConstruct:[`phrasing`],before:`\\s`,after:`[a-zA-Z]`}]};function rQ(){let e=this.data();e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===nQ)||e.toMarkdownExtensions.push(nQ)}const iQ={name:`wikiLink`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===91?(e.enter(`wikiLink`),e.enter(`wikiLinkMarker`),e.consume(t),s):n(t)}function s(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),c):n(t)}function c(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkTarget`),d(t)):t===35?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),l):t===124?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),r++,c)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAnchor`),d(t)):t===124?i===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),u):(e.consume(t),i++,l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a===0?n(t):(e.exit(`wikiLinkAlias`),d(t)):(e.consume(t),a++,u)}function d(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),f):n(t)}function f(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLink`),t):n(r)}}},aQ={name:`wikiLinkEmbed`,tokenize:(e,t,n)=>{let r=0,i=0,a=0;return o;function o(t){return t===33?(e.enter(`wikiLinkEmbed`),e.enter(`wikiLinkEmbedBang`),e.consume(t),e.exit(`wikiLinkEmbedBang`),s):n(t)}function s(t){return t===91?(e.enter(`wikiLinkMarker`),e.consume(t),c):n(t)}function c(t){return t===91?(e.consume(t),e.exit(`wikiLinkMarker`),e.enter(`wikiLinkTarget`),l):n(t)}function l(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?r===0?n(t):(e.exit(`wikiLinkTarget`),f(t)):t===35?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAnchor`),u):t===124?r===0?n(t):(e.exit(`wikiLinkTarget`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),r++,l)}function u(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?i===0?n(t):(e.exit(`wikiLinkAnchor`),f(t)):t===124?i===0?n(t):(e.exit(`wikiLinkAnchor`),e.enter(`wikiLinkSeparator`),e.consume(t),e.exit(`wikiLinkSeparator`),e.enter(`wikiLinkAlias`),d):(e.consume(t),i++,u)}function d(t){return t===null||t===-5||t===-4||t===-3||t===91?n(t):t===93?a===0?n(t):(e.exit(`wikiLinkAlias`),f(t)):(e.consume(t),a++,d)}function f(t){return t===93?(e.enter(`wikiLinkMarker`),e.consume(t),p):n(t)}function p(r){return r===93?(e.consume(r),e.exit(`wikiLinkMarker`),e.exit(`wikiLinkEmbed`),t):n(r)}}};function oQ(){return{text:{91:iQ,33:aQ}}}function sQ(e){this.enter({type:`wikiLink`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function cQ(e){this.enter({type:`wikiLinkEmbed`,value:``,data:{target:``,anchor:null,alias:null},children:[]},e)}function lQ(e){return e.stack[e.stack.length-1]}function uQ(e){let t=lQ(this),n=this.sliceSerialize(e);t.data.target=n.trim(),n!==t.data.target&&(t.data.sourceTarget=n)}function dQ(e){let t=lQ(this),n=this.sliceSerialize(e),r=n.trim();t.data.anchor=r.length?r:null,t.data.anchor!==null&&n!==r&&(t.data.sourceAnchor=n)}function fQ(e){let t=lQ(this),n=this.sliceSerialize(e),r=n.trim();t.data.alias=r.length?r:null,t.data.alias!==null&&n!==r&&(t.data.sourceAlias=n)}function pQ(e){let{target:t,anchor:n,alias:r}=e.data,i=r||(n?`${t}#${n}`:t);e.value=i,e.children=[{type:`text`,value:i}]}function mQ(e){pQ(lQ(this)),this.exit(e)}function hQ(e){pQ(lQ(this)),this.exit(e)}const gQ={enter:{wikiLink:sQ,wikiLinkEmbed:cQ},exit:{wikiLinkTarget:uQ,wikiLinkAnchor:dQ,wikiLinkAlias:fQ,wikiLink:mQ,wikiLinkEmbed:hQ}};function _Q(e,t){return typeof e==`string`&&e.trim()===t?e:t}const vQ={handlers:{wikiLink:e=>{let t=e,n=t.data?.target??``,r=t.data?.anchor,i=t.data?.alias,a=`[[${_Q(t.data?.sourceTarget,n)}`;return r&&(a+=`#${_Q(t.data?.sourceAnchor,r)}`),i&&(a+=`|${_Q(t.data?.sourceAlias,i)}`),`${a}]]`},wikiLinkEmbed:e=>{let t=e,n=t.data?.target??``,r=t.data?.anchor,i=t.data?.alias,a=`![[${n}`;return r&&(a+=`#${r}`),i&&(a+=`|${i}`),`${a}]]`}},unsafe:[{character:`[`,inConstruct:[`phrasing`]}]},yQ=oQ();function bQ(){let e=this.data();e.micromarkExtensions||=[],e.micromarkExtensions.some(e=>e===yQ)||e.micromarkExtensions.push(yQ),e.fromMarkdownExtensions||=[],e.fromMarkdownExtensions.some(e=>e===gQ)||e.fromMarkdownExtensions.push(gQ),e.toMarkdownExtensions||=[],e.toMarkdownExtensions.some(e=>e===vQ)||e.toMarkdownExtensions.push(vQ)}function xQ(e){return e.children.some(e=>{let t=e.type;return t!==`yaml`&&t!==`toml`})?e:{...e,children:[...e.children,{type:`paragraph`,children:[]}]}}const SQ=[{name:`remark-parse`,plugin:Tz},{name:`remark-mdx-agnostic`,plugin:$Z},{name:`remark-gfm`,plugin:bL},{name:`remark-math`,plugin:BR,options:{singleDollarTextMath:!1}},{name:`remark-wiki-link`,plugin:bQ},{name:`remark-github-alerts`,plugin:OR,options:HX},{name:`callout-transformer`,plugin:VX},{name:`restore-from-mdx`,plugin:vX},{name:`restore-entity-refs`,plugin:EX},{name:`restore-backslash-escapes`,plugin:kX},{name:`details-accordion-promoter`,plugin:hZ},{name:`image-promoter`,plugin:CZ},{name:`indented-code-promoter`,plugin:kZ},{name:`math-promoter`,plugin:jZ},{name:`single-dollar-math-promoter`,plugin:tQ},{name:`highlight-promoter`,plugin:SZ},{name:`mermaid-promoter`,plugin:qZ},{name:`comment-promoter`,plugin:YX},{name:`merged-post-parse-walker`,plugin:GZ},{name:`ensure-non-empty-doc`,plugin:()=>xQ}];function CQ(e){let t=AL();for(let e of SQ)t=`options`in e&&e.options!==void 0?t.use(e.plugin,e.options):t.use(e.plugin);return t=t.use(eR,{schema:e.schema,handlers:e.handlers}),t.freeze(),t}function wQ(e){let t=AL().use(wR,[`yaml`]).use(bL,{tablePipeAlign:!1}).use(BR,{singleDollarTextMath:!1}).use($Z).use(bQ).use(rQ).use(xL,{bullet:`-`,fences:!0,rule:`-`,join:[YZ],...e.toMarkdownHandlers?{handlers:e.toMarkdownHandlers}:{}});return t.freeze(),t}function TQ(e){return e.charCodeAt(0)===65279?{source:e.slice(1),hadBom:!0}:{source:e,hadBom:!1}}const EQ=/^\n+$/,DQ=/^\n{2,}$/;function OQ(e,t,n){let r,i,a,o=e.children;if(o.length>0){let e=o[0]?.position?.start?.offset;if(typeof e==`number`&&e>0){let n=t.slice(0,e);EQ.test(n)&&(r=n)}let n=o[o.length-1]?.position?.end?.offset;if(typeof n==`number`&&n<=t.length){let e=t.slice(n);DQ.test(e)&&(i=e)}let s=[],c=!1;for(let e=1;e<o.length;e++){let n=o[e-1]?.position?.end?.offset,r=o[e]?.position?.start?.offset,i=null;if(typeof n==`number`&&typeof r==`number`&&r>=n){let e=t.slice(n,r);RegExp(`^\\n{3,}$`).test(e)&&(i=e.length-1,c=!0)}s.push(i)}c&&(a=s)}if(!n&&r===void 0&&i===void 0&&!a)return;let s={...n?{bom:!0}:{},...r===void 0?{}:{leading:r},...i===void 0?{}:{trailing:i},...a?{gapBlankLines:a}:{}};return e.data??={},e.data.sourceDocBoundary=s,s}function kQ(e){if(typeof e!=`object`||!e)return;let t=e,n={};return t.bom===!0&&(n.bom=!0),typeof t.leading==`string`&&EQ.test(t.leading)&&(n.leading=t.leading),typeof t.trailing==`string`&&DQ.test(t.trailing)&&(n.trailing=t.trailing),Array.isArray(t.gapBlankLines)&&t.gapBlankLines.every(e=>e===null||typeof e==`number`&&Number.isInteger(e)&&e>=2)&&(n.gapBlankLines=t.gapBlankLines),n.bom||n.leading||n.trailing||n.gapBlankLines?n:void 0}function AQ(e,t){let{source:n,hadBom:r}=TQ(e),i=new nj(CX(gX(OX(n)))),a=t.parse(i);i.value=n;let o=t.runSync(a,i),s=OQ(o,n,r),c=t.stringify(o);return s?c.type.create({...c.attrs,sourceDocBoundary:s},c.content,c.marks):c}function jQ(e,t){let{source:n,hadBom:r}=TQ(e),i=new nj(CX(gX(OX(n)))),a=t.parse(i);i.value=n;let o=t.runSync(a,i);return OQ(o,n,r),o}function MQ(e,t,n){let r=nR(e,{schema:n.schema,nodeHandlers:n.pmNodeHandlers,markHandlers:n.pmMarkHandlers}),i=kQ(e.attrs?.sourceDocBoundary),a=i?.gapBlankLines;if(a&&a.length===r.children.length-1)for(let e=1;e<r.children.length;e++){let t=a[e-1];if(typeof t==`number`){let n=r.children[e];n.data??={},n.data.sourcePrecedingBlankLines=t}}let o=String(t.stringify(r));return i?.leading&&(o=i.leading+o),i?.trailing&&(o=o.replace(/\n+$/,``)+i.trailing),i?.bom&&(o=`\uFEFF${o}`),o}function NQ(){return typeof process>`u`||!process.env?!1:process.env.NODE_ENV===`development`||process.env.NODE_ENV===`test`}function PQ(e){let t=e.lastIndexOf(`/`);return t===-1?``:t===0?`/`:e.slice(0,t)}function FQ(e,t){let n=e?`${e}/${t}`:t,r=n.startsWith(`/`),i=[];for(let e of n.split(`/`))if(!(e===``||e===`.`)){if(e===`..`){let e=i[i.length-1];i.length>0&&e!==`..`?i.pop():r||i.push(`..`);continue}i.push(e)}let a=i.join(`/`);return r?`/${a}`:a}function IQ(e,t){if(typeof e!=`string`||e===``||!t||e.startsWith(`/`)||!aq(e))return e;let n=FQ(PQ(t),e);return n===``||n===`..`||n.startsWith(`../`)?(NQ()&&console.warn(`[resolve-image-url] doc-relative path escapes contentDir; emitting raw URL: ${e} (from sourcePath ${t})`),e):`/${n}`}const LQ=Object.assign(n$,{peek:()=>`$`}),RQ=Object.assign(r$,{peek:()=>`~`}),zQ=(()=>{for(let e of QZ.extensions??[]){let t=e?.handlers?.mdxJsxFlowElement;if(typeof t==`function`)return t}throw Error(`mdast-util-mdx-jsx mdxJsxFlowElement to-markdown handler not found — the dirty MDX JSX serialize path cannot bind. Likely a breaking change in mdast-util-mdx-jsx (pinned in the root overrides); re-run the markdown-pipeline upgrade protocol (test:fidelity).`)})(),BQ={text(e,t,n,r){if(typeof e.data?.sourceRaw==`string`&&Nq(e.data.sourceRaw,e.value??``))return e.data.sourceRaw;if(e.data?.escapedChars?.length){let t=e.value??``,i=e.data.escapedChars,a=``,o=0;for(let{offset:e,char:s}of i)e>o&&(a+=JQ(n,t.slice(o,e),{...r,before:r.before+a,after:`\\`})),a+=`\\${s}`,o=e+1;return o<t.length&&(a+=JQ(n,t.slice(o),{...r,before:r.before+a})),a}return JQ(n,(e.value??``).replaceAll(`\xA0`,` `),r)},emphasis(e,t,n,r){let i=e.data?.sourceDelimiter??`*`,a=n.createTracker(r),o=n.enter(`emphasis`),s=a.move(i);return s+=$Q(n.containerPhrasing(e,{before:s,after:i,...a.current()}),r,i),s+=a.move(i),o(),s},strong(e,t,n,r){let i=e.data?.sourceDelimiter??`**`,a=n.createTracker(r),o=n.enter(`strong`),s=a.move(i);return s+=$Q(n.containerPhrasing(e,{before:s,after:i,...a.current()}),r,i),s+=a.move(i),o(),s},link(e,t,n,r){if(e.data?.sourceStyle===`autolink`)return`<${e.url??``}>`;if(e.data?.sourceStyle===`gfm-autolink`){let t=e.children?.length===1?e.children[0]:null;if(t?.type===`text`&&typeof t.value==`string`)return t.value}let i=n.createTracker(r),a=n.enter(`link`),o=n.enter(`label`),s=i.move(`[`);s+=i.move(n.containerPhrasing(e,{before:s,after:`](`,...i.current()})),s+=i.move(`](`),o();let c=n.enter(`destinationRaw`),l=String(e.url??``),u=e.data?.sourceUrlForm===`angle-bracketed`,d=l.startsWith(`<`)&&l.endsWith(`>`),f=u&&!d?`<${l}>`:GQ(l);if(s+=i.move(f),c(),e.title){let t=e.data?.sourceTitleMarker??`double`;s+=i.move(WQ(e.title,t))}return s+=i.move(`)`),a(),s},image(e,t,n,r){let i=n.createTracker(r),a=n.enter(`image`),o=n.enter(`label`),s=i.move(`![`);s+=i.move(n.safe(e.alt??``,{before:s,after:`](`,...i.current()})),s+=i.move(`](`),o();let c=n.enter(`destinationRaw`);if(s+=i.move(GQ(String(e.url??``))),c(),e.title){let t=n.enter(`titleQuote`);s+=i.move(` "`),s+=i.move(n.safe(e.title,{before:s,after:`"`,...i.current()})),s+=i.move(`"`),t()}return s+=i.move(`)`),a(),s},definition(e,t,n,r){let i=e.data?.sourceLayout??`inline`,a=e.data?.sourceTitleMarker??`double`,o=n.enter(`definition`),s=n.createTracker(r),c=n.enter(`label`),l=s.move(`[`);l+=s.move(n.safe(n.associationId(e),{before:l,after:`]`,...s.current()})),l+=s.move(`]:`),c();let u=i===`multiline`?`
425
+ `:` `;l+=s.move(u);let d=String(e.url??``);if(!d||/[\0- ]/.test(d)){let e=n.enter(`destinationLiteral`);l+=s.move(`<`),l+=s.move(n.safe(d,{before:l,after:`>`,...s.current()})),l+=s.move(`>`),e()}else{let e=n.enter(`destinationRaw`);l+=s.move(GQ(d)),e()}if(e.title){let t=i===`multiline`?`
426
+ `:` `;l+=s.move(WQ(e.title,a,t))}return o(),l},thematicBreak(e){return e.data?.sourceRaw??`---`},break(e){return e.data?.sourceStyle===`backslash`?`\\
427
427
  `:`
428
428
  `},code(e){let t=e.value??``;if(e.data?.sourceStyle===`indented`){let n=t.split(`
429
429
  `),r=e.data.sourceIndents;return Array.isArray(r)&&r.length===n.length?n.map((e,t)=>`${r[t]??(e.length>0?` `:``)}${e}`).join(`
@@ -431,7 +431,7 @@ $2`).split(`
431
431
  `)}let n=e.data?.sourceFenceChar===`~`?`~`:"`",r=Math.max(3,e.data?.sourceFenceLength??3),i=RegExp(`^ {0,3}(\\${n}+)[ \\t]*$`);for(let e of t.split(`
432
432
  `)){let t=i.exec(e);t&&t[1].length>=r&&(r=t[1].length+1)}let a=e.data?.sourceClosingFenceLength,o=typeof a==`number`&&a>r?a:r,s=e.data?.sourceFenceIndent,c=typeof s==`number`&&s>=1&&s<=3?` `.repeat(s):``,l=e.data?.sourceInfoPadding,u=n.repeat(r),d=e.lang??``,f=`${u}${d&&typeof l==`number`&&l>=1?` `.repeat(l):``}${d}${e.meta?` ${e.meta}`:``}\n${t}\n${n.repeat(o)}`;return c?f.split(`
433
433
  `).map(e=>e.length>0?`${c}${e}`:e).join(`
434
- `):f},inlineCode(e,t,n){let r=e.value??``,i=e.data?.sourceFenceChar===`~`?`~`:"`",a=typeof e.data?.sourceFenceLength==`number`&&e.data.sourceFenceLength>0?e.data.sourceFenceLength:1,o=i==="`"?"`":`~`,s=a;for(;RegExp(`(^|[^${o}])${o.repeat(s)}([^${o}]|$)`).test(r);)s+=1;let c=i.repeat(s);/[^ \r\n]/.test(r)&&(e.data?.sourcePadded===!0||/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||r.startsWith(i)||r.endsWith(i))&&(r=` ${r} `);let l=`${c}${r}${c}`;return n.stack.includes(`tableCell`)?l.replace(/\|/g,`\\$&`):l},inlineMath:IQ,delete:LQ,heading(e,t,n,r){let i=e.data?.sourceStyle??`atx`,a=e.depth;if(i===`setext`&&(a===1||a===2)){let t=n.containerPhrasing(e,{...r,before:`
434
+ `):f},inlineCode(e,t,n){let r=e.value??``,i=e.data?.sourceFenceChar===`~`?`~`:"`",a=typeof e.data?.sourceFenceLength==`number`&&e.data.sourceFenceLength>0?e.data.sourceFenceLength:1,o=i==="`"?"`":`~`,s=a;for(;RegExp(`(^|[^${o}])${o.repeat(s)}([^${o}]|$)`).test(r);)s+=1;let c=i.repeat(s);/[^ \r\n]/.test(r)&&(e.data?.sourcePadded===!0||/^[ \r\n]/.test(r)&&/[ \r\n]$/.test(r)||r.startsWith(i)||r.endsWith(i))&&(r=` ${r} `);let l=`${c}${r}${c}`;return n.stack.includes(`tableCell`)?l.replace(/\|/g,`\\$&`):l},inlineMath:LQ,delete:RQ,heading(e,t,n,r){let i=e.data?.sourceStyle??`atx`,a=e.depth;if(i===`setext`&&(a===1||a===2)){let t=n.containerPhrasing(e,{...r,before:`
435
435
  `,after:`
436
436
  `}),i=e.data?.sourceUnderlineLength,o=typeof i==`number`&&i>=1?i:Math.max(t.length,3);return`${t}\n${(a===1?`=`:`-`).repeat(o)}`}let o=e.data?.sourceLeadingIndent,s=typeof o==`number`&&o>=1&&o<=3?` `.repeat(o):``,c=e.data?.sourceInteriorSpacing,l=typeof c==`number`&&c>=2?` `.repeat(c):` `,u=`#`.repeat(a),d=n.containerPhrasing(e,{...r,before:`${u} `,after:`
437
437
  `}),f=e.data?.sourceTrailingHashes;if(typeof f==`number`&&f>0){let e=`#`.repeat(f);return d?`${s}${u}${l}${d} ${e}`:`${s}${u} ${e}`}return d?`${s}${u}${l}${d}`:`${s}${u}`},list(e,t,n,r){let i=n.options.bullet||`-`,a=!!e.ordered,o=n.bulletCurrent,s=n.bulletLastUsed;if(!a){let t=e.data?.bulletMarker;(t===`-`||t===`*`||t===`+`)&&(n.bulletCurrent=t)}let c=e.children||[],l=[],u=a?e.data?.listMarkerDelimiter??`.`:null,d=e.start??1;for(let t=0;t<c.length;t++){let o=c[t],s=o.data?.sourceOrdinal,f=typeof s==`number`&&s>=0?s:d+t,p=a?`${f}${u}`:e.data?.bulletMarker??i,m=o.data?.sourceMarkerSpacing,h=typeof m==`number`&&m>=2&&m<=4?m:1,g=` `.repeat(h),_=p;o.checked===!0?_+=`${g}[${o.data?.sourceCheckboxChar===`X`?`X`:`x`}]`:o.checked===!1&&(_+=`${g}[ ]`);let v=o.data?.sourceContinuationIndent,y=p.length+h,b=typeof v==`number`&&v>=y&&v<=y+3?v:y,x=` `.repeat(b),S=o.checked===null||o.checked===void 0?g:` `,C=n.containerFlow(o,r).split(`
@@ -440,8 +440,8 @@ $2`).split(`
440
440
 
441
441
  `:`
442
442
  `;return l.join(f)},table(e,t,n,r){let i=n.enter(`table`),a=[],o=[],s=e.children??[];for(let e of s){let t=e.children??[],i=[],s=[];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);let c=e.data?.sourcePadding;s.push(c&&typeof c.left==`number`&&typeof c.right==`number`?{left:c.left,right:c.right}:null)}a.push(i),o.push(s)}i();let c=e.align??[],l=e.data?.sourceDashCounts,u=a[0]?.length??0,d=a.slice(1).reduce((e,t)=>Math.max(e,t.length),0),f=Math.max(u,d,c.length),p=[];for(let e=0;e<f;e++){let t=c[e],n=``,r=``;t===`center`?(n=`:`,r=`:`):t===`left`?n=`:`:t===`right`&&(r=`:`);let i=l?.[e],a=typeof i==`number`&&i>=1?i:1;p.push(n+`-`.repeat(a)+r)}let m=(e,t)=>{let n=[];for(let r=0;r<f;r++){let i=e[r]??``,a=t[r]??{left:1,right:1};n.push(` `.repeat(a.left)+i+` `.repeat(a.right))}let r=v&&!v.leading?``:`|`,i=v&&!v.trailing?``:`|`;return`${r}${n.join(`|`)}${i}`},h=e.data?.sourceAlignmentPadding,g=Array.from({length:f},(e,t)=>{let n=h?.[t];return n&&typeof n.left==`number`&&typeof n.right==`number`?n:null}),_=e.data?.sourceOuterPipes,v=_&&f>=2&&a.every(e=>{let t=(e[0]??``).trim(),n=(e[f-1]??``).trim();return(_.leading||t.length>0)&&(_.trailing||n.length>0&&!n.endsWith(`\\`))})?_:null;if(a.length===0)return m(p,g);let y=[];y.push(m(a[0],o[0]??[])),y.push(m(p,g));for(let e=1;e<a.length;e++)y.push(m(a[e],o[e]??[]));return y.join(`
443
- `)},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=BQ(i.attributes??[]);return!i.children||i.children.length===0?s?c?`<${s} ${c} />`:`<${s} />`:``:RQ({...i,attributes:(i.attributes??[]).map(HQ)},t,n,r)},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=BQ(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)=>{if(n)return`>`;let r=s?.[c++];return r===`none`||r===0?`>${e}`:typeof r==`number`&&r>=2&&!e.startsWith(` `)?`>${` `.repeat(r)}${e}`:`> ${e}`})}};function BQ(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`){n.value.includes(`"`)?t.push(`${e}={${VQ(n.value)}}`):t.push(`${e}="${n.value}"`);continue}t.push(`${e}={${n.value.value}}`)}return t.join(` `)}function VQ(e){return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function HQ(e){return e.type===`mdxJsxAttribute`&&typeof e.value==`string`&&e.value.includes(`"`)?{type:`mdxJsxAttribute`,name:e.name,value:{type:`mdxJsxAttributeValueExpression`,value:VQ(e.value)}}:e}function UQ(e,t,n=` `){return t===`single`?`${n}'${e.replace(/'/g,`\\'`)}'`:t===`paren`?`${n}(${e.replace(/[()]/g,`\\$&`)})`:`${n}"${e.replace(/"/g,`\\"`)}"`}function WQ(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 GQ(e){return e.replace(/(?<!\\)&(?=(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z][A-Za-z0-9]*);)/g,(e,t)=>KQ(t)?e:`\\${e}`)}function KQ(e){if(e.charCodeAt(0)!==35)return!1;let t=e[1]===`x`||e[1]===`X`?Number.parseInt(e.slice(2),16):Number.parseInt(e.slice(1),10);return t===9||t===10||t===11||t===12||t===13||t===32}function qQ(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==="`"||(e.character===`*`||e.character===`_`||e.character===`~`)&&e.inConstruct===`phrasing`||e.character===`=`&&e.atBreak===!0));let i;try{i=e.safe(t,n)}finally{e.unsafe=r}return GQ(ZQ(i,n))}function JQ(e){if(Number.isNaN(e))return`ws`;let t=lN(e);return t===1?`ws`:t===2?`punct`:`other`}function YQ(e,t,n){let r=JQ(t),i=JQ(n),a=i!==`ws`&&(i===`other`||r!==`other`),o=r!==`ws`&&(r===`other`||i!==`other`);return e===`_`?a&&(!o||r===`punct`)||o&&(!a||i===`punct`):a||o}function XQ(e,t,n){let r=t;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;if(r<e.length)return e[r]===`
444
- `||e[r]===`\r`;let i=n.after.charCodeAt(0);return Number.isNaN(i)||i===10||i===13}function ZQ(e,t){let n=``,r=0;for(;r<e.length;){let i=e.charAt(r);if(i===`\\`){n+=e.slice(r,r+2),r+=2;continue}if(i===`*`||i===`_`||i===`~`||i===`=`){let a=r+1;for(;a<e.length&&e.charAt(a)===i;)a++;let o=r===0?t.before.charCodeAt(t.before.length-1):e.charCodeAt(r-1);if(i===`=`)n+=(Number.isNaN(o)||o===10||o===13)&&XQ(e,a,t)?`\\${e.slice(r,a)}`:e.slice(r,a);else{let s=a<e.length?e.charCodeAt(a):t.after.charCodeAt(0);n+=YQ(i,o,s)?`\\${i}`.repeat(a-r):e.slice(r,a)}r=a;continue}n+=i,r+=1}return n}function QQ(e,t,n){let r=n.startsWith(`_`)?`_`:`*`,i=e,a=i.charCodeAt(0);$Q(t.before.charCodeAt(t.before.length-1),a,r)&&(i=e$(a)+i.slice(1));let o=i.charCodeAt(i.length-1);return $Q(t.after.charCodeAt(0),o,r)&&(i=i.slice(0,-1)+e$(o)),i}function $Q(e,t,n){return!(lN(t)!==1||n===`_`&&lN(e)===void 0)}function e$(e){return`&#x${e.toString(16).toUpperCase()};`}function t$(e,t,n,r){let i=e.value??``,a=e.data?.sourceDelimiter,o=typeof a==`string`&&/^\$+$/.test(a)?a.length:2;for(o===1&&!r$(i,r)&&(o=2);RegExp(`(^|[^$])${`\\$`.repeat(o)}([^$]|$)`).test(i);)o++;let s=`$`.repeat(o);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` ${i} `);let c=-1;for(;++c<n.unsafe.length;){let e=n.unsafe[c];if(!e.atBreak)continue;let t=n.compilePattern(e),r;for(;(r=t.exec(i))!==null;){let e=r.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=`${i.slice(0,e)} ${i.slice(r.index+1)}`}}return s+i+s}function n$(e,t,n,r){let i=e.data?.sourceDelimiter===`~`?`~`:`~~`,a=n.createTracker(r),o=n.enter(`strikethrough`),s=a.move(i);return s+=n.containerPhrasing(e,{...a.current(),before:s,after:`~`}),s+=a.move(i),o(),s}function r$(e,t){return!(e.length===0||!/^\S/.test(e)||!/\S$/.test(e)||/[$\r\n]/.test(e)||e.endsWith(`\\`)||/\\[!-/:-@[-`{-~]/.test(e)||/^\d/.test(t.after)||t.before.endsWith(`\\`))}function i$(e){if(!Number.isFinite(e)||e<0)return``;if(e<1024)return`${e} B`;let t=[`KiB`,`MiB`,`GiB`,`TiB`],n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(1).replace(/\.0$/,``)} ${t[r]}`}var a$=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};constructor(e){this.schema=Ly(e.extensions),this.handlers=h$(this.schema,this.parseCtx);let{nodeHandlers:t,markHandlers:n}=g$(this.schema);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=SQ({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=CQ({toMarkdownHandlers:zQ})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return kQ(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?AQ(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?RY(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 jQ(t,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}};const o$=EY();function s$(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 c$(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 l$(e){return e.attrs.sourceDirty||c$(e)}function u$(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 d$(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),t.sourcePadded===!0&&(n.sourcePadded=!0),Object.keys(n).length===0?e:{...e,data:n}}function f$(e,t){if(e.length===0)return d$({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return d$({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:[f$(n.children,t)]}}return d$({type:`inlineCode`,value:p$(e)},t)}function p$(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=p$(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}const m$=_K;function h$(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=ZL(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=ZL(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,f=a.data?.sourcePadding??null,p=d.createAndFill({align:u,sourcePadding:f},l);p&&c.push(p)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null,c=e.data?.sourceOuterPipes??null,l=e.data?.sourceAlignmentPadding??null;return n.table.createAndFill({sourceDashCounts:s,sourceOuterPipes:c,sourceAlignmentPadding:l},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=FQ(r,t.current.sourcePath);return n.image.createAndFill({src:i,alt:e.alt??null,title:e.title??null,sourceUrl:i===r?null:r})},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,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n.replaceAll(`\xA0`,` `));let s=[...(a??[]).map(e=>({kind:`escape`,offset:e.offset,length:1})),...(o??[]).map(e=>({kind:`entity`,offset:e.offset,length:e.length,raw:e.raw}))];s.sort((e,t)=>e.offset-t.offset);let c=[];for(let e of s){let t=c[c.length-1];e.kind===`entity`&&t?.kind===`entity`&&t.offset+t.length===e.offset&&Aq(t.raw)!==null&&Dq(e.raw)?c[c.length-1]={kind:`entity`,offset:t.offset,length:t.length+e.length,raw:t.raw+e.raw}:c.push(e)}let l=[],u=0;for(let t of c){if(t.offset>u){let r=n.slice(u,t.offset).replaceAll(`\xA0`,` `);r&&l.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length).replaceAll(`\xA0`,` `);if(i)if(t.kind===`escape`)l.push(e.text(i,[r.escapeMark.create()]));else if(r.sourceLiteral){let n=Aq(t.raw);l.push(e.text(n??i,[r.sourceLiteral.create({sourceRaw:t.raw})]))}else l.push(e.text(i));u=t.offset+t.length}}if(u<n.length){let t=n.slice(u).replaceAll(`\xA0`,` `);t&&l.push(e.text(t))}return l.length===1?l[0]:l}),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,sourcePadded:t.data?.sourcePadded===!0})]));let a=r.strike??r.delete;if(a&&(i.delete=QL(a,e=>({sourceDelimiter:e.data?.sourceDelimiter===`~`?`~`:`~~`}))),r.highlight&&(i.mark=QL(r.highlight)),r.comment&&(i.comment=QL(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=ZL(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=QL(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=QL(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=ZL(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null,sourceContiguousNext:e.data?.sourceContiguousNext??!1,sourceLeadingIndent:e.data?.sourceLeadingIndent??null,sourceInteriorSpacing:e.data?.sourceInteriorSpacing??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`,sourceClosingFenceLength:t.data?.sourceClosingFenceLength??null,sourceFenceIndent:t.data?.sourceFenceIndent??null,sourceInfoPadding:t.data?.sourceInfoPadding??null,sourceIndents:t.data?.sourceIndents??null},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=ZL(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=ZL(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread,sourceMarkerSpacing:e.data?.sourceMarkerSpacing??null,sourceOrdinal:e.data?.sourceOrdinal??null,sourceCheckboxChar:e.data?.sourceCheckboxChar??null,sourceContinuationIndent:e.data?.sourceContinuationIndent??null}))),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 r=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,i,a)=>{let o=e.name??``,s=o$.getOrWildcard(o),c=s$(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=FQ(e,t.current.sourcePath);n!==e&&(c.src=n,c.sourceUrl=e)}let l=a.all(e).flat();return n.jsxComponent.createAndFill({componentName:o,kind:`element`,attributes:e.attributes,sourceRaw:r(e.data)??``,sourceDirty:!1,props:c},l.length?l:void 0)};let a=(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=t=>{if(t.name===`InlineMath`&&n.mathInline){let e=a(t,`formula`)??``,r=a(t,`id`);return n.mathInline.create({formula:e,id:r??null})}if(t.name===`Tag`&&n.tag){let e=a(t,`value`)??``;return n.tag.create({value:e})}if(n.jsxInline){let i=r(t.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}return n.jsxComponent.createAndFill({sourceRaw:r(t.data)??``})},i.mdxFlowExpression=e=>{let t=r(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:t,sourceDirty:!1})},i.mdxTextExpression=t=>{let n=r(t.data)??`{${t.value??``}}`;return e.text(n)}}return n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null,sourceTarget:e.data?.sourceTarget??null,sourceAnchor:e.data?.sourceAnchor??null,sourceAlias:e.data?.sourceAlias??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=Gq(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&&m$.has(l)&&n.jsxComponent&&o$.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&&vK.has(l)&&n.jsxComponent&&o$.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&&bK.has(l)&&n.jsxComponent&&o$.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&&xK.has(l)&&n.jsxComponent&&o$.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&d?e(o,d)??null:null,i=r===null?null:i$(r);return n.jsxComponent.createAndFill({componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,target:o,anchor:c,alias:s,size:i}})}let h=s||(c?`${o}#${c}`:o);if(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])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")}),n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``,sourceDelimiter:e.data?.sourceDelimiter??null})),i.math||=t=>{let r=t.value==null?`«unknown:${t.type}»`:t.value;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},i.inlineMath||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),t.value==null?e.text(`«unknown:${t.type}»`):e.text(t.value)),n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteReference`,reason:`FootnoteReference extension missing — recovering [^id] source`})),e.text(`[^${t.label??t.identifier}]`)),n.footnoteDefinition?i.footnoteDefinition=ZL(n.footnoteDefinition,e=>{let t=e;return{identifier:t.identifier,label:t.label??t.identifier}}):i.footnoteDefinition||=t=>{console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteDefinition`,reason:`FootnoteDefinition extension missing — recovering [^id]: marker`}));let r=`[^${t.label??t.identifier}]: `;return n.paragraph?n.paragraph.create(null,e.text(r)):null},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}`,unresolvedPosition:t.unresolvedPosition??!1})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function g$(e){let t={},n={},r=e.nodes,i=e.marks;r.paragraph&&(t.paragraph=rR(`paragraph`)),r.blockquote&&(t.blockquote=rR(`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=rR(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0,sourceContiguousNext:e.attrs.sourceContiguousNext===!0?!0:void 0,sourceLeadingIndent:e.attrs.sourceLeadingIndent??void 0,sourceInteriorSpacing:e.attrs.sourceInteriorSpacing??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,sourceClosingFenceLength:e.attrs.sourceClosingFenceLength??void 0,sourceFenceIndent:e.attrs.sourceFenceIndent??void 0,sourceInfoPadding:e.attrs.sourceInfoPadding??void 0,sourceIndents:e.attrs.sourceIndents??void 0}}}),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=rR(`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&&u$(r[0])?r.slice(1):r,a={};return typeof e.attrs.sourceMarkerSpacing==`number`&&(a.sourceMarkerSpacing=e.attrs.sourceMarkerSpacing),typeof e.attrs.sourceOrdinal==`number`&&(a.sourceOrdinal=e.attrs.sourceOrdinal),e.attrs.sourceCheckboxChar===`X`&&(a.sourceCheckboxChar=`X`),typeof e.attrs.sourceContinuationIndent==`number`&&(a.sourceContinuationIndent=e.attrs.sourceContinuationIndent),{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,...Object.keys(a).length>0?{data:a}:{},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&&(c.sourceDashCounts=s);let l=e.attrs.sourceOuterPipes;typeof l==`object`&&l&&typeof l.leading==`boolean`&&typeof l.trailing==`boolean`&&(c.sourceOuterPipes=l);let u=e.attrs.sourceAlignmentPadding;Array.isArray(u)&&u.length>0&&(c.sourceAlignmentPadding=u);let d=Object.keys(c).length>0?c:void 0,f={type:`table`,align:i,children:o};return d&&(f.data=d),f}),r.tableRow&&(t.tableRow=rR(`tableRow`));let a=e=>{let t=e.attrs.sourcePadding,n={};return typeof t==`object`&&t&&typeof t.left==`number`&&typeof t.right==`number`&&(n.sourcePadding=t),Object.keys(n).length>0?{data:n}:{}};if(r.tableCell&&(t.tableCell=rR(`tableCell`,a)),r.tableHeader&&(t.tableHeader=rR(`tableCell`,a)),r.image&&(t.image=e=>({type:`image`,url:e.attrs.sourceUrl??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!l$(e)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:r,attributes:i,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:o$.getOrWildcard(r??`*`).serialize(e,{all:e=>n.all(e),registry:o$,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;if(typeof n==`string`&&n.length>0)return{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]};let r=e.attrs.sourceDelimiter;return{type:`inlineMath`,value:t,...typeof r==`string`&&r.length>0?{data:{sourceDelimiter:r}}:{}}}),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,sourceTarget:typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,sourceAnchor:typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,sourceAlias:typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null},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=iR(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.strong&&(n.strong=iR(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.code&&(n.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return f$(n,{sourceFenceChar:r,sourceFenceLength:i,sourcePadded:e.attrs.sourcePadded===!0?!0:void 0})}),i.strike??i.delete){let e=i.strike?`strike`:`delete`;n[e]=iR(`delete`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter===`~`?`~`:`~~`}}))}return i.highlight&&(n.highlight=iR(`mark`)),i.comment&&(n.comment=iR(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),r.commentBlock&&(t.commentBlock=rR(`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=rR(`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??``,r=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,i=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,a=i||(r?`${t}#${r}`:t),o=n.map(e=>`value`in e&&typeof e.value==`string`?e.value:``).join(``);return o!==a&&o.trim().length>0&&!o.includes(`]]`)&&(i=o,a=o),{type:`wikiLinkEmbed`,value:a,data:{target:t,anchor:r,alias:i},children:[{type:`text`,value:a}]}}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.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 Mq(t,e.value)&&(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 _$=/\p{M}+/gu,v$=/[^\p{L}\p{N}]+/gu,y$=/^-+|-+$/g;function b$(e){return e.trim().normalize(`NFKD`).replace(_$,``).toLowerCase().replace(v$,`-`).replace(y$,``)}function x$(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function S$(e,t){let n=b$(e);return n?x$(n,t):``}const C$=new Set([`img`,`video`,`audio`,`mark`]);new Map(wY.flatMap(e=>e.surface===`compat`&&C$.has(e.rendersAs)?[[e.name,e]]:[])),dF(`<>`);const w$=qB(),T$=dB(),E$=fB();function D$(){return wY.filter(e=>e.surface===`canonical`&&e.name!==`*`)}function O$(){return D$().filter(e=>k$(e)!==`fence`)}function k$(e){return e.name===`MermaidFence`?`fence`:e.hasChildren?`jsx-block`:`jsx-void`}function A$(e){return{id:e.name,displayName:e.displayName??e.name,description:e.description??``,kind:k$(e)}}function j$(e){if(e.hidden!==!0&&e.type!==`reactnode`){if(`defaultValue`in e&&e.defaultValue!==void 0)return e.defaultValue;if(e.type===`enum`)return e.enumValues[0];if(e.type===`string`)return``;if(e.type===`number`)return 0;if(e.type===`boolean`)return!1}}function M$(e,t){return!(e.omitOnDefault===!0&&`defaultValue`in e&&Object.is(e.defaultValue,t)||e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&t===``)}function N$(e){let t=[];for(let n of e.props){let e=j$(n);e!==void 0&&M$(n,e)&&t.push(LJ(n.name,e))}return t}function P$(e){return yz(e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`Body content here.`,{extensions:[w$],mdastExtensions:[T$]}).children}function F$(e){let t=k$(e),n;if(t===`fence`)n={type:`code`,lang:`mermaid`,meta:null,value:e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`graph LR
445
- A --> B`};else{let r=N$(e),i=t===`jsx-block`?P$(e):[];n={type:`mdxJsxFlowElement`,name:e.name,attributes:r,children:i}}return fP({type:`root`,children:[n]},{extensions:[E$]}).trimEnd()}function I$(e){let t=[];for(let n of e.props){if(n.hidden===!0)continue;let e={name:n.name,type:n.type,required:n.required};n.description!==void 0&&(e.description=n.description),n.advanced===!0&&(e.advanced=!0),n.omitOnDefault===!0&&(e.omitOnDefault=!0),n.type===`enum`&&(e.values=n.enumValues,n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue)),n.type===`string`&&(n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),n.language!==void 0&&(e.language=n.language),n.accept!==void 0&&(e.accept=n.accept)),n.type===`boolean`&&n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),n.type===`number`&&n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),t.push(e)}return t}function L$(e){return{...A$(e),example:F$(e),params:I$(e)}}function R$(){return[``,"**Custom canonical components.** OK `.md` / `.mdx` supports the JSX components below — use whichever is semantically useful in any part of the doc. For full source syntax + parameter schemas, call `palette({ components: [ids] })` with the ids you want to use. Fenced code blocks render naturally and don't need a fetch — including ` ```mermaid ` for diagrams (mermaid label text has sharp edges — `palette({ components: [\"Mermaid\"] })` lists them; parse failures come back as `warnings` entries on write/edit) and ` ```html preview ` for interactive HTML/JS/CSS pages (the fence info-string `preview` token renders the block as a live iframe; works for `html` / `htm` / `xml`; optional `h=` / `w=` tokens set size, e.g. ` ```html preview h=400px `). Use ` ```html preview ` whenever you want anything interactive or JS-powered (charts, demos, calculators, animations) — just author the standalone HTML page in the fence. Call `palette` for the markdown-native component forms (write `> [!NOTE]`, not `<Callout>`), copy-ready themed `html preview` starters, and the theme tokens (`var(--chart-1)`, `var(--foreground)`, …) an embed should reference so it tracks the reader's light/dark theme. Arbitrary `<TagName>` JSX falls through as raw MDX when no canonical fits.",``,...O$().map(A$).map(e=>`- \`${e.id}\` (${e.kind}) — ${e.description}`)].join(`
446
- `)}const z$=N({docName:tJ,summary:rJ,content:k().optional(),...nJ}).loose(),B$=N({docName:tJ,summary:rJ,markdown:k(),position:P([`append`,`prepend`,`replace`]).optional(),extension:P([`.md`,`.mdx`]).optional(),...nJ}).loose(),V$=N({docName:tJ,summary:rJ,find:k().min(1),replace:k(),offset:A().int().nonnegative().optional(),...nJ}).loose(),H$=N({docName:tJ,connectionId:k().min(1),scope:P([`last`,`session`,`file`]).optional(),...nJ}).loose(),U$=N({value:k(),truncatedFrom:A().int().nonnegative().optional(),hint:k().optional()}).loose(),W$=$s(`kind`,[N({kind:F(`inline`),content:k()}),N({kind:F(`truncated`),byteLength:A().int().nonnegative(),hint:k()})]),G$=N({kind:F(`content-divergence`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),divergenceType:k().optional(),currentState:W$.optional(),hint:k().optional()}).loose(),K$=N({type:F(`orphan`),parentCandidates:M(k()),message:k()}).loose(),q$=N({kind:F(`disk-edit-reconciled`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),mergeOutcome:k().optional(),hint:k().optional()}).loose(),J$=$s(`kind`,[G$,q$]),Y$=$s(`kind`,[G$,q$,N({kind:F(`mermaid-parse-error`),fenceIndex:A().int().positive(),fenceFirstLine:k(),message:k(),line:A().int().positive().optional()}).loose()]),X$=M(Y$).min(1),Z$=N({timestamp:k().min(1),summary:U$.optional(),warning:J$.optional(),warnings:X$.optional()}).loose(),Q$=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),hints:M(K$).optional(),summary:U$.optional(),warning:J$.optional(),warnings:X$.optional()}).loose(),$$=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),summary:U$.optional(),warning:J$.optional(),warnings:X$.optional()}).loose(),e1=N({docName:k().min(1),scope:P([`last`,`session`]),undone:j()}).loose(),t1=N({docName:tJ,patch:rc(k(),Zs([zW,Bs()])),types:rc(k(),P(IW)).optional(),summary:rJ,...nJ}).loose(),n1=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),appliedKeys:M(k()),summary:U$.optional(),warning:J$.optional(),warnings:X$.optional()}).loose(),r1=N({entries:M(N({level:P([`info`,`warn`,`error`]),message:k().max(8192),event:k().optional(),fields:rc(k(),Ws()).optional(),ts:A().optional(),sourceId:k().optional(),lineNumber:A().optional()}).loose()).max(100)}).loose(),i1=N({accepted:A().int().min(0)}).loose(),a1=N({status:k().min(1),reason:k()}).loose(),o1=N({docName:k().min(1),content:k(),lifecycle:a1.nullable()}).loose(),s1=N({documents:M(N({kind:P([`document`,`asset`,`folder`,`file`]).default(`document`),docName:k().min(1).optional(),docExt:k().min(1).default(`.md`),size:A().int().nonnegative(),modified:k().min(1),isSymlink:j().default(!1),canonicalDocName:k().nullable().default(null),targetPath:k().nullable().default(null),path:k().min(1).optional(),assetExt:k().min(1).optional(),mediaKind:P([`image`,`video`,`audio`,`pdf`,`text`]).nullable().optional(),referencedBy:M(k().min(1)).optional(),hasChildren:j().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`})),truncated:j().optional()}).loose(),c1=N({source:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),l1=N({docName:k().min(1),backlinks:M(c1)}).loose(),u1=N({counts:rc(k().min(1),A().int().nonnegative())}).loose(),d1=$s(`kind`,[N({kind:F(`doc`),docName:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),N({kind:F(`external`),url:k().min(1),title:k(),snippet:k().nullable()}).loose()]),f1=N({docName:k().min(1),forwardLinks:M(d1)}).loose(),p1=$s(`kind`,[N({id:k().min(1),kind:F(`doc`),docName:k().min(1),anchor:k().nullable(),label:k(),cluster:k().nullable(),category:k().nullable(),tags:M(k()).nullable()}).loose(),N({id:k().min(1),kind:F(`external`),url:k().min(1),label:k()}).loose()]),m1=N({source:k().min(1),target:k().min(1)}).loose(),h1=N({nodes:M(p1),links:M(m1)}).loose(),g1=N({ts:A().int().min(0),url:k(),method:k(),ua:k().optional(),origin:k().optional(),referer:k().optional(),host:k().optional(),remote:k().optional(),secChUa:k().optional(),secChUaMobile:k().optional(),secChUaPlatform:k().optional(),secFetchSite:k().optional(),secFetchDest:k().optional(),secFetchMode:k().optional(),secFetchUser:k().optional()}).loose(),_1=N({app:Zs([F(`cursor`),F(`codex`),F(`claude`),Bs()]),signals_fired:M(k())}).loose(),v1=N({entries:M(g1),count:A().int().min(0),detection:_1}).loose(),y1=N({writers:M(N({id:k().min(1),name:k().optional(),email:k().optional()}).loose()).optional(),summary:rJ,...nJ}).loose(),b1=N({checkpointRef:k().min(1)}).loose(),x1=N({v:A().int().optional(),id:k().min(1),name:k().min(1),colorSeed:k().optional(),docs:M(k()),summaries:M(k()).optional()}).loose(),S1=N({entries:M(N({sha:k().min(1),timestamp:k().min(1),author:k(),authorEmail:k(),type:P([`checkpoint`,`wip`,`upstream`,`park`]),message:k(),contributors:M(x1),checkpoint:Ws().nullable()}).loose()),total:A().int().nonnegative().optional(),truncated:j().optional(),hasMore:j().optional()}).loose(),C1=N({sha:k().regex(/^[0-9a-f]{40}$/i),content:k(),timestamp:k(),author:k()}).loose(),w1=N({contentDir:k().min(1),pathSeparator:P([`/`,`\\`]),symlinkResolved:j()}).loose(),T1=M($s(`source`,[N({docName:k().min(1),timestamp:k().min(1),size:A().int().nonnegative(),source:F(`flat`)}).loose(),N({docName:k().min(1),timestamp:k().min(1),source:F(`timeline`),sha:k().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."}),E1=N({orphans:M(N({docName:k().min(1),title:k()}).loose())}).loose(),D1=N({hubs:M(N({docName:k().min(1),title:k(),count:A().int().nonnegative()}).loose())}).loose(),O1=N({source:k().min(1),title:k(),snippet:k().nullable()}).loose(),k1=N({deadLinks:M(N({target:k().min(1),sources:M(O1)}).loose())}).loose(),A1=N({target:N({docName:k().min(1),title:k(),aliases:M(k())}).loose(),mentions:M(N({source:k().min(1),excerpt:k(),offset:A().int().nonnegative()}).loose()),truncated:j()}).loose(),j1=N({projectPath:k().min(1)}).loose(),M1=P([`not-a-git-worktree`,`init-failed`]),N1=$s(`ok`,[N({ok:F(!0),projectPath:k().min(1)}).loose(),N({ok:F(!1),reason:M1,message:k().min(1)}).loose()]),P1=N({host:k().min(1).optional()}).loose(),F1=N({key:k().min(1)}).loose(),I1=N({keyPresent:j()}).loose(),L1=N({name:k().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:k().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),R1=N({authenticated:j()}).loose(),z1=N({}).loose(),B1=N({stackIndex:A().int().min(0),ts:A().int().min(0),additions:A().int().min(0),deletions:A().int().min(0)}).loose(),V1=N({docName:k().min(1),additionsTotal:A().int().min(0),deletionsTotal:A().int().min(0),lastTs:A().int().min(0),bursts:M(B1)}).loose(),H1=N({displayName:k().min(1),color:k().min(1),icon:k().optional(),connectionId:k().min(1)}).loose(),U1=N({sessionAlive:j(),agent:H1.nullable(),files:M(V1)}).loose(),W1=N({diff:k(),generatedAt:A().int().min(0)}).loose(),G1=N({}).loose(),K1=N({}).loose(),q1=N({}).loose(),J1=N({}).loose(),Y1=N({}).loose(),X1=N({}).loose(),Z1=N({displayName:k().min(1),icon:k(),color:k().min(1),currentDoc:k().nullable(),mode:P([`idle`,`writing`]),ts:A().int().min(0)}).loose(),Q1=N({presence:rc(k().min(1),Z1)}).loose(),$1=rc(k().min(1),j()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`});N({path:k().min(1,`path must be non-empty`)}).loose();const e0=N({}).loose(),t0=N({fromDocName:k().min(1),toDocName:k().min(1)}).loose(),n0=N({fromPath:k().min(1),toPath:k().min(1)}).loose(),r0=N({}).loose(),i0=N({path:k().min(1),...nJ,summary:rJ}).loose(),a0=N({docName:k().min(1)}).loose(),o0=N({path:k().min(1),...nJ,summary:rJ}).loose(),s0=N({path:k().min(1)}).loose(),c0=N({kind:P([`file`,`folder`]),path:k().min(1),...nJ,summary:rJ}).loose(),l0=N({kind:P([`file`,`folder`]),path:k().min(1),duplicatedDocNames:M(k().min(1))}).loose(),u0=N({pages:M(N({docName:k().min(1),title:k(),docExt:k().min(1),size:A().int().nonnegative(),modified:k().min(1),icon:k().min(1).max(2048).optional()}).loose())}).loose(),d0=N({level:A().int().min(1).max(6),text:k(),slug:k()}).loose(),f0=N({docName:k().min(1),headings:M(d0)}).loose(),p0=N({docName:k().min(1),rewrites:A().int().nonnegative()}).loose(),m0=N({kind:P([`file`,`folder`,`asset`]),fromPath:k().min(1),toPath:k().min(1),...nJ,summary:rJ}).loose(),h0=N({renamed:M(t0),renamedAssets:M(n0),rewrittenDocs:M(p0).optional(),summary:U$.optional()}).loose(),g0=N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...nJ}).loose(),_0=N({deletedDocNames:M(k().min(1))}).loose(),v0=N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...nJ,summary:rJ}).loose(),y0=N({deletedDocNames:M(k().min(1))}).loose(),b0=N({docName:k().min(1),commitSha:k().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:rJ,...nJ}).loose(),x0=N({restoredFrom:k().min(1),timestamp:k().min(1),summary:U$.optional(),warning:G$.optional(),warnings:X$.optional()}).loose(),S0=P([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),C0=N({label:k().min(1),webUrl:ys().nullable()}).loose(),w0=$s(`checkStatus`,[N({checkStatus:F(`allowed`)}).loose(),N({checkStatus:F(`denied`),deniedReason:P([`no-collaborator`,`private-no-access`,`repo-not-found`])}).loose(),N({checkStatus:F(`unknown`),unknownError:P([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`]).optional()}).loose()]),T0=P([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`semantic-protected-branch`]),E0=N({state:S0,lastSyncUtc:k().nullable(),lastFetchUtc:k().nullable(),lastPushedSha:k().nullable(),ahead:A().int().min(0),behind:A().int().min(0),consecutiveFailures:A().int().min(0),conflictCount:A().int().min(0),hasRemote:j(),syncEnabled:j(),identityUnresolved:j(),remote:C0.nullable().optional(),pushError:k().optional(),pushErrorCode:T0.optional(),pullError:k().optional(),pullErrorCode:T0.optional(),pausedReason:k().optional(),pushPermission:w0.optional()}).loose(),D0=N({op:P([`sync`,`push`,`pull`]).optional()}).loose(),O0=N({op:P([`sync`,`push`,`pull`])}).loose(),k0=N({conflicts:M(N({file:k().min(1),detectedAt:k().min(1),oursSha:k().optional(),theirsSha:k().optional(),baseSha:k().optional()}).loose())}).loose(),A0=N({file:k().min(1),strategy:P([`mine`,`theirs`,`content`,`delete`]),content:k().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0&&e.content!==``,{message:`content must be a non-empty string when strategy is 'content'`,path:[`content`]}),j0=N({}).loose(),M0=N({file:k().min(1),base:k(),ours:k(),theirs:k(),kind:P([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:k().nullable()}).loose(),N0=N({plan:kc(e=>e!==void 0,{message:`plan is required`})}).loose(),P0=N({plan:kc(e=>e!==void 0,{message:`plan is required`})}).loose(),F0=N({result:kc(e=>e!==void 0,{message:`result is required`})}).loose(),I0=N({path:k().min(1),summary:k().min(1)}).loose(),L0=N({files:A().int().nonnegative(),folders:A().int().nonnegative()}).loose(),R0=N({packs:M(N({id:k().min(1),name:k().min(1),description:k().min(1),defaultSubfolder:k().optional(),folders:M(I0),entryCounts:L0}).loose())}).loose(),z0=N({noOpen:j().optional(),out:k().min(1).optional()}).loose(),B0=N({reason:P([`unsupported-platform`,`spawn-error`]),message:k()}).loose(),V0=$s(`status`,[N({status:F(`installed`),outputPath:k(),size:A().int().nonnegative(),sha256:k(),skillVersion:k()}).loose(),N({status:F(`built`),outputPath:k(),size:A().int().nonnegative(),sha256:k(),skillVersion:k(),handoffError:B0.optional()}).loose(),N({status:F(`failed`),buildError:k()}).loose(),N({status:F(`skip-current`),skillVersion:k(),recordedAt:k().optional()}).loose()]),H0=N({tags:M(N({name:k().min(1),count:A().int().nonnegative(),isLeaf:j()}).loose())}).loose(),U0=N({docName:k().min(1),title:k(),matchingTags:M(k().min(1)),snippet:k().nullable()}).loose(),W0=N({name:k().min(1),docs:M(U0)}).loose(),G0=N({folder:Ws(),frontmatter_local:rc(k(),Ws()).nullable()}).loose(),K0=N({path:k(),frontmatter:rc(k(),Ws()).optional()}).loose(),q0=N({applied:Ws()}).loose(),J0=rc(k(),Ws()).meta({description:`Free-form frontmatter map embedded in template payloads.`}),Y0=N({template:N({name:k().min(1),folder:k(),scope:P([`local`,`inherited`]),path:k().min(1),frontmatter:J0,body:k()}).strict()}).strict(),X0=N({templates:M(N({name:k().min(1),title:k().optional(),description:k().optional(),path:k().min(1),source_folder:k()}).strict()),truncated:j()}).strict(),Z0=N({folder:k(),name:k(),body:k().optional(),frontmatter:J0.optional(),...nJ,summary:rJ}).strict(),Q0=N({path:k().min(1),created:j(),warnings:M(k())}).strict(),$0=N({existed:j(),path:k().min(1)}).strict(),e2=N({fromFolder:k(),fromName:k(),toFolder:k(),toName:k(),body:k().optional(),frontmatter:J0.optional(),...nJ,summary:rJ}).strict(),t2=N({from:k().min(1),to:k().min(1),committed:j()}).strict(),n2=N({query:k().optional(),intent:P([`autocomplete`,`full_text`,`omnibar`]).optional(),scopes:M(P([`page`,`folder`,`content`,`file`])).optional(),scope:k().optional(),limit:A().int().nonnegative().optional(),semantic:j().optional(),source:P([`omnibar`,`mcp`,`http`]).optional()}).loose(),r2=N({kind:P([`page`,`folder`,`content`,`file`]),path:k().min(1),title:k(),score:A(),signals:rc(k(),Ws()),snippet:k().optional()}).loose(),i2=N({capable:j(),applied:j(),coverage:N({embedded:A().int().nonnegative(),total:A().int().nonnegative()})}).loose(),a2=N({enabled:j(),keyPresent:j(),keySource:P([`file`,`env`]).nullable(),keyHint:k().nullable(),ready:j(),capable:j(),embedded:A().int().nonnegative(),total:A().int().nonnegative()}).loose(),o2=N({query:k(),intent:P([`autocomplete`,`full_text`,`omnibar`]),results:M(r2),elapsedMs:A().nonnegative(),semantic:i2.optional(),truncated:j().optional()}).loose(),s2=N({version:k().min(1),recordedAt:k().min(1)}).loose(),c2=N({currentVersion:k().min(1),targets:rc(k(),s2.nullable())}).loose(),l2=`server-info`,u2=`branch-switched`,d2=`disk-ack`,f2=`config-validation-rejected`,p2=`config-ignore-nested-error`,m2=P([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`]),h2=N({v:F(1),ch:F(l2),seq:A(),serverInstanceId:k().min(1),currentBranch:k().min(1).optional()}).loose(),g2=N({v:F(1),ch:F(u2),seq:A(),branch:k().min(1)}).loose(),_2=N({v:F(1),ch:m2,seq:A()}).loose(),v2=N({v:F(1),ch:F(d2),seq:A(),docName:k().min(1),sv:k().min(1)}).loose(),y2=N({v:F(1),ch:F(f2),seq:A(),docName:k().min(1),error:ll}).loose(),b2=N({v:F(1),ch:F(p2),seq:A(),path:k().min(1),error:k().min(1)}).loose(),x2={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},S2=new WeakMap;function C2(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function w2(e){return e.trim().toLowerCase()}function T2(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function E2(e){let t=T2(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0,i=e.path.split(`/`).filter(Boolean),a=new Set(i),o=[...new Set((e.aliases??[]).flatMap(e=>e.split(`/`).filter(Boolean)).filter(e=>!a.has(e)))];return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:[...i,...o].join(` `),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}function D2(e){let t=LU({schema:x2});return e.length>0&&JU(t,e),t}function O2(e){let t={documents:e};return S2.set(t,D2(e)),t}function k2(e){let t=S2.get(e);if(t)return t;let n=D2(e.documents);return S2.set(e,n),n}function A2(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`,`file`]:[`page`,`folder`,`file`]}function j2(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function M2(e,t){let n=w2(t);if(!n)return 0;let r=w2(e.title),i=w2(e.name),a=w2(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 N2(e,t){let n=M2(e,t);return n<=0?n:$q(e.path)?n*.5:n}function P2(e){return e===`file`?-60:0}function F2(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 I2(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function L2(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 R2(e,t){return w2(t).length<4?0:e===`full_text`?1:0}function z2(e,t,n={}){let r=n.intent??`omnibar`,i=C2(n.limit),a=new Set(n.scopes??A2(r)),o=e.documents.filter(e=>j2(e,a)),s=w2(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=wW(k2(e),{term:s,properties:I2(r),boost:L2(r),tolerance:R2(r,s),limit:Math.max(i*4,40)}),l=new Map(c.hits.filter(e=>j2(e.document,a)).map(e=>[e.document.id,e.score])),u=F2(o),d=new Map;for(let e of o)N2(e,s)>=0&&d.set(e.id,e);for(let e of c.hits)j2(e.document,a)&&d.set(e.document.id,e.document);return n.semantic?V2({scopedDocuments:o,candidates:d,fullTextScores:l,recency:u,normalizedQuery:s,semantic:n.semantic,limit:i}):[...d.values()].map(e=>{let t=Math.max(0,N2(e,s)),n=l.get(e.id)??0,r=u.get(e.id)??0;return{document:e,score:t+n*20+r+P2(e.kind),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)}function B2(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function V2(e){let{scopedDocuments:t,candidates:n,fullTextScores:r,recency:i,normalizedQuery:a,semantic:o,limit:s}=e,c=o.rrfK??60,l=o.candidateLimit??64,u=o.similarityFloor??0,d=o.scores,f=new Map(t.map(e=>[e.id,e])),p=[...d.entries()].filter(([e,t])=>t>=u&&f.has(e)).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).slice(0,l);for(let[e]of p)if(!n.has(e)){let t=f.get(e);t&&n.set(e,t)}let m=[...n.values()].map(e=>{let t=Math.max(0,N2(e,a)),n=r.get(e.id)??0,o=i.get(e.id)??0,s=d.get(e.id),c=s!==void 0&&s>=u;return{document:e,score:t+n*20+o+P2(e.kind),signals:c?{lexical:t,fullText:n,recency:o,vector:s}:{lexical:t,fullText:n,recency:o},lexical:t,fullText:n,recency:o,cosine:s}}),h=B2(m.filter(e=>e.fullText>0).sort((e,t)=>t.fullText-e.fullText||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),g=B2(m.filter(e=>e.cosine!==void 0&&e.cosine>=u).sort((e,t)=>t.cosine-e.cosine||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),_=e=>{let t=0,n=h.get(e);n!==void 0&&(t+=1/(c+n));let r=g.get(e);return r!==void 0&&(t+=1/(c+r)),t};return m.sort((e,t)=>{let n=e.lexical>0?1:0,r=t.lexical>0?1:0;if(n!==r)return r-n;if(n===1)return e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score;let i=_(e.document.id),a=_(t.document.id);return i===a?e.recency===t.recency?e.document.path.localeCompare(t.document.path):t.recency-e.recency:a-i}).map(({document:e,score:t,signals:n})=>({document:e,score:t,signals:n})).slice(0,s)}function H2(e){let t=new TextEncoder().encode(e),n=new Uint8Array(1+t.length);return n[0]=1,n.set(t,1),U2(n)}function U2(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}const W2=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),G2=globalThis;G2[W2]===void 0&&(G2[W2]=Ii());const K2=G2[W2],q2=[`.ok`,`skill-state.yml`],J2=[`claude-cowork`,`cli-hosts`],Y2=[`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`],X2=/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,Z2=Ys({version:k().regex(X2,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(K2,{description:`Recorded skill version for this target.`}),recordedAt:Uo().register(K2,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:P(Y2).register(K2,{description:`Install-source surface that recorded this entry.`}).optional()}),Q2=Ys({schema:F(1).register(K2,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:Ys({"claude-cowork":Z2.optional(),"cli-hosts":Z2.optional()}).register(K2,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({})});function $2(){return{schema:1,targets:{}}}function e4(){let e=!1,t=``,n=0;return r=>{let i=t4(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 t4(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 n4=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],r4={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`};function i4(e,t=n4){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}const a4={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`};function o4(e){return e?a4[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}const s4={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`};function c4(e){let t=e?.trim();return t?s4[o4(t)]??t:`Agent`}function l4(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||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=l.startsWith(`/`),d=u?l.slice(1):l,f=u?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of d.split(`/`))if(e===`..`){if(f.length===0)return null;f.pop()}else e!==`.`&&e!==``&&f.push(e);return f.length===0?null:{docName:f.join(`/`),anchor:a||null}}const u4=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function d4(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function f4(e){let t=e.trim();return u4.test(t)||t.startsWith(`//`)}function p4(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}if(f4(n))return{kind:`external`,url:n};let r=l4(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};let i=d4(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function m4(e,t){let n=e.trim();if(!n)return null;if(f4(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=d4(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function h4(e,t){let n=e.trim();if(!n||u4.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 g4(e){let t=e;return t.startsWith(`./`)&&(t=t.slice(2)),t.startsWith(`/`)&&(t=t.slice(1)),t}function _4(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function v4(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function y4(e){return e.split(`/`).filter(e=>e!==``)}function b4(e,t){let n=v4(t);return e===``||n===e?!0:n.startsWith(`${e}/`)}function x4(e,t){let n=v4(t);if(e===n)return 0;let r=e===``?n:n.slice(e.length+1);return r===``?0:y4(r).length}function S4(e,t){let n=y4(e),r=y4(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return n.length-i+(r.length-i)}function C4(){let e=new Map;function t(t){let n=g4(t);if(n===``)return;let r=_4(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=g4(t),r=_4(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=v4(g4(n)),o=[],s=[];for(let e of i)b4(a,e)?o.push(e):s.push(e);return o.length>0?(e=>{let t=e[0],n=x4(a,t);for(let r=1;r<e.length;r++){let i=e[r],o=x4(a,i);(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(o):(e=>{let t=e[0],n=S4(a,v4(t));for(let r=1;r<e.length;r++){let i=e[r],o=S4(a,v4(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 w4(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 T4(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}function E4(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function D4(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}function O4(){try{let e=_(g(b(import.meta.url)),`..`,`package.json`),t=JSON.parse(d(e,`utf-8`));if(typeof t.version==`string`&&t.version.length>0)return t.version}catch{}return`0.0.0-unknown`}const k4=O4(),A4=1;var j4=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`Open Knowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function M4(e,t){return _(e,`${t}.lock`)}const N4=new Map;function P4(e){N4.set(e,(N4.get(e)??0)+1)}function F4(e){let t=N4.get(e);return t===void 0||t<=1?(N4.delete(e),!0):(N4.set(e,t-1),!1)}function I4(e,t){try{let n=JSON.parse(d(e,`utf-8`));return n&&typeof n==`object`&&D4(n.pid)?n:(console.warn(`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return console.warn(`${t} Corrupt lock file at ${e} — replacing`),null}}function L4(e){let{lockName:t,lockDir:n,metadata:r}=e,i=`[${t}-lock]`;l(n,{recursive:!0});let a=M4(n,t),o={pid:process.pid,hostname:y(),port:r.port,startedAt:new Date().toISOString(),worktreeRoot:r.worktreeRoot,...r.kind!==void 0&&{kind:r.kind},...r.parentPid!==void 0&&{parentPid:r.parentPid},...r.capabilities!==void 0&&{capabilities:r.capabilities},protocolVersion:r.protocolVersion??1,runtimeVersion:r.runtimeVersion??k4},d=JSON.stringify(o,null,2);for(let e=0;e<3;e++){if(!c(a))try{let e=u(a,`wx`,384);try{m(e,d)}finally{s(e)}return P4(a),R4({lockName:t,lockDir:n,lockPath:a})}catch(e){if(e.code!==`EEXIST`)throw e}let e=I4(a,i);if(e){let r=e.hostname===y();if(r&&e.pid===process.pid)return p(a,d,{encoding:`utf-8`,mode:384}),P4(a),R4({lockName:t,lockDir:n,lockPath:a});if(r&&E4(e.pid))throw new j4(e,a,t);console.warn(`${i} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{f(a)}catch{}}throw Error(`${i} Failed to acquire ${a} after 3 attempts (concurrent acquire contention).`)}function R4(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>H4({lockName:t,lockDir:n}),updatePort:e=>z4({lockName:t,lockDir:n,port:e})}}function z4(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,a=M4(n,t);if(!c(a)){console.warn(`${i} Lock file missing at ${a} during port update — skipping`);return}let o;try{let e=JSON.parse(d(a,`utf-8`));if(!e||typeof e!=`object`||!D4(e.pid)){console.warn(`${i} Corrupt lock at ${a} during port update — skipping`);return}o=e}catch{console.warn(`${i} Unreadable lock at ${a} during port update — skipping`);return}if(o.pid===process.pid&&!(typeof o.hostname==`string`&&o.hostname!==y())){o.port=r;try{p(a,JSON.stringify(o,null,2),{encoding:`utf-8`,mode:384})}catch(e){console.warn(`${i} Failed to update port in ${a}: ${e instanceof Error?e.message:String(e)}`)}}}function B4(e){let{lockName:t,lockDir:n}=e,r=M4(n,t);if(!c(r))return null;let i;try{let e=JSON.parse(d(r,`utf-8`));if(!e||typeof e!=`object`||!D4(e.pid))return null;i=e}catch{return null}if(i.hostname!==y())return null;if(!E4(i.pid)){try{f(r)}catch{}return null}return i}function V4(e){let{lockName:t,lockDir:n}=e,r=M4(n,t);if(!c(r))return{status:`absent`};let i;try{i=JSON.parse(d(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!i||typeof i!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:i};let a=i;if(!D4(a.pid)||typeof a.hostname!=`string`||typeof a.port!=`number`||typeof a.startedAt!=`string`||typeof a.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let o={pid:a.pid,hostname:a.hostname,port:a.port,startedAt:a.startedAt,worktreeRoot:a.worktreeRoot,protocolVersion:typeof a.protocolVersion==`number`?a.protocolVersion:void 0,runtimeVersion:typeof a.runtimeVersion==`string`?a.runtimeVersion:void 0};if(o.hostname!==y())return{status:`stale`,lock:o};if(!E4(o.pid)){try{f(r)}catch{}return{status:`stale`,lock:o}}return o.protocolVersion===void 0||o.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:i}:{status:`live`,lock:o}}function H4(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=M4(n,t);if(F4(i)&&c(i))try{let e=JSON.parse(d(i,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||typeof e.hostname==`string`&&e.hostname!==y())return;f(i)}catch(e){console.warn(`${r} Failed to release ${i}: ${e instanceof Error?e.message:String(e)}`)}}var U4=class extends j4{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function W4(e,t){try{return L4({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof j4&&e.lockName===`server`?new U4(e.existing,e.lockPath):e}}function G4(e,t){z4({lockName:`server`,lockDir:e,port:t})}function K4(e){return B4({lockName:`server`,lockDir:e})}function q4(e){H4({lockName:`server`,lockDir:e})}export{YG as $,F as $i,Y0 as $n,WW as $r,X1 as $t,Z$ as A,Tl as Ai,a2 as An,QW as Ar,n1 as At,_2 as B,$c as Bi,e0 as Bn,S$ as Br,VK as Bt,V$ as C,Tt as Ca,Cl as Ci,b1 as Cn,C4 as Cr,v1 as Ct,B$ as D,ft as Da,Vc as Di,F0 as Dn,E2 as Dr,q0 as Dt,e1 as E,pt as Ea,Uc as Ei,P0 as En,O2 as Er,K0 as Et,lG as F,Sl as Fi,dJ as Fn,w4 as Fr,EK as Ft,f2 as G,P as Gi,A0 as Gn,VW as Gr,R1 as Gt,h2 as H,qc as Hi,A1 as Hn,Uq as Hr,z1 as Ht,vG as I,pl as Ii,mJ as In,Zq as Ir,z0 as It,KG as J,M as Ji,D0 as Jn,_J as Jr,F1 as Jt,d2 as K,Bs as Ki,j0 as Kn,$q as Kr,NJ as Kt,g2 as L,ul as Li,gJ as Ln,sG as Lr,V0 as Lt,u1 as M,yl as Mi,aJ as Mn,VG as Mr,S1 as Mt,l1 as N,Jc as Ni,sJ as Nn,$2 as Nr,C1 as Nt,Q$ as O,Bc as Oi,R0 as On,FG as Or,f1 as Ot,xJ as P,tl as Pi,fJ as Pn,H2 as Pr,D1 as Pt,qG as Q,tc as Qi,$0 as Qn,qW as Qr,Q1 as Qt,b2 as R,_l as Ri,c2 as Rn,i$ as Rr,$1 as Rt,W1 as S,Lt as Sa,I as Si,y1 as Sn,i4 as Sr,SK as St,H$ as T,D as Ta,Hc as Ti,o2 as Tn,IZ as Tr,G0 as Tt,u2 as U,Fs as Ui,M0 as Un,o4 as Ur,P1 as Ut,v2 as V,Kc as Vi,PJ as Vn,MY as Vr,h1 as Vt,p2 as W,cc as Wi,k0 as Wn,yJ as Wr,L1 as Wt,ZG as X,kc as Xi,W0 as Xn,hG as Xr,N1 as Xt,UG as Y,j as Yi,O0 as Yn,HK as Yr,j1 as Yt,XG as Z,$s as Zi,H0 as Zn,NG as Zr,a$ as Zt,r4 as _,cn as _a,GW as _i,q2 as _n,oG as _r,s1 as _t,L4 as a,rc as aa,R$ as ai,HG as an,J1 as ar,o0 as at,Y$ as b,mn as ba,Ly as bi,cK as bn,m4 as br,l0 as bt,D4 as c,Ws as ca,z2 as ci,EJ as cn,G1 as cr,a0 as ct,V4 as d,Vo as da,qq as di,h0 as dn,rK as dr,fK as dt,Ys as ea,uK as ei,Y1 as en,e2 as er,JG as et,K4 as f,fa,dG as fi,T1 as fn,MJ as fr,sK as ft,G4 as g,vr as ga,b$ as gi,wK as gn,MW as gr,_0 as gt,z4 as h,ai as ha,cG as hi,TK as hn,NW as hr,g0 as ht,U4 as i,Mc as ia,fG as ii,dK as in,X0 as ir,i1 as it,DJ as j,wl as ji,TJ as jn,c4 as jr,zW as jt,z$ as k,zc as ki,N0 as kn,PG as kr,t1 as kt,M4 as l,ys as la,JW as li,AJ as ln,v0 as lr,DK as lt,q4 as m,Ga as ma,T4 as mi,x0 as mn,w1 as mr,k1 as mt,k4 as n,N as na,pG as ni,E1 as nn,Z0 as nr,wJ as nt,W4 as o,k as oa,h4 as oi,f0 as on,K1 as or,s0 as ot,H4 as p,Wa as pa,UW as pi,b0 as pn,jJ as pr,eK as pt,l2 as q,Hs as qi,E0 as qn,oK as qr,I1 as qt,A4 as r,lc as ra,tG as ri,lK as rn,Q0 as rr,r1 as rt,E4 as s,Zs as sa,l4 as si,u0 as sn,q1 as sr,i0 as st,j4 as t,A as ta,L$ as ti,aK as tn,t2 as tr,SJ as tt,B4 as u,Uo as ua,BG as ui,m0 as un,y0 as ur,iK as ut,tK as v,un as va,Qq as vi,J2 as vn,kJ as vr,o1 as vt,$$ as w,O as wa,Wc as wi,n2 as wn,e4 as wr,r0 as wt,U1 as x,on as xa,Df as xi,GG as xn,WG as xr,nK as xt,CK as y,fn as ya,ZW as yi,X2 as yn,p4 as yr,c0 as yt,y2 as z,nl as zi,Q2 as zn,O$ as zr,$G as zt};
447
- //# sourceMappingURL=server-lock-BpjJj3OD-CrZDl-wH.mjs.map
443
+ `)},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=VQ(i.attributes??[]);return!i.children||i.children.length===0?s?c?`<${s} ${c} />`:`<${s} />`:``:zQ({...i,attributes:(i.attributes??[]).map(UQ)},t,n,r)},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=VQ(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)=>{if(n)return`>`;let r=s?.[c++];return r===`none`||r===0?`>${e}`:typeof r==`number`&&r>=2&&!e.startsWith(` `)?`>${` `.repeat(r)}${e}`:`> ${e}`})}};function VQ(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`){n.value.includes(`"`)?t.push(`${e}={${HQ(n.value)}}`):t.push(`${e}="${n.value}"`);continue}t.push(`${e}={${n.value.value}}`)}return t.join(` `)}function HQ(e){return`"${e.replace(/\\/g,`\\\\`).replace(/"/g,`\\"`)}"`}function UQ(e){return e.type===`mdxJsxAttribute`&&typeof e.value==`string`&&e.value.includes(`"`)?{type:`mdxJsxAttribute`,name:e.name,value:{type:`mdxJsxAttributeValueExpression`,value:HQ(e.value)}}:e}function WQ(e,t,n=` `){return t===`single`?`${n}'${e.replace(/'/g,`\\'`)}'`:t===`paren`?`${n}(${e.replace(/[()]/g,`\\$&`)})`:`${n}"${e.replace(/"/g,`\\"`)}"`}function GQ(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 KQ(e){return e.replace(/(?<!\\)&(?=(#[0-9]+|#[xX][0-9A-Fa-f]+|[A-Za-z][A-Za-z0-9]*);)/g,(e,t)=>qQ(t)?e:`\\${e}`)}function qQ(e){if(e.charCodeAt(0)!==35)return!1;let t=e[1]===`x`||e[1]===`X`?Number.parseInt(e.slice(2),16):Number.parseInt(e.slice(1),10);return t===9||t===10||t===11||t===12||t===13||t===32}function JQ(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==="`"||(e.character===`*`||e.character===`_`||e.character===`~`)&&e.inConstruct===`phrasing`||e.character===`=`&&e.atBreak===!0));let i;try{i=e.safe(t,n)}finally{e.unsafe=r}return KQ(QQ(i,n))}function YQ(e){if(Number.isNaN(e))return`ws`;let t=lN(e);return t===1?`ws`:t===2?`punct`:`other`}function XQ(e,t,n){let r=YQ(t),i=YQ(n),a=i!==`ws`&&(i===`other`||r!==`other`),o=r!==`ws`&&(r===`other`||i!==`other`);return e===`_`?a&&(!o||r===`punct`)||o&&(!a||i===`punct`):a||o}function ZQ(e,t,n){let r=t;for(;r<e.length&&(e[r]===` `||e[r]===` `);)r++;if(r<e.length)return e[r]===`
444
+ `||e[r]===`\r`;let i=n.after.charCodeAt(0);return Number.isNaN(i)||i===10||i===13}function QQ(e,t){let n=``,r=0;for(;r<e.length;){let i=e.charAt(r);if(i===`\\`){n+=e.slice(r,r+2),r+=2;continue}if(i===`*`||i===`_`||i===`~`||i===`=`){let a=r+1;for(;a<e.length&&e.charAt(a)===i;)a++;let o=r===0?t.before.charCodeAt(t.before.length-1):e.charCodeAt(r-1);if(i===`=`)n+=(Number.isNaN(o)||o===10||o===13)&&ZQ(e,a,t)?`\\${e.slice(r,a)}`:e.slice(r,a);else{let s=a<e.length?e.charCodeAt(a):t.after.charCodeAt(0);n+=XQ(i,o,s)?`\\${i}`.repeat(a-r):e.slice(r,a)}r=a;continue}n+=i,r+=1}return n}function $Q(e,t,n){let r=n.startsWith(`_`)?`_`:`*`,i=e,a=i.charCodeAt(0);e$(t.before.charCodeAt(t.before.length-1),a,r)&&(i=t$(a)+i.slice(1));let o=i.charCodeAt(i.length-1);return e$(t.after.charCodeAt(0),o,r)&&(i=i.slice(0,-1)+t$(o)),i}function e$(e,t,n){return!(lN(t)!==1||n===`_`&&lN(e)===void 0)}function t$(e){return`&#x${e.toString(16).toUpperCase()};`}function n$(e,t,n,r){let i=e.value??``,a=e.data?.sourceDelimiter,o=typeof a==`string`&&/^\$+$/.test(a)?a.length:2;for(o===1&&!i$(i,r)&&(o=2);RegExp(`(^|[^$])${`\\$`.repeat(o)}([^$]|$)`).test(i);)o++;let s=`$`.repeat(o);/[^ \r\n]/.test(i)&&(/^[ \r\n]/.test(i)&&/[ \r\n]$/.test(i)||/^\$|\$$/.test(i))&&(i=` ${i} `);let c=-1;for(;++c<n.unsafe.length;){let e=n.unsafe[c];if(!e.atBreak)continue;let t=n.compilePattern(e),r;for(;(r=t.exec(i))!==null;){let e=r.index;i.codePointAt(e)===10&&i.codePointAt(e-1)===13&&e--,i=`${i.slice(0,e)} ${i.slice(r.index+1)}`}}return s+i+s}function r$(e,t,n,r){let i=e.data?.sourceDelimiter===`~`?`~`:`~~`,a=n.createTracker(r),o=n.enter(`strikethrough`),s=a.move(i);return s+=n.containerPhrasing(e,{...a.current(),before:s,after:`~`}),s+=a.move(i),o(),s}function i$(e,t){return!(e.length===0||!/^\S/.test(e)||!/\S$/.test(e)||/[$\r\n]/.test(e)||e.endsWith(`\\`)||/\\[!-/:-@[-`{-~]/.test(e)||/^\d/.test(t.after)||t.before.endsWith(`\\`))}function a$(e){if(!Number.isFinite(e)||e<0)return``;if(e<1024)return`${e} B`;let t=[`KiB`,`MiB`,`GiB`,`TiB`],n=e/1024,r=0;for(;n>=1024&&r<t.length-1;)n/=1024,r+=1;return`${n.toFixed(1).replace(/\.0$/,``)} ${t[r]}`}var o$=class{schema;handlers;pmNodeHandlers;pmMarkHandlers;parseProcessor;serializeProcessor;parseCtx={current:{}};constructor(e){this.schema=Ly(e.extensions),this.handlers=g$(this.schema,this.parseCtx);let{nodeHandlers:t,markHandlers:n}=_$(this.schema);this.pmNodeHandlers=t,this.pmMarkHandlers=n,this.parseProcessor=CQ({schema:this.schema,handlers:this.handlers,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers}),this.serializeProcessor=wQ({toMarkdownHandlers:BQ})}parse(e,t){if(!e.trim())return{type:`doc`,content:[{type:`paragraph`,content:[]}]};this.parseCtx.current=t??{};try{return AQ(e,this.parseProcessor).toJSON()}finally{this.parseCtx.current={}}}parseToMdast(e){return e.trim()?jQ(e,this.parseProcessor):{type:`root`,children:[]}}parseWithFallback(e,t){return e.trim()?zY(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 MQ(t,this.serializeProcessor,{schema:this.schema,pmNodeHandlers:this.pmNodeHandlers,pmMarkHandlers:this.pmMarkHandlers})}};const s$=DY();function c$(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 l$(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 u$(e){return e.attrs.sourceDirty||l$(e)}function d$(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 f$(e,t){if(!t)return e;let n={};return t.sourceFenceChar&&(n.sourceFenceChar=t.sourceFenceChar),typeof t.sourceFenceLength==`number`&&(n.sourceFenceLength=t.sourceFenceLength),t.sourcePadded===!0&&(n.sourcePadded=!0),Object.keys(n).length===0?e:{...e,data:n}}function p$(e,t){if(e.length===0)return f$({type:`inlineCode`,value:``},t);if(e.every(e=>e.type===`text`))return f$({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:[p$(n.children,t)]}}return f$({type:`inlineCode`,value:m$(e)},t)}function m$(e){let t=``;for(let n of e)n.type===`text`?t+=n.value:`children`in n&&Array.isArray(n.children)?t+=m$(n.children):`value`in n&&typeof n.value==`string`&&(t+=n.value);return t}const h$=vK;function g$(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=ZL(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=ZL(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,f=a.data?.sourcePadding??null,p=d.createAndFill({align:u,sourcePadding:f},l);p&&c.push(p)}let l=n.tableRow.createAndFill(null,c.length>0?c:null);l&&o.push(l)}let s=e.data?.sourceDashCounts??null,c=e.data?.sourceOuterPipes??null,l=e.data?.sourceAlignmentPadding??null;return n.table.createAndFill({sourceDashCounts:s,sourceOuterPipes:c,sourceAlignmentPadding:l},o.length>0?o:null)}),n.image&&(i.image=e=>{let r=e.url??``,i=IQ(r,t.current.sourcePath);return n.image.createAndFill({src:i,alt:e.alt??null,title:e.title??null,sourceUrl:i===r?null:r})},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,o=t.data?.entityRefSpans;if(!a?.length&&!o?.length)return e.text(n.replaceAll(`\xA0`,` `));let s=[...(a??[]).map(e=>({kind:`escape`,offset:e.offset,length:1})),...(o??[]).map(e=>({kind:`entity`,offset:e.offset,length:e.length,raw:e.raw}))];s.sort((e,t)=>e.offset-t.offset);let c=[];for(let e of s){let t=c[c.length-1];e.kind===`entity`&&t?.kind===`entity`&&t.offset+t.length===e.offset&&jq(t.raw)!==null&&Oq(e.raw)?c[c.length-1]={kind:`entity`,offset:t.offset,length:t.length+e.length,raw:t.raw+e.raw}:c.push(e)}let l=[],u=0;for(let t of c){if(t.offset>u){let r=n.slice(u,t.offset).replaceAll(`\xA0`,` `);r&&l.push(e.text(r))}if(t.offset<n.length){let i=n.slice(t.offset,t.offset+t.length).replaceAll(`\xA0`,` `);if(i)if(t.kind===`escape`)l.push(e.text(i,[r.escapeMark.create()]));else if(r.sourceLiteral){let n=jq(t.raw);l.push(e.text(n??i,[r.sourceLiteral.create({sourceRaw:t.raw})]))}else l.push(e.text(i));u=t.offset+t.length}}if(u<n.length){let t=n.slice(u).replaceAll(`\xA0`,` `);t&&l.push(e.text(t))}return l.length===1?l[0]:l}),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,sourcePadded:t.data?.sourcePadded===!0})]));let a=r.strike??r.delete;if(a&&(i.delete=QL(a,e=>({sourceDelimiter:e.data?.sourceDelimiter===`~`?`~`:`~~`}))),r.highlight&&(i.mark=QL(r.highlight)),r.comment&&(i.comment=QL(r.comment,e=>({sourceForm:e.data?.sourceForm??`percent`}))),n.commentBlock&&(i.commentBlock=ZL(n.commentBlock,e=>({sourceForm:e.data?.sourceForm??`percent`,sourceLayout:e.data?.sourceLayout??`block`}))),r.emphasis&&(i.emphasis=QL(r.emphasis,e=>({sourceDelimiter:e.data?.sourceDelimiter??`*`}))),r.strong&&(i.strong=QL(r.strong,e=>({sourceDelimiter:e.data?.sourceDelimiter??`**`}))),n.heading&&(i.heading=ZL(n.heading,e=>({level:e.depth,headingStyle:e.data?.sourceStyle??`atx`,sourceTrailingHashes:e.data?.sourceTrailingHashes??null,sourceUnderlineLength:e.data?.sourceUnderlineLength??null,sourceContiguousNext:e.data?.sourceContiguousNext??!1,sourceLeadingIndent:e.data?.sourceLeadingIndent??null,sourceInteriorSpacing:e.data?.sourceInteriorSpacing??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`,sourceClosingFenceLength:t.data?.sourceClosingFenceLength??null,sourceFenceIndent:t.data?.sourceFenceIndent??null,sourceInfoPadding:t.data?.sourceInfoPadding??null,sourceIndents:t.data?.sourceIndents??null},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=ZL(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=ZL(n.listItem,e=>({checked:e.checked??null,spread:!!e.spread,sourceMarkerSpacing:e.data?.sourceMarkerSpacing??null,sourceOrdinal:e.data?.sourceOrdinal??null,sourceCheckboxChar:e.data?.sourceCheckboxChar??null,sourceContinuationIndent:e.data?.sourceContinuationIndent??null}))),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 r=e=>{if(e&&typeof e==`object`&&`sourceRaw`in e){let t=e.sourceRaw;if(typeof t==`string`)return t}};i.mdxJsxFlowElement=(e,i,a)=>{let o=e.name??``,s=s$.getOrWildcard(o),c=c$(e.attributes,s.props);if(o===`CommonMarkImage`&&typeof c.src==`string`){let e=c.src,n=IQ(e,t.current.sourcePath);n!==e&&(c.src=n,c.sourceUrl=e)}let l=a.all(e).flat();return n.jsxComponent.createAndFill({componentName:o,kind:`element`,attributes:e.attributes,sourceRaw:r(e.data)??``,sourceDirty:!1,props:c},l.length?l:void 0)};let a=(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=t=>{if(t.name===`InlineMath`&&n.mathInline){let e=a(t,`formula`)??``,r=a(t,`id`);return n.mathInline.create({formula:e,id:r??null})}if(t.name===`Tag`&&n.tag){let e=a(t,`value`)??``;return n.tag.create({value:e})}if(n.jsxInline){let i=r(t.data)??``;return n.jsxInline.createAndFill({},i?[e.text(i)]:null)}return n.jsxComponent.createAndFill({sourceRaw:r(t.data)??``})},i.mdxFlowExpression=e=>{let t=r(e.data)??`{${e.value??``}}`;return n.jsxComponent.createAndFill({kind:`expression`,sourceRaw:t,sourceDirty:!1})},i.mdxTextExpression=t=>{let n=r(t.data)??`{${t.value??``}}`;return e.text(n)}}return n.wikiLink&&(i.wikiLink=e=>n.wikiLink.createAndFill({target:e.data?.target??``,alias:e.data?.alias??null,anchor:e.data?.anchor??null,sourceTarget:e.data?.sourceTarget??null,sourceAnchor:e.data?.sourceAnchor??null,sourceAlias:e.data?.sourceAlias??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=Kq(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&&h$.has(l)&&n.jsxComponent&&s$.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&&yK.has(l)&&n.jsxComponent&&s$.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&&xK.has(l)&&n.jsxComponent&&s$.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&&SK.has(l)&&n.jsxComponent&&s$.has(`WikiEmbedFile`)){let{resolveSize:e}=t.current,r=e&&d?e(o,d)??null:null,i=r===null?null:a$(r);return n.jsxComponent.createAndFill({componentName:`WikiEmbedFile`,kind:`element`,attributes:[],sourceRaw:``,sourceDirty:!1,props:{src:p,target:o,anchor:c,alias:s,size:i}})}let h=s||(c?`${o}#${c}`:o);if(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])}throw Error("[wikiLinkEmbed handler] schema lacks `link` mark — cannot dispatch without violating the STOP rule against emitting PM wikiLinkEmbed server-side")}),n.mathInline&&(i.inlineMath=e=>n.mathInline.create({formula:e.value??``,sourceDelimiter:e.data?.sourceDelimiter??null})),i.math||=t=>{let r=t.value==null?`«unknown:${t.type}»`:t.value;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},i.inlineMath||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:t.type,reason:`Unhandled inline mdast: ${t.type}`})),t.value==null?e.text(`«unknown:${t.type}»`):e.text(t.value)),n.footnoteReference?i.footnoteReference=e=>n.footnoteReference.create({identifier:e.identifier,label:e.label??e.identifier}):i.footnoteReference||=t=>(console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteReference`,reason:`FootnoteReference extension missing — recovering [^id] source`})),e.text(`[^${t.label??t.identifier}]`)),n.footnoteDefinition?i.footnoteDefinition=ZL(n.footnoteDefinition,e=>{let t=e;return{identifier:t.identifier,label:t.label??t.identifier}}):i.footnoteDefinition||=t=>{console.warn(JSON.stringify({event:`unknown-mdast-type`,type:`footnoteDefinition`,reason:`FootnoteDefinition extension missing — recovering [^id]: marker`}));let r=`[^${t.label??t.identifier}]: `;return n.paragraph?n.paragraph.create(null,e.text(r)):null},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}`,unresolvedPosition:t.unresolvedPosition??!1})),n.rawMdxFallback.createAndFill({reason:`Unhandled mdast: ${t.originalType}`,originalSpan:r},t.value?[e.text(t.value)]:null)},i}function _$(e){let t={},n={},r=e.nodes,i=e.marks;r.paragraph&&(t.paragraph=rR(`paragraph`)),r.blockquote&&(t.blockquote=rR(`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=rR(`heading`,e=>({depth:e.attrs.level,data:{sourceStyle:e.attrs.headingStyle,sourceTrailingHashes:e.attrs.sourceTrailingHashes??void 0,sourceUnderlineLength:e.attrs.sourceUnderlineLength??void 0,sourceContiguousNext:e.attrs.sourceContiguousNext===!0?!0:void 0,sourceLeadingIndent:e.attrs.sourceLeadingIndent??void 0,sourceInteriorSpacing:e.attrs.sourceInteriorSpacing??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,sourceClosingFenceLength:e.attrs.sourceClosingFenceLength??void 0,sourceFenceIndent:e.attrs.sourceFenceIndent??void 0,sourceInfoPadding:e.attrs.sourceInfoPadding??void 0,sourceIndents:e.attrs.sourceIndents??void 0}}}),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=rR(`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&&d$(r[0])?r.slice(1):r,a={};return typeof e.attrs.sourceMarkerSpacing==`number`&&(a.sourceMarkerSpacing=e.attrs.sourceMarkerSpacing),typeof e.attrs.sourceOrdinal==`number`&&(a.sourceOrdinal=e.attrs.sourceOrdinal),e.attrs.sourceCheckboxChar===`X`&&(a.sourceCheckboxChar=`X`),typeof e.attrs.sourceContinuationIndent==`number`&&(a.sourceContinuationIndent=e.attrs.sourceContinuationIndent),{type:`listItem`,checked:e.attrs.checked??null,spread:e.attrs.spread??!1,...Object.keys(a).length>0?{data:a}:{},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&&(c.sourceDashCounts=s);let l=e.attrs.sourceOuterPipes;typeof l==`object`&&l&&typeof l.leading==`boolean`&&typeof l.trailing==`boolean`&&(c.sourceOuterPipes=l);let u=e.attrs.sourceAlignmentPadding;Array.isArray(u)&&u.length>0&&(c.sourceAlignmentPadding=u);let d=Object.keys(c).length>0?c:void 0,f={type:`table`,align:i,children:o};return d&&(f.data=d),f}),r.tableRow&&(t.tableRow=rR(`tableRow`));let a=e=>{let t=e.attrs.sourcePadding,n={};return typeof t==`object`&&t&&typeof t.left==`number`&&typeof t.right==`number`&&(n.sourcePadding=t),Object.keys(n).length>0?{data:n}:{}};if(r.tableCell&&(t.tableCell=rR(`tableCell`,a)),r.tableHeader&&(t.tableHeader=rR(`tableCell`,a)),r.image&&(t.image=e=>({type:`image`,url:e.attrs.sourceUrl??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!u$(e)&&e.attrs.sourceRaw?{type:`mdxJsxFlowElement`,name:r,attributes:i,children:[],data:{sourceRaw:String(e.attrs.sourceRaw)}}:s$.getOrWildcard(r??`*`).serialize(e,{all:e=>n.all(e),registry:s$,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;if(typeof n==`string`&&n.length>0)return{type:`mdxJsxTextElement`,name:`InlineMath`,attributes:[{type:`mdxJsxAttribute`,name:`formula`,value:t},{type:`mdxJsxAttribute`,name:`id`,value:n}],children:[]};let r=e.attrs.sourceDelimiter;return{type:`inlineMath`,value:t,...typeof r==`string`&&r.length>0?{data:{sourceDelimiter:r}}:{}}}),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,sourceTarget:typeof e.attrs.sourceTarget==`string`?e.attrs.sourceTarget:null,sourceAnchor:typeof e.attrs.sourceAnchor==`string`?e.attrs.sourceAnchor:null,sourceAlias:typeof e.attrs.sourceAlias==`string`?e.attrs.sourceAlias:null},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=iR(`emphasis`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.strong&&(n.strong=iR(`strong`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter}}))),i.code&&(n.code=(e,t,n)=>{let r=e.attrs.sourceFenceChar,i=e.attrs.sourceFenceLength;return p$(n,{sourceFenceChar:r,sourceFenceLength:i,sourcePadded:e.attrs.sourcePadded===!0?!0:void 0})}),i.strike??i.delete){let e=i.strike?`strike`:`delete`;n[e]=iR(`delete`,e=>({data:{sourceDelimiter:e.attrs.sourceDelimiter===`~`?`~`:`~~`}}))}return i.highlight&&(n.highlight=iR(`mark`)),i.comment&&(n.comment=iR(`comment`,e=>({data:{sourceForm:e.attrs.sourceForm===`html`?`html`:`percent`}}))),r.commentBlock&&(t.commentBlock=rR(`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=rR(`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??``,r=typeof e.attrs.anchor==`string`&&e.attrs.anchor.length>0?e.attrs.anchor:null,i=typeof e.attrs.alias==`string`&&e.attrs.alias.length>0?e.attrs.alias:null,a=i||(r?`${t}#${r}`:t),o=n.map(e=>`value`in e&&typeof e.value==`string`?e.value:``).join(``);return o!==a&&o.trim().length>0&&!o.includes(`]]`)&&(i=o,a=o),{type:`wikiLinkEmbed`,value:a,data:{target:t,anchor:r,alias:i},children:[{type:`text`,value:a}]}}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.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 Nq(t,e.value)&&(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 v$=/\p{M}+/gu,y$=/[^\p{L}\p{N}]+/gu,b$=/^-+|-+$/g;function x$(e){return e.trim().normalize(`NFKD`).replace(v$,``).toLowerCase().replace(y$,`-`).replace(b$,``)}function S$(e,t){let n=t.get(e)??0;return t.set(e,n+1),n===0?e:`${e}-${n}`}function C$(e,t){let n=x$(e);return n?S$(n,t):``}const w$=new Set([`img`,`video`,`audio`,`mark`]);new Map(TY.flatMap(e=>e.surface===`compat`&&w$.has(e.rendersAs)?[[e.name,e]]:[])),dF(`<>`);const T$=qB(),E$=dB(),D$=fB();function O$(){return TY.filter(e=>e.surface===`canonical`&&e.name!==`*`)}function k$(){return O$().filter(e=>A$(e)!==`fence`)}function A$(e){return e.name===`MermaidFence`?`fence`:e.hasChildren?`jsx-block`:`jsx-void`}function j$(e){return{id:e.name,displayName:e.displayName??e.name,description:e.description??``,kind:A$(e)}}function M$(e){if(e.hidden!==!0&&e.type!==`reactnode`){if(`defaultValue`in e&&e.defaultValue!==void 0)return e.defaultValue;if(e.type===`enum`)return e.enumValues[0];if(e.type===`string`)return``;if(e.type===`number`)return 0;if(e.type===`boolean`)return!1}}function N$(e,t){return!(e.omitOnDefault===!0&&`defaultValue`in e&&Object.is(e.defaultValue,t)||e.type===`string`&&e.required===!1&&e.defaultValue===void 0&&t===``)}function P$(e){let t=[];for(let n of e.props){let e=M$(n);e!==void 0&&N$(n,e)&&t.push(RJ(n.name,e))}return t}function F$(e){return yz(e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`Body content here.`,{extensions:[T$],mdastExtensions:[E$]}).children}function I$(e){let t=A$(e),n;if(t===`fence`)n={type:`code`,lang:`mermaid`,meta:null,value:e.exampleBody&&e.exampleBody.trim().length>0?e.exampleBody:`graph LR
445
+ A --> B`};else{let r=P$(e),i=t===`jsx-block`?F$(e):[];n={type:`mdxJsxFlowElement`,name:e.name,attributes:r,children:i}}return fP({type:`root`,children:[n]},{extensions:[D$]}).trimEnd()}function L$(e){let t=[];for(let n of e.props){if(n.hidden===!0)continue;let e={name:n.name,type:n.type,required:n.required};n.description!==void 0&&(e.description=n.description),n.advanced===!0&&(e.advanced=!0),n.omitOnDefault===!0&&(e.omitOnDefault=!0),n.type===`enum`&&(e.values=n.enumValues,n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue)),n.type===`string`&&(n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),n.language!==void 0&&(e.language=n.language),n.accept!==void 0&&(e.accept=n.accept)),n.type===`boolean`&&n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),n.type===`number`&&n.defaultValue!==void 0&&(e.defaultValue=n.defaultValue),t.push(e)}return t}function R$(e){return{...j$(e),example:I$(e),params:L$(e)}}function z$(){return[``,"**Custom canonical components.** OK `.md` / `.mdx` supports the JSX components below — use whichever is semantically useful in any part of the doc. For full source syntax + parameter schemas, call `palette({ components: [ids] })` with the ids you want to use. Fenced code blocks render naturally and don't need a fetch — including ` ```mermaid ` for diagrams (mermaid label text has sharp edges — `palette({ components: [\"Mermaid\"] })` lists them; parse failures come back as `warnings` entries on write/edit) and ` ```html preview ` for interactive HTML/JS/CSS pages (the fence info-string `preview` token renders the block as a live iframe; works for `html` / `htm` / `xml`; optional `h=` / `w=` tokens set size, e.g. ` ```html preview h=400px `). Use ` ```html preview ` whenever you want anything interactive or JS-powered (charts, demos, calculators, animations) — just author the standalone HTML page in the fence. Call `palette` for the markdown-native component forms (write `> [!NOTE]`, not `<Callout>`), copy-ready themed `html preview` starters, and the theme tokens (`var(--chart-1)`, `var(--foreground)`, …) an embed should reference so it tracks the reader's light/dark theme. Arbitrary `<TagName>` JSX falls through as raw MDX when no canonical fits.",``,...k$().map(j$).map(e=>`- \`${e.id}\` (${e.kind}) — ${e.description}`)].join(`
446
+ `)}const B$=N({docName:nJ,summary:iJ,content:k().optional(),...rJ}).loose(),V$=N({docName:nJ,summary:iJ,markdown:k(),position:P([`append`,`prepend`,`replace`]).optional(),extension:P($G).optional(),...rJ}).loose(),H$=N({docName:nJ,summary:iJ,find:k().min(1),replace:k(),offset:A().int().nonnegative().optional(),...rJ}).loose(),U$=N({docName:nJ,connectionId:k().min(1),scope:P([`last`,`session`,`file`]).optional(),...rJ}).loose(),W$=N({value:k(),truncatedFrom:A().int().nonnegative().optional(),hint:k().optional()}).loose(),G$=$s(`kind`,[N({kind:F(`inline`),content:k()}),N({kind:F(`truncated`),byteLength:A().int().nonnegative(),hint:k()})]),K$=N({kind:F(`content-divergence`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),divergenceType:k().optional(),currentState:G$.optional(),hint:k().optional()}).loose(),q$=N({type:F(`orphan`),parentCandidates:M(k()),message:k()}).loose(),J$=N({kind:F(`disk-edit-reconciled`),intendedBytes:A().int().nonnegative(),actualBytes:A().int().nonnegative(),byteDelta:A().int(),mergeOutcome:k().optional(),hint:k().optional()}).loose(),Y$=$s(`kind`,[K$,J$]),X$=$s(`kind`,[K$,J$,N({kind:F(`mermaid-parse-error`),fenceIndex:A().int().positive(),fenceFirstLine:k(),message:k(),line:A().int().positive().optional()}).loose()]),Z$=M(X$).min(1),Q$=N({timestamp:k().min(1),summary:W$.optional(),warning:Y$.optional(),warnings:Z$.optional()}).loose(),$$=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),hints:M(q$).optional(),summary:W$.optional(),warning:Y$.optional(),warnings:Z$.optional()}).loose(),e1=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),summary:W$.optional(),warning:Y$.optional(),warnings:Z$.optional()}).loose(),t1=N({docName:k().min(1),scope:P([`last`,`session`]),undone:j()}).loose(),n1=N({docName:nJ,patch:rc(k(),Zs([zW,Bs()])),types:rc(k(),P(IW)).optional(),summary:iJ,...rJ}).loose(),r1=N({timestamp:k().min(1),subscriberCount:A().int().nonnegative(),systemSubscriberCount:A().int().nonnegative(),appliedKeys:M(k()),summary:W$.optional(),warning:Y$.optional(),warnings:Z$.optional()}).loose(),i1=N({entries:M(N({level:P([`info`,`warn`,`error`]),message:k().max(8192),event:k().optional(),fields:rc(k(),Ws()).optional(),ts:A().optional(),sourceId:k().optional(),lineNumber:A().optional()}).loose()).max(100)}).loose(),a1=N({accepted:A().int().min(0)}).loose(),o1=N({status:k().min(1),reason:k()}).loose(),s1=N({docName:k().min(1),content:k(),lifecycle:o1.nullable()}).loose(),c1=N({documents:M(N({kind:P([`document`,`asset`,`folder`,`file`]).default(`document`),docName:k().min(1).optional(),docExt:k().min(1).default(`.md`),size:A().int().nonnegative(),modified:k().min(1),isSymlink:j().default(!1),canonicalDocName:k().nullable().default(null),targetPath:k().nullable().default(null),path:k().min(1).optional(),assetExt:k().min(1).optional(),mediaKind:P([`image`,`video`,`audio`,`pdf`,`text`]).nullable().optional(),referencedBy:M(k().min(1)).optional(),hasChildren:j().optional()}).loose().refine(e=>e.kind===`document`?e.docName!==void 0&&e.path===void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.kind===`folder`?e.docName===void 0&&e.path!==void 0&&e.assetExt===void 0&&e.mediaKind===void 0&&e.referencedBy===void 0:e.kind===`file`?e.path!==void 0&&e.mediaKind===void 0&&e.referencedBy===void 0&&e.hasChildren===void 0:e.path!==void 0&&e.assetExt!==void 0&&e.referencedBy!==void 0&&e.hasChildren===void 0,{message:`document/asset/folder/file kind must match its required fields (document → docName; asset → path+assetExt+referencedBy; folder → path only, no docName; file → path, no mediaKind/referencedBy/hasChildren)`})),truncated:j().optional()}).loose(),l1=N({source:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),u1=N({docName:k().min(1),backlinks:M(l1)}).loose(),d1=N({counts:rc(k().min(1),A().int().nonnegative())}).loose(),f1=$s(`kind`,[N({kind:F(`doc`),docName:k().min(1),anchor:k().nullable(),title:k(),snippet:k().nullable()}).loose(),N({kind:F(`external`),url:k().min(1),title:k(),snippet:k().nullable()}).loose()]),p1=N({docName:k().min(1),forwardLinks:M(f1)}).loose(),m1=$s(`kind`,[N({id:k().min(1),kind:F(`doc`),docName:k().min(1),anchor:k().nullable(),label:k(),cluster:k().nullable(),category:k().nullable(),tags:M(k()).nullable()}).loose(),N({id:k().min(1),kind:F(`external`),url:k().min(1),label:k()}).loose()]),h1=N({source:k().min(1),target:k().min(1)}).loose(),g1=N({nodes:M(m1),links:M(h1)}).loose(),_1=N({ts:A().int().min(0),url:k(),method:k(),ua:k().optional(),origin:k().optional(),referer:k().optional(),host:k().optional(),remote:k().optional(),secChUa:k().optional(),secChUaMobile:k().optional(),secChUaPlatform:k().optional(),secFetchSite:k().optional(),secFetchDest:k().optional(),secFetchMode:k().optional(),secFetchUser:k().optional()}).loose(),v1=N({app:Zs([F(`cursor`),F(`codex`),F(`claude`),Bs()]),signals_fired:M(k())}).loose(),y1=N({entries:M(_1),count:A().int().min(0),detection:v1}).loose(),b1=N({writers:M(N({id:k().min(1),name:k().optional(),email:k().optional()}).loose()).optional(),summary:iJ,...rJ}).loose(),x1=N({checkpointRef:k().min(1)}).loose(),S1=N({v:A().int().optional(),id:k().min(1),name:k().min(1),colorSeed:k().optional(),docs:M(k()),summaries:M(k()).optional()}).loose(),C1=N({entries:M(N({sha:k().min(1),timestamp:k().min(1),author:k(),authorEmail:k(),type:P([`checkpoint`,`wip`,`upstream`,`park`]),message:k(),contributors:M(S1),checkpoint:Ws().nullable()}).loose()),total:A().int().nonnegative().optional(),truncated:j().optional(),hasMore:j().optional()}).loose(),w1=N({sha:k().regex(/^[0-9a-f]{40}$/i),content:k(),timestamp:k(),author:k()}).loose(),T1=N({contentDir:k().min(1),pathSeparator:P([`/`,`\\`]),symlinkResolved:j()}).loose(),E1=M($s(`source`,[N({docName:k().min(1),timestamp:k().min(1),size:A().int().nonnegative(),source:F(`flat`)}).loose(),N({docName:k().min(1),timestamp:k().min(1),source:F(`timeline`),sha:k().min(1)}).loose()])).meta({description:"Flat array of rescue buffer entries; discriminated via `source`."}),D1=N({orphans:M(N({docName:k().min(1),title:k()}).loose())}).loose(),O1=N({hubs:M(N({docName:k().min(1),title:k(),count:A().int().nonnegative()}).loose())}).loose(),k1=N({source:k().min(1),title:k(),snippet:k().nullable()}).loose(),A1=N({deadLinks:M(N({target:k().min(1),sources:M(k1)}).loose())}).loose(),j1=N({target:N({docName:k().min(1),title:k(),aliases:M(k())}).loose(),mentions:M(N({source:k().min(1),excerpt:k(),offset:A().int().nonnegative()}).loose()),truncated:j()}).loose(),M1=N({projectPath:k().min(1)}).loose(),N1=P([`not-a-git-worktree`,`init-failed`]),P1=$s(`ok`,[N({ok:F(!0),projectPath:k().min(1)}).loose(),N({ok:F(!1),reason:N1,message:k().min(1)}).loose()]),F1=N({host:k().min(1).optional()}).loose(),I1=N({key:k().min(1)}).loose(),L1=N({keyPresent:j()}).loose(),R1=N({name:k().refine(e=>e.trim().length>0,{message:`name must be non-empty`}),email:k().refine(e=>e.trim().length>0,{message:`email must be non-empty`})}).loose(),z1=N({authenticated:j()}).loose(),B1=N({}).loose(),V1=N({stackIndex:A().int().min(0),ts:A().int().min(0),additions:A().int().min(0),deletions:A().int().min(0)}).loose(),H1=N({docName:k().min(1),additionsTotal:A().int().min(0),deletionsTotal:A().int().min(0),lastTs:A().int().min(0),bursts:M(V1)}).loose(),U1=N({displayName:k().min(1),color:k().min(1),icon:k().optional(),connectionId:k().min(1)}).loose(),W1=N({sessionAlive:j(),agent:U1.nullable(),files:M(H1)}).loose(),G1=N({diff:k(),generatedAt:A().int().min(0)}).loose(),K1=N({}).loose(),q1=N({}).loose(),J1=N({}).loose(),Y1=N({}).loose(),X1=N({}).loose(),Z1=N({}).loose(),Q1=N({displayName:k().min(1),icon:k(),color:k().min(1),currentDoc:k().nullable(),mode:P([`idle`,`writing`]),ts:A().int().min(0)}).loose(),$1=N({presence:rc(k().min(1),Q1)}).loose(),e0=rc(k().min(1),j()).meta({description:`Flat boolean record keyed by agent-scheme name (claude / codex / cursor). True = installed.`});N({path:k().min(1,`path must be non-empty`)}).loose();const t0=N({}).loose(),n0=N({fromDocName:k().min(1),toDocName:k().min(1)}).loose(),r0=N({fromPath:k().min(1),toPath:k().min(1)}).loose(),i0=N({}).loose(),a0=N({path:k().min(1),...rJ,summary:iJ}).loose(),o0=N({docName:k().min(1)}).loose(),s0=N({path:k().min(1),...rJ,summary:iJ}).loose(),c0=N({path:k().min(1)}).loose(),l0=N({kind:P([`file`,`folder`]),path:k().min(1),...rJ,summary:iJ}).loose(),u0=N({kind:P([`file`,`folder`]),path:k().min(1),duplicatedDocNames:M(k().min(1))}).loose(),d0=N({pages:M(N({docName:k().min(1),title:k(),docExt:k().min(1),size:A().int().nonnegative(),modified:k().min(1),icon:k().min(1).max(2048).optional()}).loose())}).loose(),f0=N({level:A().int().min(1).max(6),text:k(),slug:k()}).loose(),p0=N({docName:k().min(1),headings:M(f0)}).loose(),m0=N({docName:k().min(1),rewrites:A().int().nonnegative()}).loose(),h0=N({kind:P([`file`,`folder`,`asset`]),fromPath:k().min(1),toPath:k().min(1),...rJ,summary:iJ}).loose(),g0=N({renamed:M(n0),renamedAssets:M(r0),rewrittenDocs:M(m0).optional(),summary:W$.optional()}).loose(),_0=N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...rJ}).loose(),v0=N({deletedDocNames:M(k().min(1))}).loose(),y0=N({kind:P([`file`,`folder`,`asset`]),path:k().min(1),...rJ,summary:iJ}).loose(),b0=N({deletedDocNames:M(k().min(1))}).loose(),x0=N({docName:k().min(1),commitSha:k().regex(/^[0-9a-f]{40}$/i,{message:`commitSha must be a 40-char git SHA`}),summary:iJ,...rJ}).loose(),S0=N({restoredFrom:k().min(1),timestamp:k().min(1),summary:W$.optional(),warning:K$.optional(),warnings:Z$.optional()}).loose(),C0=P([`dormant`,`idle`,`fetching`,`pulling`,`pushing`,`conflict`,`offline`,`auth-error`,`disabled`]),w0=N({label:k().min(1),webUrl:ys().nullable()}).loose(),T0=$s(`checkStatus`,[N({checkStatus:F(`allowed`)}).loose(),N({checkStatus:F(`denied`),deniedReason:P([`no-collaborator`,`private-no-access`,`repo-not-found`])}).loose(),N({checkStatus:F(`unknown`),unknownError:P([`network`,`timeout`,`rate-limit`,`token-invalid`,`malformed-response`]).optional()}).loose()]),E0=P([`auth-403`,`auth-401`,`auth-scope-mismatch`,`auth-no-credential`,`semantic-protected-branch`]),D0=N({state:C0,lastSyncUtc:k().nullable(),lastFetchUtc:k().nullable(),lastPushedSha:k().nullable(),ahead:A().int().min(0),behind:A().int().min(0),consecutiveFailures:A().int().min(0),conflictCount:A().int().min(0),hasRemote:j(),syncEnabled:j(),identityUnresolved:j(),remote:w0.nullable().optional(),pushError:k().optional(),pushErrorCode:E0.optional(),pullError:k().optional(),pullErrorCode:E0.optional(),pausedReason:k().optional(),pushPermission:T0.optional()}).loose(),O0=N({op:P([`sync`,`push`,`pull`]).optional()}).loose(),k0=N({op:P([`sync`,`push`,`pull`])}).loose(),A0=N({conflicts:M(N({file:k().min(1),detectedAt:k().min(1),oursSha:k().optional(),theirsSha:k().optional(),baseSha:k().optional()}).loose())}).loose(),j0=N({file:k().min(1),strategy:P([`mine`,`theirs`,`content`,`delete`]),content:k().optional()}).loose().refine(e=>e.strategy!==`content`||e.content!==void 0&&e.content!==``,{message:`content must be a non-empty string when strategy is 'content'`,path:[`content`]}),M0=N({}).loose(),N0=N({file:k().min(1),base:k(),ours:k(),theirs:k(),kind:P([`both-modified`,`delete-modify`,`modify-delete`]),lifecycleStatus:k().nullable()}).loose(),P0=N({plan:kc(e=>e!==void 0,{message:`plan is required`})}).loose(),F0=N({plan:kc(e=>e!==void 0,{message:`plan is required`})}).loose(),I0=N({result:kc(e=>e!==void 0,{message:`result is required`})}).loose(),L0=N({path:k().min(1),summary:k().min(1)}).loose(),R0=N({files:A().int().nonnegative(),folders:A().int().nonnegative()}).loose(),z0=N({packs:M(N({id:k().min(1),name:k().min(1),description:k().min(1),defaultSubfolder:k().optional(),folders:M(L0),entryCounts:R0}).loose())}).loose(),B0=N({noOpen:j().optional(),out:k().min(1).optional()}).loose(),V0=N({reason:P([`unsupported-platform`,`spawn-error`]),message:k()}).loose(),H0=$s(`status`,[N({status:F(`installed`),outputPath:k(),size:A().int().nonnegative(),sha256:k(),skillVersion:k()}).loose(),N({status:F(`built`),outputPath:k(),size:A().int().nonnegative(),sha256:k(),skillVersion:k(),handoffError:V0.optional()}).loose(),N({status:F(`failed`),buildError:k()}).loose(),N({status:F(`skip-current`),skillVersion:k(),recordedAt:k().optional()}).loose()]),U0=N({tags:M(N({name:k().min(1),count:A().int().nonnegative(),isLeaf:j()}).loose())}).loose(),W0=N({docName:k().min(1),title:k(),matchingTags:M(k().min(1)),snippet:k().nullable()}).loose(),G0=N({name:k().min(1),docs:M(W0)}).loose(),K0=N({folder:Ws(),frontmatter_local:rc(k(),Ws()).nullable()}).loose(),q0=N({path:k(),frontmatter:rc(k(),Ws()).optional()}).loose(),J0=N({applied:Ws()}).loose(),Y0=rc(k(),Ws()).meta({description:`Free-form frontmatter map embedded in template payloads.`}),X0=N({template:N({name:k().min(1),folder:k(),scope:P([`local`,`inherited`]),path:k().min(1),frontmatter:Y0,body:k()}).strict()}).strict(),Z0=N({templates:M(N({name:k().min(1),title:k().optional(),description:k().optional(),path:k().min(1),source_folder:k()}).strict()),truncated:j()}).strict(),Q0=N({folder:k(),name:k(),body:k().optional(),frontmatter:Y0.optional(),...rJ,summary:iJ}).strict(),$0=N({path:k().min(1),created:j(),warnings:M(k())}).strict(),e2=N({existed:j(),path:k().min(1)}).strict(),t2=N({fromFolder:k(),fromName:k(),toFolder:k(),toName:k(),body:k().optional(),frontmatter:Y0.optional(),...rJ,summary:iJ}).strict(),n2=N({from:k().min(1),to:k().min(1),committed:j()}).strict(),r2=N({query:k().optional(),intent:P([`autocomplete`,`full_text`,`omnibar`]).optional(),scopes:M(P([`page`,`folder`,`content`,`file`])).optional(),scope:k().optional(),limit:A().int().nonnegative().optional(),semantic:j().optional(),source:P([`omnibar`,`mcp`,`http`]).optional()}).loose(),i2=N({kind:P([`page`,`folder`,`content`,`file`]),path:k().min(1),title:k(),score:A(),signals:rc(k(),Ws()),snippet:k().optional()}).loose(),a2=N({capable:j(),applied:j(),coverage:N({embedded:A().int().nonnegative(),total:A().int().nonnegative()})}).loose(),o2=N({enabled:j(),keyPresent:j(),keySource:P([`file`,`env`]).nullable(),keyHint:k().nullable(),ready:j(),capable:j(),embedded:A().int().nonnegative(),total:A().int().nonnegative()}).loose(),s2=N({query:k(),intent:P([`autocomplete`,`full_text`,`omnibar`]),results:M(i2),elapsedMs:A().nonnegative(),semantic:a2.optional(),truncated:j().optional()}).loose(),c2=N({version:k().min(1),recordedAt:k().min(1)}).loose(),l2=N({currentVersion:k().min(1),targets:rc(k(),c2.nullable())}).loose(),u2=`server-info`,d2=`branch-switched`,f2=`disk-ack`,p2=`config-validation-rejected`,m2=`config-ignore-nested-error`,h2=P([`files`,`backlinks`,`graph`,`sync-status`,`session-activity`,`tags`]),g2=N({v:F(1),ch:F(u2),seq:A(),serverInstanceId:k().min(1),currentBranch:k().min(1).optional()}).loose(),_2=N({v:F(1),ch:F(d2),seq:A(),branch:k().min(1)}).loose(),v2=N({v:F(1),ch:h2,seq:A()}).loose(),y2=N({v:F(1),ch:F(f2),seq:A(),docName:k().min(1),sv:k().min(1)}).loose(),b2=N({v:F(1),ch:F(p2),seq:A(),docName:k().min(1),error:ll}).loose(),x2=N({v:F(1),ch:F(m2),seq:A(),path:k().min(1),error:k().min(1)}).loose(),S2={id:`string`,kind:`enum`,path:`string`,title:`string`,name:`string`,pathSegments:`string`,content:`string`,modifiedTs:`number`},C2=new WeakMap;function w2(e){return e===void 0||!Number.isFinite(e)?20:Math.max(1,Math.min(100,Math.trunc(e)))}function T2(e){return e.trim().toLowerCase()}function E2(e){let t=e.split(`/`).filter(Boolean);return t[t.length-1]??e}function D2(e){let t=E2(e.path),n=e.title?.trim()||t,r=e.modifiedTs??0,i=e.path.split(`/`).filter(Boolean),a=new Set(i),o=[...new Set((e.aliases??[]).flatMap(e=>e.split(`/`).filter(Boolean)).filter(e=>!a.has(e)))];return{id:`${e.kind}:${e.path}`,kind:e.kind,path:e.path,title:n,name:t,pathSegments:[...i,...o].join(` `),content:e.content??``,modifiedTs:Number.isFinite(r)?r:0}}function O2(e){let t=LU({schema:S2});return e.length>0&&JU(t,e),t}function k2(e){let t={documents:e};return C2.set(t,O2(e)),t}function A2(e){let t=C2.get(e);if(t)return t;let n=O2(e.documents);return C2.set(e,n),n}function j2(e){return e===`autocomplete`?[`page`]:e===`full_text`?[`page`,`content`,`file`]:[`page`,`folder`,`file`]}function M2(e,t){return t.has(e.kind)?!0:e.kind===`page`&&t.has(`content`)}function N2(e,t){let n=T2(t);if(!n)return 0;let r=T2(e.title),i=T2(e.name),a=T2(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 P2(e,t){let n=N2(e,t);return n<=0?n:eJ(e.path)?n*.5:n}function F2(e){return e===`file`?-60:0}function I2(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 L2(e){return e===`full_text`?[`title`,`name`,`path`,`pathSegments`,`content`]:[`title`,`name`,`path`,`pathSegments`]}function R2(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 z2(e,t){return T2(t).length<4?0:e===`full_text`?1:0}function B2(e,t,n={}){let r=n.intent??`omnibar`,i=w2(n.limit),a=new Set(n.scopes??j2(r)),o=e.documents.filter(e=>M2(e,a)),s=T2(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=wW(A2(e),{term:s,properties:L2(r),boost:R2(r),tolerance:z2(r,s),limit:Math.max(i*4,40)}),l=new Map(c.hits.filter(e=>M2(e.document,a)).map(e=>[e.document.id,e.score])),u=I2(o),d=new Map;for(let e of o)P2(e,s)>=0&&d.set(e.id,e);for(let e of c.hits)M2(e.document,a)&&d.set(e.document.id,e.document);return n.semantic?H2({scopedDocuments:o,candidates:d,fullTextScores:l,recency:u,normalizedQuery:s,semantic:n.semantic,limit:i}):[...d.values()].map(e=>{let t=Math.max(0,P2(e,s)),n=l.get(e.id)??0,r=u.get(e.id)??0;return{document:e,score:t+n*20+r+F2(e.kind),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)}function V2(e){let t=new Map;return e.forEach((e,n)=>{t.set(e,n+1)}),t}function H2(e){let{scopedDocuments:t,candidates:n,fullTextScores:r,recency:i,normalizedQuery:a,semantic:o,limit:s}=e,c=o.rrfK??60,l=o.candidateLimit??64,u=o.similarityFloor??0,d=o.scores,f=new Map(t.map(e=>[e.id,e])),p=[...d.entries()].filter(([e,t])=>t>=u&&f.has(e)).sort((e,t)=>t[1]-e[1]||e[0].localeCompare(t[0])).slice(0,l);for(let[e]of p)if(!n.has(e)){let t=f.get(e);t&&n.set(e,t)}let m=[...n.values()].map(e=>{let t=Math.max(0,P2(e,a)),n=r.get(e.id)??0,o=i.get(e.id)??0,s=d.get(e.id),c=s!==void 0&&s>=u;return{document:e,score:t+n*20+o+F2(e.kind),signals:c?{lexical:t,fullText:n,recency:o,vector:s}:{lexical:t,fullText:n,recency:o},lexical:t,fullText:n,recency:o,cosine:s}}),h=V2(m.filter(e=>e.fullText>0).sort((e,t)=>t.fullText-e.fullText||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),g=V2(m.filter(e=>e.cosine!==void 0&&e.cosine>=u).sort((e,t)=>t.cosine-e.cosine||e.document.path.localeCompare(t.document.path)).map(e=>e.document.id)),_=e=>{let t=0,n=h.get(e);n!==void 0&&(t+=1/(c+n));let r=g.get(e);return r!==void 0&&(t+=1/(c+r)),t};return m.sort((e,t)=>{let n=e.lexical>0?1:0,r=t.lexical>0?1:0;if(n!==r)return r-n;if(n===1)return e.score===t.score?e.document.path.localeCompare(t.document.path):t.score-e.score;let i=_(e.document.id),a=_(t.document.id);return i===a?e.recency===t.recency?e.document.path.localeCompare(t.document.path):t.recency-e.recency:a-i}).map(({document:e,score:t,signals:n})=>({document:e,score:t,signals:n})).slice(0,s)}function U2(e){let t=new TextEncoder().encode(e),n=new Uint8Array(1+t.length);return n[0]=1,n.set(t,1),W2(n)}function W2(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]);return btoa(t).replace(/\+/g,`-`).replace(/\//g,`_`).replace(/=+$/,``)}const G2=Symbol.for(`@inkeep/open-knowledge/skill-state-field-registry`),K2=globalThis;K2[G2]===void 0&&(K2[G2]=Ii());const q2=K2[G2],J2=[`.ok`,`skill-state.yml`],Y2=[`claude-cowork`,`cli-hosts`],X2=[`server-build-and-open`,`electron-build-and-open`,`cli-npx-skills-add`,`desktop-direct`,`cli-start`],Z2=/^\d+\.\d+\.\d+(?:[-+][\w.-]+)?$/,Q2=Ys({version:k().regex(Z2,`version must match /^\\d+\\.\\d+\\.\\d+(?:[-+][\\w.-]+)?$/`).register(q2,{description:`Recorded skill version for this target.`}),recordedAt:Uo().register(q2,{description:`ISO 8601 timestamp of the most recent successful write. Updated on every write, including reinstalls of the same version.`}),surface:P(X2).register(q2,{description:`Install-source surface that recorded this entry.`}).optional()}),$2=Ys({schema:F(1).register(q2,{description:`Schema major version. Bumped only on breaking shape changes.`}),targets:Ys({"claude-cowork":Q2.optional(),"cli-hosts":Q2.optional()}).register(q2,{description:`Per-target install-state entries. Absent target = no recorded install.`}).default({})});function e4(){return{schema:1,targets:{}}}function t4(){let e=!1,t=``,n=0;return r=>{let i=n4(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 n4(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 r4=[`#D97757`,`#1B1912`,`#F9F3E9`,`#7A9DFF`,`#8534F3`,`#9663F0`,`#727CF3`],i4={claude:`#D97757`,cursor:`#1B1912`,windsurf:`#0B100F`,openai:`#7A9DFF`,github:`#8534F3`,cline:`#9663F0`,bot:`#727CF3`};function a4(e,t=r4){let n=0;for(let t of e)n=(n<<5)-n+t.charCodeAt(0)|0;return t[Math.abs(n)%t.length]}const o4={"claude-code":`claude`,"claude-ai":`claude`,cursor:`cursor`,"cursor-vscode":`cursor`,cascade:`windsurf`,codex:`openai`,"codex-mcp-client":`openai`,copilot:`github`,cline:`cline`};function s4(e){return e?o4[e]||(e.startsWith(`local-agent-mode-`)?`claude`:`bot`):`bot`}const c4={claude:`Claude`,cursor:`Cursor`,windsurf:`Windsurf`,openai:`Codex`,github:`Copilot`,cline:`Cline`};function l4(e){let t=e?.trim();return t?c4[s4(t)]??t:`Agent`}function u4(e,t){let n=e.trim();if(!n||/^[a-zA-Z][a-zA-Z\d+\-.]*:/.test(n)||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=l.startsWith(`/`),d=u?l.slice(1):l,f=u?[]:t.includes(`/`)?t.split(`/`).slice(0,-1):[];for(let e of d.split(`/`))if(e===`..`){if(f.length===0)return null;f.pop()}else e!==`.`&&e!==``&&f.push(e);return f.length===0?null:{docName:f.join(`/`),anchor:a||null}}const d4=/^[a-zA-Z][a-zA-Z\d+\-.]*:/;function f4(e){let t=(e.split(/[?#]/)[0]??e).match(/\.([a-z0-9]+)$/i);return t?(t[1]??``).toLowerCase():null}function p4(e){let t=e.trim();return d4.test(t)||t.startsWith(`//`)}function m4(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}if(p4(n))return{kind:`external`,url:n};let r=u4(n,t);if(r)return{kind:`doc`,docName:r.docName,anchor:r.anchor};let i=f4(n);return i&&i!==`md`&&i!==`mdx`?{kind:`asset`,url:n,ext:i}:null}function h4(e,t){let n=e.trim();if(!n)return null;if(p4(n))return{kind:`external`,url:t?`${n}#${t}`:n};let r=f4(n);return r&&r!==`md`&&r!==`mdx`?{kind:`asset`,url:n,ext:r}:{kind:`doc`,docName:n,anchor:t?.trim()||null}}function g4(e,t){let n=e.trim();if(!n||d4.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 _4(e){let t=e;return t.startsWith(`./`)&&(t=t.slice(2)),t.startsWith(`/`)&&(t=t.slice(1)),t}function v4(e){let t=e.lastIndexOf(`/`);return t===-1?e:e.slice(t+1)}function y4(e){let t=e.lastIndexOf(`/`);return t===-1?``:e.slice(0,t)}function b4(e){return e.split(`/`).filter(e=>e!==``)}function x4(e,t){let n=y4(t);return e===``||n===e?!0:n.startsWith(`${e}/`)}function S4(e,t){let n=y4(t);if(e===n)return 0;let r=e===``?n:n.slice(e.length+1);return r===``?0:b4(r).length}function C4(e,t){let n=b4(e),r=b4(t),i=0;for(;i<n.length&&i<r.length&&n[i]===r[i];)i++;return n.length-i+(r.length-i)}function w4(){let e=new Map;function t(t){let n=_4(t);if(n===``)return;let r=v4(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=_4(t),r=v4(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=y4(_4(n)),o=[],s=[];for(let e of i)x4(a,e)?o.push(e):s.push(e);return o.length>0?(e=>{let t=e[0],n=S4(a,t);for(let r=1;r<e.length;r++){let i=e[r],o=S4(a,i);(o<n||o===n&&i<t)&&(t=i,n=o)}return t})(o):(e=>{let t=e[0],n=C4(a,y4(t));for(let r=1;r<e.length;r++){let i=e[r],o=C4(a,y4(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 T4(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 E4(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}function D4(e){try{return process.kill(e,0),!0}catch(e){return!!(e&&typeof e==`object`&&`code`in e&&e.code===`EPERM`)}}function O4(e){return!(typeof e!=`number`||!Number.isInteger(e)||e<2||e>2147483647)}function k4(){try{let e=_(g(b(import.meta.url)),`..`,`package.json`),t=JSON.parse(d(e,`utf-8`));if(typeof t.version==`string`&&t.version.length>0)return t.version}catch{}return`0.0.0-unknown`}const A4=k4(),j4=1;var M4=class extends Error{existing;lockPath;lockName;constructor(e,t,n){super(`Open Knowledge ${n} already running on port ${e.port} (pid ${e.pid}, started ${e.startedAt}). Stop it first or use a different directory. Lock: ${t}`),this.name=`ProcessLockCollisionError`,this.existing=e,this.lockPath=t,this.lockName=n}};function N4(e,t){return _(e,`${t}.lock`)}const P4=new Map;function F4(e){P4.set(e,(P4.get(e)??0)+1)}function I4(e){let t=P4.get(e);return t===void 0||t<=1?(P4.delete(e),!0):(P4.set(e,t-1),!1)}function L4(e,t){try{let n=JSON.parse(d(e,`utf-8`));return n&&typeof n==`object`&&O4(n.pid)?n:(console.warn(`${t} Corrupt lock file at ${e} — replacing`),null)}catch{return console.warn(`${t} Corrupt lock file at ${e} — replacing`),null}}function R4(e){let{lockName:t,lockDir:n,metadata:r}=e,i=`[${t}-lock]`;l(n,{recursive:!0});let a=N4(n,t),o={pid:process.pid,hostname:y(),port:r.port,startedAt:new Date().toISOString(),worktreeRoot:r.worktreeRoot,...r.kind!==void 0&&{kind:r.kind},...r.parentPid!==void 0&&{parentPid:r.parentPid},...r.capabilities!==void 0&&{capabilities:r.capabilities},protocolVersion:r.protocolVersion??1,runtimeVersion:r.runtimeVersion??A4},d=JSON.stringify(o,null,2);for(let e=0;e<3;e++){if(!c(a))try{let e=u(a,`wx`,384);try{m(e,d)}finally{s(e)}return F4(a),z4({lockName:t,lockDir:n,lockPath:a})}catch(e){if(e.code!==`EEXIST`)throw e}let e=L4(a,i);if(e){let r=e.hostname===y();if(r&&e.pid===process.pid)return p(a,d,{encoding:`utf-8`,mode:384}),F4(a),z4({lockName:t,lockDir:n,lockPath:a});if(r&&D4(e.pid))throw new M4(e,a,t);console.warn(`${i} Stale lock detected (pid=${e.pid}, host=${e.hostname}) — replacing`)}try{f(a)}catch{}}throw Error(`${i} Failed to acquire ${a} after 3 attempts (concurrent acquire contention).`)}function z4(e){let{lockName:t,lockDir:n,lockPath:r}=e;return{lockPath:r,release:()=>U4({lockName:t,lockDir:n}),updatePort:e=>B4({lockName:t,lockDir:n,port:e})}}function B4(e){let{lockName:t,lockDir:n,port:r}=e,i=`[${t}-lock]`,a=N4(n,t);if(!c(a)){console.warn(`${i} Lock file missing at ${a} during port update — skipping`);return}let o;try{let e=JSON.parse(d(a,`utf-8`));if(!e||typeof e!=`object`||!O4(e.pid)){console.warn(`${i} Corrupt lock at ${a} during port update — skipping`);return}o=e}catch{console.warn(`${i} Unreadable lock at ${a} during port update — skipping`);return}if(o.pid===process.pid&&!(typeof o.hostname==`string`&&o.hostname!==y())){o.port=r;try{p(a,JSON.stringify(o,null,2),{encoding:`utf-8`,mode:384})}catch(e){console.warn(`${i} Failed to update port in ${a}: ${e instanceof Error?e.message:String(e)}`)}}}function V4(e){let{lockName:t,lockDir:n}=e,r=N4(n,t);if(!c(r))return null;let i;try{let e=JSON.parse(d(r,`utf-8`));if(!e||typeof e!=`object`||!O4(e.pid))return null;i=e}catch{return null}if(i.hostname!==y())return null;if(!D4(i.pid)){try{f(r)}catch{}return null}return i}function H4(e){let{lockName:t,lockDir:n}=e,r=N4(n,t);if(!c(r))return{status:`absent`};let i;try{i=JSON.parse(d(r,`utf-8`))}catch{return{status:`incompatible`,reason:`corrupt`,raw:void 0}}if(!i||typeof i!=`object`)return{status:`incompatible`,reason:`corrupt`,raw:i};let a=i;if(!O4(a.pid)||typeof a.hostname!=`string`||typeof a.port!=`number`||typeof a.startedAt!=`string`||typeof a.worktreeRoot!=`string`)return{status:`incompatible`,reason:`corrupt`,raw:i};let o={pid:a.pid,hostname:a.hostname,port:a.port,startedAt:a.startedAt,worktreeRoot:a.worktreeRoot,protocolVersion:typeof a.protocolVersion==`number`?a.protocolVersion:void 0,runtimeVersion:typeof a.runtimeVersion==`string`?a.runtimeVersion:void 0};if(o.hostname!==y())return{status:`stale`,lock:o};if(!D4(o.pid)){try{f(r)}catch{}return{status:`stale`,lock:o}}return o.protocolVersion===void 0||o.runtimeVersion===void 0?{status:`incompatible`,reason:`missing-fields`,raw:i}:{status:`live`,lock:o}}function U4(e){let{lockName:t,lockDir:n}=e,r=`[${t}-lock]`,i=N4(n,t);if(I4(i)&&c(i))try{let e=JSON.parse(d(i,`utf-8`));if(!e||typeof e!=`object`||typeof e.pid!=`number`||e.pid!==process.pid||typeof e.hostname==`string`&&e.hostname!==y())return;f(i)}catch(e){console.warn(`${r} Failed to release ${i}: ${e instanceof Error?e.message:String(e)}`)}}var W4=class extends M4{constructor(e,t){super(e,t,`server`),this.name=`ServerLockCollisionError`}};function G4(e,t){try{return R4({lockName:`server`,lockDir:e,metadata:t}).lockPath}catch(e){throw e instanceof M4&&e.lockName===`server`?new W4(e.existing,e.lockPath):e}}function K4(e,t){B4({lockName:`server`,lockDir:e,port:t})}function q4(e){return V4({lockName:`server`,lockDir:e})}function J4(e){U4({lockName:`server`,lockDir:e})}export{YG as $,tc as $i,e2 as $n,qW as $r,Z1 as $t,Q$ as A,zc as Ai,P0 as An,PG as Ar,r1 as At,v2 as B,nl as Bi,$2 as Bn,k$ as Br,HK as Bt,H$ as C,Lt as Ca,I as Ci,b1 as Cn,a4 as Cr,y1 as Ct,V$ as D,pt as Da,Uc as Di,F0 as Dn,k2 as Dr,J0 as Dt,t1 as E,D as Ea,Hc as Ei,s2 as En,LZ as Er,q0 as Et,lG as F,tl as Fi,pJ as Fn,U2 as Fr,DK as Ft,p2 as G,cc as Gi,A0 as Gn,bJ as Gr,z1 as Gt,g2 as H,Kc as Hi,FJ as Hn,NY as Hr,B1 as Ht,vG as I,Sl as Ii,fJ as In,T4 as Ir,B0 as It,KG as J,Hs as Ji,D0 as Jn,sK as Jr,I1 as Jt,f2 as K,P as Ki,j0 as Kn,VW as Kr,PJ as Kt,_2 as L,pl as Li,hJ as Ln,Qq as Lr,H0 as Lt,d1 as M,wl as Mi,EJ as Mn,l4 as Mr,C1 as Mt,u1 as N,yl as Ni,oJ as Nn,VG as Nr,w1 as Nt,$$ as O,ft as Oa,Vc as Oi,I0 as On,D2 as Or,p1 as Ot,SJ as P,Jc as Pi,cJ as Pn,e4 as Pr,O1 as Pt,qG as Q,$s as Qi,U0 as Qn,NG as Qr,$1 as Qt,x2 as R,ul as Ri,_J as Rn,sG as Rr,e0 as Rt,G1 as S,on as Sa,Df as Si,GG as Sn,WG as Sr,CK as St,U$ as T,O as Ta,Wc as Ti,r2 as Tn,t4 as Tr,K0 as Tt,d2 as U,qc as Ui,j1 as Un,Wq as Ur,F1 as Ut,y2 as V,$c as Vi,t0 as Vn,C$ as Vr,g1 as Vt,m2 as W,Fs as Wi,N0 as Wn,s4 as Wr,R1 as Wt,ZG as X,j as Xi,k0 as Xn,UK as Xr,P1 as Xt,UG as Y,M as Yi,O0 as Yn,vJ as Yr,M1 as Yt,XG as Z,kc as Zi,G0 as Zn,hG as Zr,o$ as Zt,i4 as _,vr as _a,x$ as _i,J2 as _n,MW as _r,c1 as _t,R4 as a,Mc as aa,fG as ai,HG as an,Z0 as ar,s0 as at,X$ as b,fn as ba,ZW as bi,lK as bn,m4 as br,u0 as bt,O4 as c,Zs as ca,u4 as ci,DJ as cn,J1 as cr,o0 as ct,H4 as d,Uo as da,BG as di,g0 as dn,b0 as dr,pK as dt,F as ea,WW as ei,X1 as en,X0 as er,JG as et,q4 as f,Vo as fa,Jq as fi,E1 as fn,iK as fr,cK as ft,K4 as g,ai as ga,cG as gi,TK as gn,NW as gr,v0 as gt,B4 as h,Ga as ha,E4 as hi,EK as hn,T1 as hr,_0 as ht,W4 as i,lc as ia,tG as ii,fK as in,$0 as ir,a1 as it,OJ as j,Tl as ji,o2 as jn,QW as jr,zW as jt,B$ as k,Bc as ki,z0 as kn,FG as kr,n1 as kt,N4 as l,Ws as la,B2 as li,jJ as ln,K1 as lr,OK as lt,J4 as m,Wa as ma,UW as mi,S0 as mn,MJ as mr,A1 as mt,A4 as n,A as na,R$ as ni,D1 as nn,n2 as nr,TJ as nt,G4 as o,rc as oa,z$ as oi,p0 as on,Y1 as or,c0 as ot,U4 as p,fa as pa,dG as pi,x0 as pn,NJ as pr,tK as pt,u2 as q,Bs as qi,M0 as qn,eJ as qr,L1 as qt,j4 as r,N as ra,pG as ri,uK as rn,Q0 as rr,i1 as rt,D4 as s,k as sa,g4 as si,d0 as sn,q1 as sr,a0 as st,M4 as t,Ys as ta,dK as ti,oK as tn,t2 as tr,CJ as tt,V4 as u,ys as ua,JW as ui,h0 as un,y0 as ur,aK as ut,nK as v,cn as va,GW as vi,Y2 as vn,oG as vr,s1 as vt,e1 as w,Tt as wa,Cl as wi,x1 as wn,w4 as wr,i0 as wt,W1 as x,mn as xa,Ly as xi,$G as xn,h4 as xr,rK as xt,wK as y,un as ya,$q as yi,Z2 as yn,AJ as yr,l0 as yt,b2 as z,_l as zi,l2 as zn,a$ as zr,eK as zt};
447
+ //# sourceMappingURL=server-lock-BpjJj3OD-DlYx_Xz-.mjs.map