geneseed 5.3.0 → 5.3.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +27 -0
- package/README.md +2 -2
- package/SHIPPED.md +1 -1
- package/adapters/bob/README.md +31 -18
- package/adapters/claude-code/README.md +27 -22
- package/adapters/openclaude/README.md +18 -8
- package/adapters/opencode/HOW-OPENCODE-LOADS.md +8 -3
- package/adapters/opencode/plugins/geneseed-activity.js +20 -21
- package/adapters/opencode/plugins/geneseed-context.js +169 -62
- package/adapters/opencode/plugins/geneseed-guard.js +414 -202
- package/adapters/opencode/plugins/geneseed-workflow.js +3 -2
- package/adapters/opencode/workflows/_runtime.js +3 -2
- package/bin/geneseed-hook.mjs +57 -9
- package/docs/concepts/enforcement-table.md +1 -1
- package/docs/concepts/exclusions.md +2 -2
- package/docs/concepts/footprint.md +10 -0
- package/docs/concepts/hook-gates.md +3 -3
- package/docs/concepts/host-matrix.md +22 -4
- package/docs/design-history.md +8 -0
- package/docs/extending.md +49 -7
- package/docs/guides/install-bob.md +2 -2
- package/docs/guides/install-openclaude.md +1 -1
- package/docs/guides/verify.md +12 -0
- package/docs/reference/environment.md +1 -0
- package/docs/reference/troubleshoot-doctor.md +1 -1
- package/docs/token-footprint.md +66 -2
- package/docs/understand/design-choices-hosts.md +1 -1
- package/docs/understand/design-choices-shape.md +1 -0
- package/docs/understand/enforced-vs-asked.md +1 -1
- package/docs/understand/machine-bob.md +1 -1
- package/docs/web-ui.md +5 -0
- package/harness.config.json +1 -1
- package/js/README.md +3 -2
- package/js/build/args.mjs +1 -1
- package/js/build/driver.mjs +1 -1
- package/js/build/emit-claude.mjs +1 -1
- package/js/build/generate.mjs +5 -14
- package/js/hosts/done-checks.mjs +6 -0
- package/js/hosts/geneseed-dir.mjs +3 -2
- package/js/hosts/gitref.mjs +5 -3
- package/js/hosts/hook-tap.mjs +104 -0
- package/js/hosts/hooks-context.mjs +4 -2
- package/js/hosts/hooks-learn.mjs +47 -16
- package/js/hosts/hooks.mjs +19 -13
- package/js/hosts/hosts.mjs +80 -12
- package/js/hosts/installs.mjs +7 -0
- package/js/hosts/native.mjs +14 -5
- package/js/hosts/owned.mjs +7 -6
- package/js/hosts/ownership-gate.mjs +14 -1
- package/js/hosts/settings.mjs +245 -103
- package/js/hosts/shim.mjs +4 -4
- package/js/hosts/usage.mjs +9 -3
- package/js/inspect/checks-probe.mjs +66 -5
- package/js/inspect/checks-repo.mjs +196 -2
- package/js/inspect/cost.mjs +34 -2
- package/js/inspect/doctor.mjs +6 -1
- package/js/lib/machine-dir.mjs +1 -1
- package/js/lib/node-floor.mjs +46 -6
- package/js/maintain/uninstall.mjs +42 -16
- package/js/web/actions.mjs +1 -9
- package/package.json +1 -1
- package/web/dist/assets/Activity-WQ3ykgxU.js +1 -0
- package/web/dist/assets/{ActivityDetail-BSzevynX.js → ActivityDetail-7rt04SkS.js} +1 -1
- package/web/dist/assets/{Bonsai-Bfpb6W-1.js → Bonsai-BBl4XXqs.js} +1 -1
- package/web/dist/assets/{CopyButton-ByIntFtB.js → CopyButton-Beven8yn.js} +1 -1
- package/web/dist/assets/Dashboard-BgLArtgu.js +2 -0
- package/web/dist/assets/{Docs-DvlMJhpu.js → Docs-B5aHp86J.js} +3 -3
- package/web/dist/assets/Factories-BjqzXAw8.js +1 -0
- package/web/dist/assets/GreenhouseView-Bce212qd.js +1 -0
- package/web/dist/assets/{Installs-BlGmVrFK.js → Installs-B1OsrHXF.js} +3 -3
- package/web/dist/assets/JournalView-CV4omyww.js +1 -0
- package/web/dist/assets/{Kits-DRwpxC-J.js → Kits-CW1e7xNa.js} +1 -1
- package/web/dist/assets/{Laws-CZkiNOWQ.js → Laws-1Ckf1lbs.js} +2 -2
- package/web/dist/assets/{LibRows-DEHjIoD-.js → LibRows-Dag1s0ZX.js} +1 -1
- package/web/dist/assets/Library-B3FuFLel.js +3 -0
- package/web/dist/assets/Loops-CwqgnLNw.js +2 -0
- package/web/dist/assets/Markdown-CxkA7940.js +71 -0
- package/web/dist/assets/OperatorHudView-JmYY1pBR.js +1 -0
- package/web/dist/assets/{Personal-Bp9nV4GR.js → Personal-DKLgLa7Z.js} +2 -2
- package/web/dist/assets/Settings-BwErnh-R.js +1 -0
- package/web/dist/assets/{Tabs-CWeQTADL.js → Tabs-8zsyEPSK.js} +1 -1
- package/web/dist/assets/{index-CsAZq0BQ.css → index-CRWqKxfY.css} +1 -1
- package/web/dist/assets/index-Ce6qF2nG.js +6 -0
- package/web/dist/index.html +2 -2
- package/adapters/claude-code/settings.json +0 -52
- package/web/dist/assets/Activity-CqJiquEq.js +0 -1
- package/web/dist/assets/Dashboard-DBOEi9lQ.js +0 -2
- package/web/dist/assets/Factories-Bpvv7L2H.js +0 -1
- package/web/dist/assets/GreenhouseView-GpBsYn50.js +0 -1
- package/web/dist/assets/JournalView-iLuLrOxE.js +0 -1
- package/web/dist/assets/Library-B4K-1iNF.js +0 -3
- package/web/dist/assets/Loops-BWSzaW8E.js +0 -2
- package/web/dist/assets/Markdown-0ORz7tAc.js +0 -69
- package/web/dist/assets/OperatorHudView-BAXwCEvY.js +0 -1
- package/web/dist/assets/Settings-CWWuaIp-.js +0 -1
- package/web/dist/assets/index-How7SzDZ.js +0 -6
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{At as r,Et as i,Ot as a,S as o,St as s,bt as c,kt as l,xt as u}from"./index-Ce6qF2nG.js";import{n as d}from"./sections-CtFz7HFH.js";import{A as f,B as p,C as m,E as h,F as g,H as _,K as v,M as y,N as b,O as x,P as S,U as C,_ as w,a as T,d as ee,f as E,g as D,h as O,i as k,j as A,l as j,n as M,p as N,r as P,u as F,v as I,w as L,x as R}from"./motion-RlUl1osO.js";import{t as z}from"./api-DLDVY3K-.js";import{n as B}from"./Dashboard-BgLArtgu.js";function V(e){return L((e.iterationDuration+e._loopDelay)*e.iterationCount-e._loopDelay)||1e-11}function H(e,t,n,r,i,a){let o=f(e.duration)&&e.duration<=1e-11?n-C:n;t.composition&&I(t,o,1,1,v.AUTO);let s=r?new F(r,e,t,o,!1,i,a):new O(e,t,o);return t.composition&&s.init(!0),m(t,s),h(t,e=>{let n=e._offset+e._delay+e.duration;n>t.iterationDuration&&(t.iterationDuration=n)}),t.duration=V(t),t}var U=0,W=class extends O{constructor(e={}){super(e,null,0),++U,this.id=b(e.id)?U:e.id,this.duration=0,this.labels={};let t=e.defaults,n=p.defaults;this.defaults=t?S(t,n):n,this.composition=R(e.composition,!0),this.onRender=e.onRender||n.onRender;let r=R(e.playbackEase,n.playbackEase);this._ease=r?E(r):null,this.iterationDuration=0}add(e,t,n){let i=A(t),a=A(e);if(i||a){if(this._hasChildren=!0,i){let i=t,a=p.editor&&p.editor.addTimelineChild,o=n&&n.type===`Stagger`&&p.editor,s=x(n)?n:null;if(s||o){let t=N(e),o=this.duration,c=this.iterationDuration,l=i.id,u=0,d=t.length,f=a?a(e,i,this.id,n,d):null,m=s||p.editor.resolveStagger(n.defaultValue);t.forEach(e=>{let n={...f||i};this.duration=o,this.iterationDuration=c,b(l)||(n.id=l+`-`+u);let a=r(this,m(e,u,t,null,this));H(n,this,a,e,u,t),u++})}else{let t=a?a(e,i,this.id,n):i,o=n&&n.type?n.defaultValue:n;H(t,this,r(this,o),e)}}else H(e,this,r(this,t));return this.composition&&this.init(!0),this}}sync(e,t){if(b(e)||e&&b(e.pause))return this;e.pause();let n=+(e.effect?e.effect.getTiming().duration:e.duration);!b(e)&&!b(e.persist)&&(e.persist=!0);let r=p.editor,i=r&&r.addTimelineChild;r&&r.addTimelineSync&&(t=r.addTimelineSync(e,t,this.id),r.addTimelineChild=null);let a=this.add(e,{currentTime:[0,n],duration:n,delay:0,ease:`linear`,playbackEase:`linear`},t);return r&&(r.addTimelineChild=i),a}set(e,t,n){return b(t)?this:(t.duration=C,t.composition=_.replace,this.add(e,t,n))}call(e,t){return b(e)||e&&!x(e)?this:(p.editor&&p.editor.addTimelineCall&&(t=p.editor.addTimelineCall(e,t,this.id)),this.add({duration:0,delay:0,onComplete:()=>e(this)},t))}label(e,t){return b(e)||e&&!y(e)||(p.editor&&p.editor.addTimelineLabel&&(t=p.editor.addTimelineLabel(e,t,this.id)),this.labels[e]=r(this,t)),this}remove(e,t){return D(N(e),this,t),this}stretch(e){let t=this.duration;if(t===g(e))return this;let n=e/t,r=this.labels;h(this,e=>e.stretch(e.duration*n));for(let e in r)r[e]*=n;return super.stretch(e)}refresh(){return h(this,e=>{e.refresh&&e.refresh()}),this}revert(){return super.revert(),h(this,e=>e.revert,!0),w(this)}then(e){return super.then(e)}},G=e=>p.editor?p.editor.addTimeline(e):new W(e).init(),K=e(t(),1),q=n(),J=.62,te=(e,t)=>String(e).length*t*J;function Y(e,t){let n=0;for(let t of e){if(t.t===``||t.t==null)continue;let e=te(t.t,t.size)/2;n=Math.max(n,Math.hypot(e,t.dy-t.size*.75),Math.hypot(e,t.dy+t.size*.25))}return Math.ceil(n+t)}function X(e,t,n=0){let r=t.x-e.x,i=t.y-e.y,a=Math.hypot(r,i)||1,o=r/a,s=i/a,c=e.x+o*e.r,l=e.y+s*e.r,u=t.x-o*t.r,d=t.y-s*t.r,f=n*a,p=e=>e.toFixed(1);return`M${p(c)} ${p(l)} C${p(c+o*a*.3-s*f)} ${p(l+s*a*.3+o*f)} ${p(u-o*a*.3-s*f)} ${p(d-s*a*.3+o*f)} ${p(u)} ${p(d)}`}var Z=!1,Q=!1,ne=M[8]+M[7];function $({hash:e,label:t,part:n,children:r}){return(0,q.jsx)(`g`,{className:`cm-node`,"data-cm":n,role:`button`,tabIndex:0,"aria-label":t,onClick:()=>i(e),onKeyDown:t=>{(t.key===`Enter`||t.key===` `)&&(t.preventDefault(),i(e))},children:r})}function re({overview:e,dataRev:t}){let{data:n}=s(()=>z.catalog(`laws`),[t],`catalog:laws`),r=n?.items??null,i=n?.nouns?.ontology||`Ethos`,c=n?.nouns?.laws||`Dictates`,d=n?.nouns?.doctrines||`Doctrines`,f=(0,K.useRef)(null),p=(0,K.useRef)(!0),m=(0,K.useRef)(null);(0,K.useLayoutEffect)(()=>{let e=f.current;if(!e||Z||!k())return;Z=!0;let t=t=>[...e.querySelectorAll(t)],n=t(`[data-cm="hub"]`),r=t(`[data-cm="sat"]`),i=t(`[data-cm="gov"]`),o=t(`.cm-edge-gov`),s=t(`.cm-note, .cm-govern-label`),c=a(t(`.cm-edge`));j([...n,...r,...i],{opacity:0,scale:.7}),j([...o,...s],{opacity:0}),j(c,{draw:`0 0`});let u=G({autoplay:!1,defaults:{ease:P}}).add(n,{opacity:1,scale:1,duration:M[7]},0).add(c,{draw:`0 1`,duration:M[7],delay:l(M[1])},M[3]).add(r,{opacity:1,scale:1,duration:M[7],delay:l(M[1])},M[5]).add(o,{opacity:1,duration:M[6],delay:l(M[1])},M[7]).add(i,{opacity:1,scale:1,duration:M[7],delay:l(M[1])},M[8]).add(s,{opacity:1,duration:M[6]},M[8]);p.current=!1;let d=()=>u.complete(),h=()=>{u.play(),d=T(u,ne),p.current=!0,m.current?.()};if(typeof IntersectionObserver>`u`)return h(),()=>d();let g=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(g.disconnect(),h())},{threshold:.33});return g.observe(e),()=>{g.disconnect(),p.current=!0,d()}},[]);let h=e?.counts||{},g=u(h),_=[];for(let e of(r||[]).filter(e=>e.tier===`doctrine`)){let t=_.find(t=>t.id===e.pack);t||_.push(t={id:e.pack,n:0}),t.n+=1}let v=e?.footprint===`lean`?`lean — first line only`:`full text inlined`,y={x:330,y:165,r:Y([{t:`Constitution`,size:17,dy:-12},{t:`${g} rules`,size:10,dy:8},{t:v,size:8.5,dy:24}],12)},b={x:126,y:95,r:Y([{t:i,size:12.5,dy:-7},{t:`${h.ontology??0} sections`,size:10,dy:10}],11)},x={x:560,y:78,r:Y([{t:c,size:12.5,dy:-6},{t:`${h.laws??0}`,size:13,dy:12}],11)},S={x:560,y:252,r:Y([{t:d,size:12.5,dy:-6},{t:`${h.doctrines?.rules??0}`,size:13,dy:12}],11)},C=(e,t,n,r)=>({x:e,y:t,label:n,count:r,r:Y([{t:n,size:10.5,dy:-2},{t:`${r}`,size:9,dy:10}],9)}),w=[{...C(812,52,`Skills`,h.skills??0),hash:`#/skills`,from:x},{...C(820,126,`Agents`,h.agents??0),hash:`#/agents`,from:x},{...C(816,232,`Memory`,h.memory??0),hash:`#/personal/memory`,from:S},{...C(812,300,`Wiki`,h.wiki??0),hash:`#/section/wiki`,from:S}],E={rx:122,ry:68,from:212,to:112},D=_.map((e,t)=>{let n=(_.length===1?(E.from+E.to)/2:E.from+(E.to-E.from)*t/(_.length-1))*Math.PI/180;return{...e,x:S.x+E.rx*Math.cos(n),y:S.y+E.ry*Math.sin(n),r:Y([{t:e.id,size:7.5,dy:-2},{t:`${e.on}`,size:7.5,dy:8}],4)}}),O=D.length;return(0,K.useLayoutEffect)(()=>{let e=f.current;if(!e||!O||Q||!k())return;Q=!0;let t=[...e.querySelectorAll(`.cm-mini > g`)];j(t,{opacity:0,scale:.5});let n=()=>j(t,{opacity:1,scale:1}),r=()=>{m.current=null;let e=ee(t,{opacity:1,scale:1,duration:M[7],delay:l(M[1],{start:M[7]}),ease:P});n=T(e,M[7]+M[1]*O+M[7])};return p.current?r():m.current=r,()=>{m.current=null,n()}},[O]),(0,q.jsxs)(`svg`,{ref:f,className:`cmap`,viewBox:`0 0 940 350`,role:`group`,"aria-label":`The constitution map`,children:[(0,q.jsx)(`path`,{d:X(y,b,.05),className:`cm-edge`}),(0,q.jsx)(`path`,{d:X(y,x,-.07),className:`cm-edge`}),(0,q.jsx)(`path`,{d:X(y,S,.07),className:`cm-edge`}),w.map(e=>(0,q.jsx)(`path`,{d:X(e.from,e,.03),className:`cm-edge-gov`},`e-${e.label}`)),(0,q.jsxs)($,{hash:`#/laws`,part:`hub`,label:`Constitution: ${g} rules`,children:[(0,q.jsx)(`circle`,{cx:y.x,cy:y.y,r:y.r,className:`cm-hub-disc`}),(0,q.jsx)(`text`,{x:y.x,y:y.y-12,textAnchor:`middle`,className:`cm-hub-name`,children:`Constitution`}),(0,q.jsxs)(`text`,{x:y.x,y:y.y+8,textAnchor:`middle`,className:`cm-hub-num`,children:[g,` rules`]}),(0,q.jsx)(`text`,{x:y.x,y:y.y+24,textAnchor:`middle`,className:`cm-note`,children:v})]}),(0,q.jsxs)($,{hash:`#/laws`,part:`sat`,label:`${i}: ${h.ontology??0} sections`,children:[(0,q.jsx)(`circle`,{cx:b.x,cy:b.y,r:b.r,className:`cm-sat-disc`}),(0,q.jsx)(`text`,{x:b.x,y:b.y-7,textAnchor:`middle`,className:`cm-sat-name`,children:i}),(0,q.jsxs)(`text`,{x:b.x,y:b.y+10,textAnchor:`middle`,className:`cm-sat-num`,children:[h.ontology??0,` sections`]})]}),(0,q.jsx)(`text`,{x:b.x,y:b.y+b.r+16,textAnchor:`middle`,className:`cm-note`,children:`how it thinks, not a rule`}),(0,q.jsxs)($,{hash:`#/laws`,part:`sat`,label:`${c}: ${h.laws??0}, never broken`,children:[(0,q.jsx)(`circle`,{cx:x.x,cy:x.y,r:x.r,className:`cm-sat-disc`}),(0,q.jsx)(`text`,{x:x.x,y:x.y-6,textAnchor:`middle`,className:`cm-sat-name`,children:c}),(0,q.jsx)(`text`,{x:x.x,y:x.y+12,textAnchor:`middle`,className:`cm-sat-big`,children:h.laws??0})]}),(0,q.jsx)(`text`,{x:x.x,y:x.y+x.r+16,textAnchor:`middle`,className:`cm-note`,children:`never broken`}),(0,q.jsxs)($,{hash:`#/laws`,part:`sat`,label:`${d}: ${h.doctrines?.rules??0} rules`,children:[(0,q.jsx)(`circle`,{cx:S.x,cy:S.y,r:S.r,className:`cm-sat-disc`}),(0,q.jsx)(`text`,{x:S.x,y:S.y-6,textAnchor:`middle`,className:`cm-sat-name`,children:d}),(0,q.jsx)(`text`,{x:S.x,y:S.y+12,textAnchor:`middle`,className:`cm-sat-big`,children:h.doctrines?.rules??0})]}),(0,q.jsx)(`text`,{x:S.x+22,y:S.y+S.r+20,className:`cm-note`,children:h.doctrines?`${h.doctrines.active}/${h.doctrines.total} packs built in`:`packs chosen at build`}),(0,q.jsx)(`g`,{className:`cm-mini`,children:D.map(e=>(0,q.jsxs)(`g`,{children:[(0,q.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r,className:`cm-pack-disc`,style:{stroke:o(e.id)}}),(0,q.jsx)(`text`,{x:e.x,y:e.y-2,textAnchor:`middle`,className:`cm-pack-id`,children:e.id}),(0,q.jsx)(`text`,{x:e.x,y:e.y+8,textAnchor:`middle`,style:{fill:o(e.id)},children:e.n})]},e.id))}),(0,q.jsx)(`text`,{x:866,y:16,textAnchor:`middle`,className:`cm-govern-label`,children:`GOVERNS THE HARNESS`}),w.map(e=>(0,q.jsxs)($,{hash:e.hash,part:`gov`,label:`${e.label}: ${e.count}`,children:[(0,q.jsx)(`circle`,{cx:e.x,cy:e.y,r:e.r,className:`cm-gov-disc`}),(0,q.jsx)(`text`,{x:e.x,y:e.y-2,textAnchor:`middle`,className:`cm-gov-name`,children:e.label}),(0,q.jsx)(`text`,{x:e.x,y:e.y+10,textAnchor:`middle`,className:`cm-gov-num`,children:e.count})]},e.label)),(0,q.jsx)(`text`,{x:b.x,y:228,textAnchor:`middle`,className:`cm-note`,children:`tap any node to open its ledger`})]})}function ie({counts:e}){let t=[{label:d.skills.label,n:e.skills??0,hash:`#/skills`},{label:`Rules`,n:u(e),hash:`#/laws`},{label:d.agents.label,n:e.agents??0,hash:`#/agents`},{label:d.memory.label,n:e.memory??0,hash:`#/personal/memory`},{label:d.notebook.label,n:e.notebook??0,hash:`#/personal/notebook`},{label:d.wiki.label,n:e.wiki??0,hash:`#/section/wiki`},{label:d.config.label,n:e.config??0,hash:`#/section/config`}],n=Math.max(...t.map(e=>e.n),1);return(0,q.jsxs)(`div`,{className:`card pad-lg jr-card`,children:[(0,q.jsxs)(`div`,{className:`card-head`,children:[(0,q.jsx)(`h3`,{children:`Growth rings`}),(0,q.jsx)(`span`,{className:`tick right`,children:`by section`})]}),t.map(e=>(0,q.jsxs)(`button`,{className:`jr-ring`,onClick:()=>i(e.hash),children:[(0,q.jsx)(`span`,{className:`jr-ring-label`,children:e.label}),(0,q.jsx)(`span`,{className:`jr-ring-track`,children:(0,q.jsx)(`span`,{className:`jr-ring-fill`,style:{width:`${e.n/n*100}%`}})}),(0,q.jsx)(`span`,{className:`jr-ring-num`,children:e.n})]},e.label))]})}function ae({recent:e,buildEpoch:t}){let n=e?.items||[],r=e?.skipped||[];return(0,q.jsxs)(`div`,{className:`card pad-lg jr-card`,children:[(0,q.jsxs)(`div`,{className:`card-head`,children:[(0,q.jsx)(`h3`,{children:`Freshly grown`}),(0,q.jsx)(`span`,{className:`tick right`,children:`newest`})]}),e?n.length===0?(0,q.jsx)(`p`,{className:`sub`,children:`Nothing here carries a date yet.`}):n.slice(0,5).map(e=>(0,q.jsxs)(`button`,{className:`jr-fresh`,onClick:()=>i(`#/item/${e.type}/${encodeURIComponent(e.name)}`),children:[(0,q.jsx)(`span`,{className:`jr-fresh-kind`,children:e.section}),(0,q.jsx)(`span`,{className:`jr-fresh-name`,children:e.title}),(0,q.jsx)(`span`,{className:`jr-fresh-when`,children:c(e.mtime)})]},`${e.section}:${e.name}`)):(0,q.jsx)(`p`,{className:`sub`,children:`Reading the shelves…`}),r.length>0&&(0,q.jsxs)(`p`,{className:`sub jr-skipped`,children:[`Not dated: `,r.join(`, `),` — too many files to stat on every load.`]}),(0,q.jsxs)(`p`,{className:`jr-care`,children:[t?`Last built ✓ ${c(t)}`:`Never built here`,` ·`,` `,(0,q.jsx)(`button`,{className:`jr-go`,onClick:()=>i(`#/activity`),children:`log →`})]})]})}function oe({overview:e,recent:t,lens:n,dataRev:r}){let a=e?.counts||{};return(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(`div`,{className:`jr-head`,children:(0,q.jsx)(B,{verdict:n?.verdict})}),(0,q.jsxs)(`div`,{className:`jr-row2`,children:[(0,q.jsx)(ie,{counts:a}),(0,q.jsx)(ae,{recent:t,buildEpoch:e?.build_epoch})]}),(0,q.jsxs)(`div`,{className:`card pad-lg jr-map`,children:[(0,q.jsxs)(`div`,{className:`card-head`,children:[(0,q.jsx)(`h3`,{children:`The Constitution — and the harness it governs`}),(0,q.jsx)(`button`,{className:`jr-go right`,onClick:()=>i(`#/laws`),children:`open →`})]}),(0,q.jsx)(re,{overview:e,dataRev:r})]})]})}export{oe as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{$ as i,R as a,St as o,V as s,X as c,Z as l,et as u,it as d,pt as f}from"./index-How7SzDZ.js";import{t as p}from"./Markdown-0ORz7tAc.js";import{t as m}from"./EmptyState-CY5Pm2xy.js";import{t as h}from"./DataTable-b9zTShqJ.js";import{r as g}from"./controls-D4wmg_pl.js";var _=e(t(),1),v=e=>e.kits||[],y=e=>!e.editable||e.state===`unreadable`;function b(e,t){let n=d(),r=l(),i=e=>{let t=r.get(`kits`,e.id);return t&&t.base===c(v(e))?t:null},{prune:a}=r;(0,_.useEffect)(()=>{if(!e?.installs)return;let t=new Map(e.installs.map(e=>[e.id,c(v(e))]));a(`kits`,(e,n)=>t.has(e)&&t.get(e)!==n.base)},[e,a]);let o=e=>i(e)?.value??new Set(v(e)),s=(e,t)=>{let n=new Set(o(e));n.delete(t)||n.add(t),r.put(`kits`,e.id,n,c(v(e)))},u=e=>{let t=o(e),n=new Set(v(e));return{on:[...t].filter(e=>!n.has(e)),off:[...n].filter(e=>!t.has(e))}},p=e=>r.running(`kits`,e.id)||!!i(e)?.applied;return{setOf:o,toggle:s,change:u,apply:async e=>{let i=[...o(e)],a=`Rebuild ${f(e)} with kits: ${i.join(`, `)||`none`}? Members of kits turned off are removed; files you edited are kept.`;await n(a,{confirmLabel:`Rebuild`})&&await t(`install`,{host:e.host,path:e.path,kits:i})&&r.startApply(`kits`,e.id)},running:p,failed:e=>!!i(e)?.failed,discard:e=>{p(e)||r.drop(`kits`,e.id)},busy:r.busy}}var x=n();function S(e,t){let{on:n,off:r}=t.change(e);if(t.running(e))return`Rebuilding…`;let i=[...n.map(e=>`turn on ${e}`),...r.map(e=>`turn off ${e}`)].join(` · `);return[t.failed(e)?`Last rebuild failed — see console`:``,i].filter(Boolean).join(` · `)||`No staged changes`}function C({row:e,stage:t}){let{on:n,off:r}=t.change(e),i=n.length+r.length>0,a=t.running(e);return(0,x.jsxs)(`div`,{className:`kit-foot`,children:[(0,x.jsx)(`span`,{className:`kit-hint${i?` staged`:``}`,role:`status`,children:S(e,t)}),(0,x.jsx)(`button`,{type:`button`,className:`btn soft sm`,"aria-label":`Apply kits for ${f(e)}`,disabled:y(e)||!i||a||t.busy,title:t.busy&&!a?`A job is running`:void 0,onClick:()=>t.apply(e),children:`Apply`})]})}var w={active:[`Active`,`ok`],disabled:[`Disabled`,`warn`]},T=({row:e})=>{let[t,n]=w[e.state]||[e.state||`Unknown`,``];return(0,x.jsx)(`span`,{className:`tag ${n}`,children:t})},E=encodeURIComponent,D=e=>(e||``).split(/\s+/).filter(Boolean).length,O=e=>[...new Set(e.filter(Boolean))],k=e=>(e||``).slice(0,7),A=(e,t)=>e?`On in ${e} of ${N(t,`install`)}`:`Installed when this kit is on`,j=({type:e,names:t,listed:n,offNote:r=A(0)})=>t.length?(0,x.jsx)(`ul`,{className:`kit-links`,children:t.map(t=>(0,x.jsx)(`li`,{children:n?.has(t)?(0,x.jsx)(`a`,{href:`#/item/${e}/${E(t)}`,children:t}):(0,x.jsx)(`span`,{className:`kit-link-off`,title:r,children:t})},t))}):(0,x.jsx)(`p`,{className:`panel-note`,children:`None.`});function M({kit:e,installs:t,stage:n,listed:r}){let i=e.credits||[],a=A(t.filter(t=>v(t).includes(e.name)).length,t.length);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`reader-tags`,children:[(0,x.jsx)(`span`,{className:`tag acc`,children:`Kit`}),O(i.map(e=>e.license)).map(e=>(0,x.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,x.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,x.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,x.jsxs)(`p`,{className:`mono dim reader-src`,children:[`kits/`,e.name,`/`]}),(0,x.jsx)(`hr`,{className:`hr`}),(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Installs`}),t.length?(0,x.jsx)(`ul`,{className:`kit-list kit-box`,"aria-label":`Installs for ${e.name}`,children:t.map(t=>{let r=y(t),i=f(t);return(0,x.jsxs)(`li`,{className:`kit-install`,children:[(0,x.jsxs)(`div`,{className:`kit-row`,children:[(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`b`,{children:i}),(0,x.jsx)(`span`,{className:`mono dim`,children:t.path})]}),(0,x.jsx)(T,{row:t}),(0,x.jsx)(g,{on:n.setOf(t).has(e.name),disabled:r||n.running(t),label:`${e.name} for ${i}`,onToggle:()=>n.toggle(t,e.name)})]}),r&&(0,x.jsx)(`p`,{className:`kit-lock`,children:t.reason||t.error}),(0,x.jsx)(C,{row:t,stage:n})]},t.id)})}):(0,x.jsx)(`p`,{className:`panel-note`,children:`No install yet.`}),i.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Upstream`}),(0,x.jsx)(`dl`,{className:`loop-facts`,children:i.map(e=>(0,x.jsxs)(_.Fragment,{children:[(0,x.jsx)(`dt`,{children:e.author||e.repo}),(0,x.jsxs)(`dd`,{children:[(0,x.jsx)(`span`,{className:`mono`,children:e.repo}),e.commit?(0,x.jsxs)(`span`,{className:`mono dim`,children:[`@ `,k(e.commit)]}):null,e.compareUrl?(0,x.jsx)(`a`,{href:e.compareUrl,target:`_blank`,rel:`noreferrer`,"aria-label":`Compare ${e.repo} @ ${k(e.commit)} with HEAD`,children:`compare`}):null,e.license?(0,x.jsx)(`span`,{className:`tag`,children:e.license}):null]})]},e.key||e.repo))})]}):null,(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Skills`}),(0,x.jsx)(j,{type:`skill`,names:e.skills||[],listed:r?.skills,offNote:a}),(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Agents`}),(0,x.jsx)(j,{type:`agent`,names:e.agents||[],listed:r?.agents,offNote:a}),e.rules?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`h3`,{className:`loop-h2`,children:[`Rules`,` `,(0,x.jsxs)(`span`,{className:`mono dim`,children:[D(e.rules),e.rulesWordBudget?` / ${e.rulesWordBudget}`:``,` words`]})]}),(0,x.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,x.jsx)(p,{body:e.rules})})]}):null,e.banned?.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Banned APIs`}),(0,x.jsx)(`ul`,{className:`kit-links`,"aria-label":`Banned APIs`,children:e.banned.map(e=>(0,x.jsx)(`li`,{children:(0,x.jsx)(`span`,{className:`kit-link-off`,children:e})},e))})]}):null]})}var N=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,P=f;function F(e,t,n){let r=v(t).includes(n),i=e.setOf(t).has(n);return r===i?{now:i,note:i?`on`:`off`,staged:!1}:{now:i,note:i?`staged on`:`staged off`,staged:!0}}function I({kit:e,installs:t,stage:n,listed:r,max:i}){let o=e.credits||[],s=e.skills||[],c=e.agents||[],l=t.map(t=>({row:t,...F(n,t,e.name)})),u=l.filter(t=>v(t.row).includes(e.name)).length,d=l.filter(e=>e.staged).length,f=A(u,t.length),p=`on in ${u} of ${N(t.length,`install`)}${d?` · ${d} staged`:``}`;return(0,x.jsxs)(`article`,{className:`kit-card${d?` staged`:``}`,"aria-labelledby":`kit-${e.name}`,children:[(0,x.jsxs)(`header`,{className:`kit-card-head`,children:[(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`h2`,{className:`kit-card-title`,id:`kit-${e.name}`,children:(0,x.jsx)(`a`,{className:`kit-name`,href:`#/kits/${E(e.name)}`,children:e.name})}),e.description?(0,x.jsx)(`p`,{className:`kit-desc`,children:e.description}):null]}),O(o.map(e=>e.license)).map(e=>(0,x.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,x.jsxs)(`div`,{className:`kit-counts`,children:[(0,x.jsx)(`span`,{children:`Skills`}),(0,x.jsx)(a,{value:s.length,max:i,label:`Skills`}),(0,x.jsx)(`span`,{className:`mono`,children:s.length}),(0,x.jsx)(`span`,{children:`Agents`}),(0,x.jsx)(a,{value:c.length,max:i,label:`Agents`}),(0,x.jsx)(`span`,{className:`mono`,children:c.length})]}),s.length?(0,x.jsx)(j,{type:`skill`,names:s,listed:r?.skills,offNote:f}):null,c.length?(0,x.jsx)(j,{type:`agent`,names:c,listed:r?.agents,offNote:f}):null,(0,x.jsxs)(`footer`,{className:`kit-card-foot`,children:[o.length?(0,x.jsxs)(`span`,{className:`kit-credit`,children:[`Adapted from`,` `,o.map((e,t)=>(0,x.jsxs)(_.Fragment,{children:[t?`, `:null,(0,x.jsx)(`a`,{href:`https://github.com/${e.repo}`,target:`_blank`,rel:`noreferrer`,children:e.repo}),e.author?` · ${e.author}`:null]},e.key||e.repo))]}):(0,x.jsx)(`span`,{}),t.length?(0,x.jsxs)(`span`,{className:`kit-where`,children:[(0,x.jsx)(`span`,{className:`kit-dots`,role:`img`,"aria-label":l.map(e=>`${P(e.row)}: ${e.note}`).join(`, `),children:l.map(e=>(0,x.jsx)(`span`,{className:`kit-dot${e.now?` on`:``}${e.staged?` staged`:``}`,title:`${P(e.row)}: ${e.note}`},e.row.id))}),(0,x.jsx)(`span`,{className:`mono dim`,children:p})]}):null]})]})}function L({kits:e,installs:t,stage:n}){let r=[{key:`install`,label:`Install`,render:e=>(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`b`,{children:P(e)}),(0,x.jsx)(`span`,{className:`mono dim`,children:e.path}),y(e)?(0,x.jsx)(`span`,{className:`kit-lock-note`,children:e.reason||e.error}):null,Object.entries(e.keptKitFiles||{}).map(([e,t])=>(0,x.jsxs)(`span`,{className:`mono dim`,children:[`kept from inactive kit `,e,`: `,t.join(`, `),` — delete by hand`]},e))]})},...e.map(e=>({key:`kit:${e.name}`,label:e.name,render:t=>{let r=F(n,t,e.name);return(0,x.jsxs)(`span`,{className:`kit-cell`,children:[(0,x.jsx)(g,{on:r.now,disabled:y(t)||n.running(t),label:`${e.name} for ${P(t)}`,onToggle:()=>n.toggle(t,e.name)}),(0,x.jsx)(`span`,{className:`kit-note${r.staged?` staged`:``}`,children:r.note})]})}})),{key:`change`,label:`Change`,render:e=>{let{on:t,off:r}=n.change(e),i=[...t.map(e=>`+ ${e}`),...r.map(e=>`− ${e}`)];return(0,x.jsx)(`span`,{className:`tag${i.length?` acc`:``}`,children:i.join(`, `)||`none`})}}];return(0,x.jsxs)(`section`,{className:`panel flush kit-matrix`,"aria-labelledby":`kit-mx-h`,children:[(0,x.jsxs)(`div`,{className:`kit-matrix-head`,children:[(0,x.jsx)(`h2`,{id:`kit-mx-h`,children:`On which install`}),(0,x.jsx)(`span`,{className:`dim`,children:`Each row is one install.`})]}),t.length?(0,x.jsx)(h,{caption:`Kits per install`,captionHidden:!0,columns:r,rows:t,rowKey:e=>e.id}):(0,x.jsx)(`p`,{className:`panel-note`,children:`No install yet.`})]})}function R({installs:e,stage:t}){let n=e=>{let{on:n,off:r}=t.change(e);return n.length+r.length},r=e.filter(e=>n(e)>0),i=e.find(e=>t.running(e))||r.find(e=>!t.failed(e))||r[0]||null,a=r.reduce((e,t)=>e+n(t),0),o=!!i&&t.running(i),s=r.filter(e=>e!==i).length;return(0,x.jsxs)(`div`,{className:`kit-bar${i?` staged`:``}`,role:`region`,"aria-label":`Staged changes`,children:[(0,x.jsx)(`b`,{children:a?`${N(a,`change`)} on ${N(r.length,`install`)}`:`No staged changes`}),i?(0,x.jsxs)(`span`,{className:`kit-hint staged`,role:`status`,children:[P(i),`: `,S(i,t),s?` — ${s} more staged, applied one at a time`:``]}):null,(0,x.jsxs)(`span`,{className:`kit-bar-acts`,children:[(0,x.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":i?`Discard staged kits for ${P(i)}`:`Discard staged kits`,disabled:!i||o,onClick:()=>t.discard(i),children:`Discard`}),(0,x.jsx)(`button`,{type:`button`,className:`btn sm`,"aria-label":i?`Apply and rebuild kits for ${P(i)}`:`Apply and rebuild kits`,disabled:!i||y(i)||!n(i)||o||t.busy,title:t.busy&&!o?`A job is running`:void 0,onClick:()=>t.apply(i),children:`Apply and rebuild`})]})]})}function z({item:e,onAction:t,dataRev:n}){let{data:a,error:c}=o(()=>r.kits(),[n]),l=b(a,t),{data:d}=o(()=>Promise.all([r.catalog(`skills`),r.catalog(`agents`)]).then(([e,t])=>({skills:new Set((e.items||[]).map(e=>e.name)),agents:new Set((t.items||[]).map(e=>e.name))})).catch(()=>null),[n]),f=a?.kits||[],p=a?.installs||[],h=c||a?.error;if(e){let t=f.find(t=>t.name===e);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(s,{title:`Kits`,crumbs:[{label:`Kits`,href:`#/kits`},{label:e}]}),(0,x.jsx)(i,{error:h,style:{margin:`0 0 var(--sp-3)`}}),a?t?(0,x.jsx)(`article`,{className:`panel kit-page`,"aria-label":`Entry`,children:(0,x.jsx)(M,{kit:t,installs:p,stage:l,listed:d})}):(0,x.jsxs)(m,{title:`No such kit`,action:(0,x.jsx)(`a`,{href:`#/kits`,children:`Back to all kits`}),children:[`No kit is named “`,e,`”.`]}):h?null:(0,x.jsx)(u,{})]})}let g=Math.max(1,...f.flatMap(e=>[(e.skills||[]).length,(e.agents||[]).length]));return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(s,{eyebrow:a?`${N(f.length,`kit`)} · ${N(p.length,`install`)}`:null,title:`Kits`,sub:`A kit adds a stack's skills, agents and rules to an install. Turn one on per install, then apply once.`}),(0,x.jsx)(i,{error:h,style:{margin:`0 0 var(--sp-3)`}}),a?f.length===0?h?null:(0,x.jsx)(m,{title:`No kits`,children:`This Geneseed ships no kit.`}):(0,x.jsxs)(`div`,{className:`kit-page-body`,children:[(0,x.jsx)(`div`,{className:`kit-gallery`,children:f.map(e=>(0,x.jsx)(I,{kit:e,installs:p,stage:l,listed:d,max:g},e.name))}),(0,x.jsx)(L,{kits:f,installs:p,stage:l}),p.length?(0,x.jsx)(R,{installs:p,stage:l}):null]}):h?null:(0,x.jsx)(u,{})]})}export{z as default};
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{$ as i,R as a,St as o,V as s,X as c,Z as l,et as u,it as d,pt as f}from"./index-Ce6qF2nG.js";import{t as p}from"./EmptyState-CY5Pm2xy.js";import{t as m}from"./Markdown-CxkA7940.js";import{t as h}from"./DataTable-b9zTShqJ.js";import{r as g}from"./controls-D4wmg_pl.js";var _=e(t(),1),v=e=>e.kits||[],y=e=>!e.editable||e.state===`unreadable`;function b(e,t){let n=d(),r=l(),i=e=>{let t=r.get(`kits`,e.id);return t&&t.base===c(v(e))?t:null},{prune:a}=r;(0,_.useEffect)(()=>{if(!e?.installs)return;let t=new Map(e.installs.map(e=>[e.id,c(v(e))]));a(`kits`,(e,n)=>t.has(e)&&t.get(e)!==n.base)},[e,a]);let o=e=>i(e)?.value??new Set(v(e)),s=(e,t)=>{let n=new Set(o(e));n.delete(t)||n.add(t),r.put(`kits`,e.id,n,c(v(e)))},u=e=>{let t=o(e),n=new Set(v(e));return{on:[...t].filter(e=>!n.has(e)),off:[...n].filter(e=>!t.has(e))}},p=e=>r.running(`kits`,e.id)||!!i(e)?.applied;return{setOf:o,toggle:s,change:u,apply:async e=>{let i=[...o(e)],a=`Rebuild ${f(e)} with kits: ${i.join(`, `)||`none`}? Members of kits turned off are removed; files you edited are kept.`;await n(a,{confirmLabel:`Rebuild`})&&await t(`install`,{host:e.host,path:e.path,kits:i})&&r.startApply(`kits`,e.id)},running:p,failed:e=>!!i(e)?.failed,discard:e=>{p(e)||r.drop(`kits`,e.id)},busy:r.busy}}var x=n();function S(e,t){let{on:n,off:r}=t.change(e);if(t.running(e))return`Rebuilding…`;let i=[...n.map(e=>`turn on ${e}`),...r.map(e=>`turn off ${e}`)].join(` · `);return[t.failed(e)?`Last rebuild failed — see console`:``,i].filter(Boolean).join(` · `)||`No staged changes`}function C({row:e,stage:t}){let{on:n,off:r}=t.change(e),i=n.length+r.length>0,a=t.running(e);return(0,x.jsxs)(`div`,{className:`kit-foot`,children:[(0,x.jsx)(`span`,{className:`kit-hint${i?` staged`:``}`,role:`status`,children:S(e,t)}),(0,x.jsx)(`button`,{type:`button`,className:`btn soft sm`,"aria-label":`Apply kits for ${f(e)}`,disabled:y(e)||!i||a||t.busy,title:t.busy&&!a?`A job is running`:void 0,onClick:()=>t.apply(e),children:`Apply`})]})}var w={active:[`Active`,`ok`],disabled:[`Disabled`,`warn`]},T=({row:e})=>{let[t,n]=w[e.state]||[e.state||`Unknown`,``];return(0,x.jsx)(`span`,{className:`tag ${n}`,children:t})},E=encodeURIComponent,D=e=>(e||``).split(/\s+/).filter(Boolean).length,O=e=>[...new Set(e.filter(Boolean))],k=e=>(e||``).slice(0,7),A=(e,t)=>e?`On in ${e} of ${N(t,`install`)}`:`Installed when this kit is on`,j=({type:e,names:t,listed:n,offNote:r=A(0)})=>t.length?(0,x.jsx)(`ul`,{className:`kit-links`,children:t.map(t=>(0,x.jsx)(`li`,{children:n?.has(t)?(0,x.jsx)(`a`,{href:`#/item/${e}/${E(t)}`,children:t}):(0,x.jsx)(`span`,{className:`kit-link-off`,title:r,children:t})},t))}):(0,x.jsx)(`p`,{className:`panel-note`,children:`None.`});function M({kit:e,installs:t,stage:n,listed:r}){let i=e.credits||[],a=A(t.filter(t=>v(t).includes(e.name)).length,t.length);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`div`,{className:`reader-tags`,children:[(0,x.jsx)(`span`,{className:`tag acc`,children:`Kit`}),O(i.map(e=>e.license)).map(e=>(0,x.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,x.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,x.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,x.jsxs)(`p`,{className:`mono dim reader-src`,children:[`kits/`,e.name,`/`]}),(0,x.jsx)(`hr`,{className:`hr`}),(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Installs`}),t.length?(0,x.jsx)(`ul`,{className:`kit-list kit-box`,"aria-label":`Installs for ${e.name}`,children:t.map(t=>{let r=y(t),i=f(t);return(0,x.jsxs)(`li`,{className:`kit-install`,children:[(0,x.jsxs)(`div`,{className:`kit-row`,children:[(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`b`,{children:i}),(0,x.jsx)(`span`,{className:`mono dim`,children:t.path})]}),(0,x.jsx)(T,{row:t}),(0,x.jsx)(g,{on:n.setOf(t).has(e.name),disabled:r||n.running(t),label:`${e.name} for ${i}`,onToggle:()=>n.toggle(t,e.name)})]}),r&&(0,x.jsx)(`p`,{className:`kit-lock`,children:t.reason||t.error}),(0,x.jsx)(C,{row:t,stage:n})]},t.id)})}):(0,x.jsx)(`p`,{className:`panel-note`,children:`No install yet.`}),i.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Upstream`}),(0,x.jsx)(`dl`,{className:`loop-facts`,children:i.map(e=>(0,x.jsxs)(_.Fragment,{children:[(0,x.jsx)(`dt`,{children:e.author||e.repo}),(0,x.jsxs)(`dd`,{children:[(0,x.jsx)(`span`,{className:`mono`,children:e.repo}),e.commit?(0,x.jsxs)(`span`,{className:`mono dim`,children:[`@ `,k(e.commit)]}):null,e.compareUrl?(0,x.jsx)(`a`,{href:e.compareUrl,target:`_blank`,rel:`noreferrer`,"aria-label":`Compare ${e.repo} @ ${k(e.commit)} with HEAD`,children:`compare`}):null,e.license?(0,x.jsx)(`span`,{className:`tag`,children:e.license}):null]})]},e.key||e.repo))})]}):null,(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Skills`}),(0,x.jsx)(j,{type:`skill`,names:e.skills||[],listed:r?.skills,offNote:a}),(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Agents`}),(0,x.jsx)(j,{type:`agent`,names:e.agents||[],listed:r?.agents,offNote:a}),e.rules?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsxs)(`h3`,{className:`loop-h2`,children:[`Rules`,` `,(0,x.jsxs)(`span`,{className:`mono dim`,children:[D(e.rules),e.rulesWordBudget?` / ${e.rulesWordBudget}`:``,` words`]})]}),(0,x.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,x.jsx)(m,{body:e.rules})})]}):null,e.banned?.length?(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(`h3`,{className:`loop-h2`,children:`Banned APIs`}),(0,x.jsx)(`ul`,{className:`kit-links`,"aria-label":`Banned APIs`,children:e.banned.map(e=>(0,x.jsx)(`li`,{children:(0,x.jsx)(`span`,{className:`kit-link-off`,children:e})},e))})]}):null]})}var N=(e,t,n=`${t}s`)=>`${e} ${e===1?t:n}`,P=f;function F(e,t,n){let r=v(t).includes(n),i=e.setOf(t).has(n);return r===i?{now:i,note:i?`on`:`off`,staged:!1}:{now:i,note:i?`staged on`:`staged off`,staged:!0}}function I({kit:e,installs:t,stage:n,listed:r,max:i}){let o=e.credits||[],s=e.skills||[],c=e.agents||[],l=t.map(t=>({row:t,...F(n,t,e.name)})),u=l.filter(t=>v(t.row).includes(e.name)).length,d=l.filter(e=>e.staged).length,f=A(u,t.length),p=`on in ${u} of ${N(t.length,`install`)}${d?` · ${d} staged`:``}`;return(0,x.jsxs)(`article`,{className:`kit-card${d?` staged`:``}`,"aria-labelledby":`kit-${e.name}`,children:[(0,x.jsxs)(`header`,{className:`kit-card-head`,children:[(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`h2`,{className:`kit-card-title`,id:`kit-${e.name}`,children:(0,x.jsx)(`a`,{className:`kit-name`,href:`#/kits/${E(e.name)}`,children:e.name})}),e.description?(0,x.jsx)(`p`,{className:`kit-desc`,children:e.description}):null]}),O(o.map(e=>e.license)).map(e=>(0,x.jsx)(`span`,{className:`tag`,children:e},e))]}),(0,x.jsxs)(`div`,{className:`kit-counts`,children:[(0,x.jsx)(`span`,{children:`Skills`}),(0,x.jsx)(a,{value:s.length,max:i,label:`Skills`}),(0,x.jsx)(`span`,{className:`mono`,children:s.length}),(0,x.jsx)(`span`,{children:`Agents`}),(0,x.jsx)(a,{value:c.length,max:i,label:`Agents`}),(0,x.jsx)(`span`,{className:`mono`,children:c.length})]}),s.length?(0,x.jsx)(j,{type:`skill`,names:s,listed:r?.skills,offNote:f}):null,c.length?(0,x.jsx)(j,{type:`agent`,names:c,listed:r?.agents,offNote:f}):null,(0,x.jsxs)(`footer`,{className:`kit-card-foot`,children:[o.length?(0,x.jsxs)(`span`,{className:`kit-credit`,children:[`Adapted from`,` `,o.map((e,t)=>(0,x.jsxs)(_.Fragment,{children:[t?`, `:null,(0,x.jsx)(`a`,{href:`https://github.com/${e.repo}`,target:`_blank`,rel:`noreferrer`,children:e.repo}),e.author?` · ${e.author}`:null]},e.key||e.repo))]}):(0,x.jsx)(`span`,{}),t.length?(0,x.jsxs)(`span`,{className:`kit-where`,children:[(0,x.jsx)(`span`,{className:`kit-dots`,role:`img`,"aria-label":l.map(e=>`${P(e.row)}: ${e.note}`).join(`, `),children:l.map(e=>(0,x.jsx)(`span`,{className:`kit-dot${e.now?` on`:``}${e.staged?` staged`:``}`,title:`${P(e.row)}: ${e.note}`},e.row.id))}),(0,x.jsx)(`span`,{className:`mono dim`,children:p})]}):null]})]})}function L({kits:e,installs:t,stage:n}){let r=[{key:`install`,label:`Install`,render:e=>(0,x.jsxs)(`div`,{className:`kit-main`,children:[(0,x.jsx)(`b`,{children:P(e)}),(0,x.jsx)(`span`,{className:`mono dim`,children:e.path}),y(e)?(0,x.jsx)(`span`,{className:`kit-lock-note`,children:e.reason||e.error}):null,Object.entries(e.keptKitFiles||{}).map(([e,t])=>(0,x.jsxs)(`span`,{className:`mono dim`,children:[`kept from inactive kit `,e,`: `,t.join(`, `),` — delete by hand`]},e))]})},...e.map(e=>({key:`kit:${e.name}`,label:e.name,render:t=>{let r=F(n,t,e.name);return(0,x.jsxs)(`span`,{className:`kit-cell`,children:[(0,x.jsx)(g,{on:r.now,disabled:y(t)||n.running(t),label:`${e.name} for ${P(t)}`,onToggle:()=>n.toggle(t,e.name)}),(0,x.jsx)(`span`,{className:`kit-note${r.staged?` staged`:``}`,children:r.note})]})}})),{key:`change`,label:`Change`,render:e=>{let{on:t,off:r}=n.change(e),i=[...t.map(e=>`+ ${e}`),...r.map(e=>`− ${e}`)];return(0,x.jsx)(`span`,{className:`tag${i.length?` acc`:``}`,children:i.join(`, `)||`none`})}}];return(0,x.jsxs)(`section`,{className:`panel flush kit-matrix`,"aria-labelledby":`kit-mx-h`,children:[(0,x.jsxs)(`div`,{className:`kit-matrix-head`,children:[(0,x.jsx)(`h2`,{id:`kit-mx-h`,children:`On which install`}),(0,x.jsx)(`span`,{className:`dim`,children:`Each row is one install.`})]}),t.length?(0,x.jsx)(h,{caption:`Kits per install`,captionHidden:!0,columns:r,rows:t,rowKey:e=>e.id}):(0,x.jsx)(`p`,{className:`panel-note`,children:`No install yet.`})]})}function R({installs:e,stage:t}){let n=e=>{let{on:n,off:r}=t.change(e);return n.length+r.length},r=e.filter(e=>n(e)>0),i=e.find(e=>t.running(e))||r.find(e=>!t.failed(e))||r[0]||null,a=r.reduce((e,t)=>e+n(t),0),o=!!i&&t.running(i),s=r.filter(e=>e!==i).length;return(0,x.jsxs)(`div`,{className:`kit-bar${i?` staged`:``}`,role:`region`,"aria-label":`Staged changes`,children:[(0,x.jsx)(`b`,{children:a?`${N(a,`change`)} on ${N(r.length,`install`)}`:`No staged changes`}),i?(0,x.jsxs)(`span`,{className:`kit-hint staged`,role:`status`,children:[P(i),`: `,S(i,t),s?` — ${s} more staged, applied one at a time`:``]}):null,(0,x.jsxs)(`span`,{className:`kit-bar-acts`,children:[(0,x.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-label":i?`Discard staged kits for ${P(i)}`:`Discard staged kits`,disabled:!i||o,onClick:()=>t.discard(i),children:`Discard`}),(0,x.jsx)(`button`,{type:`button`,className:`btn sm`,"aria-label":i?`Apply and rebuild kits for ${P(i)}`:`Apply and rebuild kits`,disabled:!i||y(i)||!n(i)||o||t.busy,title:t.busy&&!o?`A job is running`:void 0,onClick:()=>t.apply(i),children:`Apply and rebuild`})]})]})}function z({item:e,onAction:t,dataRev:n}){let{data:a,error:c}=o(()=>r.kits(),[n]),l=b(a,t),{data:d}=o(()=>Promise.all([r.catalog(`skills`),r.catalog(`agents`)]).then(([e,t])=>({skills:new Set((e.items||[]).map(e=>e.name)),agents:new Set((t.items||[]).map(e=>e.name))})).catch(()=>null),[n]),f=a?.kits||[],m=a?.installs||[],h=c||a?.error;if(e){let t=f.find(t=>t.name===e);return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(s,{title:`Kits`,crumbs:[{label:`Kits`,href:`#/kits`},{label:e}]}),(0,x.jsx)(i,{error:h,style:{margin:`0 0 var(--sp-3)`}}),a?t?(0,x.jsx)(`article`,{className:`panel kit-page`,"aria-label":`Entry`,children:(0,x.jsx)(M,{kit:t,installs:m,stage:l,listed:d})}):(0,x.jsxs)(p,{title:`No such kit`,action:(0,x.jsx)(`a`,{href:`#/kits`,children:`Back to all kits`}),children:[`No kit is named “`,e,`”.`]}):h?null:(0,x.jsx)(u,{})]})}let g=Math.max(1,...f.flatMap(e=>[(e.skills||[]).length,(e.agents||[]).length]));return(0,x.jsxs)(x.Fragment,{children:[(0,x.jsx)(s,{eyebrow:a?`${N(f.length,`kit`)} · ${N(m.length,`install`)}`:null,title:`Kits`,sub:`A kit adds a stack's skills, agents and rules to an install. Turn one on per install, then apply once.`}),(0,x.jsx)(i,{error:h,style:{margin:`0 0 var(--sp-3)`}}),a?f.length===0?h?null:(0,x.jsx)(p,{title:`No kits`,children:`This Geneseed ships no kit.`}):(0,x.jsxs)(`div`,{className:`kit-page-body`,children:[(0,x.jsx)(`div`,{className:`kit-gallery`,children:f.map(e=>(0,x.jsx)(I,{kit:e,installs:m,stage:l,listed:d,max:g},e.name))}),(0,x.jsx)(L,{kits:f,installs:m,stage:l}),m.length?(0,x.jsx)(R,{installs:m,stage:l}):null]}):h?null:(0,x.jsx)(u,{})]})}export{z as default};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{$ as i,Et as a,J as o,R as s,St as c,U as l,V as u,X as d,Z as f,_ as p,c as m,d as h,et as g,f as _,g as v,h as y,it as b,l as ee,lt as x,m as S,mt as te,nt as C,p as ne,pt as w,q as T,s as re,tt as E,u as D,ut as O,v as k,y as ie}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{$ as i,Et as a,J as o,R as s,St as c,U as l,V as u,X as d,Z as f,_ as p,c as m,d as h,et as g,f as _,g as v,h as y,it as b,l as ee,lt as x,m as S,mt as te,nt as C,p as ne,pt as w,q as T,s as re,tt as E,u as D,ut as O,v as k,y as ie}from"./index-Ce6qF2nG.js";import{t as ae}from"./EmptyState-CY5Pm2xy.js";import{t as oe}from"./FilterInput-qGKNSlxv.js";import{t as se}from"./Markdown-CxkA7940.js";var A=e(t(),1);function ce({items:e,packs:t,install:n,canApply:r,onAction:i,gateArmed:a}){let o=b(),s=e.filter(e=>e.tier===`doctrine`&&e.active!==!1).map(e=>e.name),c=s.join(`,`),l=f(),u=n?`${n.host}:${n.scope}:${n.path}`:``,p=d(s),{prune:m}=l,h=e.length>0;(0,A.useEffect)(()=>{h&&m(`rules`,(e,t)=>e===u&&t.base!==p)},[h,u,p,m]);let g=l.get(`rules`,u),_=g&&g.base===p?g.value:s,v=e=>l.put(`rules`,u,e(_),p),y=e=>_.includes(e),ee=e=>v(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e]),x=e=>e.rules.some(e=>y(e.addr)),S=e=>{let t=e.rules.map(e=>e.addr),n=e.rules.every(e=>y(e.addr));v(e=>n?e.filter(e=>!t.includes(e)):[...new Set([...e,...t])])},te=e=>{let t=e.rules.filter(e=>y(e.addr)).length;return t?e.active?`${t} of ${e.rules.length} active`:`staged on · ${t} of ${e.rules.length}`:e.active?`staged off`:`not built in`},C=t.flatMap(e=>e.rules.map(e=>e.addr)),T=C.filter(y),E=T.join(`,`)!==c,O=`process.5`,k=s.includes(O)&&!_.includes(O);return{deployedRules:s,isOn:y,toggleRule:ee,packOn:x,togglePack:S,packState:te,allRules:C,pickedRules:T,dirty:E,losingConsent:k,applyPacks:async()=>{if(!r||!E)return;let e=t.filter(e=>e.rules.some(e=>y(e.addr))).map(e=>e.pack),c=t.filter(t=>e.includes(t.pack)).flatMap(e=>e.rules.filter(e=>!y(e.addr)).map(e=>e.addr)),d=k?`
|
|
2
2
|
|
|
3
3
|
process 5 carries commit/push consent. Dropping it also removes the git-gate hook, so commits and pushes stop being confirmed at the tool boundary (Bob still logs its warning). `+(a?`(Real data loss stays gated: that is Rule IV’s, not the pack’s.)`:`(Rule IV’s deletion gate is off on this install, so real data loss is not asked about either.)`):``,f={},p=[],m=[];for(let[e,{key:r,label:i}]of Object.entries(D)){if(!e.includes(`.`))continue;let a=t.flatMap(e=>e.rules).find(t=>t.addr===e)?.name||e,o=s.includes(e),c=n?.[r]!==!1;o&&!y(e)&&c&&(f[r]=!1,m.push(`Excluding ${a} also switches the ${i.toLowerCase()} off: its text goes, and its hook stops asking.`)),!o&&y(e)&&!c&&(p.push({key:r,label:i}),m.push(`Including ${a} brings its text back; the ${i.toLowerCase()} stays off unless you tick the box.`))}for(let e of ne){if(e===O||!s.includes(e)||y(e))continue;let n=t.flatMap(e=>e.rules).find(t=>t.addr===e)?.name||e;m.push(`Excluding ${n} also drops its hook: it stops asking on every host.`)}for(let e of re){if(!s.includes(e)||y(e))continue;let n=t.flatMap(e=>e.rules).find(t=>t.addr===e)?.name||e;m.push(`Excluding ${n} drops its text; its hook still asks (it has no switch yet).`)}let h=T.length?`${T.length} of ${C.length} doctrine rules`:`no doctrine rules`,g=m.length?`\n\n${m.join(`
|
|
4
|
-
`)}`:``,_=p.length?{label:`Also turn the ${p.map(e=>e.label.toLowerCase()).join(` and `)} back on`,checked:!0}:void 0,v=await o(`Rebuild ${w(n)} with ${h}? It rebuilds in place, non-destructive.${d}${g}`,{title:`Rebuild with these rules?`,confirmLabel:`Rebuild`,check:_});if(!v)return;let b={...f};if(v?.checked!==!1)for(let e of p)b[e.key]=!0;await i(`install`,{...n,doctrines:e,excludeRules:c,...b})&&l.startApply(`rules`,u)},revert:()=>l.drop(`rules`,u)}}var j=n();function M({addr:e,isOpen:t,onToggle:n,className:a,style:o,head:s,label:l,rev:u,toggleCol:d=null,renderBody:f,srcLine:p,after:m=null}){let h=(0,A.useId)(),{data:g,error:_,reload:v}=c(()=>t?r.item(`law`,e):Promise.resolve(null),[t,e,u],`law-item`),y=t&&(0,j.jsxs)(`div`,{className:`law-expand`,id:h,children:[_?(0,j.jsx)(i,{error:_,onRetry:v}):g?f(g):(0,j.jsx)(`p`,{className:`dim`,children:`Loading…`}),(0,j.jsx)(`div`,{className:`law-srcline`,children:p}),m]}),b={type:`button`,onClick:n,"aria-expanded":t,"aria-controls":h,"aria-label":l};return d?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:a,style:o,"data-addr":e,children:[(0,j.jsx)(`button`,{className:`law-disclosure`,...b,children:s}),(0,j.jsx)(`span`,{className:`toggle-col`,children:d})]}),y]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{className:a,style:o,"data-addr":e,...b,children:s}),y]})}function le({law:e,isOpen:t,onToggle:n,rev:r,toggleCol:i=null,after:a=null}){let o=e.enf===`Hook gate`?` hook`:e.enf===`Gate off`?` gate-off`:``,s=(0,j.jsx)(`span`,{className:`law-enf${o}`,"data-col":`enf`,"aria-hidden":i?`true`:void 0,children:e.enf},`enf`),c=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`span`,{className:`law-no`,"data-col":`no`,children:[(0,j.jsx)(`span`,{className:`x`,"aria-hidden":`true`,children:`›`}),e.no]}),(0,j.jsxs)(`span`,{className:`law-name`,children:[(0,j.jsx)(`span`,{children:e.name}),e.ess?(0,j.jsx)(`span`,{className:`law-princ`,children:e.ess}):null,e.asks?(0,j.jsx)(`span`,{className:`law-asks mono`,children:e.asks}):null,e.note?(0,j.jsx)(`span`,{className:`law-note`,children:e.note}):null,e.no?(0,j.jsxs)(`span`,{className:`law-fold law-fold-no`,"aria-hidden":`true`,children:[(0,j.jsx)(`span`,{className:`x`,children:`›`}),e.no]}):null,e.latin?(0,j.jsx)(`span`,{className:`law-fold law-fold-latin`,"aria-hidden":`true`,children:e.latin}):null,(0,j.jsxs)(`span`,{className:`law-fold law-fold-chips`,"aria-hidden":`true`,children:[(0,j.jsx)(`span`,{className:`law-chip-status ${e.statusTone}`,children:e.status}),(0,j.jsx)(`span`,{className:`law-chip-enf${o}`,children:e.enf})]})]}),(0,j.jsx)(`span`,{className:`law-latin`,"data-col":`latin`,children:e.latin}),(0,j.jsx)(`span`,{className:`law-status ${e.statusTone}`,"data-col":`status`,children:e.status}),i?null:s]});return(0,j.jsx)(M,{addr:e.addr,isOpen:t,onToggle:n,className:`law-row${i?` has-toggle`:``}${t?` on`:``}${e.off?` law-off`:``}`,style:{"--cc":e.c},head:c,label:`${e.no?e.no+` `:``}${e.name}, ${e.status}, ${e.enf}`,rev:r,toggleCol:i?[i[0],s,i[1]]:null,renderBody:t=>(0,j.jsx)(ae,{body:t.body||e.ess,links:t.links}),srcLine:`$ geneseed law ${e.addr} · ${e.src}`,after:a})}var N=[`invariants`,`doctrines`];function ue({tiers:e,current:t,onPick:n}){return(0,j.jsx)(`div`,{className:`tier-strip`,children:e.map((e,r)=>{let i=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`span`,{className:`tier-head`,children:[(0,j.jsxs)(`span`,{className:`tier-k mono`,children:[`RANK `,r+1]}),e.pill?(0,j.jsx)(`span`,{className:`badge tier-pill ${e.pill[1]}`,children:e.pill[0]}):null]}),(0,j.jsxs)(`span`,{className:`tier-top`,children:[(0,j.jsx)(`span`,{className:`tier-name`,children:e.name}),(0,j.jsx)(`span`,{className:`tier-n mono`,children:e.n})]}),(0,j.jsx)(`span`,{className:`tier-bar`,"aria-hidden":`true`,children:(0,j.jsx)(`span`,{style:{width:`${Math.round(e.fill*100)}%`}})}),(0,j.jsx)(`span`,{className:`tier-sub`,children:e.sub}),(0,j.jsx)(`span`,{className:`tier-sub tier-rule`,children:e.rule})]}),a=`tier${t===e.key?` on`:``}`;return e.href?(0,j.jsx)(`a`,{className:`tier`,href:e.href,children:i},e.key):n&&N.includes(e.key)?(0,j.jsx)(`button`,{type:`button`,className:a,"aria-pressed":t===e.key,onClick:()=>n(t===e.key?`all`:e.key),children:i},e.key):(0,j.jsx)(`div`,{className:a,children:i},e.key)})})}function de({gates:e,byAddr:t,onJump:n,disarmed:r=()=>!1,install:i=null,slot:a=0}){let o=i?w(i):``,c=Object.entries(e?.asks||{}).map(([e,t])=>[e,t,r(y(e))]).sort((e,t)=>e[2]-t[2]||t[1]-e[1]),l=Math.max(1,...c.map(([,e])=>e));return(0,j.jsxs)(`section`,{className:`panel`,"aria-labelledby":`gate-asks`,children:[(0,j.jsxs)(`div`,{className:`panel-head`,children:[(0,j.jsx)(`h2`,{id:`gate-asks`,children:`Gate asks`}),(0,j.jsxs)(`span`,{className:`mono dim`,children:[e?.total??0,` in ledger`]})]}),i&&c.some(e=>e[2])&&(0,j.jsx)(`span`,{className:`lib-legend mono`,children:(0,j.jsxs)(`span`,{children:[a>=0&&(0,j.jsx)(`i`,{className:`lr-dot`,style:x(a),"aria-hidden":`true`}),o]})}),c.length?(0,j.jsx)(`ul`,{className:`gate-list`,children:c.map(([e,r,c])=>{let u=y(e),d=t[u]?.name||v(u);return(0,j.jsxs)(`li`,{children:[(0,j.jsx)(`button`,{type:`button`,className:`gate-row`,onClick:()=>n(u),children:(0,j.jsxs)(`span`,{className:`gate-top`,children:[(0,j.jsx)(`span`,{className:`gate-name${c?` dim`:``}`,children:d}),c&&(0,j.jsxs)(`span`,{className:`mono off`,children:[i&&a>=0&&(0,j.jsx)(`i`,{className:`lr-dot`,style:x(a),"aria-hidden":`true`}),`off`,i&&(0,j.jsxs)(`span`,{className:`sr-only`,children:[` · `,o]})]}),(0,j.jsx)(`span`,{className:`mono gate-n`,children:r})]})}),(0,j.jsx)(s,{value:r,max:l,label:`${d} asks`,tone:c?`accent`:`warn`})]},e)})}):(0,j.jsx)(`p`,{className:`sub`,children:`No gate has asked yet.`}),(0,j.jsx)(`p`,{className:`panel-note`,children:e?.standing_down?.length?`Standing down: ${e.standing_down.join(`, `)}.`:`None standing down.`})]})}function fe({packs:e,sel:t,canApply:n,install:r,gateArmed:i}){let{isOn:a,packOn:o,togglePack:c,dirty:l,losingConsent:u}=t,d=Math.max(1,...e.map(e=>e.rules.length));return(0,j.jsxs)(`section`,{className:`panel`,"aria-labelledby":`doc-packs`,children:[(0,j.jsxs)(`div`,{className:`panel-head`,children:[(0,j.jsx)(`h2`,{id:`doc-packs`,children:`Doctrine packs`}),(0,j.jsxs)(`span`,{className:`mono dim`,children:[e.filter(o).length,`/`,e.length,` on`]})]}),e.length?(0,j.jsx)(`ul`,{className:`pack-list`,children:e.map(e=>{let t=e.rules.filter(e=>a(e.addr)).length;return(0,j.jsxs)(`li`,{className:o(e)?``:`off`,children:[(0,j.jsx)(`span`,{className:`pl-name`,title:e.desc,children:e.title}),(0,j.jsx)(s,{value:t,max:d,label:`${e.title} rules on`}),(0,j.jsx)(`span`,{className:`mono pl-n`,children:t}),n?(0,j.jsx)(`button`,{type:`button`,className:`sw-toggle${o(e)?` on`:``}${t&&t<e.rules.length?` mixed`:``}`,role:`checkbox`,"aria-checked":e.rules.length&&t===e.rules.length?`true`:t?`mixed`:`false`,"aria-label":`${e.title} pack`,onClick:()=>c(e)}):null]},e.pack)})}):(0,j.jsx)(`p`,{className:`sub`,children:`This install predates the three-tier constitution.`}),n&&e.length>0&&(0,j.jsxs)(j.Fragment,{children:[u&&(0,j.jsxs)(`p`,{className:`pack-warn`,role:`status`,"aria-live":`polite`,children:[`Dropping `,(0,j.jsx)(`b`,{children:`process 5`}),` also removes the commit/push consent gate:`,` `,(0,j.jsx)(`code`,{children:`git commit`}),` and `,(0,j.jsx)(`code`,{children:`git push`}),` stop being confirmed at the tool boundary.`,` `,i?`Real data loss stays gated by Rule IV.`:`Rule IV’s deletion gate is off on this install too.`]}),(0,j.jsx)(`p`,{className:`panel-note`,role:`status`,"aria-live":`polite`,children:l?`Not applied yet. Apply rebuilds ${r.host} · ${r.scope} once, with every change together.`:`Matches the deployed install. Changing a pack rebuilds it.`})]})]})}var pe=`ont:ownership`,me=e=>e===`ownership`?pe:e,he=`process.5`;function ge(e,t){let n=[];for(let r of e){if(r.tier!==`doctrine`)continue;let e=n.find(e=>e.pack===r.pack);e||(e={pack:r.pack,title:r.packTitle||r.pack,desc:r.packDesc||``,active:r.packActive!==!1,rules:[]},n.push(e));let i=p(r.title);e.rules.push({addr:r.name,no:`${r.pack} ${r.name.split(`.`)[1]||``}`,name:i.name,latin:i.latin,ess:r.summary||``,enf:S(r.name,t),c:ie[r.pack]||`var(--text-3)`,src:`doctrines/${r.pack}.md`})}return n}function P(e){let t=o(e.dataRev),[n,r]=T(`laws`,t);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(E,{className:`page-pick`,installs:t,value:n,onChange:r}),(0,j.jsx)(I,{...e,install:n,listed:t!==null,installSlot:O((t||[]).map(e=>e.id)).indexOf(n?.id)},n?.id??`none`)]})}var F=(e,t)=>e?.install?.host===t.host&&e.install.path===t.path;function I({install:e,listed:t,installSlot:n,...a}){let o=e&&F(a.overview,e)?a.overview:null,{data:s,error:l,loading:u}=c(()=>Promise.resolve().then(()=>e&&!o?r.overview(te(e)):null),[!!o,a.dataRev]),d=o||(e&&F(s,e)?s:null),f=e?d:a.overview,p=!(!e||d||u);return(0,j.jsxs)(j.Fragment,{children:[p?(0,j.jsx)(i,{error:`Could not read this install's gates${l?`: ${l}`:`.`}`}):null,(0,j.jsx)(L,{...a,overview:f,pair:te(e),onAction:t&&(!e||d!==null)?a.onAction:void 0,pending:!t||!!(e&&!d&&u),gatesUnread:p,installSlot:n})]})}function L({selected:e,overview:t,setup:n,onAction:o,dataRev:d,pair:f,pending:v,gatesUnread:x,installSlot:te}){let T=b(),{data:E,error:O}=c(()=>r.catalog(`laws`,f),f?[d,f.host,f.path]:[d],`catalog:laws`),{data:ae}=l(d,f),[M,N]=(0,A.useState)(`all`),[P,F]=(0,A.useState)(``),[I,L]=(0,A.useState)(`all`),[_e,ve]=(0,A.useState)(()=>new Set),R=me(e)||null,ye=e=>a(R===e?`#/laws`:`#/item/law/${encodeURIComponent(e)}`),z=t?.install,B=!!(z&&o),[be,xe]=(0,A.useState)(0),Se=(0,A.useRef)(null);(0,A.useEffect)(()=>{if(!R)return;let e=requestAnimationFrame(()=>{let e=document.querySelector(`[data-addr="${CSS.escape(R)}"]`);if(!e)return;let t=Se.current===R;Se.current=null;let n=e.getBoundingClientRect();if(t||n.top<80||n.bottom>window.innerHeight){let t=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;e.scrollIntoView?.({block:`center`,behavior:t?`auto`:`smooth`})}t&&(e.classList.remove(`law-flash`),e.offsetWidth,e.classList.add(`law-flash`))});return()=>cancelAnimationFrame(e)},[R,be,E]);let V=E?.items||[],H=ge(V,t?.install),U=e=>t?.install?.[D[e].key]!==!1,Ce=U(`IV`),W=ce({items:V,packs:H,install:z,canApply:B,onAction:o,gateArmed:Ce}),{deployedRules:G,isOn:K,toggleRule:we,packOn:Te,packState:Ee,allRules:q}=W;if(O)return(0,j.jsx)(i,{error:O});if(!E||v)return(0,j.jsx)(g,{});let J={ontology:E.nouns?.ontology||`Ethos`,law:E.nouns?.law||`Dictate`,laws:E.nouns?.laws||`Dictates`,doctrines:E.nouns?.doctrines||`Doctrines`},De=(e,t)=>{let n=S(e,t);return x&&D[e]&&n===`Hook gate`?`Unknown`:n},Oe=V.filter(e=>e.tier===`ontology`).map(e=>({addr:e.name,no:``,name:e.title,latin:``,ess:``,status:`Always`,statusTone:`ok`,enf:e.name===pe&&(z||x)?De(`ownership`,z):`Instruction`,c:`var(--text-3)`,src:`ontology/universal.md`})),Y=V.filter(e=>(e.tier??`invariant`)===`invariant`).map(e=>{let n=e.klass&&k[e.klass]?e.klass:`craft`,r=p(e.title);return{addr:e.name,no:e.name,name:r.name,latin:r.latin,ess:e.summary||``,retired:r.retired,status:r.retired?`Retired`:`Active`,statusTone:r.retired?``:`ok`,enf:r.retired?`None`:De(e.name,t?.install),cat:n,c:k[n].c,off:r.retired,src:`laws/universal.md`}}),ke=B?[{addr:`ownership`,name:D.ownership.label,latin:``,ess:``,enf:S(`ownership`,z)}]:[],Ae=e=>K(e)?!1:re.has(e)?!0:!D[e]||x?!1:U(e)&&!G.includes(e),je=e=>{let t=K(e.addr),n=G.includes(e.addr),r=t===n?t?`Active`:`Off`:t?`Staged on`:`Staged off`;return{...e,enf:x&&D[e.addr]&&e.enf===`Hook gate`?`Unknown`:e.enf,note:Ae(e.addr)?`Text excluded; the hook still asks.`:``,off:!t,status:r,statusTone:t?`ok`:t===n?``:`warn`}},Me=H.filter(e=>e.active).flatMap(e=>e.rules.filter(e=>!G.includes(e.addr)).map(e=>e.addr)),Ne=async e=>{if(!B)return;let{key:t,label:n}=D[e],r=n.toLowerCase(),i=!U(e),a=w(z),s=W.dirty?` Your staged doctrine changes are not part of this rebuild; they stay staged.`:``;await T((i?`Re-arm the ${r} on ${a}? ${m[e].arm} It rebuilds in place, non-destructive.`:`Switch the ${r} off on ${a}? ${m[e].off} It rebuilds in place, non-destructive.`)+s,{title:i?`Re-arm the ${r}?`:`Switch the ${r} off?`,confirmLabel:i?`Re-arm`:`Switch off`})&&o(`install`,{...z,[t]:i})},Pe=(e,t)=>(0,j.jsx)(`button`,{type:`button`,className:`sw-toggle${U(e)?` on`:``}`,role:`switch`,"aria-checked":U(e),"aria-label":t?`${D[e].label}: hook gate of ${t}`:D[e].label,onClick:()=>Ne(e)}),Fe=(e,t)=>(0,j.jsxs)(`span`,{className:`no-gate`,title:t,children:[e,(0,j.jsxs)(`span`,{className:`sr-only`,children:[`: `,t]})]}),Ie=(e,t)=>[(0,j.jsx)(`span`,{className:`toggle-cell`,children:e},`text`),(0,j.jsx)(`span`,{className:`toggle-cell`,children:t},`gate`)],Le=e=>D[e.addr]?Pe(e.addr,e.name):e.addr===he?Fe(`with text`,`No switch of its own: excluding ${e.name} drops its commit and push ask in the same rebuild (Bob still logs its warning).`):ne.has(e.addr)?Fe(`with text`,`No switch of its own: excluding ${e.name}, or its pack, drops its hook in the same rebuild.`):re.has(e.addr)?Fe(`always on`,`No switch yet: the hook asks even with ${e.name}'s text excluded.`):null,Re=e=>String(e.addr).includes(`.`)&&K(e.addr)!==G.includes(e.addr),ze=(e,t=I)=>t===`all`||(t===`gated`?e.enf===`Hook gate`&&(D[e.addr]||re.has(e.addr)||!String(e.addr).includes(`.`)||G.includes(e.addr)):Re(e)),X=P.trim().toLowerCase(),Z=e=>ze(e)&&(!X||`${e.addr} ${e.name} ${e.latin} ${e.ess}`.toLowerCase().includes(X)),Be=e=>{let t=Ze[e];(String(e).includes(`.`)?M===`invariants`:t&&M===`doctrines`)&&N(`all`),t&&!ze(t)&&L(`all`),t&&!Z(t)&&F(``),Se.current=me(e),xe(e=>e+1),a(`#/item/law/${encodeURIComponent(e)}`)},Ve={};for(let[e,t]of Object.entries(n?.gates?.asks||{}))Ve[y(e)]=t;let He=e=>Ve[e.addr]?{...e,asks:`${Ve[e.addr]} ask${Ve[e.addr]===1?``:`s`}`}:e,Q=Y.filter(e=>!e.retired).length,Ue=G.length,We=e=>{if(x)return[`gates unread`,`warn`];let t=e.filter(e=>D[e.addr]&&!U(e.addr)).length;return t?[`${t} gate${t===1?``:`s`} off`,`warn`]:[`always`,`ok`]},Ge=q.length-Ue,Ke=[Ge>0&&`${Ge} excluded`,!x&&!U(`rigor.5`)&&`1 gate off`].filter(Boolean),qe=Ke.length?[Ke.join(` · `),`warn`]:[`all on`,`ok`],$=ae?.stats,Je={ethos:{name:J.ontology,n:Oe.length,fill:1,sub:`${Oe.length} sections`,pill:We(ke)},invariants:{name:J.laws,n:Y.length,fill:Y.length?Q/Y.length:0,sub:Y.length>Q?`${Q} active · ${Y.length-Q} retired`:`${Q} active`,pill:We(Y)},doctrines:{name:J.doctrines,n:q.length,fill:q.length?Ue/q.length:0,sub:`${H.length} packs`,pill:qe},yours:{name:`Your rules`,n:$?.rules??``,fill:+!!$?.rules,sub:$?`${$.rules} rule${$.rules===1?``:`s`} · ≈${$.tokens.toLocaleString(`en-US`)} tok`:`user-rules.md`,href:`#/personal/rules`,pill:[`yours`,``]}},Ye=e=>{if(e===`—`)return`Nothing outranks them.`;let t=e.replace(`{{LAW}}`,J.law);return`${t[0].toUpperCase()}${t.slice(1)}.`},Xe=h.map(e=>({key:e.key,...Je[e.key],rule:Ye(e.against)})),Ze=Object.fromEntries([...Y,...H.flatMap(e=>e.rules)].map(e=>[e.addr,e])),Qe=[[`all`,`All`,Y.length+q.length],[`invariants`,J.laws,Y.length],[`doctrines`,J.doctrines,q.length]],$e=M===`all`||M===`invariants`,et=M===`all`||M===`doctrines`,tt=[...ke,...$e?Y:[],...et?H.flatMap(e=>e.rules):[]],nt=[[`gated`,`Gated`,x?null:tt.filter(e=>ze(e,`gated`)).length],[`changed`,`Changed`,tt.filter(e=>ze(e,`changed`)).length]],rt=e=>String(e).includes(`.`)?String(e).split(`.`)[0]:null,it=e=>I!==`changed`&&_e.has(e)&&rt(R)!==e,at=e=>{let t=it(e);ve(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r}),!t&&rt(R)===e&&a(`#/laws`)},ot=H.flatMap(e=>e.rules.filter(Re).map(e=>({...e,plus:K(e.addr)}))),st=B&&H.length>0&&W.dirty,ct=()=>{L(`changed`),M===`invariants`&&N(`all`),F(``)},lt=(e,t)=>(0,j.jsxs)(`div`,{className:`band-head`,role:`presentation`,children:[(0,j.jsx)(`h2`,{className:`tier-h`,children:e}),(0,j.jsx)(`span`,{className:`mono dim`,children:t})]}),ut=e=>(0,j.jsxs)(`div`,{className:`law-rowhead`,"aria-hidden":`true`,children:[(0,j.jsx)(`span`,{"data-col":`no`,children:`No.`}),(0,j.jsx)(`span`,{children:`Rule`}),(0,j.jsx)(`span`,{"data-col":`latin`,children:`Latin name`}),(0,j.jsx)(`span`,{"data-col":`status`,children:`Status`}),e&&(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`span`,{className:`rh-cut`,children:`Rule `}),`text`]}),(0,j.jsx)(`span`,{"data-col":`enf`,children:`Enforced by`}),e&&(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`span`,{className:`rh-cut`,children:`Hook `}),`gate`]})]}),dt=Y.filter(Z),ft=(X||I!==`all`?ke.filter(Z).length:0)+($e?dt.length:0)+(et?H.reduce((e,t)=>e+t.rules.filter(Z).length,0):0),pt=He(ke[0]||{}).asks,mt=(e,t)=>B?(0,j.jsxs)(`div`,{className:`law-gate`,children:[(0,j.jsxs)(`span`,{className:`law-name`,children:[(0,j.jsx)(`span`,{children:D[e].label}),t?(0,j.jsx)(`span`,{className:`law-asks mono`,children:t}):null,(0,j.jsx)(`span`,{className:`law-princ`,children:m[e].desc})]}),Pe(e)]}):null,ht=e=>{let t=ee[e];return t?(0,j.jsxs)(`details`,{className:`law-hook`,children:[(0,j.jsx)(`summary`,{children:`What the hook does`}),(0,j.jsxs)(`dl`,{children:[(0,j.jsx)(`dt`,{children:`Triggers on`}),(0,j.jsx)(`dd`,{children:t.on}),(0,j.jsx)(`dt`,{children:`Per host`}),(0,j.jsx)(`dd`,{children:t.hosts}),(0,j.jsx)(`dt`,{children:`Does not see`}),(0,j.jsx)(`dd`,{children:t.blind}),(0,j.jsx)(`dt`,{children:`If switched off`}),(0,j.jsx)(`dd`,{children:t.off})]})]}):null};return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(u,{eyebrow:z?[t?.theme,z.footprint&&`${z.footprint} footprint`,w(z)].filter(Boolean).join(` · `):null,title:`Constitution`,sub:`What the agent follows on every turn. Ranked: a lower rank may tighten a higher one, never repeal it. Open any rule to read its canonical text.`,actions:(0,j.jsx)(se,{className:`law-filter`,value:P,onChange:F,placeholder:`Filter rules`,label:`Filter rules`})}),(0,j.jsxs)(`section`,{className:`ladder`,"aria-labelledby":`ladder-h`,children:[(0,j.jsx)(`h2`,{id:`ladder-h`,className:`eyebrow`,children:`Precedence`}),(0,j.jsx)(ue,{tiers:Xe,current:M,onPick:N}),(0,j.jsx)(`div`,{className:`ladder-tail`,children:_.map((e,t)=>(0,j.jsxs)(`span`,{className:`ladder-low`,children:[(0,j.jsxs)(`span`,{className:`mono tier-k`,children:[`RANK `,h.length+t+1]}),` `,e.label,` —`,` `,e.against]},e.source))})]}),(0,j.jsxs)(`div`,{className:`split`,children:[(0,j.jsxs)(`section`,{className:`panel flush law-wrap${B?` with-toggle`:``}`,"aria-label":`Rules`,children:[Oe.length>0&&(0,j.jsxs)(j.Fragment,{children:[lt(J.ontology,`ontology/universal.md`),ut(!1),Oe.map(e=>(0,j.jsx)(le,{law:e,rev:d,isOpen:R===e.addr,onToggle:()=>ye(e.addr),after:e.addr===pe?(0,j.jsxs)(j.Fragment,{children:[ht(`ownership`),mt(`ownership`,pt)]}):null},e.addr))]}),(0,j.jsxs)(`div`,{className:`law-toolbar`,children:[(0,j.jsx)(C,{"aria-label":`Show`,children:Qe.map(([e,t,n])=>(0,j.jsxs)(`button`,{type:`button`,className:M===e?`on`:``,"aria-pressed":M===e,onClick:()=>N(e),children:[t,` `,(0,j.jsx)(`span`,{className:`mono`,children:n})]},e))}),(0,j.jsx)(C,{"aria-label":`Narrow`,children:nt.map(([e,t,n])=>(0,j.jsxs)(`button`,{type:`button`,className:I===e?`on`:``,"aria-pressed":I===e,disabled:n===null,onClick:()=>L(I===e?`all`:e),children:[t,` `,n===null?null:(0,j.jsx)(`span`,{className:`mono`,children:n})]},e))})]}),$e&&dt.length>0&&(0,j.jsxs)(j.Fragment,{children:[lt(J.laws,`laws/universal.md`),ut(B),dt.map(e=>(0,j.jsx)(le,{law:He(e),rev:d,isOpen:R===e.addr,onToggle:()=>ye(e.addr),after:ht(e.addr),toggleCol:!B||e.retired?null:Ie(Fe(`locked`,`A ${J.law} cannot be excluded: its text always binds.`),D[e.addr]?Pe(e.addr,e.name):null)},e.addr))]}),et&&H.map(e=>{let t=e.rules.filter(Z);if(!t.length)return null;let n=it(e.pack),r=e.rules.filter(e=>K(e.addr)).length;return(0,j.jsxs)(`div`,{className:`pack-wrap${Te(e)?``:` pack-off`}`,children:[(0,j.jsxs)(`div`,{className:`band-head pack-head`,children:[(0,j.jsx)(`h2`,{className:`tier-h`,style:{"--cc":ie[e.pack]},children:(0,j.jsx)(`button`,{type:`button`,className:`pack-fold`,"aria-expanded":!n,onClick:()=>at(e.pack),children:e.title})}),(0,j.jsx)(`span`,{className:`mono dim`,children:e.pack}),(0,j.jsx)(`span`,{className:`pack-desc dim`,children:e.desc}),(0,j.jsx)(`span`,{className:`pack-fill`,children:(0,j.jsx)(s,{value:r,max:e.rules.length,label:`${e.title} rules switched on`})}),(0,j.jsx)(`span`,{className:`pack-state mono`,children:Ee(e)})]}),!e.active&&!B&&(0,j.jsxs)(`div`,{className:`pack-enable`,children:[`$ geneseed-build --doctrines`,` `,H.filter(t=>t.active||t.pack===e.pack).map(e=>e.pack).join(`,`),Me.length>0&&` --exclude-rules ${Me.join(`,`)}`]}),!n&&ut(B),!n&&t.map(e=>(0,j.jsx)(le,{law:He(je(e)),rev:d,isOpen:R===e.addr,onToggle:()=>ye(e.addr),after:ht(e.addr),toggleCol:B?Ie((0,j.jsx)(`button`,{type:`button`,className:`sw-toggle${K(e.addr)?` on`:``}`,role:`switch`,"aria-checked":K(e.addr),"aria-label":`${e.name} rule text`,onClick:()=>we(e.addr)}),Le(e)):null},e.addr))]},e.pack)}),ft===0&&(0,j.jsx)(oe,{title:X||I!==`all`?`No matching rules`:`Nothing in this tier`,children:X?(0,j.jsxs)(j.Fragment,{children:[`Nothing matches “`,P.trim(),`”.`]}):I===`all`?(0,j.jsx)(j.Fragment,{children:`This install predates the tier.`}):(0,j.jsxs)(j.Fragment,{children:[`No `,I,` rule in this tier.`]})})]}),(0,j.jsxs)(`aside`,{className:`aside-stack`,children:[(0,j.jsx)(fe,{packs:H,sel:W,canApply:B,install:z,gateArmed:Ce}),(0,j.jsx)(de,{gates:n?.gates,byAddr:Ze,onJump:Be,disarmed:e=>!!D[e]&&!U(e),install:t?.install,slot:te})]})]}),st&&(0,j.jsxs)(`div`,{className:`law-bar`,role:`region`,"aria-label":`Unapplied changes`,children:[(0,j.jsxs)(`span`,{className:`law-bar-n`,children:[ot.length,` unapplied change`,ot.length===1?``:`s`]}),(0,j.jsx)(`span`,{className:`law-bar-list`,children:ot.map(e=>(0,j.jsxs)(`span`,{className:`badge ${e.plus?`ok`:`warn`}`,children:[e.plus?`+`:`−`,` `,e.no,` `,e.name]},e.addr))}),(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:ct,children:`Review changes`}),(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>{L(`all`),W.revert()},children:`Revert`}),(0,j.jsxs)(`button`,{type:`button`,className:`btn`,onClick:W.applyPacks,children:[`Apply (`,W.pickedRules.length,`/`,q.length,` rules)`]})]})]})}export{P as default};
|
|
4
|
+
`)}`:``,_=p.length?{label:`Also turn the ${p.map(e=>e.label.toLowerCase()).join(` and `)} back on`,checked:!0}:void 0,v=await o(`Rebuild ${w(n)} with ${h}? It rebuilds in place, non-destructive.${d}${g}`,{title:`Rebuild with these rules?`,confirmLabel:`Rebuild`,check:_});if(!v)return;let b={...f};if(v?.checked!==!1)for(let e of p)b[e.key]=!0;await i(`install`,{...n,doctrines:e,excludeRules:c,...b})&&l.startApply(`rules`,u)},revert:()=>l.drop(`rules`,u)}}var j=n();function M({addr:e,isOpen:t,onToggle:n,className:a,style:o,head:s,label:l,rev:u,toggleCol:d=null,renderBody:f,srcLine:p,after:m=null}){let h=(0,A.useId)(),{data:g,error:_,reload:v}=c(()=>t?r.item(`law`,e):Promise.resolve(null),[t,e,u],`law-item`),y=t&&(0,j.jsxs)(`div`,{className:`law-expand`,id:h,children:[_?(0,j.jsx)(i,{error:_,onRetry:v}):g?f(g):(0,j.jsx)(`p`,{className:`dim`,children:`Loading…`}),(0,j.jsx)(`div`,{className:`law-srcline`,children:p}),m]}),b={type:`button`,onClick:n,"aria-expanded":t,"aria-controls":h,"aria-label":l};return d?(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`div`,{className:a,style:o,"data-addr":e,children:[(0,j.jsx)(`button`,{className:`law-disclosure`,...b,children:s}),(0,j.jsx)(`span`,{className:`toggle-col`,children:d})]}),y]}):(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(`button`,{className:a,style:o,"data-addr":e,...b,children:s}),y]})}function le({law:e,isOpen:t,onToggle:n,rev:r,toggleCol:i=null,after:a=null}){let o=e.enf===`Hook gate`?` hook`:e.enf===`Gate off`?` gate-off`:``,s=(0,j.jsx)(`span`,{className:`law-enf${o}`,"data-col":`enf`,"aria-hidden":i?`true`:void 0,children:e.enf},`enf`),c=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`span`,{className:`law-no`,"data-col":`no`,children:[(0,j.jsx)(`span`,{className:`x`,"aria-hidden":`true`,children:`›`}),e.no]}),(0,j.jsxs)(`span`,{className:`law-name`,children:[(0,j.jsx)(`span`,{children:e.name}),e.ess?(0,j.jsx)(`span`,{className:`law-princ`,children:e.ess}):null,e.asks?(0,j.jsx)(`span`,{className:`law-asks mono`,children:e.asks}):null,e.note?(0,j.jsx)(`span`,{className:`law-note`,children:e.note}):null,e.no?(0,j.jsxs)(`span`,{className:`law-fold law-fold-no`,"aria-hidden":`true`,children:[(0,j.jsx)(`span`,{className:`x`,children:`›`}),e.no]}):null,e.latin?(0,j.jsx)(`span`,{className:`law-fold law-fold-latin`,"aria-hidden":`true`,children:e.latin}):null,(0,j.jsxs)(`span`,{className:`law-fold law-fold-chips`,"aria-hidden":`true`,children:[(0,j.jsx)(`span`,{className:`law-chip-status ${e.statusTone}`,children:e.status}),(0,j.jsx)(`span`,{className:`law-chip-enf${o}`,children:e.enf})]})]}),(0,j.jsx)(`span`,{className:`law-latin`,"data-col":`latin`,children:e.latin}),(0,j.jsx)(`span`,{className:`law-status ${e.statusTone}`,"data-col":`status`,children:e.status}),i?null:s]});return(0,j.jsx)(M,{addr:e.addr,isOpen:t,onToggle:n,className:`law-row${i?` has-toggle`:``}${t?` on`:``}${e.off?` law-off`:``}`,style:{"--cc":e.c},head:c,label:`${e.no?e.no+` `:``}${e.name}, ${e.status}, ${e.enf}`,rev:r,toggleCol:i?[i[0],s,i[1]]:null,renderBody:t=>(0,j.jsx)(se,{body:t.body||e.ess,links:t.links}),srcLine:`$ geneseed law ${e.addr} · ${e.src}`,after:a})}var N=[`invariants`,`doctrines`];function ue({tiers:e,current:t,onPick:n}){return(0,j.jsx)(`div`,{className:`tier-strip`,children:e.map((e,r)=>{let i=(0,j.jsxs)(j.Fragment,{children:[(0,j.jsxs)(`span`,{className:`tier-head`,children:[(0,j.jsxs)(`span`,{className:`tier-k mono`,children:[`RANK `,r+1]}),e.pill?(0,j.jsx)(`span`,{className:`badge tier-pill ${e.pill[1]}`,children:e.pill[0]}):null]}),(0,j.jsxs)(`span`,{className:`tier-top`,children:[(0,j.jsx)(`span`,{className:`tier-name`,children:e.name}),(0,j.jsx)(`span`,{className:`tier-n mono`,children:e.n})]}),(0,j.jsx)(`span`,{className:`tier-bar`,"aria-hidden":`true`,children:(0,j.jsx)(`span`,{style:{width:`${Math.round(e.fill*100)}%`}})}),(0,j.jsx)(`span`,{className:`tier-sub`,children:e.sub}),(0,j.jsx)(`span`,{className:`tier-sub tier-rule`,children:e.rule})]}),a=`tier${t===e.key?` on`:``}`;return e.href?(0,j.jsx)(`a`,{className:`tier`,href:e.href,children:i},e.key):n&&N.includes(e.key)?(0,j.jsx)(`button`,{type:`button`,className:a,"aria-pressed":t===e.key,onClick:()=>n(t===e.key?`all`:e.key),children:i},e.key):(0,j.jsx)(`div`,{className:a,children:i},e.key)})})}function de({gates:e,byAddr:t,onJump:n,disarmed:r=()=>!1,install:i=null,slot:a=0}){let o=i?w(i):``,c=Object.entries(e?.asks||{}).map(([e,t])=>[e,t,r(y(e))]).sort((e,t)=>e[2]-t[2]||t[1]-e[1]),l=Math.max(1,...c.map(([,e])=>e));return(0,j.jsxs)(`section`,{className:`panel`,"aria-labelledby":`gate-asks`,children:[(0,j.jsxs)(`div`,{className:`panel-head`,children:[(0,j.jsx)(`h2`,{id:`gate-asks`,children:`Gate asks`}),(0,j.jsxs)(`span`,{className:`mono dim`,children:[e?.total??0,` in ledger`]})]}),i&&c.some(e=>e[2])&&(0,j.jsx)(`span`,{className:`lib-legend mono`,children:(0,j.jsxs)(`span`,{children:[a>=0&&(0,j.jsx)(`i`,{className:`lr-dot`,style:x(a),"aria-hidden":`true`}),o]})}),c.length?(0,j.jsx)(`ul`,{className:`gate-list`,children:c.map(([e,r,c])=>{let u=y(e),d=t[u]?.name||v(u);return(0,j.jsxs)(`li`,{children:[(0,j.jsx)(`button`,{type:`button`,className:`gate-row`,onClick:()=>n(u),children:(0,j.jsxs)(`span`,{className:`gate-top`,children:[(0,j.jsx)(`span`,{className:`gate-name${c?` dim`:``}`,children:d}),c&&(0,j.jsxs)(`span`,{className:`mono off`,children:[i&&a>=0&&(0,j.jsx)(`i`,{className:`lr-dot`,style:x(a),"aria-hidden":`true`}),`off`,i&&(0,j.jsxs)(`span`,{className:`sr-only`,children:[` · `,o]})]}),(0,j.jsx)(`span`,{className:`mono gate-n`,children:r})]})}),(0,j.jsx)(s,{value:r,max:l,label:`${d} asks`,tone:c?`accent`:`warn`})]},e)})}):(0,j.jsx)(`p`,{className:`sub`,children:`No gate has asked yet.`}),(0,j.jsx)(`p`,{className:`panel-note`,children:e?.standing_down?.length?`Standing down: ${e.standing_down.join(`, `)}.`:`None standing down.`})]})}function fe({packs:e,sel:t,canApply:n,install:r,gateArmed:i}){let{isOn:a,packOn:o,togglePack:c,dirty:l,losingConsent:u}=t,d=Math.max(1,...e.map(e=>e.rules.length));return(0,j.jsxs)(`section`,{className:`panel`,"aria-labelledby":`doc-packs`,children:[(0,j.jsxs)(`div`,{className:`panel-head`,children:[(0,j.jsx)(`h2`,{id:`doc-packs`,children:`Doctrine packs`}),(0,j.jsxs)(`span`,{className:`mono dim`,children:[e.filter(o).length,`/`,e.length,` on`]})]}),e.length?(0,j.jsx)(`ul`,{className:`pack-list`,children:e.map(e=>{let t=e.rules.filter(e=>a(e.addr)).length;return(0,j.jsxs)(`li`,{className:o(e)?``:`off`,children:[(0,j.jsx)(`span`,{className:`pl-name`,title:e.desc,children:e.title}),(0,j.jsx)(s,{value:t,max:d,label:`${e.title} rules on`}),(0,j.jsx)(`span`,{className:`mono pl-n`,children:t}),n?(0,j.jsx)(`button`,{type:`button`,className:`sw-toggle${o(e)?` on`:``}${t&&t<e.rules.length?` mixed`:``}`,role:`checkbox`,"aria-checked":e.rules.length&&t===e.rules.length?`true`:t?`mixed`:`false`,"aria-label":`${e.title} pack`,onClick:()=>c(e)}):null]},e.pack)})}):(0,j.jsx)(`p`,{className:`sub`,children:`This install predates the three-tier constitution.`}),n&&e.length>0&&(0,j.jsxs)(j.Fragment,{children:[u&&(0,j.jsxs)(`p`,{className:`pack-warn`,role:`status`,"aria-live":`polite`,children:[`Dropping `,(0,j.jsx)(`b`,{children:`process 5`}),` also removes the commit/push consent gate:`,` `,(0,j.jsx)(`code`,{children:`git commit`}),` and `,(0,j.jsx)(`code`,{children:`git push`}),` stop being confirmed at the tool boundary.`,` `,i?`Real data loss stays gated by Rule IV.`:`Rule IV’s deletion gate is off on this install too.`]}),(0,j.jsx)(`p`,{className:`panel-note`,role:`status`,"aria-live":`polite`,children:l?`Not applied yet. Apply rebuilds ${r.host} · ${r.scope} once, with every change together.`:`Matches the deployed install. Changing a pack rebuilds it.`})]})]})}var pe=`ont:ownership`,me=e=>e===`ownership`?pe:e,he=`process.5`;function ge(e,t){let n=[];for(let r of e){if(r.tier!==`doctrine`)continue;let e=n.find(e=>e.pack===r.pack);e||(e={pack:r.pack,title:r.packTitle||r.pack,desc:r.packDesc||``,active:r.packActive!==!1,rules:[]},n.push(e));let i=p(r.title);e.rules.push({addr:r.name,no:`${r.pack} ${r.name.split(`.`)[1]||``}`,name:i.name,latin:i.latin,ess:r.summary||``,enf:S(r.name,t),c:ie[r.pack]||`var(--text-3)`,src:`doctrines/${r.pack}.md`})}return n}function P(e){let t=o(e.dataRev),[n,r]=T(`laws`,t);return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(E,{className:`page-pick`,installs:t,value:n,onChange:r}),(0,j.jsx)(I,{...e,install:n,listed:t!==null,installSlot:O((t||[]).map(e=>e.id)).indexOf(n?.id)},n?.id??`none`)]})}var F=(e,t)=>e?.install?.host===t.host&&e.install.path===t.path;function I({install:e,listed:t,installSlot:n,...a}){let o=e&&F(a.overview,e)?a.overview:null,{data:s,error:l,loading:u}=c(()=>Promise.resolve().then(()=>e&&!o?r.overview(te(e)):null),[!!o,a.dataRev]),d=o||(e&&F(s,e)?s:null),f=e?d:a.overview,p=!(!e||d||u);return(0,j.jsxs)(j.Fragment,{children:[p?(0,j.jsx)(i,{error:`Could not read this install's gates${l?`: ${l}`:`.`}`}):null,(0,j.jsx)(L,{...a,overview:f,pair:te(e),onAction:t&&(!e||d!==null)?a.onAction:void 0,pending:!t||!!(e&&!d&&u),gatesUnread:p,installSlot:n})]})}function L({selected:e,overview:t,setup:n,onAction:o,dataRev:d,pair:f,pending:v,gatesUnread:x,installSlot:te}){let T=b(),{data:E,error:O}=c(()=>r.catalog(`laws`,f),f?[d,f.host,f.path]:[d],`catalog:laws`),{data:se}=l(d,f),[M,N]=(0,A.useState)(`all`),[P,F]=(0,A.useState)(``),[I,L]=(0,A.useState)(`all`),[_e,ve]=(0,A.useState)(()=>new Set),R=me(e)||null,ye=e=>a(R===e?`#/laws`:`#/item/law/${encodeURIComponent(e)}`),z=t?.install,B=!!(z&&o),[be,xe]=(0,A.useState)(0),Se=(0,A.useRef)(null);(0,A.useEffect)(()=>{if(!R)return;let e=requestAnimationFrame(()=>{let e=document.querySelector(`[data-addr="${CSS.escape(R)}"]`);if(!e)return;let t=Se.current===R;Se.current=null;let n=e.getBoundingClientRect();if(t||n.top<80||n.bottom>window.innerHeight){let t=window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;e.scrollIntoView?.({block:`center`,behavior:t?`auto`:`smooth`})}t&&(e.classList.remove(`law-flash`),e.offsetWidth,e.classList.add(`law-flash`))});return()=>cancelAnimationFrame(e)},[R,be,E]);let V=E?.items||[],H=ge(V,t?.install),U=e=>t?.install?.[D[e].key]!==!1,Ce=U(`IV`),W=ce({items:V,packs:H,install:z,canApply:B,onAction:o,gateArmed:Ce}),{deployedRules:G,isOn:K,toggleRule:we,packOn:Te,packState:Ee,allRules:q}=W;if(O)return(0,j.jsx)(i,{error:O});if(!E||v)return(0,j.jsx)(g,{});let J={ontology:E.nouns?.ontology||`Ethos`,law:E.nouns?.law||`Dictate`,laws:E.nouns?.laws||`Dictates`,doctrines:E.nouns?.doctrines||`Doctrines`},De=(e,t)=>{let n=S(e,t);return x&&D[e]&&n===`Hook gate`?`Unknown`:n},Oe=V.filter(e=>e.tier===`ontology`).map(e=>({addr:e.name,no:``,name:e.title,latin:``,ess:``,status:`Always`,statusTone:`ok`,enf:e.name===pe&&(z||x)?De(`ownership`,z):`Instruction`,c:`var(--text-3)`,src:`ontology/universal.md`})),Y=V.filter(e=>(e.tier??`invariant`)===`invariant`).map(e=>{let n=e.klass&&k[e.klass]?e.klass:`craft`,r=p(e.title);return{addr:e.name,no:e.name,name:r.name,latin:r.latin,ess:e.summary||``,retired:r.retired,status:r.retired?`Retired`:`Active`,statusTone:r.retired?``:`ok`,enf:r.retired?`None`:De(e.name,t?.install),cat:n,c:k[n].c,off:r.retired,src:`laws/universal.md`}}),ke=B?[{addr:`ownership`,name:D.ownership.label,latin:``,ess:``,enf:S(`ownership`,z)}]:[],Ae=e=>K(e)?!1:re.has(e)?!0:!D[e]||x?!1:U(e)&&!G.includes(e),je=e=>{let t=K(e.addr),n=G.includes(e.addr),r=t===n?t?`Active`:`Off`:t?`Staged on`:`Staged off`;return{...e,enf:x&&D[e.addr]&&e.enf===`Hook gate`?`Unknown`:e.enf,note:Ae(e.addr)?`Text excluded; the hook still asks.`:``,off:!t,status:r,statusTone:t?`ok`:t===n?``:`warn`}},Me=H.filter(e=>e.active).flatMap(e=>e.rules.filter(e=>!G.includes(e.addr)).map(e=>e.addr)),Ne=async e=>{if(!B)return;let{key:t,label:n}=D[e],r=n.toLowerCase(),i=!U(e),a=w(z),s=W.dirty?` Your staged doctrine changes are not part of this rebuild; they stay staged.`:``;await T((i?`Re-arm the ${r} on ${a}? ${m[e].arm} It rebuilds in place, non-destructive.`:`Switch the ${r} off on ${a}? ${m[e].off} It rebuilds in place, non-destructive.`)+s,{title:i?`Re-arm the ${r}?`:`Switch the ${r} off?`,confirmLabel:i?`Re-arm`:`Switch off`})&&o(`install`,{...z,[t]:i})},Pe=(e,t)=>(0,j.jsx)(`button`,{type:`button`,className:`sw-toggle${U(e)?` on`:``}`,role:`switch`,"aria-checked":U(e),"aria-label":t?`${D[e].label}: hook gate of ${t}`:D[e].label,onClick:()=>Ne(e)}),Fe=(e,t)=>(0,j.jsxs)(`span`,{className:`no-gate`,title:t,children:[e,(0,j.jsxs)(`span`,{className:`sr-only`,children:[`: `,t]})]}),Ie=(e,t)=>[(0,j.jsx)(`span`,{className:`toggle-cell`,children:e},`text`),(0,j.jsx)(`span`,{className:`toggle-cell`,children:t},`gate`)],Le=e=>D[e.addr]?Pe(e.addr,e.name):e.addr===he?Fe(`with text`,`No switch of its own: excluding ${e.name} drops its commit and push ask in the same rebuild (Bob still logs its warning).`):ne.has(e.addr)?Fe(`with text`,`No switch of its own: excluding ${e.name}, or its pack, drops its hook in the same rebuild.`):re.has(e.addr)?Fe(`always on`,`No switch yet: the hook asks even with ${e.name}'s text excluded.`):null,Re=e=>String(e.addr).includes(`.`)&&K(e.addr)!==G.includes(e.addr),ze=(e,t=I)=>t===`all`||(t===`gated`?e.enf===`Hook gate`&&(D[e.addr]||re.has(e.addr)||!String(e.addr).includes(`.`)||G.includes(e.addr)):Re(e)),X=P.trim().toLowerCase(),Z=e=>ze(e)&&(!X||`${e.addr} ${e.name} ${e.latin} ${e.ess}`.toLowerCase().includes(X)),Be=e=>{let t=Ze[e];(String(e).includes(`.`)?M===`invariants`:t&&M===`doctrines`)&&N(`all`),t&&!ze(t)&&L(`all`),t&&!Z(t)&&F(``),Se.current=me(e),xe(e=>e+1),a(`#/item/law/${encodeURIComponent(e)}`)},Ve={};for(let[e,t]of Object.entries(n?.gates?.asks||{}))Ve[y(e)]=t;let He=e=>Ve[e.addr]?{...e,asks:`${Ve[e.addr]} ask${Ve[e.addr]===1?``:`s`}`}:e,Q=Y.filter(e=>!e.retired).length,Ue=G.length,We=e=>{if(x)return[`gates unread`,`warn`];let t=e.filter(e=>D[e.addr]&&!U(e.addr)).length;return t?[`${t} gate${t===1?``:`s`} off`,`warn`]:[`always`,`ok`]},Ge=q.length-Ue,Ke=[Ge>0&&`${Ge} excluded`,!x&&!U(`rigor.5`)&&`1 gate off`].filter(Boolean),qe=Ke.length?[Ke.join(` · `),`warn`]:[`all on`,`ok`],$=se?.stats,Je={ethos:{name:J.ontology,n:Oe.length,fill:1,sub:`${Oe.length} sections`,pill:We(ke)},invariants:{name:J.laws,n:Y.length,fill:Y.length?Q/Y.length:0,sub:Y.length>Q?`${Q} active · ${Y.length-Q} retired`:`${Q} active`,pill:We(Y)},doctrines:{name:J.doctrines,n:q.length,fill:q.length?Ue/q.length:0,sub:`${H.length} packs`,pill:qe},yours:{name:`Your rules`,n:$?.rules??``,fill:+!!$?.rules,sub:$?`${$.rules} rule${$.rules===1?``:`s`} · ≈${$.tokens.toLocaleString(`en-US`)} tok`:`user-rules.md`,href:`#/personal/rules`,pill:[`yours`,``]}},Ye=e=>{if(e===`—`)return`Nothing outranks them.`;let t=e.replace(`{{LAW}}`,J.law);return`${t[0].toUpperCase()}${t.slice(1)}.`},Xe=h.map(e=>({key:e.key,...Je[e.key],rule:Ye(e.against)})),Ze=Object.fromEntries([...Y,...H.flatMap(e=>e.rules)].map(e=>[e.addr,e])),Qe=[[`all`,`All`,Y.length+q.length],[`invariants`,J.laws,Y.length],[`doctrines`,J.doctrines,q.length]],$e=M===`all`||M===`invariants`,et=M===`all`||M===`doctrines`,tt=[...ke,...$e?Y:[],...et?H.flatMap(e=>e.rules):[]],nt=[[`gated`,`Gated`,x?null:tt.filter(e=>ze(e,`gated`)).length],[`changed`,`Changed`,tt.filter(e=>ze(e,`changed`)).length]],rt=e=>String(e).includes(`.`)?String(e).split(`.`)[0]:null,it=e=>I!==`changed`&&_e.has(e)&&rt(R)!==e,at=e=>{let t=it(e);ve(n=>{let r=new Set(n);return t?r.delete(e):r.add(e),r}),!t&&rt(R)===e&&a(`#/laws`)},ot=H.flatMap(e=>e.rules.filter(Re).map(e=>({...e,plus:K(e.addr)}))),st=B&&H.length>0&&W.dirty,ct=()=>{L(`changed`),M===`invariants`&&N(`all`),F(``)},lt=(e,t)=>(0,j.jsxs)(`div`,{className:`band-head`,role:`presentation`,children:[(0,j.jsx)(`h2`,{className:`tier-h`,children:e}),(0,j.jsx)(`span`,{className:`mono dim`,children:t})]}),ut=e=>(0,j.jsxs)(`div`,{className:`law-rowhead`,"aria-hidden":`true`,children:[(0,j.jsx)(`span`,{"data-col":`no`,children:`No.`}),(0,j.jsx)(`span`,{children:`Rule`}),(0,j.jsx)(`span`,{"data-col":`latin`,children:`Latin name`}),(0,j.jsx)(`span`,{"data-col":`status`,children:`Status`}),e&&(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`span`,{className:`rh-cut`,children:`Rule `}),`text`]}),(0,j.jsx)(`span`,{"data-col":`enf`,children:`Enforced by`}),e&&(0,j.jsxs)(`span`,{children:[(0,j.jsx)(`span`,{className:`rh-cut`,children:`Hook `}),`gate`]})]}),dt=Y.filter(Z),ft=(X||I!==`all`?ke.filter(Z).length:0)+($e?dt.length:0)+(et?H.reduce((e,t)=>e+t.rules.filter(Z).length,0):0),pt=He(ke[0]||{}).asks,mt=(e,t)=>B?(0,j.jsxs)(`div`,{className:`law-gate`,children:[(0,j.jsxs)(`span`,{className:`law-name`,children:[(0,j.jsx)(`span`,{children:D[e].label}),t?(0,j.jsx)(`span`,{className:`law-asks mono`,children:t}):null,(0,j.jsx)(`span`,{className:`law-princ`,children:m[e].desc})]}),Pe(e)]}):null,ht=e=>{let t=ee[e];return t?(0,j.jsxs)(`details`,{className:`law-hook`,children:[(0,j.jsx)(`summary`,{children:`What the hook does`}),(0,j.jsxs)(`dl`,{children:[(0,j.jsx)(`dt`,{children:`Triggers on`}),(0,j.jsx)(`dd`,{children:t.on}),(0,j.jsx)(`dt`,{children:`Per host`}),(0,j.jsx)(`dd`,{children:t.hosts}),(0,j.jsx)(`dt`,{children:`Does not see`}),(0,j.jsx)(`dd`,{children:t.blind}),(0,j.jsx)(`dt`,{children:`If switched off`}),(0,j.jsx)(`dd`,{children:t.off})]})]}):null};return(0,j.jsxs)(j.Fragment,{children:[(0,j.jsx)(u,{eyebrow:z?[t?.theme,z.footprint&&`${z.footprint} footprint`,w(z)].filter(Boolean).join(` · `):null,title:`Constitution`,sub:`What the agent follows on every turn. Ranked: a lower rank may tighten a higher one, never repeal it. Open any rule to read its canonical text.`,actions:(0,j.jsx)(oe,{className:`law-filter`,value:P,onChange:F,placeholder:`Filter rules`,label:`Filter rules`})}),(0,j.jsxs)(`section`,{className:`ladder`,"aria-labelledby":`ladder-h`,children:[(0,j.jsx)(`h2`,{id:`ladder-h`,className:`eyebrow`,children:`Precedence`}),(0,j.jsx)(ue,{tiers:Xe,current:M,onPick:N}),(0,j.jsx)(`div`,{className:`ladder-tail`,children:_.map((e,t)=>(0,j.jsxs)(`span`,{className:`ladder-low`,children:[(0,j.jsxs)(`span`,{className:`mono tier-k`,children:[`RANK `,h.length+t+1]}),` `,e.label,` —`,` `,e.against]},e.source))})]}),(0,j.jsxs)(`div`,{className:`split`,children:[(0,j.jsxs)(`section`,{className:`panel flush law-wrap${B?` with-toggle`:``}`,"aria-label":`Rules`,children:[Oe.length>0&&(0,j.jsxs)(j.Fragment,{children:[lt(J.ontology,`ontology/universal.md`),ut(!1),Oe.map(e=>(0,j.jsx)(le,{law:e,rev:d,isOpen:R===e.addr,onToggle:()=>ye(e.addr),after:e.addr===pe?(0,j.jsxs)(j.Fragment,{children:[ht(`ownership`),mt(`ownership`,pt)]}):null},e.addr))]}),(0,j.jsxs)(`div`,{className:`law-toolbar`,children:[(0,j.jsx)(C,{"aria-label":`Show`,children:Qe.map(([e,t,n])=>(0,j.jsxs)(`button`,{type:`button`,className:M===e?`on`:``,"aria-pressed":M===e,onClick:()=>N(e),children:[t,` `,(0,j.jsx)(`span`,{className:`mono`,children:n})]},e))}),(0,j.jsx)(C,{"aria-label":`Narrow`,children:nt.map(([e,t,n])=>(0,j.jsxs)(`button`,{type:`button`,className:I===e?`on`:``,"aria-pressed":I===e,disabled:n===null,onClick:()=>L(I===e?`all`:e),children:[t,` `,n===null?null:(0,j.jsx)(`span`,{className:`mono`,children:n})]},e))})]}),$e&&dt.length>0&&(0,j.jsxs)(j.Fragment,{children:[lt(J.laws,`laws/universal.md`),ut(B),dt.map(e=>(0,j.jsx)(le,{law:He(e),rev:d,isOpen:R===e.addr,onToggle:()=>ye(e.addr),after:ht(e.addr),toggleCol:!B||e.retired?null:Ie(Fe(`locked`,`A ${J.law} cannot be excluded: its text always binds.`),D[e.addr]?Pe(e.addr,e.name):null)},e.addr))]}),et&&H.map(e=>{let t=e.rules.filter(Z);if(!t.length)return null;let n=it(e.pack),r=e.rules.filter(e=>K(e.addr)).length;return(0,j.jsxs)(`div`,{className:`pack-wrap${Te(e)?``:` pack-off`}`,children:[(0,j.jsxs)(`div`,{className:`band-head pack-head`,children:[(0,j.jsx)(`h2`,{className:`tier-h`,style:{"--cc":ie[e.pack]},children:(0,j.jsx)(`button`,{type:`button`,className:`pack-fold`,"aria-expanded":!n,onClick:()=>at(e.pack),children:e.title})}),(0,j.jsx)(`span`,{className:`mono dim`,children:e.pack}),(0,j.jsx)(`span`,{className:`pack-desc dim`,children:e.desc}),(0,j.jsx)(`span`,{className:`pack-fill`,children:(0,j.jsx)(s,{value:r,max:e.rules.length,label:`${e.title} rules switched on`})}),(0,j.jsx)(`span`,{className:`pack-state mono`,children:Ee(e)})]}),!e.active&&!B&&(0,j.jsxs)(`div`,{className:`pack-enable`,children:[`$ geneseed-build --doctrines`,` `,H.filter(t=>t.active||t.pack===e.pack).map(e=>e.pack).join(`,`),Me.length>0&&` --exclude-rules ${Me.join(`,`)}`]}),!n&&ut(B),!n&&t.map(e=>(0,j.jsx)(le,{law:He(je(e)),rev:d,isOpen:R===e.addr,onToggle:()=>ye(e.addr),after:ht(e.addr),toggleCol:B?Ie((0,j.jsx)(`button`,{type:`button`,className:`sw-toggle${K(e.addr)?` on`:``}`,role:`switch`,"aria-checked":K(e.addr),"aria-label":`${e.name} rule text`,onClick:()=>we(e.addr)}),Le(e)):null},e.addr))]},e.pack)}),ft===0&&(0,j.jsx)(ae,{title:X||I!==`all`?`No matching rules`:`Nothing in this tier`,children:X?(0,j.jsxs)(j.Fragment,{children:[`Nothing matches “`,P.trim(),`”.`]}):I===`all`?(0,j.jsx)(j.Fragment,{children:`This install predates the tier.`}):(0,j.jsxs)(j.Fragment,{children:[`No `,I,` rule in this tier.`]})})]}),(0,j.jsxs)(`aside`,{className:`aside-stack`,children:[(0,j.jsx)(fe,{packs:H,sel:W,canApply:B,install:z,gateArmed:Ce}),(0,j.jsx)(de,{gates:n?.gates,byAddr:Ze,onJump:Be,disarmed:e=>!!D[e]&&!U(e),install:t?.install,slot:te})]})]}),st&&(0,j.jsxs)(`div`,{className:`law-bar`,role:`region`,"aria-label":`Unapplied changes`,children:[(0,j.jsxs)(`span`,{className:`law-bar-n`,children:[ot.length,` unapplied change`,ot.length===1?``:`s`]}),(0,j.jsx)(`span`,{className:`law-bar-list`,children:ot.map(e=>(0,j.jsxs)(`span`,{className:`badge ${e.plus?`ok`:`warn`}`,children:[e.plus?`+`:`−`,` `,e.no,` `,e.name]},e.addr))}),(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:ct,children:`Review changes`}),(0,j.jsx)(`button`,{type:`button`,className:`btn ghost`,onClick:()=>{L(`all`),W.revert()},children:`Revert`}),(0,j.jsxs)(`button`,{type:`button`,className:`btn`,onClick:W.applyPacks,children:[`Apply (`,W.pickedRules.length,`/`,q.length,` rules)`]})]})]})}export{P as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,r as n,t as r}from"./react-C1iE8mnY.js";import{gt as i}from"./index-
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,r as n,t as r}from"./react-C1iE8mnY.js";import{gt as i}from"./index-Ce6qF2nG.js";import{t as a}from"./FilterInput-qGKNSlxv.js";var o=n(),s=e(t(),1),c=r(),l={experimental:{label:`experimental`,cls:`warn`,icon:`flask`,hint:`Shipped, but not yet confirmed by real use.`},deprecated:{label:`deprecated`,cls:`bad`,icon:`clear`,hint:`On its way out — look for the replacement before building on it.`},personal:{label:`personal`,cls:``,icon:`profile`,hint:`Yours — present in this install, not shipped or versioned by Geneseed.`},unknown:{label:`no status`,cls:``,icon:`about`,hint:`Not listed in registry.json.`}};function u({status:e,withHint:t=!1,compact:n=!1}){let r=l[e];if(!r)return null;if(n)return(0,c.jsxs)(`span`,{className:`badge status-icon ${r.cls}`,title:`${r.label}: ${r.hint}`,children:[(0,c.jsx)(i,{name:r.icon}),(0,c.jsx)(`span`,{className:`sr-only`,children:r.label})]});let a=(0,c.jsxs)(`span`,{className:`badge ${r.cls}`,title:t?void 0:r.hint,children:[(0,c.jsx)(`span`,{className:`dot`}),r.label]});return t?(0,c.jsxs)(c.Fragment,{children:[a,(0,c.jsx)(`span`,{className:`dim`,children:r.hint})]}):a}function d({items:e}){return Object.keys(l).filter(t=>e.some(e=>e.status===t)).map(e=>(0,c.jsxs)(`span`,{title:l[e].hint,children:[(0,c.jsx)(`span`,{className:`badge status-icon ${l[e].cls}`,"aria-hidden":`true`,children:(0,c.jsx)(i,{name:l[e].icon})}),l[e].label]},e))}function f({label:e,total:t,cats:n,cat:r,onChange:i}){if(n.length<=1)return null;let a=[{key:`all`,label:`All`,n:t,c:`var(--text-3)`},...n];return(0,c.jsxs)(`div`,{className:`rail-cats`,children:[(0,c.jsx)(`ul`,{"aria-label":e,children:a.map(({key:e,label:t,n,c:a})=>(0,c.jsx)(`li`,{children:(0,c.jsxs)(`button`,{type:`button`,className:r===e?`on`:``,"aria-pressed":r===e,style:{"--cc":a},onClick:()=>i(e),children:[(0,c.jsx)(`span`,{className:`cdot`,"aria-hidden":`true`}),(0,c.jsx)(`span`,{className:`rc-name`,title:t,children:t}),(0,c.jsx)(`span`,{className:`mono dim`,children:n})]})},e))}),(0,c.jsx)(`div`,{className:`rail-mix`,"aria-hidden":`true`,children:n.map(({key:e,n:t,c:n})=>(0,c.jsx)(`span`,{className:r===`all`||r===e?``:`dim`,style:{"--cc":n,flexGrow:t}},e))})]})}function p(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)`}))}var m=({name:e})=>(0,c.jsxs)(`span`,{className:`tag acc`,title:`Ships with the ${e} kit`,children:[`kit: `,e]}),h=()=>(0,c.jsx)(`span`,{className:`tag acc`,title:`Every agent inherits this agent's root file`,children:`base`});function g(e,t){let n=(t||``).trim().toLowerCase();return n?e.filter(e=>`${e.title||``} ${e.name||``} ${e.desc||``}`.toLowerCase().includes(n)):e}function _({label:e,count:t,extra:n,tools:r,toolsCompact:i,q:l,onQ:u,matched:d,inView:p,current:m,sections:h,cats:g,cat:_,onCat:v,total:y,catLabel:w,children:T}){let E=C(p),D=E.list,O=S([...p,D]),k=(0,s.useId)(),A=(0,s.useRef)(null);(0,s.useLayoutEffect)(()=>x(O.current));let[j,M]=(0,s.useState)(``),N=(0,s.useRef)(!0);return(0,s.useEffect)(()=>{N.current?N.current=!1:M(O.current?.querySelector(`.lib-row.on`)?.dataset.title||``)},p),(0,c.jsxs)(`section`,{className:`lib-list`,"aria-label":e,onKeyDown:e=>{e.key===`ArrowDown`&&e.target.classList?.contains(`lib-filter`)&&(e.preventDefault(),D||(0,o.flushSync)(()=>E.setList(!0)),O.current?.querySelector(`.lib-row`)?.focus())},"data-open":D,children:[(0,c.jsxs)(`div`,{className:`lib-list-head`,children:[(0,c.jsxs)(`b`,{children:[e,` `,(0,c.jsx)(`span`,{className:`mono dim`,children:t})]}),n]}),(0,c.jsxs)(`div`,{className:`lib-toolbar`,children:[h?(0,c.jsx)(`nav`,{className:`lib-seg`,"aria-label":`Sections`,children:h.map(e=>(0,c.jsxs)(`a`,{href:e.href,className:e.on?`on`:``,"aria-current":e.on?`page`:void 0,onClick:e=>{e.metaKey||e.ctrlKey||e.shiftKey||e.button!==0||E.setList(!0)},children:[e.label,(0,c.jsx)(`span`,{className:`mono`,children:e.n??``})]},e.key))}):null,(0,c.jsxs)(`div`,{className:`lib-toolbar-filter`,children:[(0,c.jsx)(a,{value:l,onChange:u,placeholder:`Filter ${e.toLowerCase()}`,label:`Filter ${e}`}),r?(0,c.jsx)(`div`,{className:`lib-tools`,children:r}):null,i?(0,c.jsx)(`div`,{className:`lib-tools-compact`,children:i}):null]}),g?.length>1?(0,c.jsx)(`div`,{className:`lib-chips`,children:(0,c.jsx)(f,{label:w,total:y,cats:g,cat:_,onChange:v})}):null]}),(0,c.jsxs)(`div`,{className:`lib-picker`,children:[(0,c.jsxs)(`button`,{ref:A,type:`button`,className:`lib-list-toggle`,"aria-expanded":D,"aria-controls":k,onClick:()=>E.setList(e=>!e),children:[(0,c.jsx)(`span`,{className:`dim lib-pick-n`,children:d===void 0?``:`${d} ${e.toLowerCase()}`}),(0,c.jsx)(`b`,{children:m}),(0,c.jsx)(`span`,{className:`dim lib-pick-hint`,children:D?`close`:`change`}),(0,c.jsx)(`span`,{className:`lib-caret`,"aria-hidden":`true`,children:`▾`})]}),(0,c.jsxs)(`div`,{className:`lib-rows`,id:k,ref:O,onKeyDown:b,onFocus:e=>x(e.currentTarget),onClick:e=>{if(e.metaKey||e.ctrlKey||e.shiftKey||e.button!==0)return;let t=e.target.closest?.(`.lib-row`);t&&!(p[1]&&t.classList.contains(`on`))&&E.pick()},children:[T,l.trim()&&d===0&&(0,c.jsxs)(`div`,{className:`empty`,style:{padding:32},children:[(0,c.jsx)(`div`,{className:`big`,children:`No matches`}),`Nothing in `,e.toLowerCase(),` matches “`,l.trim(),`”.`]})]})]}),(0,c.jsx)(`p`,{className:`sr-only`,role:`status`,"aria-live":`polite`,children:j?`${j} opened`:``})]})}function v({item:e,isOpen:t,href:n,children:r}){return(0,c.jsxs)(`a`,{className:`lib-row${t?` on`:``}`,href:n,"aria-current":t?`true`:void 0,"data-title":e.title||e.name,"data-pinned":e.base?`true`:void 0,children:[(0,c.jsxs)(`span`,{className:`lr-name`,children:[e.title||e.name,(0,c.jsx)(u,{status:e.status,compact:!0}),e.kit?(0,c.jsx)(m,{name:e.kit}):null,e.base?(0,c.jsx)(h,{}):null,r]}),e.desc?(0,c.jsx)(`span`,{className:`lr-desc`,children:e.desc}):null,e.meta?(0,c.jsx)(`span`,{className:`lr-meta mono`,children:e.meta}):null]})}function y({rows:e,activeName:t,hrefOf:n,pills:r}){let i=null,a=[];for(let o of e)o.group&&o.group!==i&&(i=o.group,a.push((0,c.jsxs)(`div`,{className:`lib-group`,children:[o.groupC?(0,c.jsx)(`span`,{className:`cdot`,style:{"--cc":o.groupC},"aria-hidden":`true`}):null,o.group]},`g-${o.group}`))),a.push((0,c.jsx)(v,{item:o,isOpen:t===o.name,href:n(o),children:r?.(o)},o.name));return a}function b(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 x(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 S(e){let t=(0,s.useRef)(null);return(0,s.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 C([e,t]){let[n,r]=(0,s.useState)(!t),[i,a]=(0,s.useState)([e,t]),[o,c]=(0,s.useState)(!1);return(i[0]!==e||i[1]!==t)&&(a([e,t]),r(o||!t),c(!1)),{list:n,setList:r,pick:()=>c(!0)}}export{g as a,u as c,_ as i,d as l,y as n,f as o,m as r,p as s,h as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/Markdown-CxkA7940.js","assets/rolldown-runtime-XKyaHtl9.js","assets/react-C1iE8mnY.js","assets/AgentGlyph-k6o3gCM1.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{$ as i,Et as a,H as o,J as s,St as c,b as l,et as u,gt as d,it as f,lt as p,nt as ee,pt as m,rt as h,t as g,ut as _,x as v,z as te}from"./index-Ce6qF2nG.js";import{n as y,t as b}from"./sections-CtFz7HFH.js";import{a as ne,c as re,i as ie,l as ae,n as oe,o as se,r as ce,t as le}from"./LibRows-Dag1s0ZX.js";import{t as ue}from"./EmptyState-CY5Pm2xy.js";import{o as x}from"./motion-RlUl1osO.js";var S=e(t(),1),C=n();function de({load:e}){let t=String(e||`lazy`).toLowerCase();return(0,C.jsx)(`span`,{className:`mf-load mf-load-${t===`eager`?`ok`:t===`exclude`?`warn`:`muted`}`,children:t})}function fe({entries:e}){return e.length?(0,C.jsxs)(`table`,{className:`mf-entries`,children:[(0,C.jsx)(`thead`,{className:`sr-only`,children:(0,C.jsxs)(`tr`,{children:[(0,C.jsx)(`th`,{scope:`col`,children:`Path`}),(0,C.jsx)(`th`,{scope:`col`,children:`Load`}),(0,C.jsx)(`th`,{scope:`col`,children:`Description`})]})}),(0,C.jsx)(`tbody`,{children:e.map((e,t)=>{let n=String(e.load).toLowerCase()===`exclude`;return(0,C.jsxs)(`tr`,{children:[(0,C.jsx)(`td`,{className:`mf-path mono ${n?`mf-struck`:``}`,children:e.path||`·`}),(0,C.jsx)(`td`,{className:`mf-load-cell`,children:(0,C.jsx)(de,{load:e.load})}),(0,C.jsx)(`td`,{className:`mf-edesc`,children:e.description||``})]},`${e.path||t}-${t}`)})})]}):null}function pe({wiki:e}){let t=Array.isArray(e.entries)?e.entries:[],n=Array.isArray(e.protected)?e.protected:[];return(0,C.jsxs)(`div`,{className:`mf-vault`,children:[(0,C.jsxs)(`div`,{className:`mf-vault-head`,children:[(0,C.jsx)(`div`,{className:`mf-vault-name`,children:e.name||`wiki`}),e.path?(0,C.jsx)(`code`,{className:`mf-vault-path mono`,children:e.path}):null]}),e.description?(0,C.jsx)(`p`,{className:`mf-vault-desc`,children:e.description}):null,(0,C.jsxs)(`div`,{className:`mf-roles`,children:[e.conventions?(0,C.jsxs)(`span`,{className:`mf-role`,children:[(0,C.jsx)(d,{name:`skill`,className:`glyph`}),` conventions: `,e.conventions]}):null,e.inbox?(0,C.jsxs)(`span`,{className:`mf-role`,children:[(0,C.jsx)(d,{name:`notebook`,className:`glyph`}),` inbox: `,e.inbox]}):null,n.map(e=>(0,C.jsxs)(`span`,{className:`mf-role mf-role-danger`,children:[(0,C.jsx)(d,{name:`law`,className:`glyph`}),` protected: `,e]},e))]}),(0,C.jsx)(fe,{entries:t})]})}function w({body:e}){let[t,n]=(0,S.useState)(!1),r=(0,S.useId)();return e?(0,C.jsxs)(`div`,{className:`mf-raw`,children:[(0,C.jsxs)(`button`,{type:`button`,className:`mf-raw-toggle`,"aria-expanded":t,"aria-controls":r,onClick:()=>n(e=>!e),children:[(0,C.jsx)(d,{name:`chevron`,className:`glyph mf-caret ${t?`on`:``}`}),`Raw source`]}),t?(0,C.jsx)(`pre`,{id:r,className:`mf-raw-pre`,children:e.replace(/^```json\n|\n```$/g,``)}):null]}):null}function me({manifest:e,body:t,name:n}){if(!e)return(0,C.jsx)(`pre`,{className:`mf-raw-pre`,children:(t||``).replace(/^```json\n|\n```$/g,``)});if(e.kind===`wiki`){let n=e.wikis||[];return n.length?(0,C.jsxs)(`div`,{className:`mf-doc`,children:[n.map((e,t)=>(0,C.jsx)(pe,{wiki:e},e.name||t)),(0,C.jsx)(w,{body:t})]}):(0,C.jsxs)(`div`,{className:`mf-empty`,children:[(0,C.jsx)(`div`,{className:`mf-empty-title`,children:`No wiki declared yet`}),(0,C.jsxs)(`p`,{children:[`A wiki is your machine-wide knowledge base — an Obsidian vault or any folder of linked markdown the agent reads from and writes back to. Declare one in`,` `,(0,C.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` to switch it on.`]}),(0,C.jsx)(`a`,{className:`btn ghost sm`,href:`#/docs/wiki`,children:`How to configure a wiki`}),(0,C.jsx)(w,{body:t})]})}let r=e.context||[];return r.length?(0,C.jsxs)(`div`,{className:`mf-doc`,children:[(0,C.jsx)(fe,{entries:r}),(0,C.jsx)(w,{body:t})]}):(0,C.jsxs)(`div`,{className:`mf-empty`,children:[(0,C.jsx)(`div`,{className:`mf-empty-title`,children:`No project context declared`}),(0,C.jsxs)(`p`,{children:[`Point the agent at the docs for this project by adding entries to`,` `,(0,C.jsx)(`code`,{className:`mono`,children:n||`context.json`}),` — each with a`,` `,(0,C.jsx)(`code`,{className:`mono`,children:`path`}),`, a `,(0,C.jsx)(`code`,{className:`mono`,children:`load`}),` mode (eager or lazy), and a description.`]}),(0,C.jsx)(w,{body:t})]})}var T=e=>e>=1e3?`${(e/1e3).toFixed(+(e<1e4))}k`:String(e),E=e=>Math.round(e/4),D=[{key:`root`,label:`Constitution`,tone:`accent`,has:e=>e.source===`root`},{key:`catalogue`,label:`Catalogues`,tone:`muted`,has:e=>e.source===`catalogue`},{key:`agent`,label:`This agent`,tone:`warn`,has:e=>e.source!==`root`&&e.source!==`catalogue`}],he=[[`dictate`,`Dictates`],[`doctrine`,`Doctrines`],[`user`,`User rules`]],O={"not-wired":`not wired, re-emit this install`,"no-event":`not delivered on this host`};function ge(e,t){if(!e||!t)return``;let n=(e,t)=>e.blocks.filter(e=>e.chars>0&&!t.blocks.some(t=>t.id===e.id)),r=e=>e.id===`session-files`?`session files`:e.label.replace(/^.* spec$/,`spec`);return[...n(e,t).map(e=>`+ ${r(e)} ${T(e.chars)}`),...n(t,e).map(e=>`− ${r(e)} ${T(e.chars)}`)].join(`, `)}var k=e=>e.kind===`user`?`#/personal/rules`:`#/item/law/${encodeURIComponent(e.id)}`,A=e=>`${e.layer??``}${e.id}`;function _e({label:e,n:t,children:n}){return(0,C.jsxs)(`li`,{children:[(0,C.jsx)(`span`,{children:e}),n,(0,C.jsx)(`span`,{className:`mono`,children:T(t)})]})}function ve({loadout:e,base:t,error:n,install:r}){let[i,a]=(0,S.useState)(!1),[o,s]=(0,S.useState)(e?.agent);if(e?.agent!==o&&(s(e?.agent),a(!1)),n)return(0,C.jsx)(`p`,{className:`sub`,children:`Loadout not measured for this install.`});if(!e)return null;let c=e=>e.reduce((e,t)=>e+t.chars,0),l=c(e.blocks),u=ge(e,t),d=D.map(t=>{let n=e.blocks.filter(t.has);return{...t,blocks:n,n:c(n)}}),[f,p,ee]=d,m=Math.max(1,...f.blocks.map(e=>e.chars)),h=e.blocks.find(e=>e.id===`user-rules`),g=h?O[h.delivery]:void 0,_=e.rules||[],v=_.filter(e=>!(g&&e.kind===`user`)),y=_.filter(e=>e.citedBySpec),b=[];for(let e of _){let t=e.kind===`dictate`?`Dictates`:e.kind===`user`?`User rules`:e.id.split(`.`)[0],n=b.find(e=>e.name===t);n?n.n+=1:b.push({name:t,n:1,user:e.kind===`user`})}let ne=he.map(([e,t])=>[t,v.filter(t=>t.kind===e).length]).filter(([,e])=>e>0);return(0,C.jsxs)(`section`,{className:`loadout`,"aria-label":`Loadout`,children:[(0,C.jsxs)(`header`,{className:`loadout-head`,children:[(0,C.jsxs)(`div`,{children:[(0,C.jsxs)(`h3`,{className:`loadout-eyebrow mono`,children:[`Loadout · `,r||e.host]}),(0,C.jsxs)(`p`,{className:`loadout-total`,children:[(0,C.jsx)(`strong`,{children:T(E(l))}),(0,C.jsxs)(`span`,{className:`dim`,children:[`tokens at start · `,T(l),` chars`]})]})]}),u?(0,C.jsxs)(`div`,{className:`loadout-delta`,children:[(0,C.jsxs)(`span`,{className:`dim`,children:[`Against the `,t?.noun||`Primary agent`]}),(0,C.jsx)(`ul`,{children:u.split(`, `).map(e=>(0,C.jsx)(`li`,{className:`mono loadout-pill${e.startsWith(`+`)?` is-plus`:``}`,children:e},e))})]}):null]}),(0,C.jsxs)(`div`,{className:`loadout-bar`,children:[(0,C.jsx)(te,{label:`Loadout`,legend:!1,parts:d.map(e=>({key:e.key,label:e.label,n:e.n,tone:e.tone}))}),(0,C.jsx)(`ul`,{className:`loadout-groups`,"aria-hidden":`true`,children:d.map(e=>e.n>0?(0,C.jsxs)(`li`,{style:{flexGrow:e.n},children:[(0,C.jsx)(`span`,{children:e.label}),` `,(0,C.jsxs)(`span`,{className:`mono dim`,children:[T(e.n),` · `,Math.round(e.n/l*100),`%`]})]},e.key):null)})]}),(0,C.jsxs)(`details`,{className:`loadout-card`,open:e.agent===`primary`,children:[(0,C.jsxs)(`summary`,{children:[(0,C.jsx)(`i`,{className:`tone-accent`,"aria-hidden":`true`}),(0,C.jsx)(`strong`,{children:`Constitution`}),(0,C.jsx)(`span`,{className:`dim`,children:`root file, loaded by the host`}),(0,C.jsxs)(`span`,{className:`mono dim loadout-sum`,children:[T(f.n),` · ≈ `,T(E(f.n)),` tok`]})]}),(0,C.jsx)(`ul`,{className:`loadout-root`,children:f.blocks.map(e=>(0,C.jsx)(_e,{label:e.label,n:e.chars,children:(0,C.jsx)(`span`,{className:`loadout-mini`,"aria-hidden":`true`,children:(0,C.jsx)(`span`,{style:{width:`${Math.max(4,e.chars/m*100)}%`}})})},e.id))})]}),(0,C.jsxs)(`div`,{className:`loadout-pair`,children:[(0,C.jsxs)(`div`,{className:`loadout-card`,children:[(0,C.jsxs)(`p`,{className:`loadout-card-h`,children:[(0,C.jsx)(`i`,{className:`tone-muted`,"aria-hidden":`true`}),(0,C.jsx)(`strong`,{children:`Catalogues`}),(0,C.jsx)(`span`,{className:`mono dim loadout-sum`,children:T(p.n)})]}),(0,C.jsx)(`ul`,{className:`loadout-list`,children:p.blocks.map(e=>(0,C.jsx)(_e,{label:e.label,n:e.chars},e.id))}),(0,C.jsx)(`p`,{className:`dim loadout-note`,children:`Listed by the host, not by Geneseed.`})]}),(0,C.jsxs)(`div`,{className:`loadout-card is-own`,children:[(0,C.jsxs)(`p`,{className:`loadout-card-h`,children:[(0,C.jsx)(`i`,{className:`tone-warn`,"aria-hidden":`true`}),(0,C.jsx)(`strong`,{children:`This agent`}),(0,C.jsx)(`span`,{className:`mono dim loadout-sum`,children:T(ee.n)})]}),(0,C.jsx)(`ul`,{className:`loadout-list`,children:ee.blocks.map(e=>(0,C.jsx)(_e,{label:e.label,n:e.chars,children:e.id===`user-rules`?(0,C.jsx)(`span`,{className:`loadout-pill${g?` is-plus`:``}`,children:g||`injected at sub-agent start`}):null},e.id))})]})]}),(0,C.jsxs)(`section`,{className:`loadout-rules`,"aria-label":`Rules it follows`,children:[(0,C.jsxs)(`div`,{className:`loadout-rules-h`,children:[(0,C.jsxs)(`h4`,{className:`loadout-eyebrow mono`,children:[`Rules it follows · `,v.length]}),(0,C.jsx)(`span`,{className:`dim`,children:ne.map(([e,t])=>`${t} ${e}`).join(` · `)})]}),y.length?(0,C.jsxs)(`div`,{className:`loadout-cited`,children:[(0,C.jsx)(`span`,{className:`loadout-cited-h`,children:`Cited by its spec`}),y.map(e=>(0,C.jsxs)(`a`,{href:k(e),children:[(0,C.jsx)(`span`,{className:`mono`,children:e.id}),` · `,e.title]},A(e)))]}):null,(0,C.jsx)(`ul`,{className:`loadout-packs`,children:b.map(e=>e.user&&g?(0,C.jsxs)(`li`,{className:`is-muted`,children:[(0,C.jsx)(`span`,{children:`User rules`}),` `,(0,C.jsx)(`span`,{className:`mono`,children:e.n}),` `,(0,C.jsx)(`span`,{className:`dim`,children:g})]},e.name):(0,C.jsx)(`li`,{children:(0,C.jsxs)(`a`,{href:e.user?`#/personal/rules`:`#/laws`,children:[(0,C.jsx)(`span`,{children:e.name}),` `,(0,C.jsx)(`span`,{className:`mono dim`,children:e.n})]})},e.name))}),_.length?(0,C.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":i,onClick:()=>a(e=>!e),children:i?`Show fewer`:`Show all ${_.length}${g?` listed`:``} rules`}):null,i?he.map(([e,t])=>{let n=_.filter(t=>t.kind===e),r=g&&e===`user`;return n.length?(0,C.jsxs)(`div`,{className:r?`is-muted`:void 0,children:[(0,C.jsxs)(`h5`,{className:`reader-when-h`,children:[t,` `,(0,C.jsx)(`span`,{className:`mono dim`,children:n.length}),r?(0,C.jsxs)(`span`,{className:`dim`,children:[` · `,g]}):null]}),(0,C.jsx)(`ul`,{children:n.map(e=>(0,C.jsxs)(`li`,{children:[r?(0,C.jsxs)(`span`,{children:[(0,C.jsx)(`span`,{className:`mono`,children:e.id}),` `,e.title]}):(0,C.jsxs)(`a`,{href:k(e),children:[(0,C.jsx)(`span`,{className:`mono`,children:e.id}),` `,e.title]}),e.layer&&e.layer!==`install`?(0,C.jsxs)(`span`,{className:`dim`,children:[` (`,e.layer,`)`]}):null]},A(e)))})]},e):null}):null]}),(0,C.jsxs)(`p`,{className:`dim loadout-foot`,children:[`Not counted: `,e.notCounted.join(`; `),`. Tokens are chars ÷ 4.`]})]})}function ye({label:e,options:t,value:n,onChange:r}){let[i,a]=(0,S.useState)(!1),o=(0,S.useRef)(null),s=(0,S.useId)(),c=t.find(e=>e.key===n)||t[0],l=()=>a(!1);return(0,S.useEffect)(()=>{i&&document.getElementById(s)?.querySelector(`[aria-pressed="true"]`)?.focus()},[i,s]),(0,C.jsxs)(`span`,{className:`drop-menu`,children:[(0,C.jsxs)(`button`,{ref:o,type:`button`,className:`drop-menu-btn`,"aria-label":`${e}: ${c.label}`,"aria-haspopup":`dialog`,"aria-expanded":i,"aria-controls":i?s:void 0,onClick:()=>a(e=>!e),children:[c.label,(0,C.jsx)(`span`,{className:`lib-caret`,"aria-hidden":`true`,children:`▾`})]}),(0,C.jsx)(h,{open:i,onClose:l,anchorRef:o,label:e,className:`drop-menu-pop`,children:(0,C.jsx)(`div`,{id:s,className:`drop-menu-list`,onKeyDown:e=>{if(e.key!==`ArrowDown`&&e.key!==`ArrowUp`)return;let t=[...e.currentTarget.querySelectorAll(`button`)],n=t.indexOf(document.activeElement);e.preventDefault(),t[(n+(e.key===`ArrowDown`?1:t.length-1))%t.length]?.focus()},children:t.map(e=>(0,C.jsx)(`button`,{type:`button`,"aria-pressed":e.key===c.key,onClick:()=>{r(e.key),l()},children:e.label},e.key))})})]})}function be({label:e,value:t,delta:n,children:r}){let i=x(Number.isInteger(t)?t:null);return(0,C.jsxs)(`div`,{className:`stat`,children:[(0,C.jsx)(`div`,{className:`stat-label`,children:e}),(0,C.jsx)(`div`,{className:`stat-value mono`,children:i===null?t:Math.round(i)}),n==null?null:(0,C.jsx)(`div`,{className:`stat-delta`,children:n}),r]})}var xe=(0,S.lazy)(()=>g(()=>import(`./Markdown-CxkA7940.js`).then(e=>e.n),__vite__mapDeps([0,1,2]))),Se=(0,S.lazy)(()=>g(()=>import(`./AgentGlyph-k6o3gCM1.js`),__vite__mapDeps([3,1,2]))),Ce={skills:`skill`,agents:`agent`},we=`:primary`,Te=(e,t)=>`${t?e/t*100:0}%`,Ee=e=>e.split(`:`).slice(0,2).join(` `),De=e=>e.split(`/`).map((e,t)=>(0,C.jsxs)(S.Fragment,{children:[t?`/`:null,t?(0,C.jsx)(`wbr`,{}):null,e]},t)),j=e=>{let[t,n,...r]=e.split(`:`);return{host:t,scope:n,path:r.join(`:`)}},Oe=e=>m(j(e));function ke(e,t){return e===`memory`?`memory/${t}`:e===`notebook`?`notebook/${t}`:e===`wiki`?`geneseed-wiki.jsonc`:e===`config`?t:e===`skills`?`skills/${t}/SKILL.md`:`${e}/${t}.md`}function Ae({section:e,source:t}){return(0,C.jsxs)(`div`,{className:`lib-doc-empty`,children:[(0,C.jsx)(d,{name:y[e].icon,className:`glyph`}),(0,C.jsxs)(`span`,{children:[`This entry is part of the `,y[e].label.toLowerCase(),` convention; see`,` `,(0,C.jsx)(`code`,{className:`mono`,children:t}),`. It has no standalone per-entry document.`]})]})}var je=e=>e.replace(/\s+/g,` `).trim(),Me=e=>e.replace(/^(?:[ \t]*\n)+/,``);function Ne(e,t){let n=e.replace(/\r\n/g,`
|
|
3
|
+
`),r=/^(?:[ \t]*\n)*[ ]{0,3}#[ \t]+(.*?)(?:[ \t]+#+)?[ \t]*(?:\n|$)/.exec(n);if(!r)return{title:null,body:e};let i=Me(n.slice(r[0].length)),a=/^(?:>[^\n]*(?:\n|$))+/.exec(i),o=a?je(a[0].replace(/^>[ \t]?/gm,``)):``,s=t?je(t):``;return o&&(s===o||s.startsWith(o+` `))&&(i=Me(i.slice(a[0].length))),{title:r[1].trim(),body:i}}function Pe({u:e,usage:t,noCall:n}){if(!e||e.n===0&&!e.last)return(0,C.jsx)(`div`,{className:`lib-stats`,children:(0,C.jsx)(be,{label:`Used`,value:0,delta:n})});let r=[...new Set(e.installs.map(Ee))].join(`, `),i=t.days_counted>=30?`in the last 30 days`:`since ${t.since}`,a=Math.max(1,...e.per_day),o=[e.last?`last used ${e.last}`:null,i,r?`on ${r}`:null].filter(Boolean).join(` · `);return(0,C.jsx)(`div`,{className:`lib-stats`,children:(0,C.jsx)(be,{label:`Used`,value:e.n,delta:o,children:(0,C.jsx)(`div`,{className:`cols30`,"aria-hidden":`true`,children:e.per_day.map((e,t)=>(0,C.jsx)(`i`,{className:t===29?`today`:``,style:{height:Te(e,a)}},t))})})})}function Fe(e){let t=/\s*\bUse when:\s*/i.exec(e||``);if(!t)return{lede:e||``,when:``};let n=e.slice(t.index+t[0].length).trim();return{lede:e.slice(0,t.index).trim(),when:n&&n[0].toUpperCase()+n.slice(1)}}var Ie={skills:`skills`,agents:`agents`,memory:`memory`,notebook:`notebook`,wiki:`wiki`,config:`project-context`},Le=(e,t)=>t||(e&&b.includes(e)?e:b[0]),Re=encodeURIComponent;function ze(e){let t=e=>l[e.klass]?e.klass:`personal`,n=v.flatMap(n=>e.filter(e=>t(e)===n).map(e=>({...e,cat:n,group:l[n].label,groupC:l[n].c})));return{rows:n,cats:v.map(e=>({key:e,label:l[e].label,c:l[e].c,n:n.filter(t=>t.cat===e).length})).filter(e=>e.n>0)}}function Be(e){let t=e.filter(e=>e.topic).map(e=>({...e,group:e.topic}));return t.sort((e,t)=>e.group<t.group?-1:+(e.group>t.group)),[...e.filter(e=>!e.topic),...t]}function Ve({overview:e,section:t,selected:n,dataRev:d,lock:m,base:h,onRulesChanged:g,onCountsChanged:v}){let te=f(),[x,de]=(0,S.useState)(()=>Le(t,m)),[fe,pe]=(0,S.useState)(``),[w,T]=(0,S.useState)(`all`),[E,D]=(0,S.useState)(`all`),[he,O]=(0,S.useState)(``),[ge,k]=(0,S.useState)(null),[A,_e]=(0,S.useState)(null),[be,Ee]=(0,S.useState)(t);if(t!==be){Ee(t),O(``);let e=Le(t,m);e!==x&&(de(e),pe(``),T(`all`),D(`all`))}let[je,Me]=(0,S.useState)(n);n!==je&&(Me(n),O(``));let{data:Ve,error:He,reload:Ue}=c(()=>r.catalog(x),[x,d],`catalog`),We=m?null:Ce[x]||null,Ge=We!==null,{data:M}=c(()=>Ge?Promise.resolve().then(()=>r.usage()).catch(()=>null):Promise.resolve(null),[Ge,d],`usage`,{revalidate:!0}),N=Ge&&!!M?.enabled&&Array.isArray(M.names),Ke=(0,S.useMemo)(()=>new Map((Array.isArray(M?.names)?M.names:[]).map(e=>[`${e.kind}\u0000${e.name}`,e])),[M]),P=e=>N&&Ke.get(`${We}\u0000${e}`)||null,qe=e=>{let t=P(e.name);return!t||t.n===0&&!t.last},Je=M?.since?`No call since ${M.since}`:`No call recorded yet`,F=Ve?.section===x,I=F&&Ve?.items||[],Ye=!F&&!He,[Xe,...Ze]=F&&Ve.sharedInstalls||[],L=e=>e===Xe?`shared`:Oe(e),R=x===`skills`,Qe=R?ze(I):null,z=R?Qe.rows:x===`memory`?Be(I):I,B=n||z[0]?.name||null,V=x===`agents`&&!m,H=V&&B===`:primary`,{data:$e,error:et}=c(()=>V?Promise.resolve().then(()=>r.loadout()):Promise.resolve(null),[V,d],`loadout-primary`,{revalidate:!0}),tt=V?{name:we,type:`agent`,base:!0,title:!et&&$e?.noun||`Primary agent`,desc:`The main agent of the session. Every agent inherits its root file.`}:null,nt=H?tt:B?I.find(e=>e.name===B):null,rt=nt?.type||y[x].type,U=A?.sec===x&&A?.name===B?A.key:null,{data:it,error:W}=c(()=>!B||H?Promise.resolve(null):U?r.item(rt,B,j(U)):r.item(rt,B),[x,B,rt,U,d,H]),G=W?null:it,at=G&&G.name===B&&(!U||G.install===U)?G:null,ot=e=>vt&&e?.install?` in ${L(e.install)}`:``,K=H?null:U||G?.install||null,st=V&&B&&!H&&G&&G.name===B,{data:ct,error:lt}=c(()=>st?Promise.all([r.loadout(B,K?j(K):void 0),r.loadout(void 0,K?j(K):void 0).catch(()=>null)]).then(([e,t])=>({own:e,base:t})):Promise.resolve(null),[st,B,K,d]),ut=H?{own:et?null:$e,base:null}:ct,dt=H?et:lt,ft=he||He||W,pt=B?{name:B,title:G?.title||B,desc:G?.desc||``}:null,q=nt||pt,mt=t=>t===x&&F?I.length:e?.counts?.[t]??``,ht=s(d),gt=K||ht?.[0]?.id,_t=gt?Oe(gt):void 0,vt=new Set(I.flatMap(e=>e.installs||[])).size>1,yt=_([...(ht||[]).map(e=>e.id),...I.flatMap(e=>e.installs||[])],Ze),J=R?z.filter(e=>w===`all`||e.cat===w):z,bt=N?J.filter(qe).length:0,xt=e=>e.status===`experimental`,St=J.filter(xt).length,Y=[[`all`,`All`,J.length],...N?[[`used`,`Used`,J.length-bt],[`unused`,`Not used yet`,bt,Je]]:[],...St?[[`experimental`,`Experimental`,St,`Shipped, not yet confirmed by real use`]]:[]],X=Y.some(([e])=>e===E)?E:`all`,Ct=X===`all`?J:X===`experimental`?J.filter(xt):J.filter(e=>qe(e)===(X===`unused`)),wt=N?Math.max(0,...I.map(e=>P(e.name)?.n||0)):0,Tt=R?1/0:50,Z=fe.trim().toLowerCase(),Q=Z?ne(Ct,Z):Ct.slice(0,Tt),Et=!Z&&w===`all`&&X===`all`&&B&&!Q.some(e=>e.name===B)?[...Q,...z.filter(e=>e.name===B)]:Q,Dt=tt&&F&&w===`all`&&X===`all`?ne([tt],Z):[],Ot=Dt.length+Q.length,kt=[...Dt,...Et],At=e=>h?`${h}/${Re(e.name)}`:`#/item/${e.type||y[x].type}/${Re(e.name)}`,jt=async()=>{let e=at;if(!e)return;let t=e.name;if(await te(`Forget the memory fact "${t}"${ot(e)}? It leaves the index and moves to memory/archive/ (geneseed memory rm --archived --purge deletes it for good).`,{title:`Forget this fact?`,confirmLabel:`Forget`,tone:`danger`})){O(``);try{await r.memoryDelete(t,e.install?j(e.install):void 0)}catch(e){O(`Could not forget "${t}": ${e.message}`);return}a(h||`#/personal/memory`),Ue(),v?.()}},Mt=async()=>{let e=at;if(!e)return;let t=e.name;if(await te(`Promote "${t}"${ot(e)} into a standing rule? It is appended to user-rules.md as a trial rule (a month of probation), and the memory fact moves to memory/archive/ so the lesson isn't loaded twice.`,{title:`Promote to a rule?`,confirmLabel:`Promote`})){O(``);try{let n=e.install?j(e.install):void 0,i=await r.rules(n);await r.rulesPromote({name:t,fingerprint:i.fingerprint,delete_memory:!0},n),o(),g?.(),v?.(),a(`#/personal/rules`)}catch(e){O(`Could not promote: ${e.message}`),Ue()}}},Nt=G?.body?Ne(G.body,G.desc||q?.desc):null,Pt=G?.title||q?.title||q?.name,Ft=Pt===q?.name&&Nt?.title?Nt.title:Pt,It=F&&I.length===0,Lt=G?.status||q?.status,Rt=x===`skills`?l[nt?.klass]:null,zt=y[x].label,{lede:Bt,when:Vt}=Fe(G?.desc||q?.desc||``),$=q&&!H?G?.source||q.source||(W?null:ke(x,q.name)):null;return(0,C.jsxs)(`div`,{className:`lib-wrap`,children:[(0,C.jsx)(i,{error:ft,style:{margin:`0 0 var(--sp-3)`}}),(0,C.jsxs)(`div`,{className:`library lib-dossier${m?` locked`:``}${N?` uses`:``}`,children:[m?null:(0,C.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Library kinds`,children:[(0,C.jsxs)(`div`,{className:`lib-title`,children:[(0,C.jsx)(`h1`,{className:`h`,children:`Library`}),(0,C.jsx)(`span`,{className:`dim`,children:`What the agent knows`}),N&&M.since?(0,C.jsxs)(`span`,{className:`mono dim lib-title-since`,children:[`calls since `,M.since]}):null]}),(0,C.jsx)(`nav`,{className:`kind-list`,"aria-label":`Kinds`,children:b.map(e=>(0,C.jsxs)(S.Fragment,{children:[(0,C.jsxs)(`a`,{href:`#/section/${e}`,className:x===e?`on`:``,"aria-current":x===e?`page`:void 0,children:[y[e].label,(0,C.jsx)(`span`,{className:`mono dim`,children:mt(e)})]}),e===x&&R&&F&&(0,C.jsx)(se,{label:`Skill types`,total:I.length,cats:Qe.cats,cat:w,onChange:T})]},e))})]}),(0,C.jsxs)(ie,{label:zt,count:F?Z?`${Q.length} of ${Ct.length}`:Ct.length:``,q:fe,onQ:pe,matched:Ot,inView:[x,n],current:q?Ft:void 0,sections:m?void 0:b.map(e=>({key:e,label:y[e].label,n:mt(e),href:`#/section/${e}`,on:x===e})),cats:R&&F?Qe.cats:null,cat:w,total:I.length,onCat:T,catLabel:`Skill types`,extra:(0,C.jsxs)(C.Fragment,{children:[N&&M.since?(0,C.jsxs)(`span`,{className:`mono dim lib-since`,children:[`calls since `,M.since]}):null,(0,C.jsxs)(`span`,{className:`lib-legend mono`,children:[vt?yt.map((e,t)=>(0,C.jsxs)(`span`,{className:`lk-install`,title:j(e).path,children:[(0,C.jsx)(`i`,{className:`lr-dot`,style:p(t),"aria-hidden":`true`}),L(e)]},e)):null,(0,C.jsx)(ae,{items:I})]})]}),toolsCompact:F&&Y.length>1?(0,C.jsx)(ye,{label:`Show`,options:Y.map(([e,t])=>({key:e,label:e===`all`?`All uses`:t})),value:X,onChange:D}):void 0,tools:F&&Y.length>1?(0,C.jsx)(ee,{"aria-label":`Show`,children:Y.map(([e,t,n,r])=>(0,C.jsxs)(`button`,{type:`button`,className:X===e?`on`:``,"aria-pressed":X===e,title:r,onClick:()=>D(e),children:[t,` `,(0,C.jsx)(`span`,{className:`mono`,children:n})]},e))}):null,children:[Ye?(0,C.jsx)(u,{}):null,(0,C.jsx)(oe,{rows:kt,activeName:q?.name,hrefOf:At,pills:N||vt?e=>{let t=P(e.name)?.n||0,n=vt?(0,C.jsx)(`span`,{className:`lr-dots`,children:yt.map((t,n)=>e.installs?.includes(t)?(0,C.jsx)(`span`,{className:`lr-dot lr-install`,style:p(n),title:`${L(t)} — ${j(t).path}`,children:(0,C.jsx)(`span`,{className:`sr-only`,children:L(t)})},t):(0,C.jsx)(`span`,{className:`lr-dot off`,"aria-hidden":`true`},t))}):null;return N?(0,C.jsxs)(C.Fragment,{children:[n,(0,C.jsxs)(`span`,{className:`lr-use`,children:[(0,C.jsx)(`span`,{className:`ub-trk`,"aria-hidden":`true`,children:(0,C.jsx)(`i`,{style:{width:Te(t,wt)}})}),(0,C.jsxs)(`span`,{className:t?`mono`:`mono dim`,children:[t,(0,C.jsx)(`span`,{className:`sr-only`,children:t===1?` call`:` calls`})]})]})]}):n}:void 0}),!Z&&I.length>Tt&&(0,C.jsxs)(`div`,{className:`lib-more`,children:[`Showing `,Tt,` of `,I.length,`; type to search the rest.`]}),It&&(x===`wiki`?(0,C.jsxs)(ue,{title:`No wiki entries`,action:(0,C.jsx)(`a`,{href:`#/section/config`,children:`Open the setup files`}),docs:{href:`#/docs/wiki`,label:`How to configure a wiki →`},children:[`Declare a wiki in `,(0,C.jsx)(`code`,{className:`mono`,children:`geneseed-wiki.jsonc`}),` and its entries appear here.`]}):(0,C.jsx)(ue,{title:`Nothing here yet`,children:`Once the harness produces entries they appear here.`}))]}),(0,C.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:q?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsxs)(`div`,{className:`reader-tags`,children:[(0,C.jsx)(`span`,{className:`tag acc`,children:zt.replace(/s$/,``)}),H?(0,C.jsx)(le,{}):null,Rt?(0,C.jsx)(`span`,{className:`tag`,children:Rt.label}):null,G?.kit??q.kit?(0,C.jsx)(ce,{name:G?.kit??q.kit}):null,(0,C.jsx)(re,{status:Lt,withHint:!0}),$?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(`span`,{className:`mono dim reader-src`,children:De($)}),(0,C.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:async()=>{try{await navigator.clipboard.writeText($),k({src:$,ok:!0})}catch{k({src:$,ok:!1})}},children:ge?.src===$?ge.ok?`Copied`:`Copy failed`:`Copy path`})]}):null]}),(0,C.jsxs)(`div`,{className:`reader-head`,children:[(0,C.jsx)(`h2`,{className:`reader-title`,children:Ft}),x===`agents`&&!H?(0,C.jsx)(S.Suspense,{fallback:null,children:(0,C.jsx)(Se,{name:q.name})}):null]}),(0,C.jsxs)(`div`,{className:`reader-intro${N?` with-stats`:``}`,children:[(0,C.jsxs)(`div`,{className:`reader-intro-text`,children:[Bt?(0,C.jsx)(`p`,{className:`reader-lede`,children:Bt}):null,Vt?(0,C.jsxs)(`section`,{className:`reader-when`,children:[(0,C.jsx)(`h3`,{className:`reader-when-h`,children:`Use when`}),(0,C.jsx)(`p`,{children:Vt})]}):null]}),N?(0,C.jsx)(Pe,{u:P(q.name),usage:M,noCall:Je}):null]}),x===`memory`&&at&&q.name!==`MEMORY`&&q.name!==`README`&&(0,C.jsxs)(`div`,{className:`row gap-8`,children:[(0,C.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:Mt,title:`Turn this lesson into a standing trial rule in user-rules.md`,children:`Promote to rule`}),(0,C.jsx)(`button`,{type:`button`,className:`btn ghost sm`,onClick:jt,children:`Forget this fact`})]}),G?.installs?.length>1&&G.installs.includes(G.install)?(0,C.jsxs)(`label`,{className:`row gap-8 lib-copy`,children:[(0,C.jsx)(`span`,{className:`dim`,children:`Install:`}),(0,C.jsx)(`select`,{className:`sel`,"aria-label":`Install`,value:U||G.install,onChange:e=>_e({sec:x,name:B,key:e.target.value}),children:G.installs.map(e=>(0,C.jsx)(`option`,{value:e,title:j(e).path,children:L(e)},e))}),(0,C.jsx)(`span`,{className:`dim`,children:`this entry only`})]}):null,(0,C.jsx)(`hr`,{className:`hr`}),V?(0,C.jsx)(ve,{loadout:ut?.own,base:ut?.base,error:dt,install:_t}):null,H?null:W?(0,C.jsxs)(`p`,{className:`sub`,children:[`No `,zt.replace(/s$/,``).toLowerCase(),` named `,(0,C.jsx)(`em`,{children:q.name}),` could be read in this install.`]}):q?.kind===`manifest`||G?.manifest!==void 0?G?(0,C.jsx)(me,{manifest:G.manifest,body:G.body,name:q.name}):(0,C.jsx)(u,{}):G?.body?(0,C.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,C.jsx)(S.Suspense,{fallback:null,children:(0,C.jsx)(xe,{body:Nt.body,links:G.links||[]})})}):G===null&&B?(0,C.jsx)(u,{}):(0,C.jsx)(Ae,{section:x,source:ke(x,q.name)}),Ie[x]?(0,C.jsx)(`div`,{className:`reader-links`,children:(0,C.jsxs)(`a`,{className:`btn ghost sm`,href:`#/docs/${Ie[x]}`,children:[`About `,zt.toLowerCase(),` in Docs`]})}):null]}):Ye?(0,C.jsx)(u,{}):null})]})]})}export{we as PRIMARY,Ne as bodyHead,Ve as default,Be as groupMemory,Oe as installLabel,j as installOfKey,ze as splitSkills,Fe as splitWhen};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{i as t,t as n}from"./react-C1iE8mnY.js";import{t as r}from"./api-DLDVY3K-.js";import{$ as i,J as a,St as o,Tt as s,et as c,mt as l,q as u,tt as d,wt as f}from"./index-Ce6qF2nG.js";import{t as p}from"./EmptyState-CY5Pm2xy.js";import{t as m}from"./CopyButton-Beven8yn.js";import{c as h,i as g,n as _,o as v,r as y,s as b,t as ee}from"./ActiveLoops-BJJN3P-V.js";import{t as x}from"./Markdown-CxkA7940.js";import{a as S,i as C,n as w,o as te,s as ne}from"./LibRows-Dag1s0ZX.js";import{i as T}from"./motion-RlUl1osO.js";var E=e(t(),1),D=n(),O=encodeURIComponent,k=f.loops.map(e=>[e,s[e]]),A={architecture:`Architecture`,tests:`Tests`,development:`Development`,refactoring:`Refactoring`,"day-to-day":`Day-to-day`},j={project:`Project`,global:`Global`,shipped:`Shipped`},M={templates:`Categories`,bricks:`Origins`,active:`Statuses`},N=[[`awaiting`,`Awaiting`],[`running`,`Running`],[`done`,`Done · stopped`],[`stopped`,`Done · stopped`],[`finished`,`Finished · unreadable`],[`unreadable`,`Finished · unreadable`]];function P(e,t){let n=e.filter(e=>e.startsWith(`${t} (`)).at(-1);return n?/(overrides \w+)\)$/.exec(n)?.[1]:null}var F=(e,t,n)=>n.flatMap(([n,r])=>e.filter(e=>t(e)===n).map(e=>({...e,group:r})));function I(e,t){let n=new Set(t.filter(e=>e.gate===`human`).map(e=>e.name));return F(e.map(e=>({...e,desc:e.description,human:e.graph.nodes.some(e=>n.has(e))})),e=>A[e.graph.category]?e.graph.category:`other`,[...Object.entries(A),[`other`,`Other`]])}function L(e,t){return F(e.map(e=>({...e,desc:e.description,override:P(t,e.name)})),e=>e.origin,Object.entries(j))}function R(e){return F(e.map(e=>({...e,name:e.root,desc:e.branch})),e=>e.status,N)}var z=(e,t)=>(0,D.jsx)(`span`,{className:`tag${e?` ${e}`:``}`,children:t},t),B={templates:e=>e.human?z(`human`,`human gate`):null,bricks:e=>[e.effect===`mutate`?z(`warn`,`mutate`):null,b(e)?z(`human`,`human gate`):null,e.override?z(`acc`,e.override):null,e.available===!1?z(`bad`,`unavailable`):null],active:e=>z(_[e.status],e.status)};function V({name:e,brick:t,override:n,on:r}){let i=`loop-brick${r?` on`:``}${!t||t.available===!1?` dimmed`:``}`;return t?(0,D.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,D.jsx)(`b`,{children:(0,D.jsx)(`a`,{href:`#/loops/bricks/${O(e)}`,children:e})}),z(t.effect===`mutate`?`warn`:``,t.effect),(0,D.jsx)(`span`,{className:`mono dim`,children:t.agent||t.skill}),(0,D.jsx)(`span`,{className:`panel-note`,children:t.outcomes.join(` · `)}),b(t)?z(`human`,b(t).toLowerCase()):null,n?z(`acc`,n):null]}):(0,D.jsxs)(`li`,{className:i,id:`brick-${e}`,children:[(0,D.jsx)(`b`,{children:e}),(0,D.jsx)(`span`,{className:`panel-note`,children:`Not in the catalogue: this template cannot run as is.`})]})}function H(e){let t=e.loops||[],n=t.find(e=>e.iteration),r=n?.nodes[0],i=t=>{let n=new Map;for(let r of e.edges.filter(t))n.set(r.from,[...n.get(r.from)||[],r.on]);return[...n].map(([e,t])=>`${e} says ${t.join(` or `)}`).join(`, `)},a=t=>{let i=e.edges.filter(e=>e.to===t);return!!n&&t!==r&&i.length>0&&i.every(e=>e.from===r)&&e.edges.some(e=>e.from===t&&e.to===`$close`)},o=[...new Set(e.edges.filter(e=>e.to===`$close`).map(e=>e.from))].map(e=>a(e)?`${i(t=>t.to===e)} → ${e}; ${i(t=>t.from===e&&t.to===`$close`)} → close`:`${i(t=>t.from===e&&t.to===`$close`)} → close`),s=t.filter(e=>!e.iteration).map(e=>`${e.nodes.join(e.nodes.length===2?` ⇄ `:` → `)}, max ${e.max}`),c=n?e.nodes.filter(e=>!n.nodes.includes(e)):[],l=i(e=>e.to===`$stop`);return[c.length&&[`Setup`,`${c.join(` → `)}, once.`],n?[`Iteration (max ${n.max})`,`${n.nodes.filter(e=>!a(e)).join(` → `)}.`]:[`Steps`,`${e.nodes.join(` → `)}.`],s.length&&[`Retry`,`${s.join(`; `)}.`],o.length&&[`Exit`,`${o.join(`; `)}.`],[`Stop`,`${l?`${l}, or `:``}any step says error → stop.`]].filter(Boolean)}function re({t:e,bricks:t,overridden:n,runs:r}){let[i,a]=(0,E.useState)(null),o=new Map(t.map(e=>[e.name,e])),s=H(e.graph),c=h(e.graph,t),l=c.mode===`ring`,u=`geneseed loop init --graph ${e.name} --title "<title>" --requirement "<requirement>"`,d=r?.filter(t=>y(t)&&t.graph.name===e.name).length;return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`reader-tags`,children:[(0,D.jsx)(`span`,{className:`tag acc`,children:`Template`}),A[e.graph.category]?z(``,A[e.graph.category]):null,e.human?z(`human`,`human gate`):null]}),(0,D.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,D.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,D.jsxs)(`p`,{className:`mono dim reader-src`,children:[`loops/`,e.name,`.json · `,e.origin]}),(0,D.jsx)(`hr`,{className:`hr`}),(0,D.jsxs)(`figure`,{className:`loop-console`,children:[(0,D.jsx)(`div`,{className:l?`loop-graph`:`loop-graph flow`,style:{"--loop-w":`${c.width}px`},children:(0,D.jsx)(v,{graph:e.graph,bricks:t,onSelect:e=>{a(e),document.getElementById(`brick-${e}`)?.scrollIntoView?.({behavior:T()?`smooth`:`auto`,block:`nearest`})}})}),(0,D.jsxs)(`figcaption`,{className:`loop-how`,children:[(0,D.jsx)(`span`,{className:`loop-kicker`,children:`How it runs`}),(0,D.jsx)(`ol`,{children:s.map(([e,t])=>(0,D.jsxs)(`li`,{children:[(0,D.jsxs)(`b`,{children:[e,`:`]}),` `,t]},e))}),l?(0,D.jsxs)(`span`,{className:`loop-legend`,children:[(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`i`,{className:`ring`,"aria-hidden":`true`}),`iteration`]}),s.some(([e])=>e===`Retry`)?(0,D.jsxs)(`span`,{children:[(0,D.jsx)(`i`,{className:`inner`,"aria-hidden":`true`}),`retry`]}):null]}):null]})]}),(0,D.jsxs)(`section`,{className:`loop-start`,"aria-labelledby":`loop-start-h`,children:[(0,D.jsxs)(`div`,{className:`loop-start-bar`,children:[(0,D.jsx)(`h3`,{id:`loop-start-h`,className:`loop-kicker`,children:`Start it in your project`}),(0,D.jsx)(m,{text:u,label:`Copy command`})]}),(0,D.jsx)(`pre`,{className:`mono`,children:u})]}),r?(0,D.jsxs)(`p`,{className:`panel-note loop-running`,children:[`Running now: `,d?`${d} of this template`:`none`,`.`,` `,d?(0,D.jsx)(`a`,{href:`#/loops/active`,children:`Open Active →`}):`A started loop appears under Active with its iteration and preset.`]}):null,e.graph.rules?.length?(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`h3`,{className:`loop-h2`,children:`Rules`}),(0,D.jsx)(`ul`,{className:`loop-rules`,"aria-label":`Rules every brick follows`,children:e.graph.rules.map(e=>(0,D.jsx)(`li`,{children:e},e))})]}):null,(0,D.jsx)(`h3`,{className:`loop-h2`,children:`Bricks`}),(0,D.jsx)(`ul`,{className:`loop-brick-list`,"aria-label":`Bricks in ${e.name}`,children:e.graph.nodes.map(e=>(0,D.jsx)(V,{name:e,brick:o.get(e),override:P(n,e),on:i===e},e))})]})}function U(e){return`---\n${[[`name`,e.name],[`description`,e.description],[`effect`,e.effect],[e.agent?`agent`:`skill`,e.agent||e.skill],[`gate`,e.gate],[`gateOn`,e.gateOn?.join(`, `)],[`outcomes`,e.outcomes.join(`, `)]].filter(([,e])=>e).map(([e,t])=>`${e}: ${t}`).join(`
|
|
2
|
+
`)}\n---\n${e.body}`}function W({b:e}){let[t,n]=(0,E.useState)(!1),r=[[`effect`,z(e.effect===`mutate`?`warn`:``,e.effect)],[e.agent?`agent`:`skill`,(0,D.jsx)(`span`,{className:`mono`,children:e.agent||e.skill},`who`)],[`outcomes`,e.outcomes.map(e=>z(``,e))],[`gate`,b(e)?z(`human`,b(e).toLowerCase()):`none`],[`origin`,e.override?`${e.origin}, ${e.override}`:e.origin],[`available`,e.available===!1?(0,D.jsxs)(`span`,{className:`t-warn`,children:[`no — `,e.reason]},`why`):`yes`]];return(0,D.jsxs)(D.Fragment,{children:[(0,D.jsxs)(`div`,{className:`reader-tags`,children:[(0,D.jsx)(`span`,{className:`tag acc`,children:`Brick`}),B.bricks(e)]}),(0,D.jsx)(`h2`,{className:`reader-title`,children:e.name}),e.description?(0,D.jsx)(`p`,{className:`reader-lede`,children:e.description}):null,(0,D.jsxs)(`p`,{className:`mono dim reader-src`,children:[`bricks/`,e.name,`.md`]}),(0,D.jsx)(`dl`,{className:`loop-facts`,children:r.map(([e,t])=>(0,D.jsxs)(E.Fragment,{children:[(0,D.jsx)(`dt`,{children:e}),(0,D.jsx)(`dd`,{children:t})]},e))}),(0,D.jsx)(`hr`,{className:`hr`}),(0,D.jsx)(`div`,{className:`row gap-8 loop-src-bar`,children:(0,D.jsx)(`button`,{type:`button`,className:`btn ghost sm`,"aria-expanded":t,onClick:()=>n(!t),children:t?`Hide source`:`View source`})}),t?(0,D.jsx)(`pre`,{className:`loop-brick-src`,"aria-label":`Source`,children:U(e)}):(0,D.jsx)(`div`,{className:`lib-doc detail-doc`,children:(0,D.jsx)(x,{body:e.body})})]})}function G({problems:e}){if(!e?.length)return null;let t=e.length;return(0,D.jsxs)(`div`,{className:`panel loop-problems`,role:`status`,"aria-label":`Catalogue files skipped`,children:[(0,D.jsxs)(`b`,{className:`t-warn`,children:[t,` catalogue `,t===1?`problem`:`problems`,`: these files were skipped`]}),(0,D.jsx)(`ul`,{className:`panel-note`,children:e.map(e=>(0,D.jsx)(`li`,{className:`mono`,children:e},e))})]})}var K={templates:{title:`No templates`,body:(0,D.jsxs)(D.Fragment,{children:[`Add one under `,(0,D.jsx)(`code`,{className:`mono`,children:`.geneseed/loops/`}),` in the repo.`]})},bricks:{title:`No bricks`,body:(0,D.jsxs)(D.Fragment,{children:[`Add one under `,(0,D.jsx)(`code`,{className:`mono`,children:`.geneseed/bricks/`}),` in the repo.`]})},active:{title:`No loops yet`,body:(0,D.jsxs)(D.Fragment,{children:[`Start one with `,(0,D.jsx)(`code`,{className:`mono`,children:`geneseed loop init`}),` in a worktree, or ask the agent to run a loop. It shows up here while it runs.`]})}},q={templates:(0,D.jsxs)(D.Fragment,{children:[`A template wires bricks into a loop. `,(0,D.jsx)(`a`,{href:`#/docs/loops`,children:`How loops work →`}),` `,(0,D.jsx)(`a`,{href:`#/docs/loop-which-template`,children:`Which template? →`})]}),bricks:(0,D.jsxs)(D.Fragment,{children:[`A brick is one step: a skill or agent and its outcomes.`,` `,(0,D.jsx)(`a`,{href:`#/docs/loop-bricks`,children:`About bricks →`})]}),active:(0,D.jsxs)(D.Fragment,{children:[`Loops registered on this machine, read from their LOOP.md.`,` `,(0,D.jsx)(`a`,{href:`#/docs/loop-running`,children:`Running a loop →`})]})};function J({tab:e=`templates`,item:t,dataRev:n}){let s=a(n),[f,m]=u(`loops`,s),{data:h,error:_}=o(()=>r.loops(l(f)),[n,f?.id??``],`loops`),v=g(),[b,x]=(0,E.useState)(``),[T,A]=(0,E.useState)(`all`),[j,N]=(0,E.useState)(e);e!==j&&(N(e),x(``),A(`all`));let P=h?.bricks||[],F=e===`active`?v.loops&&R(v.loops):h&&(e===`bricks`?L(h.bricks,h.overridden):I(h.templates,h.bricks)),z=F||[],V=ne(z),H=T===`all`?z:z.filter(e=>e.group===T),U=b.trim(),J=S(H,U),Y=!!(t&&F&&!z.some(e=>e.name===t)),X=Y?null:z.find(e=>e.name===t)||e===`active`&&z.find(y)||z[0]||null,Z={templates:h?.templates.length,bricks:h?.bricks.length,active:v.loops?.length},Q=k.find(([t])=>t===e)[1],$=e===`active`?v.error:_;return(0,D.jsxs)(`div`,{className:`lib-wrap`,children:[e===`active`?null:(0,D.jsx)(d,{className:`page-pick`,installs:s,value:f,onChange:m}),(0,D.jsx)(i,{error:$,style:{margin:`0 0 var(--sp-3)`}}),(0,D.jsx)(G,{problems:h?.problems}),(0,D.jsxs)(`div`,{className:`library`,children:[(0,D.jsxs)(`aside`,{className:`lib-kinds`,"aria-label":`Loops sections`,children:[(0,D.jsxs)(`div`,{className:`lib-title`,children:[(0,D.jsx)(`h1`,{className:`h`,children:`Loops`}),(0,D.jsx)(`span`,{className:`dim`,children:`What the engine runs`})]}),(0,D.jsx)(`p`,{className:`panel-note lib-lede`,children:q[e]}),(0,D.jsx)(`nav`,{className:`kind-list`,"aria-label":`Sections`,children:k.map(([t,n])=>(0,D.jsxs)(E.Fragment,{children:[(0,D.jsxs)(`a`,{href:`#/loops/${t}`,className:e===t?`on`:``,"aria-current":e===t?`page`:void 0,children:[n,(0,D.jsx)(`span`,{className:`mono dim`,children:Z[t]??``})]}),e===t&&(0,D.jsx)(te,{label:M[t],total:z.length,cats:V,cat:T,onChange:A})]},t))})]}),(0,D.jsx)(C,{label:Q,count:U?`${J.length} of ${H.length}`:F?H.length:``,q:b,onQ:x,matched:J.length,inView:[e,t],current:X?.name,sections:k.map(([t,n])=>({key:t,label:n,n:Z[t],href:`#/loops/${t}`,on:e===t})),cats:V,cat:T,total:z.length,onCat:A,catLabel:M[e],children:F?z.length===0?(0,D.jsx)(p,{title:K[e].title,children:K[e].body}):(0,D.jsx)(w,{rows:J,activeName:X?.name,hrefOf:t=>`#/loops/${e}/${O(t.name)}`,pills:B[e]}):$?null:(0,D.jsx)(c,{})}),(0,D.jsx)(`article`,{className:`lib-reader`,"aria-label":`Entry`,children:Y?(0,D.jsx)(p,{title:(0,D.jsxs)(D.Fragment,{children:[(0,D.jsx)(`code`,{className:`mono`,children:t}),` is not registered any more.`]}),docs:{href:`#/loops/${e}`,label:`All ${Q.toLowerCase()} →`}}):X?e===`active`?(0,D.jsx)(ee,{loop:X,bricks:P,onPreset:v.onPreset}):e===`bricks`?(0,D.jsx)(W,{b:X}):(0,D.jsx)(re,{t:X,bricks:P,overridden:h.overridden,runs:v.loops},X.name):e===`active`&&F?(0,D.jsx)(p,{title:`What is a loop?`,docs:{href:`#/docs/loops`,label:`How loops work →`},children:`A loop runs bricks in a ring until its gate passes.`}):null})]})]})}export{R as activeRows,L as brickRows,U as brickSource,J as default,H as howItRuns,I as templateRows};
|
|
@@ -0,0 +1,71 @@
|
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-XKyaHtl9.js";import{i as n,t as r}from"./react-C1iE8mnY.js";var i=t(n(),1);function a(){return{async:!1,breaks:!1,extensions:null,gfm:!0,hooks:null,pedantic:!1,renderer:null,silent:!1,tokenizer:null,walkTokens:null}}var o=a();function s(e){o=e}var c={exec:()=>null};function l(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 u(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(f.caret,`$1`),n=n.replace(e,i),r},getRegex:()=>new RegExp(n,t)};return r}var d=((e=``)=>{try{return!!RegExp(`(?<=1)(?<!1)`+e)}catch{return!1}})(),f={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}((?:=+|-+)[ \t]*)(?=\n|$)/g,blockquoteSetextReplace2:/^ {0,3}>[ \t]?/gm,blockquoteMarkerWhitespace:/^( {0,3}>)([ \t]+)/gm,listReplaceNesting:/^ {1,4}(?=( {4})*[^ ])/g,listIsTask:/^\[[ xX]\][ \t]+\S/,listReplaceTask:/^\[[ xX]\][ \t]+/,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:l(e=>RegExp(`^ {0,${e}}(?:[*+-]|\\d{1,9}[.)])((?:[ ][^\\n]*)?(?:\\n|$))`)),hrRegex:l(e=>RegExp(`^ {0,${e}}((?:-[ ]*){3,}|(?:_[ ]*){3,}|(?:\\*[ ]*){3,})(?:\\n+|$)`)),fencesBeginRegex:l(e=>RegExp(`^ {0,${e}}(?:\`\`\`|~~~)`)),headingBeginRegex:l(e=>RegExp(`^ {0,${e}}#{1,6}(?:\\s|$)`)),pedanticHeadingBeginRegex:l(e=>RegExp(`^ {0,${e}}#`)),htmlBeginRegex:l(e=>RegExp(`^ {0,${e}}(?:</?(?:${C})(?: +|$|/?>)|<(?:(?:script|pre|style|textarea)(?:[\\s>]|$)|!--)|<\\?|<![A-Za-z]|<!\\[CDATA\\[)`,`i`)),blockquoteBeginRegex:l(e=>RegExp(`^ {0,${e}}>`))},p=/^(?:[ \t]*(?:\n|$))+/,m=/^((?: {4}| {0,3}\t)[^\n]+(?:\n(?:[ \t]*(?:\n|$))*)?)+/,h=/^ {0,3}(`{3,}(?=[^`\n]*(?:\n|$))|~{3,})([^\n]*)(?:\n|$)(?:|([\s\S]*?)(?:\n|$))(?: {0,3}(?:(?=`)\1`*|(?=~)\1~*) *(?=\n|$)|$)/,g=/^ {0,3}((?:-[\t ]*){3,}|(?:_[ \t]*){3,}|(?:\*[ \t]*){3,})(?:\n+|$)/,_=/^ {0,3}(#{1,6})(?=\s|$)(.*)(?:\n+|$)/,v=/ {0,3}(?:[*+-]|\d{1,9}[.)])/,y=/^(?!bull |blockCode|fences|blockquote|heading|html|table)((?:.|\n(?!\s*?\n|bull |fences|blockquote|heading|hr|html|table))+?)\n {0,3}(=+|-+)[ \t]*(?:\n+|$)/,b=u(y).replace(/bull/g,v).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(),ee=u(y).replace(/bull/g,v).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(),x=/^([^\n]+(?:\n(?!hr|heading|lheading|blockquote|fences|list|html|table|[ \t]+\n)[^\n]+)*)/,te=/^[^\n]+/,S=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\\n]|\n(?![ \t]*\n))+/,ne=u(/^ {0,3}\[(label)\]: *(?:\n[ \t]*)?([^<\s][^\s]*|<.*?>)(?:(?: +(?:\n[ \t]*)?| *\n[ \t]*)(title))? *(?:\n+|$)/).replace(`label`,S).replace(`title`,/(?:"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\\n]|\n(?!\n))*'|\((?:\\[\s\S]|[^()\\])*\))/).getRegex(),re=u(/^(bull)([ \t][^\n]*?)?(?:\n|$)/).replace(/bull/g,v).getRegex(),C=`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`,w=/<!--(?:-?>|[\s\S]*?(?:-->|$))/,ie=u(`^ {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)(?:[ \\t]+|\\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`,w).replace(`tag`,C).replace(`attribute`,/ +[a-zA-Z:_][\w.:-]*(?: *= *"[^"\n]*"| *= *'[^'\n]*'| *= *[^\s"'=<>`]+)?/).getRegex(),ae=e=>u(x).replace(`hr`,g).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`,C).getRegex(),oe=ae(/ {0,3}(?:[*+-]|1[.)])[ \t]+[^ \t\n]/),se=ae(/ {0,3}(?:[*+-]|\d{1,9}[.)])(?:[ \t]|\n|$)/),T={blockquote:u(/^( {0,3}> ?(?:(?![ \t]*(?:\n|$))(paragraph)|[^\n]*)(?:\n|$))+/).replace(`paragraph`,se).getRegex(),code:m,def:ne,fences:h,heading:_,hr:g,html:ie,lheading:b,list:re,newline:p,paragraph:oe,table:c,text:te},ce=u(`^ *([^\\n ].*)\\n {0,3}((?:\\| *)?:?-+:? *(?:\\| *:?-+:? *)*(?:\\| *)?)(?:\\n((?:(?! *\\n|hr|heading|blockquote|code|fences|list|html).*(?:\\n|$))*)\\n*|$)`).replace(`hr`,g).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`,C).getRegex(),le={...T,lheading:ee,table:ce,paragraph:u(x).replace(`hr`,g).replace(`heading`,` {0,3}#{1,6}(?:\\s|$)`).replace(`|lheading`,``).replace(`table`,ce).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`,C).getRegex()},ue={...T,html:u(`^ *(?:comment(?: *\\n|\\s*$)|<(tag)[\\s\\S]+?</\\1>(?: *\\n{2,}|\\s*$)|<tag(?:"[^"]*"|'[^']*'|\\s[^'"/>\\s]*)*?/?>(?: *\\n{2,}|\\s*$))`).replace(`comment`,w).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:c,lheading:/^(.+?)\n {0,3}(=+|-+) *(?:\n+|$)/,paragraph:u(x).replace(`hr`,g).replace(`heading`,` *#{1,6} *[^
|
|
2
|
+
]`).replace(`lheading`,b).replace(`|table`,``).replace(`blockquote`,` {0,3}>`).replace(`|fences`,``).replace(`|list`,``).replace(`|html`,``).replace(`|tag`,``).getRegex()},de=/^\\([!"#$%&'()*+,\-./:;<=>?@\[\]\\^_`{|}~])/,fe=/^(`+)([^`]|[^`][\s\S]*?[^`])\1(?!`)/,E=/^( {2,}|\\)\n(?!\s*$)[ \t]*/,pe=/^(`+|[^`])(?:(?= {2,}\n)|[\s\S]*?(?:(?=[\\<!\[`*_]|\b_|$)|[^ ](?= {2,}\n)))/,D=/[\p{P}\p{S}]/u,O=/[\s\p{P}\p{S}]/u,k=/[^\s\p{P}\p{S}]/u,me=u(/^((?![*_])punctSpace)/,`u`).replace(/punctSpace/g,O).getRegex(),he=/[\p{Pi}\p{Ps}"']/u,ge=/(?!~)[\p{P}\p{S}]/u,_e=/(?!~)[\s\p{P}\p{S}]/u,ve=/(?:[^\s\p{P}\p{S}]|~)/u,ye=u(/link|precode-code|html/,`g`).replace(`link`,/\[(?:[^\[\]`]|(?<a>`+)[^`]+\k<a>(?!`))*?\]\((?:\\[\s\S]|[^\\\(\)]|\((?:\\[\s\S]|[^\\\(\)])*\))*\)/).replace(`precode-`,d?"(?<!`)()":"(^^|[^`])").replace(`code`,/(?<b>`+)[^`]+\k<b>(?!`)/).replace(`html`,/<(?! )[^<>]*?>/).getRegex(),be=/^(?:\*+(?:((?!\*)punct)|([^\s*]))?)|^_+(?:((?!_)punct)|([^\s_]))?/,xe=u(be,`u`).replace(/punct/g,D).getRegex(),Se=u(be,`u`).replace(/punct/g,ge).getRegex(),Ce=u(/^(?:\*+(?:((?!\*)(?!openQuote)punct)|([^\s*]))?)|^_+(?:((?!_)(?!openQuote)punct)|([^\s_]))?/,`u`).replace(/openQuote/g,he).replace(/punct/g,D).getRegex(),we=`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)punctSpace(\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|notPunctSpace(\\*+)(?=notPunctSpace)`,Te=u(we,`gu`).replace(/notPunctSpace/g,k).replace(/punctSpace/g,O).replace(/punct/g,D).getRegex(),Ee=u(we,`gu`).replace(/notPunctSpace/g,ve).replace(/punctSpace/g,_e).replace(/punct/g,ge).getRegex(),De=u(`^[^_*]*?__[^_*]*?\\*[^_*]*?(?=__)|[^*]+(?=[^*])|(?!\\*)punct(\\*+)(?=[\\s]|$)|notPunctSpace(\\*+)(?!\\*)(?=punctSpace|$)|(?!\\*)[\\s](\\*+)(?=notPunctSpace)|[\\s](\\*+)(?!\\*)(?=punct)|(?!\\*)punct(\\*+)(?!\\*)(?=punct)|(?:(?!\\*)punct|notPunctSpace)(\\*+)(?!\\*)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,k).replace(/punctSpace/g,O).replace(/punct/g,D).getRegex(),Oe=u(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)punctSpace(_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)`,`gu`).replace(/notPunctSpace/g,k).replace(/punctSpace/g,O).replace(/punct/g,D).getRegex(),ke=u(`^[^_*]*?\\*\\*[^_*]*?_[^_*]*?(?=\\*\\*)|[^_]+(?=[^_])|(?!_)punct(_+)(?=[\\s]|$)|notPunctSpace(_+)(?!_)(?=punctSpace|$)|(?!_)[\\s](_+)(?=notPunctSpace)|[\\s](_+)(?!_)(?=punct)|(?!_)punct(_+)(?!_)(?=punct)|(?:(?!_)punct|notPunctSpace)(_+)(?!_)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,k).replace(/punctSpace/g,O).replace(/punct/g,D).getRegex(),Ae=u(/^~~?(?:((?!~)punct)|[^\s~])/,`u`).replace(/punct/g,D).getRegex(),je=u(`^[^~]+(?=[^~])|(?!~)punct(~~?)(?=[\\s]|$)|notPunctSpace(~~?)(?!~)(?=punctSpace|$)|(?!~)punctSpace(~~?)(?=notPunctSpace)|[\\s](~~?)(?!~)(?=punct)|(?!~)punct(~~?)(?!~)(?=punct)|notPunctSpace(~~?)(?=notPunctSpace)`,`gu`).replace(/notPunctSpace/g,k).replace(/punctSpace/g,O).replace(/punct/g,D).getRegex(),Me=u(/\\(punct)/,`gu`).replace(/punct/g,D).getRegex(),Ne=u(/(`+)(?:[^`]|[^`][\s\S]*?[^`])\1(?!`)|`+|\\(punct)/,`gu`).replace(/punct/g,D).getRegex(),Pe=u(/^<(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(),Fe=u(w).replace(`(?:-->|$)`,`-->`).getRegex(),Ie=u(`^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`,Fe).replace(`attribute`,/\s+[a-zA-Z:_][\w.:-]*(?:\s*=\s*"[^"]*"|\s*=\s*'[^']*'|\s*=\s*[^\s"'=<>`]+)?/).getRegex(),Le=/\[(?:\\[\s\S]|[^\[\]\\])*\]/,A=u(/(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\])|[^\[\]\\`])*?/).replace(`brackets`,Le).getRegex(),Re=u(/^!?\[(label)\]\([ \t\n]*(href)(?:(?:[ \t]+(?:\n[ \t]*)?|\n[ \t]*)(title))?[ \t\n]*\)/).replace(`label`,A).replace(`href`,/<(?:\\.|[^\n<>\\])+>|[^ \t\n\x00-\x1f]+|(?=\))/).replace(`title`,/"(?:\\[\s\S]|[^"\\])*"|'(?:\\[\s\S]|[^'\\])*'|\((?:\\[\s\S]|[^)\\])*\)/).getRegex(),ze=u(/^!?\[(label)\]\[(ref)\]/).replace(`label`,A).replace(`ref`,S).getRegex(),Be=u(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,S).getRegex(),Ve=/(?!\s*\])(?:\\[\s\S]|[^\[\]\\]){1,999}/,He=u(/(?:[^\[\]\\`]*(?:\[(?:brackets|\\[\s\S]|[^\[\]\\])*\]|\\[\s\S]|`+(?!`)[^`]*?`+(?!`)|``+(?=\]))){0,999}?[^\[\]\\`]*?/).replace(`brackets`,Le).getRegex(),Ue=u(`reflink|nolink(?!\\()`,`g`).replace(`reflink`,u(/^!?\[(label)\]\[(ref)\]/).replace(`label`,He).replace(`ref`,Ve).getRegex()).replace(`nolink`,u(/^!?\[(ref)\](?:\[\])?/).replace(`ref`,Ve).getRegex()).getRegex(),We=/[hH][tT][tT][pP][sS]?|[fF][tT][pP]/,Ge=u(/(?: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(),j={_backpedal:c,anyPunctuation:Me,anyPunctuationOutsideCode:Ne,autolink:Pe,blockSkip:ye,br:E,code:fe,del:c,delLDelim:c,delRDelim:c,emStrongLDelim:xe,emStrongRDelimAst:Te,emStrongRDelimUnd:Oe,escape:de,link:Re,nolink:Be,punctuation:me,reflink:ze,reflinkSearch:Ue,tag:Ie,text:pe,url:c},Ke={...j,emStrongLDelim:Ce,emStrongRDelimAst:De,emStrongRDelimUnd:ke,link:u(/^!?\[(label)\]\((.*?)\)/).replace(`label`,A).getRegex(),reflink:u(/^!?\[(label)\]\s*\[([^\]]*)\]/).replace(`label`,A).getRegex()},M={...j,emStrongRDelimAst:Ee,emStrongLDelim:Se,delLDelim:Ae,delRDelim:je,url:u(/^emailProtocol|^((?:protocol):\/\/|www\.)(?:[a-zA-Z0-9\-]+\.?)+[^\s<]*|^email/).replace(`emailProtocol`,Ge).replace(`protocol`,We).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:u(/^(?:[^a-zA-Z0-9](?=emailProtocol)|(`+|~+|[^`~])(?:(?=[`~])|(?= {2,}\n)|(?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@)|[\s\S]*?(?:(?=[\\<!\[`*~_]|\b_|protocol:\/\/|wwwStart|$)|[^ ](?= {2,}\n)|[^a-zA-Z0-9](?=emailProtocol)|[^a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-](?=[a-zA-Z0-9.!#$%&'*+\/=?_`{\|}~-]+@))))/).replace(`protocol`,We).replace(/emailProtocol/g,/(?:mailto|xmpp):/).replace(`wwwStart`,d?`(?<![^\\s*_~(])www\\.`:`www\\.`).getRegex()},qe={...M,br:u(E).replace(`{2,}`,`*`).getRegex(),text:u(M.text).replace(`\\b_`,`\\b_| {2,}\\n`).replace(/\{2,\}/g,`*`).getRegex()},N={normal:T,gfm:le,pedantic:ue},P={normal:j,gfm:M,breaks:qe,pedantic:Ke},Je={"&":`&`,"<":`<`,">":`>`,'"':`"`,"'":`'`},Ye=e=>Je[e];function F(e,t){if(t){if(f.escapeTest.test(e))return e.replace(f.escapeReplace,Ye)}else if(f.escapeTestNoEncode.test(e))return e.replace(f.escapeReplaceNoEncode,Ye);return e}function Xe(e){return f.numericCharacterReference.test(e)?e.replace(f.numericCharacterReferenceOrAmpersand,(e,t,n)=>{if(t===void 0&&n===void 0)return`&`;let r=t===void 0?Number.parseInt(n,16):Number.parseInt(t,10);return r===0||r>1114111||r>=55296&&r<=57343?`�`:r===38?`&`:String.fromCodePoint(r)}):e}function I(e){try{e=encodeURI(e).replace(f.percentDecode,`%`)}catch{return null}return e}function Ze(e,t){let n=e.replace(f.findPipe,(e,t,n)=>{let r=!1,i=t;for(;--i>=0&&n[i]===`\\`;)r=!r;return r?`|`:` |`}).split(f.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(f.slashPipe,`|`);return n}function L(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 R(e){let t=e.split(`
|
|
3
|
+
`),n=t.length-1;for(;n>=0&&f.blankLine.test(t[n]);)n--;return t.length-n<=2?e:t.slice(0,n+1).join(`
|
|
4
|
+
`)}function z(e){return e.trim().replace(f.multipleSpaceGlobal,` `).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}var B=new WeakMap;function V(e){let t={"*":-1,_:-1},n=-1,r=e.length;for(let i=0;i<r;i++){let a=e[i];if(a!==`*`&&a!==`_`&&a!==`~`)continue;let o=i===0?`
|
|
5
|
+
`:e[i-1],s=i+1;for(;s<r&&e[s]===a;)s++;o!==` `&&o!==` `&&o!==`
|
|
6
|
+
`&&o!==`\r`&&o!==`\f`&&(a===`~`?n=i:t[a]=i),i=s-1}return{maskedSrc:e,lastPossibleEmStrongCloserIndex:t,lastPossibleDelCloserIndex:n}}function $e(e,t){let n=V(t),r=B.get(e);r?r.push(n):B.set(e,[n])}function et(e){let t=B.get(e);t&&(t.pop(),t.length===0&&B.delete(e))}function tt(e,t,n){let r=B.get(e)?.at(-1);return r&&r.maskedSrc===t?r.lastPossibleEmStrongCloserIndex[n]:V(t).lastPossibleEmStrongCloserIndex[n]}function nt(e,t){let n=B.get(e)?.at(-1);return n&&n.maskedSrc===t?n.lastPossibleDelCloserIndex:V(t).lastPossibleDelCloserIndex}function H(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 rt(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 it(e,t,n){let r=e.match(n.other.indentCodeCompensation);if(r===null)return t;let i=r[1];return t.split(`
|
|
7
|
+
`).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(`
|
|
8
|
+
`)}function at(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 U=class{options;rules;lexer;constructor(e){this.options=e||o}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]:R(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=it(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=L(e,`#`);(this.options.pedantic||!t||this.rules.other.endingSpaceTabChar.test(t))&&(e=t.trim())}return{type:`heading`,raw:L(t[0],`
|
|
9
|
+
`),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:L(t[0],`
|
|
10
|
+
`)}}blockquote(e){let t=this.rules.block.blockquote.exec(e);if(t){let e=L(t[0],`
|
|
11
|
+
`).split(`
|
|
12
|
+
`),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(`
|
|
13
|
+
`),c=s.replace(this.rules.other.blockquoteMarkerWhitespace,(e,t,n)=>t+H(n,t.length)).replace(this.rules.other.blockquoteSetextReplace,`
|
|
14
|
+
$1`).replace(this.rules.other.blockquoteSetextReplace2,``);n=n?`${n}
|
|
15
|
+
${s}`:s,r=r?`${r}
|
|
16
|
+
${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`||u?.type===`table`)break;if(u?.type===`blockquote`){let t=u,a=e.join(`
|
|
17
|
+
`),o=t.raw+`
|
|
18
|
+
`+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(`
|
|
19
|
+
`).length:0,d=l?e.slice(0,-l):e;if(d.length>0&&(n=`${n}
|
|
20
|
+
${d.join(`
|
|
21
|
+
`)}`),r=r.substring(0,r.length-t.text.length)+s.text,e=e.slice(d.length),e.length>0&&this.rules.other.blockquoteStart.test(e[0]))continue;break}if(u?.type===`list`){let t=u,a=t.raw+`
|
|
22
|
+
`+e.join(`
|
|
23
|
+
`),o=this.list(a);i[i.length-1]=o;let s=o.raw.length>t.raw.length?a.slice(t.raw.length+1,o.raw.length).split(`
|
|
24
|
+
`).length:0;if(s>0){let t=e.slice(0,s).join(`
|
|
25
|
+
`);n=`${n}
|
|
26
|
+
${t}`,r=`${r}
|
|
27
|
+
${t}`}e=e.slice(s)}}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(`
|
|
28
|
+
`,1)[0],d=t[1].length,f=this.options.pedantic?H(u,d):u.replace(this.rules.other.leadingSpaceTab,e=>H(e,d)),p=e.split(`
|
|
29
|
+
`,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.options.pedantic?this.rules.other.pedanticHeadingBeginRegex(h):this.rules.other.headingBeginRegex(h),o=this.rules.other.htmlBeginRegex(h),s=this.rules.other.blockquoteBeginRegex(h);for(;e;){let c=e.split(`
|
|
30
|
+
`,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=>H(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+=`
|
|
31
|
+
`+l.slice(h);else{if(m||f.replace(this.rules.other.tabCharGlobal,` `).search(this.rules.other.nonSpaceChar)>=4||r.test(f)||i.test(f)||o.test(f)||n.test(f))break;let e=!this.options.pedantic&&/^ {0,3}(?:=+|-+) *$/.test(p)&&this.rules.block.lheading.test(`${f}
|
|
32
|
+
${p}`)?` ${l.replace(/^ {0,3}/,``)}`:p;a+=`
|
|
33
|
+
`+e}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=R(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=z(t[1]),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:L(t[0],`
|
|
34
|
+
`),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=Ze(t[1]),r=t[2].replace(this.rules.other.tableAlignChars,``).split(`|`),i=t[3]?.trim()?t[3].replace(this.rules.other.tableRowBlankLine,``).split(`
|
|
35
|
+
`):[],a={type:`table`,raw:L(t[0],`
|
|
36
|
+
`),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(Ze(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:L(t[0],`
|
|
37
|
+
`),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)===`
|
|
38
|
+
`?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&&at(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=L(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=L(t[0].slice(0,-1),`\\`);if((t[0].length-i.length)%2==0)return;let a=t[2],o=``;if(this.options.pedantic){let e=this.rules.other.pedanticHrefTitle.exec(a);e&&(a=e[1],o=e[3])}else o=t[3]?t[3].slice(1,-1):``;return a=a.trim(),this.rules.other.startAngleBracket.test(a)&&(a=this.options.pedantic&&!this.rules.other.endAngleBracket.test(r)?a.slice(1):a.slice(1,-1)),rt(t,{href:a&&a.replace(this.rules.inline.anyPunctuation,`$1`),title:o&&o.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&&at(e,n[1],r,this.rules))return;let i=t[z(n[2]||n[1])];if(!i){let e=n[0].charAt(0);return{type:`text`,raw:e,text:e}}return rt(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])return;let i=r[0][0],a=n===i,o=t.length-e.length,s=o;for(;!this.options.pedantic&&s>0&&t[s-1]===i;)s--;let c=[...t.slice(Math.max(0,s-2),s)].at(-1)??``,l=c===`*`||c===`_`||!!this.rules.inline.punctuation.exec(c);s<o&&(n=c);let u=s<o?l:!!this.rules.inline.punctuation.exec(n);if(r[4]&&n.match(this.rules.other.unicodeAlphaNumeric))return;let d=r[1]||r[3]||``;if(!d||!n||u){let n=[...r[0]].length-1,u,f,p=n,m=0,h=o-s+n,g=!this.options.pedantic&&!!c.trim()&&(!!d||i===`*`&&!l);if(i!==`*`&&i!==`_`)return;let _=i===`*`?this.rules.inline.emStrongRDelimAst:this.rules.inline.emStrongRDelimUnd,v=tt(this,t,i),y=t.length-e.length+n;if(v<y)return;t=t.slice(-1*e.length+n);let b=v-y;for(_.lastIndex=0;(r=_.exec(t))!==null&&!(r.index>b);){if(u=r[1]||r[2]||r[3]||r[4]||r[5]||r[6],!u)continue;if(f=[...u].length,r[3]||r[4]){p+=f;continue}if(r[5]||r[6]||g){if(a&&(r[5]||r[6]))break;if(h%3&&!((h+f)%3)){m+=f;continue}}if(p-=f,p>0)continue;f=Math.min(f,f+p+m);let t=[...r[0]][0].length,i=e.slice(0,n+r.index+t+f);if(Math.min(n,f)%2){let e=i.slice(1,-1);return{type:`em`,raw:i,text:e,tokens:this.lexer.inlineTokens(e)}}let o=i.slice(2,-2);return{type:`strong`,raw:i,text:o,tokens:this.lexer.inlineTokens(o)}}}}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,c=nt(this,t),l=t.length-e.length+n;if(c<l)return;t=t.slice(-1*e.length+n);let u=c-l;for(s.lastIndex=0;(r=s.exec(t))!==null&&!(r.index>u);){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]:Xe(t[0]),escaped:e}}}},W=class e{tokens;options;state;inlineQueue;tokenizer;constructor(e){this.tokens=[],this.tokens.links=Object.create(null),this.options=e||o,this.options.tokenizer=this.options.tokenizer||new U,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:f,block:N.normal,inline:P.normal};this.options.pedantic?(t.block=N.pedantic,t.inline=P.pedantic):this.options.gfm&&(t.block=N.gfm,t.inline=this.options.breaks?P.breaks:P.gfm),this.tokenizer.rules=t}static get rules(){return{block:N,inline:P}}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(f.carriageReturn,`
|
|
39
|
+
`),this.blockTokens(e,this.tokens);for(let e=0;e<this.inlineQueue.length;e++){let t=this.inlineQueue[e];this.state.inRawBlock=!1,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(f.tabCharGlobal,` `).replace(f.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+=`
|
|
40
|
+
`: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(`
|
|
41
|
+
`)?``:`
|
|
42
|
+
`)+i.raw,n.text+=`
|
|
43
|
+
`+i.text,this.inlineQueue.at(-1).src=n.text):t.push(i);continue}if((i=this.tokenizer.fences(e))||(i=this.tokenizer.heading(e))||(i=this.tokenizer.hr(e))||(i=this.tokenizer.blockquote(e))||(i=this.tokenizer.list(e))||(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(`
|
|
44
|
+
`)?``:`
|
|
45
|
+
`)+i.raw,n.text+=`
|
|
46
|
+
`+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))||(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(`
|
|
47
|
+
`)?``:`
|
|
48
|
+
`)+i.raw,r.text+=`
|
|
49
|
+
`+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)}else 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(`
|
|
50
|
+
`)?``:`
|
|
51
|
+
`)+i.raw,n.text+=`
|
|
52
|
+
`+i.text,this.inlineQueue.pop(),this.inlineQueue.at(-1).src=n.text):t.push(i)}else 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,z(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.includes(`*`)||e.includes(`_`)||e.includes(`~`)||this.options.hooks?.emStrongMask||this.tokenizer.emStrong!==U.prototype.emStrong||this.tokenizer.del!==U.prototype.del?this.#n(e):e;$e(this.tokenizer,n);try{return this.#t(e,n,t)}finally{et(this.tokenizer)}}#t(e,t,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(t=>(o=t.call({lexer:this},e,n))?(e=e.substring(o.raw.length),n.push(o),!0):!1))continue;if((o=this.tokenizer.escape(e))||(o=this.tokenizer.tag(e))||(o=this.tokenizer.link(e))){e=e.substring(o.raw.length),n.push(o);continue}if(o=this.tokenizer.reflink(e,this.tokens.links)){e=e.substring(o.raw.length);let t=n.at(-1);o.type===`text`&&t?.type===`text`?(t.raw+=o.raw,t.text+=o.text):n.push(o);continue}if((o=this.tokenizer.emStrong(e,t,i))||(o=this.tokenizer.codespan(e))||(o=this.tokenizer.br(e))||(o=this.tokenizer.del(e,t,i))||(o=this.tokenizer.autolink(e))||!this.state.inLink&&(o=this.tokenizer.url(e))){e=e.substring(o.raw.length),n.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 t=n.at(-1);t?.type===`text`?(t.raw+=o.raw,t.text+=o.text):n.push(o)}else if(e){this.infiniteLoopError(e.charCodeAt(0));break}}return n}#n(e){let t=e;if(this.tokens.links&&e.includes(`[`)){let e=this.tokenizer.rules.inline.reflinkSearch,n=t=>{let r=t.lastIndexOf(`[`);if(!Object.hasOwn(this.tokens.links,z(t.slice(r+1,-1))))return t;if(r>1&&t.charAt(0)!==`!`){let i=t.slice(1,r-1);if(this.linkInText(i))return`[`+i.replace(e,n)+`][`+`a`.repeat(t.length-r-2)+`]`}return`[`+`a`.repeat(t.length-2)+`]`};t=t.replace(e,n)}return t=t.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),t=t.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)+`]`}),t=this.options.hooks?.emStrongMask?.call({lexer:this},t)??t,t}infiniteLoopError(e){let t=`Infinite loop on byte: `+e;if(this.options.silent)console.error(t);else throw Error(t)}},G=class{options;parser;constructor(e){this.options=e||o}space(e){return``}code({text:e,lang:t,escaped:n}){let r=(t||``).match(f.notSpaceStart)?.[0],i=e?e.replace(f.endingNewline,``)+`
|
|
53
|
+
`:``;return r?`<pre><code class="language-`+F(r)+`">`+(n?i:F(i,!0))+`</code></pre>
|
|
54
|
+
`:`<pre><code>`+(n?i:F(i,!0))+`</code></pre>
|
|
55
|
+
`}blockquote({tokens:e}){return`<blockquote>
|
|
56
|
+
${this.parser.parse(e)}</blockquote>
|
|
57
|
+
`}html({text:e}){return e}def(e){return``}heading({tokens:e,depth:t}){return`<h${t}>${this.parser.parseInline(e)}</h${t}>
|
|
58
|
+
`}hr(e){return`<hr>
|
|
59
|
+
`}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+`>
|
|
60
|
+
`+r+`</`+i+`>
|
|
61
|
+
`}listitem(e){return`<li>${this.parser.parse(e.tokens)}</li>
|
|
62
|
+
`}checkbox({checked:e}){return`<input `+(e?`checked="" `:``)+`disabled="" type="checkbox"> `}paragraph({tokens:e}){return`<p>${this.parser.parseInline(e)}</p>
|
|
63
|
+
`}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>
|
|
64
|
+
<thead>
|
|
65
|
+
`+t+`</thead>
|
|
66
|
+
`+r+`</table>
|
|
67
|
+
`}tablerow({text:e}){return`<tr>
|
|
68
|
+
${e}</tr>
|
|
69
|
+
`}tablecell(e){let t=this.parser.parseInline(e.tokens),n=e.header?`th`:`td`;return(e.align?`<${n} align="${e.align}">`:`<${n}>`)+t+`</${n}>
|
|
70
|
+
`}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>${F(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?F(n,!0):this.parser.parseInline(r),o=I(e);if(o===null)return a;e=F(o,i);let s=`<a href="`+e+`"`;return t&&(s+=` title="`+F(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=I(e);if(i===null)return F(n);e=i;let a=`<img src="${F(e)}" alt="${F(n)}"`;return t&&(a+=` title="${F(t)}"`),a+=`>`,a}text(e){return`tokens`in e&&e.tokens?this.parser.parseInline(e.tokens):`escaped`in e&&e.escaped?e.text:F(e.text)}},K=class{parser;strong({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}em({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}codespan({text:e}){return e}del({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}html({text:e}){return e}text({text:e}){return e}link({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}image({text:e,tokens:t}){return t?this.parser.parseInline(t,this):e}br(){return``}checkbox({raw:e}){return e}},q=class e{options;renderer;textRenderer;constructor(e){this.options=e||o,this.options.renderer=this.options.renderer||new G,this.renderer=this.options.renderer,this.renderer.options=this.options,this.renderer.parser=this,this.textRenderer=new K,this.textRenderer.parser=this}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}},J=class{options;block;constructor(e){this.options=e||o}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?W.lex:W.lexInline}provideParser(e=this.block){return e?q.parse:q.parseInline}};function Y(e,t){if(Array.isArray(t))for(let n=0;n<t.length;n++)e.push(t[n]);else e.push(t)}var X=new class{defaults=a();options=this.setOptions;parse=this.parseMarkdown(!0);parseInline=this.parseMarkdown(!1);Parser=q;Renderer=G;TextRenderer=K;Lexer=W;Tokenizer=U;Hooks=J;constructor(...e){this.use(...e)}walkTokens(e,t){let n=[];for(let r of e)switch(Y(n,t.call(this,r)),r.type){case`table`:{let e=r;for(let r of e.header)Y(n,this.walkTokens(r.tokens,t));for(let r of e.rows)for(let e of r)Y(n,this.walkTokens(e.tokens,t));break}case`list`:{let e=r;Y(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);Y(n,this.walkTokens(i,t))}):e.tokens&&Y(n,this.walkTokens(e.tokens,t))}}return n}use(...e){let t=this.defaults.extensions||{renderers:Object.create(null),childTokens:Object.create(null)};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 G(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===!1?``:n??``}}n.renderer=t}if(e.tokenizer){let t=this.defaults.tokenizer||new U(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 J;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]=J.passThroughHooks.has(n)?e=>{if(t.options.async&&J.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(t.options.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 Y(n,r.call(this,e)),t&&Y(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 W.lex(e,t??this.defaults)}parser(e,t){return q.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?W.lex:W.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?q.parse:q.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?W.lex:W.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?q.parse:q.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+=`
|
|
71
|
+
Please report this to https://github.com/markedjs/marked.`,e){let e=`<p>An error occurred:</p><pre>`+F(n.message+``,!0)+`</pre>`;return t?Promise.resolve(e):e}if(t)return Promise.reject(n);throw n}}};function Z(e,t){return X.parse(e,t)}Z.options=Z.setOptions=function(e){return X.setOptions(e),Z.defaults=X.defaults,s(Z.defaults),Z},Z.getDefaults=a,Z.defaults=o;function ot(...e){return X.use(...e),Z.defaults=X.defaults,s(Z.defaults),Z}Z.use=ot,Z.walkTokens=function(e,t){return X.walkTokens(e,t)},Z.parseInline=X.parseInline,Z.Parser=q,Z.parser=q.parse,Z.Renderer=G,Z.TextRenderer=K,Z.Lexer=W,Z.lexer=W.lex,Z.Tokenizer=U,Z.Hooks=J,Z.parse=Z,Z.options,Z.setOptions,Z.walkTokens,Z.parseInline,q.parse,W.lex;var st=e({default:()=>ht,renderMarkdown:()=>$,sanitizeHtml:()=>Q}),ct=r(),lt=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`]),ut=new Set([`href`,`src`,`xlink:href`,`action`,`formaction`,`poster`,`background`]),dt=new Set([`http`,`https`,`mailto`]);function ft(e){let t=/^([a-z][a-z0-9+.-]*):/.exec(e.replace(/[\u0000- ]/g,``).toLowerCase());return!t||dt.has(t[1])}function Q(e){for(let t=0;t<4;t++){let t=pt(e);if(t===e)return t;e=t}return``}function pt(e){let t=document.createElement(`template`);return t.innerHTML=e,t.content.querySelectorAll(`*`).forEach(e=>{if(lt.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`||ut.has(r)&&!ft(n))&&e.removeAttribute(t)}}),t.innerHTML}function $(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 Q(Z.parse(r,{breaks:!1}))}var mt=[];function ht({body:e,links:t=mt}){let n=(0,i.useMemo)(()=>$(e,t),[e,t]);return(0,ct.jsx)(`div`,{className:`markdown`,dangerouslySetInnerHTML:{__html:n}})}export{Z as a,Q as i,st as n,$ as r,ht as t};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import"./rolldown-runtime-XKyaHtl9.js";import{i as e,t}from"./react-C1iE8mnY.js";import{F as n,_t as r}from"./index-Ce6qF2nG.js";import{n as i,r as a}from"./sections-CtFz7HFH.js";import{n as o,r as s}from"./Dashboard-BgLArtgu.js";e();var c=t(),l=14;function u({title:e,right:t,children:n,span:r}){return(0,c.jsxs)(`div`,{className:`c-mod`,style:r?{gridColumn:`span ${r}`}:null,children:[(0,c.jsxs)(`div`,{className:`c-mod-head`,children:[(0,c.jsx)(`span`,{className:`c-tab`}),(0,c.jsx)(`h3`,{children:e}),t&&(0,c.jsx)(`span`,{className:`c-mod-right`,children:t})]}),(0,c.jsx)(`div`,{className:`c-mod-body`,children:n})]})}function d({label:e,value:t}){return(0,c.jsxs)(`div`,{className:`c-kpi`,children:[(0,c.jsx)(`div`,{className:`c-kpi-label`,children:e}),(0,c.jsx)(`div`,{className:`c-kpi-val`+(t===0?` zero`:``),children:t})]})}function f({data:e,height:t=120,hi:n}){if(!e.length)return null;let r=Math.max(...e.map(e=>e.v),1);return(0,c.jsx)(`div`,{className:`c-cols`,style:{height:t},children:e.map((e,i)=>{let a=Math.max(e.v/r*(t-6),2);return(0,c.jsx)(`div`,{className:`c-col ${i===n?`hi`:``}`,style:{height:a},title:`${e.t}: ${e.v}`},i)})})}function p({checks:e}){return(0,c.jsx)(`div`,{className:`c-band`,children:e.map((e,t)=>(0,c.jsx)(`span`,{className:`c-band-cell ${e.problems.length===0?`ok`:`bad`}`,title:`${e.label}: ${e.problems.length===0?`pass`:`${e.problems.length} problem(s)`}`},t))})}function m(e){let t={};for(let n of e||[]){let e=n.action||`unknown`;t[e]=(t[e]||0)+1}return Object.entries(t).map(([e,t])=>({label:e,value:t})).sort((e,t)=>t.value-e.value)}function h({overview:e,jobs:t,lens:h}){let g=e.counts||{},_=a.reduce((e,t)=>e+(g[t]||0),0),v=Math.max(...a.map(e=>g[e]||0),1),y=h?.doctor?.state||`loading`,b=h?.doctor?.data?.groups||[],x=b.filter(e=>e.problems.length===0).length,S=n(t||[],10,`0d`),C=S.reduce((e,t)=>e+t.v,0),w=m(t),T=Math.max(...w.map(e=>e.value),1),E=r(e.diff),D=[[`status`,e.deployed?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`DEPLOYED`}):(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NOT DEPLOYED`})],[`voice`,(0,c.jsx)(`span`,{className:`t-cap`,children:e.theme})],[`mode`,e.emit],[`doctor`,y===`failed`?(0,c.jsx)(`span`,{className:`c-pill warn`,children:`NO ANSWER`}):y===`ok`?b.length===0?(0,c.jsx)(`span`,{className:`c-pill`,children:`—`}):x===b.length?(0,c.jsx)(`span`,{className:`c-pill ok`,children:`CLEAN`}):(0,c.jsxs)(`span`,{className:`c-pill warn`,children:[b.length-x,` ISSUES`]}):(0,c.jsx)(`span`,{className:`c-pill`,children:`…`})],[`edits`,String(E)],[`built`,e.build_time||`—`],[`target`,(0,c.jsx)(`span`,{className:`c-dim mono`,children:e.target})]];return(0,c.jsxs)(`div`,{className:`c-root`,children:[(0,c.jsx)(`div`,{className:`c-titlebar`,children:(0,c.jsxs)(`div`,{children:[(0,c.jsx)(`h2`,{className:`c-h1`,children:`HARNESS // STATUS`}),(0,c.jsxs)(`div`,{className:`c-sub`,children:[e.target,` · rendered from src/ · inherited everywhere`]}),(0,c.jsx)(o,{verdict:h?.verdict})]})}),(0,c.jsx)(`div`,{className:`c-strip`,children:D.map(([e,t],n)=>(0,c.jsxs)(`div`,{className:`c-strip-cell`,children:[(0,c.jsx)(`div`,{className:`c-strip-k`,children:e}),(0,c.jsx)(`div`,{className:`c-strip-v`,children:t})]},n))}),(0,c.jsxs)(`div`,{className:`c-kpi-row`,children:[(0,c.jsx)(d,{label:`AGENTS`,value:g.agents??`—`}),(0,c.jsx)(d,{label:`SKILLS`,value:g.skills??`—`}),(0,c.jsx)(d,{label:`DICTATES`,value:g.laws??`—`}),(0,c.jsx)(d,{label:`PACKS`,value:g.doctrines?`${g.doctrines.active}/${g.doctrines.total}`:`—`}),(0,c.jsx)(d,{label:`MEMORY`,value:g.memory??`—`}),(0,c.jsx)(d,{label:`NOTEBOOK`,value:g.notebook??`—`}),(0,c.jsx)(d,{label:`EDITS`,value:E})]}),(0,c.jsxs)(`div`,{className:`c-grid`,children:[(0,c.jsx)(u,{title:`CAPABILITY DISTRIBUTION`,right:`${_} ENTRIES`,span:2,children:(0,c.jsxs)(`table`,{className:`c-tbl`,children:[(0,c.jsx)(`thead`,{children:(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`th`,{children:`SECTION`}),(0,c.jsx)(`th`,{children:`DETAIL`}),(0,c.jsx)(`th`,{style:{width:150},children:`SHARE`}),(0,c.jsx)(`th`,{className:`num`,children:`N`})]})}),(0,c.jsx)(`tbody`,{children:a.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,children:i[e].label}),(0,c.jsx)(`td`,{className:`c-dim`,children:i[e].desc}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${(g[e]||0)/v*100}%`,background:e===`agents`||e===`skills`?`var(--accent)`:`var(--line-3)`}})})}),(0,c.jsx)(`td`,{className:(g[e]||0)>0?`num`:`num c-dim`,children:g[e]??0})]},e))})]})}),(0,c.jsx)(u,{title:`DOCTOR // CHECKS`,right:b.length?`${x}/${b.length}`:`—`,children:b.length>0?(0,c.jsxs)(c.Fragment,{children:[(0,c.jsx)(p,{checks:b}),(0,c.jsx)(`div`,{className:`c-check-list`,children:b.map(e=>{let t=e.problems.length===0;return(0,c.jsxs)(`div`,{className:`c-check-row`,children:[(0,c.jsx)(`span`,{className:`c-dotmark ${t?`ok`:`bad`}`}),(0,c.jsx)(`span`,{className:`c-check-name`,children:e.label}),(0,c.jsx)(`span`,{className:`c-check-detail`,children:t?`clean`:`${e.problems.length} problem${e.problems.length===1?``:`s`}`})]},e.label)})})]}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:y===`failed`?`Doctor did not answer.`:y===`ok`?`Doctor reported no checks.`:`Checking…`})}),(0,c.jsxs)(u,{title:`RUN RATE // 10D`,right:`${C} RUNS`,span:2,children:[(0,c.jsx)(f,{data:S,height:120,hi:S.length-1}),(0,c.jsx)(`div`,{className:`c-axis`,children:S.map((e,t)=>(0,c.jsx)(`span`,{children:t%2==0?e.t:``},t))})]}),(0,c.jsx)(u,{title:`RUN LOG // BY TYPE`,right:`${(t||[]).length} LOGGED`,children:w.length>0?(0,c.jsx)(`table`,{className:`c-tbl`,children:(0,c.jsx)(`tbody`,{children:w.map(e=>(0,c.jsxs)(`tr`,{children:[(0,c.jsx)(`td`,{className:`c-name`,style:{textTransform:`uppercase`,fontWeight:400},children:e.label}),(0,c.jsx)(`td`,{children:(0,c.jsx)(`div`,{className:`c-bar`,children:(0,c.jsx)(`i`,{style:{width:`${e.value/T*100}%`,background:`var(--accent)`}})})}),(0,c.jsx)(`td`,{className:`num`,children:e.value})]},e.label))})}):(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})}),(0,c.jsx)(u,{title:`RECENT // RUN LOG`,span:3,children:(0,c.jsx)(s,{jobs:t,max:l,empty:(0,c.jsx)(`p`,{className:`c-dim mono c-fine`,children:`No runs logged.`})})})]})]})}export{h as default};
|