geneseed 4.30.1 → 4.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (97) hide show
  1. package/CHANGELOG.md +34 -0
  2. package/SHIPPED.md +1 -1
  3. package/adapters/opencode/plugins/geneseed-context.js +136 -1
  4. package/adapters/opencode/plugins/geneseed-guard.js +145 -2
  5. package/docs/concepts/exclusions.md +1 -1
  6. package/docs/concepts/footprint.md +1 -1
  7. package/docs/concepts/hook-gates.md +1 -1
  8. package/docs/concepts/hooks.md +6 -4
  9. package/docs/concepts/host-matrix.md +1 -1
  10. package/docs/concepts/loop-bricks.md +1 -1
  11. package/docs/concepts/loop-notes.md +4 -2
  12. package/docs/concepts/loop-templates.md +7 -4
  13. package/docs/concepts/loops.md +3 -0
  14. package/docs/concepts/ownership.md +1 -1
  15. package/docs/guides/run-a-loop.md +1 -1
  16. package/docs/guides/set-up-ownership.md +1 -1
  17. package/docs/reference/loop-actions.md +1 -1
  18. package/docs/reference/plugin-activity.md +1 -1
  19. package/docs/reference/plugin-context.md +4 -0
  20. package/docs/reference/plugin-guard.md +1 -1
  21. package/docs/understand/enforced-vs-asked.md +3 -2
  22. package/docs/understand/machine-bob.md +1 -1
  23. package/docs/web-ui.md +85 -26
  24. package/harness.config.json +1 -1
  25. package/js/README.md +3 -3
  26. package/js/hosts/hooks-context.mjs +22 -1
  27. package/js/hosts/hooks-done.mjs +97 -31
  28. package/js/hosts/hooks-prims.mjs +65 -0
  29. package/js/hosts/hooks.mjs +188 -27
  30. package/js/loop/state.mjs +15 -5
  31. package/js/web/actions.mjs +17 -27
  32. package/js/web/activity.mjs +139 -23
  33. package/js/web/api.mjs +31 -13
  34. package/js/web/catalog.mjs +108 -23
  35. package/js/web/handler.mjs +4 -3
  36. package/js/web/routes.mjs +47 -14
  37. package/js/web/server.mjs +14 -13
  38. package/js/web/state.mjs +36 -15
  39. package/js/web/usage-api.mjs +7 -3
  40. package/package.json +1 -1
  41. package/src/agents/_template.md +3 -0
  42. package/src/agents/developer.md +5 -2
  43. package/src/agents/tester.md +4 -1
  44. package/src/bricks/apply.md +3 -0
  45. package/src/bricks/test.md +6 -4
  46. package/src/loops/bugfix.json +11 -5
  47. package/src/loops/feature.json +7 -4
  48. package/src/skills/loop.md +1 -0
  49. package/src/skills/ship.md +9 -1
  50. package/web/dist/assets/Activity-Bjy64wHC.js +1 -0
  51. package/web/dist/assets/ActivityDetail-B0AaipP8.js +1 -0
  52. package/web/dist/assets/{Bonsai-CN4rRAHc.js → Bonsai-CJniRqaH.js} +1 -1
  53. package/web/dist/assets/{CopyButton-CYljsnLo.js → CopyButton-C5Li6awl.js} +1 -1
  54. package/web/dist/assets/Dashboard-B-6DTmae.js +2 -0
  55. package/web/dist/assets/{DataTable-BWbUx4bY.js → DataTable-b9zTShqJ.js} +1 -1
  56. package/web/dist/assets/{Docs-DE04qOKj.js → Docs-LRc30XL9.js} +2 -2
  57. package/web/dist/assets/{EmptyState-1sPNleqv.js → EmptyState-CY5Pm2xy.js} +1 -1
  58. package/web/dist/assets/FilterInput-qGKNSlxv.js +1 -0
  59. package/web/dist/assets/{GreenhouseView-DPwhFO_j.js → GreenhouseView-CcoYlaWo.js} +1 -1
  60. package/web/dist/assets/Installs-dp1epTcE.js +3 -0
  61. package/web/dist/assets/JournalView-nFP4poCf.js +1 -0
  62. package/web/dist/assets/{KitApply-BN2Az7dc.js → KitApply-DwyZUj57.js} +1 -1
  63. package/web/dist/assets/{Kits-C9qVd466.js → Kits-C0IEdZXe.js} +1 -1
  64. package/web/dist/assets/Laws-CkykmQWu.js +3 -0
  65. package/web/dist/assets/Library-Guh9HBZU.js +2 -0
  66. package/web/dist/assets/Loops-CzitjxGV.js +2 -0
  67. package/web/dist/assets/Markdown-C4S4tTA7.js +69 -0
  68. package/web/dist/assets/{OperatorHudView-CLN6Qn25.js → OperatorHudView-DLGNulIY.js} +1 -1
  69. package/web/dist/assets/Personal-BMtberL8.js +2 -0
  70. package/web/dist/assets/RailCats-D5weYPCS.js +1 -0
  71. package/web/dist/assets/Tabs-uYJqfuQt.js +1 -0
  72. package/web/dist/assets/api-BxjLd7Qd.js +1 -0
  73. package/web/dist/assets/index-DA7BiaE5.js +3 -0
  74. package/web/dist/assets/index-dbbDGFDq.css +1 -0
  75. package/web/dist/assets/{motion-CXaUMNkg.js → motion-Bccx3zE8.js} +1 -1
  76. package/web/dist/assets/react-C1iE8mnY.js +9 -0
  77. package/web/dist/assets/rolldown-runtime-XKyaHtl9.js +1 -0
  78. package/web/dist/assets/{usePoll-bDFN-Hr6.js → usePoll-o8ul-Sog.js} +1 -1
  79. package/web/dist/index.html +6 -6
  80. package/web/dist/assets/Activity-C8pQvnos.js +0 -1
  81. package/web/dist/assets/ActivityDetail-D_8Bx-QO.js +0 -1
  82. package/web/dist/assets/Dashboard-DkUm4XMu.js +0 -2
  83. package/web/dist/assets/FilterInput-CZREvrjX.js +0 -1
  84. package/web/dist/assets/Installs-DmPzD4BW.js +0 -3
  85. package/web/dist/assets/JournalView-DQlDC-7i.js +0 -1
  86. package/web/dist/assets/Laws-T2wbwMmB.js +0 -3
  87. package/web/dist/assets/Library-t3KocV0-.js +0 -2
  88. package/web/dist/assets/Loops-6lNY-9uR.js +0 -2
  89. package/web/dist/assets/Markdown-DpmmtW2Y.js +0 -65
  90. package/web/dist/assets/Personal-xjoSqCzr.js +0 -2
  91. package/web/dist/assets/RailCats-BuJD4Jou.js +0 -1
  92. package/web/dist/assets/Tabs-DaExAgql.js +0 -1
  93. package/web/dist/assets/api-LvBC0CnK.js +0 -1
  94. package/web/dist/assets/index-DhNNxhfg.js +0 -3
  95. package/web/dist/assets/index-XTGBLKQr.css +0 -1
  96. package/web/dist/assets/react-DlYQp10C.js +0 -9
  97. package/web/dist/assets/rolldown-runtime-hePW80VL.js +0 -1
@@ -1,65 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";var r=e(t(),1);function i(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var a=i();function o(e){a=e}var s={exec:()=>null};function c(e){let t=[];return n=>{let r=Math.max(0,Math.min(3,n-1)),i=t[r];return i||(i=e(r),t[r]=i),i}}function l(e,t=``){let n=typeof e==`string`?e:e.source,r={replace:(e,t)=>{let i=typeof t==`string`?t:t.source;return i=i.replace(d.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var u=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),d={codeRemoveIndent:/^(?: {0,3}\t| {1,4})/gm,outputLinkReplace:/\\([\[\]])/g,indentCodeCompensation:/^(\s+)(?:```)/,beginningSpace:/^\s+/,endingHash:/#$/,startingSpaceChar:/^ /,endingSpaceChar:/ $/,endingSpaceTabChar:/[ \t]$/,nonSpaceChar:/[^ ]/,newLineCharGlobal:/\n/g,tabCharGlobal:/\t/g,leadingSpaceTab:/^[ \t]+/,multipleSpaceGlobal:/\s+/g,blankLine:/^[ \t]*$/,doubleBlankLine:/\n[ \t]*\n[ \t]*$/,blockquoteStart:/^ {0,3}>/,blockquoteSetextReplace:/\n {0,3}((?:=+|-+) *)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\] +\S/,listReplaceTask:/^\[[ xX]\] +/,listTaskCheckbox:/\[[ xX]\]/,anyLine:/\n.*\n/,hrefBrackets:/^<(.*)>$/,tableDelimiter:/[:|]/,tableAlignChars:/^\||\| *$/g,tableRowBlankLine:/\n[ \t]*$/,tableAlignRight:/^ *-+: *$/,tableAlignCenter:/^ *:-+: *$/,tableAlignLeft:/^ *:-+ *$/,startATag:/^<a /i,endATag:/^<\/a>/i,startPreScriptTag:/^<(pre|code|kbd|script)(\s|>)/i,endPreScriptTag:/^<\/(pre|code|kbd|script)(\s|>)/i,startAngleBracket:/^</,endAngleBracket:/>$/,pedanticHrefTitle:/^([^'"]*[^\s])\s+(['"])(.*)\2/,unicodeAlphaNumeric:/[\p{L}\p{N}]/u,numericCharacterReference:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));/,numericCharacterReferenceOrAmpersand:/&#(?:(\d{1,7})|[Xx]([A-Fa-f0-9]{1,6}));|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,escapeTest:/[&<>"']/,escapeReplace:/[&<>"']/g,escapeTestNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/,escapeReplaceNoEncode:/[<>"']|&(?!(#\d{1,7}|#[Xx][a-fA-F0-9]{1,6}|\w+);)/g,caret:/(^|[^\[])\^/g,percentDecode:/%25/g,findPipe:/\|/g,splitPipe:/ \|/,slashPipe:/\\\|/g,carriageReturn:/\r\n|\r/g,spaceLine:/^ +$/gm,notSpaceStart:/^\S*/,endingNewline:/\n$/,listItemRegex:e=>RegExp(`^( {0,3}${e})((?:[ ][^\\n]*)?(?:\\n|$))`),nextBulletRegex:c(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:c(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:c(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:c(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:c(e=>RegExp(`^ {0,${e}}(?:</?(?:${x})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,`i`)),blockquoteBeginRegex:c(e=>RegExp(`^ {0,${e}}>`))},f=/^(?:[ \t]*(?:\n|$))+/,p=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,m=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}\1[~`]* *(?=\n|$)|$)/,h=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,g=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,_=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,ee=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+) *(?:\n+|$)/,v=l(ee).replace(/bull/g,_).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/\|table/g,``).getRegex(),te=l(ee).replace(/bull/g,_).replace(/blockCode/g,/(?: {4}| {0,3}\t)/).replace(/fences/g,/ {0,3}(?:`{3,}|~{3,})/).replace(/blockquote/g,/ {0,3}>/).replace(/heading/g,/ {0,3}#{1,6}(?:\s|$)/).replace(/hr/g,/ {0,3}(?:(?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/).replace(/html/g,/ {0,3}<[^\n>]+>\n/).replace(/table/g,/ {0,3}\|?(?:[:\- ]*\|)+[\:\- ]*\n/).getRegex(),y=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,ne=/^[^\n]+/,b=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\])+/,re=l(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,b).replace(`title`,/(?:"(?:\\"?|[^"\\])*"|'[^'\n]*(?:\n[^'\n]+)*\n?'|\([^()]*\))/).getRegex(),ie=l(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,_).getRegex(),x=`address|article|aside|base|basefont|blockquote|body|caption|center|col|colgroup|dd|details|dialog|dir|div|dl|dt|fieldset|figcaption|figure|footer|form|frame|frameset|h[1-6]|head|header|hr|html|iframe|legend|li|link|main|menu|menuitem|meta|nav|noframes|ol|optgroup|option|p|param|search|section|summary|table|tbody|td|tfoot|th|thead|title|tr|track|ul`,S=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ae=l(`^ {0,3}(?:<(script|pre|style|textarea)[\\s>][\\s\\S]*?(?:</\\1>[^\\n]*\\n*|$)|comment[^\\n]*(\\n+|$)|<\\?[\\s\\S]*?(?:\\?>[^\\n]*\\n*|$)|<![A-Z][\\s\\S]*?(?:>[^\\n]*\\n*|$)|<!\\[CDATA\\[[\\s\\S]*?(?:\\]\\]>[^\\n]*\\n*|$)|</?(tag)(?: +|\\n|/?>)[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|<(?!(?:script|pre|style|textarea)(?![a-z0-9-]))([a-z][a-z0-9-]*)(?:attribute)*? */?>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$)|</[a-z][a-z0-9-]*\\s*>(?=[ \\t]*(?:\\n|$))[\\s\\S]*?(?:(?:\\n[ ]*)+\\n|$))`,`i`).replace(`comment`,S).replace(`tag`,x).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),oe=e=>l(y).replace(`hr`,h).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,e).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,x).getRegex(),se=oe(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),ce=oe(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),C={blockquote:l(/^( {0,3}> ?(paragraph|[^\n]*)(?:\n|$))+/).replace(`paragraph`,ce).getRegex(),code:p,def:re,fences:m,heading:g,hr:h,html:ae,lheading:v,list:ie,newline:f,paragraph:se,table:s,text:ne},w=l(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,h).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`blockquote`,` {0,3}>`).replace(`code`,`(?: {4}| {0,3} )[^\\n]`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,x).getRegex(),le={...C,lheading:te,table:w,paragraph:l(y).replace(`hr`,h).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,w).replace(`blockquote`,` {0,3}>`).replace(`fences`," {0,3}(?:`{3,}(?=[^`\\n]*(?:\\n|$))|~~~)[^\\n]*(?:\\n|$)").replace(`list`,` {0,3}(?:[*+-]|1[.)])[ \\t]+[^ \\t\\n]`).replace(`html`,` {0,3}(?:</?(?:tag)(?: +|\\n|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`).replace(`tag`,x).getRegex()},ue={...C,html:l(`^ *(?:comment *(?:\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1> *(?:\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?> *(?:\\n{2,}|\\s*$))`).replace(`comment`,S).replace(/tag/g,`(?!(?:a|em|strong|small|s|cite|q|dfn|abbr|data|time|code|var|samp|kbd|sub|sup|i|b|u|mark|ruby|rt|rp|bdi|bdo|span|br|wbr|ins|del|img)\\b)\\w+(?!:|[^\\w\\s@]*@)\\b`).getRegex(),def:/^ *\[([^\]]+)\]: *<?([^\s>]+)>?(?: +(["(][^\n]+[")]))? *(?:\n+|$)/,heading:/^(#{1,6})(.*)(?:\n+|$)/,fences:s,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:l(y).replace(`hr`,h).replace(`heading`,` *#{1,6} *[^
2
- ]`).replace(`lheading`,v).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},de=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,fe=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,T=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,pe=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,E=/[\p{P}\p{S}]/u,D=/[\s\p{P}\p{S}]/u,O=/[^\s\p{P}\p{S}]/u,me=l(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,D).getRegex(),he=/[\p{Pi}\p{Ps}"']/u,k=/(?!~)[\p{P}\p{S}]/u,ge=/(?!~)[\s\p{P}\p{S}]/u,_e=/(?:[^\s\p{P}\p{S}]|~)/u,ve=l(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,u?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),A=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,ye=l(A,`u`).replace(/punct/g,E).getRegex(),be=l(A,`u`).replace(/punct/g,k).getRegex(),xe=l(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,he).replace(/punct/g,E).getRegex(),j=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Se=l(j,`gu`).replace(/notPunctSpace/g,O).replace(/punctSpace/g,D).replace(/punct/g,E).getRegex(),Ce=l(j,`gu`).replace(/notPunctSpace/g,_e).replace(/punctSpace/g,ge).replace(/punct/g,k).getRegex(),we=l(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,O).replace(/punctSpace/g,D).replace(/punct/g,E).getRegex(),Te=l(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,O).replace(/punctSpace/g,D).replace(/punct/g,E).getRegex(),Ee=l(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,O).replace(/punctSpace/g,D).replace(/punct/g,E).getRegex(),De=l(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,E).getRegex(),Oe=l(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,O).replace(/punctSpace/g,D).replace(/punct/g,E).getRegex(),ke=l(/\\(punct)/,`gu`).replace(/punct/g,E).getRegex(),Ae=l(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,`gu`).replace(/punct/g,E).getRegex(),je=l(/^<(scheme:[^\s\x00-\x1f<>]*|email)>/).replace(`scheme`,/[a-zA-Z][a-zA-Z0-9+.-]{1,31}/).replace(`email`,/[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+(@)[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?(?:\.[a-zA-Z0-9](?:[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])?)+(?![-_])/).getRegex(),Me=l(S).replace(`(?:-->|$)`,`-->`).getRegex(),Ne=l(`^comment|^</[a-zA-Z][a-zA-Z0-9-]*\\s*>|^<[a-zA-Z][a-zA-Z0-9-]*(?:attribute)*?\\s*/?>|^<\\?[\\s\\S]*?\\?>|^<![a-zA-Z]+\\s[\\s\\S]*?>|^<!\\[CDATA\\[[\\s\\S]*?\\]\\]>`).replace(`comment`,Me).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),M=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,N=l(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,M).getRegex(),Pe=l(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace(`label`,N).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\"?|[^"\\])*"|'(?:\\'?|[^'\\])*'|\((?:\\\)?|[^)\\])*\)/).getRegex(),Fe=l(/^!?\[(label)\]\[(ref)\]/).replace(`label`,N).replace(`ref`,b).getRegex(),Ie=l(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,b).getRegex(),P=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,Le=l(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,M).getRegex(),Re=l(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,l(/^!?\[(label)\]\[(ref)\]/).replace(`label`,Le).replace(`ref`,P).getRegex()).replace(`nolink`,l(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,P).getRegex()).getRegex(),F=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,ze=l(/(?:mailto:email|xmpp:email(?:\/[A-Za-z0-9@.]+)?)/).replace(/email/g,/[A-Za-z0-9._+-]+@[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),I={_backpedal:s,anyPunctuation:ke,anyPunctuationOutsideCode:Ae,autolink:je,blockSkip:ve,br:T,code:fe,del:s,delLDelim:s,delRDelim:s,emStrongLDelim:ye,emStrongRDelimAst:Se,emStrongRDelimUnd:Te,escape:de,link:Pe,nolink:Ie,punctuation:me,reflink:Fe,reflinkSearch:Re,tag:Ne,text:pe,url:s},Be={...I,emStrongLDelim:xe,emStrongRDelimAst:we,emStrongRDelimUnd:Ee,link:l(/^!?\[(label)\]\((.*?)\)/).replace(`label`,N).getRegex(),reflink:l(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,N).getRegex()},L={...I,emStrongRDelimAst:Ce,emStrongLDelim:be,delLDelim:De,delRDelim:Oe,url:l(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,ze).replace(`protocol`,F).replace(`email`,/[A-Za-z0-9._+-]+(@)[a-zA-Z0-9-_]+(?:\.[a-zA-Z0-9-_]*[a-zA-Z0-9])+(?![\w-])/).getRegex(),_backpedal:/(?:[^?!.,:;*_'"~()&]+|\([^)]*\)|&(?![a-zA-Z0-9]+;$)|[?!.,:;*_'"~)]+(?!$))+/,del:/^(~~?)(?=[^\s~])((?:\\[\s\S]|[^\\])*?(?:\\[\s\S]|[^\s~\\]))\1(?=[^~]|$)/,text:l(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|www\.|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,F).replace(/emailProtocol/g,/(?:mailto|xmpp):/).getRegex()},Ve={...L,br:l(T).replace(`{2,}`,`*`).getRegex(),text:l(L.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},R={normal:C,gfm:le,pedantic:ue},z={normal:I,gfm:L,breaks:Ve,pedantic:Be},He={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#39;`},B=e=>He[e];function V(e,t){if(t){if(d.escapeTest.test(e))return e.replace(d.escapeReplace,B)}else if(d.escapeTestNoEncode.test(e))return e.replace(d.escapeReplaceNoEncode,B);return e}function Ue(e){return d.numericCharacterReference.test(e)?e.replace(d.numericCharacterReferenceOrAmpersand,(e,t,n)=>{if(t===void 0&&n===void 0)return`&amp;`;let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:r===38?`&amp;`:String.fromCodePoint(r)}):e}function We(e){try{e=encodeURI(e).replace(d.percentDecode,`%`)}catch{return null}return e}function Ge(e,t){let n=e.replace(d.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(d.splitPipe),r=0;if(n[0].trim()||n.shift(),n.length>0&&!n.at(-1)?.trim()&&n.pop(),t){if(n.length>t)n.splice(t);else for(;n.length<t;)n.push(``)}for(;r<n.length;r++)n[r]=n[r].trim().replace(d.slashPipe,`|`);return n}function H(e,t,n){let r=e.length;if(r===0)return``;let i=0;for(;i<r;){let a=e.charAt(r-i-1);if(a===t&&!n)i++;else if(a!==t&&n)i++;else break}return e.slice(0,r-i)}function Ke(e){let t=e.split(`
3
- `),n=t.length-1;for(;n>=0&&d.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
4
- `)}function U(e){return e.trim().toLowerCase().toUpperCase().toLowerCase()}function qe(e,t){if(e.indexOf(t[0])===-1&&e.indexOf(t[1])===-1)return-1;let n=0;for(let r=0;r<e.length;r++)if(e[r]===`\\`)r++;else if(e[r]===t[0])n++;else if(e[r]===t[1]&&(n--,n<0))return r;return n>0?-2:-1}function W(e,t=0){let n=t,r=``;for(let t of e)if(t===` `){let e=4-n%4;r+=` `.repeat(e),n+=e}else r+=t,n++;return r}function Je(e,t,n,r,i){let a=t.href,o=t.title||null,s=e[1].replace(i.other.outputLinkReplace,`$1`),c=e[0].charAt(0)===`!`,l=r.state.inLink,u=r.state.linkEmitted,d=r.state.inRawBlock;r.state.inLink=!0,r.state.linkEmitted=!1;let f=r.inlineTokens(s),p=r.state.linkEmitted;if(r.state.linkEmitted=u,r.state.inLink=l,!c){if(p){r.state.inRawBlock=d;return}r.state.linkEmitted=!0}return{type:c?`image`:`link`,raw:n,href:a,title:o,text:s,tokens:f}}function Ye(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
5
- `).map(e=>{let t=e.match(n.other.beginningSpace);if(t===null)return e;let[r]=t;return e.slice(Math.min(r.length,i.length))}).join(`
6
- `)}function Xe(e,t,n,r){if(!t.includes(`<`))return!1;for(let i=0;i<t.length;i++){if(t[i]===`\\`){i++;continue}if(t[i]==="`"){let e=r.inline.code.exec(t.slice(i));if(e){i+=e[0].length-1;continue}}if(t[i]!==`<`)continue;let a=e.slice(n+i),o=r.inline.tag.exec(a)||r.inline.autolink.exec(a);if(o){if(o[0].length>t.length-i)return!0;i+=o[0].length-1}}return!1}var G=class{options;rules;lexer;constructor(e){this.options=e||a}space(e){let t=this.rules.block.newline.exec(e);if(t&&t[0].length>0)return{type:`space`,raw:t[0]}}code(e){let t=this.rules.block.code.exec(e);if(t){let e=this.options.pedantic?t[0]:Ke(t[0]);return{type:`code`,raw:e,codeBlockStyle:`indented`,text:e.replace(this.rules.other.codeRemoveIndent,``)}}}fences(e){let t=this.rules.block.fences.exec(e);if(t){let e=t[0],n=Ye(e,t[3]||``,this.rules);return{type:`code`,raw:e,lang:t[2]?t[2].trim().replace(this.rules.inline.anyPunctuation,`$1`):t[2],text:n}}}heading(e){let t=this.rules.block.heading.exec(e);if(t){let e=t[2].trim();if(this.rules.other.endingHash.test(e)){let t=H(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:H(t[0],`
7
- `),depth:t[1].length,text:e,tokens:this.lexer.inline(e)}}}hr(e){let t=this.rules.block.hr.exec(e);if(t)return{type:`hr`,raw:H(t[0],`
8
- `)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=H(t[0],`
9
- `).split(`
10
- `),n=``,r=``,i=[];for(;e.length>0;){let t=!1,a=[],o=0;for(;o<e.length;o++)if(this.rules.other.blockquoteStart.test(e[o]))a.push(e[o]),t=!0;else if(!t)a.push(e[o]);else break;e=e.slice(o);let s=a.join(`
11
- `),c=s.replace(this.rules.other.blockquoteSetextReplace,`
12
- $1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
13
- ${s}`:s,r=r?`${r}
14
- ${c}`:c;let l=this.lexer.state.top;if(this.lexer.state.top=!0,this.lexer.blockTokens(c,i,!0),this.lexer.state.top=l,e.length===0)break;let u=i.at(-1);if(u?.type===`code`||u?.type===`heading`||u?.type===`hr`||u?.type===`html`)break;if(u?.type===`blockquote`){let t=u,a=e.join(`
15
- `),o=t.raw+`
16
- `+a.replace(this.rules.other.blockquoteSetextReplace2,``),s=this.blockquote(o);i[i.length-1]=s;let c=o.substring(s.raw.length).replace(/^\n/,``),l=c?c.split(`
17
- `).length:0,d=l?e.slice(0,-l):e;d.length>0&&(n=`${n}
18
- ${d.join(`
19
- `)}`),r=r.substring(0,r.length-t.text.length)+s.text;break}if(u?.type===`list`){let t=u,a=t.raw+`
20
- `+e.join(`
21
- `),o=this.list(a);i[i.length-1]=o,n=n.substring(0,n.length-u.raw.length)+o.raw,r=r.substring(0,r.length-t.raw.length)+o.raw,e=a.substring(i.at(-1).raw.length).split(`
22
- `);continue}}return{type:`blockquote`,raw:n,tokens:i,text:r}}}list(e){let t=this.rules.block.list.exec(e);if(t){let n=e,r=()=>n.length-e.length,i=t[1].trim(),a=i.length>1,o={type:`list`,raw:``,ordered:a,start:a?+i.slice(0,-1):``,loose:!1,items:[]};i=a?`\\d{1,9}\\${i.slice(-1)}`:`\\${i}`,this.options.pedantic&&(i=a?i:`[*+-]`);let s=this.rules.other.listItemRegex(i),c=!1;for(;e;){let i=!1,a=``;if(!(t=s.exec(e))||this.rules.block.hr.test(e))break;let l=r();e=e.substring(t[0].length);let u=t[2].split(`
23
- `,1)[0],d=t[1].length,f=this.options.pedantic?W(u,d):u.replace(this.rules.other.leadingSpaceTab,e=>W(e,d)),p=e.split(`
24
- `,1)[0],m=!f.trim(),h=0;if(this.options.pedantic?(h=2,a=f.trimStart()):m?h=d+1:(h=f.search(this.rules.other.nonSpaceChar),h=h>4?1:h,a=f.slice(h),h+=d),m&&this.rules.other.blankLine.test(p)&&(e=e.substring(p.length+1),i=!0),!i){let t=this.rules.other.nextBulletRegex(h),n=this.rules.other.hrRegex(h),r=this.rules.other.fencesBeginRegex(h),i=this.rules.other.headingBeginRegex(h),o=this.rules.other.htmlBeginRegex(h),s=this.rules.other.blockquoteBeginRegex(h);for(;e;){let c=e.split(`
25
- `,1)[0],l;if(p=c,this.options.pedantic?(p=p.replace(this.rules.other.listReplaceNesting,` `),l=p):l=p.replace(this.rules.other.leadingSpaceTab,e=>W(e)),r.test(p)||i.test(p)||o.test(p)||s.test(p)||t.test(p)||n.test(p))break;if(l.search(this.rules.other.nonSpaceChar)>=h||!p.trim())a+=`
26
- `+l.slice(h);else{if(m||f.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||r.test(f)||i.test(f)||n.test(f))break;a+=`
27
- `+p}m=!p.trim(),e=e.substring(c.length+1),f=l.slice(h)}}let g=n.slice(l,r());o.loose||(c?o.loose=!0:this.rules.other.doubleBlankLine.test(g)&&(c=!0)),o.items.push({type:`list_item`,raw:g,task:!!this.options.gfm&&this.rules.other.listIsTask.test(a),loose:!1,text:a,tokens:[]})}let l=o.items.at(-1);if(l)l.raw=l.raw.trimEnd(),l.text=l.text.trimEnd();else return;o.raw=n.slice(0,r()).trimEnd();for(let e of o.items)if(this.lexer.state.top=!1,e.tokens=this.lexer.blockTokens(e.text,[]),!o.loose){let t=e.tokens.filter(e=>e.type===`space`);o.loose=t.length>0&&t.some(e=>this.rules.other.anyLine.test(e.raw))}for(let e of o.items){let t=e.tokens[0];if(e.task&&(t?.type===`text`||t?.type===`paragraph`)){e.text=e.text.replace(this.rules.other.listReplaceTask,``),t.raw=t.raw.replace(this.rules.other.listReplaceTask,``),t.text=t.text.replace(this.rules.other.listReplaceTask,``);for(let e=this.lexer.inlineQueue.length-1;e>=0;e--)if(this.rules.other.listIsTask.test(this.lexer.inlineQueue[e].src)){this.lexer.inlineQueue[e].src=this.lexer.inlineQueue[e].src.replace(this.rules.other.listReplaceTask,``);break}let n=this.rules.other.listTaskCheckbox.exec(e.raw);if(n){let t={type:`checkbox`,raw:n[0]+` `,checked:n[0]!==`[ ]`};e.checked=t.checked,o.loose?e.tokens[0]&&[`paragraph`,`text`].includes(e.tokens[0].type)&&`tokens`in e.tokens[0]&&e.tokens[0].tokens?(e.tokens[0].raw=t.raw+e.tokens[0].raw,e.tokens[0].text=t.raw+e.tokens[0].text,e.tokens[0].tokens.unshift(t)):e.tokens.unshift({type:`paragraph`,raw:t.raw,text:t.raw,tokens:[t]}):e.tokens.unshift(t)}}else e.task&&=!1}if(o.loose)for(let e of o.items){e.loose=!0;for(let t of e.tokens)t.type===`text`&&(t.type=`paragraph`)}return o}}html(e){let t=this.rules.block.html.exec(e);if(t){let e=Ke(t[0]);return{type:`html`,block:!0,raw:e,pre:t[1]===`pre`||t[1]===`script`||t[1]===`style`,text:e}}}def(e){let t=this.rules.block.def.exec(e);if(t){if(!this.rules.other.startAngleBracket.test(t[2])&&qe(t[2],`()`)!==-1)return;let e=U(t[1]).replace(this.rules.other.multipleSpaceGlobal,` `),n=t[2]?t[2].replace(this.rules.other.hrefBrackets,`$1`).replace(this.rules.inline.anyPunctuation,`$1`):``,r=t[3]?t[3].substring(1,t[3].length-1).replace(this.rules.inline.anyPunctuation,`$1`):t[3];return{type:`def`,tag:e,raw:H(t[0],`
28
- `),href:n,title:r}}}table(e){let t=this.rules.block.table.exec(e);if(!t||!this.rules.other.tableDelimiter.test(t[2]))return;let n=Ge(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
29
- `):[],a={type:`table`,raw:H(t[0],`
30
- `),header:[],align:[],rows:[]};if(n.length===r.length){for(let e of r)this.rules.other.tableAlignRight.test(e)?a.align.push(`right`):this.rules.other.tableAlignCenter.test(e)?a.align.push(`center`):this.rules.other.tableAlignLeft.test(e)?a.align.push(`left`):a.align.push(null);for(let e=0;e<n.length;e++)a.header.push({text:n[e],tokens:this.lexer.inline(n[e]),header:!0,align:a.align[e]});for(let e of i)a.rows.push(Ge(e,a.header.length).map((e,t)=>({text:e,tokens:this.lexer.inline(e),header:!1,align:a.align[t]})));return a}}lheading(e){let t=this.rules.block.lheading.exec(e);if(t){let e=t[1].trim();return{type:`heading`,raw:H(t[0],`
31
- `),depth:t[2].charAt(0)===`=`?1:2,text:e,tokens:this.lexer.inline(e)}}}paragraph(e){let t=this.rules.block.paragraph.exec(e);if(t){let e=t[1].charAt(t[1].length-1)===`
32
- `?t[1].slice(0,-1):t[1];return{type:`paragraph`,raw:t[0],text:e,tokens:this.lexer.inline(e)}}}text(e){let t=this.rules.block.text.exec(e);if(t)return{type:`text`,raw:t[0],text:t[0],tokens:this.lexer.inline(t[0])}}escape(e){let t=this.rules.inline.escape.exec(e);if(t)return{type:`escape`,raw:t[0],text:t[1]}}tag(e){let t=this.rules.inline.tag.exec(e);if(t)return!this.lexer.state.inLink&&this.rules.other.startATag.test(t[0])?this.lexer.state.inLink=!0:this.lexer.state.inLink&&this.rules.other.endATag.test(t[0])&&(this.lexer.state.inLink=!1),!this.lexer.state.inRawBlock&&this.rules.other.startPreScriptTag.test(t[0])?this.lexer.state.inRawBlock=!0:this.lexer.state.inRawBlock&&this.rules.other.endPreScriptTag.test(t[0])&&(this.lexer.state.inRawBlock=!1),{type:`html`,raw:t[0],inLink:this.lexer.state.inLink,inRawBlock:this.lexer.state.inRawBlock,block:!1,text:t[0]}}link(e){if(this.lexer.state.linkParenPossible===!1)return;let t=this.rules.inline.link.exec(e);if(t){let n=t[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&Xe(e,t[1],n,this.rules))return;let r=t[2].trim();if(!this.options.pedantic&&this.rules.other.startAngleBracket.test(r)){if(!this.rules.other.endAngleBracket.test(r))return;let e=H(r.slice(0,-1),`\\`);if((r.length-e.length)%2==0)return}else{let e=qe(t[2],`()`);if(e===-2)return;if(e>-1){let n=(t[0].indexOf(`!`)===0?5:4)+t[1].length+e;t[2]=t[2].substring(0,e),t[0]=t[0].substring(0,n).trim(),t[3]=``}}let i=t[2],a=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(i);e&&(i=e[1],a=e[3])}else a=t[3]?t[3].slice(1,-1):``;return i=i.trim(),this.rules.other.startAngleBracket.test(i)&&(i=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?i.slice(1):i.slice(1,-1)),Je(t,{href:i&&i.replace(this.rules.inline.anyPunctuation,`$1`),title:a&&a.replace(this.rules.inline.anyPunctuation,`$1`)},t[0],this.lexer,this.rules)}}reflink(e,t){let n;if((n=this.rules.inline.reflink.exec(e))||(n=this.rules.inline.nolink.exec(e))){let r=n[0].charAt(0)===`!`?2:1;if(!this.options.pedantic&&Xe(e,n[1],r,this.rules))return;let i=t[U((n[2]||n[1]).replace(this.rules.other.multipleSpaceGlobal,` `))];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return Je(n,i,n[0],this.lexer,this.rules)}}emStrong(e,t,n=``){let r=this.rules.inline.emStrongLDelim.exec(e);if(!(!r||!r[1]&&!r[2]&&!r[3]&&!r[4]||r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))&&(!(r[1]||r[3])||!n||this.rules.inline.punctuation.exec(n))){let i=[...r[0]].length-1,a,o,s=i,c=0,l=r[0][0],u=n===l,d=l===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd;for(d.lastIndex=0,t=t.slice(-1*e.length+i);(r=d.exec(t))!==null;){if(a=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!a)continue;if(o=[...a].length,r[3]||r[4]){s+=o;continue}if(r[5]||r[6]){if(i%3&&!((i+o)%3)){c+=o;continue}if(u)break}if(s-=o,s>0)continue;o=Math.min(o,o+s+c);let t=[...r[0]][0].length,n=e.slice(0,i+r.index+t+o);if(Math.min(i,o)%2){let e=n.slice(1,-1);return{type:`em`,raw:n,text:e,tokens:this.lexer.inlineTokens(e)}}let l=n.slice(2,-2);return{type:`strong`,raw:n,text:l,tokens:this.lexer.inlineTokens(l)}}}}codespan(e){let t=this.rules.inline.code.exec(e);if(t){let e=t[2].replace(this.rules.other.newLineCharGlobal,` `),n=this.rules.other.nonSpaceChar.test(e),r=this.rules.other.startingSpaceChar.test(e)&&this.rules.other.endingSpaceChar.test(e);return n&&r&&(e=e.substring(1,e.length-1)),{type:`codespan`,raw:t[0],text:e}}}br(e){let t=this.rules.inline.br.exec(e);if(t)return{type:`br`,raw:t[0]}}del(e,t,n=``){let r=this.rules.inline.delLDelim.exec(e);if(r&&(!r[1]||!n||this.rules.inline.punctuation.exec(n))){let n=[...r[0]].length-1,i,a,o=n,s=this.rules.inline.delRDelim;for(s.lastIndex=0,t=t.slice(-1*e.length+n);(r=s.exec(t))!==null;){if(i=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!i||(a=[...i].length,a!==n))continue;if(r[3]||r[4]){o+=a;continue}if(o-=a,o>0)continue;a=Math.min(a,a+o);let t=[...r[0]][0].length,s=e.slice(0,n+r.index+t+a),c=s.slice(n,-n);return{type:`del`,raw:s,text:c,tokens:this.lexer.inlineTokens(c)}}}}autolink(e){let t=this.rules.inline.autolink.exec(e);if(t){let e,n;return t[2]===`@`?(e=t[1],n=`mailto:`+e):(e=t[1],n=e),{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}url(e){let t;if(t=this.rules.inline.url.exec(e)){let e,n;if(t[2]===`@`)e=t[0],n=`mailto:`+e;else{let r;do r=t[0],t[0]=this.rules.inline._backpedal.exec(t[0])?.[0]??``;while(r!==t[0]);e=t[0],n=t[1]===`www.`?`http://`+t[0]:t[0]}return{type:`link`,raw:t[0],text:e,href:n,autolink:!0,tokens:[{type:`text`,raw:e,text:e}]}}}inlineText(e){let t=this.rules.inline.text.exec(e);if(t){let e=this.lexer.state.inRawBlock;return{type:`text`,raw:t[0],text:e?t[0]:Ue(t[0]),escaped:e}}}},K=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||a,this.options.tokenizer=this.options.tokenizer||new G,this.tokenizer=this.options.tokenizer,this.tokenizer.options=this.options,this.tokenizer.lexer=this,this.inlineQueue=[],this.state={inLink:!1,inRawBlock:!1,linkEmitted:!1,linkParenPossible:!0,top:!0};let t={other:d,block:R.normal,inline:z.normal};this.options.pedantic?(t.block=R.pedantic,t.inline=z.pedantic):this.options.gfm&&(t.block=R.gfm,t.inline=this.options.breaks?z.breaks:z.gfm),this.tokenizer.rules=t}static get rules(){return{block:R,inline:z}}static lex(t,n){return new e(n).lex(t)}static lexInline(t,n){return new e(n).inlineTokens(t)}lex(e){e=e.replace(d.carriageReturn,`
33
- `),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.inlineTokens(t.src,t.tokens)}return this.inlineQueue=[],this.tokens}blockTokens(e,t=[],n=!1){this.tokenizer.lexer=this,this.options.pedantic&&(e=e.replace(d.tabCharGlobal,` `).replace(d.spaceLine,``));let r=1/0;for(;e;){if(e.length<r)r=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}let i;if(this.options.extensions?.block?.some(n=>(i=n.call({lexer:this},e,t))?(e=e.substring(i.raw.length),t.push(i),!0):!1))continue;if(i=this.tokenizer.space(e)){e=e.substring(i.raw.length);let n=t.at(-1);i.raw.length===1&&n!==void 0?n.raw+=`
34
- `:t.push(i);continue}if(i=this.tokenizer.code(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
35
- `)?``:`
36
- `)+i.raw,n.text+=`
37
- `+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(i=this.tokenizer.fences(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.heading(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.hr(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.blockquote(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.list(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.html(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.def(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`paragraph`||n?.type===`text`?(n.raw+=(n.raw.endsWith(`
38
- `)?``:`
39
- `)+i.raw,n.text+=`
40
- `+i.raw,this.inlineQueue.at(-1).src=n.text):this.tokens.links[i.tag]||(this.tokens.links[i.tag]={href:i.href,title:i.title},t.push(i));continue}if(i=this.tokenizer.table(e)){e=e.substring(i.raw.length),t.push(i);continue}if(i=this.tokenizer.lheading(e)){e=e.substring(i.raw.length),t.push(i);continue}let a=e;if(this.options.extensions?.startBlock){let t=1/0,n=e.slice(1),r;this.options.extensions.startBlock.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(a=e.substring(0,t+1))}if(this.state.top&&(i=this.tokenizer.paragraph(a))){let r=t.at(-1);n&&r?.type===`paragraph`?(r.raw+=(r.raw.endsWith(`
41
- `)?``:`
42
- `)+i.raw,r.text+=`
43
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=r.text):t.push(i),n=a.length!==e.length,e=e.substring(i.raw.length);continue}if(i=this.tokenizer.text(e)){e=e.substring(i.raw.length);let n=t.at(-1);n?.type===`text`?(n.raw+=(n.raw.endsWith(`
44
- `)?``:`
45
- `)+i.raw,n.text+=`
46
- `+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return this.state.top=!0,t}inline(e,t=[]){return this.inlineQueue.push({src:e,tokens:t}),t}linkInText(e){if(!e.includes(`[`))return!1;let t=this.tokenizer.rules.inline.link;for(let n of e.matchAll(this.tokenizer.rules.inline.blockSkip))if(t.test(n[0])&&e.charAt(n.index-1)!==`!`)return!0;for(let t of e.matchAll(this.tokenizer.rules.inline.reflinkSearch)){let e=t[0],n=e.lastIndexOf(`[`);if(e.charAt(0)!==`!`&&Object.hasOwn(this.tokens.links,U(e.slice(n+1,-1)))&&!(n>1&&this.linkInText(e.slice(1,n-1))))return!0}return!1}inlineTokens(e,t=[]){this.tokenizer.lexer=this;let n=this.state.linkParenPossible;this.state.linkParenPossible=n&&e.includes(`)`);try{return this.#e(e,t)}finally{this.state.linkParenPossible=n}}#e(e,t){let n=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,t=n=>{let r=n.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,U(n.slice(r+1,-1))))return n;if(r>1&&n.charAt(0)!==`!`){let i=n.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,t)+`][`+`a`.repeat(n.length-r-2)+`]`}return`[`+`a`.repeat(n.length-2)+`]`};n=n.replace(e,t)}n=n.replace(this.tokenizer.rules.inline.anyPunctuationOutsideCode,(e,t,n)=>n?`+`.repeat(e.length):t?t+e.slice(t.length,-t.length).replace(/`/g,`+`)+t:e),n=n.replace(this.tokenizer.rules.inline.blockSkip,(e,t,n)=>{let r=n?n.length:0;return e.slice(0,r)+`[`+`a`.repeat(e.length-r-2)+`]`}),n=this.options.hooks?.emStrongMask?.call({lexer:this},n)??n;let r=!1,i=``,a=1/0;for(;e;){if(e.length<a)a=e.length;else{this.infiniteLoopError(e.charCodeAt(0));break}r||(i=``),r=!1;let o;if(this.options.extensions?.inline?.some(n=>(o=n.call({lexer:this},e,t))?(e=e.substring(o.raw.length),t.push(o),!0):!1))continue;if(o=this.tokenizer.escape(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.tag(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.link(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let n=t.at(-1);o.type===`text`&&n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(o=this.tokenizer.emStrong(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.codespan(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.br(e)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.del(e,n,i)){e=e.substring(o.raw.length),t.push(o);continue}if(o=this.tokenizer.autolink(e)){e=e.substring(o.raw.length),t.push(o);continue}if(!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),t.push(o);continue}let s=e;if(this.options.extensions?.startInline){let t=1/0,n=e.slice(1),r;this.options.extensions.startInline.forEach(e=>{r=e.call({lexer:this},n),typeof r==`number`&&r>=0&&(t=Math.min(t,r))}),t<1/0&&t>=0&&(s=e.substring(0,t+1))}if(o=this.tokenizer.inlineText(s)){e=e.substring(o.raw.length),o.raw.slice(-1)!==`_`&&(i=o.raw.slice(-1)),r=!0;let n=t.at(-1);n?.type===`text`?(n.raw+=o.raw,n.text+=o.text):t.push(o);continue}if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},q=class{options;parser;constructor(e){this.options=e||a}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(d.notSpaceStart)?.[0],i=e?e.replace(d.endingNewline,``)+`
47
- `:``;return r?`<pre><code class="language-`+V(r)+`">`+(n?i:V(i,!0))+`</code></pre>
48
- `:`<pre><code>`+(n?i:V(i,!0))+`</code></pre>
49
- `}blockquote({tokens:e}){return`<blockquote>
50
- ${this.parser.parse(e)}</blockquote>
51
- `}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
52
- `}hr(e){return`<hr>
53
- `}list(e){let t=e.ordered,n=e.start,r=``;for(let t=0;t<e.items.length;t++){let n=e.items[t];r+=this.listitem(n)}let i=t?`ol`:`ul`,a=t&&n!==1?` start="`+n+`"`:``;return`<`+i+a+`>
54
- `+r+`</`+i+`>
55
- `}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
56
- `}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
57
- `}table(e){let t=``,n=``;for(let t=0;t<e.header.length;t++)n+=this.tablecell(e.header[t]);t+=this.tablerow({text:n});let r=``;for(let t=0;t<e.rows.length;t++){let i=e.rows[t];n=``;for(let e=0;e<i.length;e++)n+=this.tablecell(i[e]);r+=this.tablerow({text:n})}return r&&=`<tbody>${r}</tbody>`,`<table>
58
- <thead>
59
- `+t+`</thead>
60
- `+r+`</table>
61
- `}tablerow({text:e}){return`<tr>
62
- ${e}</tr>
63
- `}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
64
- `}strong({tokens:e}){return`<strong>${this.parser.parseInline(e)}</strong>`}em({tokens:e}){return`<em>${this.parser.parseInline(e)}</em>`}codespan({text:e}){return`<code>${V(e,!0)}</code>`}br(e){return`<br>`}del({tokens:e}){return`<del>${this.parser.parseInline(e)}</del>`}link({href:e,title:t,text:n,tokens:r,autolink:i}){let a=i?V(n,!0):this.parser.parseInline(r),o=We(e);if(o===null)return a;e=V(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+V(t)+`"`),s+=`>`+a+`</a>`,s}image({href:e,title:t,text:n,tokens:r}){r&&(n=this.parser.parseInline(r,this.parser.textRenderer));let i=We(e);if(i===null)return V(n);e=i;let a=`<img src="${V(e)}" alt="${V(n)}"`;return t&&(a+=` title="${V(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:V(e.text)}},J=class{strong({text:e}){return e}em({text:e}){return e}codespan({text:e}){return e}del({text:e}){return e}html({text:e}){return e}text({text:e}){return e}link({text:e}){return``+e}image({text:e}){return``+e}br(){return``}checkbox({raw:e}){return e}},Y=class e{options;renderer;textRenderer;constructor(e){this.options=e||a,this.options.renderer=this.options.renderer||new q,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new J}static parse(t,n){return new e(n).parse(t)}static parseInline(t,n){return new e(n).parseInline(t)}parse(e){this.renderer.parser=this;let t=``;for(let n=0;n<e.length;n++){let r=e[n];if(this.options.extensions?.renderers?.[r.type]){let e=r,n=this.options.extensions.renderers[e.type].call({parser:this},e);if(n!==!1||![`space`,`hr`,`heading`,`code`,`table`,`blockquote`,`list`,`checkbox`,`html`,`def`,`paragraph`,`text`].includes(e.type)){t+=n||``;continue}}let i=r;switch(i.type){case`space`:t+=this.renderer.space(i);break;case`hr`:t+=this.renderer.hr(i);break;case`heading`:t+=this.renderer.heading(i);break;case`code`:t+=this.renderer.code(i);break;case`table`:t+=this.renderer.table(i);break;case`blockquote`:t+=this.renderer.blockquote(i);break;case`list`:t+=this.renderer.list(i);break;case`checkbox`:t+=this.renderer.checkbox(i);break;case`html`:t+=this.renderer.html(i);break;case`def`:t+=this.renderer.def(i);break;case`paragraph`:t+=this.renderer.paragraph(i);break;case`text`:t+=this.renderer.text(i);break;default:{let e=`Token with "`+i.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return t}parseInline(e,t=this.renderer){this.renderer.parser=this;let n=``;for(let r=0;r<e.length;r++){let i=e[r];if(this.options.extensions?.renderers?.[i.type]){let e=this.options.extensions.renderers[i.type].call({parser:this},i);if(e!==!1||![`escape`,`html`,`link`,`image`,`checkbox`,`strong`,`em`,`codespan`,`br`,`del`,`text`].includes(i.type)){n+=e||``;continue}}let a=i;switch(a.type){case`escape`:n+=t.text(a);break;case`html`:n+=t.html(a);break;case`link`:n+=t.link(a);break;case`image`:n+=t.image(a);break;case`checkbox`:n+=t.checkbox(a);break;case`strong`:n+=t.strong(a);break;case`em`:n+=t.em(a);break;case`codespan`:n+=t.codespan(a);break;case`br`:n+=t.br(a);break;case`del`:n+=t.del(a);break;case`text`:n+=t.text(a);break;default:{let e=`Token with "`+a.type+`" type was not found.`;if(this.options.silent)return console.error(e),``;throw Error(e)}}}return n}},X=class{options;block;constructor(e){this.options=e||a}static passThroughHooks=new Set([`preprocess`,`postprocess`,`processAllTokens`,`emStrongMask`]);static passThroughHooksRespectAsync=new Set([`preprocess`,`postprocess`,`processAllTokens`]);preprocess(e){return e}postprocess(e){return e}processAllTokens(e){return e}emStrongMask(e){return e}provideLexer(e=this.block){return e?K.lex:K.lexInline}provideParser(e=this.block){return e?Y.parse:Y.parseInline}};function Z(e,t){if(Array.isArray(t))for(let n=0;n<t.length;n++)e.push(t[n]);else e.push(t)}var Q=new class{defaults=i();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=Y;Renderer=q;TextRenderer=J;Lexer=K;Tokenizer=G;Hooks=X;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(Z(n,t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)Z(n,this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)Z(n,this.walkTokens(e.tokens,t));break}case`list`:{let e=r;Z(n,this.walkTokens(e.items,t));break}default:{let e=r;this.defaults.extensions?.childTokens?.[e.type]?this.defaults.extensions.childTokens[e.type].forEach(r=>{let i=e[r].flat(1/0);Z(n,this.walkTokens(i,t))}):e.tokens&&Z(n,this.walkTokens(e.tokens,t))}}return n}use(...e){let t=this.defaults.extensions||{renderers:{},childTokens:{}};return e.forEach(e=>{let n={...e};if(n.async=this.defaults.async||n.async||!1,e.extensions&&(e.extensions.forEach(e=>{if(!e.name)throw Error(`extension name required`);if(`renderer`in e){let n=t.renderers[e.name];n?t.renderers[e.name]=function(...t){let r=e.renderer.apply(this,t);return r===!1&&(r=n.apply(this,t)),r}:t.renderers[e.name]=e.renderer}if(`tokenizer`in e){if(!e.level||e.level!==`block`&&e.level!==`inline`)throw Error(`extension level must be 'block' or 'inline'`);let n=t[e.level];n?n.unshift(e.tokenizer):t[e.level]=[e.tokenizer],e.start&&(e.level===`block`?t.startBlock?t.startBlock.push(e.start):t.startBlock=[e.start]:e.level===`inline`&&(t.startInline?t.startInline.push(e.start):t.startInline=[e.start]))}`childTokens`in e&&e.childTokens&&(t.childTokens[e.name]=e.childTokens)}),n.extensions=t),e.renderer){let t=this.defaults.renderer||new q(this.defaults);for(let n in e.renderer){if(!(n in t))throw Error(`renderer '${n}' does not exist`);if([`options`,`parser`].includes(n))continue;let r=n,i=e.renderer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n||``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new G(this.defaults);for(let n in e.tokenizer){if(!(n in t))throw Error(`tokenizer '${n}' does not exist`);if([`options`,`rules`,`lexer`].includes(n))continue;let r=n,i=e.tokenizer[r],a=t[r];t[r]=(...e)=>{let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.tokenizer=t}if(e.hooks){let t=this.defaults.hooks||new X;for(let n in e.hooks){if(!(n in t))throw Error(`hook '${n}' does not exist`);if([`options`,`block`].includes(n))continue;let r=n,i=e.hooks[r],a=t[r];t[r]=X.passThroughHooks.has(n)?e=>{if(this.defaults.async&&X.passThroughHooksRespectAsync.has(n))return(async()=>{let n=await i.call(t,e);return a.call(t,n)})();let r=i.call(t,e);return a.call(t,r)}:(...e)=>{if(this.defaults.async)return(async()=>{let n=await i.apply(t,e);return n===!1&&(n=await a.apply(t,e)),n})();let n=i.apply(t,e);return n===!1&&(n=a.apply(t,e)),n}}n.hooks=t}if(e.walkTokens){let t=this.defaults.walkTokens,r=e.walkTokens;n.walkTokens=function(e){let n=[];return n.push(r.call(this,e)),t&&Z(n,t.call(this,e)),n}}this.defaults={...this.defaults,...n}}),this}setOptions(e){return this.defaults={...this.defaults,...e},this}lexer(e,t){return K.lex(e,t??this.defaults)}parser(e,t){return Y.parse(e,t??this.defaults)}parseMarkdown(e){return(t,n)=>{let r={...n},i={...this.defaults,...r},a=this.onError(!!i.silent,!!i.async);if(this.defaults.async===!0&&r.async===!1)return a(Error(`marked(): The async option was set to true by an extension. Remove async: false from the parse options object to return a Promise.`));if(typeof t>`u`||t===null)return a(Error(`marked(): input parameter is undefined or null`));if(typeof t!=`string`)return a(Error(`marked(): input parameter is of type `+Object.prototype.toString.call(t)+`, string expected`));if(i.hooks&&(i.hooks.options=i,i.hooks.block=e),i.async)return(async()=>{let n=i.hooks?await i.hooks.preprocess(t):t,r=await(i.hooks?await i.hooks.provideLexer(e):e?K.lex:K.lexInline)(n,i),a=i.hooks?await i.hooks.processAllTokens(r):r;i.walkTokens&&await Promise.all(this.walkTokens(a,i.walkTokens));let o=await(i.hooks?await i.hooks.provideParser(e):e?Y.parse:Y.parseInline)(a,i);return i.hooks?await i.hooks.postprocess(o):o})().catch(a);try{i.hooks&&(t=i.hooks.preprocess(t));let n=(i.hooks?i.hooks.provideLexer(e):e?K.lex:K.lexInline)(t,i);i.hooks&&(n=i.hooks.processAllTokens(n)),i.walkTokens&&this.walkTokens(n,i.walkTokens);let r=(i.hooks?i.hooks.provideParser(e):e?Y.parse:Y.parseInline)(n,i);return i.hooks&&(r=i.hooks.postprocess(r)),r}catch(e){return a(e)}}}onError(e,t){return n=>{if(n.message+=`
65
- Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+V(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function $(e,t){return Q.parse(e,t)}$.options=$.setOptions=function(e){return Q.setOptions(e),$.defaults=Q.defaults,o($.defaults),$},$.getDefaults=i,$.defaults=a;function Ze(...e){return Q.use(...e),$.defaults=Q.defaults,o($.defaults),$}$.use=Ze,$.walkTokens=function(e,t){return Q.walkTokens(e,t)},$.parseInline=Q.parseInline,$.Parser=Y,$.parser=Y.parse,$.Renderer=q,$.TextRenderer=J,$.Lexer=K,$.lexer=K.lex,$.Tokenizer=G,$.Hooks=X,$.parse=$,$.options,$.setOptions,$.walkTokens,$.parseInline,Y.parse,K.lex;var Qe=n(),$e=new Set([`script`,`style`,`iframe`,`frame`,`frameset`,`object`,`embed`,`link`,`meta`,`base`,`form`,`template`,`animate`,`set`,`animatemotion`,`animatetransform`,`discard`,`animatecolor`,`xmp`,`noembed`,`noframes`,`noscript`,`plaintext`]),et=new Set([`href`,`src`,`xlink:href`,`action`,`formaction`,`poster`,`background`]),tt=new Set([`http`,`https`,`mailto`]);function nt(e){let t=/^([a-z][a-z0-9+.-]*):/.exec(e.replace(/[\u0000- ]/g,``).toLowerCase());return!t||tt.has(t[1])}function rt(e){for(let t=0;t<4;t++){let t=it(e);if(t===e)return t;e=t}return``}function it(e){let t=document.createElement(`template`);return t.innerHTML=e,t.content.querySelectorAll(`*`).forEach(e=>{if($e.has(e.localName.toLowerCase()))return e.remove();for(let{name:t,value:n}of[...e.attributes]){let r=t.toLowerCase();(r.startsWith(`on`)||r===`srcdoc`||r===`style`||et.has(r)&&!nt(n))&&e.removeAttribute(t)}}),t.innerHTML}function at(e,t=[]){let n=new Map(t.map(e=>[e.label,e])),r=(e||``).replace(/\[\[([^\]]+)\]\]/g,(e,t)=>{let r=n.get(t.trim());return r?`[${r.label}](#/item/${r.type}/${encodeURIComponent(r.name)})`:e});return rt($.parse(r,{breaks:!1}))}var ot=[];function st({body:e,links:t=ot}){let n=(0,r.useMemo)(()=>at(e,t),[e,t]);return(0,Qe.jsx)(`div`,{className:`markdown`,dangerouslySetInnerHTML:{__html:n}})}export{$ as i,at as n,rt as r,st as t};
@@ -1,2 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./api-LvBC0CnK.js";import{H as i,J as a,Q as o,R as s,W as c,Y as l,Z as u,bt as d,pt as f,xt as p}from"./index-DhNNxhfg.js";import{t as m}from"./EmptyState-1sPNleqv.js";import{t as h}from"./Markdown-DpmmtW2Y.js";import{t as g}from"./Tabs-DaExAgql.js";import _ from"./Library-t3KocV0-.js";var v=e(t(),1),y=e=>e(`Discard your unsaved edit?`,{title:`Unsaved edit`,confirmLabel:`Discard`,tone:`danger`}),b=`The file changed on disk — reloaded the fresh copy. Your draft is kept.`;function x({data:e,reload:t}){let n=o(),[r,i]=(0,v.useState)(null),[a,s]=(0,v.useState)(null),[c,l]=(0,v.useState)(!1),[u,f]=(0,v.useState)(``),m=e?.fingerprint||``,h=r!==null&&JSON.stringify(r)!==JSON.stringify(a),g=(0,v.useRef)(!1),_=e=>{i(e),s(e)},x=()=>i(null);return(0,v.useEffect)(()=>{if(!h)return;let e=e=>{e.preventDefault(),e.returnValue=``};window.addEventListener(`beforeunload`,e);let t=p(({to:e})=>(g.current||(g.current=!0,y(n).then(n=>{n&&(t(),i(null),d(e))}).finally(()=>{g.current=!1})),!1));return()=>{window.removeEventListener(`beforeunload`,e),t()}},[h,n]),{draft:r,setDraft:i,open:_,close:x,discard:async()=>h&&!await y(n)?!1:(x(),!0),dirty:h,busy:c,notice:u,setNotice:f,save:async(e,{conflict:n}={})=>{l(!0),f(``);try{return await e(m)||!0}catch(e){e.status===409?f(n??b):f(e.message);return}finally{l(!1),t()}}}}var S=n(),C={title:``,body:``,scope:`project`,trial_until:``},w=[`project`,`global`],T=e=>e===`user`?`global`:e,E=/\r\n|[\n\r\v\f\x1c\x1d\x1e\x85\u2028\u2029]/,D=e=>e.startsWith(`## `)||/^##\s+R\d+\s*[—–-]+\s*\S/.test(e),O=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Your draft is kept — Save again.`,k=`user-rules.md changed on disk (an agent session?) — reloaded the fresh copy. Try again.`;function A({value:e,onChange:t,onCancel:n,onSave:r,busy:i}){let[a]=(0,v.useState)(e.scope),o=n=>r=>t({...e,[n]:r.target.value}),s=e.body.trim().split(E).some(D)?`A line cannot start with “## ” — user-rules.md reads it as a new rule heading. Use ### or plain text.`:``,c=!(e.title.trim()&&e.body.trim()),l=!c&&!s;return(0,S.jsxs)(`div`,{className:`rule-form`,children:[(0,S.jsxs)(`label`,{className:`field`,children:[(0,S.jsx)(`span`,{children:`Rule title`}),(0,S.jsx)(`input`,{className:`lib-filter`,type:`text`,value:e.title,onChange:o(`title`),placeholder:`Title — short and imperative (e.g. No emoji in commit subjects)`,autoFocus:!0})]}),(0,S.jsxs)(`label`,{className:`field`,children:[(0,S.jsx)(`span`,{children:`Rule body`}),(0,S.jsx)(`textarea`,{className:`rule-body-input`,value:e.body,onChange:o(`body`),rows:4,placeholder:`The rule, stated plainly and testably, in one short paragraph.`,"aria-invalid":s?!0:void 0,"aria-describedby":s?`rule-body-error`:void 0})]}),s?(0,S.jsx)(`p`,{id:`rule-body-error`,className:`sub rule-notice`,role:`alert`,children:s}):null,(0,S.jsxs)(`div`,{className:`row wrap`,children:[(0,S.jsxs)(`label`,{className:`field`,children:[(0,S.jsx)(`span`,{children:`Rule scope`}),(0,S.jsxs)(`select`,{className:`sel`,value:e.scope,onChange:o(`scope`),children:[(0,S.jsx)(`option`,{value:`project`,children:`scope: project (this repo, committable)`}),(0,S.jsx)(`option`,{value:`global`,children:`scope: global (every repository)`}),w.includes(a)?null:(0,S.jsxs)(`option`,{value:a,children:[`scope: `,a,` (as written in the file)`]})]})]}),(0,S.jsxs)(`label`,{className:`rule-trial-label`,children:[`trial until`,(0,S.jsx)(`input`,{className:`lib-filter rule-date`,type:`date`,value:e.trial_until,onChange:o(`trial_until`),"aria-label":`Trial until date (optional)`})]}),(0,S.jsxs)(`div`,{className:`row gap-8`,style:{marginLeft:`auto`},children:[(0,S.jsx)(`button`,{className:`btn sm`,disabled:!l||i,onClick:()=>r(e),"aria-describedby":c?`rule-form-hint`:void 0,children:i?`Saving…`:`Save rule`}),(0,S.jsx)(`button`,{className:`btn ghost sm`,disabled:i,onClick:n,children:`Cancel`})]})]}),c?(0,S.jsx)(`p`,{id:`rule-form-hint`,className:`panel-note`,children:`A rule needs a title and a body.`}):null]})}function j({rule:e,isOpen:t,onToggle:n,onEdit:r,onDelete:i,onGraduate:a}){return(0,S.jsxs)(`div`,{className:`rule-row ${t?`on`:``}`,children:[(0,S.jsxs)(`button`,{className:`rule-head`,onClick:n,"aria-expanded":t,"data-rule-head":e.id,children:[(0,S.jsxs)(`span`,{className:`rule-no`,children:[`R`,e.id]}),(0,S.jsx)(`span`,{className:`rule-title`,children:e.title}),(0,S.jsx)(`span`,{className:`rule-chip ${e.scope===`user`?`user`:``}`,children:e.scope}),e.status===`trial`&&(0,S.jsx)(`span`,{className:`rule-chip trial ${e.overdue?`overdue`:``}`,children:e.overdue?`review due`:`trial · ${e.trial_until}`})]}),t&&(0,S.jsxs)(`div`,{className:`rule-expand`,children:[(0,S.jsx)(`p`,{children:e.body}),e.source?(0,S.jsxs)(`div`,{className:`rule-src`,children:[`source: `,e.source]}):null,(0,S.jsxs)(`div`,{className:`row gap-8`,style:{marginTop:10},children:[e.status===`trial`&&(0,S.jsx)(`button`,{className:`btn ghost sm`,onClick:a,title:`Adopt for good — drop the trial marker`,"aria-label":`Graduate R${e.id}`,children:`Graduate`}),(0,S.jsx)(`button`,{className:`btn ghost sm`,onClick:r,"aria-label":`Edit R${e.id}`,children:`Edit`}),(0,S.jsx)(`button`,{className:`btn ghost sm`,onClick:i,"aria-label":`Retire R${e.id}`,children:`Retire`})]})]})]})}function M({onChanged:e}){let t=o(),[n,i]=(0,v.useState)(0),{data:s,error:c}=f(()=>r.rules(),[n]),[u,d]=(0,v.useState)(null),p=()=>i(e=>e+1),h=x({data:s,reload:p}),{draft:g,busy:_,notice:y}=h,b=(0,v.useRef)(null),[w,E]=(0,v.useState)(0),D=e=>{b.current=e,E(e=>e+1)},M=(0,v.useRef)(null),N=(0,v.useRef)(null);if((0,v.useEffect)(()=>{let e=b.current;b.current=null,e!==null&&(e===`add`?M.current:N.current?.querySelector(`[data-rule-head="${e}"]`))?.focus()},[w]),c)return(0,S.jsx)(a,{error:c,onRetry:p});if(!s)return(0,S.jsx)(l,{});let P=s.rules||[],F=g?.target,I=F!==void 0&&F!==`new`&&!P.some(e=>e.id===F&&e.title===g.title0),L=F===`new`||I,R=async(t,n)=>{let i=await h.save(e=>r.rulesMutate({...t,fingerprint:e}),{conflict:n?O:k});return i&&n&&h.close(),e?.(),i},z=e=>h.setDraft({...g,form:e}),B=async(e,t)=>{await R(e,!0)&&D(t)},V=async e=>{await h.discard()&&D(e)},H=async e=>{await t(`Retire rule R${e.id} — “${e.title}”? It moves to user-rules-retired.md, which is never loaded.`,{title:`Retire this rule?`,confirmLabel:`Retire`,tone:`danger`})&&await R({op:`delete`,id:e.id})&&g===null&&D(`add`)},U=async e=>{await R({op:`update`,id:e.id,title:e.title,body:e.body,scope:e.scope,source:e.source,trial_until:``})&&D(e.id)};return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`div`,{className:`eyebrow`,children:`governance · yours`}),(0,S.jsx)(`h2`,{className:`h`,children:`Rules`}),(0,S.jsxs)(`p`,{className:`sub`,children:[`Your own standing rules, from `,(0,S.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),` beside the deployed AGENT.md. The agent obeys them with the same force as the Laws — they may tighten a Law, never repeal one — and no update ever touches the file. Keep the set small: every rule is loaded every session.`]})]}),s.exists&&g===null&&(0,S.jsx)(`button`,{className:`btn`,ref:M,onClick:()=>h.open({target:`new`,title0:``,form:C}),children:`Add rule`})]}),y?(0,S.jsx)(`p`,{className:`sub rule-notice`,role:`status`,children:y}):null,(s.warnings||[]).map(e=>(0,S.jsxs)(`p`,{className:`sub rule-notice`,children:[`format warning: `,e]},e)),L&&(0,S.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,S.jsx)(`div`,{className:`eyebrow`,style:{marginBottom:10},children:`new rule`}),I?(0,S.jsxs)(`p`,{className:`sub rule-notice`,role:`status`,children:[`Rule R`,F,` is no longer in user-rules.md (an agent session removed or renumbered it). Your draft is kept — Save adds it as a new rule.`]}):null,(0,S.jsx)(A,{value:g.form,onChange:z,busy:_,onCancel:()=>V(`add`),onSave:e=>B({op:`add`,...e},`add`)})]}),s.exists?P.length===0&&!L?(0,S.jsx)(m,{title:`No rules yet`,children:`The file is seeded and loaded every session — it is just empty. Add your first standing rule here, ask the agent for one in-session (the rule skill), or promote a recurring memory fact from the Library.`}):(0,S.jsx)(`div`,{className:`card rules-list`,ref:N,children:P.map(e=>!I&&F===e.id?(0,S.jsx)(`div`,{className:`rule-row on`,children:(0,S.jsx)(`div`,{className:`rule-expand`,style:{paddingTop:14},children:(0,S.jsx)(A,{value:g.form,onChange:z,busy:_,onCancel:()=>V(e.id),onSave:t=>B({op:`update`,id:e.id,source:e.source,...t},e.id)})})},e.id):(0,S.jsx)(j,{rule:e,isOpen:u===e.id,onToggle:()=>d(u===e.id?null:e.id),onEdit:()=>{d(e.id),h.open({target:e.id,title0:e.title,form:{title:e.title,body:e.body,scope:T(e.scope),trial_until:e.trial_until}})},onDelete:()=>H(e),onGraduate:()=>U(e)},e.id))}):(0,S.jsxs)(m,{title:`No user-rules.md here yet`,children:[`The build seeds it beside AGENT.md — run a build/update from the Dashboard (or`,` `,(0,S.jsx)(`code`,{className:`mono`,children:`geneseed update`}),`) and it appears, ready for your rules.`]})]})}var N=`PROFILE.md changed on disk since you opened it — reloaded the fresh copy. Your draft is kept — Save again.`;function P({onChanged:e}){let{data:t,error:n,loading:i,reload:o,setData:s}=f(()=>r.profile(),[]),c=x({data:t,reload:o}),{draft:d,dirty:p,busy:g,notice:_}=c,[y,b]=(0,v.useState)(!1);if(t&&!y&&(b(!0),(t.text||``).trim()||c.open(t.text||``)),i&&!t)return(0,S.jsx)(l,{});if(n)return(0,S.jsx)(a,{error:n,onRetry:o});let C=d!==null,w=t?.text||``;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsxs)(`div`,{className:`head-row mb-16`,children:[(0,S.jsxs)(`div`,{children:[(0,S.jsx)(`div`,{className:`eyebrow`,children:`identity · yours`}),(0,S.jsx)(`h2`,{className:`h`,children:`Profile`}),(0,S.jsxs)(`p`,{className:`sub`,children:[`Who you are and how you like to work, from `,(0,S.jsx)(`code`,{className:`mono`,children:`PROFILE.md`}),` `,`beside the deployed AGENT.md. Unlike `,(0,S.jsx)(`code`,{className:`mono`,children:`user-rules.md`}),`, it is identity, not rules — it colours how the agent works but never binds (precedence is Laws, then rules, then this). Seeded once, never overwritten by an update. Prefer not to write it by hand? Ask the agent to run the `,(0,S.jsx)(`code`,{className:`mono`,children:`profile`}),` skill — it interviews you and drafts this file with your consent.`]})]}),(0,S.jsxs)(`div`,{className:`row`,children:[(0,S.jsxs)(u,{"aria-label":`Profile mode`,children:[(0,S.jsx)(`button`,{className:C?``:`on`,"aria-pressed":!C,onClick:c.discard,children:`View`}),(0,S.jsx)(`button`,{className:C?`on`:``,"aria-pressed":C,onClick:()=>C||c.open(w),children:`Edit`})]}),C&&(0,S.jsx)(`button`,{className:`btn`,disabled:!p||g,onClick:async()=>{let t=await c.save(e=>r.profileSave({text:d,fingerprint:e}),{conflict:N});t&&(s(e=>({...e,text:d,seeded:!1,fingerprint:t.fingerprint||``})),c.setNotice(`Saved.`),c.close(),e?.())},children:g?`Saving…`:`Save`})]})]}),_?(0,S.jsx)(`p`,{className:`sub rule-notice`,role:`status`,children:_}):null,C?(0,S.jsx)(`textarea`,{className:`rule-body-input`,style:{width:`100%`,minHeight:`60vh`,fontFamily:`var(--mono, monospace)`},value:d,onChange:e=>c.setDraft(e.target.value),spellCheck:!1,"aria-label":`Profile markdown`}):w.trim()?(0,S.jsxs)(S.Fragment,{children:[t?.seeded?(0,S.jsxs)(m,{title:`This is still the template`,action:(0,S.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>c.open(w),children:`Edit it here`}),children:[`Ask the agent to run the `,(0,S.jsx)(`code`,{className:`mono`,children:`profile`}),` skill — it interviews you and drafts this file with your consent.`]}):null,(0,S.jsx)(`div`,{className:`card pad-lg`,children:(0,S.jsx)(h,{body:w})})]}):(0,S.jsxs)(m,{title:`No profile yet`,children:[`Switch to Edit to write one, or ask the agent to run the`,` `,(0,S.jsx)(`code`,{className:`mono`,children:`profile`}),` skill.`]})]})}var F=(e,t)=>`${e} ${t}${e===1?``:`s`}`,I=new Set([`MEMORY`,`NOTEBOOK`,`README`]),L=e=>e?(e.items||[]).filter(e=>!I.has(String(e.name).toUpperCase())).length:null;function R({rules:e,profile:t,facts:n,notes:r}){let i=e?.exists?e.stats:null;if(!i)return null;let a=Math.round(Math.max(i.rules/i.max_rules,i.tokens/i.max_tokens)*100),[o,c]=a>=100?[`bad`,`over budget: a bloated rule set dilutes the rules that matter`]:a>=70?[`warn`,`getting heavy; consider merging or pruning`]:[`accent`,i.rules?`${i.rules} rules in ${i.lines} lines.`:`All of it is the file’s preamble; no rule text yet.`],l=[{k:`Profile`,v:t?.seeded?`template`:t?.exists?`written`:`missing`,warn:!!t?.seeded},{k:`Rules`,v:`${i.rules}/${i.max_rules}`},{k:`Memory`,v:n==null?`n/a`:F(n,`fact`)},{k:`Notebook`,v:r==null?`n/a`:F(r,`note`)}];return(0,S.jsxs)(`div`,{className:`card-row`,children:[(0,S.jsxs)(`section`,{className:`panel`,"aria-labelledby":`pc-budget`,children:[(0,S.jsxs)(`div`,{className:`panel-head`,children:[(0,S.jsx)(`h2`,{id:`pc-budget`,children:`Rule budget`}),(0,S.jsxs)(`span`,{className:`mono dim`,children:[i.rules,` of `,i.max_rules]})]}),(0,S.jsx)(`div`,{className:`slots`,style:{"--slots":i.max_rules},role:`img`,"aria-label":`${i.rules} of ${i.max_rules} rule slots used`,children:Array.from({length:i.max_rules},(e,t)=>(0,S.jsx)(`span`,{className:t<i.rules?`used`:``},t))}),(0,S.jsxs)(`p`,{className:`big-num`,children:[(0,S.jsx)(`span`,{className:`mono`,children:i.tokens}),` `,(0,S.jsxs)(`span`,{className:`dim`,children:[`/ `,i.max_tokens.toLocaleString(`en-US`),` tokens, every turn`]})]}),(0,S.jsx)(s,{value:i.tokens,max:i.max_tokens,label:`tokens`,tone:o}),(0,S.jsx)(`p`,{className:`panel-note`,children:c})]}),(0,S.jsxs)(`section`,{className:`panel`,"aria-labelledby":`pc-known`,children:[(0,S.jsx)(`div`,{className:`panel-head`,children:(0,S.jsx)(`h2`,{id:`pc-known`,children:`What the agent knows about you`})}),(0,S.jsx)(`ul`,{className:`hbars`,children:l.map(e=>(0,S.jsxs)(`li`,{children:[(0,S.jsx)(`span`,{className:`hb-label`,children:e.k}),(0,S.jsx)(`span`,{className:`mono hb-n${e.warn?` warn`:``}`,children:e.v})]},e.k))})]})]})}var z=/^- \[([^\]]*)\]\(topics\/[^)]+\.md\) — (\d+) facts?$/,B=e=>String(e||``).split(`
2
- `).map(e=>z.exec(e.trim())).filter(Boolean).map(e=>({topic:e[1],n:Number(e[2])}));function V({topics:e}){return e.length?(0,S.jsxs)(`section`,{className:`panel pm-topics`,"aria-labelledby":`pm-topics`,children:[(0,S.jsxs)(`div`,{className:`panel-head`,children:[(0,S.jsx)(`h2`,{id:`pm-topics`,children:`Topics`}),(0,S.jsx)(`span`,{className:`mono dim`,children:F(e.length,`topic`)})]}),(0,S.jsx)(`ul`,{className:`hbars`,children:e.map(e=>(0,S.jsxs)(`li`,{children:[(0,S.jsx)(`span`,{className:`hb-label`,children:e.topic}),(0,S.jsx)(`span`,{className:`mono hb-n`,children:F(e.n,`fact`)})]},e.topic))})]}):null}var H={memory:{title:`No facts yet`,body:(0,S.jsxs)(`div`,{className:`pm-first`,children:[(0,S.jsx)(`p`,{children:`The agent writes a fact when a session teaches it something durable: a decision, a correction, a trap. Say “remember that…” in any session, and it asks whether that belongs here or in your standing rules.`}),(0,S.jsxs)(`ul`,{children:[(0,S.jsx)(`li`,{children:`One fact per file, filed under a topic.`}),(0,S.jsx)(`li`,{children:`Stale facts move to Archived; nothing is deleted without you.`}),(0,S.jsx)(`li`,{children:`The store stays on this machine and out of git.`})]})]}),action:(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(`a`,{className:`btn ghost`,href:`#/docs/memory`,children:`How memory works`}),(0,S.jsx)(`a`,{className:`btn ghost`,href:`#/item/skill/rule`,children:`The rule skill`})]})},notebook:{title:`No notes yet`,body:`The notebook is the agent’s own scratch space: plans and notes it keeps for itself.`}};function U({tab:e=`rules`,item:t,dataRev:n}){let a=e=>Promise.resolve(e).catch(()=>null),{data:o,reload:s}=i(n),{data:l,reload:u}=f(()=>a(r.profile()),[n]),{data:d,reload:p}=f(()=>r.catalog(`memory`),[`memory`,n],`catalog`),{data:h}=f(()=>r.catalog(`notebook`),[`notebook`,n],`catalog`),v=L(d),{data:y}=f(()=>e===`memory`?a(r.item(`memory`,`MEMORY`)):Promise.resolve(null),[`memory-map`,e,n,v]),b=L(h),x={memory:v,notebook:b},C={rules:o?.stats?.rules,profile:l?.seeded?`template`:null,memory:v,notebook:b},w=e===`memory`||e===`notebook`;return(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(c,{title:`Personal`,sub:`The only files you write. They survive updates, reinstalls and voice changes.`}),(0,S.jsx)(g,{page:`personal`,current:e,badges:C,label:`Personal files`}),e===`rules`&&(0,S.jsxs)(S.Fragment,{children:[(0,S.jsx)(R,{rules:o,profile:l,facts:v,notes:b}),(0,S.jsx)(M,{onChanged:s})]}),e===`profile`&&(0,S.jsx)(P,{onChanged:u}),w&&x[e]===0&&!t?(0,S.jsx)(m,{title:H[e].title,action:H[e].action,children:H[e].body}):w?(0,S.jsxs)(S.Fragment,{children:[e===`memory`&&(0,S.jsx)(V,{topics:B(y?.body)}),(0,S.jsx)(_,{lock:e,base:`#/personal/${e}`,selected:t,dataRev:n,onRulesChanged:()=>{s(),p()}},e)]}):null]})}export{U as default};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,t as n}from"./react-DlYQp10C.js";import{t as r}from"./FilterInput-CZREvrjX.js";var i=e(t(),1),a=n(),o={experimental:{label:`experimental`,cls:`warn`,hint:`Shipped, but not yet confirmed by real use.`},deprecated:{label:`deprecated`,cls:`bad`,hint:`On its way out — look for the replacement before building on it.`},personal:{label:`personal`,cls:``,hint:`Yours — present in this install, not shipped or versioned by Geneseed.`},unknown:{label:`no status`,cls:``,hint:`Not listed in registry.json.`}};function s({status:e,withHint:t=!1}){let n=o[e];if(!n)return null;let r=(0,a.jsxs)(`span`,{className:`badge ${n.cls}`,title:t?void 0:n.hint,children:[(0,a.jsx)(`span`,{className:`dot`}),n.label]});return t?(0,a.jsxs)(a.Fragment,{children:[r,(0,a.jsx)(`span`,{className:`dim`,children:n.hint})]}):r}var c=({name:e})=>(0,a.jsxs)(`span`,{className:`tag acc`,title:`Ships with the ${e} kit`,children:[`kit: `,e]});function l(e,t){let n=(t||``).trim().toLowerCase();return n?e.filter(e=>`${e.title||``} ${e.name||``} ${e.desc||``}`.toLowerCase().includes(n)):e}function u({label:e,count:t,extra:n,tools:o,q:s,onQ:c,matched:l,inView:u,children:d}){let f=h(u);(0,i.useLayoutEffect)(()=>m(f.current));let[g,_]=(0,i.useState)(``),v=(0,i.useRef)(!0);return(0,i.useEffect)(()=>{if(v.current){v.current=!1;return}_(f.current?.querySelector(`.lib-row.on`)?.dataset.title||``)},u),(0,a.jsxs)(`section`,{className:`lib-list`,"aria-label":e,onKeyDown:e=>{e.key===`ArrowDown`&&e.target.classList?.contains(`lib-filter`)&&(e.preventDefault(),f.current?.querySelector(`.lib-row`)?.focus())},children:[(0,a.jsxs)(`div`,{className:`lib-list-head`,children:[(0,a.jsxs)(`b`,{children:[e,` `,(0,a.jsx)(`span`,{className:`mono dim`,children:t})]}),n]}),(0,a.jsx)(r,{value:s,onChange:c,placeholder:`Filter ${e.toLowerCase()}`,label:`Filter ${e}`}),o?(0,a.jsx)(`div`,{className:`lib-tools`,children:o}):null,(0,a.jsxs)(`div`,{className:`lib-rows`,ref:f,onKeyDown:p,onFocus:e=>m(e.currentTarget),children:[d,s.trim()&&l===0&&(0,a.jsxs)(`div`,{className:`empty`,style:{padding:32},children:[(0,a.jsx)(`div`,{className:`big`,children:`No matches`}),`Nothing in `,e.toLowerCase(),` matches “`,s.trim(),`”.`]})]}),(0,a.jsx)(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:g?`${g} opened`:``})]})}function d({item:e,isOpen:t,href:n,children:r}){return(0,a.jsxs)(`a`,{className:`lib-row${t?` on`:``}`,href:n,"aria-current":t?`true`:void 0,"data-title":e.title||e.name,children:[(0,a.jsxs)(`span`,{className:`lr-name`,children:[e.title||e.name,(0,a.jsx)(s,{status:e.status}),e.kit?(0,a.jsx)(c,{name:e.kit}):null,r]}),e.desc?(0,a.jsx)(`span`,{className:`lr-desc`,children:e.desc}):null,e.meta?(0,a.jsx)(`span`,{className:`lr-meta mono`,children:e.meta}):null]})}function f({rows:e,activeName:t,hrefOf:n,pills:r}){let i=null,o=[];for(let s of e)s.group&&s.group!==i&&(i=s.group,o.push((0,a.jsxs)(`div`,{className:`lib-group`,children:[s.groupC?(0,a.jsx)(`span`,{className:`cdot`,style:{"--cc":s.groupC},"aria-hidden":`true`}):null,s.group]},`g-${s.group}`))),o.push((0,a.jsx)(d,{item:s,isOpen:t===s.name,href:n(s),children:r?.(s)},s.name));return o}function p(e){let t=[...e.currentTarget.querySelectorAll(`.lib-row`)],n=t.indexOf(document.activeElement);if(n===-1)return;let r={ArrowDown:Math.min(n+1,t.length-1),ArrowUp:Math.max(n-1,0),Home:0,End:t.length-1}[e.key];r!==void 0&&(e.preventDefault(),t[r].focus())}function m(e){if(!e)return;let t=[...e.querySelectorAll(`.lib-row`)],n=t.find(e=>e===document.activeElement)||e.querySelector(`.lib-row.on`)||t[0];for(let e of t)e.tabIndex=e===n?0:-1}function h(e){let t=(0,i.useRef)(null);return(0,i.useEffect)(()=>{let e=t.current,n=e?.querySelector(`.lib-row.on`);if(!n||!e)return;let r=n.offsetTop;r>=e.scrollTop&&r+n.clientHeight<=e.scrollTop+e.clientHeight||(e.scrollTop=Math.max(0,r-e.clientHeight/2+n.clientHeight/2))},e),t}function g({label:e,total:t,cats:n,cat:r,onChange:i}){if(n.length<=1)return null;let o=[{key:`all`,label:`All`,n:t,c:`var(--text-3)`},...n];return(0,a.jsxs)(`div`,{className:`rail-cats`,children:[(0,a.jsx)(`ul`,{"aria-label":e,children:o.map(({key:e,label:t,n,c:o})=>(0,a.jsx)(`li`,{children:(0,a.jsxs)(`button`,{type:`button`,className:r===e?`on`:``,"aria-pressed":r===e,style:{"--cc":o},onClick:()=>i(e),children:[(0,a.jsx)(`span`,{className:`cdot`,"aria-hidden":`true`}),(0,a.jsx)(`span`,{className:`rc-name`,children:t}),(0,a.jsx)(`span`,{className:`mono dim`,children:n})]})},e))}),(0,a.jsx)(`div`,{className:`rail-mix`,"aria-hidden":`true`,children:n.map(({key:e,n:t,c:n})=>(0,a.jsx)(`span`,{className:r===`all`||r===e?``:`dim`,style:{"--cc":n,flexGrow:t}},e))})]})}function _(e){let t=[],n=new Map;for(let r of e)n.has(r.group)||t.push(r.group),n.set(r.group,(n.get(r.group)||0)+1);return t.map(e=>({key:e,label:e,n:n.get(e),c:`var(--accent)`}))}export{u as a,c as i,_ as n,l as o,f as r,s,g as t};
@@ -1 +0,0 @@
1
- import"./rolldown-runtime-hePW80VL.js";import{i as e,t}from"./react-DlYQp10C.js";import{vt as n,yt as r}from"./index-DhNNxhfg.js";e();var i=t();function a({page:e,current:t,badges:a={},label:o}){return(0,i.jsx)(`nav`,{className:`tabs`,"aria-label":o,children:n[e].map(n=>(0,i.jsxs)(`a`,{href:`#/${e}/${n}`,className:t===n?`on`:``,"aria-current":t===n?`page`:void 0,children:[r[n],a[n]==null?null:(0,i.jsx)(`span`,{className:`tab-badge`,children:a[n]})]},n))})}export{a as t};
@@ -1 +0,0 @@
1
- var e=typeof window<`u`?window.__GENESEED_TOKEN__:``;async function t(e){let t=await e.json().catch(()=>({})),n=e.status===403&&t.error===`forbidden`?`the web server restarted since this page loaded — reload the page, then re-apply your edit`:t.error||t.message||e.statusText,r=Error(n);return r.status=e.status,r.body=t,r}async function n(e){let n=await fetch(e);if(!n.ok)throw await t(n);return n.json()}async function r(n,r={}){let i=await fetch(n,{method:`POST`,headers:{"X-Geneseed-Token":e||``,"Content-Type":`application/json`},body:JSON.stringify(r)});if(!i.ok)throw await t(i);return i.json()}var i=e=>{if(e==null)return!1;if(typeof e.host==`string`&&typeof e.path==`string`)return!0;throw Error(`an install needs both host and path`)},a=(e,t)=>{if(!i(t))return e;let n=new URLSearchParams({host:t.host,path:t.path});return`${e}${e.includes(`?`)?`&`:`?`}${n}`},o=(e,t)=>{let n=e??{};if(!i(t))return n;if(`host`in n||`path`in n)throw Error(`this body already has host or path`);return{...n,host:t.host,path:t.path}},s=e=>{try{return e()}catch(e){return Promise.reject(e)}},c=(e,t)=>s(()=>n(a(e,t))),l=(e,t,n)=>s(()=>r(e,o(t,n))),u=e=>c(`/api/overview`,e),d=()=>n(`/api/fleet`),f=()=>n(`/api/kits`),p=()=>n(`/api/usage`),m=()=>n(`/api/gates`),h=()=>n(`/api/update`),g=e=>c(`/api/recent`,e),_=e=>c(`/api/activity`,e),v=(e,t)=>c(`/api/activity/`+encodeURIComponent(e),t),y=(e,t)=>l(`/api/activity`,{enabled:e},t),b=e=>c(`/api/setup`,e),x=(e=!1,t)=>c(e?`/api/doctor?fresh=1`:`/api/doctor`,t),S=e=>c(`/api/themes`,e),C=(e,t)=>c(`/api/catalog/${e}`,t),w=(e,t,n)=>c(`/api/item/${e}/${encodeURIComponent(t)}`,n),T=(e,t)=>l(`/api/memory/delete`,{name:e},t),E=e=>c(`/api/diff`,e),D=(e,t)=>l(`/api/actions/restore`,{files:e},t),O=409,k=e=>n(`/api/jobs/${e}`),A=()=>n(`/api/jobs`),j=e=>r(`/api/jobs/${e}/cancel`),M=new Set([`build`,`restore`]);async function N(e,t,n){let i=t||{},a=`/api/actions/${e}`;try{return await(M.has(e)?l(a,i,n):r(a,i))}catch(e){throw e.status===O&&e.body?.error===`busy`?Error(`An action is already running.`,{cause:e}):e}}var P=e=>c(`/api/loops`,e),F=()=>n(`/api/loops/active`),I=(e,t)=>r(`/api/loops/preset`,{root:e,preset:t}),L=()=>n(`/api/mcp`),R=e=>r(`/api/reveal`,{path:e}),z=()=>n(`/api/installs`),B=(e,t,n)=>r(`/api/install`,{host:e,path:t,action:n}),V=(e,t,n)=>r(`/api/install`,{host:e,path:t,action:`remove`,memory:n}),H=(e,t)=>r(`/api/view`,{host:e,path:t}),U=()=>r(`/api/pick-folder`,{}),W=()=>n(`/api/ping`),G=()=>r(`/api/shutdown`),K=()=>r(`/api/restart`),q=e=>e?`?harness=${encodeURIComponent(e)}`:``,J={fleet:d,kits:f,usage:p,gates:m,update:h,loops:P,activeLoops:F,setLoopPreset:I,overview:u,recent:g,activity:_,activityDetail:v,activityToggle:y,setup:b,doctor:x,themes:S,catalog:C,item:w,memoryDelete:T,diff:E,restore:D,job:k,jobs:A,cancelJob:j,action:N,mcp:L,mcpReveal:R,installs:z,installToggle:B,installRemove:V,selectView:H,pickFolder:U,ping:W,shutdown:G,restart:K,docs:(e,t)=>c(`/api/docs${q(e)}`,t),docsPage:(e,t,n)=>c(`/api/docs/page/${encodeURIComponent(e)}${q(t)}`,n),rules:e=>c(`/api/rules`,e),rulesMutate:(e,t)=>l(`/api/rules`,e,t),rulesPromote:(e,t)=>l(`/api/rules/promote`,e,t),profile:e=>c(`/api/profile`,e),profileSave:(e,t)=>l(`/api/profile`,e,t),excludes:()=>n(`/api/excludes`),excludeMutate:(e,t)=>r(`/api/excludes`,{action:e,path:t})};export{J as t};
@@ -1,3 +0,0 @@
1
- const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Dashboard-DkUm4XMu.js","assets/rolldown-runtime-hePW80VL.js","assets/react-DlYQp10C.js","assets/api-LvBC0CnK.js","assets/motion-CXaUMNkg.js","assets/sections-ChwaobfW.js","assets/Activity-C8pQvnos.js","assets/EmptyState-1sPNleqv.js","assets/Bonsai-CN4rRAHc.js","assets/usePoll-bDFN-Hr6.js","assets/ActivityDetail-D_8Bx-QO.js","assets/Library-t3KocV0-.js","assets/RailCats-BuJD4Jou.js","assets/FilterInput-CZREvrjX.js","assets/Markdown-DpmmtW2Y.js","assets/Kits-C9qVd466.js","assets/KitApply-BN2Az7dc.js","assets/DataTable-BWbUx4bY.js","assets/Loops-6lNY-9uR.js","assets/CopyButton-CYljsnLo.js","assets/Laws-T2wbwMmB.js","assets/Personal-xjoSqCzr.js","assets/Tabs-DaExAgql.js","assets/Installs-DmPzD4BW.js","assets/Docs-DE04qOKj.js"])))=>i.map(i=>d[i]);
2
- import{r as e}from"./rolldown-runtime-hePW80VL.js";import{i as t,n,r,t as i}from"./react-DlYQp10C.js";import{t as a}from"./api-LvBC0CnK.js";import{A as o,C as s,D as c,E as l,F as u,G as d,H as f,I as p,L as m,O as h,P as g,T as _,U as v,_ as y,b,d as x,f as S,i as C,j as w,l as T,n as E,o as D,r as O,s as k,t as A,u as j,v as M,z as N}from"./motion-CXaUMNkg.js";import{i as P,n as F,r as I}from"./sections-ChwaobfW.js";(function(){let e=document.createElement(`link`).relList;if(e&&e.supports&&e.supports(`modulepreload`))return;for(let e of document.querySelectorAll(`link[rel="modulepreload"]`))n(e);new MutationObserver(e=>{for(let t of e)if(t.type===`childList`)for(let e of t.addedNodes)e.tagName===`LINK`&&e.rel===`modulepreload`&&n(e)}).observe(document,{childList:!0,subtree:!0});function t(e){let t={};return e.integrity&&(t.integrity=e.integrity),e.referrerPolicy&&(t.referrerPolicy=e.referrerPolicy),t.credentials=e.crossOrigin===`use-credentials`?`include`:e.crossOrigin===`anonymous`?`omit`:`same-origin`,t}function n(e){if(e.ep)return;e.ep=!0;let n=t(e);fetch(e.href,n)}})();var ee=(e,t)=>{if(m(t,`<`)){let n=t[1]===`<`,r=e._tail,i=r?r._offset+r._delay:0;return n?i:i+r.duration}},te=(e,t)=>{let n=e.iterationDuration;if(n===1e-11&&(n=0),w(t))return n;if(h(+t))return+t;let r=t,i=e?e.labels:null,a=!c(i),o=ee(e,r),s=!w(o),l=v.exec(r);if(l){let e=l[0],t=r.split(e),c=a&&t[0]?i[t[0]]:n,u=s?o:a?c:n,d=+t[1];return M(u,d,e[0])}return s?o:a?w(i[r])?n:i[r]:n},L=(e=0,t=1,n=0)=>{let r=10**n;return Math.floor((Math.random()*(t-e+1/r)+e)*r)/r},ne=0,re=(e,t=0,n=1,r=0)=>{let i=e===void 0?ne++:e;return(e=t,a=n,o=r)=>{i+=1831565813,i=Math.imul(i^i>>>15,i|1),i^=i+Math.imul(i^i>>>7,i|61);let s=10**o;return Math.floor((((i^i>>>14)>>>0)/4294967296*(a-e+1/s)+e)*s)/s}},ie=(e,t=L)=>{let n=e.length,r,i;for(;n;)i=t(0,--n),r=e[n],e[n]=e[i],e[i]=r;return e},ae=(e,t={})=>{let n=[],r=0,i,a=null,c=t.from,f=t.reversed,m=t.ease,v=!w(m),x=v&&!w(m.ease)?m.ease:v?j(m):null,C=t.grid,T=C===!0,E=t.axis,D=t.total,O=w(c)||c===0||c===`first`,k=c===`center`,A=c===`last`,M=c===`random`,N=_(c),P=_(e),F=t.use,I=g(P?e[0]:e),ee=P?g(e[1]):0,ne=d.exec((P?e[1]:e)+``),ae=t.start||0+(P?I:0),R=t.seed,oe=!w(R)&&R!==!1?re(R===!0?0:R):L,z=t.jitter,se=!w(z),ce=_(z),B=ce?z[0]:z||0,V=ce?z[1]:z||0,H=O?0:h(c)?c:0;return(e,d,m,g,_)=>{let[v]=S(e),O=w(D)?m.length:D,j=w(F)?!1:l(F)?F(v,d,O):y(v,F),L=h(j)||o(j)&&h(+j)?+j:d,re=L>=0&&L<O?L:d;if(k&&(H=(O-1)/2),A&&(H=O-1),!n.length){if(T){let e=!0,t=!1,r=1/0,i=1/0,a=1/0,o=-1/0,s=-1/0,u=-1/0,d=[],f=[],g=[];for(let n=0;n<O;n++){let c=m[n],p=0,_=0,v=0,y=!1;if(c&&l(c.getBoundingClientRect)){let e=c.getBoundingClientRect();p=e.left+e.width/2,_=e.top+e.height/2,y=!0}else{let e=c;e&&h(e.x)&&h(e.y)&&(p=e.x,_=e.y,h(e.z)&&(v=e.z,t=!0),y=!0)}if(!y){e=!1;break}d.push(p),f.push(_),g.push(v),p<r&&(r=p),_<i&&(i=_),v<a&&(a=v),p>o&&(o=p),_>s&&(s=_),v>u&&(u=v)}if(e){let e=d[0],l=f[0],m=g[0];N?(e=r+c[0]*(o-r),l=i+c[1]*(s-i),m=t?a+(c.length>=3?c[2]:.5)*(u-a):0):k?(e=(r+o)/2,l=(i+s)/2,m=(a+u)/2):A?(e=d[O-1],l=f[O-1],m=g[O-1]):h(c)&&(e=d[c],l=f[c],m=g[c]);for(let r=0;r<O;r++){let i=e-d[r],a=l-f[r],o=m-g[r],s=p(i*i+a*a+(t?o*o:0));E===`x`&&(s=-i),E===`y`&&(s=-a),E===`z`&&(s=-o),n.push(s)}let _=1/0;for(let e=0;e<O;e++){let t=b(n[e]);t>0&&t<_&&(_=t)}if(_>0&&_<1/0)for(let e=0;e<O;e++)n[e]=n[e]/_}else for(let e=0;e<O;e++)n.push(b(H-e))}else for(let e=0;e<O;e++)if(!C)n.push(b(H-e));else{let t=C.length,r=C[0]*C[1],i,a,o;N?(i=c[0]*(C[0]-1),a=c[1]*(C[1]-1),o=t===3?(c.length>=3?c[2]:.5)*(C[2]-1):0):k?(i=(C[0]-1)/2,a=(C[1]-1)/2,o=t===3?(C[2]-1)/2:0):(i=H%C[0],a=s(H/C[0])%C[1],o=t===3?s(H/r):0);let l=e%C[0],u=s(e/C[0])%C[1],d=t===3?s(e/r):0,f=i-l,m=a-u,h=o-d,g=p(f*f+m*m+(t===3?h*h:0));E===`x`&&(g=-f),E===`y`&&(g=-m),E===`z`&&(g=-h),n.push(g)}r=n[0];for(let e=1;e<O;e++)n[e]>r&&(r=n[e]);if(x||f)for(let e=0;e<O;e++){let t=n[e];x&&(t=x(t/r)*r),f&&(t=E?-t:b(r-t)),n[e]=t}if(se){a=Array(O);for(let e=0;e<O;e++)a[e]=oe(-1,1,4)}M&&(n=ie(n,oe))}let R=P?(ee-I)/r:I;w(i)&&(i=_?te(_,w(t.start)?_.iterationDuration:ae):ae);let z=i+(R*u(n[re],2)||0);if(se){let e=r?n[re]/r:0,t=B+(V-B)*e;z+=a[re]*t}return t.modifier&&(z=t.modifier(z)),ne&&(z=`${z}${ne[2]}`),z}},R=e=>{let t=1;if(e&&e.getCTM){let n=e.getCTM();n&&(t=(p(n.a*n.a+n.b*n.b)+p(n.c*n.c+n.d*n.d))/2)}return t},oe=(e,t,n)=>{let r=N,i=getComputedStyle(e),a=i.strokeLinecap,o=i.vectorEffect===`non-scaling-stroke`?e:null,s=a,c=new Proxy(e,{get(e,t){let n=e[t];return t===f?e:t===`setAttribute`?(...t)=>{if(t[0]===`draw`){let n=t[1].split(` `),i=+n[0],c=+n[1],l=R(o),u=i*-r*l,d=c*r*l+u,f=r*l+(i===0&&c===1||i===1&&c===0?0:10*l)-d;if(a!==`butt`){let t=i===c?`butt`:a;s!==t&&(e.style.strokeLinecap=`${t}`,s=t)}e.setAttribute(`stroke-dashoffset`,`${u}`),e.setAttribute(`stroke-dasharray`,`${d} ${f}`)}return Reflect.apply(n,e,t)}:l(n)?(...t)=>Reflect.apply(n,e,t):n}});return e.getAttribute(`pathLength`)!==`${r}`&&(e.setAttribute(`pathLength`,`${r}`),c.setAttribute(`draw`,`${t} ${n}`)),c},z=(e,t=0,n=0)=>x(e).map(e=>oe(e,t,n)),se=r(),ce=n(),B=e(t(),1),V={overview:`Overview`,laws:`Constitution`,library:`Library`,kits:`Kits`,loops:`Loops`,personal:`Personal`,installs:`Installs`,docs:`Docs`,activity:`Activity`},H={loops:[`templates`,`bricks`,`active`],personal:[`rules`,`profile`,`memory`,`notebook`],installs:[`hosts`,`kits`,`edits`,`doctor`,`server`]},le={templates:`Templates`,bricks:`Bricks`,active:`Active`,rules:`Rules`,profile:`Profile`,memory:`Memory`,notebook:`Notebook`,hosts:`Hosts`,kits:`Kits`,edits:`Local edits`,doctor:`Doctor`,server:`Server`},ue={dashboard:[`overview`],constitution:[`laws`],rules:[`personal`,`rules`],profile:[`personal`,`profile`],harness:[`installs`,`hosts`],harnesses:[`installs`,`hosts`],themes:[`installs`,`hosts`],diff:[`installs`,`edits`],doctor:[`installs`,`doctor`],settings:[`installs`,`server`],about:[`installs`,`server`]},de=(e,t)=>t!==void 0&&Object.hasOwn(e,t),fe=(e,t)=>H[e].includes(t)?t:H[e][0];function pe(e){let t=(e||`#/`).slice(2).split(`/`).filter(Boolean),[n,r,i]=t,a=e=>{try{return decodeURIComponent(e||``)}catch{return e||``}};if(n===`section`||n===`item`){let e=n===`item`&&de(P,r)?P[r]:r,t=n===`item`?a(i):void 0;return{page:e===`laws`?`laws`:`library`,section:e,item:t}}if(n===`docs`)return{page:`docs`,item:a(t.slice(1).join(`/`))};if(n===`kits`)return r?{page:`kits`,item:a(r)}:{page:`kits`};if(n===`activity`&&r)return{page:`activity`,item:a(r)};if(n===`skills`||n===`agents`)return{page:`library`,section:n};if(de(H,n)){let e=fe(n,r);return i&&e===r?{page:n,tab:e,item:a(i)}:{page:n,tab:e}}if(de(ue,n)){let[e,t]=ue[n];return t?{page:e,tab:t}:{page:e}}return{page:de(V,n)?n:`overview`}}var me=new Set;function he(e){return me.add(e),()=>me.delete(e)}function ge(){let e=()=>pe(typeof window<`u`?window.location.hash:``),[t,n]=(0,B.useState)(e);(0,B.useEffect)(()=>{let t=window.location.hash,r=()=>{let r=window.location.hash;if(r!==t){for(let e of me)if(e({from:t,to:r})===!1){window.history.replaceState(window.history.state,``,t||`#/`);return}t=r,n(e())}};return window.addEventListener(`hashchange`,r),()=>window.removeEventListener(`hashchange`,r)},[]);let r=(0,B.useRef)(!1);return(0,B.useEffect)(()=>{if(document.title=`${V[t.page]} · Geneseed`,!r.current){r.current=!0;return}let e=document.getElementById(`main`);e?.focus();for(let t of[e,document.scrollingElement||document.documentElement])t&&(t.scrollTop=0)},[t.page]),t}var _e=e=>{window.location.hash=e},ve={red:`#FF5C57`,green:`#4ED888`,yellow:`#E8B53D`,blue:`#5B8CFF`,magenta:`#C77DFF`,cyan:`#3AD4C4`,white:`#E9EFEA`},ye={red:`#C53A36`,green:`#2FA864`,yellow:`#B8862A`,blue:`#3C66D8`,magenta:`#9A52D6`,cyan:`#2BA89B`,white:`#AEB8B0`},be=e=>ve[e]||ve.cyan,xe={red:`#A92F2B`,green:`#1E7A47`,yellow:`#8A6414`,blue:`#2F55C0`,magenta:`#7E3FB8`,cyan:`#15766C`,white:`#465A51`};function Se(e,t,n){if(!e)return;let r=n===`light`,i=r?ye[t]||ye.cyan:be(t);r&&t===`white`&&(i=`#566B62`);let a=r?xe[t]||xe.cyan:i;Be(e,Ie(i,ye[t]||ye.cyan,De,a,r),r)}var Ce={cultivar:{dark:`#3AD4C4`,light:`#127E73`,ink:`#06100D`},operator:{dark:`#E8A23B`,light:`#8F5E10`,ink:`#1A1306`},matrix:{dark:`#19E37C`,light:`#0B7A47`,ink:`#04140C`},atlas:{dark:`#8FD694`,light:`#1C8450`,ink:`#14200F`}};function we(e,t,n){let r=Ce[t];if(!e||!r)return!1;let i=n===`light`,a=i?r.light:r.dark;return Be(e,Ie(a,r.light,r.ink,a,i),i),!0}var Te={dark:{worst:`#232A31`,soft:[`#14181D`,`#1B2026`,`#11151A`,`#171C22`,`#0B1116`,`#121A21`,`#1C1A12`,`#211E15`]},light:{worst:`#EBE6D8`,soft:[`#FBFDFC`,`#F3F6F6`,`#F4F6F8`,`#E9F4ED`,`#FCFAF4`,`#F6F2E7`]}},Ee=.13,De=`#06100D`,Oe=e=>{let t=e.replace(`#`,``);return[0,2,4].map(e=>parseInt(t.slice(e,e+2),16))},ke=e=>`#`+e.map(e=>Math.round(e).toString(16).padStart(2,`0`)).join(``).toUpperCase(),Ae=e=>{let[t,n,r]=Oe(e).map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*t+.7152*n+.0722*r},je=(e,t)=>{let[n,r]=[Ae(e),Ae(t)].sort((e,t)=>t-e);return(n+.05)/(r+.05)},Me=(e,t,n)=>{let r=Oe(e),i=Oe(t);return ke(r.map((e,t)=>e+(i[t]-e)*n))},Ne=(e,t,n,r)=>{let i=e=>Math.min(...[].concat(t).map(t=>je(e,t))),a=e;for(let t=.05;i(a)<n&&t<=1.0001;t+=.05)a=Me(e,r,t);return a},Pe=e=>{let[t,n,r]=Oe(e).map(e=>e/255),i=Math.max(t,n,r),a=Math.min(t,n,r),o=i-a;if(o===0)return{h:0,s:0};let s=o/(1-Math.abs(i+a-1));return{h:((i===t?(n-r)/o%6:i===n?(r-t)/o+2:(t-n)/o+4)*60+360)%360,s}},Fe=(e,t)=>{let n=Math.abs(e-t)%360;return n>180?360-n:n};function Ie(e,t,n,r,i){let a=i?`#000000`:`#FFFFFF`,o=e=>je(e,n)>=je(e,`#FFFFFF`)?n:`#FFFFFF`,s=je(e,o(e))>=4.5?e:Ne(e,i?`#FFFFFF`:n,4.5,a),c=i?Te.light:Te.dark,l=[c.worst,...c.soft.map(e=>Me(e,s,Ee))];return{accent:s,accent2:t,ink:o(s),text:Ne(r,l,4.5,a)}}var Le=39,Re={dark:[`#FF8A4C`,`#FF8A4C`],light:[`#B4441F`,`#9B3A1B`]};function ze(e,t,n){let[r,i]=n?Re.light:Re.dark,{h:a,s:o}=Pe(t),s=Fe(a,Le);o>=.15&&s<=29&&Fe(a,Pe(r).h)>s?(e.style.setProperty(`--warn`,r),e.style.setProperty(`--warn-text`,i)):(e.style.removeProperty(`--warn`),e.style.removeProperty(`--warn-text`))}function Be(e,t,n){e.style.setProperty(`--accent`,t.accent),e.style.setProperty(`--accent-2`,t.accent2),e.style.setProperty(`--accent-ink`,t.ink),e.style.setProperty(`--accent-text`,t.text),ze(e,t.accent,n)}var Ve=e=>typeof e==`string`&&/^#[0-9a-fA-F]{6}$/.test(e);function He(e,t){let n=t===`light`,r=n?Te.light:Te.dark,i=n?`#000000`:`#FFFFFF`,a=Ne(e,r.worst,3,i);return Ie(a,Ne(a,r.worst,4.5,i),De,a,n)}function Ue(e,t,n){return!e||!Ve(t)?!1:(Be(e,He(t,n),n===`light`),!0)}function We(e,t){let[n,r]=(0,B.useState)(()=>{try{return t(localStorage.getItem(e))}catch{return t(null)}});return[n,(0,B.useCallback)(t=>r(n=>{let r=typeof t==`function`?t(n):t;try{localStorage.setItem(e,r)}catch{}return r}),[e])]}var Ge=`geneseed-mode`;function Ke(){let[e,t]=We(Ge,e=>e===`light`?`light`:`dark`);return[e,()=>t(e=>e===`light`?`dark`:`light`)]}var qe=`geneseed-flavour`,Je=[{id:`cultivar`,short:`Cultivar`,name:`Cultivar Evolved`,tagline:`The calm default — cool teal ink, geometric sans, soft flat cards lit by one quiet shadow.`},{id:`operator`,short:`Operator`,name:`Operator HUD`,tagline:`Amber phosphor on cool charcoal — all-mono, zero-radius instrument readout.`},{id:`matrix`,short:`Matrix`,name:`Matrix`,tagline:`Acid-green order-book terminal on pure black — all Space Mono, square 2px, a faint code-grid.`},{id:`atlas`,short:`Atlas`,name:`Atlas`,tagline:`The field journal — loam dark, sage ink, the codex as a living map.`}],Ye=new Set(Je.map(e=>e.id)),Xe={a:`cultivar`,b:`atlas`,c:`operator`,d:`cultivar`,e:`matrix`,f:`cultivar`,g:`cultivar`,z:`cultivar`,cb:`matrix`,cm:`cultivar`,greenhouse:`atlas`,heirloom:`cultivar`,aurora:`cultivar`,perspective:`cultivar`,sequencer:`cultivar`,cobalt:`matrix`,cosmic:`cultivar`,neon:`matrix`};function Ze(){return We(qe,Qe)}function Qe(e){return Ye.has(e)?e:Xe[e]||`cultivar`}var $e=1e3,et=e=>new Promise(t=>setTimeout(t,e));async function tt(){try{return(await a.ping()).pid??null}catch{return null}}async function nt(e=0,t=null){await et(e);for(let e=0;e<30;e++){let e=await tt();if(e!==null&&e!==t)break;await et($e)}window.location.reload()}async function rt(){let e=await tt();try{await a.restart()}catch(e){if(e.status)throw e}await nt($e,e)}var it=`geneseed-accent`,at=[{id:`curated`,short:`Curated`,tagline:`Each theme's own signature colour.`}],ot=[[`cyan`,`Cyan`],[`blue`,`Blue`],[`magenta`,`Violet`],[`yellow`,`Amber`],[`green`,`Green`]].map(([e,t])=>({id:`custom:${e}`,name:e,short:t,hex:be(e),tagline:`${t}, whatever the voice, until the skin changes.`})),st=[...at,...ot],ct=new Set(st.map(e=>e.id)),lt=e=>{let t=typeof e==`string`&&e.startsWith(`hex:`)?e.slice(4):null;return Ve(t)?t.toUpperCase():null},ut=e=>e&&(ct.has(e)||lt(e))?e:`curated`,dt=e=>ot.find(t=>t.id===e)?.name??null,ft=e=>{let t=lt(e);return t?`Your own colour, ${t}.`:st.find(t=>t.id===e)?.tagline??``};function pt(){return We(it,ut)}var mt=`geneseed-layout`,ht=[{id:`overview`,short:`Overview`,tagline:`Every install, what needs you, cost, usage and gates.`},{id:`cultivar`,short:`Cultivar`,tagline:`Hero, KPIs & genome grid.`},{id:`greenhouse`,short:`Greenhouse`,tagline:`Ring, tiles & mix donut.`},{id:`operator`,short:`Operator`,tagline:`Dense terminal readout.`},{id:`journal`,short:`Journal`,tagline:`Growth rings & the constitution map.`}],gt=new Set(ht.map(e=>e.id));function _t(e){return e&&gt.has(e)?e:`overview`}function vt(){return We(mt,_t)}function yt(e){let[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(null),[o,s]=(0,B.useState)([]),c=()=>a.overview().then(e=>{n(e),i(null)}).catch(t=>{i(t?.body?.message||t?.message||String(t)),e?.(t)});return(0,B.useEffect)(()=>{c()},[]),(0,B.useEffect)(()=>{a.themes().then(e=>s(e.themes)).catch(()=>{})},[]),{overview:t,error:r,themes:o,reload:c}}var bt=600;function xt({onFinish:e,onError:t}={}){let[n,r]=(0,B.useState)([]),[i,o]=(0,B.useState)(null),[s,c]=(0,B.useState)(!1);return(0,B.useEffect)(()=>{a.jobs().then(({jobs:e})=>{if(!e.length)return;r(e.map(e=>({id:e.id,action:e.action,status:e.status,output:e.output||``,duration:e.duration,started:e.started})));let t=e.find(e=>e.status===`running`);t&&(o(t.id),c(!0))}).catch(()=>{})},[]),(0,B.useEffect)(()=>{if(!i)return;let t=n.find(e=>e.id===i),s=t?.action===`update`||!!t?.restarts,c=null;s&&tt().then(e=>c=e);let l=setInterval(async()=>{if(!document.hidden)try{let t=await a.job(i);if(r(e=>{let n=e.findIndex(e=>e.id===i);if(n===-1)return e;let r=e[n],a=t.output||``;if(r.output===a&&r.status===t.status&&r.duration===t.duration)return e;let o=e.slice();return o[n]={...r,output:a,status:t.status,duration:t.duration},o}),t.status!==`running`){if(clearInterval(l),o(null),s&&t.status===`done`){nt(2e3,c);return}e?.(t.status)}}catch{if(!s)return;clearInterval(l),nt(0,c)}},bt);return()=>clearInterval(l)},[i]),{runs:n,activeId:i,consoleOpen:s,setConsoleOpen:c,runAction:async(e,n)=>{try{let{job_id:t,restarts:i}=await a.action(e,n),s=e===`build`&&n?.theme?`build (${n.theme} · ${n.emit})`:e;return r(e=>[...e,{id:t,action:s,status:`running`,output:``,started:Date.now()/1e3,restarts:!!i}]),o(t),c(!0),t}catch(e){t?.(e)}},cancelJob:e=>a.cancelJob(e).catch(e=>t?.(e)),clearRuns:()=>r([])}}var U=new Map,St=new Map;function Ct(e){for(let t of U.keys())t.startsWith(`${e}|`)&&U.delete(t)}function W(e,t=[],n=null,{revalidate:r=!1}={}){let i=n===null?null:`${n}|${t.join(``)}`,[a,o]=(0,B.useState)(()=>i!==null&&U.has(i)?U.get(i):null),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(()=>!(i!==null&&U.has(i))),d=(0,B.useRef)(e),f=(0,B.useRef)(i);(0,B.useLayoutEffect)(()=>{d.current=e,f.current=i});let p=(0,B.useRef)(0),m=(0,B.useCallback)(()=>{let e=++p.current,t=()=>e===p.current;u(!0),c(``);let n=f.current;return Promise.resolve(d.current()).then(e=>{if(t()&&(o(e),n!==null)){U.set(n,e);for(let t of St.get(n)||[])t(e)}}).catch(e=>{t()&&c(e.message)}).finally(()=>{t()&&u(!1)})},t);return(0,B.useEffect)(()=>{let e=f.current;return e!==null&&(St.has(e)||St.set(e,new Set),St.get(e).add(o)),e!==null&&U.has(e)&&(p.current++,o(U.get(e)),c(``),u(!1),!r)||m(),()=>St.get(e)?.delete(o)},[m]),{data:a,error:s,loading:l,reload:m,setData:o}}var wt=60,Tt=3600,Et=86400,Dt={seconds:90,minutes:5400,hours:36*Tt};function Ot(e){let t=Math.max(0,Date.now()/1e3-e);return t<Dt.seconds?`${Math.round(t)}s`:t<Dt.minutes?`${Math.round(t/wt)}m`:t<Dt.hours?`${Math.round(t/Tt)}h`:`${Math.round(t/Et)}d`}function kt(e){return e?e.replace(/\\/g,`/`).replace(/^\/?(home|Users)\/[^/]+/i,`~`).replace(/^[A-Z]:\/Users\/[^/]+/i,`~`):`~`}var G={deployed:.4,doctorClean:.25,doctorMinor:.15,doctorMinorMax:2,doctorFail:.05,versionSynced:.2,diskClean:.15},At={warn:G.deployed+G.doctorClean,bad:G.deployed};function jt(e,t,n){if(!e)return 0;let r=e.doctor?.problems?.length??99,i=e.doctor?.ok?G.doctorClean:r<=G.doctorMinorMax?G.doctorMinor:G.doctorFail,a=t&&t.installed_fp&&t.installed_fp===t.source_fp,o=(e.deployed?G.deployed:0)+i+(a?G.versionSynced:0)+(e.diff&&e.diff.missing===0?G.diskClean:0);return Math.min(o,At[n]??1)}var Mt=e=>Math.max(...I.map(t=>e?.[t]??0),1),Nt=e=>(e?.edited??0)+(e?.added??0),K=e=>Nt(e)+(e?.missing??0),Pt=e=>(e?.laws??0)+(e?.doctrines?.rules??0),q=i(),Ft={dashboard:`M3 13h7V3H3v10Zm0 8h7v-6H3v6Zm11 0h7V11h-7v10Zm0-18v6h7V3h-7Z`,library:`M4 5h10v14H4zM16 7h4v12h-4M7 9h4M7 12h4`,loop:`M19.5 9A8 8 0 1 1 15 4.6M15 1.5l.2 3.3-3.2.8`,graph:`M6 18a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM18 8a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM18 20a2 2 0 1 0 0-4 2 2 0 0 0 0 4ZM7.5 14.5l8-8M16.7 15.2L8.8 16.6`,changes:`M4 6h10M4 12h7M4 18h12M17 4l3 3-3 3M20 7h-6`,doctor:`M12 3v6m0 0a4 4 0 0 1-4 4H7a3 3 0 0 0-3 3v2m8-9a4 4 0 0 0 4 4h1a3 3 0 0 1 3 3v2M12 3a1.5 1.5 0 1 0 0-.01`,themes:`M12 3a9 9 0 1 0 0 18c1.1 0 2-.9 2-2 0-.5-.2-1-.5-1.3-.3-.4-.5-.8-.5-1.2 0-1 .8-1.5 1.7-1.5H17a4 4 0 0 0 4-4c0-4.4-4-8-9-8Z`,settings:`M12 15a3 3 0 1 0 0-6 3 3 0 0 0 0 6Zm8-3a8 8 0 0 0-.1-1.3l2-1.6-2-3.4-2.4 1a8 8 0 0 0-2.2-1.3L15 2H9l-.3 2.6a8 8 0 0 0-2.2 1.3l-2.4-1-2 3.4 2 1.6A8 8 0 0 0 4 12c0 .4 0 .9.1 1.3l-2 1.6 2 3.4 2.4-1a8 8 0 0 0 2.2 1.3L9 22h6l.3-2.6a8 8 0 0 0 2.2-1.3l2.4 1 2-3.4-2-1.6c.1-.4.1-.9.1-1.3Z`,search:`M11 19a8 8 0 1 0 0-16 8 8 0 0 0 0 16ZM21 21l-4.3-4.3`,chevron:`M9 6l6 6-6 6`,x:`M6 6l12 12M18 6L6 18`,menu:`M4 7h16M4 12h16M4 17h16`,play:`M7 5v14l11-7L7 5Z`,clear:`M3 6h18M8 6V4h8v2M6 6l1 14h10l1-14`,download:`M12 3v12m0 0l-4-4m4 4l4-4M4 19h16`,refresh:`M21 12a9 9 0 1 1-3-6.7M21 4v5h-5`,folder:`M3 7a2 2 0 0 1 2-2h3.5l2 2H19a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7Z`,build:`M14 3l-1 4 4-1 3 3-4 1 1 4-3 3-1-4-4 1-3-3 4-1-1-4 3-3 5 0Z`,arrow:`M5 12h14M13 6l6 6-6 6`,external:`M14 5h5v5M19 5l-8 8M12 5H6a2 2 0 0 0-2 2v11a2 2 0 0 0 2 2h11a2 2 0 0 0 2-2v-6`,copy:`M9 9h11v11H9zM5 15H4V4h11v1`,check:`M5 12.5l4.5 4.5L19 7`,spark:`M12 3v3m0 12v3m9-9h-3M6 12H3m13.5-6.5-2 2m-7 7-2 2m11 0-2-2m-7-7-2-2`,activity:`M3 12h4l2.5-7 5 14 2.5-7H21`,agent:`M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2M9 11a4 4 0 1 0 0-8 4 4 0 0 0 0 8ZM22 21v-2a4 4 0 0 0-3-3.9M16 3.1a4 4 0 0 1 0 7.8`,kit:`M21 8l-9-5-9 5v8l9 5 9-5V8ZM3 8l9 5 9-5M12 13v8`,layers:`M12 3l9 5-9 5-9-5 9-5ZM3 13l9 5 9-5M3 17l9 5 9-5`,sun:`M12 4V2M12 22v-2M4 12H2M22 12h-2M5.6 5.6 4.2 4.2M19.8 19.8l-1.4-1.4M18.4 5.6l1.4-1.4M4.2 19.8l1.4-1.4M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8Z`,moon:`M21 12.8A8.5 8.5 0 1 1 11.2 3a6.5 6.5 0 0 0 9.8 9.8Z`,power:`M12 3v9M7.5 6.5a7 7 0 1 0 9 0`,docs:`M5 4h9l5 5v11a1 1 0 0 1-1 1H5a1 1 0 0 1-1-1V5a1 1 0 0 1 1-1ZM14 4v5h5M8 12h7M8 16h7`,skill:`M21.7 6.6a5 5 0 0 1-6.6 6.6l-7.4 7.4a2 2 0 1 1-2.8-2.8l7.4-7.4a5 5 0 0 1 6.6-6.6l-2.6 2.6a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0Z`,law:`M12 3v18M5 6h14M8 21h8M6 6l-3 6h6zM3 12a3 3 0 0 1 6 0M18 6l-3 6h6zM15 12a3 3 0 0 1 6 0`,rule:`M7 3h10a1 1 0 0 1 1 1v17l-6-3.5L6 21V4a1 1 0 0 1 1-1ZM9.5 9.5l1.8 1.8 3.4-3.6`,profile:`M12 12a4 4 0 1 0 0-8 4 4 0 0 0 0 8ZM5 20a7 7 0 0 1 14 0`,notebook:`M7 4h11v16H7zM4 8h3M4 12h3M4 16h3M11 9h5M11 13h5M11 17h3`,about:`M12 21a9 9 0 1 0 0-18 9 9 0 0 0 0 18ZM12 11v6M12 7.6h.01`,github:`M12 2a10 10 0 0 0-3.2 19.5c.5.1.7-.2.7-.5v-1.8c-2.8.6-3.4-1.2-3.4-1.2-.5-1.2-1.1-1.5-1.1-1.5-.9-.6.1-.6.1-.6 1 .1 1.5 1 1.5 1 .9 1.5 2.3 1.1 2.9.8.1-.6.3-1.1.6-1.3-2.2-.3-4.6-1.1-4.6-5 0-1.1.4-2 1-2.7-.1-.3-.4-1.3.1-2.7 0 0 .8-.3 2.7 1a9.4 9.4 0 0 1 5 0c1.9-1.3 2.7-1 2.7-1 .5 1.4.2 2.4.1 2.7.6.7 1 1.6 1 2.7 0 3.9-2.4 4.7-4.6 5 .4.3.7.9.7 1.8v2.6c0 .3.2.6.7.5A10 10 0 0 0 12 2Z`};function J({name:e,className:t=`glyph`,style:n}){return(0,q.jsx)(`svg`,{className:t,style:n,viewBox:`0 0 24 24`,fill:`none`,stroke:`currentColor`,strokeWidth:`1.7`,strokeLinecap:`round`,strokeLinejoin:`round`,"aria-hidden":`true`,children:(0,q.jsx)(`path`,{d:Ft[e]||``})})}function It({className:e=`sprout`}){return(0,q.jsxs)(`svg`,{className:e,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:[(0,q.jsx)(`path`,{d:`M12 21.5v-9`,stroke:`var(--accent)`,strokeWidth:`2`,strokeLinecap:`round`,fill:`none`}),(0,q.jsx)(`path`,{d:`M12 13c0-4.5 3.2-7.5 7.5-7.5 0 4.5-3.2 7.5-7.5 7.5z`,fill:`var(--accent)`}),(0,q.jsx)(`path`,{d:`M12 14.5c0-3.6-2.6-6-6-6 0 3.6 2.6 6 6 6z`,fill:`var(--accent)`,opacity:`.42`}),(0,q.jsx)(`circle`,{cx:`12`,cy:`12.4`,r:`1.1`,fill:`var(--bg)`})]})}var Lt=[{hash:`#/`,page:`overview`,label:`Overview`,icon:`dashboard`},{hash:`#/laws`,page:`laws`,label:`Constitution`,icon:`law`,count:e=>e?.counts?(e.counts.ontology??0)+(e.counts.laws??0)+(e.counts.doctrines?.rules??0):null},{hash:`#/library`,page:`library`,label:`Library`,icon:`library`,count:e=>e?.counts?[`skills`,`agents`,`memory`,`notebook`,`wiki`,`config`].reduce((t,n)=>t+(e.counts[n]??0),0):null},{hash:`#/kits`,page:`kits`,label:`Kits`,icon:`kit`},{hash:`#/loops`,page:`loops`,label:`Loops`,icon:`loop`,count:e=>e?.counts?.loops??null},{hash:`#/personal`,page:`personal`,label:`Personal`,icon:`profile`},{hash:`#/installs`,page:`installs`,label:`Installs`,icon:`layers`,count:(e,t)=>t?`${t.filter(e=>e.state===`active`).length}/${t.length}`:null}],Rt=[{hash:`#/docs`,page:`docs`,label:`Docs`,icon:`docs`},{hash:`#/activity`,page:`activity`,label:`Activity`,icon:`activity`}];function zt({n:e,lit:t,count:n,onNavigate:r}){return(0,q.jsx)(`li`,{children:(0,q.jsxs)(`a`,{className:`sb-item${t?` on`:``}`,href:e.hash,"aria-current":t?`page`:void 0,onClick:()=>r?.(),children:[(0,q.jsx)(J,{name:e.icon}),(0,q.jsx)(`span`,{className:`sb-label`,children:e.label}),n==null?null:(0,q.jsx)(`span`,{className:`sb-count`,children:n})]})})}function Bt({overview:e,onOpenVoice:t}){if(!e)return null;let n=e.doctor,r=K(e.diff);return(0,q.jsxs)(`section`,{className:`sb-vitals`,"aria-label":`Install vitals`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:`doctor`}),(0,q.jsx)(`b`,{className:n?n.ok?`good`:`bad`:``,children:n?n.ok?`clean`:`${n.problems.length} to fix`:`not run`})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:`drift`}),(0,q.jsx)(`b`,{className:r?`warn`:``,children:e.diff?r:`n/a`})]}),(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`span`,{children:`built`}),(0,q.jsx)(`b`,{title:e.build_time||void 0,children:e.build_epoch?`${Ot(e.build_epoch)} ago`:`never`})]}),(0,q.jsxs)(`button`,{type:`button`,className:`sb-voice`,onClick:t,title:`Switch voice`,"aria-haspopup":`dialog`,children:[(0,q.jsxs)(`span`,{className:`sb-voice-name`,children:[(0,q.jsx)(`i`,{className:`sb-voice-swatch`,"aria-hidden":`true`}),`Voice · `,e.theme||`none`]}),(0,q.jsx)(J,{name:`chevron`})]})]})}function Vt({route:e,overview:t,installs:n,onOpenVoice:r,onNavigate:i}){return(0,q.jsxs)(`nav`,{className:`sidebar`,id:`rail-nav`,"aria-label":`Console`,tabIndex:-1,children:[(0,q.jsxs)(`button`,{type:`button`,className:`sb-brand`,onClick:()=>{_e(`#/`),i?.()},"aria-label":`Geneseed, go to the overview`,children:[(0,q.jsx)(`span`,{className:`sb-mark`,children:(0,q.jsx)(It,{})}),(0,q.jsxs)(`span`,{className:`sb-brand-text`,children:[(0,q.jsx)(`span`,{className:`sb-name`,children:`Geneseed`}),(0,q.jsx)(`span`,{className:`sb-ver`,children:[t?.version&&`v${t.version}`,t?.theme].filter(Boolean).join(` · `)})]})]}),(0,q.jsx)(`ul`,{className:`sb-list`,children:[...Lt,...Rt].map(r=>(0,q.jsx)(zt,{n:r,lit:e.page===r.page,count:r.count?.(t,n),onNavigate:i},r.page))}),(0,q.jsx)(`div`,{className:`sb-spacer`}),t?(0,q.jsx)(`button`,{type:`button`,className:`sb-voice-rail`,"aria-label":`Switch voice, now ${t.theme||`none`}`,title:`Switch voice`,onClick:r,children:(0,q.jsx)(J,{name:`spark`})}):null,(0,q.jsx)(Bt,{overview:t,onOpenVoice:r})]})}var Ht=[`overview`,`laws`,`library`,`installs`];function Ut({route:e,navOpen:t,onMore:n}){return(0,q.jsxs)(`nav`,{className:`tabbar`,"aria-label":`Console pages`,children:[Lt.filter(e=>Ht.includes(e.page)).map(t=>(0,q.jsxs)(`a`,{href:t.hash,className:e.page===t.page?`on`:``,"aria-current":e.page===t.page?`page`:void 0,children:[(0,q.jsx)(J,{name:t.icon}),t.label]},t.page)),(0,q.jsxs)(`button`,{type:`button`,className:`tab-more${Ht.includes(e.page)?``:` on`}`,"aria-controls":`rail-nav`,"aria-expanded":!!t,onClick:n,children:[(0,q.jsx)(J,{name:`menu`}),`More`]})]})}var Wt=[{id:`opencode`,label:`OpenCode`,deployAdds:`.opencode/ + AGENT.md`,removeProject:`.opencode/ + AGENT.md + the bundle`,removeGlobal:`~/.config/opencode's AGENT.md, agents, skills, plugins + the opencode.json entry`},{id:`claude`,label:`Claude Code`,deployAdds:`.claude/ + CLAUDE.md`,removeProject:`.claude/ + the CLAUDE.md block`,removeGlobal:`~/.claude's agents/skills + the CLAUDE.md block + settings hooks`},{id:`bob`,label:`BOB (IBM)`,deployAdds:`.bob/ + AGENTS.md`,removeProject:`.bob/ + the AGENTS.md block`,removeGlobal:`~/.bob's agents/skills + the AGENTS.md block + settings hooks`},{id:`openclaude`,label:`OpenClaude`,deployAdds:`.openclaude/ + its CLAUDE.md`,removeProject:`.openclaude/ + its CLAUDE.md block`,removeGlobal:`~/.openclaude's agents/skills + the CLAUDE.md block + settings hooks`}],Gt=e=>Wt.find(t=>t.id===e)||Wt[0],Kt=(e,t)=>t===`project`?Gt(e).removeProject:Gt(e).removeGlobal,qt=e=>String(e||``).replace(/[\\/]+$/,``).split(/[\\/]/).pop()||e,Jt=e=>e.scope===`global`?Gt(e.host).label:qt(e.path),Yt=`geneseed-harness`,Xt=Wt.map(({id:e,label:t})=>({id:e,label:t}));function Zt(e=`opencode`){let[t,n]=We(Yt,e=>Xt.some(t=>t.id===e)?e:null);return[t??e,n]}function Qt(e){let t=String(e||``);return Wt.find(e=>t.startsWith(e.id))?.id||`opencode`}var $t=Object.entries(V).flatMap(([e,t])=>(H[e]||[``]).map(n=>{let r=n?t+` / `+le[n]:t;return{kind:`Pages`,sortKey:-1,title:r,desc:``,hay:r.toLowerCase(),route:e===`overview`?`#/`:`#/`+e+(n?`/`+n:``)}}));function en(e=0){let[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(``),o=(0,B.useRef)(null),[s]=Zt(),c=`${e}|${s}`,[l,u]=(0,B.useState)(c);return l!==c&&(u(c),n(null)),(0,B.useEffect)(()=>{o.current=null},[c]),{index:t,error:r,prime:(0,B.useCallback)(()=>{if(t||o.current)return o.current;let e=(async()=>{let e=[],t=[`laws`,`skills`,...I],r=await Promise.all(t.map(async e=>{try{return{sec:e,items:(await a.catalog(e))?.items||[]}}catch{return{sec:e,items:[]}}}));for(let{sec:n,items:i}of r){let r=F[n];for(let a of i){let i=a.title||a.name;e.push({kind:r.label,sortKey:t.indexOf(n),title:i,desc:a.desc||``,hay:`${i} ${a.desc||``} ${a.name||``}`.toLowerCase(),route:`#/item/${r.type}/${encodeURIComponent(a.name)}`})}}try{let t=await a.mcp(),n=new Set;for(let r of t?.targets||[])for(let t of r.servers||[]){if(n.has(t.name))continue;n.add(t.name);let r=t.label||t.name;e.push({kind:`MCP servers`,sortKey:100,title:r,desc:t.desc||``,hay:`${r} ${t.desc||``} ${t.name||``} mcp`.toLowerCase(),route:`#/installs/hosts`})}}catch{}try{let t=await a.docs(s);for(let n of t?.groups||[])for(let t of n.pages||[])e.push({kind:`Docs`,sortKey:110,title:t.title,desc:n.label,hay:`${t.title||``} ${t.id||``} ${n.label||``} ${t.section||``} ${t.description||``}`.toLowerCase(),route:`#/docs/${encodeURIComponent(t.id)}`})}catch{}return n(e),o.current=null,e})().catch(e=>(o.current=null,i(e.message||String(e)),[]));return o.current=e,e},[t,s])}}function tn({open:e,title:t,children:n,confirmLabel:r,tone:i,onConfirm:a,onClose:o}){let s=(0,B.useRef)(null),c=(0,B.useRef)(null),l=(0,B.useRef)(null),u=(0,B.useId)(),d=i===`danger`;return(0,B.useEffect)(()=>{let t=s.current;t&&(e&&!t.open&&(typeof t.showModal==`function`?t.showModal():t.setAttribute(`open`,``)),e&&(d?c:l).current?.focus(),!e&&t.open&&(typeof t.close==`function`?t.close():t.removeAttribute(`open`)))},[e,d]),(0,q.jsxs)(`dialog`,{ref:s,className:`confirm`,"aria-labelledby":`${u}-title`,"aria-describedby":`${u}-body`,onCancel:o,onClose:o,children:[(0,q.jsx)(`h3`,{className:`confirm-title`,id:`${u}-title`,children:t}),(0,q.jsx)(`div`,{className:`confirm-body`,id:`${u}-body`,children:n}),(0,q.jsxs)(`div`,{className:`confirm-actions`,children:[(0,q.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:o,ref:c,children:`Cancel`}),(0,q.jsx)(`button`,{type:`button`,className:d?`btn danger`:`btn`,onClick:a,ref:l,children:r||`Confirm`})]})]})}var nn=(0,B.createContext)(null),rn=()=>{throw Error(`useConfirm() needs a <ConfirmProvider> above it`)};function an(){return(0,B.useContext)(nn)||rn}function on({children:e}){let[t,n]=(0,B.useState)(null),r=(0,B.useRef)(null),i=e=>{let t=r.current;r.current=null,n(null),t?.(e)},a=(0,B.useCallback)((e,t={})=>new Promise(i=>{r.current?.(!1),r.current=i,n({msg:e,...t})}),[]);return(0,q.jsxs)(nn.Provider,{value:a,children:[e,(0,q.jsx)(tn,{open:!!t,title:t?.title||`Are you sure?`,confirmLabel:t?.confirmLabel,tone:t?.tone,onConfirm:()=>i(!0),onClose:()=>i(!1),children:t?.msg})]})}var sn=24;function cn(e,t){let n=e.title.toLowerCase();return n.startsWith(t)?0:n.includes(t)?1:e.hay.includes(t)?2:-1}function ln(e,t){let n=t.toLowerCase().trim();if(!e)return[];if(!n)return e.filter(e=>e.sortKey<0).sort((e,t)=>e.sortKey-t.sortKey);let r=[];for(let t of e){let e=cn(t,n);e>=0&&r.push({e:t,s:e})}r.sort((e,t)=>e.e.sortKey-t.e.sortKey||e.s-t.s||e.e.title.localeCompare(t.e.title));let i=r.map(e=>e.e),a=i.filter(e=>e.sortKey>=0).slice(0,sn);return i.filter(e=>e.sortKey<0).concat(a)}function un(e,t){let n=t.trim().toLowerCase(),r=n?e.toLowerCase().indexOf(n):-1;return r<0?e:(0,q.jsxs)(q.Fragment,{children:[e.slice(0,r),(0,q.jsx)(`mark`,{className:`spot-hit`,children:e.slice(r,r+n.length)}),e.slice(r+n.length)]})}function dn({query:e,index:t,loading:n,error:r,active:i,onActive:a,onPick:o}){let s=(0,B.useMemo)(()=>ln(t,e),[t,e]),c=(0,B.useRef)(null),l=s.length>0;(0,B.useLayoutEffect)(()=>{let e=c.current?.querySelectorAll(`[data-spot-row]`);if(!l||!e?.length||!E())return;let t=T(e,{opacity:[0,1],translateY:[-4,0],duration:220,delay:ae(18),ease:`outQuart`});return O(t,220+18*e.length)},[l]),(0,B.useEffect)(()=>{i>=s.length&&a(0)},[s,i,a]),(0,B.useEffect)(()=>{(c.current?.querySelector(`[data-spot-row="${i}"]`))?.scrollIntoView({block:`nearest`})},[i]);let u=[],d=null;s.forEach((e,t)=>{(!d||d.kind!==e.kind)&&(d={kind:e.kind,rows:[]},u.push(d)),d.rows.push({entry:e,index:t})});let f=!!e.trim();return(0,q.jsxs)(`div`,{className:`spotlight`,ref:c,id:`spotlight-list`,role:`listbox`,"aria-label":`Search results`,children:[u.map(t=>(0,q.jsxs)(`div`,{className:`spot-group`,role:`group`,"aria-label":t.kind,children:[(0,q.jsx)(`div`,{className:`spot-group-head`,"aria-hidden":`true`,children:t.kind}),t.rows.map(({entry:t,index:n})=>(0,q.jsxs)(`div`,{id:`spot-opt-${n}`,"data-spot-row":n,role:`option`,"aria-selected":n===i,className:`spot-row ${n===i?`on`:``}`,onMouseDown:e=>{e.preventDefault(),o(t)},onMouseEnter:()=>a(n),children:[(0,q.jsx)(`div`,{className:`spot-title`,children:un(t.title,e)}),t.desc?(0,q.jsx)(`div`,{className:`spot-desc`,children:t.desc}):null]},`${t.route||t.title}-${n}`))]},`${t.kind}-${t.rows[0].index}`)),f&&r&&(0,q.jsxs)(`div`,{className:`spot-empty`,role:`presentation`,children:[`Could not load the search index — `,r]}),f&&n&&!r&&(0,q.jsx)(`div`,{className:`spot-empty`,role:`presentation`,children:`Loading…`}),f&&!n&&!r&&s.length===0&&(0,q.jsxs)(`div`,{className:`spot-empty`,role:`presentation`,children:[`No matches for “`,e,`”.`]})]})}function fn({actions:e=[],dataRev:t}){let n=(0,B.useRef)(null),r=(0,B.useRef)(null),i=(0,B.useRef)(null),[a,o]=(0,B.useState)(!1),[s,c]=(0,B.useState)(``),[l,u]=(0,B.useState)(0),{index:d,error:f,prime:p}=en(t),m=an(),h=()=>{o(!0),p()},g=()=>{let e=n.current;e?.open&&(typeof e.close==`function`?e.close():e.removeAttribute(`open`)),o(!1),c(``),u(0),i.current?.focus()};(0,B.useEffect)(()=>{let e=n.current;a&&e&&!e.open&&(typeof e.showModal==`function`?e.showModal():e.setAttribute(`open`,``),r.current?.focus())},[a]),(0,B.useEffect)(()=>{let e=e=>{((e.metaKey||e.ctrlKey)&&!e.altKey&&e.key.toLowerCase()===`k`||e.key===`/`&&!e.target.closest(`input, textarea, select`))&&(e.preventDefault(),o(!0),p())};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[p]);let _=(0,B.useMemo)(()=>[...e.map(e=>({sortKey:-2,...e})),...$t,...d||[]],[e,d]),v=a?ln(_,s):[],y=l<v.length?`spot-opt-${l}`:void 0,b=async e=>{if(g(),!e.run)return _e(e.route);let t=e.confirm;(!t||await m(t.msg,{title:t.title,confirmLabel:t.confirmLabel,tone:t.tone}))&&e.run()};return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`button`,{type:`button`,className:`tb-cmdk`,ref:i,"aria-haspopup":`dialog`,onClick:h,title:`Press / to open, or Ctrl-K / ⌘K from inside any field`,children:[(0,q.jsx)(J,{name:`search`,className:`mag glyph`}),(0,q.jsx)(`span`,{className:`tb-cmdk-label`,children:`Search or run…`}),(0,q.jsx)(`kbd`,{className:`tb-cmdk-key`,children:`Ctrl K`})]}),(0,q.jsx)(`dialog`,{ref:n,className:`palette`,"aria-label":`Search or run`,onCancel:e=>{e.preventDefault(),g()},onClose:()=>a&&g(),onClick:e=>e.target===n.current&&g(),children:a&&(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`palette-head`,children:[(0,q.jsx)(J,{name:`search`,className:`mag glyph`}),(0,q.jsx)(`input`,{ref:r,role:`combobox`,"aria-label":`Search or run`,"aria-autocomplete":`list`,"aria-expanded":`true`,"aria-controls":`spotlight-list`,"aria-activedescendant":y,value:s,onChange:e=>{c(e.target.value),u(0)},onKeyDown:e=>{if(e.key===`ArrowDown`)e.preventDefault(),u(e=>Math.min(e+1,Math.max(v.length-1,0)));else if(e.key===`ArrowUp`)e.preventDefault(),u(e=>Math.max(e-1,0));else if(e.key===`Enter`){let t=v[l];t&&(e.preventDefault(),b(t))}else e.key===`Escape`&&(e.preventDefault(),s?(c(``),u(0)):g())},placeholder:`Search or run…`}),(0,q.jsx)(`kbd`,{className:`palette-key`,children:`Esc`})]}),(0,q.jsx)(`span`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:v.length?`${v.length} results`:`no matches`}),(0,q.jsx)(dn,{query:s,index:_,loading:!d,error:d?``:f,active:l,onActive:u,onPick:b}),(0,q.jsxs)(`div`,{className:`palette-foot`,children:[(0,q.jsx)(`span`,{children:`↑↓ move`}),(0,q.jsx)(`span`,{children:`↵ open`}),(0,q.jsx)(`span`,{children:`actions that write always ask first`})]})]})})]})}function pn({installs:e,onSwitch:t,fallback:n=null}){let[r,i]=(0,B.useState)(null),o=(e||[]).filter(e=>e.state===`active`);if(o.length<2)return n;let s=o.find(e=>e.selected)||o[0];return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`select`,{className:`sel tb-harness`,"aria-label":`Harness to view`,title:`Harness the console is viewing`,value:s.id,onChange:async e=>{let n=o.find(t=>t.id===e.target.value);if(n){i(null);try{await a.selectView(n.host,n.path),t?.()}catch(e){i(e?.body?.message||e.message)}}},children:o.map(e=>(0,q.jsx)(`option`,{value:e.id,children:e.scope===`global`?`${e.host} · global`:`${Jt(e)} · ${e.host}`},e.id))}),r&&(0,q.jsxs)(`span`,{className:`t-bad`,role:`alert`,children:[` `,`Switch failed: `,r]})]})}var mn=`button:not([disabled]), [href], input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`;function hn({open:e,onClose:t,anchorRef:n,label:r,className:i,children:a}){let o=(0,B.useRef)(null);return(0,B.useEffect)(()=>{if(!e)return;let r=o.current,i=n?.current;(r.querySelector(mn)||r).focus();let a=e=>{e.key===`Escape`&&t()},s=e=>{r.contains(e.target)||i?.contains(e.target)||t()};return document.addEventListener(`keydown`,a),document.addEventListener(`mousedown`,s),()=>{document.removeEventListener(`keydown`,a),document.removeEventListener(`mousedown`,s);let e=document.activeElement;(!e||e===document.body||r.contains(e))&&i?.focus()}},[e]),e?(0,q.jsx)(`div`,{ref:o,className:i?`popover ${i}`:`popover`,role:`dialog`,"aria-label":r,tabIndex:-1,children:a}):null}function gn({children:e,...t}){let n=D(`button.on`);return(0,q.jsxs)(`div`,{className:`seg`,role:`group`,ref:n,...t,children:[(0,q.jsx)(`span`,{className:`glide`,"aria-hidden":`true`}),e]})}function _n({value:e,onChange:t,labelledBy:n}){let r=lt(e);return(0,q.jsxs)(`div`,{className:`accent-picker`,role:`group`,"aria-labelledby":n,children:[at.map(n=>(0,q.jsx)(`button`,{type:`button`,className:`accent-src${e===n.id?` on`:``}`,"aria-pressed":e===n.id,title:n.tagline,onClick:()=>t(n.id),children:n.short},n.id)),(0,q.jsxs)(`div`,{className:`accent-swatches`,children:[ot.map(n=>(0,q.jsx)(`button`,{type:`button`,className:`accent-swatch${e===n.id?` on`:``}`,style:{"--sw":n.hex},"aria-pressed":e===n.id,"aria-label":`${n.short} accent`,title:n.short,onClick:()=>t(n.id)},n.id)),(0,q.jsx)(`label`,{className:`accent-swatch accent-custom${r?` on picked`:``}`,style:r?{"--sw":r}:void 0,title:r?`Your colour, ${r}`:`Pick any colour`,children:(0,q.jsx)(`input`,{type:`color`,"aria-label":`Custom accent colour`,value:(r||`#3AD4C4`).toLowerCase(),onChange:e=>t(`hex:${e.target.value.toUpperCase()}`)})})]})]})}function vn({flavour:e,onFlavour:t,accentMode:n,onAccentMode:r,layout:i,onLayout:a,onClose:o,anchorRef:s}){let c=(e,t,n,r,i)=>(0,q.jsxs)(`div`,{className:`ap-group`,children:[(0,q.jsx)(`span`,{className:`ap-label`,id:e,children:t}),(0,q.jsx)(gn,{"aria-labelledby":e,children:n.map(e=>(0,q.jsx)(`button`,{type:`button`,className:r===e.id?`on`:``,"aria-pressed":r===e.id,title:e.tagline,onClick:()=>i(e.id),children:e.short},e.id))})]});return(0,se.createPortal)((0,q.jsxs)(hn,{open:!0,onClose:o,anchorRef:s,label:`Appearance`,className:`appearance-pop`,children:[c(`ap-skin`,`Skin`,Je,e,t),(0,q.jsxs)(`div`,{className:`ap-group`,children:[(0,q.jsx)(`span`,{className:`ap-label`,id:`ap-accent`,children:`Accent`}),(0,q.jsx)(_n,{value:n,onChange:r,labelledBy:`ap-accent`})]}),c(`ap-view`,`Overview view`,ht,i,a)]}),document.querySelector(`.app`)||document.body)}function yn({route:e,navOpen:t,onToggleNav:n,overview:r,installs:i,actions:a,mode:o,onToggleMode:s,appearance:c,dataRev:l,onSwitch:u}){let[d,f]=(0,B.useState)(!1),p=(0,B.useRef)(null),m=r?.install,h=m?`${m.host}:${m.scope}`:kt(r?.target),g=e.tab&&le[e.tab];return(0,q.jsxs)(`header`,{className:`topbar`,children:[(0,q.jsx)(`button`,{type:`button`,className:`tb-menu iconbtn`,onClick:n,"aria-label":t?`Close navigation`:`Open navigation`,"aria-expanded":!!t,"aria-controls":`rail-nav`,children:(0,q.jsx)(J,{name:t?`x`:`menu`})}),(0,q.jsx)(`nav`,{className:`crumbs`,"aria-label":`Breadcrumb`,children:(0,q.jsxs)(`ol`,{children:[(0,q.jsx)(`li`,{className:`crumb-root mono`,children:(0,q.jsx)(pn,{installs:i,onSwitch:u,fallback:(0,q.jsx)(`a`,{href:`#/installs`,title:r?.target||void 0,children:h})})}),(0,q.jsx)(`li`,{children:g?(0,q.jsx)(`a`,{href:e.page===`overview`?`#/`:`#/${e.page}`,children:V[e.page]}):(0,q.jsx)(`span`,{className:`crumb-here`,"aria-current":`page`,children:V[e.page]})}),g?(0,q.jsx)(`li`,{children:(0,q.jsx)(`span`,{className:`crumb-here`,"aria-current":`page`,children:g})}):null]})}),(0,q.jsx)(`div`,{className:`topbar-spacer`}),(0,q.jsx)(fn,{actions:a,dataRev:l}),(0,q.jsx)(`button`,{type:`button`,className:`iconbtn`,ref:p,"aria-label":`Appearance`,title:`Appearance`,"aria-expanded":d,onClick:()=>f(e=>!e),children:(0,q.jsx)(J,{name:`themes`})}),d?(0,q.jsx)(vn,{...c,anchorRef:p,onClose:()=>f(!1)}):null,(0,q.jsx)(`button`,{type:`button`,className:`iconbtn`,title:o===`light`?`Switch to dark`:`Switch to light`,"aria-label":o===`light`?`Switch to dark mode`:`Switch to light mode`,onClick:s,children:(0,q.jsx)(J,{name:o===`light`?`moon`:`sun`})})]})}function bn({themes:e,current:t,onPick:n,onClose:r}){let i=an(),a=(0,B.useRef)(null);return(0,B.useEffect)(()=>{let e=e=>{a.current&&!a.current.contains(e.target)&&r()},t=e=>{e.key===`Escape`&&r()};return document.addEventListener(`mousedown`,e),document.addEventListener(`keydown`,t),()=>{document.removeEventListener(`mousedown`,e),document.removeEventListener(`keydown`,t)}},[r]),(0,B.useEffect)(()=>{a.current?.querySelector(`button.pop-item`)?.focus()},[]),(0,q.jsxs)(`div`,{className:`pop`,ref:a,role:`dialog`,"aria-label":`Switch voice`,children:[(0,q.jsx)(`div`,{className:`tick`,style:{padding:`4px 10px 8px`},children:`Switch voice`}),e.map(e=>(0,q.jsx)(`button`,{type:`button`,"aria-pressed":e.name===t,className:`pop-item ${e.name===t?`on`:``}`,onClick:async()=>{r(),await i(`Rebuild the deployed harness in the “${e.name}” voice? It rebuilds in place, non-destructive.`,{title:`Switch voice?`,confirmLabel:`Rebuild`})&&n(e.name)},children:(0,q.jsx)(`span`,{className:`pn`,children:e.name})},e.name))]})}var xn=3500;function Sn({toast:e,onClose:t}){let[n,r]=(0,B.useState)(null),i=!!e&&e.kind!==`err`&&n!==e;(0,B.useEffect)(()=>{if(!i)return;let e=setTimeout(t,xn);return()=>clearTimeout(e)},[e,i]);let a=()=>r(e),o=()=>r(null);return(0,q.jsx)(`div`,{className:`toast-region`,"aria-live":e?.kind===`err`?void 0:`polite`,children:e&&(0,q.jsxs)(`div`,{className:`toast ${e.kind}`,role:e.kind===`err`?`alert`:void 0,onMouseEnter:a,onMouseLeave:e=>{e.currentTarget.contains(document.activeElement)||o()},onFocus:a,onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||o()},children:[(0,q.jsx)(`div`,{children:e.msg}),(0,q.jsx)(`div`,{style:{marginTop:8},children:(0,q.jsx)(`button`,{className:`btn ghost`,onClick:t,children:`Dismiss`})})]})})}function Cn({runs:e,open:t,onToggle:n,onClear:r,onCancel:i,busy:a,finish:o}){let s=(0,B.useRef)(null),c=(0,B.useRef)(null);(0,B.useEffect)(()=>{let e=c.current;o&&e&&(e.classList.remove(`flash-ok`,`flash-bad`),e.offsetWidth,e.classList.add(o.status===`done`?`flash-ok`:`flash-bad`))},[o]);let l=e.length?e[e.length-1].output.length:0;return(0,B.useEffect)(()=>{let e=s.current;e&&t&&(e.scrollTop=e.scrollHeight)},[e.length,l,t]),(0,q.jsxs)(`div`,{className:`console`,style:{height:`42vh`,transform:t?`none`:`translateY(calc(42vh - 42px))`},children:[(0,q.jsxs)(`div`,{className:`console-head`,ref:c,onClick:n,onAnimationEnd:e=>{e.target===e.currentTarget&&e.currentTarget.classList.remove(`flash-ok`,`flash-bad`)},children:[a&&(0,q.jsx)(`span`,{className:`console-progress`,"aria-hidden":`true`}),(0,q.jsxs)(`span`,{className:`ttl`,children:[(0,q.jsx)(`span`,{className:`live ${a?`on`:``}`}),`terminal`]}),(0,q.jsx)(`span`,{className:`count`,children:e.length}),(0,q.jsxs)(`div`,{className:`right`,onClick:e=>e.stopPropagation(),children:[(0,q.jsx)(`button`,{className:`iconbtn`,title:`Clear`,"aria-label":`Clear run history`,onClick:r,disabled:!e.length,children:(0,q.jsx)(J,{name:`clear`})}),(0,q.jsx)(`button`,{className:`iconbtn`,title:t?`Collapse`:`Expand`,"aria-label":t?`Collapse console`:`Expand console`,"aria-expanded":t,onClick:n,children:(0,q.jsx)(J,{name:`chevron`,className:`glyph`,style:{transform:t?`rotate(90deg)`:`rotate(-90deg)`}})})]})]}),t&&(0,q.jsxs)(`div`,{className:`console-body`,ref:s,children:[e.length===0&&(0,q.jsx)(`div`,{className:`console-empty`,children:`No commands run yet. Actions you trigger stream here.`}),e.map(e=>(0,q.jsxs)(`div`,{className:`run`,children:[(0,q.jsxs)(`div`,{className:`run-head`,children:[(0,q.jsx)(`span`,{className:`pr`,children:`$`}),(0,q.jsx)(`span`,{className:`act`,children:e.action}),(0,q.jsx)(`span`,{className:`st ${e.status}`,children:e.status===`running`?`…running`:`${e.status===`done`?`✓ done`:`✗ failed`}${e.duration?` · ${e.duration}s`:``}`}),e.status===`running`&&i&&(0,q.jsx)(`button`,{className:`iconbtn run-cancel`,title:`Cancel this run`,"aria-label":`Cancel the ${e.action} run`,onClick:()=>i(e.id),children:(0,q.jsx)(J,{name:`x`})})]}),e.output&&(0,q.jsx)(`pre`,{className:`run-out`,children:e.output})]},e.id))]})]})}var wn=550,Tn=`gs-splash-seen`,En=8e3;function Dn(){try{if(window.localStorage.getItem(Tn))return 0;window.localStorage.setItem(Tn,`1`)}catch{}return wn}function On({ready:e,onDone:t}){let[n,r]=(0,B.useState)(!1),[i,a]=(0,B.useState)(!1);(0,B.useEffect)(()=>{let e=setTimeout(()=>r(!0),Dn());return()=>clearTimeout(e)},[]);let[o,s]=(0,B.useState)(!1);(0,B.useEffect)(()=>{if(e)return;let t=setTimeout(()=>s(!0),En);return()=>clearTimeout(t)},[e]),e&&n&&!i&&a(!0),(0,B.useEffect)(()=>{if(!i)return;let e=setTimeout(()=>t?.(),700);return()=>clearTimeout(e)},[i]);let c=o&&!i;return(0,q.jsxs)(`div`,{className:`boot-splash${i?` fading`:``}`,"aria-hidden":c?void 0:`true`,onAnimationEnd:e=>{e.animationName===`splashOut`&&t?.()},children:[(0,q.jsxs)(`div`,{className:`boot-dial`,"aria-hidden":`true`,children:[(0,q.jsxs)(`svg`,{className:`boot-ring`,viewBox:`0 0 172 172`,children:[(0,q.jsx)(`circle`,{cx:`86`,cy:`86`,r:`72`,fill:`none`,stroke:`var(--surface-3)`,strokeWidth:`9`}),(0,q.jsx)(`circle`,{cx:`86`,cy:`86`,r:`50`,fill:`none`,stroke:`var(--line-2)`,strokeWidth:`8`,strokeDasharray:`1.2 5.3`,opacity:`.7`}),(0,q.jsx)(`circle`,{className:`boot-progress`,cx:`86`,cy:`86`,r:`72`,fill:`none`,stroke:`var(--accent)`,strokeWidth:`9`,strokeLinecap:`round`})]}),(0,q.jsxs)(`svg`,{className:`boot-sprout`,viewBox:`0 0 24 24`,children:[(0,q.jsx)(`path`,{className:`bs-stem`,d:`M12 21.5v-9`,stroke:`var(--accent)`,strokeWidth:`2`,strokeLinecap:`round`,fill:`none`}),(0,q.jsx)(`path`,{className:`bs-leaf bs-leaf-main`,d:`M12 13c0-4.5 3.2-7.5 7.5-7.5 0 4.5-3.2 7.5-7.5 7.5z`,fill:`var(--accent)`}),(0,q.jsx)(`path`,{className:`bs-leaf bs-leaf-back`,d:`M12 14.5c0-3.6-2.6-6-6-6 0 3.6 2.6 6 6 6z`,fill:`var(--accent)`,opacity:`.42`}),(0,q.jsx)(`circle`,{cx:`12`,cy:`12.4`,r:`1.1`,fill:`var(--bg)`})]})]}),c?(0,q.jsxs)(`div`,{className:`boot-status`,role:`alert`,children:[(0,q.jsx)(`span`,{children:`The server is not answering.`}),` `,(0,q.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>window.location.reload(),children:`Retry`})]}):(0,q.jsxs)(`div`,{className:`boot-status`,children:[(0,q.jsx)(`span`,{children:`germinating harness`}),(0,q.jsx)(`span`,{className:`boot-caret`})]})]})}function kn({label:e=`Loading…`}){return(0,q.jsxs)(`div`,{className:`loading`,role:`status`,children:[e,(0,q.jsxs)(`div`,{className:`skel`,"aria-hidden":`true`,children:[(0,q.jsx)(`div`,{className:`skel-bar`}),(0,q.jsx)(`div`,{className:`skel-bar`}),(0,q.jsx)(`div`,{className:`skel-bar`})]})]})}function An({error:e,style:t,onRetry:n,role:r=`alert`}){return e?n?(0,q.jsxs)(`div`,{className:`error-state`,role:r,style:t,children:[(0,q.jsx)(`p`,{className:`badge bad`,children:e}),(0,q.jsx)(`button`,{type:`button`,className:`btn sm`,onClick:n,children:`Retry`})]}):(0,q.jsx)(`p`,{className:`badge bad`,role:r,style:t,children:e}):null}function jn(){let[e,t]=(0,B.useState)(!1),[n,r]=(0,B.useState)(null);return(0,q.jsxs)(`div`,{className:`stale-banner`,role:`alert`,children:[(0,q.jsx)(`span`,{children:n||`This console is running code from before your last upgrade.`}),(0,q.jsx)(`button`,{className:`btn sm`,onClick:async()=>{t(!0),r(null);try{await rt()}catch(e){r(e.message),t(!1)}},disabled:e,children:e?`Restarting…`:`Restart`})]})}var Mn=/dynamically imported module|Importing a module script failed|Unable to preload CSS/i,Nn=e=>Mn.test(e?.message||``),Pn=class extends B.Component{state={error:null};static getDerivedStateFromError(e){return{error:e}}render(){let{error:e}=this.state;if(!e)return this.props.children;let t=Nn(e);return(0,q.jsxs)(`div`,{role:t?void 0:`alert`,children:[(0,q.jsx)(An,{error:e.message||String(e),role:null}),t?(0,q.jsx)(jn,{}):(0,q.jsx)(`button`,{type:`button`,className:`btn sm`,onClick:()=>this.setState({error:null}),children:`Retry`})]})}},Fn=(0,B.createContext)(null),In=e=>[...e].sort().join(`,`),Ln=e=>[...e.values()].some(e=>!e.applied&&In(e.value)!==e.base);function Rn(e,t){let[n,r]=(0,B.useState)(()=>({kits:new Map,rules:new Map})),[i,a]=(0,B.useState)(null),[o,s]=(0,B.useState)(t);if(o!==t&&(s(t),i&&t)){let e=t.status===`done`?{applied:!0}:{failed:!0};r(t=>{let n=t[i.kind].get(i.key);return n?{...t,[i.kind]:new Map(t[i.kind]).set(i.key,{...n,...e})}:t}),a(null)}let c=Ln(n.kits)||Ln(n.rules);return(0,B.useEffect)(()=>{if(!c)return;let e=e=>{e.preventDefault(),e.returnValue=``};return window.addEventListener(`beforeunload`,e),()=>window.removeEventListener(`beforeunload`,e)},[c]),{get:(e,t)=>n[e].get(t),put:(e,t,n,i)=>r(r=>{let a=new Map(r[e]);return In(n)===i?a.delete(t):a.set(t,{value:n,base:i}),{...r,[e]:a}}),drop:(e,t)=>r(n=>{let r=new Map(n[e]);return r.delete(t),{...n,[e]:r}}),prune:(0,B.useCallback)((e,t)=>r(n=>{let r=[...n[e]].filter(([e,n])=>t(e,n)).map(([e])=>e);if(!r.length)return n;let i=new Map(n[e]);return r.forEach(e=>i.delete(e)),{...n,[e]:i}}),[]),startApply:(e,t)=>{a({kind:e,key:t}),r(n=>{let r=n[e].get(t);return r?.failed?{...n,[e]:new Map(n[e]).set(t,{value:r.value,base:r.base})}:n})},running:(t,n)=>!!e&&i?.kind===t&&i?.key===n,busy:!!e}}function zn({activeId:e,finish:t,children:n}){let r=Rn(e,t);return(0,q.jsx)(Fn.Provider,{value:r,children:n})}function Bn(){let e=Rn(null,null);return(0,B.useContext)(Fn)||e}function Vn({eyebrow:e,title:t,sub:n,primary:r,actions:i,crumbs:a}){return(0,q.jsxs)(`div`,{className:`page-head`,children:[(0,q.jsxs)(`div`,{children:[a?.length?(0,q.jsx)(`nav`,{"aria-label":`Breadcrumb`,className:`page-crumbs`,children:(0,q.jsx)(`ol`,{children:a.map((e,t)=>(0,q.jsx)(`li`,{children:t===a.length-1?(0,q.jsx)(`span`,{"aria-current":`page`,children:e.label}):e.href?(0,q.jsx)(`a`,{href:e.href,children:e.label}):e.label},t))})}):null,e?(0,q.jsx)(`div`,{className:`eyebrow`,children:e}):null,(0,q.jsx)(`h1`,{className:`h`,children:t}),n?(0,q.jsx)(`p`,{className:`sub`,children:n}):null]}),r||i?(0,q.jsxs)(`div`,{className:`page-actions`,children:[i,r]}):null]})}var Hn=e=>!!e&&!e.endsWith(`-global`);function Un({onAction:e}){let{data:t,error:n}=W(()=>a.themes(),[]),[r,i]=(0,B.useState)(``),[o,s]=(0,B.useState)(``),[c,l]=(0,B.useState)(``),[u,d]=(0,B.useState)(``),[f,p]=(0,B.useState)(!1);if(n)return(0,q.jsx)(An,{error:n});if(!t)return(0,q.jsx)(kn,{});let m=r||t.current?.theme||`neutral`,h=(t.emits||[]).filter(e=>e.name!==`files`),g=t.emits?.some(e=>e.name===`opencode-global`),_=o||(g?`opencode-global`:t.current?.emit||h[0]?.name||``),v=i,y=s,b=Hn(_);return(0,q.jsxs)(`div`,{className:`narrow-lg`,children:[(0,q.jsx)(`div`,{className:`head-row mb-18`,children:(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h1`,{className:`h`,children:`Deploy your harness`}),(0,q.jsx)(`p`,{className:`sub`,children:`Geneseed isn't implanted on this machine yet. Pick a voice and an install mode, then deploy. The graft runs in the console below, and this dashboard lights up when it lands.`})]})}),(0,q.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,q.jsx)(`div`,{className:`card-head`,children:(0,q.jsx)(`h3`,{children:`1 · Choose a voice`})}),(0,q.jsx)(`div`,{className:`row wrap gap-10`,children:t.themes.map(e=>(0,q.jsx)(`button`,{className:`btn ${e.name===m?`soft`:`ghost`}`,onClick:()=>v(e.name),title:e.blurb||e.tagline||e.name,children:(0,q.jsx)(`span`,{style:{textTransform:`capitalize`},children:e.name})},e.name))})]}),(0,q.jsxs)(`div`,{className:`card pad-lg mb-16`,children:[(0,q.jsx)(`div`,{className:`card-head`,children:(0,q.jsx)(`h3`,{children:`2 · Install mode`})}),(0,q.jsxs)(`p`,{className:`sub mb-16`,children:[`A `,(0,q.jsx)(`code`,{children:`-global`}),` mode deploys once to that tool's global config, so every repo on this machine inherits the harness (recommended). A project mode installs into the repository folder you choose.`]}),(0,q.jsxs)(`label`,{className:`stack`,style:{gap:6,maxWidth:360},children:[(0,q.jsx)(`span`,{className:`tick`,children:`Mode`}),(0,q.jsx)(`select`,{className:`sel`,value:_,onChange:e=>y(e.target.value),children:h.map(e=>(0,q.jsxs)(`option`,{value:e.name,children:[e.name,e.desc?` · ${e.desc}`:``]},e.name))})]}),b&&(0,q.jsxs)(`div`,{className:`row gap-10`,style:{maxWidth:560,marginTop:12},children:[(0,q.jsx)(`input`,{className:`inp`,style:{flex:1},type:`text`,placeholder:`/path/to/project, or click Browse…`,value:c,onChange:e=>l(e.target.value),"aria-label":`Project folder to install into`}),(0,q.jsx)(`button`,{className:`btn ghost sm`,disabled:f,onClick:async()=>{p(!0),d(``);try{let e=await a.pickFolder();e.path?l(e.path):e.error&&d(e.error)}catch(e){d(e.message)}finally{p(!1)}},children:f?`Choosing…`:`Browse…`})]}),u&&(0,q.jsx)(`p`,{className:`sub`,style:{marginTop:12},children:u})]}),(0,q.jsxs)(`button`,{className:`btn btn-grid`,disabled:!m||!_||b&&!c.trim(),onClick:()=>{if(!b)return e(`build`,{theme:m,emit:_});let t=c.trim();return t?(d(``),e(`deploy`,{host:_,path:t,theme:m})):d(`Choose or type the project folder to install into.`)},children:[(0,q.jsx)(J,{name:`build`}),`Deploy harness`]})]})}var Wn=e=>W(()=>a.rules().catch(()=>null),[e],`rules`,{revalidate:!0}),Gn=()=>Ct(`rules`);function Kn({segments:e,value:t,max:n,size:r=120,stroke:i=12,label:a,sweepMs:o=650}){let s=n>0?n:0,c=e||[{key:`v`,label:a,n:Math.min(Math.max(t||0,0),s),tone:`accent`}],l=e?c.reduce((e,t)=>e+t.n,0):s,u=e?c.map(e=>`${e.label}: ${e.n} of ${l}`).join(`, `):`${c[0].n} of ${l}`,d=r/2-i/2,f=r/2,p=e=>[f+d*Math.cos(e),f+d*Math.sin(e)],m=[],h=0;for(let e of c)m.push(h),h+=e.n;let g=(0,B.useRef)(null),_=c.map(e=>e.n).join(`,`);return(0,B.useLayoutEffect)(()=>{let e=g.current?.querySelectorAll(`path.ring-arc`);if(!o||!e?.length||!E())return;let t=c.map(e=>e.n/l).filter(e=>e>0),n=t.map((e,n)=>t.slice(0,n).reduce((e,t)=>e+t,0)),r=z(e);k(r,{draw:`0 0`});let i=T(r,{draw:[`0 0`,`0 1`],duration:(e,n)=>Math.max(o*t[n],60),delay:(e,t)=>o*n[t],ease:`linear`});return O(i,o)},[_,o]),(0,q.jsxs)(`svg`,{className:`ring`,width:r,height:r,viewBox:`0 0 ${r} ${r}`,role:`img`,"aria-label":a?`${a}: ${u}`:u,children:[(0,q.jsx)(`circle`,{className:`ring-track`,cx:f,cy:f,r:d,fill:`none`,strokeWidth:i}),(0,q.jsx)(`g`,{ref:g,children:l>0?c.map((e,t)=>{let n=e.n/l;if(!(n>0))return null;let r=m[t]/l*2*Math.PI-Math.PI/2,a=r+n*2*Math.PI,[o,s]=p(r),[c,u]=p(a),h=n>=.9999?`M ${o} ${s} A ${d} ${d} 0 1 1 ${2*f-o} ${2*f-s} A ${d} ${d} 0 1 1 ${o} ${s}`:`M ${o} ${s} A ${d} ${d} 0 ${+(n>.5)} 1 ${c} ${u}`;return(0,q.jsx)(`path`,{className:`ring-arc tone-${e.tone||`muted`}`,d:h,fill:`none`,strokeWidth:i,children:(0,q.jsxs)(`title`,{children:[e.label,`: `,e.n]})},e.key)}):null})]})}var qn=500;function Jn({parts:e,total:t,label:n,legend:r=!0}){let i=e.reduce((e,t)=>e+t.n,0),a=t??i,o=e=>a>0?`${e/a*100}%`:`0%`,s=e.map(e=>`${e.label}: ${e.n} of ${a}`).join(`, `),c=(0,B.useRef)(null),l=e.map(e=>e.n).join(`,`)+`/${a}`;return(0,B.useLayoutEffect)(()=>{if(c.current&&E())return k(c.current,{scaleX:0}),O(T(c.current,{scaleX:[0,1],duration:qn,ease:`outExpo`}),qn)},[l]),(0,q.jsxs)(`div`,{className:`stackbar-box`,children:[(0,q.jsx)(`div`,{className:`stackbar sweep`,role:`img`,"aria-label":n?`${n}: ${s}`:s,ref:c,children:e.map(e=>e.n>0?(0,q.jsx)(`span`,{className:`tone-${e.tone||`muted`}`,style:{width:o(e.n)},title:`${e.label}: ${e.n}`},e.key):null)}),r&&(0,q.jsx)(`ul`,{className:`stackbar-legend`,"aria-hidden":`true`,children:e.map(e=>(0,q.jsxs)(`li`,{children:[(0,q.jsx)(`i`,{className:`tone-${e.tone||`muted`}`}),e.label,` `,(0,q.jsx)(`span`,{className:`mono`,children:e.n})]},e.key))})]})}function Yn({value:e,max:t,label:n=`value`,tone:r=`accent`}){let i=t>0?t:0;return(0,q.jsx)(Jn,{parts:[{key:`v`,label:n,n:Math.min(Math.max(e||0,0),i),tone:r}],total:i,legend:!1})}var Xn=864e5;function Zn(e,t=10,n=`today`){let r=Array(t).fill(0).map((e,r)=>({t:r===t-1?n:`${t-1-r}d`,v:0})),i=e=>new Date(e).setHours(0,0,0,0),a=i(Date.now());for(let n of e){let e=n.started||n.finished||n.created||n.ts;if(!e)continue;let o=typeof e==`string`?Date.parse(e):e*1e3;if(!Number.isFinite(o))continue;let s=Math.round((a-i(o))/Xn);s<0||s>=t||(r[t-1-s].v+=1)}return r}var Qn=(e,t)=>[...e||[]].sort((e,t)=>(t.started||0)-(e.started||0)).slice(0,t),$n=[`--emit`,`--theme`,`--scope`],er={done:`✓`,failed:`✗`};function tr(e){let t=(e.output||``).split(`
3
- `).find(e=>e.startsWith(`$ `))||``,n=t.split(/\s+/),r=[];return n.forEach((e,t)=>{let[i,a]=e.split(`=`),o=a||n[t+1];$n.includes(i)&&o&&!o.startsWith(`--`)&&r.push(o)}),{verb:(e.action||`run`).split(/[\s(]/)[0],scope:r.join(` · `),result:er[e.status]||`…`,duration:e.duration?`${e.duration}s`:`—`,command:t}}var nr={busy:{cls:`acc`,label:`working`,accent:`var(--accent)`},"waiting-input":{cls:`warn`,label:`your move`,accent:`var(--warn)`},blocked:{cls:`bad`,label:`blocked`,accent:`var(--bad)`},idle:{cls:``,label:`idle`,accent:`var(--line)`}},rr={cls:``,label:`ended`};function ir(e){if(!e)return``;let t=e.replace(/\\/g,`/`).replace(/\/+$/,``).split(`/`);return t[t.length-1]||e}var ar=e=>e?e<1e3?String(e):e<1e5?(e/1e3).toFixed(1)+`k`:e<1e6?(e/1e3).toFixed(0)+`k`:(e/1e6).toFixed(1)+`M`:`0`;function or(e){if(e=Math.max(0,Math.floor(e)),e<60)return`${e}s`;let t=Math.floor(e/60);return t<60?`${t}m ${e%60}s`:`${Math.floor(t/60)}h ${t%60}m`}function sr({startedAt:e}){let[t,n]=(0,B.useState)(()=>Date.now()/1e3);return(0,B.useEffect)(()=>{let e=setInterval(()=>n(Date.now()/1e3),1e3);return()=>clearInterval(e)},[]),or(t-e)}function cr({done:e,total:t}){let n=Math.min(t,10),r=Math.min(n,Math.round(e/t*n));return(0,q.jsxs)(`span`,{className:`act-todo`,children:[(0,q.jsx)(`span`,{className:`on`,children:`●`.repeat(r)}),(0,q.jsx)(`span`,{className:`dim`,children:`○`.repeat(n-r)})]})}var lr=e=>e.ended?null:e.turn_started_at,ur=e=>!!(e.tokens>0||e.cost>0||lr(e)||e.files?.count>0);function dr({s:e,heading:t,id:n,children:r}){let i=e.ended?rr:nr[e.status]||nr.idle,a=e.files,o=ur(e),s=e=>n?`${n}-${e}`:void 0;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`div`,{className:`row between wrap gap-12`,children:[t?(0,q.jsxs)(`div`,{className:`row gap-10 act-min`,children:[(0,q.jsx)(`span`,{className:`feed-dot act-dot ${e.ended?``:i.cls||`acc`}`}),(0,q.jsxs)(`div`,{className:`act-min`,children:[(0,q.jsx)(`h2`,{className:`act-title`,id:s(`t`),children:t}),e.cwd&&(0,q.jsx)(`div`,{className:`dim mono act-cwd`,title:e.cwd,children:e.cwd})]})]}):null,(0,q.jsxs)(`div`,{className:`row gap-8 act-fixed`,children:[e.model&&(0,q.jsx)(`span`,{className:`badge mono`,title:`model`,children:e.model}),e.agent&&(0,q.jsx)(`span`,{className:`badge`,children:e.agent}),(0,q.jsxs)(`span`,{className:`badge ${i.cls}`,id:s(`st`),children:[(0,q.jsx)(`span`,{className:`dot`}),i.label]}),r]})]}),e.phase&&(0,q.jsxs)(`div`,{className:`row gap-8 act-phase`,children:[(0,q.jsx)(J,{name:`activity`}),(0,q.jsx)(`span`,{className:`act-ell`,children:e.phase})]}),o&&(0,q.jsxs)(`div`,{className:`row wrap act-counters`,id:s(`c`),children:[e.tokens>0&&(0,q.jsxs)(`span`,{children:[ar(e.tokens),` tok`]}),e.cost>0&&(0,q.jsxs)(`span`,{children:[`$`,e.cost.toFixed(2)]}),lr(e)?(0,q.jsx)(`span`,{children:(0,q.jsx)(sr,{startedAt:e.turn_started_at})}):null,a&&a.count>0&&(0,q.jsxs)(`span`,{children:[a.count,` file`,a.count===1?``:`s`,` `,(0,q.jsxs)(`span`,{className:`t-good`,children:[`+`,a.additions]}),` `,(0,q.jsxs)(`span`,{className:`t-bad`,children:[`−`,a.deletions]})]})]}),(e.error||e.blocked_on)&&(0,q.jsx)(`div`,{className:`act-err-row`,children:(0,q.jsx)(`span`,{className:`badge bad act-ell`,title:e.error||e.blocked_on,children:e.error||e.blocked_on})})]})}var fr=e=>e?.status===`blocked`||e?.status===`waiting-input`,pr=864e5,mr=e=>new Date(e).toISOString().slice(0,10),hr=(e,t)=>new Date(`${e}T00:00:00Z`).toLocaleDateString(`en-GB`,{...t,timeZone:`UTC`}),gr=e=>hr(e,{day:`numeric`,month:`short`});function _r(e,t=Date.now()){let n=hr(e,{weekday:`long`,day:`numeric`,month:`long`}),r=e===mr(t)?`Today`:e===mr(t-pr)?`Yesterday`:``;return r?`${r} · ${n}`:n}function vr(e,{now:t=Date.now(),days:n=14,cap:r}={}){let i=(e||[]).filter(e=>Number.isFinite(e.started)),a={};for(let e of i){let t=mr(e.started*1e3);a[t]=(a[t]||0)+1}let o=i.length?mr(Math.min(...i.map(e=>e.started))*1e3):null,s=i.filter(e=>e.status!==`running`).length,c=typeof r!=`number`||s>=r;return Array.from({length:n},(e,r)=>{let i=mr(t-(n-1-r)*pr);return{key:i,n:a[i]||0,nodata:c&&(o===null||i<o)}})}var yr=(e,t)=>`${e} ${t}${e===1?``:`s`}`;function br(e,t,n,r=Date.now()){let i={},a=e=>i[e]||={key:e,runs:[],asks:[]};for(let t of Qn(e,(e||[]).length))Number.isFinite(t.started)&&a(mr(t.started*1e3)).runs.push(t);return(n||[]).forEach((e,n)=>{for(let r of t||[])r.per_day?.[n]>0&&a(e).asks.push([r.name,r.per_day[n]])}),Object.values(i).sort((e,t)=>e.key<t.key?1:-1).map(({key:e,runs:t,asks:n})=>{n.sort((e,t)=>t[1]-e[1]);let i=n.reduce((e,t)=>e+t[1],0),a=n.map(([e,t],n)=>`${e}${n?``:` asked`} ${t}×`).join(`, `),o=[t.length&&yr(t.length,`run`),i&&yr(i,`gate ask`)];return{key:e,title:_r(e,r),sum:o.filter(Boolean).join(` · `),runs:t,gate:i?{title:a,n:i}:null}})}var xr=500;function Sr({vals:e,i:t,sweep:n=!1}){let r=(0,B.useRef)(null),i=e.join(`,`);(0,B.useLayoutEffect)(()=>{if(n&&r.current&&E())return k(r.current,{strokeDasharray:1,strokeDashoffset:1}),O(T(r.current,{strokeDashoffset:[1,0],duration:xr,ease:`outExpo`}),xr)},[i,n]);let a=Math.max(1,...e),o=96/(e.length-1),s=e.map((e,t)=>`${(t*o).toFixed(1)},${(20-e/a*17).toFixed(1)}`),[c,l]=s[s.length-1].split(`,`);return(0,q.jsxs)(`svg`,{className:`spark`,viewBox:`0 0 96 22`,"aria-hidden":`true`,style:{"--i":t},children:[(0,q.jsx)(`polyline`,{points:`0,21 96,21`,className:`spk-base`}),(0,q.jsx)(`polygon`,{className:`spk-area`,points:`0,21 ${s.join(` `)} 96,21`}),(0,q.jsx)(`polyline`,{className:`spk-line`,pathLength:`1`,points:s.join(` `),ref:r}),(0,q.jsx)(`circle`,{className:`spk-end`,cx:c,cy:l,r:`2.4`})]})}function Cr(e,t){let n=(0,B.useRef)(null);return(0,B.useLayoutEffect)(()=>{let e=n.current?[...n.current.querySelectorAll(`[data-sweep]`)]:[];if(e.length&&E())return k(e,{[t]:0}),O(T(e,{[t]:[0,1],duration:xr,ease:`outExpo`}),xr)},[e,t]),n}var Y={security:`oklch(0.74 0.085 45)`,verify:`oklch(0.78 0.075 200)`,process:`oklch(0.76 0.075 150)`,craft:`oklch(0.78 0.085 95)`,context:`oklch(0.74 0.08 280)`,comms:`oklch(0.76 0.085 345)`},wr={security:{label:`Security`,c:Y.security},verify:{label:`Verification`,c:Y.verify},process:{label:`Process`,c:Y.process},craft:{label:`Craft`,c:Y.craft},context:{label:`Context`,c:Y.context},comms:{label:`Communication`,c:Y.comms}},Tr={craft:Y.craft,rigor:Y.verify,ops:Y.process,process:Y.security,comms:Y.comms},Er=e=>Tr[e]||`var(--text-3)`,Dr={design:{label:`Design`,c:Y.context},build:{label:`Build`,c:Y.craft},review:{label:`Review`,c:Y.security},ship:{label:`Ship`,c:Y.process},understand:{label:`Understand`,c:Y.verify},learn:{label:`Learn`,c:Y.comms},harness:{label:`Harness`,c:`oklch(0.76 0.07 250)`},personal:{label:`Personal`,c:`oklch(0.72 0.025 250)`}},Or=Object.keys(Dr);function kr(e){let t=String(e||``),n=/\(retired\)\s*$/i.test(t);t=t.replace(/\s*\(retired\)\s*$/i,``),t=t.replace(/^(?:Rule\s+[IVXLCDM\d]+|Doctrine\s+[a-z]+\s+\d+)\s*[—-]\s*/i,``);let r=t.indexOf(` · `);return r===-1?{latin:``,name:t.trim(),retired:n}:{latin:t.slice(0,r).trim(),name:t.slice(r+3).trim(),retired:n}}var Ar=[[10,`X`],[9,`IX`],[5,`V`],[4,`IV`],[1,`I`]],jr=e=>{let t=``;for(let[n,r]of Ar)for(;e>=n;)t+=r,e-=n;return t};function Mr(e){let t=/^([a-z]+)-(\d+)$/.exec(String(e));return t?t[1]===`law`?jr(Number(t[2])):`${t[1]}.${t[2]}`:String(e)}var Nr=new Set([`I`,`III`,`IV`,`process.1`,`process.5`,`rigor.5`,`ops.2`]),Pr={I:{key:`secretsGate`,label:`Secrets gate`},III:{key:`doneGate`,label:`Done gate`},IV:{key:`deletionGate`,label:`Deletion gate`}},Fr={I:{arm:`Writes that would carry a credential-shaped string are refused again.`,off:`A write carrying a credential-shaped string (on OpenCode, also a write to a key file) stops being refused. Rule I’s text still binds the agent; protected checks, real data loss and commit/push consent stay gated.`},III:{arm:`A turn that edited files cannot end before the project’s declared checks pass.`,off:`A turn that edited files may end without the checks in .geneseed/done-checks.txt passing. Rule III’s text still binds the agent; every other gate stays.`},IV:{arm:`Commands that would lose data nothing else holds ask again.`,off:`Commands that would really lose data — discarding uncommitted work, deleting an unpushed branch, removing untracked files — stop asking. Rule IV’s text still binds the agent; secrets, root-wide scans and commit/push consent stay gated.`}},Ir=[{key:`invariants`,source:`{{LAWS}}`,against:`—`},{key:`yours`,source:`user-rules.md`,against:`may tighten a {{LAW}}, never repeal one`},{key:`ethos`,source:`{{ONTOLOGY}}`,against:`never against a user rule`},{key:`doctrines`,source:`{{DOCTRINES}}`,against:`may tighten, never repeal`}],Lr=[{source:`mode`,label:`Mode`,against:`binds how work runs`},{source:`PROFILE.md, posture, theme`,label:`Profile, posture, theme`,against:`inform only; never bind`}],Rr=(e,t={})=>Pr[e]&&t?.[Pr[e].key]===!1?`Gate off`:Nr.has(e)?`Hook gate`:`Instruction`;function zr(e){let t={};for(let n of e||[]){let e=Dr[n.klass]?n.klass:`personal`,r=t[e]||(t[e]={key:e,label:Dr[e].label,ok:0,exp:0});n.status===`experimental`?r.exp+=1:r.ok+=1}let n=Or.filter(e=>t[e]).map(e=>({...t[e],n:t[e].ok+t[e].exp}));return{rows:n,total:n.reduce((e,t)=>e+t.n,0),experimental:n.reduce((e,t)=>e+t.exp,0),max:Math.max(1,...n.map(e=>e.n))}}var X=(e,t,n=t+`s`)=>`${e} ${e===1?t:n}`;function Br({overview:e,setup:t,rules:n,activity:r,profile:i,skills:a,laws:o}){let s=[],c=e?.doctor;c&&!c.ok&&s.push({id:`doctor`,tag:`Doctor`,tone:`bad`,title:`Doctor found ${X(c.problems.length,`problem`)}`,detail:c.problems[0]||``,where:`installs/doctor`,verb:`Review`,href:`#/installs/doctor`});let l=e?.diff,u=K(l);u&&s.push({id:`drift`,tag:`Drift`,tone:`warn`,title:`${X(u,`file`)} drifted from the source`,detail:`${l.edited} edited, ${l.added} added, ${l.missing} missing`,where:`installs/edits`,verb:`Review`,href:`#/installs/edits`}),i?.seeded&&s.push({id:`profile`,tag:`Profile`,tone:`warn`,title:`Profile is still the seeded template`,detail:`every section holds placeholder text`,where:`personal/profile`,verb:`Fill in`,href:`#/personal/profile`});let d=n?.exists?n.stats:null;d&&d.rules===0&&s.push({id:`rules`,tag:`Rules`,tone:``,title:`No standing rules yet`,detail:`0 of ${d.max_rules} · ${d.tokens} of ${d.max_tokens} tokens`,where:`personal/rules`,verb:`Write a rule`,href:`#/personal/rules`});let f=Object.entries(t?.gates?.asks||{}).sort((e,t)=>t[1]-e[1]);if(f.length){let[e,n]=f[0],r=Mr(e),i=(o?.items||[]).find(e=>e.name===r),a=i?kr(i.title).name:r;s.push({id:`gates`,tag:`Gates`,tone:``,title:`${a} asked ${X(n,`time`)}`,detail:`${n} of ${t.gates.total} gate asks`,where:r,verb:`Review`,href:`#/item/law/${encodeURIComponent(r)}`})}if(a){let{rows:e,experimental:t}=zr(a.items);t&&s.push({id:`skills`,tag:`Skills`,tone:``,title:`${X(t,`skill`)} still experimental`,detail:e.filter(e=>e.exp).sort((e,t)=>t.exp-e.exp).map(e=>`${e.label.toLowerCase()} ${e.exp}`).join(`, `),where:`library/skills`,verb:`Triage`,href:`#/skills`})}return t&&t.facts===0&&s.push({id:`memory`,tag:`Memory`,tone:``,title:`Memory holds no facts`,detail:`MEMORY.md is an empty index`,where:`library/memory`,verb:`Open`,href:`#/section/memory`}),r&&r.enabled===!1&&s.push({id:`activity`,tag:`Activity`,tone:``,title:`Session tracking is off`,detail:`no per-session trace is kept`,where:`activity`,verb:`Turn on`,href:`#/activity`}),s}var Vr=e=>K(e.drift),Hr=e=>e.drift?.stale??0;function Ur(e){let t=t=>new Set((e?.never||[]).filter(e=>e.kind===t).map(e=>e.name)).size;return{skills:t(`skill`),agents:t(`agent`)}}function Wr(e){let t=e?.installs||[],n=t.filter(e=>e.state===`active`),r=t.length-n.length,i=n.filter(e=>e.verdict===`behind`).length,a=n.reduce((e,t)=>e+Vr(t),0),o=n.reduce((e,t)=>e+Hr(t),0),s=e?.doctor,c=s&&!s.ok?`bad`:i||a||o?`warn`:`good`,l={good:`Harness healthy.`,warn:`Harness needs a look.`,bad:`Harness has problems.`}[c],u=[X(n.length,`active install`)+(r?`, ${r} disabled`:``),s?s.ok?`doctor clean`:`doctor found ${X(s.problems.length,`problem`)}`:`doctor not run yet`,i?`${X(i,`install`)} behind source`:`all in step with source`,a?`${X(a,`file`)} hand-edited`:`no hand edits`];return o&&u.push(`${X(o,`file`)} behind source`),{tone:c,head:l,facts:u}}var Gr=[[`carrier`,`Root file`],[`skills`,`Skill list`],[`agents`,`Agent list`],[`context`,`Session files`]],Kr=e=>e?e.carrier+e.skills+e.agents+e.context:0,qr=e=>e.state===`active`&&(e.verdict===`behind`||K(e.drift)>0||(e.drift?.stale??0)>0),Z=e=>`≈${(e/4/1e3).toFixed(1)}k`,Jr=e=>`${e.host} · ${e.scope}`,Yr=e=>({id:e.id,host:e.host,path:e.path,label:Jr(e)});function Xr({fleet:e,usage:t,...n}){let r=[],i=e?.doctor;i&&!i.ok&&r.push({id:`doctor`,tag:`Doctor`,tone:`bad`,title:`Doctor found ${X(i.problems.length,`problem`)}`,detail:i.problems[0]||``,where:`installs/doctor`,verb:`Review`,href:`#/installs/doctor`});for(let t of(e?.installs||[]).filter(e=>e.state===`active`)){if(t.verdict===`behind`){let e=t.built_epoch?`built ${Ot(t.built_epoch)} ago`:`never built`,n=Hr(t);r.push({id:`behind:${t.id}`,tag:`Behind`,tone:`warn`,title:`${Jr(t)} is behind its source`,detail:n?`${e} · ${X(n,`file`)} behind`:e,where:t.host,verb:`Rebuild`,act:`rebuild`,installs:[Yr(t)]})}let e=Vr(t);e&&r.push({id:`drift:${t.id}`,tag:`Drift`,tone:`warn`,title:`${Jr(t)}: ${X(e,`file`)} edited by hand`,detail:`${t.drift.edited} edited, ${t.drift.added} added, ${t.drift.missing} missing`,where:`installs/edits`,verb:`Review`,href:`#/installs/edits`})}if(t&&t.days_counted>=30&&t.never?.length){let{skills:e,agents:n}=Ur(t);r.push({id:`usage`,tag:`Usage`,tone:``,sugg:!0,title:`${X(e,`skill`)} never fired in 30 days`,detail:`${X(n,`agent`)} too`,where:`library/skills`,verb:`Triage`,href:`#/skills`})}let a=Br({...n,overview:n.overview&&{...n.overview,doctor:null,diff:null}});for(let e of a)r.push({...e,sugg:!0});return r}function Zr(e,t){return(e?.rules||[]).map(e=>{let n=Mr(e.rule),r=(t?.items||[]).find(e=>e.name===n);return{...e,name:r?kr(r.title).name:e.rule===`wiki`?`Wiki guard`:n}})}var Qr=e=>(e||[]).filter(e=>e.state===`active`&&e.cost);function $r(e){let t=Qr(e).filter(e=>e.cost.ceiling>0&&Number.isFinite(e.cost.carrier)),n=e=>e.cost.carrier/e.cost.ceiling,r=t.find(e=>e.selected)||t.reduce((e,t)=>!e||n(t)>n(e)?t:e,null);if(!r)return null;let{carrier:i,ceiling:a}=r.cost;return{label:`${r.host} · ${r.scope}`,carrier:i,ceiling:a,pct:Math.round(n(r)*100),selected:!!r.selected}}function ei(e){let t=Qr(e);if(!t.length)return null;let n=t.reduce((e,t)=>Kr(t.cost)>Kr(e.cost)?t:e),r=t.map(e=>Kr(e.cost)),i=t.find(e=>e.selected)||n;return{min:Math.min(...r),max:Math.max(...r),top:n,shown:i}}var ti=e=>(e?.per_day||[]).reduce((e,t)=>e+t,0);function ni(e,t){let n=Zr(e,t),r=n.reduce((e,t)=>e+t.n,0),i=n.reduce((e,t)=>!e||t.n>e.n?t:e,null),a=[];for(let e of n)(e.per_day||[]).forEach((e,t)=>{a[t]=(a[t]||0)+e});return{total:r,top:i?{name:i.name,n:i.n}:null,perDay:a}}var Q=e=>e.catch(()=>null),ri=(e,t)=>`${t?Math.min(100,e/t*100):0}%`,ii=36e5,ai=5e3;function oi({update:e,onAction:t,canFill:n=!0}){if(!e)return null;let r=e.install??(e.git?`git`:`npm-global`),i=r===`git`&&typeof e.behind==`number`?e.behind:null,a=i===null?e.latest===null?(0,q.jsxs)(`span`,{className:`mono dim ver-chip`,children:[e.current??``,` · `,e.checking?`checking…`:`update check unavailable`]}):e.available?(0,q.jsxs)(`span`,{className:`mono ver-chip`,children:[e.current,` `,(0,q.jsxs)(`span`,{className:`ver-new`,children:[e.latest,` available`]})]}):(0,q.jsxs)(`span`,{className:`mono dim ver-chip`,children:[e.current,` · latest`]}):i>0?(0,q.jsxs)(`span`,{className:`mono ver-chip`,children:[e.current??``,` `,(0,q.jsxs)(`span`,{className:`ver-new`,children:[i,` commit`,i===1?``:`s`,` to pull`]})]}):(0,q.jsxs)(`span`,{className:`mono dim ver-chip`,children:[e.current??``,` · up to date`]});if(r===`other`)return!e.available||!e.command?a:(0,q.jsxs)(q.Fragment,{children:[a,(0,q.jsxs)(`span`,{className:`dim`,children:[`update with `,(0,q.jsx)(`code`,{className:`mono`,children:e.command})]})]});if(r!==`git`&&!e.available)return a;let o=i===null?!!e.available:i>0;return(0,q.jsxs)(q.Fragment,{children:[a,(0,q.jsx)(`button`,{type:`button`,className:o&&n?`btn`:`btn ghost`,title:r===`git`?i===0?`Nothing to pull: up to date with upstream. Pulls and rebuilds every install anyway.`:`git pull, then rebuild every install`:`npm install -g geneseed@latest, then rebuild every install`,onClick:()=>t(`update`),children:`Update`})]})}var si={good:`M8 12.5l2.7 2.7L16 9.5M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18z`,warn:`M12 3 22 20H2zM12 10v4M12 17v.5`,bad:`M9 9l6 6M15 9l-6 6M12 3a9 9 0 1 0 0 18 9 9 0 0 0 0-18z`};function ci({tone:e}){return(0,q.jsx)(`svg`,{className:`health-ico`,viewBox:`0 0 24 24`,"aria-hidden":`true`,children:(0,q.jsx)(`path`,{d:si[e]||si.warn})})}function li({fleet:e,error:t,behind:n,onAction:r,onRebuild:i}){let a=(0,q.jsx)(`button`,{type:`button`,className:`btn ghost ldg-doctor`,onClick:()=>r(`doctor`),children:`Run doctor`});if(!e)return t?(0,q.jsxs)(`section`,{className:`health unknown`,"aria-labelledby":`ldg-health`,children:[(0,q.jsx)(ci,{tone:`warn`}),(0,q.jsx)(`div`,{className:`health-text`,role:`status`,children:(0,q.jsx)(`h2`,{id:`ldg-health`,children:`Status unknown`})}),(0,q.jsx)(`div`,{className:`health-acts`,children:a})]}):(0,q.jsx)(`div`,{className:`health unknown`,"aria-busy":`true`});let o=Wr(e),s=[...o.facts,...e.version?[`Source is ${e.version}`]:[]];return(0,q.jsxs)(`section`,{className:`health ${o.tone}`,"aria-labelledby":`ldg-health`,children:[(0,q.jsx)(ci,{tone:o.tone}),(0,q.jsxs)(`div`,{className:`health-text`,role:`status`,children:[(0,q.jsx)(`h2`,{id:`ldg-health`,children:o.head}),(0,q.jsxs)(`p`,{className:`health-facts`,children:[s.join(` · `),`.`]})]}),(0,q.jsxs)(`div`,{className:`health-acts`,children:[a,n.length?(0,q.jsxs)(`button`,{type:`button`,className:`btn`,title:`Rebuilds ${n.map(e=>e.label).join(`, `)}`,onClick:()=>i(n),children:[`Rebuild all behind (`,n.length,`)`]}):null]})]})}function ui({chars:e}){let t=C(e);return(0,q.jsxs)(`span`,{className:`mono`,children:[Z(t??e),` tok`]})}var di=e=>Math.round(e/4),fi={carrier:`accent`,skills:`skill`,agents:`agent`,context:`context`},pi=e=>Gr.map(([t,n])=>({key:t,label:n,n:di(e[t]),tone:fi[t]})),mi=e=>`${e.host} · ${e.scope}`;function hi({cost:e,i:t}){let n=2*Math.PI*14,r=e.ceiling?Math.min(1,e.carrier/e.ceiling):0;return(0,q.jsxs)(`svg`,{className:`ldg-ring`,viewBox:`0 0 36 36`,"aria-hidden":`true`,children:[(0,q.jsx)(`circle`,{className:`bg`,cx:`18`,cy:`18`,r:14}),(0,q.jsx)(`circle`,{className:`fg`+(e.ceiling&&e.carrier>e.ceiling?` over`:``),cx:`18`,cy:`18`,r:14,strokeDasharray:n.toFixed(2),strokeDashoffset:(n*(1-r)).toFixed(2),style:{"--circ":n.toFixed(2),"--i":t}})]})}function gi({id:e,title:t,aside:n,className:r=``,children:i}){return(0,q.jsxs)(`section`,{className:`panel ldg-kpi ${r}`,"aria-labelledby":e,children:[(0,q.jsxs)(`div`,{className:`ldg-kpi-head`,children:[(0,q.jsx)(`h3`,{id:e,children:t}),n]}),i]})}function _i({installs:e}){let t=$r(e);return(0,q.jsx)(gi,{id:`ldg-k-root`,title:`Root file vs ceiling`,className:`ldg-kpi-root`,children:t?(0,q.jsxs)(`div`,{className:`ldg-kpi-ring`,children:[(0,q.jsxs)(`span`,{className:`ldg-ringbox`,children:[(0,q.jsx)(Kn,{value:di(t.carrier),max:di(t.ceiling),segments:t.pct>100?[{key:`v`,label:`root file`,n:di(t.carrier),tone:`bad`}]:void 0,size:64,stroke:7,label:`${t.selected?`Root file`:`Worst root file`}: ${t.label}, ${t.pct} percent of its ceiling`}),(0,q.jsxs)(`span`,{className:`mono ldg-ring-pct`,"aria-hidden":`true`,children:[t.pct,`%`]})]}),(0,q.jsxs)(`span`,{className:`ldg-kpi-stack`,children:[(0,q.jsx)(`span`,{className:`mono ldg-kpi-fig`,children:`${Z(t.carrier)} / ${Z(t.ceiling)} tokens`}),(0,q.jsx)(`span`,{className:`dim`,children:t.label})]})]}):(0,q.jsx)(`p`,{className:`dim`,children:`No root file to measure.`})})}function vi({installs:e}){let t=ei(e),n=t&&(Z(t.min)===Z(t.max)?Z(t.max):`${Z(t.min)} – ${Z(t.max)}`);return(0,q.jsx)(gi,{id:`ldg-k-cost`,title:`Loaded every turn`,className:`ldg-kpi-cost`,children:t?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`ldg-kpi-stack`,children:[(0,q.jsx)(`span`,{className:`mono ldg-kpi-fig`,children:`${Z(Kr(t.shown.cost))} tokens`}),(0,q.jsx)(`span`,{className:`dim`,children:mi(t.shown)})]}),(0,q.jsx)(Jn,{parts:pi(t.shown.cost),label:`Loaded every turn, ${mi(t.shown)}`}),(0,q.jsx)(`span`,{className:`dim ldg-kpi-cap`,children:`All installs: ${n} tokens`})]}):(0,q.jsx)(`p`,{className:`dim`,children:`No install has a root file to measure.`})})}function yi({usage:e}){let t=e?.enabled?e.days_counted<30&&e.since?`since ${e.since}`:`30 days`:null;return(0,q.jsx)(gi,{id:`ldg-k-calls`,title:`Skill and agent calls`,className:`ldg-kpi-calls`,aside:t?(0,q.jsx)(`span`,{className:`mono dim ldg-kpi-aside`,children:t}):null,children:e?e.enabled?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`mono ldg-kpi-fig`,children:(0,q.jsx)(A,{value:ti(e)})}),e.per_day?.length>1?(0,q.jsx)(Sr,{vals:e.per_day,i:0}):null]}):(0,q.jsx)(`p`,{className:`dim`,children:`Usage counting is off on this machine.`}):(0,q.jsx)(`p`,{className:`dim`,children:`Usage could not be read.`})})}function bi({gates:e,laws:t}){let n=ni(e,t);return(0,q.jsx)(gi,{id:`ldg-k-gates`,title:`Gate asks · 30 days`,className:`ldg-kpi-gates`,aside:(0,q.jsx)(`a`,{className:`ldg-kpi-aside`,href:`#/laws`,"aria-label":`Open the Constitution`,children:`Constitution →`}),children:e?n.total?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`span`,{className:`ldg-kpi-line`,children:[(0,q.jsx)(`span`,{className:`mono ldg-kpi-fig`,children:n.total}),` `,(0,q.jsx)(`span`,{className:`dim`,children:`· ${n.top.name} ${n.top.n}`})]}),n.perDay.length>1?(0,q.jsx)(Sr,{vals:n.perDay,i:1}):null]}):(0,q.jsx)(`p`,{className:`dim`,children:`No gate asked in 30 days.`}):(0,q.jsx)(`p`,{className:`dim`,children:`Gate activity could not be read.`})})}var xi=6;function Si({i:e}){if(!e.diffable)return(0,q.jsx)(`span`,{className:`dim`,title:`Drift is only checked for global installs`,children:`not checkable`});let t=K(e.drift),n=e.drift?.stale??0;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`ldg-syncbar`,children:(0,q.jsx)(Jn,{parts:[{key:`stale`,label:`Behind source`,n,tone:`warn`},{key:`edited`,label:`Edited by hand`,n:t,tone:`bad`}],label:`Sync with source, ${mi(e)}`,legend:!1})}),t?(0,q.jsxs)(`span`,{className:`mono t-bad`,children:[t,` edited`]}):e.drift?.linked?(0,q.jsxs)(`span`,{className:`mono dim`,title:`Yours: links Geneseed leaves alone`,children:[e.drift.linked,` linked`]}):(0,q.jsx)(`span`,{className:`mono dim`,children:`none`}),n?(0,q.jsxs)(`div`,{className:`mono dim ldg-sub`,children:[n,` file`,n===1?``:`s`,` behind`]}):null]})}function Ci(e){if(!e.diffable)return`Not checkable: drift is only checked for global installs.`;let t=e.drift||{},n=[t.stale?`${t.stale} behind`:null,t.edited?`${t.edited} edited`:null,t.added?`${t.added} added`:null,t.missing?`${t.missing} missing`:null,t.linked?`${t.linked} linked (yours)`:null].filter(Boolean);return n.length?n.join(` · `):`Nothing differs.`}function wi({i:e,n:t,onRebuild:n,onOpen:r,busy:i}){let[a,o]=(0,B.useState)(!1),s=mi(e),c=(0,q.jsxs)(`td`,{className:`ldg-where`,children:[i?(0,q.jsx)(`span`,{className:`console-progress`,role:`progressbar`,"aria-label":`Rebuilding ${s}`}):null,(0,q.jsxs)(`div`,{className:`ldg-who`,children:[qr(e)?(0,q.jsx)(`svg`,{className:`ldg-glyph ${K(e.drift)?`bad`:`warn`}`,viewBox:`0 0 10 10`,role:`img`,"aria-label":K(e.drift)?`edited by hand`:`needs a rebuild`,children:(0,q.jsx)(`path`,{d:`M5 1 9 9H1z`,fill:`currentColor`})}):null,e.state===`active`&&e.cost?(0,q.jsx)(`span`,{className:`ldg-phone-ring`,"aria-hidden":`true`,children:(0,q.jsx)(hi,{cost:e.cost,i:t})}):null,(0,q.jsxs)(`div`,{className:`ldg-name`,children:[(0,q.jsx)(`span`,{className:`ldg-host`,children:e.host}),` `,(0,q.jsx)(`span`,{className:`dim`,children:e.scope}),(0,q.jsx)(`div`,{className:`mono dim ldg-path`,children:e.path})]})]})]});if(e.state!==`active`)return(0,q.jsxs)(`tr`,{className:`ldg-off`,children:[c,(0,q.jsx)(`td`,{className:`ldg-build`,children:(0,q.jsx)(`span`,{className:`pill off`,children:`disabled`})}),(0,q.jsx)(`td`,{className:`ldg-sync`}),(0,q.jsx)(`td`,{className:`ldg-root`}),(0,q.jsx)(`td`,{className:`ldg-total`}),(0,q.jsx)(`td`,{className:`ldg-act`,children:(0,q.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Open ${s}`,onClick:()=>r(e),children:`Open`})})]});let l={synced:(0,q.jsx)(`span`,{className:`pill good`,children:`in step`}),behind:(0,q.jsx)(`span`,{className:`pill warn`,children:`behind source`}),unknown:(0,q.jsx)(`span`,{className:`pill off`,children:`not checked`})}[e.verdict],u=Kr(e.cost),d=e.cost?.ceiling?Math.round(e.cost.carrier/e.cost.ceiling*100):null;return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(`tr`,{className:a?`ldg-open`:``,children:[c,(0,q.jsxs)(`td`,{className:`ldg-build`,children:[l,(0,q.jsx)(`div`,{className:`mono dim ldg-sub`,children:e.built_epoch?`built ${Ot(e.built_epoch)} ago`:`never built`})]}),(0,q.jsx)(`td`,{className:`ldg-sync`,children:(0,q.jsx)(Si,{i:e})}),(0,q.jsx)(`td`,{className:`ldg-root`,children:e.cost?d===null?(0,q.jsx)(`span`,{className:`dim`,children:`no ceiling`}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`ldg-rootbar`,children:(0,q.jsx)(Yn,{value:di(e.cost.carrier),max:di(e.cost.ceiling),label:`Root file, ${s}`,tone:d>100?`bad`:`accent`})}),(0,q.jsx)(`span`,{className:`mono dim ldg-sub`,children:`${Z(e.cost.carrier)} / ${Z(e.cost.ceiling)} · ${d}%`})]}):(0,q.jsx)(`span`,{className:`dim`,children:`not measured`})}),(0,q.jsx)(`td`,{className:`ldg-total`,children:e.cost?(0,q.jsx)(ui,{chars:u}):null}),(0,q.jsxs)(`td`,{className:`ldg-act`,children:[qr(e)?(0,q.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Rebuild ${s}`,title:`Rebuilds ${s} only`,onClick:()=>n([Yr(e)]),children:`Rebuild`}):(0,q.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":`Open ${s}`,onClick:()=>r(e),children:`Open`}),(0,q.jsx)(`button`,{type:`button`,className:`btn ghost sm ldg-toggle`,"aria-label":`Details for ${s}`,"aria-expanded":a,"aria-controls":a?`ldg-detail-${e.id}`:void 0,onClick:()=>o(e=>!e),children:(0,q.jsx)(`svg`,{viewBox:`0 0 24 24`,width:`14`,height:`14`,fill:`none`,stroke:`currentColor`,strokeWidth:`2`,"aria-hidden":`true`,children:(0,q.jsx)(`path`,{d:a?`M6 15l6-6 6 6`:`M6 9l6 6 6-6`})})})]})]}),a?(0,q.jsx)(`tr`,{className:`ldg-detail`,id:`ldg-detail-${e.id}`,children:(0,q.jsx)(`td`,{colSpan:xi,children:(0,q.jsxs)(`div`,{className:`ldg-detail-grid`,children:[(0,q.jsxs)(`div`,{className:`ldg-detail-col`,children:[e.cost?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`span`,{className:`ldg-lbl`,children:`What rides every turn · ${Z(u)} tokens`}),(0,q.jsx)(Jn,{parts:pi(e.cost),label:s})]}):(0,q.jsx)(`span`,{className:`dim`,children:`Always-on cost not measured.`}),(0,q.jsx)(`span`,{className:`dim`,children:`Voice ${e.theme} · ${e.footprint} footprint`})]}),(0,q.jsxs)(`div`,{className:`ldg-detail-col`,children:[(0,q.jsx)(`span`,{className:`ldg-lbl`,children:`Differs from source`}),(0,q.jsx)(`span`,{className:`muted`,children:Ci(e)}),e.diffable?(0,q.jsx)(`span`,{children:(0,q.jsx)(`a`,{className:`btn ghost sm`,href:`#/installs/edits`,"aria-label":`View diff for ${s}`,children:`View diff`})}):null]})]})})}):null]})}function Ti({rows:e,onAction:t,onRebuild:n}){let r=e.filter(e=>!e.sugg).length;return(0,q.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-needs`,children:[(0,q.jsxs)(`div`,{className:`panel-head panel-head-rule`,children:[(0,q.jsx)(`h2`,{id:`ldg-needs`,children:`Needs you`}),(0,q.jsxs)(`span`,{className:`mono dim`,children:[r,` problem`,r===1?``:`s`,`, `,e.length-r,` suggestion`,e.length-r===1?``:`s`]})]}),e.length?(0,q.jsx)(`ul`,{className:`needs`,children:e.map(e=>(0,q.jsxs)(`li`,{className:e.sugg?`sugg`:``,children:[(0,q.jsx)(`span`,{className:`tag ${e.tone}`,children:e.tag}),(0,q.jsxs)(`span`,{className:`needs-what`,children:[(0,q.jsx)(`b`,{children:e.title}),e.detail?(0,q.jsxs)(`span`,{className:`dim`,children:[` · `,e.detail]}):null]}),(0,q.jsx)(`span`,{className:`mono dim needs-where`,children:e.where}),e.act?(0,q.jsx)(`button`,{type:`button`,className:`needs-verb linkish`,"aria-label":`${e.verb}: ${e.title}`,onClick:()=>e.installs?n(e.installs):t(e.act),children:e.verb}):(0,q.jsx)(`a`,{className:`needs-verb`,href:e.href,"aria-label":`${e.verb}: ${e.title}`,children:e.verb})]},e.id))}):(0,q.jsx)(`p`,{className:`needs-empty`,children:`Nothing needs you.`})]})}function Ei({usage:e}){let t=(0,q.jsxs)(`div`,{className:`panel-head`,children:[(0,q.jsx)(`h2`,{id:`ldg-usage`,children:`What fires`}),(0,q.jsx)(`span`,{className:`mono dim`,children:`skills and agents, 30 d`})]});if(!e)return(0,q.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-usage`,children:[t,(0,q.jsx)(`p`,{className:`dim`,children:`Usage could not be read.`})]});if(!e.enabled)return(0,q.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-usage`,children:[t,(0,q.jsx)(`p`,{className:`dim`,children:`Usage counting is off on this machine.`})]});if(e.days_counted<30)return(0,q.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-usage`,children:[t,(0,q.jsx)(`p`,{className:`muted`,children:e.since?(0,q.jsxs)(q.Fragment,{children:[`Counting since `,(0,q.jsx)(`b`,{children:e.since}),`, `,e.days_counted,` of 30 days`]}):`No skill or agent call counted yet`}),(0,q.jsx)(`div`,{className:`daytrack`,"aria-hidden":`true`,children:Array.from({length:30},(t,n)=>(0,q.jsx)(`i`,{className:n<e.days_counted?`on`:``},n))}),(0,q.jsx)(`p`,{className:`dim chart-foot`,children:`Rankings and the never-fired count appear once 30 days are counted, so a new install is not told every skill is unused.`})]});let n=e.rows.slice(0,7),r=Math.max(1,...n.map(e=>e.n));return(0,q.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-usage`,children:[t,(0,q.jsx)(`ul`,{className:`ubars`,children:n.map((e,t)=>(0,q.jsxs)(`li`,{className:e.kind,children:[(0,q.jsxs)(`span`,{className:`ub-name`,children:[e.name,` `,(0,q.jsx)(`span`,{className:`dim`,children:e.kind})]}),(0,q.jsx)(`span`,{className:`ub-trk`,children:(0,q.jsx)(`i`,{style:{width:ri(e.n,r),"--i":t}})}),(0,q.jsx)(`span`,{className:`mono`,children:e.n})]},`${e.install}:${e.kind}:${e.name}`))}),e.never.length?(0,q.jsxs)(`div`,{className:`ub-never`,children:[(0,q.jsxs)(`span`,{children:[(0,q.jsx)(`b`,{children:Ur(e).skills}),` skills never fired`]}),(0,q.jsx)(`a`,{className:`needs-verb`,href:`#/skills`,children:`Triage`})]}):null]})}function Di({overview:e,setup:t,runs:n,onAction:r,onRetry:i,dataRev:o,banner:s,view:c}){let l=an(),[u,d]=(0,B.useState)({}),{data:f,error:p,reload:m}=W(()=>a.fleet(),[o]),{data:h}=W(()=>Q(a.usage()),[o]),{data:g}=W(()=>Q(a.gates()),[o]),_=(0,B.useRef)(null),{data:v,reload:y}=W(()=>Q(a.update()).then(e=>(e?_.current=e:_.current?.checking&&(_.current={..._.current,checking:!1}),_.current)),[o]);(0,B.useEffect)(()=>{let e=setInterval(y,ii),t=()=>{document.visibilityState===`visible`&&y()};return document.addEventListener(`visibilitychange`,t),()=>{clearInterval(e),document.removeEventListener(`visibilitychange`,t)}},[y]);let b=!!v?.checking;(0,B.useEffect)(()=>{if(!b)return;let e=setTimeout(y,ai);return()=>clearTimeout(e)},[b,v,y]);let{data:x}=Wn(o),{data:S}=W(()=>Q(a.activity()),[o]),{data:C}=W(()=>Q(a.profile()),[o]),{data:w}=W(()=>Q(a.catalog(`skills`)),[o],`catalog:skills`),{data:T}=W(()=>Q(a.catalog(`laws`)),[o],`catalog:laws`),E=f?.installs||[],[D,O]=(0,B.useState)(``),k=async e=>{O(``);try{await a.selectView(e.host,e.path)}catch(t){O(`Could not open ${mi(e)}: ${t?.message||t}`);return}i?.(),window.location.hash=`#/installs/hosts`},A=Xr({fleet:f,usage:h,overview:e,setup:t,rules:x,activity:S,profile:C,skills:w,laws:T}),j=E.filter(qr).map(Yr),M=async e=>{let t=e.map(e=>e.label);if(!await l(`Rebuild ${t.join(`, `)}? Each is re-rendered from source with its own settings.`,{title:e.length===1?`Rebuild ${t[0]}?`:`Rebuild ${e.length} installs?`,confirmLabel:`Rebuild`}))return;let n=await r(`rebuild`,{installs:e.map(({host:e,path:t})=>({host:e,path:t}))});n&&d(t=>({...t,[n]:e.map(e=>e.id)}))},N=new Set(Object.entries(u).filter(([e])=>n?.find(t=>t.id===e)?.status===`running`).flatMap(([,e])=>e));return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Vn,{eyebrow:f?`${E.length} harness${E.length===1?``:`es`} installed on this machine`:null,title:`Overview`,actions:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(oi,{update:v,onAction:r,canFill:!j.length}),c]})}),s,(0,q.jsxs)(`div`,{className:`ov-stack ldg`,children:[(0,q.jsx)(li,{fleet:f,error:p,behind:j,onAction:r,onRebuild:M}),(0,q.jsxs)(`div`,{className:`ldg-kpis`,role:`group`,"aria-labelledby":`ldg-kpis-h`,children:[(0,q.jsx)(`h2`,{id:`ldg-kpis-h`,className:`sr-only`,children:`Key figures`}),(0,q.jsx)(_i,{installs:E}),(0,q.jsx)(vi,{installs:E}),(0,q.jsx)(yi,{usage:h}),(0,q.jsx)(bi,{gates:g,laws:T})]}),(0,q.jsxs)(`section`,{className:`panel`,"aria-labelledby":`ldg-fleet`,children:[(0,q.jsxs)(`div`,{className:`panel-head panel-head-rule`,children:[(0,q.jsx)(`h2`,{id:`ldg-fleet`,children:`Installed harnesses`}),f?.source_fp?(0,q.jsxs)(`span`,{className:`mono dim`,children:[`source `,f.source_fp]}):null]}),D?(0,q.jsx)(`p`,{className:`tag bad note`,role:`alert`,children:D}):null,p&&f?(0,q.jsxs)(`p`,{className:`dim`,role:`status`,children:[`Could not refresh the installs — showing the last read.`,` `,(0,q.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:m,children:`Retry`})]}):null,(0,q.jsx)(`div`,{className:`ldg-scroll`,children:(0,q.jsxs)(`table`,{className:`ldg-fleet`,children:[(0,q.jsx)(`caption`,{className:`sr-only`,children:`Installs`}),(0,q.jsx)(`thead`,{children:(0,q.jsxs)(`tr`,{children:[(0,q.jsx)(`th`,{scope:`col`,children:`Install`}),(0,q.jsx)(`th`,{scope:`col`,className:`ldg-build`,children:`Build`}),(0,q.jsx)(`th`,{scope:`col`,className:`ldg-sync`,children:`Sync with source`}),(0,q.jsx)(`th`,{scope:`col`,className:`ldg-root`,children:`Root file · ceiling`}),(0,q.jsx)(`th`,{scope:`col`,className:`ldg-total`,children:`Always-on`}),(0,q.jsx)(`th`,{scope:`col`,children:(0,q.jsx)(`span`,{className:`sr-only`,children:`Actions`})})]})}),(0,q.jsxs)(`tbody`,{children:[p&&!f?(0,q.jsx)(`tr`,{children:(0,q.jsxs)(`td`,{colSpan:xi,children:[(0,q.jsx)(`span`,{className:`dim`,role:`status`,children:`Could not read the installs`}),` `,(0,q.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:m,children:`Retry`})]})}):null,E.map((e,t)=>(0,q.jsx)(wi,{i:e,n:t,onRebuild:M,onOpen:k,busy:N.has(e.id)},e.id))]})]})})]}),(0,q.jsxs)(`div`,{className:`ldg-bottom`,children:[(0,q.jsx)(Ti,{rows:A,onAction:r,onRebuild:M}),(0,q.jsx)(Ei,{usage:h})]})]})]})}var Oi=`geneseed-understand-seen`,ki=`understand`;function Ai(){try{let e=JSON.parse(localStorage.getItem(Oi));return Array.isArray(e)?e:[]}catch{return[]}}function ji(e){let t=Ai();if(t.includes(e))return t;let n=[...t,e];try{localStorage.setItem(Oi,JSON.stringify(n))}catch{}return n}function Mi(e,t){let n=e?.groups||[],r=n.findIndex(e=>e.id===ki),i=n[r]?.pages||[],a=i.findIndex(e=>e.id===t);if(a<0)return{prev:null,next:null};let o=n.slice(r+1).find(e=>e.pages.length);return{prev:i[a-1]||null,next:i[a+1]||o?.pages[0]||null}}function Ni(e,t){for(let n of e?.groups||[]){let e=n.pages.find(e=>e.id===t);if(e)return{part:n,section:e.section||`General`,page:e}}return{part:null,section:null,page:null}}function Pi(e,t){let{part:n,section:r}=Ni(e,t);if(!n)return{prev:null,next:null};if(n.id===`understand`)return Mi(e,t);let i=n.pages.filter(e=>(e.section||`General`)===r),a=i.findIndex(e=>e.id===t);return{prev:i[a-1]||null,next:i[a+1]||null}}var Fi=e=>`#/docs/`+encodeURIComponent(e);function Ii({pages:e,seen:t}){let n=e.filter(e=>t.includes(e.id)).length;return(0,q.jsx)(`div`,{className:`track-prog`,role:`progressbar`,"aria-label":`Pages read`,"aria-valuemin":0,"aria-valuemax":e.length,"aria-valuenow":n,children:(0,q.jsx)(`i`,{style:{width:`${n/(e.length||1)*100}%`}})})}function Li({menu:e,pageId:t}){let{prev:n,next:r}=Pi(e,t);return!n&&!r?null:(0,q.jsxs)(`nav`,{className:`track-bar`,"aria-label":`Pages`,children:[n?(0,q.jsxs)(`a`,{className:`track-card`,href:Fi(n.id),children:[(0,q.jsx)(`span`,{className:`track-card-lbl`,"aria-hidden":`true`,children:`Previous`}),(0,q.jsxs)(`span`,{className:`track-card-title`,children:[`← `,n.title]})]}):(0,q.jsx)(`span`,{}),r&&(0,q.jsxs)(`a`,{className:`track-card next`,href:Fi(r.id),children:[(0,q.jsx)(`span`,{className:`track-card-lbl`,"aria-hidden":`true`,children:`Next`}),(0,q.jsxs)(`span`,{className:`track-card-title`,children:[`Next: `,r.title,` →`]})]})]})}var Ri=`modulepreload`,zi=function(e){return`/`+e},Bi={},Vi=function(e){return e.pathname.endsWith(`.css`)},Hi=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},$=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=zi(t,n);let r=s(t),i=Vi(r);return Hi(Bi,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:Ri,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},Ui=`geneseed-newhere-dismissed`,Wi=(0,B.lazy)(()=>$(()=>import(`./Dashboard-DkUm4XMu.js`).then(e=>e.t),__vite__mapDeps([0,1,2,3,4,5])));function Gi({harness:e}){let[t,n]=(0,B.useState)(()=>!!localStorage.getItem(Ui)),{data:r}=W(()=>t?Promise.resolve(null):a.docs(e).catch(()=>null),[t,e]),i=r?.groups?.find(e=>e.id===`understand`)?.pages||[],o=Ai(),s=i.findIndex(e=>!o.includes(e.id));if(t||!i.length||s<0)return null;let c=i.filter(e=>o.includes(e.id)).length;return(0,q.jsxs)(`section`,{className:`newhere`,"aria-label":`New here?`,children:[(0,q.jsxs)(`div`,{className:`newhere-body`,children:[(0,q.jsx)(`b`,{children:`New here? Understand your harness.`}),(0,q.jsxs)(`p`,{children:[i.length,` short pages: what a harness is, what was installed, what changes in your day, and what is guaranteed.`]}),(0,q.jsx)(`div`,{className:`newhere-dots`,"aria-label":`${c} of ${i.length} read`,children:i.map(e=>(0,q.jsx)(`i`,{className:o.includes(e.id)?`f`:``},e.id))})]}),(0,q.jsx)(`a`,{className:`btn ghost`,href:`#/docs/${encodeURIComponent(i[s].id)}`,children:c?`Continue · step ${s+1}`:`Start`}),(0,q.jsx)(`button`,{type:`button`,className:`newhere-x`,onClick:()=>{localStorage.setItem(Ui,`1`),n(!0)},title:`Dismiss for good`,"aria-label":`Dismiss`,children:`×`})]})}function Ki({layout:e,onLayout:t}){return(0,q.jsx)(gn,{"aria-label":`View`,children:ht.map(n=>(0,q.jsx)(`button`,{type:`button`,className:e===n.id?`on`:``,"aria-pressed":e===n.id,title:n.tagline,onClick:()=>t(n.id),children:n.short},n.id))})}function qi({overview:e,overviewError:t,onRetry:n,themes:r,setup:i,runs:o,onAction:s,layout:c=`overview`,onLayout:l,dataRev:u}){let{data:d,loading:f}=W(()=>Promise.resolve().then(()=>a.installs()).catch(()=>null),[u],`installs`);if(!e)return t?(0,q.jsx)(An,{error:`Could not load the harness overview: ${t}`,onRetry:n}):(0,q.jsx)(kn,{});if(!e.deployed){if(f&&!d)return(0,q.jsx)(kn,{});if(!d?.installs?.some(e=>e.state===`active`))return(0,q.jsx)(Un,{onAction:s})}let p=(0,q.jsx)(Gi,{harness:Qt(e.emit)}),m=l?(0,q.jsx)(Ki,{layout:c,onLayout:l}):null;return c===`overview`?(0,q.jsx)(Di,{overview:e,setup:i,runs:o,onAction:s,onRetry:n,dataRev:u,view:m,banner:(0,q.jsxs)(q.Fragment,{children:[e.daemon_stale?(0,q.jsx)(jn,{}):null,p]})}):(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(Vn,{title:`Overview`,sub:[e.theme&&`${e.theme} voice`,e.footprint&&`${e.footprint} footprint`,e.target].filter(Boolean).join(` · `),primary:(0,q.jsx)(`button`,{type:`button`,className:`btn`,onClick:()=>s(`build-all`),children:`Rebuild`}),actions:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>s(`update`),children:`Update`}),(0,q.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>s(`doctor`),children:`Run doctor`}),m]})}),p,(0,q.jsx)(B.Suspense,{fallback:(0,q.jsx)(kn,{}),children:(0,q.jsx)(Wi,{overview:e,overviewError:t,onRetry:n,themes:r,setup:i,runs:o,onAction:s,layout:c,dataRev:u})})]})}var Ji=(0,B.lazy)(()=>$(()=>import(`./Activity-C8pQvnos.js`),__vite__mapDeps([6,1,2,3,4,7,8,9]))),Yi=(0,B.lazy)(()=>$(()=>import(`./ActivityDetail-D_8Bx-QO.js`),__vite__mapDeps([10,1,2,3,7,8,9]))),Xi=(0,B.lazy)(()=>$(()=>import(`./Library-t3KocV0-.js`),__vite__mapDeps([11,1,2,3,4,5,7,12,13,14]))),Zi=(0,B.lazy)(()=>$(()=>import(`./Kits-C9qVd466.js`),__vite__mapDeps([15,1,2,3,7,14,16,17]))),Qi=(0,B.lazy)(()=>$(()=>import(`./Loops-6lNY-9uR.js`),__vite__mapDeps([18,1,2,3,7,9,12,13,19,14,17]))),$i=(0,B.lazy)(()=>$(()=>import(`./Laws-T2wbwMmB.js`),__vite__mapDeps([20,1,2,3,7,13,14]))),ea=(0,B.lazy)(()=>$(()=>import(`./Personal-xjoSqCzr.js`),__vite__mapDeps([21,1,2,3,7,14,22,11,4,5,12,13]))),ta=(0,B.lazy)(()=>$(()=>import(`./Installs-DmPzD4BW.js`),__vite__mapDeps([23,1,2,3,4,7,22,16]))),na=(0,B.lazy)(()=>$(()=>import(`./Docs-DE04qOKj.js`),__vite__mapDeps([24,1,2,3,4,7,12,13,19,14])));function ra(){let e=ge(),[t,n]=(0,B.useState)(null),[r,i]=(0,B.useState)(!1),[o,s]=Ke(),[c,l]=Ze(),[u,d]=pt(),f=e=>{if(e===c)return;let t=()=>{l(e),d(`curated`)};if(!document.startViewTransition||!E())return t();document.startViewTransition(()=>(0,se.flushSync)(t))},[p,m]=vt(),[h,g]=(0,B.useState)(()=>{try{return!window.sessionStorage.getItem(`gs-booted`)}catch{return!0}}),[_,v]=(0,B.useState)(!1),y=(0,B.useRef)(null),b=(0,B.useRef)(null);(0,B.useEffect)(()=>{if(!_)return;let e=e=>{e.key===`Escape`&&v(!1)};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[_]),(0,B.useEffect)(()=>{if(!_)return;let e=b.current,t=document.activeElement;return e&&(e.inert=!0),document.getElementById(`rail-nav`)?.focus(),()=>{e&&(e.inert=!1),t instanceof HTMLElement&&t.focus()}},[_]);let x=e=>n({kind:e?.body?.kind||`err`,msg:e?.body?.message||e.message}),{overview:S,error:C,themes:w,reload:T}=yt(x),[D,O]=(0,B.useState)(0),k=()=>{T(),O(e=>e+1)},[A,j]=(0,B.useState)(null),{runs:M,activeId:N,consoleOpen:P,setConsoleOpen:F,runAction:I,cancelJob:ee,clearRuns:te}=xt({onFinish:e=>{k(),j({status:e,at:Date.now()})},onError:x}),{data:L}=W(()=>a.setup().catch(()=>null),[D],`setup`),{data:ne}=W(()=>a.installs().catch(()=>null),[D],`installs`),re=ne?.installs||null,ie=M[M.length-1],ae=ie?ie.status===`running`?`${ie.action} running`:`${ie.action} ${ie.status}`:``;(0,B.useEffect)(()=>{let e=y.current;if(e){if(!Ue(e,lt(u),o)){let t=dt(u);t?Se(e,t,o):we(e,c,o)}document.querySelector(`meta[name="theme-color"]`)?.setAttribute(`content`,getComputedStyle(e).getPropertyValue(`--bg`).trim())}},[o,u,c]);let R=[{title:`Rebuild all`,desc:`Re-emit every install`,run:()=>I(`build-all`),confirm:{msg:`Rebuild every install from the current sources?`,title:`Rebuild all?`,confirmLabel:`Rebuild all`}},{title:`Update`,desc:`Pull the latest Geneseed; the server restarts after`,run:()=>I(`update`),confirm:{msg:`Update Geneseed? The server restarts when the update ends.`,title:`Update Geneseed?`,confirmLabel:`Update`}},{title:`Run doctor`,desc:`Read-only health check`,run:()=>I(`doctor`)},{title:`Restart server`,desc:`Restart the local Geneseed server`,run:()=>rt().catch(x),confirm:{msg:`Restart the local Geneseed server? The console reconnects in a moment.`,title:`Restart the server?`,confirmLabel:`Restart`}},{title:o===`light`?`Switch to dark mode`:`Switch to light mode`,desc:`Appearance`,run:s},...Je.filter(e=>e.id!==c).map(e=>({title:`Flavour: ${e.name}`,desc:e.tagline,run:()=>f(e.id)}))].map(e=>({kind:`Actions`,hay:`${e.title} ${e.desc}`.toLowerCase(),...e})),oe={flavour:c,onFlavour:f,accentMode:u,onAccentMode:d,layout:p,onLayout:m};return(0,q.jsx)(`div`,{className:`app fl-${c} ${o===`light`?`light`:``}${_?` nav-open`:``}`,ref:y,children:(0,q.jsxs)(on,{children:[(0,q.jsx)(`div`,{className:`atmos`,"aria-hidden":`true`}),(0,q.jsx)(`a`,{className:`skip-link`,href:`#main`,onClick:e=>{e.preventDefault(),document.getElementById(`main`)?.focus()},children:`Skip to content`}),(0,q.jsx)(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:ae}),_&&(0,q.jsx)(`button`,{type:`button`,className:`nav-scrim`,"aria-label":`Close navigation`,onClick:()=>v(!1)}),(0,q.jsx)(Vt,{route:e,overview:S,installs:re,onOpenVoice:()=>i(e=>!e),onNavigate:()=>v(!1)}),r&&(0,q.jsx)(bn,{themes:w,current:S?.theme,onPick:e=>{i(!1),I(`build`,{theme:e,emit:S?.emit})},onClose:()=>i(!1)}),(0,q.jsxs)(`div`,{className:`col`,ref:b,children:[(0,q.jsx)(yn,{route:e,navOpen:_,onToggleNav:()=>v(e=>!e),overview:S,installs:re,actions:R,mode:o,onToggleMode:s,appearance:oe,dataRev:D,onSwitch:k}),(0,q.jsx)(`main`,{className:`page`,id:`main`,tabIndex:-1,children:(0,q.jsx)(`div`,{className:[`library`,`kits`,`loops`,`docs`].includes(e.page)?`pad pad-wide`:`pad`,children:(0,q.jsx)(zn,{activeId:N,finish:A,children:(0,q.jsx)(Pn,{children:(0,q.jsx)(B.Suspense,{fallback:(0,q.jsx)(kn,{}),children:{overview:()=>(0,q.jsx)(qi,{overview:S,overviewError:C,onRetry:T,themes:w,setup:L,runs:M,onAction:I,layout:p,onLayout:m,dataRev:D}),laws:()=>(0,q.jsx)($i,{selected:e.item,overview:S,setup:L,onAction:I,dataRev:D}),library:()=>(0,q.jsx)(Xi,{overview:S,section:e.section,selected:e.item,dataRev:D}),kits:()=>(0,q.jsx)(Zi,{item:e.item,onAction:I,dataRev:D}),loops:()=>(0,q.jsx)(Qi,{tab:e.tab,item:e.item,dataRev:D}),personal:()=>(0,q.jsx)(ea,{tab:e.tab,item:e.item,setup:L,dataRev:D}),installs:()=>(0,q.jsx)(ta,{tab:e.tab,overview:S,setup:L,themes:w,onAction:I,onMutated:k,dataRev:D,appearance:oe}),activity:()=>e.item?(0,q.jsx)(Yi,{sid:e.item},e.item):(0,q.jsx)(Ji,{}),docs:()=>(0,q.jsx)(na,{page:e.item,onAction:I,overview:S})}[e.page]?.()})},e.page)})})}),(0,q.jsx)(Ut,{route:e,navOpen:_,onMore:()=>v(!0)}),(0,q.jsx)(Cn,{runs:M,open:P,busy:!!N,finish:A,onToggle:()=>F(e=>!e),onClear:te,onCancel:ee})]}),(0,q.jsx)(Sn,{toast:t,onClose:()=>n(null)}),h&&(0,q.jsx)(On,{ready:!!S||!!C,onDone:()=>{try{window.sessionStorage.setItem(`gs-booted`,`1`)}catch{}g(!1)}})]})})}(0,ce.createRoot)(document.getElementById(`root`)).render((0,q.jsx)(ra,{})),`serviceWorker`in navigator&&window.addEventListener(`load`,()=>{navigator.serviceWorker.register(`/sw.js`).catch(()=>{})});export{Xt as $,ur as A,Kn as B,nr as C,ae as Ct,ir as D,cr as E,Zn as F,In as G,Wn as H,tr as I,An as J,Bn as K,Qn as L,vr as M,gr as N,ar as O,Cr as P,an as Q,Yn as R,Er as S,z as St,Sr as T,Un as U,Gn as V,Vn as W,_n as X,kn as Y,gn as Z,kr as _,Je as _t,Fi as a,Kt as at,Dr as b,_e as bt,Ai as c,Nt as ct,Fr as d,Ot as dt,Qt as et,Pr as f,Pt as ft,Mr as g,rt as gt,Rr as h,ft as ht,Ii as i,Jt as it,fr as j,br as k,Wr as l,Mt as lt,Lr as m,ht as mt,Li as n,Wt as nt,ji as o,J as ot,Ir as p,W as pt,jn as q,ki as r,Gt as rt,Ni as s,K as st,$ as t,Zt as tt,Zr as u,jt as ut,wr as v,H as vt,dr as w,te as wt,Or as x,he as xt,Tr as y,le as yt,Jn as z};