@inkeep/open-knowledge 0.0.0-dev-20260430043631 → 0.0.0-dev-20260430063358
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.mjs +5 -5
- package/dist/constants-DrhEfUQE.mjs +2 -0
- package/dist/index.mjs +1 -1
- package/dist/init-BjCJuWSb.mjs +1 -0
- package/dist/init-CABEHD4d.mjs +1 -0
- package/dist/{init-DR-RaetG.mjs → init-CINypD5f.mjs} +3 -3
- package/dist/{init-Cs4zbQzq.mjs → init-CsF5t9q-.mjs} +2 -2
- package/dist/{loader-BkC_FZ7h.mjs → loader-D1CrMLB2.mjs} +2 -2
- package/dist/loader-DRHRURwC.mjs +1 -0
- package/dist/paths-CQPr6nyc.mjs +2 -0
- package/dist/paths-DK1PziJN.mjs +1 -0
- package/dist/{preview-5SIgbwvp.mjs → preview-8Vt_tNBB.mjs} +2 -2
- package/dist/preview-C-XjtsGD.mjs +1 -0
- package/dist/public/assets/{ActivityModeContent-BW6QUlpa.js → ActivityModeContent-IRFPgzna.js} +1 -1
- package/dist/public/assets/{GraphPanel-CJAjFwlB.js → GraphPanel-CDyaftq6.js} +1 -1
- package/dist/public/assets/McpConsentDialogBody-BKRS2Qm0.js +1 -0
- package/dist/public/assets/{SettingsPane-Cv7AhoVO.js → SettingsPane-BMeVMzBd.js} +1 -1
- package/dist/public/assets/index-BSJSvPoC.js +1843 -0
- package/dist/public/assets/mcp-consent-store-BBTXqzE6.js +1 -0
- package/dist/public/assets/{telemetry-impl-DYBNNWwm.js → telemetry-impl-DF7KVxgp.js} +2 -2
- package/dist/public/index.html +3 -2
- package/dist/src-DQwyziiR.mjs +1 -0
- package/dist/start-BNLzgRz7.mjs +1 -0
- package/dist/{start-CixsXnAG.mjs → start-DEfS916L.mjs} +2 -2
- package/package.json +1 -1
- package/dist/constants-CCnuxCJE.mjs +0 -2
- package/dist/init-3zPu4r2d.mjs +0 -1
- package/dist/init-C9GuXJHx.mjs +0 -1
- package/dist/loader-C7FUyr_0.mjs +0 -1
- package/dist/paths-2tkmjuzR.mjs +0 -1
- package/dist/paths-pA7JHYmH.mjs +0 -2
- package/dist/preview-BUcB3nQ2.mjs +0 -1
- package/dist/public/assets/McpConsentDialogBody-DQ0fjmg5.js +0 -1
- package/dist/public/assets/index-kRR5e5Fa.js +0 -1843
- package/dist/src-CaoAADCF.mjs +0 -1
- package/dist/start-9VL8q17c.mjs +0 -1
- /package/dist/public/assets/{SourceEditor-CKxBGb1i.js → SourceEditor-CVLfrqOH.js} +0 -0
- /package/dist/public/assets/{__vite-browser-external-B0s46rwe.js → __vite-browser-external-BW1_xmov.js} +0 -0
- /package/dist/public/assets/{tooltip-CrLpzBBL.js → tooltip-Dqn5ly4m.js} +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,t}from"./preview-8Vt_tNBB.mjs";export{t as formatPreviewBlock,e as previewContent};
|
package/dist/public/assets/{ActivityModeContent-BW6QUlpa.js → ActivityModeContent-IRFPgzna.js}
RENAMED
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./ActivityPanelDiffView-C1vRNF09.js","./chunk-DECur_0Z.js","./compiler-runtime-Y11fyRVL.js","./ActivityPanelDiffView-legcy4jI.css"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{r as e}from"./chunk-DECur_0Z.js";import{i as t}from"./propagation-api-LnD10wq2.js";import{n,r,t as i}from"./compiler-runtime-Y11fyRVL.js";import{o as a}from"./toggle-group-Czy0P9Ee.js";import{t as o,x as s}from"./button-CXhPNzpp.js";import{At as c,Mt as l,jt as u,n as d,r as f,yt as p}from"./DocumentContext-B1Fp4JCg.js";import{f as m,i as h,m as g,r as _,t as v}from"./agent-presence-XtMgnv3n.js";import{a as y,c as b,i as x,o as S,s as C,t as w,x as T}from"./dialog-CJazZw1E.js";import{i as E,n as D,t as O}from"./tooltip-CrLpzBBL.js";var k=s(`rewind`,[[`path`,{d:`M12 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 12 18z`,key:`2a1g8i`}],[`path`,{d:`M22 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 22 18z`,key:`rg3s36`}]]),A=i(),j=e(n(),1),M=500,ee=64;async function te(e){let t=`/api/agent-activity?agentId=${encodeURIComponent(e)}`,n=await fetch(t);if(!n.ok)throw Error(`agent-activity fetch failed: HTTP ${n.status}`);let r=await n.json();if(!r.ok)throw Error(r.error??`agent-activity fetch not ok`);return{sessionAlive:r.sessionAlive??!1,agent:r.agent??null,files:r.files??[]}}async function N(e,t,n){let r=`/api/agent-burst-diff?agentId=${encodeURIComponent(e)}&docName=${encodeURIComponent(t)}&stackIndex=${n}`,i=await fetch(r);if(!i.ok)throw Error(`agent-burst-diff fetch failed: HTTP ${i.status}`);let a=await i.json();if(!a.ok)throw Error(a.error??`agent-burst-diff fetch not ok`);return a.diff??``}function ne(e){let t=(0,A.c)(23),{systemProvider:n}=d(),[r,i]=(0,j.useState)(null),[o,s]=(0,j.useState)(`idle`),[c,l]=(0,j.useState)(null),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=new h(ee),t[0]=u):u=t[0];let f=(0,j.useRef)(u),p=(0,j.useRef)(0),m;t[1]===n?m=t[2]:(m=e=>{let t=p.current+=1;s(`loading`),l(null),te(e).then(r=>{if(p.current!==t)return;let a=ie(n,e);i({...r,writingDocs:a}),s(`ready`)}).catch(e=>{p.current===t&&(l(e instanceof Error?e.message:String(e)),s(`error`))})},t[1]=n,t[2]=m);let g=m,_;t[3]!==e||t[4]!==g?(_=()=>{if(!e){p.current+=1,i(null),s(`idle`),l(null),f.current.clear();return}f.current.clear(),g(e);let t=null,n=a(n=>{n.includes(`session-activity`)&&(t&&clearTimeout(t),t=setTimeout(()=>{t=null,g(e)},M))});return()=>{t&&clearTimeout(t),n()}},t[3]=e,t[4]=g,t[5]=_):_=t[5];let v;t[6]===e?v=t[7]:(v=[e],t[6]=e,t[7]=v),(0,j.useEffect)(_,v);let y,b;t[8]!==e||t[9]!==n?(y=()=>{if(!e||!n)return;let t=()=>{if(!n.awareness)return;let t=ie(n,e);i(e=>!e||re(e.writingDocs,t)?e:{...e,writingDocs:t})},r=n.awareness;if(!r||typeof r.on!=`function`){t();return}r.on(`update`,t),t();let a=setInterval(t,1e3);return()=>{clearInterval(a),typeof r.off==`function`&&r.off(`update`,t)}},b=[e,n],t[8]=e,t[9]=n,t[10]=y,t[11]=b):(y=t[10],b=t[11]),(0,j.useEffect)(y,b);let x;t[12]===e?x=t[13]:(x=async(t,n)=>{if(!e)return``;let r=`${t}\0${n}`,i=f.current.get(r);if(i!==void 0)return i;let a=await N(e,t,n);return f.current.set(r,a),a},t[12]=e,t[13]=x);let S=x,C;t[14]!==e||t[15]!==g?(C=()=>{e&&g(e)},t[14]=e,t[15]=g,t[16]=C):C=t[16];let w=C,T;return t[17]!==r||t[18]!==c||t[19]!==S||t[20]!==w||t[21]!==o?(T={data:r,status:o,error:c,reload:w,fetchBurstDiff:S},t[17]=r,t[18]=c,t[19]=S,t[20]=w,t[21]=o,t[22]=T):T=t[22],T}function re(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function ie(e,t){let n=new Set;if(!e)return n;let r=e.awareness;if(!v(r))return n;let i=[t,t.startsWith(`agent-`)?t.slice(6):`agent-${t}`];for(let e of r.getStates().values()){let t=e.agentPresence;if(t)for(let e of i){let r=t[e];r&&r.mode===`writing`&&r.currentDoc&&n.add(r.currentDoc)}}return n}var P=r(),ae=(0,j.lazy)(async()=>({default:(await t(()=>import(`./ActivityPanelDiffView-C1vRNF09.js`),__vite__mapDeps([0,1,2,3]),import.meta.url)).ActivityPanelDiffView}));function oe(e,t){let n=Math.max(0,t-e);return n<6e4?`${Math.round(n/1e3)}s ago`:n<36e5?`${Math.round(n/6e4)}m ago`:new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function se(e){let t=(0,A.c)(38),{burst:n,docName:r,fetchBurstDiff:i}=e,[a,o]=(0,j.useState)(!1),[s,c]=(0,j.useState)(null),[d,f]=(0,j.useState)(null),[p,m]=(0,j.useState)(!1),[h,g]=(0,j.useState)(ce),_,v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>{let e=setInterval(()=>g(Date.now()),3e4);return()=>clearInterval(e)},v=[],t[0]=_,t[1]=v):(_=t[0],v=t[1]),(0,j.useEffect)(_,v);let y;t[2]!==n.stackIndex||t[3]!==s||t[4]!==r||t[5]!==a||t[6]!==i||t[7]!==p?(y=()=>{let e=!a;o(e),e&&s===null&&!p&&(m(!0),f(null),i(r,n.stackIndex).then(e=>{c(e),m(!1)}).catch(e=>{f(e instanceof Error?e.message:String(e)),m(!1)}))},t[2]=n.stackIndex,t[3]=s,t[4]=r,t[5]=a,t[6]=i,t[7]=p,t[8]=y):y=t[8];let b=y,x=`${a?`Collapse`:`Expand`} burst ${n.stackIndex+1} diff`,S;t[9]===a?S=t[10]:(S=a?(0,P.jsx)(l,{className:`size-3 shrink-0`,"aria-hidden":`true`}):(0,P.jsx)(u,{className:`size-3 shrink-0`,"aria-hidden":`true`}),t[9]=a,t[10]=S);let C;t[11]!==n.ts||t[12]!==h?(C=oe(n.ts,h),t[11]=n.ts,t[12]=h,t[13]=C):C=t[13];let w;t[14]===C?w=t[15]:(w=(0,P.jsx)(`span`,{className:`font-mono`,children:C}),t[14]=C,t[15]=w);let T;t[16]===n.additions?T=t[17]:(T=(0,P.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additions]}),t[16]=n.additions,t[17]=T);let E;t[18]===n.deletions?E=t[19]:(E=(0,P.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletions]}),t[18]=n.deletions,t[19]=E);let D;t[20]!==T||t[21]!==E?(D=(0,P.jsxs)(`span`,{className:`ml-auto font-mono`,children:[T,` `,E]}),t[20]=T,t[21]=E,t[22]=D):D=t[22];let O;t[23]!==a||t[24]!==D||t[25]!==x||t[26]!==S||t[27]!==w||t[28]!==b?(O=(0,P.jsxs)(`button`,{type:`button`,onClick:b,className:`flex w-full items-center gap-2 px-4 py-1.5 text-xs text-muted-foreground hover:bg-muted/40`,"aria-expanded":a,"aria-label":x,children:[S,w,D]}),t[23]=a,t[24]=D,t[25]=x,t[26]=S,t[27]=w,t[28]=b,t[29]=O):O=t[29];let k;t[30]!==s||t[31]!==a||t[32]!==d||t[33]!==p?(k=a?(0,P.jsx)(`div`,{className:`bg-muted/20`,children:p?(0,P.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:`Loading diff…`}):d?(0,P.jsxs)(`div`,{className:`px-4 py-2 text-xs text-destructive`,children:[`Failed: `,d]}):s===null?(0,P.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:`No diff.`}):(0,P.jsx)(j.Suspense,{fallback:(0,P.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:`Loading diff…`}),children:(0,P.jsx)(ae,{diff:s})})}):null,t[30]=s,t[31]=a,t[32]=d,t[33]=p,t[34]=k):k=t[34];let M;return t[35]!==O||t[36]!==k?(M=(0,P.jsxs)(`div`,{className:`border-t border-border/50`,children:[O,k]}),t[35]=O,t[36]=k,t[37]=M):M=t[37],M}function ce(){return Date.now()}function le(e,t){let n=Math.max(0,t-e);return n<6e4?`${Math.round(n/1e3)}s ago`:n<36e5?`${Math.round(n/6e4)}m ago`:`${Math.round(n/36e5)}h ago`}function ue(e){let t=(0,A.c)(93),{file:n,sessionAlive:r,isWriting:i,onNavigate:a,onUndoLast:s,onUndoAll:c,fetchBurstDiff:d}=e,[f,p]=(0,j.useState)(!1),[h,g]=(0,j.useState)(!1),[_,v]=(0,j.useState)(!1),[T,M]=(0,j.useState)(fe),ee,te;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(ee=()=>{let e=setInterval(()=>M(Date.now()),3e4);return()=>clearInterval(e)},te=[],t[0]=ee,t[1]=te):(ee=t[0],te=t[1]),(0,j.useEffect)(ee,te),n.bursts.length===0)return null;let N=!r||n.bursts.length===0||_,ne=r?n.bursts.length===0?`Nothing to undo on this file`:null:`Session ended — undo unavailable`,re;t[2]!==N||t[3]!==n.docName||t[4]!==s?(re=e=>{e.stopPropagation(),!N&&(v(!0),Promise.resolve(s(n.docName)).finally(()=>v(!1)))},t[2]=N,t[3]=n.docName,t[4]=s,t[5]=re):re=t[5];let ie=re,ae;t[6]===N?ae=t[7]:(ae=e=>{e.stopPropagation(),!N&&g(!0)},t[6]=N,t[7]=ae);let oe=ae,ce;t[8]!==N||t[9]!==n.docName||t[10]!==c?(ce=()=>{g(!1),!N&&(v(!0),Promise.resolve(c(n.docName)).finally(()=>v(!1)))},t[8]=N,t[9]=n.docName,t[10]=c,t[11]=ce):ce=t[11];let ue=ce,F;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>p(de),t[12]=F):F=t[12];let pe=f?`Collapse ${n.docName}`:`Expand ${n.docName}`,I;t[13]===f?I=t[14]:(I=f?(0,P.jsx)(l,{className:`size-4`,"aria-hidden":`true`}):(0,P.jsx)(u,{className:`size-4`,"aria-hidden":`true`}),t[13]=f,t[14]=I);let L;t[15]!==f||t[16]!==pe||t[17]!==I?(L=(0,P.jsx)(`button`,{type:`button`,onClick:F,className:`flex size-5 shrink-0 items-center justify-center rounded hover:bg-muted`,"aria-expanded":f,"aria-label":pe,"data-testid":`activity-panel-file-row-carrot`,children:I}),t[15]=f,t[16]=pe,t[17]=I,t[18]=L):L=t[18];let R;t[19]!==n.docName||t[20]!==a?(R=()=>a(n.docName),t[19]=n.docName,t[20]=a,t[21]=R):R=t[21];let me=`Navigate to ${n.docName}`,z;t[22]!==n.docName||t[23]!==R||t[24]!==me?(z=(0,P.jsx)(`button`,{type:`button`,onClick:R,className:`min-w-0 flex-1 truncate text-left text-foreground hover:underline focus-visible:outline-ring`,"aria-label":me,"data-testid":`activity-panel-file-row-filename`,title:n.docName,children:n.docName}),t[22]=n.docName,t[23]=R,t[24]=me,t[25]=z):z=t[25];let he=`Undo last edit on ${n.docName}`,ge;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,P.jsx)(m,{className:`size-3.5`,"aria-hidden":`true`}),t[26]=ge):ge=t[26];let B;t[27]!==N||t[28]!==ie||t[29]!==he?(B=(0,P.jsx)(E,{asChild:!0,children:(0,P.jsx)(o,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:ie,disabled:N,"aria-label":he,"data-testid":`activity-panel-undo-last`,children:ge})}),t[27]=N,t[28]=ie,t[29]=he,t[30]=B):B=t[30];let _e=ne??`Undo last edit`,V;t[31]===_e?V=t[32]:(V=(0,P.jsx)(D,{side:`bottom`,children:_e}),t[31]=_e,t[32]=V);let H;t[33]!==B||t[34]!==V?(H=(0,P.jsxs)(O,{children:[B,V]}),t[33]=B,t[34]=V,t[35]=H):H=t[35];let ve=`Undo all edits on ${n.docName}`,ye;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,P.jsx)(k,{className:`size-3.5`,"aria-hidden":`true`}),t[36]=ye):ye=t[36];let be;t[37]!==N||t[38]!==oe||t[39]!==ve?(be=(0,P.jsx)(E,{asChild:!0,children:(0,P.jsx)(o,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:oe,disabled:N,"aria-label":ve,"data-testid":`activity-panel-undo-all`,children:ye})}),t[37]=N,t[38]=oe,t[39]=ve,t[40]=be):be=t[40];let xe=ne??`Undo all edits`,U;t[41]===xe?U=t[42]:(U=(0,P.jsx)(D,{side:`bottom`,children:xe}),t[41]=xe,t[42]=U);let W;t[43]!==be||t[44]!==U?(W=(0,P.jsxs)(O,{children:[be,U]}),t[43]=be,t[44]=U,t[45]=W):W=t[45];let G;t[46]===n.additionsTotal?G=t[47]:(G=(0,P.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additionsTotal]}),t[46]=n.additionsTotal,t[47]=G);let K;t[48]===n.deletionsTotal?K=t[49]:(K=(0,P.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletionsTotal]}),t[48]=n.deletionsTotal,t[49]=K);let q;t[50]!==G||t[51]!==K?(q=(0,P.jsxs)(`span`,{className:`shrink-0 font-mono text-xs`,children:[G,` `,K]}),t[50]=G,t[51]=K,t[52]=q):q=t[52];let J;t[53]!==n.lastTs||t[54]!==T?(J=le(n.lastTs,T),t[53]=n.lastTs,t[54]=T,t[55]=J):J=t[55];let Y;t[56]===J?Y=t[57]:(Y=(0,P.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:J}),t[56]=J,t[57]=Y);let X;t[58]===i?X=t[59]:(X=i?(0,P.jsx)(`span`,{className:`shrink-0 text-[11px] text-primary animate-pulse`,role:`status`,children:`writing…`}):null,t[58]=i,t[59]=X);let Z;t[60]!==z||t[61]!==H||t[62]!==W||t[63]!==q||t[64]!==Y||t[65]!==X||t[66]!==L?(Z=(0,P.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[L,z,H,W,q,Y,X]}),t[60]=z,t[61]=H,t[62]=W,t[63]=q,t[64]=Y,t[65]=X,t[66]=L,t[67]=Z):Z=t[67];let Q;t[68]!==f||t[69]!==d||t[70]!==n.bursts||t[71]!==n.docName?(Q=f?(0,P.jsx)(`div`,{children:n.bursts.map(e=>(0,P.jsx)(se,{burst:e,docName:n.docName,fetchBurstDiff:d},`${n.docName}:${e.stackIndex}`))}):null,t[68]=f,t[69]=d,t[70]=n.bursts,t[71]=n.docName,t[72]=Q):Q=t[72];let Se;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,P.jsx)(b,{children:`Undo all edits on this file?`}),t[73]=Se):Se=t[73];let Ce;t[74]===n.docName?Ce=t[75]:(Ce=(0,P.jsx)(`span`,{className:`font-mono text-foreground`,children:n.docName}),t[74]=n.docName,t[75]=Ce);let we=n.bursts.length===1?``:`s`,Te;t[76]!==n.bursts.length||t[77]!==Ce||t[78]!==we?(Te=(0,P.jsxs)(C,{children:[Se,(0,P.jsxs)(y,{children:[`This will revert every change this agent has made to`,` `,Ce,` in their current session (`,n.bursts.length,` burst`,we,`). Other files and other writers are not affected.`]})]}),t[76]=n.bursts.length,t[77]=Ce,t[78]=we,t[79]=Te):Te=t[79];let Ee;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,P.jsx)(o,{type:`button`,variant:`outline`,onClick:()=>g(!1),"data-testid":`activity-panel-undo-all-cancel`,children:`Cancel`}),t[80]=Ee):Ee=t[80];let De;t[81]===ue?De=t[82]:(De=(0,P.jsxs)(S,{children:[Ee,(0,P.jsx)(o,{type:`button`,variant:`destructive`,onClick:ue,"data-testid":`activity-panel-undo-all-confirm`,children:`Undo all`})]}),t[81]=ue,t[82]=De);let Oe;t[83]!==Te||t[84]!==De?(Oe=(0,P.jsxs)(x,{className:`sm:max-w-md`,children:[Te,De]}),t[83]=Te,t[84]=De,t[85]=Oe):Oe=t[85];let $;t[86]!==h||t[87]!==Oe?($=(0,P.jsx)(w,{open:h,onOpenChange:g,children:Oe}),t[86]=h,t[87]=Oe,t[88]=$):$=t[88];let ke;return t[89]!==Z||t[90]!==Q||t[91]!==$?(ke=(0,P.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`activity-panel-file-row`,children:[Z,Q,$]}),t[89]=Z,t[90]=Q,t[91]=$,t[92]=ke):ke=t[92],ke}function de(e){return!e}function fe(){return Date.now()}async function F(e){let t=await fetch(`/api/agent-undo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...e,agentId:e.connectionId})});if(!t.ok)throw Error(`agent-undo failed: HTTP ${t.status}`)}function pe(e){return`#/${e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`}function I(e){typeof window>`u`||(window.location.hash=pe(e))}function L(){let e=(0,A.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,P.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,role:`status`,"aria-busy":`true`,children:[(0,P.jsx)(p,{className:`mr-2 size-4 animate-spin`,"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:`text-sm`,children:`Loading agent activity…`})]}),e[0]=t):t=e[0],t}function R(e){let t=(0,A.c)(9),{error:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,P.jsx)(c,{className:`size-6 text-destructive`,"aria-hidden":`true`}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,P.jsx)(`p`,{className:`text-sm font-medium`,children:`Failed to load activity`}),t[1]=a):a=t[1];let s;t[2]===n?s=t[3]:(s=(0,P.jsxs)(`div`,{className:`space-y-1`,children:[a,(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})]}),t[2]=n,t[3]=s);let l;t[4]===r?l=t[5]:(l=(0,P.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:`Retry`}),t[4]=r,t[5]=l);let u;return t[6]!==s||t[7]!==l?(u=(0,P.jsxs)(`div`,{className:`flex flex-col items-center gap-3 p-6 text-center`,role:`alert`,"data-testid":`activity-panel-error`,children:[i,s,l]}),t[6]=s,t[7]=l,t[8]=u):u=t[8],u}function me(){let e=(0,A.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,P.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,"data-testid":`activity-panel-empty`,children:(0,P.jsx)(`p`,{className:`text-sm italic`,children:`No edits yet.`})}),e[0]=t):t=e[0],t}function z(e){let t=(0,A.c)(8),{onExit:n}=e,r;t[0]===n?r=t[1]:(r=(0,P.jsx)(he,{onClick:n}),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,P.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:`Agent activity`}),t[2]=i):i=t[2];let a;t[3]===r?a=t[4]:(a=(0,P.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-2 border-b border-border px-3 py-2`,children:[r,i]}),t[3]=r,t[4]=a);let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,P.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-muted-foreground`,children:(0,P.jsx)(`p`,{className:`text-center text-sm italic`,children:`Click an agent's avatar in the presence bar to view their session.`})}),t[5]=o):o=t[5];let s;return t[6]===a?s=t[7]:(s=(0,P.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel-no-agent`,"aria-label":`Agent activity`,children:[a,o]}),t[6]=a,t[7]=s),s}function he(e){let t=(0,A.c)(6),{onClick:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,P.jsx)(g,{}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i=(0,P.jsx)(E,{asChild:!0,children:(0,P.jsx)(o,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,onClick:n,"aria-label":`Back to document view`,"data-testid":`docpanel-exit-agent-mode`,children:r})}),t[1]=n,t[2]=i);let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,P.jsx)(D,{side:`bottom`,children:`Back to document view`}),t[3]=a):a=t[3];let s;return t[4]===i?s=t[5]:(s=(0,P.jsxs)(O,{children:[i,a]}),t[4]=i,t[5]=s),s}function ge(e){let t=(0,A.c)(9),{lastTs:n}=e,[r]=(0,j.useState)(B),i;t[0]!==n||t[1]!==r?(i=n?_e(r-n):null,t[0]=n,t[1]=r,t[2]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,P.jsx)(`span`,{className:`font-medium`,children:`Session ended`}),t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=a?(0,P.jsxs)(`span`,{children:[` · `,a]}):null,t[4]=a,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,P.jsx)(`div`,{className:`mt-1 opacity-80`,children:`Undo buttons are disabled — per-session state has been garbage-collected.`}),t[6]=c):c=t[6];let l;return t[7]===s?l=t[8]:(l=(0,P.jsxs)(`div`,{className:`border-b border-border bg-muted/40 px-4 py-3 text-xs text-muted-foreground`,"data-testid":`activity-panel-session-ended`,children:[o,s,c]}),t[7]=s,t[8]=l),l}function B(){return Date.now()}function _e(e){let t=Math.max(0,e);return t<6e4?`${Math.round(t/1e3)}s ago`:t<36e5?`${Math.round(t/6e4)}m ago`:`${Math.round(t/36e5)}h ago`}function V(e){let t=(0,A.c)(10),{agent:n,size:r}=e,i=r===void 0?28:r,a;t[0]!==n.color||t[1]!==i?(a={backgroundColor:n.color,width:i,height:i},t[0]=n.color,t[1]=i,t[2]=a):a=t[2];let o=i*.57,s=i*.57,c;t[3]!==n.icon||t[4]!==o||t[5]!==s?(c=(0,P.jsx)(_,{icon:n.icon,width:o,height:s}),t[3]=n.icon,t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==a||t[8]!==c?(l=(0,P.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-full text-white ring-2 ring-background`,style:a,"aria-hidden":`true`,children:c}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function H(e){let t=(0,A.c)(20),{data:n,status:r,error:i,reload:a,fetchBurstDiff:o,onExit:s,onNavigate:c,onUndoLast:l,onUndoAll:u}=e,d=n?.files?.[0]?.lastTs??null,f;t[0]===s?f=t[1]:(f=(0,P.jsx)(he,{onClick:s}),t[0]=s,t[1]=f);let p;t[2]===n?p=t[3]:(p=n?.agent?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(V,{agent:n.agent}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:n.agent.displayName}),(0,P.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[n.sessionAlive?`Active`:`Ended`,n.files.length>0?` · ${n.files.length} file${n.files.length===1?``:`s`}`:``]})]})]}):(0,P.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,P.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:`Agent activity`})}),t[2]=n,t[3]=p);let m;t[4]!==f||t[5]!==p?(m=(0,P.jsxs)(`div`,{className:`flex flex-row items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[f,p]}),t[4]=f,t[5]=p,t[6]=m):m=t[6];let h;t[7]!==n||t[8]!==i||t[9]!==o||t[10]!==d||t[11]!==c||t[12]!==u||t[13]!==l||t[14]!==a||t[15]!==r?(h=(0,P.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`activity-panel-body`,children:r===`loading`&&n===null?(0,P.jsx)(L,{}):r===`error`&&i?(0,P.jsx)(R,{error:i,onRetry:a}):n===null?(0,P.jsx)(me,{}):(0,P.jsxs)(P.Fragment,{children:[n.sessionAlive?null:(0,P.jsx)(ge,{lastTs:d}),n.files.length===0?(0,P.jsx)(me,{}):n.files.map(e=>(0,P.jsx)(ue,{file:e,sessionAlive:n.sessionAlive,isWriting:n.writingDocs.has(e.docName),onNavigate:c,onUndoLast:l,onUndoAll:u,fetchBurstDiff:o},e.docName))]})}),t[7]=n,t[8]=i,t[9]=o,t[10]=d,t[11]=c,t[12]=u,t[13]=l,t[14]=a,t[15]=r,t[16]=h):h=t[16];let g;return t[17]!==m||t[18]!==h?(g=(0,P.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel`,"aria-label":`Agent activity`,children:[m,h]}),t[17]=m,t[18]=h,t[19]=g):g=t[19],g}function ve(){let e=(0,A.c)(22),{docPanelAgentId:t,closeActivityPanel:n}=d(),{openDocumentTransition:r}=f(),{data:i,status:a,error:o,reload:s,fetchBurstDiff:c}=ne(t);if(t===null){let t;return e[0]===n?t=e[1]:(t=(0,P.jsx)(z,{onExit:n}),e[0]=n,e[1]=t),t}let l;e[2]===r?l=e[3]:(l=e=>{r(e),I(e)},e[2]=r,e[3]=l);let u=l,p;e[4]!==i||e[5]!==t||e[6]!==s?(p=async e=>{try{await F({connectionId:t,docName:e,scope:`last`,agentName:i?.agent?.displayName}),s()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);T.error(`Undo failed: ${n}`),s()}},e[4]=i,e[5]=t,e[6]=s,e[7]=p):p=e[7];let m=p,h;e[8]!==i||e[9]!==t||e[10]!==s?(h=async e=>{try{await F({connectionId:t,docName:e,scope:`file`,agentName:i?.agent?.displayName}),T.success(`Undone all edits on ${e}`),s()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);T.error(`Undo all failed: ${n}`),s()}},e[8]=i,e[9]=t,e[10]=s,e[11]=h):h=e[11];let g=h,_;return e[12]!==n||e[13]!==i||e[14]!==o||e[15]!==c||e[16]!==u||e[17]!==g||e[18]!==m||e[19]!==s||e[20]!==a?(_=(0,P.jsx)(H,{data:i,status:a,error:o,reload:s,fetchBurstDiff:c,onExit:n,onNavigate:u,onUndoLast:m,onUndoAll:g}),e[12]=n,e[13]=i,e[14]=o,e[15]=c,e[16]=u,e[17]=g,e[18]=m,e[19]=s,e[20]=a,e[21]=_):_=e[21],_}export{ve as ActivityModeContent};
|
|
2
|
+
import{r as e}from"./chunk-DECur_0Z.js";import{i as t}from"./propagation-api-LnD10wq2.js";import{n,r,t as i}from"./compiler-runtime-Y11fyRVL.js";import{o as a}from"./toggle-group-Czy0P9Ee.js";import{t as o,x as s}from"./button-CXhPNzpp.js";import{At as c,Mt as l,jt as u,n as d,r as f,yt as p}from"./DocumentContext-B1Fp4JCg.js";import{f as m,i as h,m as g,r as _,t as v}from"./agent-presence-XtMgnv3n.js";import{a as y,c as b,i as x,o as S,s as C,t as w,x as T}from"./dialog-CJazZw1E.js";import{i as E,n as D,t as O}from"./tooltip-Dqn5ly4m.js";var k=s(`rewind`,[[`path`,{d:`M12 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 12 18z`,key:`2a1g8i`}],[`path`,{d:`M22 6a2 2 0 0 0-3.414-1.414l-6 6a2 2 0 0 0 0 2.828l6 6A2 2 0 0 0 22 18z`,key:`rg3s36`}]]),A=i(),j=e(n(),1),M=500,ee=64;async function te(e){let t=`/api/agent-activity?agentId=${encodeURIComponent(e)}`,n=await fetch(t);if(!n.ok)throw Error(`agent-activity fetch failed: HTTP ${n.status}`);let r=await n.json();if(!r.ok)throw Error(r.error??`agent-activity fetch not ok`);return{sessionAlive:r.sessionAlive??!1,agent:r.agent??null,files:r.files??[]}}async function N(e,t,n){let r=`/api/agent-burst-diff?agentId=${encodeURIComponent(e)}&docName=${encodeURIComponent(t)}&stackIndex=${n}`,i=await fetch(r);if(!i.ok)throw Error(`agent-burst-diff fetch failed: HTTP ${i.status}`);let a=await i.json();if(!a.ok)throw Error(a.error??`agent-burst-diff fetch not ok`);return a.diff??``}function ne(e){let t=(0,A.c)(23),{systemProvider:n}=d(),[r,i]=(0,j.useState)(null),[o,s]=(0,j.useState)(`idle`),[c,l]=(0,j.useState)(null),u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(u=new h(ee),t[0]=u):u=t[0];let f=(0,j.useRef)(u),p=(0,j.useRef)(0),m;t[1]===n?m=t[2]:(m=e=>{let t=p.current+=1;s(`loading`),l(null),te(e).then(r=>{if(p.current!==t)return;let a=ie(n,e);i({...r,writingDocs:a}),s(`ready`)}).catch(e=>{p.current===t&&(l(e instanceof Error?e.message:String(e)),s(`error`))})},t[1]=n,t[2]=m);let g=m,_;t[3]!==e||t[4]!==g?(_=()=>{if(!e){p.current+=1,i(null),s(`idle`),l(null),f.current.clear();return}f.current.clear(),g(e);let t=null,n=a(n=>{n.includes(`session-activity`)&&(t&&clearTimeout(t),t=setTimeout(()=>{t=null,g(e)},M))});return()=>{t&&clearTimeout(t),n()}},t[3]=e,t[4]=g,t[5]=_):_=t[5];let v;t[6]===e?v=t[7]:(v=[e],t[6]=e,t[7]=v),(0,j.useEffect)(_,v);let y,b;t[8]!==e||t[9]!==n?(y=()=>{if(!e||!n)return;let t=()=>{if(!n.awareness)return;let t=ie(n,e);i(e=>!e||re(e.writingDocs,t)?e:{...e,writingDocs:t})},r=n.awareness;if(!r||typeof r.on!=`function`){t();return}r.on(`update`,t),t();let a=setInterval(t,1e3);return()=>{clearInterval(a),typeof r.off==`function`&&r.off(`update`,t)}},b=[e,n],t[8]=e,t[9]=n,t[10]=y,t[11]=b):(y=t[10],b=t[11]),(0,j.useEffect)(y,b);let x;t[12]===e?x=t[13]:(x=async(t,n)=>{if(!e)return``;let r=`${t}\0${n}`,i=f.current.get(r);if(i!==void 0)return i;let a=await N(e,t,n);return f.current.set(r,a),a},t[12]=e,t[13]=x);let S=x,C;t[14]!==e||t[15]!==g?(C=()=>{e&&g(e)},t[14]=e,t[15]=g,t[16]=C):C=t[16];let w=C,T;return t[17]!==r||t[18]!==c||t[19]!==S||t[20]!==w||t[21]!==o?(T={data:r,status:o,error:c,reload:w,fetchBurstDiff:S},t[17]=r,t[18]=c,t[19]=S,t[20]=w,t[21]=o,t[22]=T):T=t[22],T}function re(e,t){if(e.size!==t.size)return!1;for(let n of e)if(!t.has(n))return!1;return!0}function ie(e,t){let n=new Set;if(!e)return n;let r=e.awareness;if(!v(r))return n;let i=[t,t.startsWith(`agent-`)?t.slice(6):`agent-${t}`];for(let e of r.getStates().values()){let t=e.agentPresence;if(t)for(let e of i){let r=t[e];r&&r.mode===`writing`&&r.currentDoc&&n.add(r.currentDoc)}}return n}var P=r(),ae=(0,j.lazy)(async()=>({default:(await t(()=>import(`./ActivityPanelDiffView-C1vRNF09.js`),__vite__mapDeps([0,1,2,3]),import.meta.url)).ActivityPanelDiffView}));function oe(e,t){let n=Math.max(0,t-e);return n<6e4?`${Math.round(n/1e3)}s ago`:n<36e5?`${Math.round(n/6e4)}m ago`:new Date(e).toLocaleTimeString(void 0,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`})}function se(e){let t=(0,A.c)(38),{burst:n,docName:r,fetchBurstDiff:i}=e,[a,o]=(0,j.useState)(!1),[s,c]=(0,j.useState)(null),[d,f]=(0,j.useState)(null),[p,m]=(0,j.useState)(!1),[h,g]=(0,j.useState)(ce),_,v;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(_=()=>{let e=setInterval(()=>g(Date.now()),3e4);return()=>clearInterval(e)},v=[],t[0]=_,t[1]=v):(_=t[0],v=t[1]),(0,j.useEffect)(_,v);let y;t[2]!==n.stackIndex||t[3]!==s||t[4]!==r||t[5]!==a||t[6]!==i||t[7]!==p?(y=()=>{let e=!a;o(e),e&&s===null&&!p&&(m(!0),f(null),i(r,n.stackIndex).then(e=>{c(e),m(!1)}).catch(e=>{f(e instanceof Error?e.message:String(e)),m(!1)}))},t[2]=n.stackIndex,t[3]=s,t[4]=r,t[5]=a,t[6]=i,t[7]=p,t[8]=y):y=t[8];let b=y,x=`${a?`Collapse`:`Expand`} burst ${n.stackIndex+1} diff`,S;t[9]===a?S=t[10]:(S=a?(0,P.jsx)(l,{className:`size-3 shrink-0`,"aria-hidden":`true`}):(0,P.jsx)(u,{className:`size-3 shrink-0`,"aria-hidden":`true`}),t[9]=a,t[10]=S);let C;t[11]!==n.ts||t[12]!==h?(C=oe(n.ts,h),t[11]=n.ts,t[12]=h,t[13]=C):C=t[13];let w;t[14]===C?w=t[15]:(w=(0,P.jsx)(`span`,{className:`font-mono`,children:C}),t[14]=C,t[15]=w);let T;t[16]===n.additions?T=t[17]:(T=(0,P.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additions]}),t[16]=n.additions,t[17]=T);let E;t[18]===n.deletions?E=t[19]:(E=(0,P.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletions]}),t[18]=n.deletions,t[19]=E);let D;t[20]!==T||t[21]!==E?(D=(0,P.jsxs)(`span`,{className:`ml-auto font-mono`,children:[T,` `,E]}),t[20]=T,t[21]=E,t[22]=D):D=t[22];let O;t[23]!==a||t[24]!==D||t[25]!==x||t[26]!==S||t[27]!==w||t[28]!==b?(O=(0,P.jsxs)(`button`,{type:`button`,onClick:b,className:`flex w-full items-center gap-2 px-4 py-1.5 text-xs text-muted-foreground hover:bg-muted/40`,"aria-expanded":a,"aria-label":x,children:[S,w,D]}),t[23]=a,t[24]=D,t[25]=x,t[26]=S,t[27]=w,t[28]=b,t[29]=O):O=t[29];let k;t[30]!==s||t[31]!==a||t[32]!==d||t[33]!==p?(k=a?(0,P.jsx)(`div`,{className:`bg-muted/20`,children:p?(0,P.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:`Loading diff…`}):d?(0,P.jsxs)(`div`,{className:`px-4 py-2 text-xs text-destructive`,children:[`Failed: `,d]}):s===null?(0,P.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:`No diff.`}):(0,P.jsx)(j.Suspense,{fallback:(0,P.jsx)(`div`,{className:`px-4 py-2 text-xs text-muted-foreground italic`,children:`Loading diff…`}),children:(0,P.jsx)(ae,{diff:s})})}):null,t[30]=s,t[31]=a,t[32]=d,t[33]=p,t[34]=k):k=t[34];let M;return t[35]!==O||t[36]!==k?(M=(0,P.jsxs)(`div`,{className:`border-t border-border/50`,children:[O,k]}),t[35]=O,t[36]=k,t[37]=M):M=t[37],M}function ce(){return Date.now()}function le(e,t){let n=Math.max(0,t-e);return n<6e4?`${Math.round(n/1e3)}s ago`:n<36e5?`${Math.round(n/6e4)}m ago`:`${Math.round(n/36e5)}h ago`}function ue(e){let t=(0,A.c)(93),{file:n,sessionAlive:r,isWriting:i,onNavigate:a,onUndoLast:s,onUndoAll:c,fetchBurstDiff:d}=e,[f,p]=(0,j.useState)(!1),[h,g]=(0,j.useState)(!1),[_,v]=(0,j.useState)(!1),[T,M]=(0,j.useState)(fe),ee,te;if(t[0]===Symbol.for(`react.memo_cache_sentinel`)?(ee=()=>{let e=setInterval(()=>M(Date.now()),3e4);return()=>clearInterval(e)},te=[],t[0]=ee,t[1]=te):(ee=t[0],te=t[1]),(0,j.useEffect)(ee,te),n.bursts.length===0)return null;let N=!r||n.bursts.length===0||_,ne=r?n.bursts.length===0?`Nothing to undo on this file`:null:`Session ended — undo unavailable`,re;t[2]!==N||t[3]!==n.docName||t[4]!==s?(re=e=>{e.stopPropagation(),!N&&(v(!0),Promise.resolve(s(n.docName)).finally(()=>v(!1)))},t[2]=N,t[3]=n.docName,t[4]=s,t[5]=re):re=t[5];let ie=re,ae;t[6]===N?ae=t[7]:(ae=e=>{e.stopPropagation(),!N&&g(!0)},t[6]=N,t[7]=ae);let oe=ae,ce;t[8]!==N||t[9]!==n.docName||t[10]!==c?(ce=()=>{g(!1),!N&&(v(!0),Promise.resolve(c(n.docName)).finally(()=>v(!1)))},t[8]=N,t[9]=n.docName,t[10]=c,t[11]=ce):ce=t[11];let ue=ce,F;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>p(de),t[12]=F):F=t[12];let pe=f?`Collapse ${n.docName}`:`Expand ${n.docName}`,I;t[13]===f?I=t[14]:(I=f?(0,P.jsx)(l,{className:`size-4`,"aria-hidden":`true`}):(0,P.jsx)(u,{className:`size-4`,"aria-hidden":`true`}),t[13]=f,t[14]=I);let L;t[15]!==f||t[16]!==pe||t[17]!==I?(L=(0,P.jsx)(`button`,{type:`button`,onClick:F,className:`flex size-5 shrink-0 items-center justify-center rounded hover:bg-muted`,"aria-expanded":f,"aria-label":pe,"data-testid":`activity-panel-file-row-carrot`,children:I}),t[15]=f,t[16]=pe,t[17]=I,t[18]=L):L=t[18];let R;t[19]!==n.docName||t[20]!==a?(R=()=>a(n.docName),t[19]=n.docName,t[20]=a,t[21]=R):R=t[21];let me=`Navigate to ${n.docName}`,z;t[22]!==n.docName||t[23]!==R||t[24]!==me?(z=(0,P.jsx)(`button`,{type:`button`,onClick:R,className:`min-w-0 flex-1 truncate text-left text-foreground hover:underline focus-visible:outline-ring`,"aria-label":me,"data-testid":`activity-panel-file-row-filename`,title:n.docName,children:n.docName}),t[22]=n.docName,t[23]=R,t[24]=me,t[25]=z):z=t[25];let he=`Undo last edit on ${n.docName}`,ge;t[26]===Symbol.for(`react.memo_cache_sentinel`)?(ge=(0,P.jsx)(m,{className:`size-3.5`,"aria-hidden":`true`}),t[26]=ge):ge=t[26];let B;t[27]!==N||t[28]!==ie||t[29]!==he?(B=(0,P.jsx)(E,{asChild:!0,children:(0,P.jsx)(o,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:ie,disabled:N,"aria-label":he,"data-testid":`activity-panel-undo-last`,children:ge})}),t[27]=N,t[28]=ie,t[29]=he,t[30]=B):B=t[30];let _e=ne??`Undo last edit`,V;t[31]===_e?V=t[32]:(V=(0,P.jsx)(D,{side:`bottom`,children:_e}),t[31]=_e,t[32]=V);let H;t[33]!==B||t[34]!==V?(H=(0,P.jsxs)(O,{children:[B,V]}),t[33]=B,t[34]=V,t[35]=H):H=t[35];let ve=`Undo all edits on ${n.docName}`,ye;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(ye=(0,P.jsx)(k,{className:`size-3.5`,"aria-hidden":`true`}),t[36]=ye):ye=t[36];let be;t[37]!==N||t[38]!==oe||t[39]!==ve?(be=(0,P.jsx)(E,{asChild:!0,children:(0,P.jsx)(o,{type:`button`,variant:`ghost`,size:`icon`,className:`size-6 shrink-0`,onClick:oe,disabled:N,"aria-label":ve,"data-testid":`activity-panel-undo-all`,children:ye})}),t[37]=N,t[38]=oe,t[39]=ve,t[40]=be):be=t[40];let xe=ne??`Undo all edits`,U;t[41]===xe?U=t[42]:(U=(0,P.jsx)(D,{side:`bottom`,children:xe}),t[41]=xe,t[42]=U);let W;t[43]!==be||t[44]!==U?(W=(0,P.jsxs)(O,{children:[be,U]}),t[43]=be,t[44]=U,t[45]=W):W=t[45];let G;t[46]===n.additionsTotal?G=t[47]:(G=(0,P.jsxs)(`span`,{className:`text-green-600 dark:text-green-400`,children:[`+`,n.additionsTotal]}),t[46]=n.additionsTotal,t[47]=G);let K;t[48]===n.deletionsTotal?K=t[49]:(K=(0,P.jsxs)(`span`,{className:`text-red-600 dark:text-red-400`,children:[`−`,n.deletionsTotal]}),t[48]=n.deletionsTotal,t[49]=K);let q;t[50]!==G||t[51]!==K?(q=(0,P.jsxs)(`span`,{className:`shrink-0 font-mono text-xs`,children:[G,` `,K]}),t[50]=G,t[51]=K,t[52]=q):q=t[52];let J;t[53]!==n.lastTs||t[54]!==T?(J=le(n.lastTs,T),t[53]=n.lastTs,t[54]=T,t[55]=J):J=t[55];let Y;t[56]===J?Y=t[57]:(Y=(0,P.jsx)(`span`,{className:`shrink-0 font-mono text-[11px] text-muted-foreground`,children:J}),t[56]=J,t[57]=Y);let X;t[58]===i?X=t[59]:(X=i?(0,P.jsx)(`span`,{className:`shrink-0 text-[11px] text-primary animate-pulse`,role:`status`,children:`writing…`}):null,t[58]=i,t[59]=X);let Z;t[60]!==z||t[61]!==H||t[62]!==W||t[63]!==q||t[64]!==Y||t[65]!==X||t[66]!==L?(Z=(0,P.jsxs)(`div`,{className:`flex items-center gap-2 px-3 py-2 text-sm`,children:[L,z,H,W,q,Y,X]}),t[60]=z,t[61]=H,t[62]=W,t[63]=q,t[64]=Y,t[65]=X,t[66]=L,t[67]=Z):Z=t[67];let Q;t[68]!==f||t[69]!==d||t[70]!==n.bursts||t[71]!==n.docName?(Q=f?(0,P.jsx)(`div`,{children:n.bursts.map(e=>(0,P.jsx)(se,{burst:e,docName:n.docName,fetchBurstDiff:d},`${n.docName}:${e.stackIndex}`))}):null,t[68]=f,t[69]=d,t[70]=n.bursts,t[71]=n.docName,t[72]=Q):Q=t[72];let Se;t[73]===Symbol.for(`react.memo_cache_sentinel`)?(Se=(0,P.jsx)(b,{children:`Undo all edits on this file?`}),t[73]=Se):Se=t[73];let Ce;t[74]===n.docName?Ce=t[75]:(Ce=(0,P.jsx)(`span`,{className:`font-mono text-foreground`,children:n.docName}),t[74]=n.docName,t[75]=Ce);let we=n.bursts.length===1?``:`s`,Te;t[76]!==n.bursts.length||t[77]!==Ce||t[78]!==we?(Te=(0,P.jsxs)(C,{children:[Se,(0,P.jsxs)(y,{children:[`This will revert every change this agent has made to`,` `,Ce,` in their current session (`,n.bursts.length,` burst`,we,`). Other files and other writers are not affected.`]})]}),t[76]=n.bursts.length,t[77]=Ce,t[78]=we,t[79]=Te):Te=t[79];let Ee;t[80]===Symbol.for(`react.memo_cache_sentinel`)?(Ee=(0,P.jsx)(o,{type:`button`,variant:`outline`,onClick:()=>g(!1),"data-testid":`activity-panel-undo-all-cancel`,children:`Cancel`}),t[80]=Ee):Ee=t[80];let De;t[81]===ue?De=t[82]:(De=(0,P.jsxs)(S,{children:[Ee,(0,P.jsx)(o,{type:`button`,variant:`destructive`,onClick:ue,"data-testid":`activity-panel-undo-all-confirm`,children:`Undo all`})]}),t[81]=ue,t[82]=De);let Oe;t[83]!==Te||t[84]!==De?(Oe=(0,P.jsxs)(x,{className:`sm:max-w-md`,children:[Te,De]}),t[83]=Te,t[84]=De,t[85]=Oe):Oe=t[85];let $;t[86]!==h||t[87]!==Oe?($=(0,P.jsx)(w,{open:h,onOpenChange:g,children:Oe}),t[86]=h,t[87]=Oe,t[88]=$):$=t[88];let ke;return t[89]!==Z||t[90]!==Q||t[91]!==$?(ke=(0,P.jsxs)(`div`,{className:`border-b border-border`,"data-testid":`activity-panel-file-row`,children:[Z,Q,$]}),t[89]=Z,t[90]=Q,t[91]=$,t[92]=ke):ke=t[92],ke}function de(e){return!e}function fe(){return Date.now()}async function F(e){let t=await fetch(`/api/agent-undo`,{method:`POST`,headers:{"Content-Type":`application/json`},body:JSON.stringify({...e,agentId:e.connectionId})});if(!t.ok)throw Error(`agent-undo failed: HTTP ${t.status}`)}function pe(e){return`#/${e.split(`/`).map(e=>encodeURIComponent(e)).join(`/`)}`}function I(e){typeof window>`u`||(window.location.hash=pe(e))}function L(){let e=(0,A.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,P.jsxs)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,role:`status`,"aria-busy":`true`,children:[(0,P.jsx)(p,{className:`mr-2 size-4 animate-spin`,"aria-hidden":`true`}),(0,P.jsx)(`span`,{className:`text-sm`,children:`Loading agent activity…`})]}),e[0]=t):t=e[0],t}function R(e){let t=(0,A.c)(9),{error:n,onRetry:r}=e,i;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,P.jsx)(c,{className:`size-6 text-destructive`,"aria-hidden":`true`}),t[0]=i):i=t[0];let a;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,P.jsx)(`p`,{className:`text-sm font-medium`,children:`Failed to load activity`}),t[1]=a):a=t[1];let s;t[2]===n?s=t[3]:(s=(0,P.jsxs)(`div`,{className:`space-y-1`,children:[a,(0,P.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n})]}),t[2]=n,t[3]=s);let l;t[4]===r?l=t[5]:(l=(0,P.jsx)(o,{type:`button`,variant:`outline`,size:`sm`,onClick:r,children:`Retry`}),t[4]=r,t[5]=l);let u;return t[6]!==s||t[7]!==l?(u=(0,P.jsxs)(`div`,{className:`flex flex-col items-center gap-3 p-6 text-center`,role:`alert`,"data-testid":`activity-panel-error`,children:[i,s,l]}),t[6]=s,t[7]=l,t[8]=u):u=t[8],u}function me(){let e=(0,A.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,P.jsx)(`div`,{className:`flex h-full items-center justify-center p-6 text-muted-foreground`,"data-testid":`activity-panel-empty`,children:(0,P.jsx)(`p`,{className:`text-sm italic`,children:`No edits yet.`})}),e[0]=t):t=e[0],t}function z(e){let t=(0,A.c)(8),{onExit:n}=e,r;t[0]===n?r=t[1]:(r=(0,P.jsx)(he,{onClick:n}),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,P.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:`Agent activity`}),t[2]=i):i=t[2];let a;t[3]===r?a=t[4]:(a=(0,P.jsxs)(`div`,{className:`flex shrink-0 flex-row items-center gap-2 border-b border-border px-3 py-2`,children:[r,i]}),t[3]=r,t[4]=a);let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,P.jsx)(`div`,{className:`flex flex-1 items-center justify-center p-6 text-muted-foreground`,children:(0,P.jsx)(`p`,{className:`text-center text-sm italic`,children:`Click an agent's avatar in the presence bar to view their session.`})}),t[5]=o):o=t[5];let s;return t[6]===a?s=t[7]:(s=(0,P.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel-no-agent`,"aria-label":`Agent activity`,children:[a,o]}),t[6]=a,t[7]=s),s}function he(e){let t=(0,A.c)(6),{onClick:n}=e,r;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,P.jsx)(g,{}),t[0]=r):r=t[0];let i;t[1]===n?i=t[2]:(i=(0,P.jsx)(E,{asChild:!0,children:(0,P.jsx)(o,{type:`button`,variant:`ghost`,size:`icon`,className:`size-7 shrink-0`,onClick:n,"aria-label":`Back to document view`,"data-testid":`docpanel-exit-agent-mode`,children:r})}),t[1]=n,t[2]=i);let a;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,P.jsx)(D,{side:`bottom`,children:`Back to document view`}),t[3]=a):a=t[3];let s;return t[4]===i?s=t[5]:(s=(0,P.jsxs)(O,{children:[i,a]}),t[4]=i,t[5]=s),s}function ge(e){let t=(0,A.c)(9),{lastTs:n}=e,[r]=(0,j.useState)(B),i;t[0]!==n||t[1]!==r?(i=n?_e(r-n):null,t[0]=n,t[1]=r,t[2]=i):i=t[2];let a=i,o;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,P.jsx)(`span`,{className:`font-medium`,children:`Session ended`}),t[3]=o):o=t[3];let s;t[4]===a?s=t[5]:(s=a?(0,P.jsxs)(`span`,{children:[` · `,a]}):null,t[4]=a,t[5]=s);let c;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,P.jsx)(`div`,{className:`mt-1 opacity-80`,children:`Undo buttons are disabled — per-session state has been garbage-collected.`}),t[6]=c):c=t[6];let l;return t[7]===s?l=t[8]:(l=(0,P.jsxs)(`div`,{className:`border-b border-border bg-muted/40 px-4 py-3 text-xs text-muted-foreground`,"data-testid":`activity-panel-session-ended`,children:[o,s,c]}),t[7]=s,t[8]=l),l}function B(){return Date.now()}function _e(e){let t=Math.max(0,e);return t<6e4?`${Math.round(t/1e3)}s ago`:t<36e5?`${Math.round(t/6e4)}m ago`:`${Math.round(t/36e5)}h ago`}function V(e){let t=(0,A.c)(10),{agent:n,size:r}=e,i=r===void 0?28:r,a;t[0]!==n.color||t[1]!==i?(a={backgroundColor:n.color,width:i,height:i},t[0]=n.color,t[1]=i,t[2]=a):a=t[2];let o=i*.57,s=i*.57,c;t[3]!==n.icon||t[4]!==o||t[5]!==s?(c=(0,P.jsx)(_,{icon:n.icon,width:o,height:s}),t[3]=n.icon,t[4]=o,t[5]=s,t[6]=c):c=t[6];let l;return t[7]!==a||t[8]!==c?(l=(0,P.jsx)(`span`,{className:`inline-flex shrink-0 items-center justify-center rounded-full text-white ring-2 ring-background`,style:a,"aria-hidden":`true`,children:c}),t[7]=a,t[8]=c,t[9]=l):l=t[9],l}function H(e){let t=(0,A.c)(20),{data:n,status:r,error:i,reload:a,fetchBurstDiff:o,onExit:s,onNavigate:c,onUndoLast:l,onUndoAll:u}=e,d=n?.files?.[0]?.lastTs??null,f;t[0]===s?f=t[1]:(f=(0,P.jsx)(he,{onClick:s}),t[0]=s,t[1]=f);let p;t[2]===n?p=t[3]:(p=n?.agent?(0,P.jsxs)(P.Fragment,{children:[(0,P.jsx)(V,{agent:n.agent}),(0,P.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,P.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:n.agent.displayName}),(0,P.jsxs)(`p`,{className:`truncate text-xs text-muted-foreground`,children:[n.sessionAlive?`Active`:`Ended`,n.files.length>0?` · ${n.files.length} file${n.files.length===1?``:`s`}`:``]})]})]}):(0,P.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,P.jsx)(`h2`,{className:`truncate text-sm font-medium`,children:`Agent activity`})}),t[2]=n,t[3]=p);let m;t[4]!==f||t[5]!==p?(m=(0,P.jsxs)(`div`,{className:`flex flex-row items-center gap-2 border-b border-border px-3 py-2 shrink-0`,children:[f,p]}),t[4]=f,t[5]=p,t[6]=m):m=t[6];let h;t[7]!==n||t[8]!==i||t[9]!==o||t[10]!==d||t[11]!==c||t[12]!==u||t[13]!==l||t[14]!==a||t[15]!==r?(h=(0,P.jsx)(`div`,{className:`flex-1 overflow-y-auto`,"data-testid":`activity-panel-body`,children:r===`loading`&&n===null?(0,P.jsx)(L,{}):r===`error`&&i?(0,P.jsx)(R,{error:i,onRetry:a}):n===null?(0,P.jsx)(me,{}):(0,P.jsxs)(P.Fragment,{children:[n.sessionAlive?null:(0,P.jsx)(ge,{lastTs:d}),n.files.length===0?(0,P.jsx)(me,{}):n.files.map(e=>(0,P.jsx)(ue,{file:e,sessionAlive:n.sessionAlive,isWriting:n.writingDocs.has(e.docName),onNavigate:c,onUndoLast:l,onUndoAll:u,fetchBurstDiff:o},e.docName))]})}),t[7]=n,t[8]=i,t[9]=o,t[10]=d,t[11]=c,t[12]=u,t[13]=l,t[14]=a,t[15]=r,t[16]=h):h=t[16];let g;return t[17]!==m||t[18]!==h?(g=(0,P.jsxs)(`section`,{className:`flex h-full min-h-0 flex-col`,"data-testid":`activity-panel`,"aria-label":`Agent activity`,children:[m,h]}),t[17]=m,t[18]=h,t[19]=g):g=t[19],g}function ve(){let e=(0,A.c)(22),{docPanelAgentId:t,closeActivityPanel:n}=d(),{openDocumentTransition:r}=f(),{data:i,status:a,error:o,reload:s,fetchBurstDiff:c}=ne(t);if(t===null){let t;return e[0]===n?t=e[1]:(t=(0,P.jsx)(z,{onExit:n}),e[0]=n,e[1]=t),t}let l;e[2]===r?l=e[3]:(l=e=>{r(e),I(e)},e[2]=r,e[3]=l);let u=l,p;e[4]!==i||e[5]!==t||e[6]!==s?(p=async e=>{try{await F({connectionId:t,docName:e,scope:`last`,agentName:i?.agent?.displayName}),s()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);T.error(`Undo failed: ${n}`),s()}},e[4]=i,e[5]=t,e[6]=s,e[7]=p):p=e[7];let m=p,h;e[8]!==i||e[9]!==t||e[10]!==s?(h=async e=>{try{await F({connectionId:t,docName:e,scope:`file`,agentName:i?.agent?.displayName}),T.success(`Undone all edits on ${e}`),s()}catch(e){let t=e,n=t instanceof Error?t.message:String(t);T.error(`Undo all failed: ${n}`),s()}},e[8]=i,e[9]=t,e[10]=s,e[11]=h):h=e[11];let g=h,_;return e[12]!==n||e[13]!==i||e[14]!==o||e[15]!==c||e[16]!==u||e[17]!==g||e[18]!==m||e[19]!==s||e[20]!==a?(_=(0,P.jsx)(H,{data:i,status:a,error:o,reload:s,fetchBurstDiff:c,onExit:n,onNavigate:u,onUndoLast:m,onUndoAll:g}),e[12]=n,e[13]=i,e[14]=o,e[15]=c,e[16]=u,e[17]=g,e[18]=m,e[19]=s,e[20]=a,e[21]=_):_=e[21],_}export{ve as ActivityModeContent};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e,t as n}from"./chunk-DECur_0Z.js";import{n as r,r as i,t as a}from"./compiler-runtime-Y11fyRVL.js";import{a as o,c as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./panel-DiSt1efw.js";import{N as m,Nn as h,i as g,jn as _,n as v,o as y,t as b,u as x,yt as S}from"./toggle-group-Czy0P9Ee.js";import{n as C,t as w,x as T}from"./button-CXhPNzpp.js";import{n as E,r as D,t as ee}from"./target-navigation-intent-BgBCKYrO.js";import{t as O}from"./circle-check-bKAq6pcI.js";import{i as te,n as ne,t as re}from"./tooltip-
|
|
1
|
+
import{r as e,t as n}from"./chunk-DECur_0Z.js";import{n as r,r as i,t as a}from"./compiler-runtime-Y11fyRVL.js";import{a as o,c as s,i as c,n as l,o as u,r as d,s as f,t as p}from"./panel-DiSt1efw.js";import{N as m,Nn as h,i as g,jn as _,n as v,o as y,t as b,u as x,yt as S}from"./toggle-group-Czy0P9Ee.js";import{n as C,t as w,x as T}from"./button-CXhPNzpp.js";import{n as E,r as D,t as ee}from"./target-navigation-intent-BgBCKYrO.js";import{t as O}from"./circle-check-bKAq6pcI.js";import{i as te,n as ne,t as re}from"./tooltip-Dqn5ly4m.js";var ie=T(`maximize-2`,[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`m21 3-7 7`,key:`1l2asr`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M9 21H3v-6`,key:`wtvkvv`}]]),ae=T(`minimize-2`,[[`path`,{d:`m14 10 7-7`,key:`oa77jy`}],[`path`,{d:`M20 10h-6V4`,key:`mjg0md`}],[`path`,{d:`m3 21 7-7`,key:`tjx5ai`}],[`path`,{d:`M4 14h6v6`,key:`rmj7iw`}]]),k=e(r(),1),oe=a(),se=[`#60a5fa`,`#a78bfa`,`#34d399`,`#f472b6`,`#fb923c`,`#22d3ee`,`#c084fc`,`#4ade80`,`#f87171`,`#eab308`,`#ec4899`,`#06b67f`,`#8b5cf6`,`#f43f5e`,`#0ea5e9`,`#a855f7`],ce=[`#1e40af`,`#6b21a8`,`#166534`,`#9f1239`,`#9a3412`,`#164e63`,`#581c87`,`#166534`,`#991b1b`,`#854d0e`,`#831843`,`#0f766e`,`#312e81`,`#9f1239`,`#0c4a6e`,`#6b21a8`];function le(e){let n=2;for(let r=0;r<e.length;r++)n=Math.imul(n^e.charCodeAt(r),1540483477),n^=n>>>13,n=Math.imul(n,1540483477),n^=n>>>15;return n>>>0}function ue(e,n){let r=n?se:ce;return r[le(e)%r.length]}var A=i(),de={fullscreen:{maxEntries:10,containerClassName:`bottom-3 left-3 gap-1 rounded-lg px-3 py-2 text-xs`,titleClassName:`mb-1.5`,rowClassName:`gap-2`,swatchClassName:`size-2.5`,labelClassName:`max-w-[140px]`,overflowClassName:`pl-[18px]`},docked:{maxEntries:6,containerClassName:`bottom-2 left-2 gap-0.5 rounded-md px-2 py-1.5 text-[11px]`,titleClassName:`mb-1`,rowClassName:`gap-1.5`,swatchClassName:`size-2`,labelClassName:`max-w-[112px]`,overflowClassName:`pl-[14px]`}};function fe(e){return de[e]}function pe(e){let n=(0,oe.c)(5),{clusters:r,variant:i}=e,a=i===void 0?`fullscreen`:i,{resolvedTheme:o}=h(),s=o===`dark`,c,l;if(n[0]!==r||n[1]!==s||n[2]!==a){l=Symbol.for(`react.early_return_sentinel`);bb0:{let e=fe(a);if(r.length===0){l=null;break bb0}let n=r.slice(0,e.maxEntries),i=r.length-n.length;c=(0,A.jsxs)(`div`,{className:C(`pointer-events-none absolute z-10 flex flex-col backdrop-blur-sm`,e.containerClassName,s?`bg-black/70 text-gray-200`:`bg-white/80 text-gray-800 ring-1 ring-black/5`),children:[(0,A.jsx)(`div`,{className:C(`font-medium`,e.titleClassName,s?`text-slate-300`:`text-slate-700`),children:`Clusters`}),n.map(n=>(0,A.jsxs)(`div`,{className:C(`flex items-center`,e.rowClassName),children:[(0,A.jsx)(`span`,{className:C(`inline-block shrink-0 rounded-full`,e.swatchClassName),style:{backgroundColor:ue(n,s)}}),(0,A.jsx)(`span`,{className:C(`truncate`,e.labelClassName),children:n})]},n)),i>0&&(0,A.jsxs)(`div`,{className:C(`text-muted-foreground`,e.overflowClassName),children:[`+ `,i,` more`]})]})}n[0]=r,n[1]=s,n[2]=a,n[3]=c,n[4]=l}else c=n[3],l=n[4];return l===Symbol.for(`react.early_return_sentinel`)?c:l}function me(e,n){var r=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(r!=null){var i,a,o,s,c=[],l=!0,u=!1;try{if(o=(r=r.call(e)).next,n===0){if(Object(r)!==r)return;l=!1}else for(;!(l=(i=o.call(r)).done)&&(c.push(i.value),c.length!==n);l=!0);}catch(e){u=!0,a=e}finally{try{if(!l&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return c}}function he(e,n,r){return n=we(n),n in e?Object.defineProperty(e,n,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[n]=r,e}function ge(e,n){return ye(e)||me(e,n)||xe(e,n)||j()}function _e(e){return ve(e)||be(e)||xe(e)||Ce()}function ve(e){if(Array.isArray(e))return Se(e)}function ye(e){if(Array.isArray(e))return e}function be(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function xe(e,n){if(e){if(typeof e==`string`)return Se(e,n);var r=Object.prototype.toString.call(e).slice(8,-1);if(r===`Object`&&e.constructor&&(r=e.constructor.name),r===`Map`||r===`Set`)return Array.from(e);if(r===`Arguments`||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r))return Se(e,n)}}function Se(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function Ce(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
2
2
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function j(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
3
3
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function M(e,n){if(typeof e!=`object`||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var i=r.call(e,n||`default`);if(typeof i!=`object`)return i;throw TypeError(`@@toPrimitive must return a primitive value.`)}return(n===`string`?String:Number)(e)}function we(e){var n=M(e,`string`);return typeof n==`symbol`?n:String(n)}var Te=function(e,n){var r=new Set(n);return Object.assign.apply(Object,[{}].concat(_e(Object.entries(e).filter(function(e){var n=ge(e,1)[0];return!r.has(n)}).map(function(e){var n=ge(e,2),r=n[0],i=n[1];return he({},r,i)}))))};function Ee(e,n){(n==null||n>e.length)&&(n=e.length);for(var r=0,i=Array(n);r<n;r++)i[r]=e[r];return i}function De(e){if(Array.isArray(e))return e}function N(e){if(Array.isArray(e))return Ee(e)}function Oe(e){if(typeof Symbol<`u`&&e[Symbol.iterator]!=null||e[`@@iterator`]!=null)return Array.from(e)}function ke(e,n){var r=e==null?null:typeof Symbol<`u`&&e[Symbol.iterator]||e[`@@iterator`];if(r!=null){var i,a,o,s,c=[],l=!0,u=!1;try{if(o=(r=r.call(e)).next,n!==0)for(;!(l=(i=o.call(r)).done)&&(c.push(i.value),c.length!==n);l=!0);}catch(e){u=!0,a=e}finally{try{if(!l&&r.return!=null&&(s=r.return(),Object(s)!==s))return}finally{if(u)throw a}}return c}}function Ae(){throw TypeError(`Invalid attempt to destructure non-iterable instance.
|
|
4
4
|
In order to be iterable, non-array objects must have a [Symbol.iterator]() method.`)}function je(){throw TypeError(`Invalid attempt to spread non-iterable instance.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./compiler-runtime-Y11fyRVL.js";import{t as i}from"./button-CXhPNzpp.js";import{a,c as o,i as s,n as c,o as l,s as u,t as d,x as f}from"./dialog-CJazZw1E.js";import{n as p}from"./mcp-consent-store-BBTXqzE6.js";var m=r(),h=e(t(),1),g=n();function _(e){let t=new Set;for(let n of e)n.detected&&t.add(n.id);return t}function v(e,t){let n=new Set(e);return n.has(t)?n.delete(t):n.add(t),n}function y(e,t){let n=[];for(let r of t)e.has(r.id)&&n.push(r.id);return n}var b={error:e=>f.error(e)};function x(e){let t=(0,m.c)(9),n;t[0]===e?n=t[1]:(n=e===void 0?{}:e,t[0]=e,t[1]=n);let{store:r,toast:i,payload:a}=n,o=r===void 0?p:r,s=i===void 0?b:i,c;t[2]!==a||t[3]!==o?(c=a??o.getSnapshot(),t[2]=a,t[3]=o,t[4]=c):c=t[4];let l=c;if(!l)return null;let u;return t[5]!==l||t[6]!==o||t[7]!==s?(u=(0,g.jsx)(S,{payload:l,store:o,toast:s}),t[5]=l,t[6]=o,t[7]=s,t[8]=u):u=t[8],u}function S(e){let t=(0,m.c)(44),{payload:n,store:r,toast:f}=e,p=n.detectedEditors,b;t[0]===p?b=t[1]:(b=()=>_(p),t[0]=p,t[1]=b);let[x,S]=(0,h.useState)(b),[C,w]=(0,h.useState)(!1),T;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(T=function(e){S(t=>v(t,e))},t[2]=T):T=t[2];let E=T,D;t[3]!==p||t[4]!==x||t[5]!==r||t[6]!==f?(D=async function(){w(!0);let e=await r.confirm(y(x,p));e.ok||(f.error(e.error),w(!1))},t[3]=p,t[4]=x,t[5]=r,t[6]=f,t[7]=D):D=t[7];let O=D,k;t[8]!==r||t[9]!==f?(k=async function(){w(!0);let e=await r.skip();e.ok||(f.error(e.error),w(!1))},t[8]=r,t[9]=f,t[10]=k):k=t[10];let A=k,j;t[11]!==C||t[12]!==A?(j=function(e){!e&&!C&&A()},t[11]=C,t[12]=A,t[13]=j):j=t[13];let M=j,N;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,g.jsxs)(u,{children:[(0,g.jsx)(o,{children:`Add Open Knowledge to your AI tools`}),(0,g.jsx)(a,{children:`Connect Open Knowledge to your AI tools so they can read and write your notes. Once added, asking Claude to summarize or update a page works without copy-paste. Detected editors are preselected — you can toggle any row.`})]}),t[14]=N):N=t[14];let P;if(t[15]!==C||t[16]!==p||t[17]!==x){let e;t[19]!==C||t[20]!==x?(e=e=>{let t=x.has(e.id),n=e.willReplace?`Will replace existing Open Knowledge entry`:e.detected?`Detected on this machine`:`Not detected`,r=e.willReplace?`text-xs text-amber-600 dark:text-amber-400`:`text-xs text-muted-foreground`;return(0,g.jsx)(`li`,{children:(0,g.jsxs)(`label`,{className:`flex cursor-pointer items-center gap-2.5 px-3 py-2.5 text-sm hover:bg-accent`,children:[(0,g.jsx)(`input`,{type:`checkbox`,checked:t,disabled:C,onChange:()=>E(e.id),className:`size-4 shrink-0 rounded accent-primary`,"data-testid":`mcp-consent-checkbox-${e.id}`}),(0,g.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-0.5`,children:[(0,g.jsx)(`span`,{className:`font-medium text-foreground`,children:e.label}),(0,g.jsx)(`span`,{className:r,"data-testid":`mcp-consent-status-${e.id}`,children:n})]})]})},e.id)},t[19]=C,t[20]=x,t[21]=e):e=t[21],P=p.map(e),t[15]=C,t[16]=p,t[17]=x,t[18]=P}else P=t[18];let F;t[22]===P?F=t[23]:(F=(0,g.jsx)(c,{children:(0,g.jsx)(`ul`,{className:`rounded-md border border-border bg-card/50 divide-y divide-border`,children:P})}),t[22]=P,t[23]=F);let I;t[24]===A?I=t[25]:(I=()=>void A(),t[24]=A,t[25]=I);let L;t[26]!==C||t[27]!==I?(L=(0,g.jsx)(i,{variant:`outline`,className:`font-mono uppercase`,onClick:I,disabled:C,"data-testid":`mcp-consent-skip`,children:`Skip`}),t[26]=C,t[27]=I,t[28]=L):L=t[28];let R;t[29]===O?R=t[30]:(R=()=>void O(),t[29]=O,t[30]=R);let z=C||x.size===0,B=C?`Working...`:`Add`,V;t[31]!==R||t[32]!==z||t[33]!==B?(V=(0,g.jsx)(i,{onClick:R,disabled:z,"data-testid":`mcp-consent-add`,children:B}),t[31]=R,t[32]=z,t[33]=B,t[34]=V):V=t[34];let H;t[35]!==L||t[36]!==V?(H=(0,g.jsxs)(l,{children:[L,V]}),t[35]=L,t[36]=V,t[37]=H):H=t[37];let U;t[38]!==H||t[39]!==F?(U=(0,g.jsxs)(s,{className:`sm:max-w-md`,children:[N,F,H]}),t[38]=H,t[39]=F,t[40]=U):U=t[40];let W;return t[41]!==M||t[42]!==U?(W=(0,g.jsx)(d,{open:!0,onOpenChange:M,children:U}),t[41]=M,t[42]=U,t[43]=W):W=t[43],W}export{x as McpConsentDialogBody,x as default,_ as computeInitialSelection,y as selectedIdsOrdered,v as toggleSelectedId};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./compiler-runtime-Y11fyRVL.js";import{At as i,Ct as a,T as o,ct as s,kt as c,n as l,t as u,vt as d,w as f,z as p}from"./toggle-group-Czy0P9Ee.js";import{t as m,x as h}from"./button-CXhPNzpp.js";import{N as g,V as _,Z as v,n as y,w as b}from"./DocumentContext-B1Fp4JCg.js";import{i as x,n as S,r as C,s as w}from"./config-validation-events-CpU7XuBS.js";import{S as T,x as E}from"./dialog-CJazZw1E.js";import{i as D,n as O,t as k}from"./tooltip-CrLpzBBL.js";var A=h(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),j=e(t(),1),M=r();function N(e,t){if(e.length===0)throw Error(`buildPatch: path must be non-empty`);let[n,...r]=e;return r.length===0?{[String(n)]:t}:{[String(n)]:N(r,t)}}function P(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n)return;n=n[String(e)]}return n}function F(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(e?.type===`default`){let t=e.defaultValue;return typeof t==`function`?t():t}let n=t?._zod?.def?.innerType;if(n===void 0)return;t=n}}function I(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(!e)return;if(e.type===`default`||e.type===`optional`||e.type===`nullable`){t=e.innerType;continue}return e.type}}function ee(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(!e)return;if(e.type===`enum`)return e.entries?Object.values(e.entries):void 0;if(e.innerType!==void 0){t=e.innerType;continue}return}}var L=n(),R=[{id:`content`,title:`Content`,description:`Where Open Knowledge looks for documents.`,fields:[{path:[`content`,`dir`],label:`Content directory`,description:`Project-relative path containing your markdown files.`},{path:[`content`,`include`],label:`Include patterns`,description:`Glob patterns selecting which files are content. One per line.`},{path:[`content`,`exclude`],label:`Exclude patterns`,description:`Glob patterns to skip. One per line.`}]},{id:`server`,title:`Server`,description:`Local server bind and behavior.`,fields:[{path:[`server`,`host`],label:`Host`,description:`Bind interface (e.g. localhost, 0.0.0.0).`},{path:[`server`,`openOnAgentEdit`],label:`Open preview on agent edit`,description:`When enabled, an agent write opens the preview tab if not already open.`}]},{id:`github`,title:`GitHub`,description:`OAuth app identity for sign-in. Tokens are stored in your OS keychain, not here.`,fields:[{path:[`github`,`oauthAppClientId`],label:`OAuth App client ID`,description:`Public client ID for the GitHub OAuth app. Defaults to the published Open Knowledge app.`}]},{id:`preview`,title:`Preview`,description:`Where the preview tab points when no local UI is running.`,fields:[{path:[`preview`,`baseUrl`],label:`Preview base URL`,description:`URL of your team’s deployed wiki (workspace-only).`}]},{id:`mcp`,title:`MCP`,description:`Model Context Protocol agent integration tuning.`,fields:[{path:[`mcp`,`autoStart`],label:`Auto-start server`,description:"When enabled, `ok mcp` spawns `ok start` automatically."},{path:[`mcp`,`tools`,`read_document`,`historyDepth`],label:`read_document history depth`,description:`How many history entries the agent’s read_document tool returns.`},{path:[`mcp`,`tools`,`search`,`maxResults`],label:`search max results`,description:`Cap on results returned by the agent’s search tool.`}]},{id:`appearance`,title:`Appearance`,description:`UI preferences. Editor toggles continue to write localStorage as a cache.`,fields:[{path:[`appearance`,`theme`],label:`Theme`,description:`Light, dark, or follow the OS.`,control:`enum-toggle`},{path:[`appearance`,`editorModeDefault`],label:`Default editor mode`,description:`Which mode new docs open in by default.`,control:`enum-toggle`}]}];function z(e,t){let n=(0,M.c)(4),[r,i]=(0,j.useState)(null),a,s;return n[0]!==e||n[1]!==t?(a=()=>{if(e===null)return;let n=t===`workspace`?o:f,r=new v,a=new _({url:e,name:n,document:r}),s=p(a,t),c=!0,l=()=>{c&&i(e=>e?.provider===a?{...e,synced:!0,config:s.current()}:e)};a.on(`synced`,l);let u=s.subscribe(e=>{c&&i(t=>t?.provider===a?t&&{...t,config:e}:t)});return i({provider:a,binding:s,config:s.current(),synced:!1}),()=>{c=!1,u(),a.off(`synced`,l),s.dispose(),a.destroy(),r.destroy(),i(e=>e?.provider===a?null:e)}},s=[e,t],n[0]=e,n[1]=t,n[2]=a,n[3]=s):(a=n[2],s=n[3]),(0,j.useEffect)(a,s),r}function B(e){let t=(0,M.c)(28),{scope:n,onClose:r,onScopeChange:i}=e,{collabUrl:a}=y(),o=z(a,n),[c,d]=(0,j.useState)(null),f=(0,j.useRef)(null),p,h;t[0]===n?(p=t[1],h=t[2]):(p=()=>{let e=S(e=>{if(!(n===`workspace`&&e.docName===`__config__/workspace`||n===`user`&&e.docName===`__user__/config.yml`))return;E.error(s(e.error),{duration:8e3});let t=V(e.error);t&&(d(t),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>d(null),600))});return()=>{e(),f.current&&clearTimeout(f.current)}},h=[n],t[0]=n,t[1]=p,t[2]=h),(0,j.useEffect)(p,h);let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,L.jsx)(`h1`,{className:`text-sm font-semibold`,children:`Settings`}),t[3]=g):g=t[3];let _;t[4]===i?_=t[5]:(_=e=>{(e===`workspace`||e===`user`)&&i(e)},t[4]=i,t[5]=_);let v,b;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,L.jsx)(l,{value:`workspace`,className:`text-xs`,children:`This project`}),b=(0,L.jsx)(l,{value:`user`,className:`text-xs`,children:`User`}),t[6]=v,t[7]=b):(v=t[6],b=t[7]);let x;t[8]!==n||t[9]!==_?(x=(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[g,(0,L.jsxs)(u,{type:`single`,value:n,onValueChange:_,"aria-label":`Settings scope`,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg`,children:[v,b]})]}),t[8]=n,t[9]=_,t[10]=x):x=t[10];let C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,L.jsx)(T,{className:`size-4`}),t[11]=C):C=t[11];let w;t[12]===r?w=t[13]:(w=(0,L.jsx)(D,{asChild:!0,children:(0,L.jsx)(m,{variant:`ghost`,size:`icon`,onClick:r,"aria-label":`Close settings`,className:`text-muted-foreground`,children:C})}),t[12]=r,t[13]=w);let A;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,L.jsx)(O,{children:`Close`}),t[14]=A):A=t[14];let N;t[15]===w?N=t[16]:(N=(0,L.jsxs)(k,{children:[w,A]}),t[15]=w,t[16]=N);let P;t[17]!==N||t[18]!==x?(P=(0,L.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center justify-between border-b px-4`,children:[x,N]}),t[17]=N,t[18]=x,t[19]=P):P=t[19];let F;t[20]!==o||t[21]!==c||t[22]!==n?(F=(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:o===null||!o.synced?(0,L.jsx)(H,{}):(0,L.jsx)(W,{scope:n,binding:o.binding,config:o.config,flashedPath:c})}),t[20]=o,t[21]=c,t[22]=n,t[23]=F):F=t[23];let I;return t[24]!==n||t[25]!==P||t[26]!==F?(I=(0,L.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,"data-testid":`settings-pane`,"data-scope":n,children:[P,F]}),t[24]=n,t[25]=P,t[26]=F,t[27]=I):I=t[27],I}function V(e){if(!d(e)||e.code!==`SCHEMA_INVALID`)return null;let t=e.issues[0];return!t||t.path.length===0?null:t.path.map(String).join(`.`)}function H(){let e=(0,M.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsx)(`div`,{className:`space-y-6 p-6`,children:Array.from({length:3}).map(U)}),e[0]=t):t=e[0],t}function U(e,t){return(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(x,{className:`h-5 w-32`}),(0,L.jsx)(x,{className:`h-4 w-64`}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(x,{className:`h-9 w-full`}),(0,L.jsx)(x,{className:`h-9 w-full`})]})]},t)}function W(e){let t=(0,M.c)(8),{scope:n,binding:r,config:i,flashedPath:a}=e,o;t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==n?(o=R.map(e=>{let t=e.fields.filter(e=>G(e.path,n));return t.length===0?null:(0,L.jsx)(K,{section:e,children:t.map(e=>(0,L.jsx)(q,{field:e,scope:n,binding:r,config:i,isFlashed:a===e.path.join(`.`)},e.path.join(`.`)))},e.id)}),t[0]=r,t[1]=i,t[2]=a,t[3]=n,t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,L.jsx)(se,{}),t[5]=s):s=t[5];let c;return t[6]===o?c=t[7]:(c=(0,L.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-8 p-6`,children:[o,s]}),t[6]=o,t[7]=c),c}function G(e,t){let n=a(c,e);if(!n)return!0;let r=i(n);return r?!(r.scope===`workspace`&&t!==`workspace`||r.scope===`user`&&t!==`user`):!0}function K(e){let t=(0,M.c)(14),{section:n,children:r}=e,i=`settings-${n.id}-title`,a=`settings-${n.id}-title`,o;t[0]!==n.title||t[1]!==a?(o=(0,L.jsx)(`h2`,{id:a,className:`text-base font-semibold`,children:n.title}),t[0]=n.title,t[1]=a,t[2]=o):o=t[2];let s;t[3]===n.description?s=t[4]:(s=(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n.description}),t[3]=n.description,t[4]=s);let c;t[5]!==o||t[6]!==s?(c=(0,L.jsxs)(`div`,{className:`space-y-1`,children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;t[8]===r?l=t[9]:(l=(0,L.jsx)(`div`,{className:`space-y-4`,children:r}),t[8]=r,t[9]=l);let u;return t[10]!==i||t[11]!==c||t[12]!==l?(u=(0,L.jsxs)(`section`,{"aria-labelledby":i,className:`space-y-3`,children:[c,l]}),t[10]=i,t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function q(e){let t=(0,M.c)(55),{field:n,scope:r,binding:o,config:s,isFlashed:l}=e,u,d,f,p,h,g;if(t[0]!==s||t[1]!==n.path){let e=a(c,n.path);g=e?I(e):void 0,d=e?F(e):void 0,u=P(s,n.path),p=e?i(e):void 0,f=e?ee(e):void 0,h=d===void 0?u!=null:!$(u,d),t[0]=s,t[1]=n.path,t[2]=u,t[3]=d,t[4]=f,t[5]=p,t[6]=h,t[7]=g}else u=t[2],d=t[3],f=t[4],p=t[5],h=t[6],g=t[7];let _=h,v;t[8]===n.path?v=t[9]:(v=n.path.join(`-`),t[8]=n.path,t[9]=v);let y=v,b=`${y}-error`,[x,S]=(0,j.useState)(null),C;t[10]!==o||t[11]!==n.path?(C=e=>{let t=N(n.path,e),r=o.patch(t);return r.ok?(S(null),!0):(S(oe(r.error)),!1)},t[10]=o,t[11]=n.path,t[12]=C):C=t[12];let w=C,T;t[13]!==w||t[14]!==d?(T=()=>{w(d===void 0?null:d)},t[13]=w,t[14]=d,t[15]=T):T=t[15];let E=T,R;t[16]===_?R=t[17]:(R=_?(0,L.jsx)(`span`,{"data-modified":`true`,"aria-hidden":`true`,className:`absolute -left-3 top-1 h-5 w-0.5 rounded-full bg-primary`}):null,t[16]=_,t[17]=R);let z=R,B=`relative space-y-1 ${l?`animate-settings-flash`:``}`,V;t[18]===n.path?V=t[19]:(V=n.path.join(`.`),t[18]=n.path,t[19]=V);let H;t[20]!==n.label||t[21]!==y?(H=(0,L.jsx)(`label`,{htmlFor:y,className:`text-sm font-medium`,children:n.label}),t[20]=n.label,t[21]=y,t[22]=H):H=t[22];let U;t[23]!==u||t[24]!==d||t[25]!==n.label||t[26]!==E?(U=d!==void 0||u!==void 0?(0,L.jsxs)(k,{children:[(0,L.jsx)(D,{asChild:!0,children:(0,L.jsx)(m,{variant:`ghost`,size:`icon`,className:`h-6 w-6 text-muted-foreground opacity-60 hover:opacity-100`,onClick:E,"aria-label":`Reset ${n.label} to default`,children:(0,L.jsx)(A,{className:`size-3.5`})})}),(0,L.jsx)(O,{children:`Reset to default`})]}):null,t[23]=u,t[24]=d,t[25]=n.label,t[26]=E,t[27]=U):U=t[27];let W;t[28]!==H||t[29]!==U?(W=(0,L.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[H,U]}),t[28]=H,t[29]=U,t[30]=W):W=t[30];let G;t[31]===n.description?G=t[32]:(G=n.description?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n.description}):null,t[31]=n.description,t[32]=G);let K=x?b:void 0,q=p?.scope===`workspace`&&r!==`workspace`?`This field can only be set per-project. Switch to the 'This project' tab to edit it.`:p?.scope===`user`&&r!==`user`?`This field can only be set globally. Switch to the 'User' tab to edit it.`:null,J;t[33]!==w||t[34]!==u||t[35]!==f||t[36]!==n||t[37]!==y||t[38]!==K||t[39]!==q||t[40]!==g?(J=(0,L.jsx)(te,{field:n,fieldId:y,errorId:K,typeTag:g,currentValue:u,enumOptions:f,onCommit:w,readonlyReason:q}),t[33]=w,t[34]=u,t[35]=f,t[36]=n,t[37]=y,t[38]=K,t[39]=q,t[40]=g,t[41]=J):J=t[41];let Y;t[42]!==x||t[43]!==b||t[44]!==n.path?(Y=x?(0,L.jsx)(`p`,{id:b,role:`alert`,className:`text-xs text-destructive`,"data-field-error":n.path.join(`.`),children:x}):null,t[42]=x,t[43]=b,t[44]=n.path,t[45]=Y):Y=t[45];let X;return t[46]!==z||t[47]!==r||t[48]!==G||t[49]!==J||t[50]!==Y||t[51]!==V||t[52]!==W||t[53]!==B?(X=(0,L.jsxs)(`div`,{className:B,"data-field":V,"data-scope":r,children:[z,W,G,J,Y]}),t[46]=z,t[47]=r,t[48]=G,t[49]=J,t[50]=Y,t[51]=V,t[52]=W,t[53]=B,t[54]=X):X=t[54],X}function te(e){let t=(0,M.c)(32),{field:n,fieldId:r,errorId:i,typeTag:a,currentValue:o,enumOptions:s,onCommit:c,readonlyReason:l}=e;if(l){let e;return t[0]!==r||t[1]!==l?(e=(0,L.jsx)(`div`,{id:r,role:`note`,className:`rounded border border-dashed border-muted px-3 py-2 text-xs text-muted-foreground`,children:l}),t[0]=r,t[1]=l,t[2]=e):e=t[2],e}if(a===`boolean`){let e=!!o,n;return t[3]!==i||t[4]!==r||t[5]!==c||t[6]!==e?(n=(0,L.jsx)(X,{fieldId:r,errorId:i,value:e,onCommit:c}),t[3]=i,t[4]=r,t[5]=c,t[6]=e,t[7]=n):n=t[7],n}if(a===`enum`&&s&&s.length>0&&(n.control===`enum-toggle`||s.length<=4)){let e=typeof o==`string`?o:``,a;return t[8]!==s||t[9]!==i||t[10]!==n.label||t[11]!==r||t[12]!==c||t[13]!==e?(a=(0,L.jsx)(ne,{fieldId:r,errorId:i,ariaLabel:n.label,options:s,value:e,onCommit:c}),t[8]=s,t[9]=i,t[10]=n.label,t[11]=r,t[12]=c,t[13]=e,t[14]=a):a=t[14],a}if(a===`number`||a===`int`){let e=typeof o==`number`?o:0,n;return t[15]!==i||t[16]!==r||t[17]!==c||t[18]!==e?(n=(0,L.jsx)(Y,{fieldId:r,errorId:i,value:e,onCommit:c}),t[15]=i,t[16]=r,t[17]=c,t[18]=e,t[19]=n):n=t[19],n}if(a===`array`){let e;t[20]===o?e=t[21]:(e=Array.isArray(o)?o:[],t[20]=o,t[21]=e);let n;return t[22]!==i||t[23]!==r||t[24]!==c||t[25]!==e?(n=(0,L.jsx)(re,{fieldId:r,errorId:i,value:e,onCommit:c}),t[22]=i,t[23]=r,t[24]=c,t[25]=e,t[26]=n):n=t[26],n}let u=typeof o==`string`?o:``,d;return t[27]!==i||t[28]!==r||t[29]!==c||t[30]!==u?(d=(0,L.jsx)(J,{fieldId:r,errorId:i,value:u,onCommit:c}),t[27]=i,t[28]=r,t[29]=c,t[30]=u,t[31]=d):d=t[31],d}function J(e){let t=(0,M.c)(22),{fieldId:n,errorId:r,value:i,onCommit:a}=e,[o,s]=(0,j.useState)(i),[c,l]=(0,j.useState)(!1),u=(0,j.useRef)(i),d,f;t[0]!==o||t[1]!==i?(d=()=>{o===u.current&&(s(i),u.current=i)},f=[i,o],t[0]=o,t[1]=i,t[2]=d,t[3]=f):(d=t[2],f=t[3]),(0,j.useEffect)(d,f);let p;t[4]!==a||t[5]!==o?(p=()=>{o!==u.current&&a(o)&&(u.current=o,Q(l))},t[4]=a,t[5]=o,t[6]=p):p=t[6];let m=p,h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>s(e.target.value),t[7]=h):h=t[7];let _;t[8]===m?_=t[9]:(_=e=>{e.key===`Enter`&&(e.preventDefault(),m())},t[8]=m,t[9]=_);let v=r?!0:void 0,y;t[10]!==m||t[11]!==r||t[12]!==n||t[13]!==o||t[14]!==_||t[15]!==v?(y=(0,L.jsx)(g,{id:n,value:o,onChange:h,onBlur:m,onKeyDown:_,"aria-describedby":r,"aria-invalid":v,className:`h-8 text-sm`}),t[10]=m,t[11]=r,t[12]=n,t[13]=o,t[14]=_,t[15]=v,t[16]=y):y=t[16];let b;t[17]===c?b=t[18]:(b=(0,L.jsx)(Z,{visible:c}),t[17]=c,t[18]=b);let x;return t[19]!==y||t[20]!==b?(x=(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,b]}),t[19]=y,t[20]=b,t[21]=x):x=t[21],x}function Y(e){let t=(0,M.c)(22),{fieldId:n,errorId:r,value:i,onCommit:a}=e,[o,s]=(0,j.useState)(String(i)),[c,l]=(0,j.useState)(!1),u=(0,j.useRef)(String(i)),d,f;t[0]!==o||t[1]!==i?(d=()=>{o===u.current&&(s(String(i)),u.current=String(i))},f=[i,o],t[0]=o,t[1]=i,t[2]=d,t[3]=f):(d=t[2],f=t[3]),(0,j.useEffect)(d,f);let p;t[4]!==a||t[5]!==o?(p=()=>{if(o===u.current)return;let e=Number(o);if(!Number.isFinite(e)){a(o);return}a(e)&&(u.current=o,Q(l))},t[4]=a,t[5]=o,t[6]=p):p=t[6];let m=p,h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>s(e.target.value),t[7]=h):h=t[7];let _;t[8]===m?_=t[9]:(_=e=>{e.key===`Enter`&&(e.preventDefault(),m())},t[8]=m,t[9]=_);let v=r?!0:void 0,y;t[10]!==m||t[11]!==r||t[12]!==n||t[13]!==o||t[14]!==_||t[15]!==v?(y=(0,L.jsx)(g,{id:n,type:`number`,value:o,onChange:h,onBlur:m,onKeyDown:_,"aria-describedby":r,"aria-invalid":v,className:`h-8 w-28 text-sm`}),t[10]=m,t[11]=r,t[12]=n,t[13]=o,t[14]=_,t[15]=v,t[16]=y):y=t[16];let b;t[17]===c?b=t[18]:(b=(0,L.jsx)(Z,{visible:c}),t[17]=c,t[18]=b);let x;return t[19]!==y||t[20]!==b?(x=(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,b]}),t[19]=y,t[20]=b,t[21]=x):x=t[21],x}function X(e){let t=(0,M.c)(12),{fieldId:n,errorId:r,value:i,onCommit:a}=e,[o,s]=(0,j.useState)(!1),c;t[0]===a?c=t[1]:(c=e=>{a(e)&&Q(s)},t[0]=a,t[1]=c);let l;t[2]!==r||t[3]!==n||t[4]!==c||t[5]!==i?(l=(0,L.jsx)(b,{id:n,checked:i,"aria-describedby":r,onCheckedChange:c}),t[2]=r,t[3]=n,t[4]=c,t[5]=i,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=(0,L.jsx)(Z,{visible:o}),t[7]=o,t[8]=u);let d;return t[9]!==l||t[10]!==u?(d=(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11],d}function ne(e){let t=(0,M.c)(18),{fieldId:n,errorId:r,ariaLabel:i,options:a,value:o,onCommit:s}=e,[c,d]=(0,j.useState)(!1),f;t[0]===s?f=t[1]:(f=e=>{e&&s(e)&&Q(d)},t[0]=s,t[1]=f);let p;if(t[2]!==n||t[3]!==a){let e;t[5]===n?e=t[6]:(e=(e,t)=>(0,L.jsx)(l,{value:e,id:t===0?n:void 0,className:`text-xs capitalize`,children:e},e),t[5]=n,t[6]=e),p=a.map(e),t[2]=n,t[3]=a,t[4]=p}else p=t[4];let m;t[7]!==i||t[8]!==f||t[9]!==p||t[10]!==o?(m=(0,L.jsx)(u,{type:`single`,value:o,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg`,"aria-label":i,onValueChange:f,children:p}),t[7]=i,t[8]=f,t[9]=p,t[10]=o,t[11]=m):m=t[11];let h;t[12]===c?h=t[13]:(h=(0,L.jsx)(Z,{visible:c}),t[12]=c,t[13]=h);let g;return t[14]!==r||t[15]!==m||t[16]!==h?(g=(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,"aria-describedby":r,children:[m,h]}),t[14]=r,t[15]=m,t[16]=h,t[17]=g):g=t[17],g}function re(e){let t=(0,M.c)(24),{fieldId:n,errorId:r,value:i,onCommit:a}=e,o;t[0]===i?o=t[1]:(o=i.join(`
|
|
1
|
+
import{r as e}from"./chunk-DECur_0Z.js";import{n as t,r as n,t as r}from"./compiler-runtime-Y11fyRVL.js";import{At as i,Ct as a,T as o,ct as s,kt as c,n as l,t as u,vt as d,w as f,z as p}from"./toggle-group-Czy0P9Ee.js";import{t as m,x as h}from"./button-CXhPNzpp.js";import{N as g,V as _,Z as v,n as y,w as b}from"./DocumentContext-B1Fp4JCg.js";import{i as x,n as S,r as C,s as w}from"./config-validation-events-CpU7XuBS.js";import{S as T,x as E}from"./dialog-CJazZw1E.js";import{i as D,n as O,t as k}from"./tooltip-Dqn5ly4m.js";var A=h(`rotate-ccw`,[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]),j=e(t(),1),M=r();function N(e,t){if(e.length===0)throw Error(`buildPatch: path must be non-empty`);let[n,...r]=e;return r.length===0?{[String(n)]:t}:{[String(n)]:N(r,t)}}function P(e,t){let n=e;for(let e of t){if(typeof n!=`object`||!n)return;n=n[String(e)]}return n}function F(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(e?.type===`default`){let t=e.defaultValue;return typeof t==`function`?t():t}let n=t?._zod?.def?.innerType;if(n===void 0)return;t=n}}function I(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(!e)return;if(e.type===`default`||e.type===`optional`||e.type===`nullable`){t=e.innerType;continue}return e.type}}function ee(e){let t=e;for(let e=0;e<16;e++){if(t==null)return;let e=t?._zod?.def;if(!e)return;if(e.type===`enum`)return e.entries?Object.values(e.entries):void 0;if(e.innerType!==void 0){t=e.innerType;continue}return}}var L=n(),R=[{id:`content`,title:`Content`,description:`Where Open Knowledge looks for documents.`,fields:[{path:[`content`,`dir`],label:`Content directory`,description:`Project-relative path containing your markdown files.`},{path:[`content`,`include`],label:`Include patterns`,description:`Glob patterns selecting which files are content. One per line.`},{path:[`content`,`exclude`],label:`Exclude patterns`,description:`Glob patterns to skip. One per line.`}]},{id:`server`,title:`Server`,description:`Local server bind and behavior.`,fields:[{path:[`server`,`host`],label:`Host`,description:`Bind interface (e.g. localhost, 0.0.0.0).`},{path:[`server`,`openOnAgentEdit`],label:`Open preview on agent edit`,description:`When enabled, an agent write opens the preview tab if not already open.`}]},{id:`github`,title:`GitHub`,description:`OAuth app identity for sign-in. Tokens are stored in your OS keychain, not here.`,fields:[{path:[`github`,`oauthAppClientId`],label:`OAuth App client ID`,description:`Public client ID for the GitHub OAuth app. Defaults to the published Open Knowledge app.`}]},{id:`preview`,title:`Preview`,description:`Where the preview tab points when no local UI is running.`,fields:[{path:[`preview`,`baseUrl`],label:`Preview base URL`,description:`URL of your team’s deployed wiki (workspace-only).`}]},{id:`mcp`,title:`MCP`,description:`Model Context Protocol agent integration tuning.`,fields:[{path:[`mcp`,`autoStart`],label:`Auto-start server`,description:"When enabled, `ok mcp` spawns `ok start` automatically."},{path:[`mcp`,`tools`,`read_document`,`historyDepth`],label:`read_document history depth`,description:`How many history entries the agent’s read_document tool returns.`},{path:[`mcp`,`tools`,`search`,`maxResults`],label:`search max results`,description:`Cap on results returned by the agent’s search tool.`}]},{id:`appearance`,title:`Appearance`,description:`UI preferences. Editor toggles continue to write localStorage as a cache.`,fields:[{path:[`appearance`,`theme`],label:`Theme`,description:`Light, dark, or follow the OS.`,control:`enum-toggle`},{path:[`appearance`,`editorModeDefault`],label:`Default editor mode`,description:`Which mode new docs open in by default.`,control:`enum-toggle`}]}];function z(e,t){let n=(0,M.c)(4),[r,i]=(0,j.useState)(null),a,s;return n[0]!==e||n[1]!==t?(a=()=>{if(e===null)return;let n=t===`workspace`?o:f,r=new v,a=new _({url:e,name:n,document:r}),s=p(a,t),c=!0,l=()=>{c&&i(e=>e?.provider===a?{...e,synced:!0,config:s.current()}:e)};a.on(`synced`,l);let u=s.subscribe(e=>{c&&i(t=>t?.provider===a?t&&{...t,config:e}:t)});return i({provider:a,binding:s,config:s.current(),synced:!1}),()=>{c=!1,u(),a.off(`synced`,l),s.dispose(),a.destroy(),r.destroy(),i(e=>e?.provider===a?null:e)}},s=[e,t],n[0]=e,n[1]=t,n[2]=a,n[3]=s):(a=n[2],s=n[3]),(0,j.useEffect)(a,s),r}function B(e){let t=(0,M.c)(28),{scope:n,onClose:r,onScopeChange:i}=e,{collabUrl:a}=y(),o=z(a,n),[c,d]=(0,j.useState)(null),f=(0,j.useRef)(null),p,h;t[0]===n?(p=t[1],h=t[2]):(p=()=>{let e=S(e=>{if(!(n===`workspace`&&e.docName===`__config__/workspace`||n===`user`&&e.docName===`__user__/config.yml`))return;E.error(s(e.error),{duration:8e3});let t=V(e.error);t&&(d(t),f.current&&clearTimeout(f.current),f.current=setTimeout(()=>d(null),600))});return()=>{e(),f.current&&clearTimeout(f.current)}},h=[n],t[0]=n,t[1]=p,t[2]=h),(0,j.useEffect)(p,h);let g;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(g=(0,L.jsx)(`h1`,{className:`text-sm font-semibold`,children:`Settings`}),t[3]=g):g=t[3];let _;t[4]===i?_=t[5]:(_=e=>{(e===`workspace`||e===`user`)&&i(e)},t[4]=i,t[5]=_);let v,b;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=(0,L.jsx)(l,{value:`workspace`,className:`text-xs`,children:`This project`}),b=(0,L.jsx)(l,{value:`user`,className:`text-xs`,children:`User`}),t[6]=v,t[7]=b):(v=t[6],b=t[7]);let x;t[8]!==n||t[9]!==_?(x=(0,L.jsxs)(`div`,{className:`flex items-center gap-3`,children:[g,(0,L.jsxs)(u,{type:`single`,value:n,onValueChange:_,"aria-label":`Settings scope`,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg`,children:[v,b]})]}),t[8]=n,t[9]=_,t[10]=x):x=t[10];let C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,L.jsx)(T,{className:`size-4`}),t[11]=C):C=t[11];let w;t[12]===r?w=t[13]:(w=(0,L.jsx)(D,{asChild:!0,children:(0,L.jsx)(m,{variant:`ghost`,size:`icon`,onClick:r,"aria-label":`Close settings`,className:`text-muted-foreground`,children:C})}),t[12]=r,t[13]=w);let A;t[14]===Symbol.for(`react.memo_cache_sentinel`)?(A=(0,L.jsx)(O,{children:`Close`}),t[14]=A):A=t[14];let N;t[15]===w?N=t[16]:(N=(0,L.jsxs)(k,{children:[w,A]}),t[15]=w,t[16]=N);let P;t[17]!==N||t[18]!==x?(P=(0,L.jsxs)(`header`,{className:`flex h-12 shrink-0 items-center justify-between border-b px-4`,children:[x,N]}),t[17]=N,t[18]=x,t[19]=P):P=t[19];let F;t[20]!==o||t[21]!==c||t[22]!==n?(F=(0,L.jsx)(`div`,{className:`min-h-0 flex-1 overflow-y-auto`,children:o===null||!o.synced?(0,L.jsx)(H,{}):(0,L.jsx)(W,{scope:n,binding:o.binding,config:o.config,flashedPath:c})}),t[20]=o,t[21]=c,t[22]=n,t[23]=F):F=t[23];let I;return t[24]!==n||t[25]!==P||t[26]!==F?(I=(0,L.jsxs)(`div`,{className:`flex h-full min-h-0 flex-col overflow-hidden`,"data-testid":`settings-pane`,"data-scope":n,children:[P,F]}),t[24]=n,t[25]=P,t[26]=F,t[27]=I):I=t[27],I}function V(e){if(!d(e)||e.code!==`SCHEMA_INVALID`)return null;let t=e.issues[0];return!t||t.path.length===0?null:t.path.map(String).join(`.`)}function H(){let e=(0,M.c)(1),t;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,L.jsx)(`div`,{className:`space-y-6 p-6`,children:Array.from({length:3}).map(U)}),e[0]=t):t=e[0],t}function U(e,t){return(0,L.jsxs)(`div`,{className:`space-y-3`,children:[(0,L.jsx)(x,{className:`h-5 w-32`}),(0,L.jsx)(x,{className:`h-4 w-64`}),(0,L.jsxs)(`div`,{className:`space-y-2`,children:[(0,L.jsx)(x,{className:`h-9 w-full`}),(0,L.jsx)(x,{className:`h-9 w-full`})]})]},t)}function W(e){let t=(0,M.c)(8),{scope:n,binding:r,config:i,flashedPath:a}=e,o;t[0]!==r||t[1]!==i||t[2]!==a||t[3]!==n?(o=R.map(e=>{let t=e.fields.filter(e=>G(e.path,n));return t.length===0?null:(0,L.jsx)(K,{section:e,children:t.map(e=>(0,L.jsx)(q,{field:e,scope:n,binding:r,config:i,isFlashed:a===e.path.join(`.`)},e.path.join(`.`)))},e.id)}),t[0]=r,t[1]=i,t[2]=a,t[3]=n,t[4]=o):o=t[4];let s;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,L.jsx)(se,{}),t[5]=s):s=t[5];let c;return t[6]===o?c=t[7]:(c=(0,L.jsxs)(`div`,{className:`mx-auto max-w-3xl space-y-8 p-6`,children:[o,s]}),t[6]=o,t[7]=c),c}function G(e,t){let n=a(c,e);if(!n)return!0;let r=i(n);return r?!(r.scope===`workspace`&&t!==`workspace`||r.scope===`user`&&t!==`user`):!0}function K(e){let t=(0,M.c)(14),{section:n,children:r}=e,i=`settings-${n.id}-title`,a=`settings-${n.id}-title`,o;t[0]!==n.title||t[1]!==a?(o=(0,L.jsx)(`h2`,{id:a,className:`text-base font-semibold`,children:n.title}),t[0]=n.title,t[1]=a,t[2]=o):o=t[2];let s;t[3]===n.description?s=t[4]:(s=(0,L.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:n.description}),t[3]=n.description,t[4]=s);let c;t[5]!==o||t[6]!==s?(c=(0,L.jsxs)(`div`,{className:`space-y-1`,children:[o,s]}),t[5]=o,t[6]=s,t[7]=c):c=t[7];let l;t[8]===r?l=t[9]:(l=(0,L.jsx)(`div`,{className:`space-y-4`,children:r}),t[8]=r,t[9]=l);let u;return t[10]!==i||t[11]!==c||t[12]!==l?(u=(0,L.jsxs)(`section`,{"aria-labelledby":i,className:`space-y-3`,children:[c,l]}),t[10]=i,t[11]=c,t[12]=l,t[13]=u):u=t[13],u}function q(e){let t=(0,M.c)(55),{field:n,scope:r,binding:o,config:s,isFlashed:l}=e,u,d,f,p,h,g;if(t[0]!==s||t[1]!==n.path){let e=a(c,n.path);g=e?I(e):void 0,d=e?F(e):void 0,u=P(s,n.path),p=e?i(e):void 0,f=e?ee(e):void 0,h=d===void 0?u!=null:!$(u,d),t[0]=s,t[1]=n.path,t[2]=u,t[3]=d,t[4]=f,t[5]=p,t[6]=h,t[7]=g}else u=t[2],d=t[3],f=t[4],p=t[5],h=t[6],g=t[7];let _=h,v;t[8]===n.path?v=t[9]:(v=n.path.join(`-`),t[8]=n.path,t[9]=v);let y=v,b=`${y}-error`,[x,S]=(0,j.useState)(null),C;t[10]!==o||t[11]!==n.path?(C=e=>{let t=N(n.path,e),r=o.patch(t);return r.ok?(S(null),!0):(S(oe(r.error)),!1)},t[10]=o,t[11]=n.path,t[12]=C):C=t[12];let w=C,T;t[13]!==w||t[14]!==d?(T=()=>{w(d===void 0?null:d)},t[13]=w,t[14]=d,t[15]=T):T=t[15];let E=T,R;t[16]===_?R=t[17]:(R=_?(0,L.jsx)(`span`,{"data-modified":`true`,"aria-hidden":`true`,className:`absolute -left-3 top-1 h-5 w-0.5 rounded-full bg-primary`}):null,t[16]=_,t[17]=R);let z=R,B=`relative space-y-1 ${l?`animate-settings-flash`:``}`,V;t[18]===n.path?V=t[19]:(V=n.path.join(`.`),t[18]=n.path,t[19]=V);let H;t[20]!==n.label||t[21]!==y?(H=(0,L.jsx)(`label`,{htmlFor:y,className:`text-sm font-medium`,children:n.label}),t[20]=n.label,t[21]=y,t[22]=H):H=t[22];let U;t[23]!==u||t[24]!==d||t[25]!==n.label||t[26]!==E?(U=d!==void 0||u!==void 0?(0,L.jsxs)(k,{children:[(0,L.jsx)(D,{asChild:!0,children:(0,L.jsx)(m,{variant:`ghost`,size:`icon`,className:`h-6 w-6 text-muted-foreground opacity-60 hover:opacity-100`,onClick:E,"aria-label":`Reset ${n.label} to default`,children:(0,L.jsx)(A,{className:`size-3.5`})})}),(0,L.jsx)(O,{children:`Reset to default`})]}):null,t[23]=u,t[24]=d,t[25]=n.label,t[26]=E,t[27]=U):U=t[27];let W;t[28]!==H||t[29]!==U?(W=(0,L.jsxs)(`div`,{className:`flex items-baseline justify-between gap-2`,children:[H,U]}),t[28]=H,t[29]=U,t[30]=W):W=t[30];let G;t[31]===n.description?G=t[32]:(G=n.description?(0,L.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:n.description}):null,t[31]=n.description,t[32]=G);let K=x?b:void 0,q=p?.scope===`workspace`&&r!==`workspace`?`This field can only be set per-project. Switch to the 'This project' tab to edit it.`:p?.scope===`user`&&r!==`user`?`This field can only be set globally. Switch to the 'User' tab to edit it.`:null,J;t[33]!==w||t[34]!==u||t[35]!==f||t[36]!==n||t[37]!==y||t[38]!==K||t[39]!==q||t[40]!==g?(J=(0,L.jsx)(te,{field:n,fieldId:y,errorId:K,typeTag:g,currentValue:u,enumOptions:f,onCommit:w,readonlyReason:q}),t[33]=w,t[34]=u,t[35]=f,t[36]=n,t[37]=y,t[38]=K,t[39]=q,t[40]=g,t[41]=J):J=t[41];let Y;t[42]!==x||t[43]!==b||t[44]!==n.path?(Y=x?(0,L.jsx)(`p`,{id:b,role:`alert`,className:`text-xs text-destructive`,"data-field-error":n.path.join(`.`),children:x}):null,t[42]=x,t[43]=b,t[44]=n.path,t[45]=Y):Y=t[45];let X;return t[46]!==z||t[47]!==r||t[48]!==G||t[49]!==J||t[50]!==Y||t[51]!==V||t[52]!==W||t[53]!==B?(X=(0,L.jsxs)(`div`,{className:B,"data-field":V,"data-scope":r,children:[z,W,G,J,Y]}),t[46]=z,t[47]=r,t[48]=G,t[49]=J,t[50]=Y,t[51]=V,t[52]=W,t[53]=B,t[54]=X):X=t[54],X}function te(e){let t=(0,M.c)(32),{field:n,fieldId:r,errorId:i,typeTag:a,currentValue:o,enumOptions:s,onCommit:c,readonlyReason:l}=e;if(l){let e;return t[0]!==r||t[1]!==l?(e=(0,L.jsx)(`div`,{id:r,role:`note`,className:`rounded border border-dashed border-muted px-3 py-2 text-xs text-muted-foreground`,children:l}),t[0]=r,t[1]=l,t[2]=e):e=t[2],e}if(a===`boolean`){let e=!!o,n;return t[3]!==i||t[4]!==r||t[5]!==c||t[6]!==e?(n=(0,L.jsx)(X,{fieldId:r,errorId:i,value:e,onCommit:c}),t[3]=i,t[4]=r,t[5]=c,t[6]=e,t[7]=n):n=t[7],n}if(a===`enum`&&s&&s.length>0&&(n.control===`enum-toggle`||s.length<=4)){let e=typeof o==`string`?o:``,a;return t[8]!==s||t[9]!==i||t[10]!==n.label||t[11]!==r||t[12]!==c||t[13]!==e?(a=(0,L.jsx)(ne,{fieldId:r,errorId:i,ariaLabel:n.label,options:s,value:e,onCommit:c}),t[8]=s,t[9]=i,t[10]=n.label,t[11]=r,t[12]=c,t[13]=e,t[14]=a):a=t[14],a}if(a===`number`||a===`int`){let e=typeof o==`number`?o:0,n;return t[15]!==i||t[16]!==r||t[17]!==c||t[18]!==e?(n=(0,L.jsx)(Y,{fieldId:r,errorId:i,value:e,onCommit:c}),t[15]=i,t[16]=r,t[17]=c,t[18]=e,t[19]=n):n=t[19],n}if(a===`array`){let e;t[20]===o?e=t[21]:(e=Array.isArray(o)?o:[],t[20]=o,t[21]=e);let n;return t[22]!==i||t[23]!==r||t[24]!==c||t[25]!==e?(n=(0,L.jsx)(re,{fieldId:r,errorId:i,value:e,onCommit:c}),t[22]=i,t[23]=r,t[24]=c,t[25]=e,t[26]=n):n=t[26],n}let u=typeof o==`string`?o:``,d;return t[27]!==i||t[28]!==r||t[29]!==c||t[30]!==u?(d=(0,L.jsx)(J,{fieldId:r,errorId:i,value:u,onCommit:c}),t[27]=i,t[28]=r,t[29]=c,t[30]=u,t[31]=d):d=t[31],d}function J(e){let t=(0,M.c)(22),{fieldId:n,errorId:r,value:i,onCommit:a}=e,[o,s]=(0,j.useState)(i),[c,l]=(0,j.useState)(!1),u=(0,j.useRef)(i),d,f;t[0]!==o||t[1]!==i?(d=()=>{o===u.current&&(s(i),u.current=i)},f=[i,o],t[0]=o,t[1]=i,t[2]=d,t[3]=f):(d=t[2],f=t[3]),(0,j.useEffect)(d,f);let p;t[4]!==a||t[5]!==o?(p=()=>{o!==u.current&&a(o)&&(u.current=o,Q(l))},t[4]=a,t[5]=o,t[6]=p):p=t[6];let m=p,h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>s(e.target.value),t[7]=h):h=t[7];let _;t[8]===m?_=t[9]:(_=e=>{e.key===`Enter`&&(e.preventDefault(),m())},t[8]=m,t[9]=_);let v=r?!0:void 0,y;t[10]!==m||t[11]!==r||t[12]!==n||t[13]!==o||t[14]!==_||t[15]!==v?(y=(0,L.jsx)(g,{id:n,value:o,onChange:h,onBlur:m,onKeyDown:_,"aria-describedby":r,"aria-invalid":v,className:`h-8 text-sm`}),t[10]=m,t[11]=r,t[12]=n,t[13]=o,t[14]=_,t[15]=v,t[16]=y):y=t[16];let b;t[17]===c?b=t[18]:(b=(0,L.jsx)(Z,{visible:c}),t[17]=c,t[18]=b);let x;return t[19]!==y||t[20]!==b?(x=(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,b]}),t[19]=y,t[20]=b,t[21]=x):x=t[21],x}function Y(e){let t=(0,M.c)(22),{fieldId:n,errorId:r,value:i,onCommit:a}=e,[o,s]=(0,j.useState)(String(i)),[c,l]=(0,j.useState)(!1),u=(0,j.useRef)(String(i)),d,f;t[0]!==o||t[1]!==i?(d=()=>{o===u.current&&(s(String(i)),u.current=String(i))},f=[i,o],t[0]=o,t[1]=i,t[2]=d,t[3]=f):(d=t[2],f=t[3]),(0,j.useEffect)(d,f);let p;t[4]!==a||t[5]!==o?(p=()=>{if(o===u.current)return;let e=Number(o);if(!Number.isFinite(e)){a(o);return}a(e)&&(u.current=o,Q(l))},t[4]=a,t[5]=o,t[6]=p):p=t[6];let m=p,h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=e=>s(e.target.value),t[7]=h):h=t[7];let _;t[8]===m?_=t[9]:(_=e=>{e.key===`Enter`&&(e.preventDefault(),m())},t[8]=m,t[9]=_);let v=r?!0:void 0,y;t[10]!==m||t[11]!==r||t[12]!==n||t[13]!==o||t[14]!==_||t[15]!==v?(y=(0,L.jsx)(g,{id:n,type:`number`,value:o,onChange:h,onBlur:m,onKeyDown:_,"aria-describedby":r,"aria-invalid":v,className:`h-8 w-28 text-sm`}),t[10]=m,t[11]=r,t[12]=n,t[13]=o,t[14]=_,t[15]=v,t[16]=y):y=t[16];let b;t[17]===c?b=t[18]:(b=(0,L.jsx)(Z,{visible:c}),t[17]=c,t[18]=b);let x;return t[19]!==y||t[20]!==b?(x=(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[y,b]}),t[19]=y,t[20]=b,t[21]=x):x=t[21],x}function X(e){let t=(0,M.c)(12),{fieldId:n,errorId:r,value:i,onCommit:a}=e,[o,s]=(0,j.useState)(!1),c;t[0]===a?c=t[1]:(c=e=>{a(e)&&Q(s)},t[0]=a,t[1]=c);let l;t[2]!==r||t[3]!==n||t[4]!==c||t[5]!==i?(l=(0,L.jsx)(b,{id:n,checked:i,"aria-describedby":r,onCheckedChange:c}),t[2]=r,t[3]=n,t[4]=c,t[5]=i,t[6]=l):l=t[6];let u;t[7]===o?u=t[8]:(u=(0,L.jsx)(Z,{visible:o}),t[7]=o,t[8]=u);let d;return t[9]!==l||t[10]!==u?(d=(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11],d}function ne(e){let t=(0,M.c)(18),{fieldId:n,errorId:r,ariaLabel:i,options:a,value:o,onCommit:s}=e,[c,d]=(0,j.useState)(!1),f;t[0]===s?f=t[1]:(f=e=>{e&&s(e)&&Q(d)},t[0]=s,t[1]=f);let p;if(t[2]!==n||t[3]!==a){let e;t[5]===n?e=t[6]:(e=(e,t)=>(0,L.jsx)(l,{value:e,id:t===0?n:void 0,className:`text-xs capitalize`,children:e},e),t[5]=n,t[6]=e),p=a.map(e),t[2]=n,t[3]=a,t[4]=p}else p=t[4];let m;t[7]!==i||t[8]!==f||t[9]!==p||t[10]!==o?(m=(0,L.jsx)(u,{type:`single`,value:o,variant:`segmented`,size:`sm`,spacing:1,className:`bg-muted dark:bg-background p-0.5 rounded-lg`,"aria-label":i,onValueChange:f,children:p}),t[7]=i,t[8]=f,t[9]=p,t[10]=o,t[11]=m):m=t[11];let h;t[12]===c?h=t[13]:(h=(0,L.jsx)(Z,{visible:c}),t[12]=c,t[13]=h);let g;return t[14]!==r||t[15]!==m||t[16]!==h?(g=(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,"aria-describedby":r,children:[m,h]}),t[14]=r,t[15]=m,t[16]=h,t[17]=g):g=t[17],g}function re(e){let t=(0,M.c)(24),{fieldId:n,errorId:r,value:i,onCommit:a}=e,o;t[0]===i?o=t[1]:(o=i.join(`
|
|
2
2
|
`),t[0]=i,t[1]=o);let s=o,[c,l]=(0,j.useState)(s),[u,d]=(0,j.useState)(!1),f=(0,j.useRef)(s),p,m;t[2]!==c||t[3]!==i?(p=()=>{let e=i.join(`
|
|
3
3
|
`);c===f.current&&(l(e),f.current=e)},m=[i,c],t[2]=c,t[3]=i,t[4]=p,t[5]=m):(p=t[4],m=t[5]),(0,j.useEffect)(p,m);let h;t[6]!==a||t[7]!==c?(h=()=>{c!==f.current&&a(c.split(`
|
|
4
4
|
`).map(ae).filter(ie))&&(f.current=c,Q(d))},t[6]=a,t[7]=c,t[8]=h):h=t[8];let g=h,_;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(_=e=>l(e.target.value),t[9]=_):_=t[9];let v;t[10]===c?v=t[11]:(v=c.split(`
|