tarsk 0.5.72 → 0.5.73
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/index.js +5505 -2902
- package/dist/public/assets/{account-view-C_WBVXA3.js → account-view-DKQdyGPK.js} +1 -1
- package/dist/public/assets/{alert-dialog-FQ5_FqBX.js → alert-dialog-Cb1PEgra.js} +1 -1
- package/dist/public/assets/api-BMo_Lz8f.js +2 -0
- package/dist/public/assets/{async-error-boundary-DCDTsNTO.js → async-error-boundary-J8P6NVvc.js} +1 -1
- package/dist/public/assets/{async-loading-fallback-C173aA9v.js → async-loading-fallback-B_JNgWJR.js} +1 -1
- package/dist/public/assets/browser-tab-D_GXZ93G.js +12 -0
- package/dist/public/assets/{button-sfGyFWfz.js → button-DeNw35VZ.js} +1 -1
- package/dist/public/assets/{card-D5k0GHxM.js → card-B4eI0NI-.js} +1 -1
- package/dist/public/assets/{chat-dock-context-DIyMsJHM.js → chat-dock-context-BXoAs38w.js} +1 -1
- package/dist/public/assets/{commit-dialog-Bmh1QdHK.js → commit-dialog-DDLaQVzY.js} +1 -1
- package/dist/public/assets/{commit-error-dialog-Dpu8C-0w.js → commit-error-dialog-Cp0Aic7I.js} +1 -1
- package/dist/public/assets/{commit-method-fields-CYzy7rmY.js → commit-method-fields-CD3PTIox.js} +1 -1
- package/dist/public/assets/{context-menu-Bo0OMC7-.js → context-menu-Dx5Jy21w.js} +1 -1
- package/dist/public/assets/{conversation-history-view-COFXqD0e.js → conversation-history-view-JymxZFJ2.js} +1 -1
- package/dist/public/assets/{create-project-dialog-DQ4AbwQP.js → create-project-dialog-qbwqSqGU.js} +2 -2
- package/dist/public/assets/{create-project-workspace-BiRMezO9.js → create-project-workspace-BcIx6FNf.js} +1 -1
- package/dist/public/assets/{create-repo-dialog-CYiCHWgi.js → create-repo-dialog-DcvSMy3g.js} +1 -1
- package/dist/public/assets/{delete-confirm-dialog-B99gEJN8.js → delete-confirm-dialog-C9NASyh6.js} +1 -1
- package/dist/public/assets/{dialog-CP2cYR59.js → dialog-Do98zzAW.js} +1 -1
- package/dist/public/assets/{diff-view-Cnuntc3l.js → diff-view-ePD0sdsW.js} +2 -2
- package/dist/public/assets/dist-BWuYHVi8.js +2 -0
- package/dist/public/assets/{dist-DrpdKPSI.js → dist-CjhvxqFU.js} +1 -1
- package/dist/public/assets/{explorer-tab-view-BoCoREoE.js → explorer-tab-view-D6hsKrXY.js} +2 -2
- package/dist/public/assets/{explorer-tree-DvD1-WW3.js → explorer-tree-BG8ShRwn.js} +1 -1
- package/dist/public/assets/{explorer-view-B4WJUy7s.js → explorer-view-BZcNnLd9.js} +2 -2
- package/dist/public/assets/{git-history-dialog-DHdzijZS.js → git-history-dialog-DWhJ1-ba.js} +1 -1
- package/dist/public/assets/index-DhOeeft5.css +1 -0
- package/dist/public/assets/index-DjaVbFDB.js +3386 -0
- package/dist/public/assets/{markdown-renderer-Dx9-Ljv0.js → markdown-renderer-qLede1zH.js} +4 -4
- package/dist/public/assets/{mcp-server-card-DPNG9Up7.js → mcp-server-card-zm-ss-7h.js} +1 -1
- package/dist/public/assets/{merged-pr-dialog-CEvS2z8D.js → merged-pr-dialog-Due9WdB4.js} +1 -1
- package/dist/public/assets/{model-list-controls-ChoemIJa.js → model-list-controls-D86_87E4.js} +1 -1
- package/dist/public/assets/{onboarding-dialog-DCull5p_.js → onboarding-dialog-DlqbPvG0.js} +1 -1
- package/dist/public/assets/{project-env-vars-view-DTGwl4wr.js → project-env-vars-view-N1Io1Pau.js} +1 -1
- package/dist/public/assets/{project-model-aliases-view-CEDz_6NW.js → project-model-aliases-view-B4FEze4g.js} +1 -1
- package/dist/public/assets/{project-settings-view-DniUno1i.js → project-settings-view-BalZ6Fe1.js} +1 -1
- package/dist/public/assets/{project-tools-view-DknCaJu_.js → project-tools-view-OnCN0jKz.js} +1 -1
- package/dist/public/assets/{providers-list-view-D_n1Ai6S.js → providers-list-view-DXvcxXDM.js} +1 -1
- package/dist/public/assets/pull-request-dialog-BeeTNIN_.js +1 -0
- package/dist/public/assets/{pull-with-changes-dialog-rKmqSi73.js → pull-with-changes-dialog-B9y2_lt_.js} +1 -1
- package/dist/public/assets/{push-before-pr-dialog-BeEx6Po_.js → push-before-pr-dialog-D3pMFe9A.js} +1 -1
- package/dist/public/assets/{settings-general-view-CVHlxpTM.js → settings-general-view-CAYlYs3J.js} +1 -1
- package/dist/public/assets/{settings-instructions-view-Bpx_dUaJ.js → settings-instructions-view-GjQivhLy.js} +1 -1
- package/dist/public/assets/{settings-list-PMi8ZniW.js → settings-list-DU82HNPX.js} +1 -1
- package/dist/public/assets/{settings-logs-view-64Aq1hEw.js → settings-logs-view-DnQ_4O9b.js} +4 -4
- package/dist/public/assets/{settings-mcp-servers-view-B84c4h47.js → settings-mcp-servers-view-C6OZHR3K.js} +1 -1
- package/dist/public/assets/{settings-models-view-DdRC4YXo.js → settings-models-view-CTjnBd74.js} +1 -1
- package/dist/public/assets/{settings-rules-view-CGLh95Ta.js → settings-rules-view-DiTC-cBE.js} +1 -1
- package/dist/public/assets/settings-skills-view-DHoSorOw.js +3 -0
- package/dist/public/assets/{settings-slack-view-OFNrG_DW.js → settings-slack-view-CiuJZ-9i.js} +1 -1
- package/dist/public/assets/{settings-slash-commands-view-DOo0BimH.js → settings-slash-commands-view-CnXff39A.js} +1 -1
- package/dist/public/assets/{settings-statistics-view-DpaSoVqG.js → settings-statistics-view-D8SvAGE_.js} +1 -1
- package/dist/public/assets/{settings-storage-view-DlyXWB__.js → settings-storage-view-CUsa7Lwv.js} +1 -1
- package/dist/public/assets/{settings-subagents-view-D7o69YzB.js → settings-subagents-view-B4HugfzU.js} +1 -1
- package/dist/public/assets/{settings-system-prompt-view-BFGfrXfe.js → settings-system-prompt-view-DNQKxcFg.js} +1 -1
- package/dist/public/assets/{settings-view-Dw1Zh2Qn.js → settings-view-DoZmXguf.js} +2 -2
- package/dist/public/assets/store-BaMSfYoJ.js +9 -0
- package/dist/public/assets/{table-B2TDbGGl.js → table-B3fLagUj.js} +1 -1
- package/dist/public/assets/tasks-view-BaMd8ZM0.js +2 -0
- package/dist/public/assets/{terminal-panel-DBZpuMz9.js → terminal-panel-BjD6z-3y.js} +2 -2
- package/dist/public/assets/{toggle-group-BiUqOiP6.js → toggle-group-5tREtjoW.js} +1 -1
- package/dist/public/assets/{use-active-dock-panel-instance-CcCdDHzX.js → use-active-dock-panel-instance-BSch6-Fx.js} +1 -1
- package/dist/public/assets/{use-installed-ai-files-BNrsyACe.js → use-installed-ai-files-E4BAFIPG.js} +1 -1
- package/dist/public/assets/{use-open-chat-dock-panel-D1D5bnsL.js → use-open-chat-dock-panel-Cr1bQYOH.js} +1 -1
- package/dist/public/assets/{web-C5UYr_H-.js → web-BKpP7kYB.js} +1 -1
- package/dist/public/assets/{web-DaSLtaQ7.js → web-CtDn8Ggo.js} +1 -1
- package/dist/public/assets/{web-Rx_XWVAQ.js → web-DaiDQ9WA.js} +1 -1
- package/dist/public/assets/{web-iwWEZ1P2.js → web-W5CC9Cq4.js} +1 -1
- package/dist/public/index.html +14 -14
- package/package.json +2 -1
- package/dist/public/assets/api-ODizoHnY.js +0 -2
- package/dist/public/assets/browser-tab-Cl9d7ESj.js +0 -12
- package/dist/public/assets/dist-ZlK7I-y-.js +0 -2
- package/dist/public/assets/index-Bmkj1Qwa.js +0 -3380
- package/dist/public/assets/index-DPMRI86E.css +0 -1
- package/dist/public/assets/pull-request-dialog-BkQBaJkw.js +0 -1
- package/dist/public/assets/settings-skills-view-DeVnXDl-.js +0 -3
- package/dist/public/assets/store-Be_7VK0D.js +0 -8
- package/dist/public/assets/tasks-view-FR7c1qFr.js +0 -2
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/dist-IeRYu0zQ.js","assets/rolldown-runtime-aKtaBQYM.js"])))=>i.map(i=>d[i]);
|
|
2
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,o as r,r as i,t as a}from"./react-vendor-Ee0-5T4I.js";import{a as o,n as s,t as c}from"./query-keys-5QPW6Dv-.js";import{R as l,at as u,ct as d,dt as f,ot as p,ut as m,x as h}from"./dist-ZlK7I-y-.js";import{$t as g,An as _,Z as v,_t as y,it as b,mn as x,rn as S,rt as C,vt as w,wt as T,y as E,yn as D}from"./dist-DIjomljy.js";import{t as O}from"./utils-CT-Dw22R.js";import{t as k}from"./button-sfGyFWfz.js";import{Hr as A,Ht as j,Ir as M,Xt as N,g as P,kr as F,mn as I}from"./api-ODizoHnY.js";import{i as L,n as R,r as z,t as B}from"./tooltip-B6ziVyTv.js";import{t as V}from"./use-toast-xpb5jNtN.js";import{i as ee,n as H,r as te,s as ne,t as U}from"./dialog-CP2cYR59.js";import{n as W}from"./explorer-tab-context-BxUVwWQQ.js";import{t as G}from"./use-open-chat-dock-panel-D1D5bnsL.js";function K(e,t){return s(e,o,t)}var q=n(),J=e(r(),1);function re(e,t){let n=(0,q.c)(6),[r,i]=(0,J.useState)(e),a=(0,J.useRef)(-1/0),o=(0,J.useRef)(null),s=(0,J.useRef)(e),c;n[0]!==r||n[1]!==t||n[2]!==e?(c=()=>{if(s.current=e,Object.is(e,r))return;let n=function(){o.current=null,a.current=Date.now(),i(s.current)},c=Date.now()-a.current;if(c>=t){n();return}o.current||=setTimeout(n,t-c)},n[0]=r,n[1]=t,n[2]=e,n[3]=c):c=n[3],(0,J.useEffect)(c);let l,u;return n[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>()=>{o.current&&=(clearTimeout(o.current),null)},u=[],n[4]=l,n[5]=u):(l=n[4],u=n[5]),(0,J.useEffect)(l,u),r}var ie=e(t(),1),ae=.1,Y=10,oe=1.25,X=.001;function se(){let e=(0,q.c)(15),[t,n]=(0,J.useState)(1),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={x:0,y:0},e[0]=r):r=e[0];let[i,a]=(0,J.useState)(r),[o,s]=(0,J.useState)(!1),c=(0,J.useRef)(null),l=Z,u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>n(e=>l(e*oe)),e[1]=u):u=e[1];let d=u,f;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>n(e=>l(e/oe)),e[2]=f):f=e[2];let p=f,m;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{n(1),a({x:0,y:0})},e[3]=m):m=e[3];let h=m,g;e[4]===i?g=e[5]:(g=e=>{e.preventDefault(),s(!0),c.current={x:e.clientX,y:e.clientY,ox:i.x,oy:i.y}},e[4]=i,e[5]=g);let _=g,v;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{c.current&&a({x:c.current.ox+(e.clientX-c.current.x),y:c.current.oy+(e.clientY-c.current.y)})},e[6]=v):v=e[6];let y=v,b;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{s(!1),c.current=null},e[7]=b):b=e[7];let x=b,S=(0,J.useRef)(null),C,w;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{let e=S.current;if(!e)return;let t=function(e){e.preventDefault();let t=-e.deltaY*X;n(e=>l(e*(1+t)))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},w=[],e[8]=C,e[9]=w):(C=e[8],w=e[9]),(0,J.useEffect)(C,w);let T;return e[10]!==o||e[11]!==i||e[12]!==_||e[13]!==t?(T={scale:t,offset:i,isDragging:o,containerRef:S,zoomIn:d,zoomOut:p,reset:h,onMouseDown:_,onMouseMove:y,onMouseUp:x},e[10]=o,e[11]=i,e[12]=_,e[13]=t,e[14]=T):T=e[14],T}function Z(e){return Math.min(Math.max(e,ae),Y)}var Q=a(),ce=h(`app.mermaid-renderer.ui`);function le(){let e=(0,q.c)(2),[t,n]=(0,J.useState)(!1),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=function(){n(document.documentElement.classList.contains(`dark`))};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>t.disconnect()},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,J.useEffect)(r,i),t}var ue=null;function de(){return ue||=i(()=>import(`./dist-IeRYu0zQ.js`),__vite__mapDeps([0,1])),ue}function fe(e,t){let[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(null);return(0,J.useEffect)(()=>{let n=!1,i=setTimeout(()=>{let i=n=>{try{let i=n(e,{bg:t?`#18181B`:`#FFFFFF`,fg:t?`#FAFAFA`:`#27272A`,transparent:!1,padding:32});if(typeof i!=`string`||i.length===0)throw Error(`Mermaid renderer returned no SVG`);r(i),a(null)}catch(e){ce.error(`Mermaid render error:`,e),r(null),a(e instanceof Error?e.message:String(e))}};de().then(e=>{n||i(e.renderMermaidSVG)},e=>{n||(ce.error(`Mermaid renderer failed to load:`,e),a(e instanceof Error?e.message:String(e)))})},200);return()=>{n=!0,clearTimeout(i)}},[e,t]),{svgOutput:n,errorMessage:i}}function pe(e){let t=(0,q.c)(70),{svgOutput:n,onClose:r}=e,{scale:i,offset:a,isDragging:o,containerRef:s,zoomIn:c,zoomOut:l,reset:d,onMouseDown:f,onMouseMove:p,onMouseUp:m}=se(),h,g;t[0]===r?(h=t[1],g=t[2]):(h=()=>{let e=function(e){e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},g=[r],t[0]=r,t[1]=h,t[2]=g),(0,J.useEffect)(h,g);let _;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=[],t[3]=_):_=t[3],(0,J.useEffect)(me,_);let b;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(`span`,{className:O(u.compact,`font-mono text-muted-foreground`),children:`mermaid diagram`}),t[4]=b):b=t[4];let x,S;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(y,{className:`h-3.5 w-3.5`}),S=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Zoom out`}),t[5]=x,t[6]=S):(x=t[5],S=t[6]);let w;t[7]===l?w=t[8]:(w=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsxs)(k,{variant:`ghost`,size:`icon-xs`,onClick:l,children:[x,S]})}),t[7]=l,t[8]=w);let T;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(R,{children:`Zoom out`}),t[9]=T):T=t[9];let D;t[10]===w?D=t[11]:(D=(0,Q.jsxs)(B,{children:[w,T]}),t[10]=w,t[11]=D);let A;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=O(u.compact,`min-w-[3rem] px-2 py-1 font-mono text-muted-foreground hover:text-foreground hover:bg-muted rounded transition-colors`),t[12]=A):A=t[12];let j;t[13]===i?j=t[14]:(j=Math.round(i*100),t[13]=i,t[14]=j);let M;t[15]!==d||t[16]!==j?(M=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,onClick:d,className:A,children:[j,`%`]})}),t[15]=d,t[16]=j,t[17]=M):M=t[17];let N;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsx)(R,{children:`Reset zoom`}),t[18]=N):N=t[18];let P;t[19]===M?P=t[20]:(P=(0,Q.jsxs)(B,{children:[M,N]}),t[19]=M,t[20]=P);let F,I;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(C,{className:`h-3.5 w-3.5`}),I=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Zoom in`}),t[21]=F,t[22]=I):(F=t[21],I=t[22]);let V;t[23]===c?V=t[24]:(V=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsxs)(k,{variant:`ghost`,size:`icon-xs`,onClick:c,children:[F,I]})}),t[23]=c,t[24]=V);let ee;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(R,{children:`Zoom in`}),t[25]=ee):ee=t[25];let H;t[26]===V?H=t[27]:(H=(0,Q.jsxs)(B,{children:[V,ee]}),t[26]=V,t[27]=H);let te,ne;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Q.jsx)(v,{className:`h-3.5 w-3.5`}),ne=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Reset view`}),t[28]=te,t[29]=ne):(te=t[28],ne=t[29]);let U;t[30]===d?U=t[31]:(U=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsxs)(k,{variant:`ghost`,size:`icon-xs`,onClick:d,children:[te,ne]})}),t[30]=d,t[31]=U);let W;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(R,{children:`Reset view`}),t[32]=W):W=t[32];let G;t[33]===U?G=t[34]:(G=(0,Q.jsxs)(B,{children:[U,W]}),t[33]=U,t[34]=G);let K;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`}),t[35]=K):K=t[35];let re,ae;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Q.jsx)(E,{className:`h-3.5 w-3.5`}),ae=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`}),t[36]=re,t[37]=ae):(re=t[36],ae=t[37]);let Y;t[38]===r?Y=t[39]:(Y=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsxs)(k,{variant:`ghost`,size:`icon-xs`,onClick:r,children:[re,ae]})}),t[38]=r,t[39]=Y);let oe;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Q.jsx)(R,{children:`Close (Esc)`}),t[40]=oe):oe=t[40];let X;t[41]===Y?X=t[42]:(X=(0,Q.jsxs)(B,{children:[Y,oe]}),t[41]=Y,t[42]=X);let Z;t[43]!==P||t[44]!==H||t[45]!==G||t[46]!==X||t[47]!==D?(Z=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 bg-background/90 border-b border-border shrink-0`,children:[b,(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[D,P,H,G,K,X]})]}),t[43]=P,t[44]=H,t[45]=G,t[46]=X,t[47]=D,t[48]=Z):Z=t[48];let ce=o?`cursor-grabbing`:`cursor-grab`,le;t[49]===ce?le=t[50]:(le=O(`flex-1 overflow-hidden select-none`,ce),t[49]=ce,t[50]=le);let ue=`translate(${a.x}px, ${a.y}px) scale(${i})`,de=o?`none`:`transform 0.1s ease-out`,fe;t[51]!==ue||t[52]!==de?(fe={transform:ue,transformOrigin:`center center`,transition:de},t[51]=ue,t[52]=de,t[53]=fe):fe=t[53];let pe;t[54]===n?pe=t[55]:(pe={__html:n},t[54]=n,t[55]=pe);let he;t[56]!==fe||t[57]!==pe?(he=(0,Q.jsx)(`div`,{className:`w-full h-full flex items-center justify-center`,style:fe,dangerouslySetInnerHTML:pe}),t[56]=fe,t[57]=pe,t[58]=he):he=t[58];let ge;t[59]!==s||t[60]!==f||t[61]!==p||t[62]!==m||t[63]!==le||t[64]!==he?(ge=(0,Q.jsx)(`div`,{ref:s,className:le,onMouseDown:f,onMouseMove:p,onMouseUp:m,onMouseLeave:m,children:he}),t[59]=s,t[60]=f,t[61]=p,t[62]=m,t[63]=le,t[64]=he,t[65]=ge):ge=t[65];let $;t[66]===Symbol.for(`react.memo_cache_sentinel`)?($=(0,Q.jsx)(`div`,{className:O(u.compact,`shrink-0 px-4 py-2 text-center text-muted-foreground/60 bg-background/60 border-t border-border`),children:`Scroll to zoom · Drag to pan · Esc to close`}),t[66]=$):$=t[66];let _e;return t[67]!==Z||t[68]!==ge?(_e=(0,ie.createPortal)((0,Q.jsx)(z,{children:(0,Q.jsxs)(`div`,{className:`fixed inset-0 z-50 flex flex-col bg-black/85 backdrop-blur-sm`,role:`dialog`,"aria-modal":`true`,"aria-label":`Diagram fullscreen view`,children:[Z,ge,$]})}),document.body),t[67]=Z,t[68]=ge,t[69]=_e):_e=t[69],_e}function me(){return document.body.style.overflow=`hidden`,he}function he(){document.body.style.overflow=``}function ge(e){let t=(0,q.c)(57),{content:n,className:r}=e,[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1),{svgOutput:c,errorMessage:l}=fe(n,le()),d=l!==null,f;t[0]===n?f=t[1]:(f=async function(){await navigator.clipboard.writeText(n),a(!0),setTimeout(()=>a(!1),2e3)},t[0]=n,t[1]=f);let p=f,m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=O(u.compact,`font-mono text-muted-foreground`),t[2]=m):m=t[2];let h=d?`mermaid (render error)`:`mermaid diagram`,g;t[3]===h?g=t[4]:(g=(0,Q.jsx)(`span`,{className:m,children:h}),t[3]=h,t[4]=g);let v;t[5]!==d||t[6]!==c?(v=c&&!d&&(0,Q.jsxs)(B,{children:[(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsxs)(k,{variant:`action`,size:`icon-xs`,onClick:()=>s(!0),children:[(0,Q.jsx)(T,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`View fullscreen`})]})}),(0,Q.jsx)(R,{children:`View fullscreen`})]}),t[5]=d,t[6]=c,t[7]=v):v=t[7];let y;t[8]===i?y=t[9]:(y=i?(0,Q.jsx)(_,{}):(0,Q.jsx)(D,{}),t[8]=i,t[9]=y);let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Copy mermaid code`}),t[10]=b):b=t[10];let x;t[11]!==p||t[12]!==y?(x=(0,Q.jsxs)(k,{variant:`action`,size:`icon-xs`,onClick:p,children:[y,b]}),t[11]=p,t[12]=y,t[13]=x):x=t[13];let S;t[14]!==v||t[15]!==x?(S=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[v,x]}),t[14]=v,t[15]=x,t[16]=S):S=t[16];let C;t[17]!==g||t[18]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border bg-muted/80 px-4 py-2`,children:[g,S]}),t[17]=g,t[18]=S,t[19]=C):C=t[19];let w=C;if(d){let e;t[20]===r?e=t[21]:(e=O(`group relative overflow-hidden rounded-lg border border-border bg-muted`,r),t[20]=r,t[21]=e);let i;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(i=O(u.compact,`border-b border-border bg-background/50 px-4 py-2 text-destructive`),t[22]=i):i=t[22];let a;t[23]===l?a=t[24]:(a=(0,Q.jsx)(`div`,{className:i,role:`alert`,children:l}),t[23]=l,t[24]=a);let o;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(o=O(u.compact,`font-mono text-foreground leading-relaxed`),t[25]=o):o=t[25];let s;t[26]===n?s=t[27]:(s=(0,Q.jsx)(`pre`,{className:`overflow-x-auto p-4 max-w-full`,children:(0,Q.jsx)(`code`,{className:o,children:n})}),t[26]=n,t[27]=s);let c;return t[28]!==w||t[29]!==e||t[30]!==a||t[31]!==s?(c=(0,Q.jsxs)(`div`,{className:e,children:[w,a,s]}),t[28]=w,t[29]=e,t[30]=a,t[31]=s,t[32]=c):c=t[32],c}if(!c){let e;t[33]===r?e=t[34]:(e=O(`group relative overflow-hidden rounded-lg border border-border bg-muted`,r),t[33]=r,t[34]=e);let n;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(`div`,{className:O(u.compact,`p-4 text-muted-foreground`),children:`Rendering diagram…`}),t[35]=n):n=t[35];let i;return t[36]!==w||t[37]!==e?(i=(0,Q.jsxs)(`div`,{className:e,children:[w,n]}),t[36]=w,t[37]=e,t[38]=i):i=t[38],i}let E;t[39]===r?E=t[40]:(E=O(`group relative overflow-hidden rounded-lg border border-border bg-muted`,r),t[39]=r,t[40]=E);let A;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>s(!0),t[41]=A):A=t[41];let j;t[42]===c?j=t[43]:(j=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`block w-full text-left cursor-zoom-in p-4 max-w-full overflow-hidden [&_svg]:max-w-full [&_svg]:h-auto hover:bg-muted/70 transition-colors`,onClick:A,dangerouslySetInnerHTML:{__html:c}})}),t[42]=c,t[43]=j);let M;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(R,{children:`Click to view fullscreen`}),t[44]=M):M=t[44];let N;t[45]===j?N=t[46]:(N=(0,Q.jsxs)(B,{children:[j,M]}),t[45]=j,t[46]=N);let P;t[47]!==w||t[48]!==E||t[49]!==N?(P=(0,Q.jsxs)(`div`,{className:E,children:[w,N]}),t[47]=w,t[48]=E,t[49]=N,t[50]=P):P=t[50];let F;t[51]!==o||t[52]!==c?(F=o&&(0,Q.jsx)(pe,{svgOutput:c,onClose:()=>s(!1)}),t[51]=o,t[52]=c,t[53]=F):F=t[53];let I;return t[54]!==P||t[55]!==F?(I=(0,Q.jsxs)(z,{children:[P,F]}),t[54]=P,t[55]=F,t[56]=I):I=t[56],I}function $(e){let t=e.trim();if(t.startsWith(`/`)){let e=F().replace(/\/$/,``);return m(`${e}${t}`,e)}return m(t,F())}function _e(e){let t=e.trim();if(t.startsWith(`/api/`))return!0;if(!/^https?:\/\//i.test(t))return!1;try{let e=new URL(t);if(d(e.hostname))return!0;let n=new URL(F());return e.origin===n.origin&&e.pathname.startsWith(`/api/`)}catch{return!1}}function ve(e){let t=e.trim();return!t||t.startsWith(`mailto:`)||t.startsWith(`tel:`)?!1:M()?/^https?:\/\//i.test(t)||t.startsWith(`/api/`):_e(t)}function ye(e){let t=$(e);return A()&&!M()?(window.open(t,`_blank`,`noopener,noreferrer`),Promise.resolve()):N(t)}function be(e){return!!(d(e.hostname)||typeof window<`u`&&e.origin===window.location.origin)}function xe(e){return decodeURIComponent(e.replace(/^\/+/,``))}function Se(e){let t=e.trim();if(!t||t.includes(`
|
|
3
|
-
`))return null;let n=l(t);if(!n)return null;let r=t.toLowerCase();return r.startsWith(`http://`)||r.startsWith(`https://`)||r.startsWith(`/`)||r.includes(`/explorer/media`)||t.includes(`/`)||t.includes(`\\`)?{kind:n,src:t}:null}function Ce(e,t){let n=e.trim();if(!n||n.startsWith(`data:`)||n.includes(`/explorer/media`))return null;let r;if(/^https?:\/\//i.test(n)){let e;try{e=new URL(n)}catch{return null}if(!be(e))return null;r=xe(e.pathname)}else r=xe(n);let i=l(r);return!i||t&&i!==t?null:{path:r,kind:i}}function we(e,t){return $(`/api/threads/${encodeURIComponent(e)}/explorer/media?path=${encodeURIComponent(t)}`)}function Te(e){if(!e.startsWith(`/`))return!1;let t=e.split(`/`)[1]??``;return[`Users`,`tmp`,`var`,`private`,`Volumes`,`home`].includes(t)}function Ee(e,t){if(!e||e.startsWith(`data:`))return e;if(t){if(Te(e)&&l(e))return we(t,e);let n=Ce(e);if(n)return we(t,n.path)}return e.startsWith(`/`)?$(e):m(e,F())}function De(e,t){return Ee(e,t)}function Oe(e){let t=f(e);if(!t?.imageUrl&&!t?.imageData)return null;let n;if(typeof e==`object`&&e){let t=e;if(typeof t.model==`string`)n=t.model;else if(typeof t.content==`string`)try{let e=JSON.parse(t.content);typeof e.model==`string`&&(n=e.model)}catch{}}else if(typeof e==`string`)try{let t=JSON.parse(e.trim());typeof t.model==`string`&&(n=t.model)}catch{}return{imageUrl:t.imageUrl,imageData:t.imageData,model:n}}function ke(e,t){let n=Oe(e)??Oe(t);if(!n?.imageUrl&&!n?.imageData)return null;let r,i=[e,t.content,t];for(let e of i)if(typeof e==`string`&&e.trim().startsWith(`{`))try{let t=JSON.parse(e);if(typeof t.savedPath==`string`){r=t.savedPath;break}}catch{}else if(e&&typeof e==`object`){let t=e;if(typeof t.savedPath==`string`){r=t.savedPath;break}if(typeof t.content==`string`)try{let e=JSON.parse(t.content);if(typeof e.savedPath==`string`){r=e.savedPath;break}}catch{}}return{...n,savedPath:r}}function Ae(e){let t=(0,q.c)(34),{imageUrl:n,imageData:r,alt:i,threadId:a}=e,o=i===void 0?`Generated image`:i,[s,c]=(0,J.useState)(!1),l;t[0]!==r||t[1]!==n||t[2]!==a?(l=r?`data:image/png;base64,${r}`:De(n??``,a),t[0]=r,t[1]=n,t[2]=a,t[3]=l):l=t[3];let u=l,d;t[4]===u?d=t[5]:(d=async()=>{let e=p(u)??`generated-image-${Date.now()}.png`,{path:t}=await I(u.startsWith(`data:`)?{imageData:u.replace(/^data:[^;]+;base64,/,``),filename:e}:{imageUrl:u,filename:e});V({title:`Saved to downloads: ${t.split(`/`).pop()}`})},t[4]=u,t[5]=d);let f=d,m;t[6]===u?m=t[7]:(m=async()=>{await P(u.startsWith(`data:`)?{imageData:u.replace(/^data:[^;]+;base64,/,``)}:{imageUrl:u}),c(!0),setTimeout(()=>c(!1),2e3)},t[6]=u,t[7]=m);let h=m;if(!u)return null;let g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g={maxHeight:`512px`},t[8]=g):g=t[8];let v;t[9]!==o||t[10]!==u?(v=(0,Q.jsx)(`img`,{src:u,alt:o,className:`max-w-full rounded-lg block`,style:g}),t[9]=o,t[10]=u,t[11]=v):v=t[11];let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(x,{className:`h-3.5 w-3.5`}),t[12]=y):y=t[12];let b;t[13]===f?b=t[14]:(b=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsx)(`button`,{onClick:f,className:`flex items-center justify-center h-7 w-7 rounded-md bg-background/80 backdrop-blur-sm border border-border text-foreground hover:bg-background transition-colors`,children:y})}),t[13]=f,t[14]=b);let S;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(R,{children:`Save image`}),t[15]=S):S=t[15];let C;t[16]===b?C=t[17]:(C=(0,Q.jsxs)(B,{children:[b,S]}),t[16]=b,t[17]=C);let w;t[18]===s?w=t[19]:(w=s?(0,Q.jsx)(_,{className:`h-3.5 w-3.5 text-green-500`}):(0,Q.jsx)(D,{className:`h-3.5 w-3.5`}),t[18]=s,t[19]=w);let T;t[20]!==h||t[21]!==w?(T=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsx)(`button`,{onClick:h,className:`flex items-center justify-center h-7 w-7 rounded-md bg-background/80 backdrop-blur-sm border border-border text-foreground hover:bg-background transition-colors`,children:w})}),t[20]=h,t[21]=w,t[22]=T):T=t[22];let E=s?`Copied!`:`Copy to clipboard`,O;t[23]===E?O=t[24]:(O=(0,Q.jsx)(R,{children:E}),t[23]=E,t[24]=O);let k;t[25]!==T||t[26]!==O?(k=(0,Q.jsxs)(B,{children:[T,O]}),t[25]=T,t[26]=O,t[27]=k):k=t[27];let A;t[28]!==C||t[29]!==k?(A=(0,Q.jsx)(`div`,{className:`absolute top-2 right-2 flex gap-1 opacity-0 group-hover/img:opacity-100 transition-opacity`,children:(0,Q.jsxs)(z,{children:[C,k]})}),t[28]=C,t[29]=k,t[30]=A):A=t[30];let j;return t[31]!==A||t[32]!==v?(j=(0,Q.jsxs)(`div`,{className:`mb-3 relative group/img inline-block max-w-full`,children:[v,A]}),t[31]=A,t[32]=v,t[33]=j):j=t[33],j}var je=h(`chat.media`);function Me(e){if(!e)return`Unknown media error`;switch(e.code){case MediaError.MEDIA_ERR_ABORTED:return`Playback aborted`;case MediaError.MEDIA_ERR_NETWORK:return`Network error while fetching media`;case MediaError.MEDIA_ERR_DECODE:return`Media decode error`;case MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED:return`Unsupported media format or inaccessible source`;default:return`Media error (code ${e.code})`}}async function Ne(e){try{let t=await fetch(e,{method:`GET`,headers:{Range:`bytes=0-0`}}),n=t.headers.get(`content-type`)??`unknown`,r=t.headers.get(`accept-ranges`)??`none`,i=t.headers.get(`content-range`),a=i?`, content-range=${i}`:``;return`HTTP ${t.status} ${t.statusText}, content-type=${n}, accept-ranges=${r}${a}`}catch(e){return e instanceof Error?e.message:`Fetch failed`}}function Pe(e){je.error(`Failed to load media`,{kind:e.kind,src:e.src,label:e.label,mediaError:e.mediaError?{code:e.mediaError.code,message:e.mediaError.message,label:Me(e.mediaError)}:void 0,probeResult:e.probeResult})}function Fe(e,t,n,r){let[i,a]=(0,J.useState)({objectUrl:null,loadError:null,loading:!1});return(0,J.useEffect)(()=>{if(!t){a(e=>(e.objectUrl&&URL.revokeObjectURL(e.objectUrl),{objectUrl:null,loadError:null,loading:!1}));return}let i=!1;a(e=>(e.objectUrl&&URL.revokeObjectURL(e.objectUrl),{objectUrl:null,loadError:null,loading:!0}));async function o(){try{let t=await fetch(e);if(!t.ok){let t=await Ne(e);throw Error(t)}let n=await t.blob();if(i)return;let r=URL.createObjectURL(n);if(i){URL.revokeObjectURL(r);return}a({objectUrl:r,loadError:null,loading:!1})}catch(t){if(i)return;let o=t instanceof Error?t.message:await Ne(e);Pe({kind:n,src:e,label:r,probeResult:o}),a({objectUrl:null,loadError:o,loading:!1})}}return o(),()=>{i=!0,a(e=>(e.objectUrl&&URL.revokeObjectURL(e.objectUrl),{objectUrl:null,loadError:null,loading:!1}))}},[e,t,n,r]),i}function Ie(e){let t=(0,q.c)(44),{src:n,label:r}=e,[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1),c=(0,J.useRef)(null),{objectUrl:l,loadError:d,loading:f}=Fe(n,i,`video`,r),p;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(p=function(e){a(e),e||(s(!1),c.current&&c.current.pause())},t[0]=p):p=t[0];let m=p,h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h=function(){s(Le)},t[1]=h):h=t[1];let g=h,_;t[2]!==r||t[3]!==n?(_=async function(e){let t=e.currentTarget.error;Pe({kind:`video`,src:n,label:r,mediaError:t,probeResult:await Ne(n)})},t[2]=r,t[3]=n,t[4]=_):_=t[4];let v=_,y=r??`Video`,x;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>a(!0),t[5]=x):x=t[5];let S=r?`Play ${r}`:`Play video`,C;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(`span`,{className:`flex h-14 w-14 items-center justify-center rounded-full bg-background/90 text-foreground shadow-sm`,children:(0,Q.jsx)(b,{className:`h-7 w-7 fill-current`})}),t[6]=C):C=t[6];let D;t[7]===S?D=t[8]:(D=(0,Q.jsx)(`button`,{type:`button`,onClick:x,"aria-label":S,className:`flex min-h-32 w-full items-center justify-center rounded-md bg-muted/30 transition-colors hover:bg-muted/50`,children:C}),t[7]=S,t[8]=D);let k=o?`h-dvh w-dvw max-w-none rounded-none`:`max-w-[min(92vw,960px)]`,A;t[9]===k?A=t[10]:(A=O(`gap-0 overflow-hidden border-none bg-black p-0 sm:rounded-lg`,k),t[9]=k,t[10]=A);let j;t[11]===y?j=t[12]:(j=(0,Q.jsx)(ne,{className:`sr-only`,children:y}),t[11]=y,t[12]=j);let M;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(ee,{className:`sr-only`,children:`Video player`}),t[13]=M):M=t[13];let N=o?`Shrink video`:`Expand video`,P;t[14]===o?P=t[15]:(P=o?(0,Q.jsx)(w,{className:`h-4 w-4`}):(0,Q.jsx)(T,{className:`h-4 w-4`}),t[14]=o,t[15]=P);let F;t[16]!==N||t[17]!==P?(F=(0,Q.jsx)(`button`,{type:`button`,onClick:g,"aria-label":N,className:`flex h-7 w-7 items-center justify-center rounded-full text-white/90 transition-colors hover:bg-white/15 hover:text-white`,children:P}),t[16]=N,t[17]=P,t[18]=F):F=t[18];let I;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsxs)(H,{className:`flex h-7 w-7 items-center justify-center rounded-full text-white/90 transition-colors hover:bg-white/15 hover:text-white`,children:[(0,Q.jsx)(E,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),t[19]=I):I=t[19];let L;t[20]===F?L=t[21]:(L=(0,Q.jsxs)(`div`,{className:`absolute right-4 top-4 z-10 flex items-center gap-1`,children:[F,I]}),t[20]=F,t[21]=L);let R=o?`h-full`:`min-h-[240px]`,z;t[22]===R?z=t[23]:(z=O(`flex items-center justify-center p-3 pt-12 sm:p-4`,R),t[22]=R,t[23]=z);let B;t[24]!==o||t[25]!==v||t[26]!==d||t[27]!==f||t[28]!==l?(B=f?(0,Q.jsx)(`p`,{className:O(u.compact,`text-white/80`),children:`Loading video...`}):d?(0,Q.jsxs)(`p`,{className:O(u.compact,`px-4 text-center text-destructive`),children:[`Could not load video: `,d]}):l?(0,Q.jsx)(`video`,{ref:c,src:l,controls:!0,autoPlay:!0,playsInline:!0,className:O(`max-w-full rounded`,o?`max-h-full`:`max-h-[80vh]`),onError:v}):null,t[24]=o,t[25]=v,t[26]=d,t[27]=f,t[28]=l,t[29]=B):B=t[29];let V;t[30]!==z||t[31]!==B?(V=(0,Q.jsx)(`div`,{className:z,children:B}),t[30]=z,t[31]=B,t[32]=V):V=t[32];let W;t[33]!==j||t[34]!==L||t[35]!==V||t[36]!==A?(W=(0,Q.jsxs)(te,{hideClose:!0,className:A,children:[j,M,L,V]}),t[33]=j,t[34]=L,t[35]=V,t[36]=A,t[37]=W):W=t[37];let G;t[38]!==i||t[39]!==W?(G=(0,Q.jsx)(U,{open:i,onOpenChange:m,children:W}),t[38]=i,t[39]=W,t[40]=G):G=t[40];let K;return t[41]!==G||t[42]!==D?(K=(0,Q.jsxs)(Q.Fragment,{children:[D,G]}),t[41]=G,t[42]=D,t[43]=K):K=t[43],K}function Le(e){return!e}function Re(e){let t=(0,q.c)(12),{src:n,label:r}=e,{objectUrl:i,loadError:a,loading:o}=Fe(n,!0,`audio`,r),s;t[0]!==r||t[1]!==n?(s=async function(e){let t=e.currentTarget.error;Pe({kind:`audio`,src:n,label:r,mediaError:t,probeResult:await Ne(n)})},t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s,l;t[3]!==c||t[4]!==o||t[5]!==i?(l=o?(0,Q.jsx)(`p`,{className:O(u.compact,`text-muted-foreground`),children:`Loading audio...`}):i?(0,Q.jsx)(`audio`,{src:i,controls:!0,preload:`metadata`,className:`w-full`,onError:c}):null,t[3]=c,t[4]=o,t[5]=i,t[6]=l):l=t[6];let d;t[7]===a?d=t[8]:(d=a?(0,Q.jsxs)(`p`,{className:O(u.compact,`mt-2 text-destructive`),children:[`Could not load audio: `,a]}):null,t[7]=a,t[8]=d);let f;return t[9]!==l||t[10]!==d?(f=(0,Q.jsxs)(Q.Fragment,{children:[l,d]}),t[9]=l,t[10]=d,t[11]=f):f=t[11],f}function ze(e){let t=(0,q.c)(13),{src:n,kind:r,label:i}=e;if(!n)return null;let a=r===`video`?g:S,o=r===`video`?`p-2`:`p-3`,s;t[0]===o?s=t[1]:(s=O(`mt-2 max-w-full overflow-hidden rounded-lg border border-border bg-background`,o),t[0]=o,t[1]=s);let c;t[2]!==a||t[3]!==i?(c=i?(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-muted-foreground`,children:[(0,Q.jsx)(a,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{className:O(u.compact,`truncate`),children:i})]}):null,t[2]=a,t[3]=i,t[4]=c):c=t[4];let l;t[5]!==r||t[6]!==i||t[7]!==n?(l=r===`video`?(0,Q.jsx)(Ie,{src:n,label:i}):(0,Q.jsx)(Re,{src:n,label:i}),t[5]=r,t[6]=i,t[7]=n,t[8]=l):l=t[8];let d;return t[9]!==s||t[10]!==c||t[11]!==l?(d=(0,Q.jsxs)(`div`,{className:s,children:[c,l]}),t[9]=s,t[10]=c,t[11]=l,t[12]=d):d=t[12],d}var Be=[`graph`,`flowchart`,`sequenceDiagram`,`classDiagram`,`stateDiagram`,`erDiagram`,`journey`,`gantt`,`pie`,`quadrantChart`,`requirementDiagram`,`gitgraph`,`mindmap`,`timeline`,`zenuml`,`sankey`,`block`,`architecture`,`c4`,`packet`,`circuit`],Ve=/```mermaid\s*\n([\s\S]*?)\n```/;function He(e){return e.split(`
|
|
4
|
-
`).find(e=>e.trim().length>0)??``}function Ue(e){let t=e.trim().toLowerCase();return t.length===0?!1:Be.some(e=>t===e.toLowerCase()||t.startsWith(e.toLowerCase()+` `))}function We(e){return!e||typeof e!=`string`?!1:Ve.test(e)?!0:Ue(He(e))}function Ge(e){let t=Ve.exec(e);return t?t[1].trim():Ue(He(e))?e.trim():null}function Ke(e){let t=(0,q.c)(14),{href:n,children:r}=e,i;t[0]===n?i=t[1]:(i=$(n),t[0]=n,t[1]=i);let a=i,o;t[2]===n?o=t[3]:(o=ve(n),t[2]=n,t[3]=o);let s=o,c;t[4]!==n||t[5]!==s?(c=function(e){s&&(e.preventDefault(),ye(n))},t[4]=n,t[5]=s,t[6]=c):c=t[6];let l=c,u;t[7]===s?u=t[8]:(u=s?{}:{target:`_blank`,rel:`noopener noreferrer`},t[7]=s,t[8]=u);let d;return t[9]!==r||t[10]!==l||t[11]!==a||t[12]!==u?(d=(0,Q.jsx)(`a`,{href:a,onClick:l,className:`text-inherit underline underline-offset-2 hover:text-inherit/80`,...u,children:r}),t[9]=r,t[10]=l,t[11]=a,t[12]=u,t[13]=d):d=t[13],d}function qe(e){let t=(0,q.c)(11),{path:n,children:r,className:i}=e,{openChatDockPanel:a}=G(),{setPendingExplorerPath:o}=W(),s;t[0]!==a||t[1]!==n||t[2]!==o?(s=function(e){e.preventDefault(),e.stopPropagation(),o(n),a(`explorer`)},t[0]=a,t[1]=n,t[2]=o,t[3]=s):s=t[3];let c=s,l;t[4]===i?l=t[5]:(l=O(`cursor-pointer underline decoration-border underline-offset-2 transition-colors hover:text-foreground hover:decoration-foreground/60`,i),t[4]=i,t[5]=l);let u;return t[6]!==r||t[7]!==c||t[8]!==n||t[9]!==l?(u=(0,Q.jsx)(`a`,{href:`#`,onClick:c,"data-file-path":n,className:l,children:r}),t[6]=r,t[7]=c,t[8]=n,t[9]=l,t[10]=u):u=t[10],u}var Je=`[a-z0-9_@~./\\\\+-]*[a-z0-9_@~-]\\.[a-z][a-z0-9-]{0,11}`,Ye=RegExp(`^(?:${Je})$`,`i`),Xe=/[:#]L?\d+(?:-\d+)?$/,Ze=/[.,;:!?)\]}'"]+$/;function Qe(e){let t=new Set,n=new Map;for(let r of e){let e=r.replace(/\\/g,`/`);if(!e||e.endsWith(`/`))continue;t.add(e);let i=e.slice(e.lastIndexOf(`/`)+1),a=n.get(i);a?a.push(e):n.set(i,[e])}for(let e of n.values())e.sort(nt);return{exact:t,byBasename:n}}function $e(e){let t=e.trim().replace(/\\/g,`/`);return t=t.replace(Ze,``),t=t.replace(Xe,``),t.startsWith(`@`)&&(t=t.slice(1)),t.startsWith(`./`)&&(t=t.slice(2)),t=t.replace(/^\/+/,``),t.length===0||t.length>512||/\s/.test(t)||t.includes(`://`)||!Ye.test(t)?null:t}function et(e,t){let n=$e(e);if(!n)return null;if(t.exact.has(n))return n;let r=n.slice(n.lastIndexOf(`/`)+1),i=t.byBasename.get(r);if(!i||i.length===0)return null;if(!n.includes(`/`))return i[0];let a=`/${n}`;return i.find(e=>e.endsWith(a))??null}function tt(e,t){let n=new RegExp(Je,`gi`),r=[],i=0,a;for(;(a=n.exec(e))!==null;)a.index>i&&r.push({text:e.slice(i,a.index),path:null}),r.push({text:a[0],path:et(a[0],t)}),i=a.index+a[0].length;return i<e.length&&r.push({text:e.slice(i),path:null}),r.length>0?r:[{text:e,path:null}]}function nt(e,t){let n=rt(e)-rt(t);return n===0?e.length-t.length||e.localeCompare(t):n}function rt(e){let t=1;for(let n=0;n<e.length;n+=1)e.charCodeAt(n)===47&&(t+=1);return t}var it=15e3,at=2e4;function ot(e){let t=(0,q.c)(10),n;t[0]===e?n=t[1]:(n=c.threads.files(e??``),t[0]=e,t[1]=n);let r;t[2]===e?r=t[3]:(r=()=>j(e),t[2]=e,t[3]=r);let i=!!e,a;t[4]!==n||t[5]!==r||t[6]!==i?(a={queryKey:n,queryFn:r,enabled:i,staleTime:it,refetchInterval:at},t[4]=n,t[5]=r,t[6]=i,t[7]=a):a=t[7];let o=K(a),s;return t[8]===o.data?s=t[9]:(s=o.data?Qe(o.data):null,t[8]=o.data,t[9]=s),s}var st=/^(\s*)([-*+]|\d+\.)\s+(.*)$/,ct=100,lt=/^!\[([^\]]*)\]\(([^)]+)\)\s*$/,ut=/[.,!?;:]+$/,dt=(0,J.memo)(function({content:e,className:t,enableMermaid:n=!1,threadId:r,compact:i=!1,bodyClassName:a}){let
|
|
2
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{a as t,n,o as r,r as i,t as a}from"./react-vendor-Ee0-5T4I.js";import{a as o,n as s,t as c}from"./query-keys-5QPW6Dv-.js";import{S as l,dt as u,ft as d,lt as f,ot as p,st as m,z as h}from"./dist-BWuYHVi8.js";import{$t as g,An as _,Z as v,_t as y,it as b,mn as x,rn as S,rt as C,vt as w,wt as T,y as E,yn as D}from"./dist-DIjomljy.js";import{t as O}from"./utils-CT-Dw22R.js";import{t as k}from"./button-DeNw35VZ.js";import{Ar as A,Ht as j,Lr as M,Ur as N,Xt as P,g as F,mn as I}from"./api-BMo_Lz8f.js";import{i as L,n as R,r as z,t as B}from"./tooltip-B6ziVyTv.js";import{t as V}from"./use-toast-xpb5jNtN.js";import{i as ee,n as H,r as te,s as ne,t as U}from"./dialog-Do98zzAW.js";import{n as W}from"./explorer-tab-context-BxUVwWQQ.js";import{t as G}from"./use-open-chat-dock-panel-Cr1bQYOH.js";function K(e,t){return s(e,o,t)}var q=n(),J=e(r(),1);function re(e,t){let n=(0,q.c)(6),[r,i]=(0,J.useState)(e),a=(0,J.useRef)(-1/0),o=(0,J.useRef)(null),s=(0,J.useRef)(e),c;n[0]!==r||n[1]!==t||n[2]!==e?(c=()=>{if(s.current=e,Object.is(e,r))return;let n=function(){o.current=null,a.current=Date.now(),i(s.current)},c=Date.now()-a.current;if(c>=t){n();return}o.current||=setTimeout(n,t-c)},n[0]=r,n[1]=t,n[2]=e,n[3]=c):c=n[3],(0,J.useEffect)(c);let l,u;return n[4]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>()=>{o.current&&=(clearTimeout(o.current),null)},u=[],n[4]=l,n[5]=u):(l=n[4],u=n[5]),(0,J.useEffect)(l,u),r}var ie=e(t(),1),ae=.1,Y=10,oe=1.25,X=.001;function se(){let e=(0,q.c)(15),[t,n]=(0,J.useState)(1),r;e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r={x:0,y:0},e[0]=r):r=e[0];let[i,a]=(0,J.useState)(r),[o,s]=(0,J.useState)(!1),c=(0,J.useRef)(null),l=Z,u;e[1]===Symbol.for(`react.memo_cache_sentinel`)?(u=()=>n(e=>l(e*oe)),e[1]=u):u=e[1];let d=u,f;e[2]===Symbol.for(`react.memo_cache_sentinel`)?(f=()=>n(e=>l(e/oe)),e[2]=f):f=e[2];let p=f,m;e[3]===Symbol.for(`react.memo_cache_sentinel`)?(m=()=>{n(1),a({x:0,y:0})},e[3]=m):m=e[3];let h=m,g;e[4]===i?g=e[5]:(g=e=>{e.preventDefault(),s(!0),c.current={x:e.clientX,y:e.clientY,ox:i.x,oy:i.y}},e[4]=i,e[5]=g);let _=g,v;e[6]===Symbol.for(`react.memo_cache_sentinel`)?(v=e=>{c.current&&a({x:c.current.ox+(e.clientX-c.current.x),y:c.current.oy+(e.clientY-c.current.y)})},e[6]=v):v=e[6];let y=v,b;e[7]===Symbol.for(`react.memo_cache_sentinel`)?(b=()=>{s(!1),c.current=null},e[7]=b):b=e[7];let x=b,S=(0,J.useRef)(null),C,w;e[8]===Symbol.for(`react.memo_cache_sentinel`)?(C=()=>{let e=S.current;if(!e)return;let t=function(e){e.preventDefault();let t=-e.deltaY*X;n(e=>l(e*(1+t)))};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},w=[],e[8]=C,e[9]=w):(C=e[8],w=e[9]),(0,J.useEffect)(C,w);let T;return e[10]!==o||e[11]!==i||e[12]!==_||e[13]!==t?(T={scale:t,offset:i,isDragging:o,containerRef:S,zoomIn:d,zoomOut:p,reset:h,onMouseDown:_,onMouseMove:y,onMouseUp:x},e[10]=o,e[11]=i,e[12]=_,e[13]=t,e[14]=T):T=e[14],T}function Z(e){return Math.min(Math.max(e,ae),Y)}var Q=a(),ce=l(`app.mermaid-renderer.ui`);function le(){let e=(0,q.c)(2),[t,n]=(0,J.useState)(!1),r,i;return e[0]===Symbol.for(`react.memo_cache_sentinel`)?(r=()=>{let e=function(){n(document.documentElement.classList.contains(`dark`))};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),()=>t.disconnect()},i=[],e[0]=r,e[1]=i):(r=e[0],i=e[1]),(0,J.useEffect)(r,i),t}var ue=null;function de(){return ue||=i(()=>import(`./dist-IeRYu0zQ.js`),__vite__mapDeps([0,1])),ue}function fe(e,t){let[n,r]=(0,J.useState)(null),[i,a]=(0,J.useState)(null);return(0,J.useEffect)(()=>{let n=!1,i=setTimeout(()=>{let i=n=>{try{let i=n(e,{bg:t?`#18181B`:`#FFFFFF`,fg:t?`#FAFAFA`:`#27272A`,transparent:!1,padding:32});if(typeof i!=`string`||i.length===0)throw Error(`Mermaid renderer returned no SVG`);r(i),a(null)}catch(e){ce.error(`Mermaid render error:`,e),r(null),a(e instanceof Error?e.message:String(e))}};de().then(e=>{n||i(e.renderMermaidSVG)},e=>{n||(ce.error(`Mermaid renderer failed to load:`,e),a(e instanceof Error?e.message:String(e)))})},200);return()=>{n=!0,clearTimeout(i)}},[e,t]),{svgOutput:n,errorMessage:i}}function pe(e){let t=(0,q.c)(70),{svgOutput:n,onClose:r}=e,{scale:i,offset:a,isDragging:o,containerRef:s,zoomIn:c,zoomOut:l,reset:u,onMouseDown:d,onMouseMove:f,onMouseUp:m}=se(),h,g;t[0]===r?(h=t[1],g=t[2]):(h=()=>{let e=function(e){e.key===`Escape`&&r()};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},g=[r],t[0]=r,t[1]=h,t[2]=g),(0,J.useEffect)(h,g);let _;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(_=[],t[3]=_):_=t[3],(0,J.useEffect)(me,_);let b;t[4]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(`span`,{className:O(p.compact,`font-mono text-muted-foreground`),children:`mermaid diagram`}),t[4]=b):b=t[4];let x,S;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,Q.jsx)(y,{className:`h-3.5 w-3.5`}),S=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Zoom out`}),t[5]=x,t[6]=S):(x=t[5],S=t[6]);let w;t[7]===l?w=t[8]:(w=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsxs)(k,{variant:`ghost`,size:`icon-xs`,onClick:l,children:[x,S]})}),t[7]=l,t[8]=w);let T;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(T=(0,Q.jsx)(R,{children:`Zoom out`}),t[9]=T):T=t[9];let D;t[10]===w?D=t[11]:(D=(0,Q.jsxs)(B,{children:[w,T]}),t[10]=w,t[11]=D);let A;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(A=O(p.compact,`min-w-[3rem] px-2 py-1 font-mono text-muted-foreground hover:text-foreground hover:bg-muted rounded transition-colors`),t[12]=A):A=t[12];let j;t[13]===i?j=t[14]:(j=Math.round(i*100),t[13]=i,t[14]=j);let M;t[15]!==u||t[16]!==j?(M=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsxs)(`button`,{type:`button`,onClick:u,className:A,children:[j,`%`]})}),t[15]=u,t[16]=j,t[17]=M):M=t[17];let N;t[18]===Symbol.for(`react.memo_cache_sentinel`)?(N=(0,Q.jsx)(R,{children:`Reset zoom`}),t[18]=N):N=t[18];let P;t[19]===M?P=t[20]:(P=(0,Q.jsxs)(B,{children:[M,N]}),t[19]=M,t[20]=P);let F,I;t[21]===Symbol.for(`react.memo_cache_sentinel`)?(F=(0,Q.jsx)(C,{className:`h-3.5 w-3.5`}),I=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Zoom in`}),t[21]=F,t[22]=I):(F=t[21],I=t[22]);let V;t[23]===c?V=t[24]:(V=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsxs)(k,{variant:`ghost`,size:`icon-xs`,onClick:c,children:[F,I]})}),t[23]=c,t[24]=V);let ee;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(ee=(0,Q.jsx)(R,{children:`Zoom in`}),t[25]=ee):ee=t[25];let H;t[26]===V?H=t[27]:(H=(0,Q.jsxs)(B,{children:[V,ee]}),t[26]=V,t[27]=H);let te,ne;t[28]===Symbol.for(`react.memo_cache_sentinel`)?(te=(0,Q.jsx)(v,{className:`h-3.5 w-3.5`}),ne=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Reset view`}),t[28]=te,t[29]=ne):(te=t[28],ne=t[29]);let U;t[30]===u?U=t[31]:(U=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsxs)(k,{variant:`ghost`,size:`icon-xs`,onClick:u,children:[te,ne]})}),t[30]=u,t[31]=U);let W;t[32]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,Q.jsx)(R,{children:`Reset view`}),t[32]=W):W=t[32];let G;t[33]===U?G=t[34]:(G=(0,Q.jsxs)(B,{children:[U,W]}),t[33]=U,t[34]=G);let K;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(K=(0,Q.jsx)(`div`,{className:`w-px h-4 bg-border mx-1`}),t[35]=K):K=t[35];let re,ae;t[36]===Symbol.for(`react.memo_cache_sentinel`)?(re=(0,Q.jsx)(E,{className:`h-3.5 w-3.5`}),ae=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`}),t[36]=re,t[37]=ae):(re=t[36],ae=t[37]);let Y;t[38]===r?Y=t[39]:(Y=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsxs)(k,{variant:`ghost`,size:`icon-xs`,onClick:r,children:[re,ae]})}),t[38]=r,t[39]=Y);let oe;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(oe=(0,Q.jsx)(R,{children:`Close (Esc)`}),t[40]=oe):oe=t[40];let X;t[41]===Y?X=t[42]:(X=(0,Q.jsxs)(B,{children:[Y,oe]}),t[41]=Y,t[42]=X);let Z;t[43]!==P||t[44]!==H||t[45]!==G||t[46]!==X||t[47]!==D?(Z=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between px-4 py-3 bg-background/90 border-b border-border shrink-0`,children:[b,(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[D,P,H,G,K,X]})]}),t[43]=P,t[44]=H,t[45]=G,t[46]=X,t[47]=D,t[48]=Z):Z=t[48];let ce=o?`cursor-grabbing`:`cursor-grab`,le;t[49]===ce?le=t[50]:(le=O(`flex-1 overflow-hidden select-none`,ce),t[49]=ce,t[50]=le);let ue=`translate(${a.x}px, ${a.y}px) scale(${i})`,de=o?`none`:`transform 0.1s ease-out`,fe;t[51]!==ue||t[52]!==de?(fe={transform:ue,transformOrigin:`center center`,transition:de},t[51]=ue,t[52]=de,t[53]=fe):fe=t[53];let pe;t[54]===n?pe=t[55]:(pe={__html:n},t[54]=n,t[55]=pe);let he;t[56]!==fe||t[57]!==pe?(he=(0,Q.jsx)(`div`,{className:`w-full h-full flex items-center justify-center`,style:fe,dangerouslySetInnerHTML:pe}),t[56]=fe,t[57]=pe,t[58]=he):he=t[58];let ge;t[59]!==s||t[60]!==d||t[61]!==f||t[62]!==m||t[63]!==le||t[64]!==he?(ge=(0,Q.jsx)(`div`,{ref:s,className:le,onMouseDown:d,onMouseMove:f,onMouseUp:m,onMouseLeave:m,children:he}),t[59]=s,t[60]=d,t[61]=f,t[62]=m,t[63]=le,t[64]=he,t[65]=ge):ge=t[65];let $;t[66]===Symbol.for(`react.memo_cache_sentinel`)?($=(0,Q.jsx)(`div`,{className:O(p.compact,`shrink-0 px-4 py-2 text-center text-muted-foreground/60 bg-background/60 border-t border-border`),children:`Scroll to zoom · Drag to pan · Esc to close`}),t[66]=$):$=t[66];let _e;return t[67]!==Z||t[68]!==ge?(_e=(0,ie.createPortal)((0,Q.jsx)(z,{children:(0,Q.jsxs)(`div`,{className:`fixed inset-0 z-50 flex flex-col bg-black/85 backdrop-blur-sm`,role:`dialog`,"aria-modal":`true`,"aria-label":`Diagram fullscreen view`,children:[Z,ge,$]})}),document.body),t[67]=Z,t[68]=ge,t[69]=_e):_e=t[69],_e}function me(){return document.body.style.overflow=`hidden`,he}function he(){document.body.style.overflow=``}function ge(e){let t=(0,q.c)(57),{content:n,className:r}=e,[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1),{svgOutput:c,errorMessage:l}=fe(n,le()),u=l!==null,d;t[0]===n?d=t[1]:(d=async function(){await navigator.clipboard.writeText(n),a(!0),setTimeout(()=>a(!1),2e3)},t[0]=n,t[1]=d);let f=d,m;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(m=O(p.compact,`font-mono text-muted-foreground`),t[2]=m):m=t[2];let h=u?`mermaid (render error)`:`mermaid diagram`,g;t[3]===h?g=t[4]:(g=(0,Q.jsx)(`span`,{className:m,children:h}),t[3]=h,t[4]=g);let v;t[5]!==u||t[6]!==c?(v=c&&!u&&(0,Q.jsxs)(B,{children:[(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsxs)(k,{variant:`action`,size:`icon-xs`,onClick:()=>s(!0),children:[(0,Q.jsx)(T,{}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`View fullscreen`})]})}),(0,Q.jsx)(R,{children:`View fullscreen`})]}),t[5]=u,t[6]=c,t[7]=v):v=t[7];let y;t[8]===i?y=t[9]:(y=i?(0,Q.jsx)(_,{}):(0,Q.jsx)(D,{}),t[8]=i,t[9]=y);let b;t[10]===Symbol.for(`react.memo_cache_sentinel`)?(b=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Copy mermaid code`}),t[10]=b):b=t[10];let x;t[11]!==f||t[12]!==y?(x=(0,Q.jsxs)(k,{variant:`action`,size:`icon-xs`,onClick:f,children:[y,b]}),t[11]=f,t[12]=y,t[13]=x):x=t[13];let S;t[14]!==v||t[15]!==x?(S=(0,Q.jsxs)(`div`,{className:`flex items-center gap-1`,children:[v,x]}),t[14]=v,t[15]=x,t[16]=S):S=t[16];let C;t[17]!==g||t[18]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border bg-muted/80 px-4 py-2`,children:[g,S]}),t[17]=g,t[18]=S,t[19]=C):C=t[19];let w=C;if(u){let e;t[20]===r?e=t[21]:(e=O(`group relative overflow-hidden rounded-lg border border-border bg-muted`,r),t[20]=r,t[21]=e);let i;t[22]===Symbol.for(`react.memo_cache_sentinel`)?(i=O(p.compact,`border-b border-border bg-background/50 px-4 py-2 text-destructive`),t[22]=i):i=t[22];let a;t[23]===l?a=t[24]:(a=(0,Q.jsx)(`div`,{className:i,role:`alert`,children:l}),t[23]=l,t[24]=a);let o;t[25]===Symbol.for(`react.memo_cache_sentinel`)?(o=O(p.compact,`font-mono text-foreground leading-relaxed`),t[25]=o):o=t[25];let s;t[26]===n?s=t[27]:(s=(0,Q.jsx)(`pre`,{className:`overflow-x-auto p-4 max-w-full`,children:(0,Q.jsx)(`code`,{className:o,children:n})}),t[26]=n,t[27]=s);let c;return t[28]!==w||t[29]!==e||t[30]!==a||t[31]!==s?(c=(0,Q.jsxs)(`div`,{className:e,children:[w,a,s]}),t[28]=w,t[29]=e,t[30]=a,t[31]=s,t[32]=c):c=t[32],c}if(!c){let e;t[33]===r?e=t[34]:(e=O(`group relative overflow-hidden rounded-lg border border-border bg-muted`,r),t[33]=r,t[34]=e);let n;t[35]===Symbol.for(`react.memo_cache_sentinel`)?(n=(0,Q.jsx)(`div`,{className:O(p.compact,`p-4 text-muted-foreground`),children:`Rendering diagram…`}),t[35]=n):n=t[35];let i;return t[36]!==w||t[37]!==e?(i=(0,Q.jsxs)(`div`,{className:e,children:[w,n]}),t[36]=w,t[37]=e,t[38]=i):i=t[38],i}let E;t[39]===r?E=t[40]:(E=O(`group relative overflow-hidden rounded-lg border border-border bg-muted`,r),t[39]=r,t[40]=E);let A;t[41]===Symbol.for(`react.memo_cache_sentinel`)?(A=()=>s(!0),t[41]=A):A=t[41];let j;t[42]===c?j=t[43]:(j=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsx)(`button`,{type:`button`,className:`block w-full text-left cursor-zoom-in p-4 max-w-full overflow-hidden [&_svg]:max-w-full [&_svg]:h-auto hover:bg-muted/70 transition-colors`,onClick:A,dangerouslySetInnerHTML:{__html:c}})}),t[42]=c,t[43]=j);let M;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(R,{children:`Click to view fullscreen`}),t[44]=M):M=t[44];let N;t[45]===j?N=t[46]:(N=(0,Q.jsxs)(B,{children:[j,M]}),t[45]=j,t[46]=N);let P;t[47]!==w||t[48]!==E||t[49]!==N?(P=(0,Q.jsxs)(`div`,{className:E,children:[w,N]}),t[47]=w,t[48]=E,t[49]=N,t[50]=P):P=t[50];let F;t[51]!==o||t[52]!==c?(F=o&&(0,Q.jsx)(pe,{svgOutput:c,onClose:()=>s(!1)}),t[51]=o,t[52]=c,t[53]=F):F=t[53];let I;return t[54]!==P||t[55]!==F?(I=(0,Q.jsxs)(z,{children:[P,F]}),t[54]=P,t[55]=F,t[56]=I):I=t[56],I}function $(e){let t=e.trim();if(t.startsWith(`/`)){let e=A().replace(/\/$/,``);return u(`${e}${t}`,e)}return u(t,A())}function _e(e){let t=e.trim();if(t.startsWith(`/api/`))return!0;if(!/^https?:\/\//i.test(t))return!1;try{let e=new URL(t);if(f(e.hostname))return!0;let n=new URL(A());return e.origin===n.origin&&e.pathname.startsWith(`/api/`)}catch{return!1}}function ve(e){let t=e.trim();return!t||t.startsWith(`mailto:`)||t.startsWith(`tel:`)?!1:M()?/^https?:\/\//i.test(t)||t.startsWith(`/api/`):_e(t)}function ye(e){let t=$(e);return N()&&!M()?(window.open(t,`_blank`,`noopener,noreferrer`),Promise.resolve()):P(t)}function be(e){return!!(f(e.hostname)||typeof window<`u`&&e.origin===window.location.origin)}function xe(e){return decodeURIComponent(e.replace(/^\/+/,``))}function Se(e){let t=e.trim();if(!t||t.includes(`
|
|
3
|
+
`))return null;let n=h(t);if(!n)return null;let r=t.toLowerCase();return r.startsWith(`http://`)||r.startsWith(`https://`)||r.startsWith(`/`)||r.includes(`/explorer/media`)||t.includes(`/`)||t.includes(`\\`)?{kind:n,src:t}:null}function Ce(e,t){let n=e.trim();if(!n||n.startsWith(`data:`)||n.includes(`/explorer/media`))return null;let r;if(/^https?:\/\//i.test(n)){let e;try{e=new URL(n)}catch{return null}if(!be(e))return null;r=xe(e.pathname)}else r=xe(n);let i=h(r);return!i||t&&i!==t?null:{path:r,kind:i}}function we(e,t){return $(`/api/threads/${encodeURIComponent(e)}/explorer/media?path=${encodeURIComponent(t)}`)}function Te(e){if(!e.startsWith(`/`))return!1;let t=e.split(`/`)[1]??``;return[`Users`,`tmp`,`var`,`private`,`Volumes`,`home`].includes(t)}function Ee(e,t){if(!e||e.startsWith(`data:`))return e;if(t){if(Te(e)&&h(e))return we(t,e);let n=Ce(e);if(n)return we(t,n.path)}return e.startsWith(`/`)?$(e):u(e,A())}function De(e,t){return Ee(e,t)}function Oe(e){let t=d(e);if(!t?.imageUrl&&!t?.imageData)return null;let n;if(typeof e==`object`&&e){let t=e;if(typeof t.model==`string`)n=t.model;else if(typeof t.content==`string`)try{let e=JSON.parse(t.content);typeof e.model==`string`&&(n=e.model)}catch{}}else if(typeof e==`string`)try{let t=JSON.parse(e.trim());typeof t.model==`string`&&(n=t.model)}catch{}return{imageUrl:t.imageUrl,imageData:t.imageData,model:n}}function ke(e,t){let n=Oe(e)??Oe(t);if(!n?.imageUrl&&!n?.imageData)return null;let r,i=[e,t.content,t];for(let e of i)if(typeof e==`string`&&e.trim().startsWith(`{`))try{let t=JSON.parse(e);if(typeof t.savedPath==`string`){r=t.savedPath;break}}catch{}else if(e&&typeof e==`object`){let t=e;if(typeof t.savedPath==`string`){r=t.savedPath;break}if(typeof t.content==`string`)try{let e=JSON.parse(t.content);if(typeof e.savedPath==`string`){r=e.savedPath;break}}catch{}}return{...n,savedPath:r}}function Ae(e){let t=(0,q.c)(34),{imageUrl:n,imageData:r,alt:i,threadId:a}=e,o=i===void 0?`Generated image`:i,[s,c]=(0,J.useState)(!1),l;t[0]!==r||t[1]!==n||t[2]!==a?(l=r?`data:image/png;base64,${r}`:De(n??``,a),t[0]=r,t[1]=n,t[2]=a,t[3]=l):l=t[3];let u=l,d;t[4]===u?d=t[5]:(d=async()=>{let e=m(u)??`generated-image-${Date.now()}.png`,{path:t}=await I(u.startsWith(`data:`)?{imageData:u.replace(/^data:[^;]+;base64,/,``),filename:e}:{imageUrl:u,filename:e});V({title:`Saved to downloads: ${t.split(`/`).pop()}`})},t[4]=u,t[5]=d);let f=d,p;t[6]===u?p=t[7]:(p=async()=>{await F(u.startsWith(`data:`)?{imageData:u.replace(/^data:[^;]+;base64,/,``)}:{imageUrl:u}),c(!0),setTimeout(()=>c(!1),2e3)},t[6]=u,t[7]=p);let h=p;if(!u)return null;let g;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(g={maxHeight:`512px`},t[8]=g):g=t[8];let v;t[9]!==o||t[10]!==u?(v=(0,Q.jsx)(`img`,{src:u,alt:o,className:`max-w-full rounded-lg block`,style:g}),t[9]=o,t[10]=u,t[11]=v):v=t[11];let y;t[12]===Symbol.for(`react.memo_cache_sentinel`)?(y=(0,Q.jsx)(x,{className:`h-3.5 w-3.5`}),t[12]=y):y=t[12];let b;t[13]===f?b=t[14]:(b=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsx)(`button`,{onClick:f,className:`flex items-center justify-center h-7 w-7 rounded-md bg-background/80 backdrop-blur-sm border border-border text-foreground hover:bg-background transition-colors`,children:y})}),t[13]=f,t[14]=b);let S;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(S=(0,Q.jsx)(R,{children:`Save image`}),t[15]=S):S=t[15];let C;t[16]===b?C=t[17]:(C=(0,Q.jsxs)(B,{children:[b,S]}),t[16]=b,t[17]=C);let w;t[18]===s?w=t[19]:(w=s?(0,Q.jsx)(_,{className:`h-3.5 w-3.5 text-green-500`}):(0,Q.jsx)(D,{className:`h-3.5 w-3.5`}),t[18]=s,t[19]=w);let T;t[20]!==h||t[21]!==w?(T=(0,Q.jsx)(L,{asChild:!0,children:(0,Q.jsx)(`button`,{onClick:h,className:`flex items-center justify-center h-7 w-7 rounded-md bg-background/80 backdrop-blur-sm border border-border text-foreground hover:bg-background transition-colors`,children:w})}),t[20]=h,t[21]=w,t[22]=T):T=t[22];let E=s?`Copied!`:`Copy to clipboard`,O;t[23]===E?O=t[24]:(O=(0,Q.jsx)(R,{children:E}),t[23]=E,t[24]=O);let k;t[25]!==T||t[26]!==O?(k=(0,Q.jsxs)(B,{children:[T,O]}),t[25]=T,t[26]=O,t[27]=k):k=t[27];let A;t[28]!==C||t[29]!==k?(A=(0,Q.jsx)(`div`,{className:`absolute top-2 right-2 flex gap-1 opacity-0 group-hover/img:opacity-100 transition-opacity`,children:(0,Q.jsxs)(z,{children:[C,k]})}),t[28]=C,t[29]=k,t[30]=A):A=t[30];let j;return t[31]!==A||t[32]!==v?(j=(0,Q.jsxs)(`div`,{className:`mb-3 relative group/img inline-block max-w-full`,children:[v,A]}),t[31]=A,t[32]=v,t[33]=j):j=t[33],j}var je=l(`chat.media`);function Me(e){if(!e)return`Unknown media error`;switch(e.code){case MediaError.MEDIA_ERR_ABORTED:return`Playback aborted`;case MediaError.MEDIA_ERR_NETWORK:return`Network error while fetching media`;case MediaError.MEDIA_ERR_DECODE:return`Media decode error`;case MediaError.MEDIA_ERR_SRC_NOT_SUPPORTED:return`Unsupported media format or inaccessible source`;default:return`Media error (code ${e.code})`}}async function Ne(e){try{let t=await fetch(e,{method:`GET`,headers:{Range:`bytes=0-0`}}),n=t.headers.get(`content-type`)??`unknown`,r=t.headers.get(`accept-ranges`)??`none`,i=t.headers.get(`content-range`),a=i?`, content-range=${i}`:``;return`HTTP ${t.status} ${t.statusText}, content-type=${n}, accept-ranges=${r}${a}`}catch(e){return e instanceof Error?e.message:`Fetch failed`}}function Pe(e){je.error(`Failed to load media`,{kind:e.kind,src:e.src,label:e.label,mediaError:e.mediaError?{code:e.mediaError.code,message:e.mediaError.message,label:Me(e.mediaError)}:void 0,probeResult:e.probeResult})}function Fe(e,t,n,r){let[i,a]=(0,J.useState)({objectUrl:null,loadError:null,loading:!1});return(0,J.useEffect)(()=>{if(!t){a(e=>(e.objectUrl&&URL.revokeObjectURL(e.objectUrl),{objectUrl:null,loadError:null,loading:!1}));return}let i=!1;a(e=>(e.objectUrl&&URL.revokeObjectURL(e.objectUrl),{objectUrl:null,loadError:null,loading:!0}));async function o(){try{let t=await fetch(e);if(!t.ok){let t=await Ne(e);throw Error(t)}let n=await t.blob();if(i)return;let r=URL.createObjectURL(n);if(i){URL.revokeObjectURL(r);return}a({objectUrl:r,loadError:null,loading:!1})}catch(t){if(i)return;let o=t instanceof Error?t.message:await Ne(e);Pe({kind:n,src:e,label:r,probeResult:o}),a({objectUrl:null,loadError:o,loading:!1})}}return o(),()=>{i=!0,a(e=>(e.objectUrl&&URL.revokeObjectURL(e.objectUrl),{objectUrl:null,loadError:null,loading:!1}))}},[e,t,n,r]),i}function Ie(e){let t=(0,q.c)(44),{src:n,label:r}=e,[i,a]=(0,J.useState)(!1),[o,s]=(0,J.useState)(!1),c=(0,J.useRef)(null),{objectUrl:l,loadError:u,loading:d}=Fe(n,i,`video`,r),f;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(f=function(e){a(e),e||(s(!1),c.current&&c.current.pause())},t[0]=f):f=t[0];let m=f,h;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(h=function(){s(Le)},t[1]=h):h=t[1];let g=h,_;t[2]!==r||t[3]!==n?(_=async function(e){let t=e.currentTarget.error;Pe({kind:`video`,src:n,label:r,mediaError:t,probeResult:await Ne(n)})},t[2]=r,t[3]=n,t[4]=_):_=t[4];let v=_,y=r??`Video`,x;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(x=()=>a(!0),t[5]=x):x=t[5];let S=r?`Play ${r}`:`Play video`,C;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,Q.jsx)(`span`,{className:`flex h-14 w-14 items-center justify-center rounded-full bg-background/90 text-foreground shadow-sm`,children:(0,Q.jsx)(b,{className:`h-7 w-7 fill-current`})}),t[6]=C):C=t[6];let D;t[7]===S?D=t[8]:(D=(0,Q.jsx)(`button`,{type:`button`,onClick:x,"aria-label":S,className:`flex min-h-32 w-full items-center justify-center rounded-md bg-muted/30 transition-colors hover:bg-muted/50`,children:C}),t[7]=S,t[8]=D);let k=o?`h-dvh w-dvw max-w-none rounded-none`:`max-w-[min(92vw,960px)]`,A;t[9]===k?A=t[10]:(A=O(`gap-0 overflow-hidden border-none bg-black p-0 sm:rounded-lg`,k),t[9]=k,t[10]=A);let j;t[11]===y?j=t[12]:(j=(0,Q.jsx)(ne,{className:`sr-only`,children:y}),t[11]=y,t[12]=j);let M;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(M=(0,Q.jsx)(ee,{className:`sr-only`,children:`Video player`}),t[13]=M):M=t[13];let N=o?`Shrink video`:`Expand video`,P;t[14]===o?P=t[15]:(P=o?(0,Q.jsx)(w,{className:`h-4 w-4`}):(0,Q.jsx)(T,{className:`h-4 w-4`}),t[14]=o,t[15]=P);let F;t[16]!==N||t[17]!==P?(F=(0,Q.jsx)(`button`,{type:`button`,onClick:g,"aria-label":N,className:`flex h-7 w-7 items-center justify-center rounded-full text-white/90 transition-colors hover:bg-white/15 hover:text-white`,children:P}),t[16]=N,t[17]=P,t[18]=F):F=t[18];let I;t[19]===Symbol.for(`react.memo_cache_sentinel`)?(I=(0,Q.jsxs)(H,{className:`flex h-7 w-7 items-center justify-center rounded-full text-white/90 transition-colors hover:bg-white/15 hover:text-white`,children:[(0,Q.jsx)(E,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Close`})]}),t[19]=I):I=t[19];let L;t[20]===F?L=t[21]:(L=(0,Q.jsxs)(`div`,{className:`absolute right-4 top-4 z-10 flex items-center gap-1`,children:[F,I]}),t[20]=F,t[21]=L);let R=o?`h-full`:`min-h-[240px]`,z;t[22]===R?z=t[23]:(z=O(`flex items-center justify-center p-3 pt-12 sm:p-4`,R),t[22]=R,t[23]=z);let B;t[24]!==o||t[25]!==v||t[26]!==u||t[27]!==d||t[28]!==l?(B=d?(0,Q.jsx)(`p`,{className:O(p.compact,`text-white/80`),children:`Loading video...`}):u?(0,Q.jsxs)(`p`,{className:O(p.compact,`px-4 text-center text-destructive`),children:[`Could not load video: `,u]}):l?(0,Q.jsx)(`video`,{ref:c,src:l,controls:!0,autoPlay:!0,playsInline:!0,className:O(`max-w-full rounded`,o?`max-h-full`:`max-h-[80vh]`),onError:v}):null,t[24]=o,t[25]=v,t[26]=u,t[27]=d,t[28]=l,t[29]=B):B=t[29];let V;t[30]!==z||t[31]!==B?(V=(0,Q.jsx)(`div`,{className:z,children:B}),t[30]=z,t[31]=B,t[32]=V):V=t[32];let W;t[33]!==j||t[34]!==L||t[35]!==V||t[36]!==A?(W=(0,Q.jsxs)(te,{hideClose:!0,className:A,children:[j,M,L,V]}),t[33]=j,t[34]=L,t[35]=V,t[36]=A,t[37]=W):W=t[37];let G;t[38]!==i||t[39]!==W?(G=(0,Q.jsx)(U,{open:i,onOpenChange:m,children:W}),t[38]=i,t[39]=W,t[40]=G):G=t[40];let K;return t[41]!==G||t[42]!==D?(K=(0,Q.jsxs)(Q.Fragment,{children:[D,G]}),t[41]=G,t[42]=D,t[43]=K):K=t[43],K}function Le(e){return!e}function Re(e){let t=(0,q.c)(12),{src:n,label:r}=e,{objectUrl:i,loadError:a,loading:o}=Fe(n,!0,`audio`,r),s;t[0]!==r||t[1]!==n?(s=async function(e){let t=e.currentTarget.error;Pe({kind:`audio`,src:n,label:r,mediaError:t,probeResult:await Ne(n)})},t[0]=r,t[1]=n,t[2]=s):s=t[2];let c=s,l;t[3]!==c||t[4]!==o||t[5]!==i?(l=o?(0,Q.jsx)(`p`,{className:O(p.compact,`text-muted-foreground`),children:`Loading audio...`}):i?(0,Q.jsx)(`audio`,{src:i,controls:!0,preload:`metadata`,className:`w-full`,onError:c}):null,t[3]=c,t[4]=o,t[5]=i,t[6]=l):l=t[6];let u;t[7]===a?u=t[8]:(u=a?(0,Q.jsxs)(`p`,{className:O(p.compact,`mt-2 text-destructive`),children:[`Could not load audio: `,a]}):null,t[7]=a,t[8]=u);let d;return t[9]!==l||t[10]!==u?(d=(0,Q.jsxs)(Q.Fragment,{children:[l,u]}),t[9]=l,t[10]=u,t[11]=d):d=t[11],d}function ze(e){let t=(0,q.c)(13),{src:n,kind:r,label:i}=e;if(!n)return null;let a=r===`video`?g:S,o=r===`video`?`p-2`:`p-3`,s;t[0]===o?s=t[1]:(s=O(`mt-2 max-w-full overflow-hidden rounded-lg border border-border bg-background`,o),t[0]=o,t[1]=s);let c;t[2]!==a||t[3]!==i?(c=i?(0,Q.jsxs)(`div`,{className:`mb-2 flex items-center gap-2 text-muted-foreground`,children:[(0,Q.jsx)(a,{className:`h-4 w-4`}),(0,Q.jsx)(`span`,{className:O(p.compact,`truncate`),children:i})]}):null,t[2]=a,t[3]=i,t[4]=c):c=t[4];let l;t[5]!==r||t[6]!==i||t[7]!==n?(l=r===`video`?(0,Q.jsx)(Ie,{src:n,label:i}):(0,Q.jsx)(Re,{src:n,label:i}),t[5]=r,t[6]=i,t[7]=n,t[8]=l):l=t[8];let u;return t[9]!==s||t[10]!==c||t[11]!==l?(u=(0,Q.jsxs)(`div`,{className:s,children:[c,l]}),t[9]=s,t[10]=c,t[11]=l,t[12]=u):u=t[12],u}var Be=[`graph`,`flowchart`,`sequenceDiagram`,`classDiagram`,`stateDiagram`,`erDiagram`,`journey`,`gantt`,`pie`,`quadrantChart`,`requirementDiagram`,`gitgraph`,`mindmap`,`timeline`,`zenuml`,`sankey`,`block`,`architecture`,`c4`,`packet`,`circuit`],Ve=/```mermaid\s*\n([\s\S]*?)\n```/;function He(e){return e.split(`
|
|
4
|
+
`).find(e=>e.trim().length>0)??``}function Ue(e){let t=e.trim().toLowerCase();return t.length===0?!1:Be.some(e=>t===e.toLowerCase()||t.startsWith(e.toLowerCase()+` `))}function We(e){return!e||typeof e!=`string`?!1:Ve.test(e)?!0:Ue(He(e))}function Ge(e){let t=Ve.exec(e);return t?t[1].trim():Ue(He(e))?e.trim():null}function Ke(e){let t=(0,q.c)(14),{href:n,children:r}=e,i;t[0]===n?i=t[1]:(i=$(n),t[0]=n,t[1]=i);let a=i,o;t[2]===n?o=t[3]:(o=ve(n),t[2]=n,t[3]=o);let s=o,c;t[4]!==n||t[5]!==s?(c=function(e){s&&(e.preventDefault(),ye(n))},t[4]=n,t[5]=s,t[6]=c):c=t[6];let l=c,u;t[7]===s?u=t[8]:(u=s?{}:{target:`_blank`,rel:`noopener noreferrer`},t[7]=s,t[8]=u);let d;return t[9]!==r||t[10]!==l||t[11]!==a||t[12]!==u?(d=(0,Q.jsx)(`a`,{href:a,onClick:l,className:`text-inherit underline underline-offset-2 hover:text-inherit/80`,...u,children:r}),t[9]=r,t[10]=l,t[11]=a,t[12]=u,t[13]=d):d=t[13],d}function qe(e){let t=(0,q.c)(11),{path:n,children:r,className:i}=e,{openChatDockPanel:a}=G(),{setPendingExplorerPath:o}=W(),s;t[0]!==a||t[1]!==n||t[2]!==o?(s=function(e){e.preventDefault(),e.stopPropagation(),o(n),a(`explorer`)},t[0]=a,t[1]=n,t[2]=o,t[3]=s):s=t[3];let c=s,l;t[4]===i?l=t[5]:(l=O(`cursor-pointer underline decoration-border underline-offset-2 transition-colors hover:text-foreground hover:decoration-foreground/60`,i),t[4]=i,t[5]=l);let u;return t[6]!==r||t[7]!==c||t[8]!==n||t[9]!==l?(u=(0,Q.jsx)(`a`,{href:`#`,onClick:c,"data-file-path":n,className:l,children:r}),t[6]=r,t[7]=c,t[8]=n,t[9]=l,t[10]=u):u=t[10],u}var Je=`[a-z0-9_@~./\\\\+-]*[a-z0-9_@~-]\\.[a-z][a-z0-9-]{0,11}`,Ye=RegExp(`^(?:${Je})$`,`i`),Xe=/[:#]L?\d+(?:-\d+)?$/,Ze=/[.,;:!?)\]}'"]+$/;function Qe(e){let t=new Set,n=new Map;for(let r of e){let e=r.replace(/\\/g,`/`);if(!e||e.endsWith(`/`))continue;t.add(e);let i=e.slice(e.lastIndexOf(`/`)+1),a=n.get(i);a?a.push(e):n.set(i,[e])}for(let e of n.values())e.sort(nt);return{exact:t,byBasename:n}}function $e(e){let t=e.trim().replace(/\\/g,`/`);return t=t.replace(Ze,``),t=t.replace(Xe,``),t.startsWith(`@`)&&(t=t.slice(1)),t.startsWith(`./`)&&(t=t.slice(2)),t=t.replace(/^\/+/,``),t.length===0||t.length>512||/\s/.test(t)||t.includes(`://`)||!Ye.test(t)?null:t}function et(e,t){let n=$e(e);if(!n)return null;if(t.exact.has(n))return n;let r=n.slice(n.lastIndexOf(`/`)+1),i=t.byBasename.get(r);if(!i||i.length===0)return null;if(!n.includes(`/`))return i[0];let a=`/${n}`;return i.find(e=>e.endsWith(a))??null}function tt(e,t){let n=new RegExp(Je,`gi`),r=[],i=0,a;for(;(a=n.exec(e))!==null;)a.index>i&&r.push({text:e.slice(i,a.index),path:null}),r.push({text:a[0],path:et(a[0],t)}),i=a.index+a[0].length;return i<e.length&&r.push({text:e.slice(i),path:null}),r.length>0?r:[{text:e,path:null}]}function nt(e,t){let n=rt(e)-rt(t);return n===0?e.length-t.length||e.localeCompare(t):n}function rt(e){let t=1;for(let n=0;n<e.length;n+=1)e.charCodeAt(n)===47&&(t+=1);return t}var it=15e3,at=2e4;function ot(e){let t=(0,q.c)(10),n;t[0]===e?n=t[1]:(n=c.threads.files(e??``),t[0]=e,t[1]=n);let r;t[2]===e?r=t[3]:(r=()=>j(e),t[2]=e,t[3]=r);let i=!!e,a;t[4]!==n||t[5]!==r||t[6]!==i?(a={queryKey:n,queryFn:r,enabled:i,staleTime:it,refetchInterval:at},t[4]=n,t[5]=r,t[6]=i,t[7]=a):a=t[7];let o=K(a),s;return t[8]===o.data?s=t[9]:(s=o.data?Qe(o.data):null,t[8]=o.data,t[9]=s),s}var st=/^(\s*)([-*+]|\d+\.)\s+(.*)$/,ct=100,lt=/^!\[([^\]]*)\]\(([^)]+)\)\s*$/,ut=/[.,!?;:]+$/,dt=(0,J.memo)(function({content:e,className:t,enableMermaid:n=!1,threadId:r,compact:i=!1,bodyClassName:a,revealAnimation:o=!1}){let s=re(e,ct),c=ot(r),l=(0,J.useRef)(null),u=(0,J.useMemo)(()=>{if(!s||typeof s!=`string`)return l.current=null,[];let e=It(s,n,l.current);return l.current=e,e.blocks},[s,n]);return u.length===0?null:(0,Q.jsx)(`div`,{className:O(`prose-custom min-w-0 break-words`,t),children:u.map((e,t)=>(0,Q.jsx)(`div`,{className:O(Tt(t,u,i),o&&`animate-in fade-in duration-300 motion-reduce:animate-none`),children:(0,Q.jsx)(zt,{block:e,threadId:r,chatFileIndex:c,compact:i,bodyClassName:a})},t))})});function ft(e){let t=e.match(lt);return t?{alt:t[1],src:t[2]}:null}function pt(e,t,n){let r=e?`mt-0 space-y-0.5`:`mt-0 space-y-1`,i=n?`mt-1`:``;return t?O(r,i,`pl-6`):O(r,i,`pl-6 list-outside overflow-visible list-disc`)}function mt(e){return e.replace(/\t/g,` `).length}function ht(e){return/^\d+\.$/.test(e)?Number.parseInt(e,10):1}function gt(e,t){return mt(e)>t}function _t(e,t){let n=e[t]?.match(st);if(!n)return{block:{type:`paragraph`,text:``},nextIndex:t+1};let[,r,i,a]=n,o={ordered:/^\d+\.$/.test(i),start:ht(i),items:[{text:a,children:[]}]},s=[{indent:mt(r),item:o.items[0]}],c=t+1;for(;c<e.length;){let t=vt(e,c,s,o);if(c=t.nextIndex,t.stop)break}return{block:{type:`list`,list:o},nextIndex:c}}function vt(e,t,n,r){let i=e[t];return st.test(i)?yt(e,t,n,r):i.trim()===``?Ct(e,t):wt(e,t,n)}function yt(e,t,n,r){let[,i,a,o]=e[t].match(st),s=mt(i),c=/^\d+\.$/.test(a),l={text:o,children:[]};if(bt(n,s),n.length===0)return{nextIndex:t,stop:!0};let u=n[n.length-1],d=s===u.indent,f=gt(i,u.indent);return d?xt(n,r,c,s,l,t):f?St(n,u,c,a,s,l,t):{nextIndex:t,stop:!0}}function bt(e,t){for(;e.length>0&&t<e[e.length-1].indent;)e.pop()}function xt(e,t,n,r,i,a){let o=e[e.length-2]?.childList??t;return o.ordered===n?(o.items.push(i),e[e.length-1]={indent:r,item:i},{nextIndex:a+1,stop:!1}):{nextIndex:a,stop:!0}}function St(e,t,n,r,i,a,o){let s=t.childList;return(!s||s.ordered!==n)&&(s={ordered:n,start:ht(r),items:[]},t.item.children.push(s),t.childList=s),s.items.push(a),e.push({indent:i,item:a}),{nextIndex:o+1,stop:!1}}function Ct(e,t){let n=e[t+1];return!n||!st.test(n)?{nextIndex:t,stop:!0}:{nextIndex:t+1,stop:!1}}function wt(e,t,n){let r=mt(e[t].match(/^(\s*)/)?.[1]??``),i=n[n.length-1];return r>i.indent?(i.item.text=`${i.item.text}\n${e[t].trim()}`,{nextIndex:t+1,stop:!1}):{nextIndex:t,stop:!0}}function Tt(e,t,n=!1){if(e===0)return``;let r=t[e-1],i=t[e];return r.type===`list`||i.type===`list`?``:n?`mt-2`:`mt-3`}function Et(e,t,n){let r=e[t].trimStart().slice(3).trim(),i=[],a=t+1;for(;a<e.length&&!e[a].trimStart().startsWith("```");)i.push(e[a]),a++;let o=i.join(`
|
|
5
5
|
`);return n&&(r===`mermaid`||r===``&&We(o))?{block:{type:`mermaid`,code:o},nextIndex:a+1}:{block:{type:`code`,language:r,code:o},nextIndex:a+1}}function Dt(e){let t=e.match(/^(#{1,6})(\s.*)?$/);return t?{type:`heading`,level:t[1].length,text:t[2]?t[2].trim():``}:null}function Ot(e){return/^(---|\*\*\*|___)/.test(e.trim())}function kt(e,t){let n=e[t];if(!n.includes(`|`)||t+1>=e.length||!e[t+1].match(/^\|?\s*[-:]+/))return null;let r=n.split(`|`).map(e=>e.trim()).filter(Boolean),i=t+2,a=[];for(;i<e.length&&e[i].includes(`|`);)a.push(e[i].split(`|`).map(e=>e.trim()).filter(Boolean)),i++;return{block:{type:`table`,headers:r,rows:a},nextIndex:i}}function At(e,t){let n=[],r=t;for(;r<e.length&&e[r].startsWith(`> `);)n.push(e[r].slice(2)),r++;return{block:{type:`blockquote`,text:n.join(`
|
|
6
6
|
`)},nextIndex:r}}function jt(e){let t=ft(e);return t?{type:`image`,...t}:null}function Mt(e){let t=Se(e);return t?{type:`media`,kind:t.kind,src:t.src}:null}function Nt(e,t,n){let r=t,i=[];for(;r<e.length&&e[r].trim()!==``&&!e[r].startsWith(`#`)&&!e[r].startsWith("```")&&!e[r].startsWith(`> `)&&!st.test(e[r]);)i.push(e[r]),r++;let a=i.join(`
|
|
7
7
|
`);if(n&&We(a)){let e=Ge(a);if(e)return{block:{type:`mermaid`,code:e},nextIndex:r}}return{block:{type:`paragraph`,text:a},nextIndex:r}}function Pt(e){let t=[],n=0;for(let r=0;r<e.length;r++)t.push(n),n+=e[r].length+ +(r<e.length-1);return t}function Ft(e,t=!1){let n=e.split(`
|
|
8
|
-
`),r=Pt(n),i=[],a=[],o=0;for(;o<n.length;){let e=n[o],s=r[o]??0;if(e.trimStart().startsWith("```")){let{block:e,nextIndex:r}=Et(n,o,t);i.push(e),a.push(s),o=r;continue}let c=Dt(e);if(c){i.push(c),a.push(s),o++;continue}if(Ot(e)){i.push({type:`hr`}),a.push(s),o++;continue}let l=kt(n,o);if(l){i.push(l.block),a.push(s),o=l.nextIndex;continue}if(e.startsWith(`> `)){let{block:e,nextIndex:t}=At(n,o);i.push(e),a.push(s),o=t;continue}if(st.test(e)){let{block:e,nextIndex:t}=_t(n,o);i.push(e),a.push(s),o=t;continue}if(e.trim()===``){o++;continue}let u=jt(e);if(u){i.push(u),a.push(s),o++;continue}let d=Mt(e);if(d){i.push(d),a.push(s),o++;continue}let{block:f,nextIndex:p}=Nt(n,o,t);i.push(f),a.push(s),o=p}return{blocks:i,blockStarts:a}}function It(e,t,n){if(n&&n.enableMermaid===t&&n.md===e&&n.blocks.length>0)return n;if(n&&n.enableMermaid===t&&n.blocks.length>0&&e.startsWith(n.md)){let r=n.blockStarts[n.blockStarts.length-1]??0,i=n.blocks.slice(0,-1),a=n.blockStarts.slice(0,-1),o=Ft(e.slice(r),t);return{md:e,enableMermaid:t,blocks:[...i,...o.blocks],blockStarts:[...a,...o.blockStarts.map(e=>e+r)]}}let r=Ft(e,t);return{md:e,enableMermaid:t,blocks:r.blocks,blockStarts:r.blockStarts}}function Lt(e,t){return`${t}-${e.text}`}function Rt(e){let t=(0,q.c)(23),{list:n,compact:r,threadId:i,chatFileIndex:a,inlineCodeClass:o,bodyClassName:s,nested:c}=e,l=a===void 0?null:a,d=c===void 0?!1:c,f=s??(r?u.caption:u.body),p=n.ordered?`ol`:`ul`,m;t[0]!==f||t[1]!==r||t[2]!==n.ordered||t[3]!==d?(m=O(f,pt(r,n.ordered,d)),t[0]=f,t[1]=r,t[2]=n.ordered,t[3]=d,t[4]=m):m=t[4];let h=n.ordered?n.start:void 0,g;if(t[5]!==s||t[6]!==l||t[7]!==r||t[8]!==o||t[9]!==n.items||t[10]!==i){let e;t[12]!==s||t[13]!==l||t[14]!==r||t[15]!==o||t[16]!==i?(e=(e,t)=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(Bt,{text:e.text,threadId:i,chatFileIndex:l,inlineCodeClass:o}),e.children.map((n,a)=>(0,Q.jsx)(Rt,{list:n,compact:r,threadId:i,chatFileIndex:l,inlineCodeClass:o,bodyClassName:s,nested:!0},`${Lt(e,t)}-child-${a}`))]})},Lt(e,t)),t[12]=s,t[13]=l,t[14]=r,t[15]=o,t[16]=i,t[17]=e):e=t[17],g=n.items.map(e),t[5]=s,t[6]=l,t[7]=r,t[8]=o,t[9]=n.items,t[10]=i,t[11]=g}else g=t[11];let _;return t[18]!==p||t[19]!==m||t[20]!==h||t[21]!==g?(_=(0,Q.jsx)(p,{className:m,start:h,children:g}),t[18]=p,t[19]=m,t[20]=h,t[21]=g,t[22]=_):_=t[22],_}var zt=(0,J.memo)(function(e){let t=(0,q.c)(96),{block:n,threadId:r,chatFileIndex:i,compact:a,bodyClassName:o}=e,s=i===void 0?null:i,c=a===void 0?!1:a,l=o??(c?u.caption:u.body),d;t[0]!==o||t[1]!==c?(d=o?O(o,`font-mono`):c?O(u.compact,`font-mono`):u.mono,t[0]=o,t[1]=c,t[2]=d):d=t[2];let f=d;switch(n.type){case`heading`:{let e=`h${n.level}`,i,a;if(t[3]!==e||t[4]!==n.level||t[5]!==c){let r=c?{1:O(u.caption,`font-semibold`),2:O(u.caption,`font-semibold`),3:O(u.body,`font-semibold`),4:O(u.body,`font-semibold`),5:O(u.compact,`font-semibold`),6:O(u.compact,`font-semibold`)}:{1:u.sectionTitle,2:u.subSectionTitle,3:u.subSectionTitle,4:u.subSectionTitle,5:u.sectionSubtitle,6:u.sectionSubtitle};i=e,a=O(r[n.level]),t[3]=e,t[4]=n.level,t[5]=c,t[6]=i,t[7]=a}else i=t[6],a=t[7];let o;t[8]!==n.text||t[9]!==s||t[10]!==f||t[11]!==r?(o=(0,Q.jsx)(Bt,{text:n.text,threadId:r,chatFileIndex:s,inlineCodeClass:f}),t[8]=n.text,t[9]=s,t[10]=f,t[11]=r,t[12]=o):o=t[12];let l;return t[13]!==i||t[14]!==a||t[15]!==o?(l=(0,Q.jsx)(i,{className:a,children:o}),t[13]=i,t[14]=a,t[15]=o,t[16]=l):l=t[16],l}case`code`:{let e;return t[17]!==n.code||t[18]!==n.language||t[19]!==c?(e=(0,Q.jsx)(Ut,{language:n.language,code:n.code,compact:c}),t[17]=n.code,t[18]=n.language,t[19]=c,t[20]=e):e=t[20],e}case`blockquote`:{let e;t[21]===l?e=t[22]:(e=O(l,`border-l-2 border-border pl-4 text-muted-foreground italic`),t[21]=l,t[22]=e);let i;t[23]!==n.text||t[24]!==s||t[25]!==f||t[26]!==r?(i=(0,Q.jsx)(Bt,{text:n.text,threadId:r,chatFileIndex:s,inlineCodeClass:f}),t[23]=n.text,t[24]=s,t[25]=f,t[26]=r,t[27]=i):i=t[27];let a;return t[28]!==e||t[29]!==i?(a=(0,Q.jsx)(`blockquote`,{className:e,children:i}),t[28]=e,t[29]=i,t[30]=a):a=t[30],a}case`list`:{let e;return t[31]!==n.list||t[32]!==o||t[33]!==s||t[34]!==c||t[35]!==f||t[36]!==r?(e=(0,Q.jsx)(Rt,{list:n.list,compact:c,threadId:r,chatFileIndex:s,inlineCodeClass:f,bodyClassName:o}),t[31]=n.list,t[32]=o,t[33]=s,t[34]=c,t[35]=f,t[36]=r,t[37]=e):e=t[37],e}case`paragraph`:{let e;t[38]===l?e=t[39]:(e=O(l,`mt-0 whitespace-pre-wrap break-words`),t[38]=l,t[39]=e);let i;t[40]!==n.text||t[41]!==s||t[42]!==f||t[43]!==r?(i=(0,Q.jsx)(Bt,{text:n.text,threadId:r,chatFileIndex:s,inlineCodeClass:f}),t[40]=n.text,t[41]=s,t[42]=f,t[43]=r,t[44]=i):i=t[44];let a;return t[45]!==e||t[46]!==i?(a=(0,Q.jsx)(`p`,{className:e,children:i}),t[45]=e,t[46]=i,t[47]=a):a=t[47],a}case`hr`:{let e;return t[48]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`hr`,{className:`border-border`}),t[48]=e):e=t[48],e}case`table`:{let e;t[49]===l?e=t[50]:(e=O(l,`w-full`),t[49]=l,t[50]=e);let i;if(t[51]!==n.headers||t[52]!==s||t[53]!==f||t[54]!==r){let e;t[56]!==s||t[57]!==f||t[58]!==r?(e=(e,t)=>(0,Q.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:(0,Q.jsx)(Bt,{text:e,threadId:r,chatFileIndex:s,inlineCodeClass:f})},t),t[56]=s,t[57]=f,t[58]=r,t[59]=e):e=t[59],i=n.headers.map(e),t[51]=n.headers,t[52]=s,t[53]=f,t[54]=r,t[55]=i}else i=t[55];let a;t[60]===i?a=t[61]:(a=(0,Q.jsx)(`thead`,{children:(0,Q.jsx)(`tr`,{className:`border-b border-table-border`,children:i})}),t[60]=i,t[61]=a);let o;if(t[62]!==n.rows||t[63]!==s||t[64]!==f||t[65]!==r){let e;t[67]!==s||t[68]!==f||t[69]!==r?(e=(e,t)=>(0,Q.jsx)(`tr`,{children:e.map((e,t)=>(0,Q.jsx)(`td`,{className:`px-3 py-2`,children:(0,Q.jsx)(Bt,{text:e,threadId:r,chatFileIndex:s,inlineCodeClass:f})},t))},t),t[67]=s,t[68]=f,t[69]=r,t[70]=e):e=t[70],o=n.rows.map(e),t[62]=n.rows,t[63]=s,t[64]=f,t[65]=r,t[66]=o}else o=t[66];let c;t[71]===o?c=t[72]:(c=(0,Q.jsx)(`tbody`,{children:o}),t[71]=o,t[72]=c);let u;return t[73]!==e||t[74]!==a||t[75]!==c?(u=(0,Q.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-table-border max-w-full`,children:(0,Q.jsxs)(`table`,{className:e,children:[a,c]})}),t[73]=e,t[74]=a,t[75]=c,t[76]=u):u=t[76],u}case`mermaid`:{let e;return t[77]===n.code?e=t[78]:(e=(0,Q.jsx)(ge,{content:n.code}),t[77]=n.code,t[78]=e),e}case`image`:{let e;t[79]!==n.src||t[80]!==r?(e=De(n.src,r),t[79]=n.src,t[80]=r,t[81]=e):e=t[81];let i=n.alt||`Image`,a;return t[82]!==e||t[83]!==i?(a=(0,Q.jsx)(Ae,{imageUrl:e,alt:i}),t[82]=e,t[83]=i,t[84]=a):a=t[84],a}case`media`:{let e;t[85]!==n.src||t[86]!==r?(e=Ee(n.src,r),t[85]=n.src,t[86]=r,t[87]=e):e=t[87];let i=e;if(n.kind===`image`){let e;return t[88]===i?e=t[89]:(e=(0,Q.jsx)(Ae,{imageUrl:i,alt:`Image`}),t[88]=i,t[89]=e),e}let a;t[90]===n.src?a=t[91]:(a=n.src.split(/[/\\]/).pop(),t[90]=n.src,t[91]=a);let o=a,s;return t[92]!==n.kind||t[93]!==o||t[94]!==i?(s=(0,Q.jsx)(ze,{src:i,kind:n.kind,label:o}),t[92]=n.kind,t[93]=o,t[94]=i,t[95]=s):s=t[95],s}default:return null}}),Bt=(0,J.memo)(function(e){let t=(0,q.c)(13),{text:n,threadId:r,chatFileIndex:i,inlineCodeClass:a}=e,o=i===void 0?null:i,s=a===void 0?u.mono:a,c;t[0]===n?c=t[1]:(c=Ht(n),t[0]=n,t[1]=c);let l=c,d;if(t[2]!==o||t[3]!==s||t[4]!==l||t[5]!==r){let e;t[7]!==o||t[8]!==s||t[9]!==r?(e=(e,t)=>{switch(e.type){case`bold`:return(0,Q.jsx)(`strong`,{className:`font-semibold`,children:e.text},t);case`italic`:return(0,Q.jsx)(`em`,{children:e.text},t);case`strikethrough`:return(0,Q.jsx)(`del`,{className:`text-muted-foreground`,children:e.text},t);case`code`:{let n=o?et(e.text,o):null;return n?(0,Q.jsx)(qe,{path:n,className:O(s,`rounded bg-muted/20 py-0.5`),children:e.text},t):(0,Q.jsx)(`code`,{className:O(s,`rounded bg-muted/20 py-0.5`),children:e.text},t)}case`link`:return(0,Q.jsx)(Ke,{href:e.href,children:e.text},t);case`image`:return(0,Q.jsx)(Ae,{imageUrl:De(e.src,r),alt:e.alt||`Image`},t);case`text`:return(0,Q.jsx)(J.Fragment,{children:Vt(e.text,o,s)},t);default:return null}},t[7]=o,t[8]=s,t[9]=r,t[10]=e):e=t[10],d=l.map(e),t[2]=o,t[3]=s,t[4]=l,t[5]=r,t[6]=d}else d=t[6];let f;return t[11]===d?f=t[12]:(f=(0,Q.jsx)(Q.Fragment,{children:d}),t[11]=d,t[12]=f),f});function Vt(e,t,n){return t?tt(e,t).map((e,t)=>e.path?(0,Q.jsx)(qe,{path:e.path,className:O(n,`rounded bg-muted/20 py-0.5`),children:e.text},t):(0,Q.jsx)(`span`,{children:e.text},t)):(0,Q.jsx)(`span`,{children:e})}function Ht(e){let t=[],n=/(`[^`]+`)|(!\[[^\]]*\]\([^)]+\))|(\*\*[^*]+\*\*)|(\*[^*]+\*)|(__[^_]+__)|(_[^_]+_)|(~~[^~]+~~)|(\[[^\]]+\]\([^)]+\))|(https?:\/\/[^\s<>"`]+)/gi,r=0,i;for(;(i=n.exec(e))!==null;){i.index>r&&t.push({type:`text`,text:e.slice(r,i.index)});let n=i[0];if(n.startsWith("`"))t.push({type:`code`,text:n.slice(1,-1)});else if(n.startsWith(`![`)){let e=n.match(/!\[([^\]]*)\]\(([^)]+)\)/);e&&t.push({type:`image`,alt:e[1],src:e[2]})}else if(n.startsWith(`**`)||n.startsWith(`__`))t.push({type:`bold`,text:n.slice(2,-2)});else if(n.startsWith(`~~`))t.push({type:`strikethrough`,text:n.slice(2,-2)});else if(n.startsWith(`*`)||n.startsWith(`_`))t.push({type:`italic`,text:n.slice(1,-1)});else if(n.startsWith(`[`)){let e=n.match(/\[([^\]]+)\]\(([^)]+)\)/);e&&t.push({type:`link`,text:e[1],href:e[2]})}else if(/^https?:\/\//i.test(n)){let e=n.replace(ut,``),r=n.slice(e.length);e&&t.push({type:`link`,text:e,href:e}),r&&t.push({type:`text`,text:r})}r=i.index+n.length}return r<e.length&&t.push({type:`text`,text:e.slice(r)}),t.length>0?t:[{type:`text`,text:e}]}function Ut(e){let t=(0,q.c)(27),{language:n,code:r,compact:i}=e,a=i===void 0?!1:i,[o,s]=(0,J.useState)(!1),c;t[0]===r?c=t[1]:(c=async function(){await navigator.clipboard.writeText(r),s(!0),setTimeout(()=>s(!1),2e3)},t[0]=r,t[1]=c);let l=c,d;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(d=O(u.compact,`text-muted-foreground font-mono`),t[2]=d):d=t[2];let f=n||`text`,p;t[3]===f?p=t[4]:(p=(0,Q.jsx)(`span`,{className:d,children:f}),t[3]=f,t[4]=p);let m;t[5]===o?m=t[6]:(m=o?(0,Q.jsx)(_,{}):(0,Q.jsx)(D,{}),t[5]=o,t[6]=m);let h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Copy code`}),t[7]=h):h=t[7];let g;t[8]!==l||t[9]!==m?(g=(0,Q.jsxs)(k,{variant:`action`,size:`icon-xs`,onClick:l,children:[m,h]}),t[8]=l,t[9]=m,t[10]=g):g=t[10];let v;t[11]!==p||t[12]!==g?(v=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border bg-muted/80 px-4 py-2`,children:[p,g]}),t[11]=p,t[12]=g,t[13]=v):v=t[13];let y=a?`p-2`:`p-4`,b;t[14]===y?b=t[15]:(b=O(`overflow-x-auto max-w-full`,y),t[14]=y,t[15]=b);let x;t[16]===a?x=t[17]:(x=O(a?O(u.compact,`font-mono`):u.mono,`text-foreground leading-relaxed`),t[16]=a,t[17]=x);let S;t[18]!==r||t[19]!==x?(S=(0,Q.jsx)(`code`,{className:x,children:r}),t[18]=r,t[19]=x,t[20]=S):S=t[20];let C;t[21]!==b||t[22]!==S?(C=(0,Q.jsx)(`pre`,{className:b,children:S}),t[21]=b,t[22]=S,t[23]=C):C=t[23];let w;return t[24]!==C||t[25]!==v?(w=(0,Q.jsxs)(`div`,{className:`group relative overflow-hidden rounded-lg border border-border bg-muted`,children:[v,C]}),t[24]=C,t[25]=v,t[26]=w):w=t[26],w}export{Oe as a,Se as c,ke as i,K as l,ze as n,De as o,Ae as r,Ee as s,dt as t};
|
|
8
|
+
`),r=Pt(n),i=[],a=[],o=0;for(;o<n.length;){let e=n[o],s=r[o]??0;if(e.trimStart().startsWith("```")){let{block:e,nextIndex:r}=Et(n,o,t);i.push(e),a.push(s),o=r;continue}let c=Dt(e);if(c){i.push(c),a.push(s),o++;continue}if(Ot(e)){i.push({type:`hr`}),a.push(s),o++;continue}let l=kt(n,o);if(l){i.push(l.block),a.push(s),o=l.nextIndex;continue}if(e.startsWith(`> `)){let{block:e,nextIndex:t}=At(n,o);i.push(e),a.push(s),o=t;continue}if(st.test(e)){let{block:e,nextIndex:t}=_t(n,o);i.push(e),a.push(s),o=t;continue}if(e.trim()===``){o++;continue}let u=jt(e);if(u){i.push(u),a.push(s),o++;continue}let d=Mt(e);if(d){i.push(d),a.push(s),o++;continue}let{block:f,nextIndex:p}=Nt(n,o,t);i.push(f),a.push(s),o=p}return{blocks:i,blockStarts:a}}function It(e,t,n){if(n&&n.enableMermaid===t&&n.md===e&&n.blocks.length>0)return n;if(n&&n.enableMermaid===t&&n.blocks.length>0&&e.startsWith(n.md)){let r=n.blockStarts[n.blockStarts.length-1]??0,i=n.blocks.slice(0,-1),a=n.blockStarts.slice(0,-1),o=Ft(e.slice(r),t);return{md:e,enableMermaid:t,blocks:[...i,...o.blocks],blockStarts:[...a,...o.blockStarts.map(e=>e+r)]}}let r=Ft(e,t);return{md:e,enableMermaid:t,blocks:r.blocks,blockStarts:r.blockStarts}}function Lt(e,t){return`${t}-${e.text}`}function Rt(e){let t=(0,q.c)(23),{list:n,compact:r,threadId:i,chatFileIndex:a,inlineCodeClass:o,bodyClassName:s,nested:c}=e,l=a===void 0?null:a,u=c===void 0?!1:c,d=s??(r?p.caption:p.body),f=n.ordered?`ol`:`ul`,m;t[0]!==d||t[1]!==r||t[2]!==n.ordered||t[3]!==u?(m=O(d,pt(r,n.ordered,u)),t[0]=d,t[1]=r,t[2]=n.ordered,t[3]=u,t[4]=m):m=t[4];let h=n.ordered?n.start:void 0,g;if(t[5]!==s||t[6]!==l||t[7]!==r||t[8]!==o||t[9]!==n.items||t[10]!==i){let e;t[12]!==s||t[13]!==l||t[14]!==r||t[15]!==o||t[16]!==i?(e=(e,t)=>(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(`div`,{className:`min-w-0`,children:[(0,Q.jsx)(Bt,{text:e.text,threadId:i,chatFileIndex:l,inlineCodeClass:o}),e.children.map((n,a)=>(0,Q.jsx)(Rt,{list:n,compact:r,threadId:i,chatFileIndex:l,inlineCodeClass:o,bodyClassName:s,nested:!0},`${Lt(e,t)}-child-${a}`))]})},Lt(e,t)),t[12]=s,t[13]=l,t[14]=r,t[15]=o,t[16]=i,t[17]=e):e=t[17],g=n.items.map(e),t[5]=s,t[6]=l,t[7]=r,t[8]=o,t[9]=n.items,t[10]=i,t[11]=g}else g=t[11];let _;return t[18]!==f||t[19]!==m||t[20]!==h||t[21]!==g?(_=(0,Q.jsx)(f,{className:m,start:h,children:g}),t[18]=f,t[19]=m,t[20]=h,t[21]=g,t[22]=_):_=t[22],_}var zt=(0,J.memo)(function(e){let t=(0,q.c)(96),{block:n,threadId:r,chatFileIndex:i,compact:a,bodyClassName:o}=e,s=i===void 0?null:i,c=a===void 0?!1:a,l=o??(c?p.caption:p.body),u;t[0]!==o||t[1]!==c?(u=o?O(o,`font-mono`):c?O(p.compact,`font-mono`):p.mono,t[0]=o,t[1]=c,t[2]=u):u=t[2];let d=u;switch(n.type){case`heading`:{let e=`h${n.level}`,i,a;if(t[3]!==e||t[4]!==n.level||t[5]!==c){let r=c?{1:O(p.caption,`font-semibold`),2:O(p.caption,`font-semibold`),3:O(p.body,`font-semibold`),4:O(p.body,`font-semibold`),5:O(p.compact,`font-semibold`),6:O(p.compact,`font-semibold`)}:{1:p.sectionTitle,2:p.subSectionTitle,3:p.subSectionTitle,4:p.subSectionTitle,5:p.sectionSubtitle,6:p.sectionSubtitle};i=e,a=O(r[n.level]),t[3]=e,t[4]=n.level,t[5]=c,t[6]=i,t[7]=a}else i=t[6],a=t[7];let o;t[8]!==n.text||t[9]!==s||t[10]!==d||t[11]!==r?(o=(0,Q.jsx)(Bt,{text:n.text,threadId:r,chatFileIndex:s,inlineCodeClass:d}),t[8]=n.text,t[9]=s,t[10]=d,t[11]=r,t[12]=o):o=t[12];let l;return t[13]!==i||t[14]!==a||t[15]!==o?(l=(0,Q.jsx)(i,{className:a,children:o}),t[13]=i,t[14]=a,t[15]=o,t[16]=l):l=t[16],l}case`code`:{let e;return t[17]!==n.code||t[18]!==n.language||t[19]!==c?(e=(0,Q.jsx)(Ut,{language:n.language,code:n.code,compact:c}),t[17]=n.code,t[18]=n.language,t[19]=c,t[20]=e):e=t[20],e}case`blockquote`:{let e;t[21]===l?e=t[22]:(e=O(l,`border-l-2 border-border pl-4 text-muted-foreground italic`),t[21]=l,t[22]=e);let i;t[23]!==n.text||t[24]!==s||t[25]!==d||t[26]!==r?(i=(0,Q.jsx)(Bt,{text:n.text,threadId:r,chatFileIndex:s,inlineCodeClass:d}),t[23]=n.text,t[24]=s,t[25]=d,t[26]=r,t[27]=i):i=t[27];let a;return t[28]!==e||t[29]!==i?(a=(0,Q.jsx)(`blockquote`,{className:e,children:i}),t[28]=e,t[29]=i,t[30]=a):a=t[30],a}case`list`:{let e;return t[31]!==n.list||t[32]!==o||t[33]!==s||t[34]!==c||t[35]!==d||t[36]!==r?(e=(0,Q.jsx)(Rt,{list:n.list,compact:c,threadId:r,chatFileIndex:s,inlineCodeClass:d,bodyClassName:o}),t[31]=n.list,t[32]=o,t[33]=s,t[34]=c,t[35]=d,t[36]=r,t[37]=e):e=t[37],e}case`paragraph`:{let e;t[38]===l?e=t[39]:(e=O(l,`mt-0 whitespace-pre-wrap break-words`),t[38]=l,t[39]=e);let i;t[40]!==n.text||t[41]!==s||t[42]!==d||t[43]!==r?(i=(0,Q.jsx)(Bt,{text:n.text,threadId:r,chatFileIndex:s,inlineCodeClass:d}),t[40]=n.text,t[41]=s,t[42]=d,t[43]=r,t[44]=i):i=t[44];let a;return t[45]!==e||t[46]!==i?(a=(0,Q.jsx)(`p`,{className:e,children:i}),t[45]=e,t[46]=i,t[47]=a):a=t[47],a}case`hr`:{let e;return t[48]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`hr`,{className:`border-border`}),t[48]=e):e=t[48],e}case`table`:{let e;t[49]===l?e=t[50]:(e=O(l,`w-full`),t[49]=l,t[50]=e);let i;if(t[51]!==n.headers||t[52]!==s||t[53]!==d||t[54]!==r){let e;t[56]!==s||t[57]!==d||t[58]!==r?(e=(e,t)=>(0,Q.jsx)(`th`,{className:`px-3 py-2 text-left font-medium`,children:(0,Q.jsx)(Bt,{text:e,threadId:r,chatFileIndex:s,inlineCodeClass:d})},t),t[56]=s,t[57]=d,t[58]=r,t[59]=e):e=t[59],i=n.headers.map(e),t[51]=n.headers,t[52]=s,t[53]=d,t[54]=r,t[55]=i}else i=t[55];let a;t[60]===i?a=t[61]:(a=(0,Q.jsx)(`thead`,{children:(0,Q.jsx)(`tr`,{className:`border-b border-table-border`,children:i})}),t[60]=i,t[61]=a);let o;if(t[62]!==n.rows||t[63]!==s||t[64]!==d||t[65]!==r){let e;t[67]!==s||t[68]!==d||t[69]!==r?(e=(e,t)=>(0,Q.jsx)(`tr`,{children:e.map((e,t)=>(0,Q.jsx)(`td`,{className:`px-3 py-2`,children:(0,Q.jsx)(Bt,{text:e,threadId:r,chatFileIndex:s,inlineCodeClass:d})},t))},t),t[67]=s,t[68]=d,t[69]=r,t[70]=e):e=t[70],o=n.rows.map(e),t[62]=n.rows,t[63]=s,t[64]=d,t[65]=r,t[66]=o}else o=t[66];let c;t[71]===o?c=t[72]:(c=(0,Q.jsx)(`tbody`,{children:o}),t[71]=o,t[72]=c);let u;return t[73]!==e||t[74]!==a||t[75]!==c?(u=(0,Q.jsx)(`div`,{className:`overflow-x-auto rounded-md border border-table-border max-w-full`,children:(0,Q.jsxs)(`table`,{className:e,children:[a,c]})}),t[73]=e,t[74]=a,t[75]=c,t[76]=u):u=t[76],u}case`mermaid`:{let e;return t[77]===n.code?e=t[78]:(e=(0,Q.jsx)(ge,{content:n.code}),t[77]=n.code,t[78]=e),e}case`image`:{let e;t[79]!==n.src||t[80]!==r?(e=De(n.src,r),t[79]=n.src,t[80]=r,t[81]=e):e=t[81];let i=n.alt||`Image`,a;return t[82]!==e||t[83]!==i?(a=(0,Q.jsx)(Ae,{imageUrl:e,alt:i}),t[82]=e,t[83]=i,t[84]=a):a=t[84],a}case`media`:{let e;t[85]!==n.src||t[86]!==r?(e=Ee(n.src,r),t[85]=n.src,t[86]=r,t[87]=e):e=t[87];let i=e;if(n.kind===`image`){let e;return t[88]===i?e=t[89]:(e=(0,Q.jsx)(Ae,{imageUrl:i,alt:`Image`}),t[88]=i,t[89]=e),e}let a;t[90]===n.src?a=t[91]:(a=n.src.split(/[/\\]/).pop(),t[90]=n.src,t[91]=a);let o=a,s;return t[92]!==n.kind||t[93]!==o||t[94]!==i?(s=(0,Q.jsx)(ze,{src:i,kind:n.kind,label:o}),t[92]=n.kind,t[93]=o,t[94]=i,t[95]=s):s=t[95],s}default:return null}}),Bt=(0,J.memo)(function(e){let t=(0,q.c)(13),{text:n,threadId:r,chatFileIndex:i,inlineCodeClass:a}=e,o=i===void 0?null:i,s=a===void 0?p.mono:a,c;t[0]===n?c=t[1]:(c=Ht(n),t[0]=n,t[1]=c);let l=c,u;if(t[2]!==o||t[3]!==s||t[4]!==l||t[5]!==r){let e;t[7]!==o||t[8]!==s||t[9]!==r?(e=(e,t)=>{switch(e.type){case`bold`:return(0,Q.jsx)(`strong`,{className:`font-semibold`,children:e.text},t);case`italic`:return(0,Q.jsx)(`em`,{children:e.text},t);case`strikethrough`:return(0,Q.jsx)(`del`,{className:`text-muted-foreground`,children:e.text},t);case`code`:{let n=o?et(e.text,o):null;return n?(0,Q.jsx)(qe,{path:n,className:O(s,`rounded bg-muted/20 py-0.5`),children:e.text},t):(0,Q.jsx)(`code`,{className:O(s,`rounded bg-muted/20 py-0.5`),children:e.text},t)}case`link`:return(0,Q.jsx)(Ke,{href:e.href,children:e.text},t);case`image`:return(0,Q.jsx)(Ae,{imageUrl:De(e.src,r),alt:e.alt||`Image`},t);case`text`:return(0,Q.jsx)(J.Fragment,{children:Vt(e.text,o,s)},t);default:return null}},t[7]=o,t[8]=s,t[9]=r,t[10]=e):e=t[10],u=l.map(e),t[2]=o,t[3]=s,t[4]=l,t[5]=r,t[6]=u}else u=t[6];let d;return t[11]===u?d=t[12]:(d=(0,Q.jsx)(Q.Fragment,{children:u}),t[11]=u,t[12]=d),d});function Vt(e,t,n){return t?tt(e,t).map((e,t)=>e.path?(0,Q.jsx)(qe,{path:e.path,className:O(n,`rounded bg-muted/20 py-0.5`),children:e.text},t):(0,Q.jsx)(`span`,{children:e.text},t)):(0,Q.jsx)(`span`,{children:e})}function Ht(e){let t=[],n=/(`[^`]+`)|(!\[[^\]]*\]\([^)]+\))|(\*\*[^*]+\*\*)|(\*[^*]+\*)|(__[^_]+__)|(_[^_]+_)|(~~[^~]+~~)|(\[[^\]]+\]\([^)]+\))|(https?:\/\/[^\s<>"`]+)/gi,r=0,i;for(;(i=n.exec(e))!==null;){i.index>r&&t.push({type:`text`,text:e.slice(r,i.index)});let n=i[0];if(n.startsWith("`"))t.push({type:`code`,text:n.slice(1,-1)});else if(n.startsWith(`![`)){let e=n.match(/!\[([^\]]*)\]\(([^)]+)\)/);e&&t.push({type:`image`,alt:e[1],src:e[2]})}else if(n.startsWith(`**`)||n.startsWith(`__`))t.push({type:`bold`,text:n.slice(2,-2)});else if(n.startsWith(`~~`))t.push({type:`strikethrough`,text:n.slice(2,-2)});else if(n.startsWith(`*`)||n.startsWith(`_`))t.push({type:`italic`,text:n.slice(1,-1)});else if(n.startsWith(`[`)){let e=n.match(/\[([^\]]+)\]\(([^)]+)\)/);e&&t.push({type:`link`,text:e[1],href:e[2]})}else if(/^https?:\/\//i.test(n)){let e=n.replace(ut,``),r=n.slice(e.length);e&&t.push({type:`link`,text:e,href:e}),r&&t.push({type:`text`,text:r})}r=i.index+n.length}return r<e.length&&t.push({type:`text`,text:e.slice(r)}),t.length>0?t:[{type:`text`,text:e}]}function Ut(e){let t=(0,q.c)(27),{language:n,code:r,compact:i}=e,a=i===void 0?!1:i,[o,s]=(0,J.useState)(!1),c;t[0]===r?c=t[1]:(c=async function(){await navigator.clipboard.writeText(r),s(!0),setTimeout(()=>s(!1),2e3)},t[0]=r,t[1]=c);let l=c,u;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(u=O(p.compact,`text-muted-foreground font-mono`),t[2]=u):u=t[2];let d=n||`text`,f;t[3]===d?f=t[4]:(f=(0,Q.jsx)(`span`,{className:u,children:d}),t[3]=d,t[4]=f);let m;t[5]===o?m=t[6]:(m=o?(0,Q.jsx)(_,{}):(0,Q.jsx)(D,{}),t[5]=o,t[6]=m);let h;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,Q.jsx)(`span`,{className:`sr-only`,children:`Copy code`}),t[7]=h):h=t[7];let g;t[8]!==l||t[9]!==m?(g=(0,Q.jsxs)(k,{variant:`action`,size:`icon-xs`,onClick:l,children:[m,h]}),t[8]=l,t[9]=m,t[10]=g):g=t[10];let v;t[11]!==f||t[12]!==g?(v=(0,Q.jsxs)(`div`,{className:`flex items-center justify-between border-b border-border bg-muted/80 px-4 py-2`,children:[f,g]}),t[11]=f,t[12]=g,t[13]=v):v=t[13];let y=a?`p-2`:`p-4`,b;t[14]===y?b=t[15]:(b=O(`overflow-x-auto max-w-full`,y),t[14]=y,t[15]=b);let x;t[16]===a?x=t[17]:(x=O(a?O(p.compact,`font-mono`):p.mono,`text-foreground leading-relaxed`),t[16]=a,t[17]=x);let S;t[18]!==r||t[19]!==x?(S=(0,Q.jsx)(`code`,{className:x,children:r}),t[18]=r,t[19]=x,t[20]=S):S=t[20];let C;t[21]!==b||t[22]!==S?(C=(0,Q.jsx)(`pre`,{className:b,children:S}),t[21]=b,t[22]=S,t[23]=C):C=t[23];let w;return t[24]!==C||t[25]!==v?(w=(0,Q.jsxs)(`div`,{className:`group relative overflow-hidden rounded-lg border border-border bg-muted`,children:[v,C]}),t[24]=C,t[25]=v,t[26]=w):w=t[26],w}export{Oe as a,Se as c,ke as i,K as l,ze as n,De as o,Ae as r,Ee as s,dt as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./react-vendor-Ee0-5T4I.js";import{
|
|
1
|
+
import{n as e,t}from"./react-vendor-Ee0-5T4I.js";import{ot as n}from"./dist-BWuYHVi8.js";import{An as r,D as i,Dn as a,Et as o,dn as s}from"./dist-DIjomljy.js";import{t as c}from"./utils-CT-Dw22R.js";import{t as l}from"./button-DeNw35VZ.js";import{i as u,n as d,r as f,t as p}from"./tooltip-B6ziVyTv.js";var m=e(),h=t();function g(e){let t=(0,m.c)(6),{onContinue:n,disabled:r,creating:i}=e,s=r||i,c;t[0]===i?c=t[1]:(c=i?(0,h.jsxs)(h.Fragment,{children:[(0,h.jsx)(o,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,h.jsxs)(h.Fragment,{children:[`Continue`,(0,h.jsx)(a,{className:`ml-2 h-4 w-4`})]}),t[0]=i,t[1]=c);let u;return t[2]!==n||t[3]!==s||t[4]!==c?(u=(0,h.jsx)(`div`,{className:`mt-6 border-t pt-4 flex justify-end`,children:(0,h.jsx)(l,{onClick:n,disabled:s,children:c})}),t[2]=n,t[3]=s,t[4]=c,t[5]=u):u=t[5],u}function _(e){return e.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``)}function v(e){return e.replace(/-/g,` `).split(/\s+/).filter(Boolean).map(e=>e.charAt(0).toUpperCase()+e.slice(1)).join(` `)}function y(e){return e.length>0&&e.length<=64}function b(e){let t=(0,m.c)(29),{name:a,description:o,installed:g,onClick:_,onOpen:v,onUninstall:y,showInstalledControls:b,className:x}=e,S=b===void 0?!0:b,C=!g&&`cursor-pointer hover:bg-accent/50`,w;t[0]!==x||t[1]!==C?(w=c(`flex w-full flex-col gap-2 rounded-lg border border-border bg-card p-2.5 text-left transition-colors`,C,x),t[0]=x,t[1]=C,t[2]=w):w=t[2];let T=g?void 0:_,E=g?void 0:`button`,D;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(D=c(n.label,`truncate leading-normal`),t[3]=D):D=t[3];let O;t[4]===a?O=t[5]:(O=(0,h.jsx)(`span`,{className:D,children:a}),t[4]=a,t[5]=O);let k;t[6]!==g||t[7]!==S?(k=g&&S&&(0,h.jsx)(f,{delayDuration:300,children:(0,h.jsxs)(p,{children:[(0,h.jsx)(u,{asChild:!0,children:(0,h.jsx)(`span`,{className:`flex-shrink-0 h-4 w-4 rounded-full bg-green-500/15 flex items-center justify-center`,children:(0,h.jsx)(r,{className:`h-2.5 w-2.5 text-green-600 dark:text-green-400`})})}),(0,h.jsx)(d,{children:`Installed`})]})}),t[6]=g,t[7]=S,t[8]=k):k=t[8];let A;t[9]!==O||t[10]!==k?(A=(0,h.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[O,k]}),t[9]=O,t[10]=k,t[11]=A):A=t[11];let j;t[12]!==g||t[13]!==v||t[14]!==y||t[15]!==S?(j=g&&S&&(0,h.jsxs)(`div`,{className:`flex items-center gap-1 flex-shrink-0`,children:[v&&(0,h.jsx)(f,{delayDuration:300,children:(0,h.jsxs)(p,{children:[(0,h.jsx)(u,{asChild:!0,children:(0,h.jsx)(l,{variant:`ghost`,size:`icon-sm`,onClick:e=>{e.stopPropagation(),v()},children:(0,h.jsx)(s,{className:`h-3.5 w-3.5`})})}),(0,h.jsx)(d,{children:`Open in Explorer`})]})}),y&&(0,h.jsx)(f,{delayDuration:300,children:(0,h.jsxs)(p,{children:[(0,h.jsx)(u,{asChild:!0,children:(0,h.jsx)(l,{variant:`ghost`,size:`icon-sm`,onClick:e=>{e.stopPropagation(),y()},className:`text-destructive hover:text-destructive`,children:(0,h.jsx)(i,{className:`h-3.5 w-3.5`})})}),(0,h.jsx)(d,{children:`Remove`})]})})]}),t[12]=g,t[13]=v,t[14]=y,t[15]=S,t[16]=j):j=t[16];let M;t[17]!==j||t[18]!==A?(M=(0,h.jsxs)(`div`,{className:`flex items-start justify-between gap-2`,children:[A,j]}),t[17]=j,t[18]=A,t[19]=M):M=t[19];let N;t[20]===Symbol.for(`react.memo_cache_sentinel`)?(N=c(n.caption,`line-clamp-3 select-text`),t[20]=N):N=t[20];let P;t[21]===o?P=t[22]:(P=(0,h.jsx)(`p`,{className:N,children:o}),t[21]=o,t[22]=P);let F;return t[23]!==M||t[24]!==P||t[25]!==w||t[26]!==T||t[27]!==E?(F=(0,h.jsxs)(`div`,{className:w,onClick:T,role:E,children:[M,P]}),t[23]=M,t[24]=P,t[25]=w,t[26]=T,t[27]=E,t[28]=F):F=t[28],F}export{g as a,_ as i,v as n,y as r,b as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{n as e,t}from"./react-vendor-Ee0-5T4I.js";import{
|
|
1
|
+
import{n as e,t}from"./react-vendor-Ee0-5T4I.js";import{ot as n}from"./dist-BWuYHVi8.js";import{t as r}from"./button-DeNw35VZ.js";import{a as i,i as a,o,r as s,s as c,t as l}from"./dialog-Do98zzAW.js";import{Pt as u,o as d}from"./index-DjaVbFDB.js";var f=e(),p=t();function m(e){let t=(0,f.c)(30),{open:m,onOpenChange:h,onNewBranch:g,onJustOpen:_,newChatOnNewBranch:v,onNewChatOnNewBranchChange:y,isLoading:b,projectName:x}=e,S=b===void 0?!1:b,C;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,p.jsx)(c,{children:`Pull Request Merged`}),t[0]=C):C=t[0];let w=x?` for ${x}`:``,T;t[1]===w?T=t[2]:(T=(0,p.jsxs)(o,{children:[C,(0,p.jsxs)(a,{children:[`The PR has already been merged`,w,`. Create a new branch and PR?`]})]}),t[1]=w,t[2]=T);let E;t[3]===y?E=t[4]:(E=e=>y(e===!0),t[3]=y,t[4]=E);let D;t[5]!==v||t[6]!==E?(D=(0,p.jsx)(d,{id:`new-chat-on-new-branch`,checked:v,onCheckedChange:E}),t[5]=v,t[6]=E,t[7]=D):D=t[7];let O;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(O=(0,p.jsx)(u,{htmlFor:`new-chat-on-new-branch`,className:n.labelNormal,children:`New Chat`}),t[8]=O):O=t[8];let k;t[9]===D?k=t[10]:(k=(0,p.jsxs)(`div`,{className:`flex items-center gap-2`,children:[D,O]}),t[9]=D,t[10]=k);let A;t[11]!==S||t[12]!==_?(A=(0,p.jsx)(r,{variant:`ghost`,onClick:_,disabled:S,children:`Just Open`}),t[11]=S,t[12]=_,t[13]=A):A=t[13];let j;t[14]!==S||t[15]!==g?(j=(0,p.jsx)(r,{onClick:g,disabled:S,children:`New Branch`}),t[14]=S,t[15]=g,t[16]=j):j=t[16];let M;t[17]!==j||t[18]!==A?(M=(0,p.jsxs)(`div`,{className:`flex w-full flex-col-reverse gap-2 sm:w-auto sm:flex-row`,children:[A,j]}),t[17]=j,t[18]=A,t[19]=M):M=t[19];let N;t[20]!==M||t[21]!==k?(N=(0,p.jsxs)(i,{className:`flex-col gap-4 sm:flex-row sm:items-center sm:justify-between`,children:[k,M]}),t[20]=M,t[21]=k,t[22]=N):N=t[22];let P;t[23]!==N||t[24]!==T?(P=(0,p.jsxs)(s,{children:[T,N]}),t[23]=N,t[24]=T,t[25]=P):P=t[25];let F;return t[26]!==h||t[27]!==m||t[28]!==P?(F=(0,p.jsx)(l,{open:m,onOpenChange:h,children:P}),t[26]=h,t[27]=m,t[28]=P,t[29]=F):F=t[29],F}export{m as MergedPRDialog};
|
package/dist/public/assets/{model-list-controls-ChoemIJa.js → model-list-controls-D86_87E4.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import"./rolldown-runtime-aKtaBQYM.js";import{n as e,o as t,t as n}from"./react-vendor-Ee0-5T4I.js";import{
|
|
1
|
+
import"./rolldown-runtime-aKtaBQYM.js";import{n as e,o as t,t as n}from"./react-vendor-Ee0-5T4I.js";import{ot as r}from"./dist-BWuYHVi8.js";import{Bn as i,P as a,Y as o,gn as s}from"./dist-DIjomljy.js";import{t as c}from"./button-DeNw35VZ.js";import"./api-BMo_Lz8f.js";import{i as l,n as u,r as d,t as f}from"./tooltip-B6ziVyTv.js";import{o as p}from"./index-DjaVbFDB.js";import{n as m}from"./sorting-DqwxPMRN.js";var h=e(),g=n();function _(e){let t=(0,h.c)(9),{codingIndex:n,modelName:i}=e,o=m(n);if(o===0)return null;let s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=[1,2,3,4,5],t[0]=s):s=t[0];let c;t[1]===o?c=t[2]:(c=(0,g.jsx)(l,{asChild:!0,children:(0,g.jsx)(`div`,{className:`flex items-center gap-0.5`,children:s.map(e=>(0,g.jsx)(a,{className:`h-3 w-3 ${e<=o?`fill-yellow-400 text-yellow-400`:`text-gray-300`}`},e))})}),t[1]=o,t[2]=c);let p;t[3]!==n||t[4]!==i?(p=(0,g.jsx)(u,{children:(0,g.jsxs)(`p`,{className:r.body,children:[i,` was indexed `,n,` for coding intelligence`]})}),t[3]=n,t[4]=i,t[5]=p):p=t[5];let _;return t[6]!==c||t[7]!==p?(_=(0,g.jsx)(d,{children:(0,g.jsxs)(f,{children:[c,p]})}),t[6]=c,t[7]=p,t[8]=_):_=t[8],_}t();function v(e){let t=(0,h.c)(10),{id:n,checked:r,disabled:i,onChange:a}=e,o=i===void 0?!1:i,s;t[0]===a?s=t[1]:(s=e=>a(e===!0),t[0]=a,t[1]=s);let c;t[2]!==r||t[3]!==o||t[4]!==n||t[5]!==s?(c=(0,g.jsx)(l,{asChild:!0,children:(0,g.jsx)(`span`,{className:`inline-flex`,children:(0,g.jsx)(p,{id:n,disabled:o,checked:r,onCheckedChange:s,"aria-label":`Select All Models`})})}),t[2]=r,t[3]=o,t[4]=n,t[5]=s,t[6]=c):c=t[6];let m;t[7]===Symbol.for(`react.memo_cache_sentinel`)?(m=(0,g.jsx)(u,{children:`Select All Models`}),t[7]=m):m=t[7];let _;return t[8]===c?_=t[9]:(_=(0,g.jsx)(d,{children:(0,g.jsxs)(f,{children:[c,m]})}),t[8]=c,t[9]=_),_}function y(e){let t=(0,h.c)(31),{sortBy:n,onSortByChange:r,showCodingIndex:p,showIntelligenceByPrice:m}=e,_=p===void 0?!1:p,v=m===void 0?!1:m,y=n===`alphabetical`?`secondary`:`ghost`,b;t[0]===r?b=t[1]:(b=()=>r(`alphabetical`),t[0]=r,t[1]=b);let x;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(x=(0,g.jsx)(i,{className:`h-4 w-4`}),t[2]=x):x=t[2];let S;t[3]!==y||t[4]!==b?(S=(0,g.jsx)(l,{asChild:!0,children:(0,g.jsx)(c,{type:`button`,variant:y,size:`icon`,className:`h-8 w-8`,onClick:b,children:x})}),t[3]=y,t[4]=b,t[5]=S):S=t[5];let C;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(C=(0,g.jsx)(u,{children:`Sort A–Z`}),t[6]=C):C=t[6];let w;t[7]===S?w=t[8]:(w=(0,g.jsxs)(f,{children:[S,C]}),t[7]=S,t[8]=w);let T=n===`price-low`||n===`price-high`?`secondary`:`ghost`,E;t[9]===r?E=t[10]:(E=()=>r(`price-low`),t[9]=r,t[10]=E);let D;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,g.jsx)(s,{className:`h-4 w-4`}),t[11]=D):D=t[11];let O;t[12]!==E||t[13]!==T?(O=(0,g.jsx)(l,{asChild:!0,children:(0,g.jsx)(c,{type:`button`,variant:T,size:`icon`,className:`h-8 w-8`,onClick:E,children:D})}),t[12]=E,t[13]=T,t[14]=O):O=t[14];let k;t[15]===Symbol.for(`react.memo_cache_sentinel`)?(k=(0,g.jsx)(u,{children:`Sort by price`}),t[15]=k):k=t[15];let A;t[16]===O?A=t[17]:(A=(0,g.jsxs)(f,{children:[O,k]}),t[16]=O,t[17]=A);let j;t[18]!==r||t[19]!==_||t[20]!==n?(j=_?(0,g.jsxs)(f,{children:[(0,g.jsx)(l,{asChild:!0,children:(0,g.jsx)(c,{type:`button`,variant:n===`coding-index`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>r(`coding-index`),children:(0,g.jsx)(a,{className:`h-4 w-4`})})}),(0,g.jsx)(u,{children:`Sort by coding intelligence`})]}):null,t[18]=r,t[19]=_,t[20]=n,t[21]=j):j=t[21];let M;t[22]!==r||t[23]!==v||t[24]!==n?(M=v?(0,g.jsxs)(f,{children:[(0,g.jsx)(l,{asChild:!0,children:(0,g.jsx)(c,{type:`button`,variant:n===`intelligence-by-price`?`secondary`:`ghost`,size:`icon`,className:`h-8 w-8`,onClick:()=>r(`intelligence-by-price`),children:(0,g.jsx)(o,{className:`h-4 w-4`})})}),(0,g.jsx)(u,{children:`Sort by price/intelligence`})]}):null,t[22]=r,t[23]=v,t[24]=n,t[25]=M):M=t[25];let N;return t[26]!==A||t[27]!==j||t[28]!==M||t[29]!==w?(N=(0,g.jsx)(d,{children:(0,g.jsxs)(`div`,{className:`flex items-center rounded-md p-0.5`,children:[w,A,j,M]})}),t[26]=A,t[27]=j,t[28]=M,t[29]=w,t[30]=N):N=t[30],N}export{y as n,_ as r,v as t};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{W as i,at as a,x as o}from"./dist-ZlK7I-y-.js";import{An as s,Bn as c,Et as l,Ln as u,Tn as d,dn as f,gn as p,q as m}from"./dist-DIjomljy.js";import{n as h,t as g}from"./utils-CT-Dw22R.js";import{t as _}from"./button-sfGyFWfz.js";import{G as v,V as y,h as b,jt as x,kt as S,s as C,vn as w,yn as T}from"./api-ODizoHnY.js";import{i as E,n as D,r as O,t as k}from"./tooltip-B6ziVyTv.js";import{n as A}from"./scroll-area-nbNFO91g.js";import{a as j,i as M,o as N,r as P,s as F,t as I}from"./dialog-CP2cYR59.js";import{Ct as L,Ft as R,On as z,Pn as B,Pt as V,St as H,Tt as U,o as W,pn as G,wt as K,xt as ee,yt as q}from"./index-Bmkj1Qwa.js";import{n as J,t as Y}from"./toggle-group-BiUqOiP6.js";import{t as te}from"./sorting-DqwxPMRN.js";import{t as ne}from"./pending-changes-Bn-0ak1d.js";function re(e){let t=/^[^:]+:\s+(.+)$/.exec(e);return(t?t[1]:e).trim()}function ie(e){return[G(e.id),e.name,re(e.name)]}function ae(e,t){let n=new Set(t.map(e=>e.toLowerCase()));return ie(e).some(e=>n.has(e.toLowerCase()))}function oe(e,t){return e.filter(e=>ae(e,t)).map(e=>e.id)}var X=t(),Z=e(n(),1),Q=r(),se=o(`app.model-selector.ui`),ce=`rounded-full border-0 px-3 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm`;function le({provider:e,onModelsChange:t,isLoading:n,disabled:r,displayMode:i=`grid`,autoSelectRecommended:o=!1}){let[s,u]=(0,Z.useState)([]),[d,f]=(0,Z.useState)(new Set),[_,y]=(0,Z.useState)(new Set),[b,S]=(0,Z.useState)(new Map),[C,w]=(0,Z.useState)(!1),[T,A]=(0,Z.useState)(``),[j,M]=(0,Z.useState)(`alphabetical`);(0,Z.useEffect)(()=>{N()},[e]);let N=async()=>{w(!0),A(``),M(`alphabetical`);try{let t=await v(e);u(t.models);let n=new Set(t.enabledModelIds);f(n);let r=new Map,i=new Set;if(o)try{let{models:e}=await x();i=new Set(oe(t.models,e)),r=new Map([...i].filter(e=>!n.has(e)).map(e=>[e,!0]))}catch(e){se.error(`Failed to load recommended models:`,e)}y(i),S(r),P(n,r,t.models)}catch(t){se.error(`Failed to load models for ${e}:`,t),u([]),f(new Set),y(new Set)}finally{w(!1)}},P=(e,n,r=s)=>{let i=new Set(e);r.forEach(e=>{n.has(e.id)&&(n.get(e.id)?i.add(e.id):i.delete(e.id))}),t?.(i)},F=e=>{S(t=>{let n=ne(t,e,d);return P(d,n),n})},I=e=>{S(t=>{let n=new Map(t);return s.forEach(t=>{let r=d.has(t.id);e?r?n.delete(t.id):n.set(t.id,!0):r?n.set(t.id,!1):n.delete(t.id)}),P(d,n),n})},L=e=>G(e.id);function z(e,t=b){let n=t.has(e),r=t.get(e);return n?!!r:d.has(e)}let B=te({models:s,query:T,sortBy:j,getDisplayName:L,getPriority:e=>+!z(e.id)}),V=j===`alphabetical`?`alphabetical`:`price`;function H(e){if(e===`alphabetical`){M(`alphabetical`);return}e===`price`&&M(`price-low`)}function U(){j!==`alphabetical`&&M(e=>e===`price-low`?`price-high`:`price-low`)}return C||n?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Q.jsx)(l,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):s.length===0?(0,Q.jsx)(`div`,{className:`text-center py-8`,children:(0,Q.jsx)(`p`,{className:a.bodyMuted,children:`No models available for this provider.`})}):i===`compact`?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:g(`flex items-center justify-between gap-3`,r&&`opacity-25`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,Q.jsx)(W,{id:`select-all-models`,disabled:r,checked:s.every(e=>z(e.id)),onCheckedChange:e=>I(e===!0)}),(0,Q.jsx)(`label`,{htmlFor:`select-all-models`,className:g(a.body,`cursor-pointer`),children:`Select all models`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,Q.jsxs)(`div`,{className:`relative w-44 sm:w-52`,children:[(0,Q.jsx)(m,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),(0,Q.jsx)(R,{placeholder:`Search models...`,value:T,onChange:e=>A(e.target.value),disabled:r,className:`pl-8 h-9`})]}),(0,Q.jsxs)(Y,{type:`single`,value:V,onValueChange:H,"aria-label":`Sort models`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:[(0,Q.jsx)(J,{value:`alphabetical`,"aria-label":`Sort A–Z`,disabled:r,className:ce,children:(0,Q.jsx)(c,{className:`h-4 w-4`})}),(0,Q.jsx)(J,{value:`price`,"aria-label":`Sort by price`,disabled:r,className:ce,onClick:U,children:(0,Q.jsx)(p,{className:`h-4 w-4`})})]})]})]}),(0,Q.jsx)(O,{children:(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-0 overflow-hidden rounded-md border border-table-border`,children:B.length===0?(0,Q.jsx)(`div`,{className:`text-center py-4`,children:(0,Q.jsx)(`p`,{className:a.bodyMuted,children:T?`No models match your search.`:`No models available.`})}):B.map(e=>{let t=z(e.id),n=e.pricing,i=t&&_.has(e.id);return(0,Q.jsxs)(k,{children:[(0,Q.jsx)(E,{asChild:!0,children:(0,Q.jsxs)(`div`,{className:g(`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default`,r&&`opacity-25`),children:[(0,Q.jsx)(W,{id:e.id,disabled:r,checked:t??!1,onCheckedChange:()=>F(e.id),className:`mt-0`}),(0,Q.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,Q.jsxs)(`label`,{htmlFor:e.id,className:g(a.body,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate flex-1 w-0`),children:[L(e),i&&(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:` (Recommended)`})]}),n&&(0,Q.jsx)(`span`,{className:g(a.compact,`text-muted-foreground whitespace-nowrap flex-shrink-0`),children:(n.prompt??0)<=0&&(n.completion??0)<=0?`Free`:`${h(n.prompt??0)} in | ${h(n.completion??0)} out`})]})]})}),e.description&&(0,Q.jsx)(D,{side:`top`,className:`max-w-xs`,children:(0,Q.jsx)(`p`,{className:a.body,children:e.description})})]},e.id)})})})]}):null}var $=o(`app.onboarding-dialog.ui`);function ue(e){let t=(0,X.c)(26),{currentStep:n}=e,r=e=>e===`provider-selection`&&n===`provider-selection`||n===`model-selection`,i=e=>n===e,o=i(`git-check`)?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`,s;t[0]===o?s=t[1]:(s=g(`flex items-center justify-center h-8 w-8 rounded-full`,a.label,o),t[0]=o,t[1]=s);let c;t[2]===s?c=t[3]:(c=(0,Q.jsx)(`div`,{className:s,children:`1`}),t[2]=s,t[3]=c);let l=r(`provider-selection`)?`bg-primary`:`bg-muted`,u;t[4]===l?u=t[5]:(u=g(`h-0.5 flex-1`,l),t[4]=l,t[5]=u);let d;t[6]===u?d=t[7]:(d=(0,Q.jsx)(`div`,{className:u}),t[6]=u,t[7]=d);let f=i(`provider-selection`)?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`,p;t[8]===f?p=t[9]:(p=g(`flex items-center justify-center h-8 w-8 rounded-full`,a.label,f),t[8]=f,t[9]=p);let m;t[10]===p?m=t[11]:(m=(0,Q.jsx)(`div`,{className:p,children:`2`}),t[10]=p,t[11]=m);let h=r(`model-selection`)?`bg-primary`:`bg-muted`,_;t[12]===h?_=t[13]:(_=g(`h-0.5 flex-1`,h),t[12]=h,t[13]=_);let v;t[14]===_?v=t[15]:(v=(0,Q.jsx)(`div`,{className:_}),t[14]=_,t[15]=v);let y=i(`model-selection`)?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`,b;t[16]===y?b=t[17]:(b=g(`flex items-center justify-center h-8 w-8 rounded-full`,a.label,y),t[16]=y,t[17]=b);let x;t[18]===b?x=t[19]:(x=(0,Q.jsx)(`div`,{className:b,children:`3`}),t[18]=b,t[19]=x);let S;return t[20]!==v||t[21]!==x||t[22]!==c||t[23]!==d||t[24]!==m?(S=(0,Q.jsxs)(`div`,{className:`w-1/2 mx-auto flex items-center gap-2 mb-6`,children:[c,d,m,v,x]}),t[20]=v,t[21]=x,t[22]=c,t[23]=d,t[24]=m,t[25]=S):S=t[25],S}function de(e){let t=(0,X.c)(3),{currentStep:n}=e;if(n===`provider-selection`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(F,{children:`Select an AI Provider`}),(0,Q.jsx)(M,{children:`Choose your preferred AI provider and enter your API key.`})]}),t[0]=e):e=t[0],e}if(n===`model-selection`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(F,{children:`Select Models`}),(0,Q.jsx)(M,{children:`Choose which models you want to use with this provider.`})]}),t[1]=e):e=t[1],e}let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(F,{children:`Let's get started`}),(0,Q.jsx)(M,{children:`First, we need to check that Git is installed on your system.`})]}),t[2]=r):r=t[2],r}function fe(e){let t=(0,X.c)(7),{gitLoading:n,gitInstalled:r}=e;if(n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Q.jsx)(l,{className:`h-5 w-5 animate-spin text-muted-foreground`})}),t[0]=e):e=t[0],e}if(r){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(z,{variant:`success`,className:`mb-0 flex items-start gap-3`,children:[(0,Q.jsx)(s,{className:`h-5 w-5 text-green-600 flex-shrink-0 mt-0.5`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:g(a.label,`text-green-900`),children:`Git is installed`}),(0,Q.jsx)(`p`,{className:a.bodyMuted,children:`You're all set to use Git features in Tarsk.`})]})]}),t[1]=e):e=t[1],e}let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(d,{className:`h-5 w-5 text-yellow-600 flex-shrink-0 mt-0.5`}),t[2]=i):i=t[2];let o,c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,Q.jsx)(`p`,{className:a.label,children:`Git is not installed`}),c=(0,Q.jsx)(`p`,{className:a.bodyMuted,children:`Git is required for some features in Tarsk. You can continue without it, but we recommend installing it.`}),t[3]=o,t[4]=c):(o=t[3],c=t[4]);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=g(a.caption,`text-brand hover:underline mt-2 inline-flex items-center gap-1`),t[5]=u):u=t[5];let p;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsxs)(z,{variant:`hint`,className:`mb-0 flex items-start gap-3`,children:[i,(0,Q.jsxs)(`div`,{className:`flex-1`,children:[o,c,(0,Q.jsxs)(`a`,{href:`https://git-scm.com/downloads`,target:`_blank`,rel:`noreferrer`,className:u,children:[`Download Git `,(0,Q.jsx)(f,{className:`h-3 w-3`})]})]})]}),t[6]=p):p=t[6],p}function pe(e){let t=(0,X.c)(16),{selectedProvider:n,onProviderChange:r,apiKey:o,onApiKeyChange:s,validatingKey:c,providerEnvValues:l,onProviderEnvChange:u,keyError:d}=e,f;t[0]!==o||t[1]!==s||t[2]!==r||t[3]!==n||t[4]!==c?(f=(0,Q.jsx)(q,{selectedProvider:n,onProviderChange:r,showApiKeyInput:!0,apiKey:o,onApiKeyChange:s,variant:`dropdown`,isLoading:c}),t[0]=o,t[1]=s,t[2]=r,t[3]=n,t[4]=c,t[5]=f):f=t[5];let p;t[6]!==u||t[7]!==l||t[8]!==n?(p=n&&L(n).map(e=>(0,Q.jsx)(B,{label:(0,Q.jsx)(V,{htmlFor:e,children:H(e)}),control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`input`,{id:e,value:l[e]??``,onChange:t=>u(e,t.target.value),className:`h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base`,placeholder:i(n.slug)&&e===`LOCAL_API_URL`?n.api:e,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`}),n.slug===`azure`&&e===K(n)||i(n.slug)&&e===`LOCAL_API_URL`?(0,Q.jsx)(`p`,{className:g(a.bodyMuted,`mt-2 break-all`),children:U(n,l)||n.api}):null]}),align:`start`},e)),t[6]=u,t[7]=l,t[8]=n,t[9]=p):p=t[9];let m;t[10]===d?m=t[11]:(m=d&&(0,Q.jsx)(z,{variant:`error`,className:`mb-0`,children:d}),t[10]=d,t[11]=m);let h;return t[12]!==f||t[13]!==p||t[14]!==m?(h=(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[f,p,m]}),t[12]=f,t[13]=p,t[14]=m,t[15]=h):h=t[15],h}function me(e){let t=(0,X.c)(4),{providerSlug:n,modelsLoading:r,onModelsChange:i}=e,a;return t[0]!==r||t[1]!==i||t[2]!==n?(a=(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsx)(le,{provider:n,isLoading:r,displayMode:`compact`,disabled:!1,autoSelectRecommended:!0,onModelsChange:i})}),t[0]=r,t[1]=i,t[2]=n,t[3]=a):a=t[3],a}function he(e){let t=(0,X.c)(32),{currentStep:n,savingOnboarding:r,gitLoading:i,validatingKey:a,apiKey:o,hasProvider:c,onSkip:d,onBack:f,onContinue:p,onValidate:m,onFinish:h}=e,g;t[0]!==n||t[1]!==d||t[2]!==r?(g=n===`provider-selection`&&(0,Q.jsx)(_,{variant:`ghost`,onClick:d,disabled:r,children:`Skip for now`}),t[0]=n,t[1]=d,t[2]=r,t[3]=g):g=t[3];let v;t[4]===g?v=t[5]:(v=(0,Q.jsx)(`div`,{children:g}),t[4]=g,t[5]=v);let y;t[6]!==n||t[7]!==f||t[8]!==r?(y=n!==`git-check`&&(0,Q.jsx)(_,{variant:`outline`,onClick:f,disabled:r,children:`Back`}),t[6]=n,t[7]=f,t[8]=r,t[9]=y):y=t[9];let b;t[10]!==n||t[11]!==i||t[12]!==p?(b=n===`git-check`&&(0,Q.jsxs)(_,{onClick:p,disabled:i,className:`gap-2`,children:[`Continue `,(0,Q.jsx)(u,{className:`h-4 w-4`})]}),t[10]=n,t[11]=i,t[12]=p,t[13]=b):b=t[13];let x;t[14]!==o||t[15]!==n||t[16]!==c||t[17]!==m||t[18]!==a?(x=n===`provider-selection`&&(0,Q.jsx)(_,{onClick:m,disabled:a||!o.trim()||!c,className:`gap-2`,children:a?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(l,{className:`h-4 w-4 animate-spin`}),`Validating...`]}):(0,Q.jsxs)(Q.Fragment,{children:[`Next `,(0,Q.jsx)(u,{className:`h-4 w-4`})]})}),t[14]=o,t[15]=n,t[16]=c,t[17]=m,t[18]=a,t[19]=x):x=t[19];let S;t[20]!==n||t[21]!==h||t[22]!==r?(S=n===`model-selection`&&(0,Q.jsx)(_,{onClick:h,disabled:r,className:`gap-2`,children:r?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(l,{className:`h-4 w-4 animate-spin`}),`Finishing...`]}):(0,Q.jsxs)(Q.Fragment,{children:[`Finish `,(0,Q.jsx)(s,{className:`h-4 w-4`})]})}),t[20]=n,t[21]=h,t[22]=r,t[23]=S):S=t[23];let C;t[24]!==y||t[25]!==b||t[26]!==x||t[27]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex gap-3`,children:[y,b,x,S]}),t[24]=y,t[25]=b,t[26]=x,t[27]=S,t[28]=C):C=t[28];let w;return t[29]!==v||t[30]!==C?(w=(0,Q.jsx)(`div`,{className:`px-6 py-4 border-t border-border bg-muted/10`,children:(0,Q.jsxs)(j,{className:`flex items-center justify-between`,children:[v,C]})}),t[29]=v,t[30]=C,t[31]=w):w=t[31],w}function ge({open:e,onOpenChange:t,onComplete:n}){let[r,i]=(0,Z.useState)(`git-check`),[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)([]),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)({}),[_,x]=(0,Z.useState)(!1),[E,D]=(0,Z.useState)(``),[O,k]=(0,Z.useState)(new Set),[j,M]=(0,Z.useState)(!1),[F,R]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{e&&r===`git-check`&&z()},[e,r]),(0,Z.useEffect)(()=>{e&&r===`provider-selection`&&l.length===0&&B()},[e,r,l.length]),(0,Z.useEffect)(()=>{e&&r===`model-selection`&&d&&V()},[e,r,d]);let z=async()=>{c(!0);try{let e=await C();o(e.gitInstalled),e.gitInstalled&&i(`provider-selection`)}catch(e){$.error(`Failed to check git installation:`,e),o(!1)}finally{c(!1)}},B=async()=>{try{let e=await S();if(u(e),e.length>0&&!d){let t=ee(e);t&&(f(t),m(t.apiKey??``),g(t.envValues??{}))}}catch(e){$.error(`Failed to load providers:`,e)}},V=async()=>{if(d){M(!0);try{await v(d.name),k(new Set)}catch(e){$.error(`Failed to load models:`,e)}finally{M(!1)}}},U=async()=>{if(!d||!p.trim()){D(`Please enter an API key`);return}let e=L(d),t=e.find(e=>!h[e]?.trim());if(t){D(`Please enter ${H(t)}`);return}x(!0),D(``);try{e.length>0&&await w(Object.fromEntries(e.map(e=>[e,h[e].trim()]))),await T(d.slug,p),i(`model-selection`)}catch(e){D(e instanceof Error?e.message:`Failed to validate API key`)}finally{x(!1)}},W=async()=>{if(d){R(!0);try{for(let e of O)await y(d.slug,e);await b(),n?.(),t(!1)}catch(e){$.error(`Failed to complete onboarding:`,e)}finally{R(!1)}}},G=async()=>{R(!0);try{await b(),n?.(),t(!1)}catch(e){$.error(`Failed to skip onboarding:`,e)}finally{R(!1)}},K=e=>{f(e),m(e.apiKey??``),g(e.envValues??{}),D(``)},q=(e,t)=>{g(n=>({...n,[e]:t}))},J=()=>{i(`provider-selection`)};function Y(){r===`provider-selection`?i(`git-check`):r===`model-selection`&&i(`provider-selection`)}return(0,Q.jsx)(I,{open:e,onOpenChange:t,children:(0,Q.jsxs)(P,{className:`max-w-2xl h-[min(42rem,90dvh)] flex flex-col p-0 overflow-hidden`,children:[(0,Q.jsxs)(`div`,{className:`px-6 pt-6 pb-2`,children:[(0,Q.jsx)(ue,{currentStep:r}),(0,Q.jsx)(N,{children:(0,Q.jsx)(de,{currentStep:r})})]}),(0,Q.jsx)(A,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,Q.jsxs)(`div`,{className:`px-6 py-4`,children:[r===`git-check`&&(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsx)(fe,{gitLoading:s,gitInstalled:a})}),r===`provider-selection`&&(0,Q.jsx)(pe,{selectedProvider:d,onProviderChange:K,apiKey:p,onApiKeyChange:m,validatingKey:_,providerEnvValues:h,onProviderEnvChange:q,keyError:E}),r===`model-selection`&&d&&(0,Q.jsx)(me,{providerSlug:d.slug,modelsLoading:j,onModelsChange:k})]})}),(0,Q.jsx)(he,{currentStep:r,savingOnboarding:F,gitLoading:s,validatingKey:_,apiKey:p,hasProvider:!!d,onSkip:()=>void G(),onBack:Y,onContinue:J,onValidate:()=>void U(),onFinish:()=>void W()})]})})}export{ge as OnboardingDialog,ge as default};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{G as i,S as a,ot as o}from"./dist-BWuYHVi8.js";import{An as s,Bn as c,Et as l,Ln as u,Tn as d,dn as f,gn as p,q as m}from"./dist-DIjomljy.js";import{n as h,t as g}from"./utils-CT-Dw22R.js";import{t as _}from"./button-DeNw35VZ.js";import{G as v,V as y,h as b,jt as x,kt as S,s as C,vn as w,yn as T}from"./api-BMo_Lz8f.js";import{i as E,n as D,r as O,t as k}from"./tooltip-B6ziVyTv.js";import{n as A}from"./scroll-area-nbNFO91g.js";import{a as j,i as M,o as N,r as P,s as F,t as I}from"./dialog-Do98zzAW.js";import{Ct as L,Ft as R,On as z,Pn as B,Pt as V,St as H,Tt as U,o as W,pn as G,wt as K,xt as ee,yt as q}from"./index-DjaVbFDB.js";import{n as J,t as Y}from"./toggle-group-5tREtjoW.js";import{t as te}from"./sorting-DqwxPMRN.js";import{t as ne}from"./pending-changes-Bn-0ak1d.js";function re(e){let t=/^[^:]+:\s+(.+)$/.exec(e);return(t?t[1]:e).trim()}function ie(e){return[G(e.id),e.name,re(e.name)]}function ae(e,t){let n=new Set(t.map(e=>e.toLowerCase()));return ie(e).some(e=>n.has(e.toLowerCase()))}function oe(e,t){return e.filter(e=>ae(e,t)).map(e=>e.id)}var X=t(),Z=e(n(),1),Q=r(),se=a(`app.model-selector.ui`),ce=`rounded-full border-0 px-3 data-[state=on]:bg-foreground data-[state=on]:text-background data-[state=on]:shadow-sm`;function le({provider:e,onModelsChange:t,isLoading:n,disabled:r,displayMode:i=`grid`,autoSelectRecommended:a=!1}){let[s,u]=(0,Z.useState)([]),[d,f]=(0,Z.useState)(new Set),[_,y]=(0,Z.useState)(new Set),[b,S]=(0,Z.useState)(new Map),[C,w]=(0,Z.useState)(!1),[T,A]=(0,Z.useState)(``),[j,M]=(0,Z.useState)(`alphabetical`);(0,Z.useEffect)(()=>{N()},[e]);let N=async()=>{w(!0),A(``),M(`alphabetical`);try{let t=await v(e);u(t.models);let n=new Set(t.enabledModelIds);f(n);let r=new Map,i=new Set;if(a)try{let{models:e}=await x();i=new Set(oe(t.models,e)),r=new Map([...i].filter(e=>!n.has(e)).map(e=>[e,!0]))}catch(e){se.error(`Failed to load recommended models:`,e)}y(i),S(r),P(n,r,t.models)}catch(t){se.error(`Failed to load models for ${e}:`,t),u([]),f(new Set),y(new Set)}finally{w(!1)}},P=(e,n,r=s)=>{let i=new Set(e);r.forEach(e=>{n.has(e.id)&&(n.get(e.id)?i.add(e.id):i.delete(e.id))}),t?.(i)},F=e=>{S(t=>{let n=ne(t,e,d);return P(d,n),n})},I=e=>{S(t=>{let n=new Map(t);return s.forEach(t=>{let r=d.has(t.id);e?r?n.delete(t.id):n.set(t.id,!0):r?n.set(t.id,!1):n.delete(t.id)}),P(d,n),n})},L=e=>G(e.id);function z(e,t=b){let n=t.has(e),r=t.get(e);return n?!!r:d.has(e)}let B=te({models:s,query:T,sortBy:j,getDisplayName:L,getPriority:e=>+!z(e.id)}),V=j===`alphabetical`?`alphabetical`:`price`;function H(e){if(e===`alphabetical`){M(`alphabetical`);return}e===`price`&&M(`price-low`)}function U(){j!==`alphabetical`&&M(e=>e===`price-low`?`price-high`:`price-low`)}return C||n?(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Q.jsx)(l,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):s.length===0?(0,Q.jsx)(`div`,{className:`text-center py-8`,children:(0,Q.jsx)(`p`,{className:o.bodyMuted,children:`No models available for this provider.`})}):i===`compact`?(0,Q.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,Q.jsxs)(`div`,{className:g(`flex items-center justify-between gap-3`,r&&`opacity-25`),children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 min-w-0`,children:[(0,Q.jsx)(W,{id:`select-all-models`,disabled:r,checked:s.every(e=>z(e.id)),onCheckedChange:e=>I(e===!0)}),(0,Q.jsx)(`label`,{htmlFor:`select-all-models`,className:g(o.body,`cursor-pointer`),children:`Select all models`})]}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 flex-shrink-0`,children:[(0,Q.jsxs)(`div`,{className:`relative w-44 sm:w-52`,children:[(0,Q.jsx)(m,{className:`absolute left-2.5 top-1/2 -translate-y-1/2 h-4 w-4 text-muted-foreground pointer-events-none`}),(0,Q.jsx)(R,{placeholder:`Search models...`,value:T,onChange:e=>A(e.target.value),disabled:r,className:`pl-8 h-9`})]}),(0,Q.jsxs)(Y,{type:`single`,value:V,onValueChange:H,"aria-label":`Sort models`,variant:`outline`,className:`inline-flex rounded-full border bg-muted/40 p-1`,children:[(0,Q.jsx)(J,{value:`alphabetical`,"aria-label":`Sort A–Z`,disabled:r,className:ce,children:(0,Q.jsx)(c,{className:`h-4 w-4`})}),(0,Q.jsx)(J,{value:`price`,"aria-label":`Sort by price`,disabled:r,className:ce,onClick:U,children:(0,Q.jsx)(p,{className:`h-4 w-4`})})]})]})]}),(0,Q.jsx)(O,{children:(0,Q.jsx)(`div`,{className:`grid grid-cols-1 gap-0 overflow-hidden rounded-md border border-table-border`,children:B.length===0?(0,Q.jsx)(`div`,{className:`text-center py-4`,children:(0,Q.jsx)(`p`,{className:o.bodyMuted,children:T?`No models match your search.`:`No models available.`})}):B.map(e=>{let t=z(e.id),n=e.pricing,i=t&&_.has(e.id);return(0,Q.jsxs)(k,{children:[(0,Q.jsx)(E,{asChild:!0,children:(0,Q.jsxs)(`div`,{className:g(`flex items-center space-x-3 p-3 hover:bg-muted/30 transition-colors cursor-default`,r&&`opacity-25`),children:[(0,Q.jsx)(W,{id:e.id,disabled:r,checked:t??!1,onCheckedChange:()=>F(e.id),className:`mt-0`}),(0,Q.jsxs)(`div`,{className:`flex-1 flex items-center justify-between gap-3 leading-none`,children:[(0,Q.jsxs)(`label`,{htmlFor:e.id,className:g(o.body,`peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer truncate flex-1 w-0`),children:[L(e),i&&(0,Q.jsx)(`span`,{className:`text-muted-foreground`,children:` (Recommended)`})]}),n&&(0,Q.jsx)(`span`,{className:g(o.compact,`text-muted-foreground whitespace-nowrap flex-shrink-0`),children:(n.prompt??0)<=0&&(n.completion??0)<=0?`Free`:`${h(n.prompt??0)} in | ${h(n.completion??0)} out`})]})]})}),e.description&&(0,Q.jsx)(D,{side:`top`,className:`max-w-xs`,children:(0,Q.jsx)(`p`,{className:o.body,children:e.description})})]},e.id)})})})]}):null}var $=a(`app.onboarding-dialog.ui`);function ue(e){let t=(0,X.c)(26),{currentStep:n}=e,r=e=>e===`provider-selection`&&n===`provider-selection`||n===`model-selection`,i=e=>n===e,a=i(`git-check`)?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`,s;t[0]===a?s=t[1]:(s=g(`flex items-center justify-center h-8 w-8 rounded-full`,o.label,a),t[0]=a,t[1]=s);let c;t[2]===s?c=t[3]:(c=(0,Q.jsx)(`div`,{className:s,children:`1`}),t[2]=s,t[3]=c);let l=r(`provider-selection`)?`bg-primary`:`bg-muted`,u;t[4]===l?u=t[5]:(u=g(`h-0.5 flex-1`,l),t[4]=l,t[5]=u);let d;t[6]===u?d=t[7]:(d=(0,Q.jsx)(`div`,{className:u}),t[6]=u,t[7]=d);let f=i(`provider-selection`)?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`,p;t[8]===f?p=t[9]:(p=g(`flex items-center justify-center h-8 w-8 rounded-full`,o.label,f),t[8]=f,t[9]=p);let m;t[10]===p?m=t[11]:(m=(0,Q.jsx)(`div`,{className:p,children:`2`}),t[10]=p,t[11]=m);let h=r(`model-selection`)?`bg-primary`:`bg-muted`,_;t[12]===h?_=t[13]:(_=g(`h-0.5 flex-1`,h),t[12]=h,t[13]=_);let v;t[14]===_?v=t[15]:(v=(0,Q.jsx)(`div`,{className:_}),t[14]=_,t[15]=v);let y=i(`model-selection`)?`bg-primary text-primary-foreground`:`bg-muted text-muted-foreground`,b;t[16]===y?b=t[17]:(b=g(`flex items-center justify-center h-8 w-8 rounded-full`,o.label,y),t[16]=y,t[17]=b);let x;t[18]===b?x=t[19]:(x=(0,Q.jsx)(`div`,{className:b,children:`3`}),t[18]=b,t[19]=x);let S;return t[20]!==v||t[21]!==x||t[22]!==c||t[23]!==d||t[24]!==m?(S=(0,Q.jsxs)(`div`,{className:`w-1/2 mx-auto flex items-center gap-2 mb-6`,children:[c,d,m,v,x]}),t[20]=v,t[21]=x,t[22]=c,t[23]=d,t[24]=m,t[25]=S):S=t[25],S}function de(e){let t=(0,X.c)(3),{currentStep:n}=e;if(n===`provider-selection`){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(F,{children:`Select an AI Provider`}),(0,Q.jsx)(M,{children:`Choose your preferred AI provider and enter your API key.`})]}),t[0]=e):e=t[0],e}if(n===`model-selection`){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(F,{children:`Select Models`}),(0,Q.jsx)(M,{children:`Choose which models you want to use with this provider.`})]}),t[1]=e):e=t[1],e}let r;return t[2]===Symbol.for(`react.memo_cache_sentinel`)?(r=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(F,{children:`Let's get started`}),(0,Q.jsx)(M,{children:`First, we need to check that Git is installed on your system.`})]}),t[2]=r):r=t[2],r}function fe(e){let t=(0,X.c)(7),{gitLoading:n,gitInstalled:r}=e;if(n){let e;return t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsx)(`div`,{className:`flex items-center justify-center py-8`,children:(0,Q.jsx)(l,{className:`h-5 w-5 animate-spin text-muted-foreground`})}),t[0]=e):e=t[0],e}if(r){let e;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,Q.jsxs)(z,{variant:`success`,className:`mb-0 flex items-start gap-3`,children:[(0,Q.jsx)(s,{className:`h-5 w-5 text-green-600 flex-shrink-0 mt-0.5`}),(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`p`,{className:g(o.label,`text-green-900`),children:`Git is installed`}),(0,Q.jsx)(`p`,{className:o.bodyMuted,children:`You're all set to use Git features in Tarsk.`})]})]}),t[1]=e):e=t[1],e}let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,Q.jsx)(d,{className:`h-5 w-5 text-yellow-600 flex-shrink-0 mt-0.5`}),t[2]=i):i=t[2];let a,c;t[3]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,Q.jsx)(`p`,{className:o.label,children:`Git is not installed`}),c=(0,Q.jsx)(`p`,{className:o.bodyMuted,children:`Git is required for some features in Tarsk. You can continue without it, but we recommend installing it.`}),t[3]=a,t[4]=c):(a=t[3],c=t[4]);let u;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(u=g(o.caption,`text-brand hover:underline mt-2 inline-flex items-center gap-1`),t[5]=u):u=t[5];let p;return t[6]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,Q.jsxs)(z,{variant:`hint`,className:`mb-0 flex items-start gap-3`,children:[i,(0,Q.jsxs)(`div`,{className:`flex-1`,children:[a,c,(0,Q.jsxs)(`a`,{href:`https://git-scm.com/downloads`,target:`_blank`,rel:`noreferrer`,className:u,children:[`Download Git `,(0,Q.jsx)(f,{className:`h-3 w-3`})]})]})]}),t[6]=p):p=t[6],p}function pe(e){let t=(0,X.c)(16),{selectedProvider:n,onProviderChange:r,apiKey:a,onApiKeyChange:s,validatingKey:c,providerEnvValues:l,onProviderEnvChange:u,keyError:d}=e,f;t[0]!==a||t[1]!==s||t[2]!==r||t[3]!==n||t[4]!==c?(f=(0,Q.jsx)(q,{selectedProvider:n,onProviderChange:r,showApiKeyInput:!0,apiKey:a,onApiKeyChange:s,variant:`dropdown`,isLoading:c}),t[0]=a,t[1]=s,t[2]=r,t[3]=n,t[4]=c,t[5]=f):f=t[5];let p;t[6]!==u||t[7]!==l||t[8]!==n?(p=n&&L(n).map(e=>(0,Q.jsx)(B,{label:(0,Q.jsx)(V,{htmlFor:e,children:H(e)}),control:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`input`,{id:e,value:l[e]??``,onChange:t=>u(e,t.target.value),className:`h-10 w-full rounded-md border border-input bg-background px-3 py-2 text-base`,placeholder:i(n.slug)&&e===`LOCAL_API_URL`?n.api:e,spellCheck:!1,autoCorrect:`off`,autoCapitalize:`off`}),n.slug===`azure`&&e===K(n)||i(n.slug)&&e===`LOCAL_API_URL`?(0,Q.jsx)(`p`,{className:g(o.bodyMuted,`mt-2 break-all`),children:U(n,l)||n.api}):null]}),align:`start`},e)),t[6]=u,t[7]=l,t[8]=n,t[9]=p):p=t[9];let m;t[10]===d?m=t[11]:(m=d&&(0,Q.jsx)(z,{variant:`error`,className:`mb-0`,children:d}),t[10]=d,t[11]=m);let h;return t[12]!==f||t[13]!==p||t[14]!==m?(h=(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[f,p,m]}),t[12]=f,t[13]=p,t[14]=m,t[15]=h):h=t[15],h}function me(e){let t=(0,X.c)(4),{providerSlug:n,modelsLoading:r,onModelsChange:i}=e,a;return t[0]!==r||t[1]!==i||t[2]!==n?(a=(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsx)(le,{provider:n,isLoading:r,displayMode:`compact`,disabled:!1,autoSelectRecommended:!0,onModelsChange:i})}),t[0]=r,t[1]=i,t[2]=n,t[3]=a):a=t[3],a}function he(e){let t=(0,X.c)(32),{currentStep:n,savingOnboarding:r,gitLoading:i,validatingKey:a,apiKey:o,hasProvider:c,onSkip:d,onBack:f,onContinue:p,onValidate:m,onFinish:h}=e,g;t[0]!==n||t[1]!==d||t[2]!==r?(g=n===`provider-selection`&&(0,Q.jsx)(_,{variant:`ghost`,onClick:d,disabled:r,children:`Skip for now`}),t[0]=n,t[1]=d,t[2]=r,t[3]=g):g=t[3];let v;t[4]===g?v=t[5]:(v=(0,Q.jsx)(`div`,{children:g}),t[4]=g,t[5]=v);let y;t[6]!==n||t[7]!==f||t[8]!==r?(y=n!==`git-check`&&(0,Q.jsx)(_,{variant:`outline`,onClick:f,disabled:r,children:`Back`}),t[6]=n,t[7]=f,t[8]=r,t[9]=y):y=t[9];let b;t[10]!==n||t[11]!==i||t[12]!==p?(b=n===`git-check`&&(0,Q.jsxs)(_,{onClick:p,disabled:i,className:`gap-2`,children:[`Continue `,(0,Q.jsx)(u,{className:`h-4 w-4`})]}),t[10]=n,t[11]=i,t[12]=p,t[13]=b):b=t[13];let x;t[14]!==o||t[15]!==n||t[16]!==c||t[17]!==m||t[18]!==a?(x=n===`provider-selection`&&(0,Q.jsx)(_,{onClick:m,disabled:a||!o.trim()||!c,className:`gap-2`,children:a?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(l,{className:`h-4 w-4 animate-spin`}),`Validating...`]}):(0,Q.jsxs)(Q.Fragment,{children:[`Next `,(0,Q.jsx)(u,{className:`h-4 w-4`})]})}),t[14]=o,t[15]=n,t[16]=c,t[17]=m,t[18]=a,t[19]=x):x=t[19];let S;t[20]!==n||t[21]!==h||t[22]!==r?(S=n===`model-selection`&&(0,Q.jsx)(_,{onClick:h,disabled:r,className:`gap-2`,children:r?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(l,{className:`h-4 w-4 animate-spin`}),`Finishing...`]}):(0,Q.jsxs)(Q.Fragment,{children:[`Finish `,(0,Q.jsx)(s,{className:`h-4 w-4`})]})}),t[20]=n,t[21]=h,t[22]=r,t[23]=S):S=t[23];let C;t[24]!==y||t[25]!==b||t[26]!==x||t[27]!==S?(C=(0,Q.jsxs)(`div`,{className:`flex gap-3`,children:[y,b,x,S]}),t[24]=y,t[25]=b,t[26]=x,t[27]=S,t[28]=C):C=t[28];let w;return t[29]!==v||t[30]!==C?(w=(0,Q.jsx)(`div`,{className:`px-6 py-4 border-t border-border bg-muted/10`,children:(0,Q.jsxs)(j,{className:`flex items-center justify-between`,children:[v,C]})}),t[29]=v,t[30]=C,t[31]=w):w=t[31],w}function ge({open:e,onOpenChange:t,onComplete:n}){let[r,i]=(0,Z.useState)(`git-check`),[a,o]=(0,Z.useState)(null),[s,c]=(0,Z.useState)(!1),[l,u]=(0,Z.useState)([]),[d,f]=(0,Z.useState)(null),[p,m]=(0,Z.useState)(``),[h,g]=(0,Z.useState)({}),[_,x]=(0,Z.useState)(!1),[E,D]=(0,Z.useState)(``),[O,k]=(0,Z.useState)(new Set),[j,M]=(0,Z.useState)(!1),[F,R]=(0,Z.useState)(!1);(0,Z.useEffect)(()=>{e&&r===`git-check`&&z()},[e,r]),(0,Z.useEffect)(()=>{e&&r===`provider-selection`&&l.length===0&&B()},[e,r,l.length]),(0,Z.useEffect)(()=>{e&&r===`model-selection`&&d&&V()},[e,r,d]);let z=async()=>{c(!0);try{let e=await C();o(e.gitInstalled),e.gitInstalled&&i(`provider-selection`)}catch(e){$.error(`Failed to check git installation:`,e),o(!1)}finally{c(!1)}},B=async()=>{try{let e=await S();if(u(e),e.length>0&&!d){let t=ee(e);t&&(f(t),m(t.apiKey??``),g(t.envValues??{}))}}catch(e){$.error(`Failed to load providers:`,e)}},V=async()=>{if(d){M(!0);try{await v(d.name),k(new Set)}catch(e){$.error(`Failed to load models:`,e)}finally{M(!1)}}},U=async()=>{if(!d||!p.trim()){D(`Please enter an API key`);return}let e=L(d),t=e.find(e=>!h[e]?.trim());if(t){D(`Please enter ${H(t)}`);return}x(!0),D(``);try{e.length>0&&await w(Object.fromEntries(e.map(e=>[e,h[e].trim()]))),await T(d.slug,p),i(`model-selection`)}catch(e){D(e instanceof Error?e.message:`Failed to validate API key`)}finally{x(!1)}},W=async()=>{if(d){R(!0);try{for(let e of O)await y(d.slug,e);await b(),n?.(),t(!1)}catch(e){$.error(`Failed to complete onboarding:`,e)}finally{R(!1)}}},G=async()=>{R(!0);try{await b(),n?.(),t(!1)}catch(e){$.error(`Failed to skip onboarding:`,e)}finally{R(!1)}},K=e=>{f(e),m(e.apiKey??``),g(e.envValues??{}),D(``)},q=(e,t)=>{g(n=>({...n,[e]:t}))},J=()=>{i(`provider-selection`)};function Y(){r===`provider-selection`?i(`git-check`):r===`model-selection`&&i(`provider-selection`)}return(0,Q.jsx)(I,{open:e,onOpenChange:t,children:(0,Q.jsxs)(P,{className:`max-w-2xl h-[min(42rem,90dvh)] flex flex-col p-0 overflow-hidden`,children:[(0,Q.jsxs)(`div`,{className:`px-6 pt-6 pb-2`,children:[(0,Q.jsx)(ue,{currentStep:r}),(0,Q.jsx)(N,{children:(0,Q.jsx)(de,{currentStep:r})})]}),(0,Q.jsx)(A,{className:`flex-1 min-h-0 overflow-hidden`,children:(0,Q.jsxs)(`div`,{className:`px-6 py-4`,children:[r===`git-check`&&(0,Q.jsx)(`div`,{className:`space-y-4`,children:(0,Q.jsx)(fe,{gitLoading:s,gitInstalled:a})}),r===`provider-selection`&&(0,Q.jsx)(pe,{selectedProvider:d,onProviderChange:K,apiKey:p,onApiKeyChange:m,validatingKey:_,providerEnvValues:h,onProviderEnvChange:q,keyError:E}),r===`model-selection`&&d&&(0,Q.jsx)(me,{providerSlug:d.slug,modelsLoading:j,onModelsChange:k})]})}),(0,Q.jsx)(he,{currentStep:r,savingOnboarding:F,gitLoading:s,validatingKey:_,apiKey:p,hasProvider:!!d,onSkip:()=>void G(),onBack:Y,onContinue:J,onValidate:()=>void U(),onFinish:()=>void W()})]})})}export{ge as OnboardingDialog,ge as default};
|
package/dist/public/assets/{project-env-vars-view-DTGwl4wr.js → project-env-vars-view-N1Io1Pau.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{s as i}from"./chunk-QFMPRPBF-COsSkB7x.js";import{
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{s as i}from"./chunk-QFMPRPBF-COsSkB7x.js";import{L as a,ot as o}from"./dist-BWuYHVi8.js";import{Et as s,ln as c,un as l,y as u}from"./dist-DIjomljy.js";import{t as d}from"./utils-CT-Dw22R.js";import{t as f}from"./button-DeNw35VZ.js";import{Ln as p,xt as m}from"./api-BMo_Lz8f.js";import{t as h}from"./use-toast-xpb5jNtN.js";import{Bn as g,Ft as _,In as v,Ln as y,Nn as b,kn as x}from"./index-DjaVbFDB.js";import{t as S}from"./use-settings-page-loading-BTySlInF.js";var C=t(),w=e(n(),1),T=r();function E(e){let t=(0,C.c)(20),{entry:n,index:r,loading:i,onValueChange:o}=e,s=a(n.name),[u,p]=(0,w.useState)(!1),m=n.value.length>0||n.hasExistingValue,h=n.hasExistingValue&&!n.value?`••••••••`:`value`;(0,w.useEffect)(()=>{s||p(!1)},[s]);let g=_,v=s&&!u?`password`:`text`,y=n.value,b;t[0]!==r||t[1]!==o?(b=e=>o(r,e.target.value),t[0]=r,t[1]=o,t[2]=b):b=t[2];let x=d(`font-mono`,s&&`pr-10`),S;t[3]!==g||t[4]!==n.value||t[5]!==i||t[6]!==h||t[7]!==v||t[8]!==b||t[9]!==x?(S=(0,T.jsx)(g,{type:v,placeholder:h,value:y,onChange:b,className:x,disabled:i}),t[3]=g,t[4]=n.value,t[5]=i,t[6]=h,t[7]=v,t[8]=b,t[9]=x,t[10]=S):S=t[10];let E;t[11]!==m||t[12]!==s||t[13]!==i||t[14]!==p||t[15]!==u?(E=s?(0,T.jsx)(f,{type:`button`,variant:`ghost`,size:`sm`,className:`absolute right-1 top-1/2 h-8 w-8 -translate-y-1/2 p-0`,onClick:()=>p(D),disabled:i||!m,children:u?(0,T.jsx)(l,{className:`h-4 w-4 text-muted-foreground`}):(0,T.jsx)(c,{className:`h-4 w-4 text-muted-foreground`})}):null,t[11]=m,t[12]=s,t[13]=i,t[14]=p,t[15]=u,t[16]=E):E=t[16];let O;return t[17]!==S||t[18]!==E?(O=(0,T.jsxs)(`div`,{className:`relative flex-1`,children:[S,E]}),t[17]=S,t[18]=E,t[19]=O):O=t[19],O}function D(e){return!e}function O({projectId:e}){let t=i(),[n,r]=(0,w.useState)([]),[a,c]=(0,w.useState)([]),[l,d]=(0,w.useState)(!0),[C,D]=(0,w.useState)(!1),O=(0,w.useCallback)(async()=>{if(!e){d(!1);return}d(!0);try{let t=(await m(e)).vars.map(e=>({name:e.name,value:e.value??``,hasExistingValue:e.hasValue&&e.value===void 0}));r(t),c(t)}catch(e){h({title:`Error`,description:e instanceof Error?e.message:`Failed to load environment variables`,variant:`destructive`})}finally{d(!1)}},[e]);(0,w.useLayoutEffect)(()=>{e&&d(!0)},[e]),(0,w.useEffect)(()=>{O()},[O]);let k=S(e,[l]);function A(){r(e=>[...e,{name:``,value:``,hasExistingValue:!1}])}function j(e,t){r(n=>n.map((n,r)=>r===e?{...n,name:t.toUpperCase()}:n))}function M(e,t){r(n=>n.map((n,r)=>r===e?{...n,value:t}:n))}function N(e){r(t=>t.filter((t,n)=>n!==e))}function P(){if(n.length!==a.length)return!0;for(let e=0;e<n.length;e+=1){let t=n[e],r=a[e];if(!r||t.name!==r.name||t.value!==r.value||t.hasExistingValue!==r.hasExistingValue)return!0}return!1}async function F(){if(!(!e||!P())){D(!0);try{let r=n.map(e=>({name:e.name.trim(),value:e.value,hasExistingValue:e.hasExistingValue})).filter(e=>e.name.length>0),i=r.find((e,t)=>r.findIndex(t=>t.name===e.name)!==t);if(i)throw Error(`Duplicate environment variable name: ${i.name}`);let a=r.find(e=>!e.hasExistingValue&&!e.value.trim());if(a)throw Error(`Value is required for environment variable: ${a.name}`);await p(e,r.map(e=>({name:e.name,value:e.value.trim()||void 0}))),c(n.map(e=>({...e,value:``}))),await O(),t(`/`)}catch(e){h({title:`Error`,description:e instanceof Error?e.message:`Failed to save environment variables`,variant:`destructive`})}finally{D(!1)}}}return e?(0,T.jsx)(b,{loading:k,children:(0,T.jsxs)(g,{className:`shrink-0`,children:[(0,T.jsx)(x,{title:`Environment Variables`,description:`Encrypted in Tarsk and injected for bash commands and MCP tools.`,action:(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(f,{variant:`ghost`,size:`sm`,onClick:A,disabled:l,children:`Add variable`}),(0,T.jsx)(f,{onClick:()=>void F(),disabled:C||l,children:C?(0,T.jsxs)(T.Fragment,{children:[(0,T.jsx)(s,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`})]}),sticky:!1}),(0,T.jsx)(y,{className:`max-w-none pt-6`,children:n.length===0?(0,T.jsx)(`p`,{className:o.caption,children:`No environment variables configured`}):(0,T.jsx)(`div`,{className:`flex flex-col gap-2`,children:n.map((e,t)=>(0,T.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,T.jsx)(_,{placeholder:`API_KEY`,value:e.name,onChange:e=>j(t,e.target.value),className:`w-[35%] font-mono`,disabled:l}),(0,T.jsx)(E,{entry:e,index:t,loading:l,onValueChange:M}),(0,T.jsx)(f,{variant:`ghost`,size:`icon`,onClick:()=>N(t),className:`h-9 w-9 shrink-0`,disabled:l||C,children:(0,T.jsx)(u,{className:`h-3.5 w-3.5`})})]},t))})})]})}):(0,T.jsx)(v,{title:`No project selected`,children:`Please select a project from the sidebar to manage environment variables.`})}export{O as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{s as i}from"./chunk-QFMPRPBF-COsSkB7x.js";import{
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{s as i}from"./chunk-QFMPRPBF-COsSkB7x.js";import{Bt as a,It as o,Jt as s,Kt as c,Lt as l,Rt as u,ot as d,qt as f,zt as p}from"./dist-BWuYHVi8.js";import{Et as m}from"./dist-DIjomljy.js";import{t as h}from"./utils-CT-Dw22R.js";import{t as g}from"./button-DeNw35VZ.js";import{tt as _,yt as v,zn as y}from"./api-BMo_Lz8f.js";import{t as b}from"./use-toast-xpb5jNtN.js";import{At as x,Bn as S,Dn as C,Fn as w,In as T,Ln as E,Mt as D,Nn as O,Nt as k,Ot as A,jt as j,kn as M,kt as N,pn as P}from"./index-DjaVbFDB.js";import{t as F}from"./use-settings-page-loading-BTySlInF.js";var I=e(n(),1),L=t(),R=r(),z=`__unspecified__`,B=`__default__`;function V(e){let t=(0,L.c)(20),{value:n,onChange:r,enabledModels:i,disabled:c}=e,d=c===void 0?!1:c,m;if(t[0]!==i){m=new Map;for(let e of i){let t=e.provider??`other`,n=m.get(t);n?n.push(e):m.set(t,[e])}t[0]=i,t[1]=m}else m=t[1];let h=m,g;t[2]!==r||t[3]!==n?(g=function(e,t){let i={...n};if(t===z){delete i[e],r(i);return}let a=p(t);a&&(i[e]=a,r(i))},t[2]=r,t[3]=n,t[4]=g):g=t[4];let _=g,v;t[5]===i?v=t[6]:(v=function(e){if(!e)return;let t=e.provider.toLowerCase();return i.find(n=>n.id===e.model&&(n.provider??`other`).toLowerCase()===t)},t[5]=i,t[6]=v);let y=v,b;t[7]!==r||t[8]!==n?(b=function(e,t){let i=n[e];if(!i)return;let a={...i};if(t===B)delete a.reasoningEffort;else if(s(t))a.reasoningEffort=t;else return;r({...n,[e]:a})},t[7]=r,t[8]=n,t[9]=b):b=t[9];let S=b,T;t[10]!==d||t[11]!==i||t[12]!==y||t[13]!==_||t[14]!==S||t[15]!==h||t[16]!==n?(T=u.map(e=>{let t=n[e],r=t?a(t):z,s=y(t)?.supportedReasoningEfforts??[];return(0,R.jsx)(C,{title:l[e],description:o[e],children:(0,R.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,R.jsxs)(A,{value:r,onValueChange:t=>_(e,t),disabled:d,children:[(0,R.jsx)(D,{id:`model-alias-${e}`,className:`w-full min-w-0`,children:(0,R.jsx)(k,{placeholder:`Unspecified`})}),(0,R.jsxs)(N,{children:[(0,R.jsx)(x,{value:z,children:`Unspecified`}),i.length>0&&(0,R.jsx)(j,{}),[...h.entries()].map(U)]})]}),t&&s.length>0&&(0,R.jsxs)(A,{value:t.reasoningEffort??B,onValueChange:t=>S(e,t),disabled:d,children:[(0,R.jsx)(D,{id:`model-alias-${e}-reasoning`,className:`w-full min-w-0`,children:(0,R.jsx)(k,{placeholder:`Model default`})}),(0,R.jsxs)(N,{children:[(0,R.jsx)(x,{value:B,children:`Model default`}),(0,R.jsx)(x,{value:`off`,children:f(`off`)}),s.map(H)]})]})]})},e)}),t[10]=d,t[11]=i,t[12]=y,t[13]=_,t[14]=S,t[15]=h,t[16]=n,t[17]=T):T=t[17];let E;return t[18]===T?E=t[19]:(E=(0,R.jsx)(w,{id:`model-aliases`,children:T}),t[18]=T,t[19]=E),E}function H(e){return(0,R.jsx)(x,{value:e,children:f(e)},e)}function U(e){let[t,n]=e;return(0,R.jsxs)(`div`,{children:[(0,R.jsx)(`div`,{className:h(d.dropdownGroupHeading,`px-2 py-1.5 uppercase`),children:t}),n.map(e=>{let n=a({provider:e.provider??t,model:e.id});return(0,R.jsx)(x,{value:n,children:P(e.id)},n)})]},t)}function W(e){return[...e].sort((e,t)=>{let n=(e.provider??``).localeCompare(t.provider??``);return n===0?P(e.id).localeCompare(P(t.id)):n})}function G({projectId:e,onProjectUpdated:t}){let n=i(),[r,a]=(0,I.useState)({}),[o,s]=(0,I.useState)({}),[l,u]=(0,I.useState)([]),[d,f]=(0,I.useState)(!0),[p,h]=(0,I.useState)(!1),x=(0,I.useCallback)(async()=>{if(!e){f(!1);return}f(!0);try{let[t,n]=await Promise.all([v(e),_().catch(()=>({}))]),r=t.modelAliases??{};u(W(Object.values(n).flat())),a(r),s(r)}catch(e){b({title:`Error`,description:e instanceof Error?e.message:`Failed to load model aliases`,variant:`destructive`})}finally{f(!1)}},[e]);(0,I.useLayoutEffect)(()=>{e&&f(!0)},[e]),(0,I.useEffect)(()=>{x()},[x]);let C=F(e,[d]);function w(){return JSON.stringify(r)!==JSON.stringify(o)}async function D(){if(!(!e||!w())){h(!0);try{let i=Object.keys(r).length>0?r:void 0;if(i){let e=await _();c(i,Object.fromEntries(Object.entries(e).map(([e,t])=>[e,t.map(e=>e.id)])))}await y(e,{modelAliases:i??null}),s(r),t&&await t(),await x(),n(`/`)}catch(e){b({title:`Error`,description:e instanceof Error?e.message:`Failed to save model aliases`,variant:`destructive`})}finally{h(!1)}}}return e?(0,R.jsx)(O,{loading:C,children:(0,R.jsxs)(S,{className:`shrink-0`,children:[(0,R.jsx)(M,{title:`Model Aliases`,description:`Map short names (fast, local, cheap, smart) to enabled models. Subagents can reference these aliases in AGENT.md. Set Cheap to enable Orchestrate mode.`,action:(0,R.jsx)(g,{onClick:()=>void D(),disabled:p||d,children:p?(0,R.jsxs)(R.Fragment,{children:[(0,R.jsx)(m,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`}),sticky:!1}),(0,R.jsx)(E,{className:`max-w-none pt-6`,children:(0,R.jsx)(V,{value:r,onChange:a,enabledModels:l,disabled:d||p})})]})}):(0,R.jsx)(T,{title:`No project selected`,children:`Please select a project from the sidebar to configure model aliases.`})}export{G as default};
|
package/dist/public/assets/{project-settings-view-DniUno1i.js → project-settings-view-BalZ6Fe1.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{s as i}from"./chunk-QFMPRPBF-COsSkB7x.js";import{Et as a,at as o}from"./dist-ZlK7I-y-.js";import{Et as s,Gt as c}from"./dist-DIjomljy.js";import{t as l}from"./utils-CT-Dw22R.js";import{t as u}from"./button-sfGyFWfz.js";import{Fn as d,Ir as f,Rn as p,yt as m,zn as h}from"./api-ODizoHnY.js";import{t as g}from"./use-toast-xpb5jNtN.js";import{An as ee,Bn as te,Dn as _,Fn as ne,Ft as re,In as ie,Ln as ae,Nn as oe,Pt as se,Y as ce,i as le,kn as ue,s as v,vt as de}from"./index-Bmkj1Qwa.js";import{i as fe}from"./commit-method-fields-CYzy7rmY.js";import{a as pe,n as y,r as me,t as b}from"./context-menu-Bo0OMC7-.js";import{t as he}from"./use-settings-page-loading-BTySlInF.js";var x=t(),S=e(n(),1),C=r();function ge(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>t(r),r.onerror=()=>n(Error(`The selected file is not a readable image.`)),r.src=e})}async function _e(e,t){if(!e){t.setLoading(!1);return}t.setLoading(!0);try{let n=await m(e);t.setProjectPath(n.projectPath??null),t.setName(n.name??``),t.setValue(n.setupScript??``),t.setValidationScript(n.validationScript??``),t.setRunCmd(n.runCommand??``),t.setCommitMethod(n.commitMethod??a.PullRequest),t.setAllowAllCommands(n.allowAllCommands!==!1),t.setAllowedCommandPatterns(n.allowedCommandPatterns??[]),t.setUseBuiltInBrowser(n.useBuiltInBrowser!==!1),t.setProjectIcon(n.projectIcon??null),t.setOriginalName(n.name??``),t.setOriginalAllowAllCommands(n.allowAllCommands!==!1),t.setOriginalAllowedCommandPatterns(n.allowedCommandPatterns??[]),t.setOriginalUseBuiltInBrowser(n.useBuiltInBrowser!==!1),t.setOriginalProjectIcon(n.projectIcon??null)}catch(e){g({title:`Error`,description:e instanceof Error?e.message:`Failed to load project settings`,variant:`destructive`})}finally{t.setLoading(!1)}}async function w(e,t){try{let n=await ge(e),r=document.createElement(`canvas`);r.width=256,r.height=256;let i=r.getContext(`2d`);if(!i)throw Error(`Could not prepare image conversion`);i.imageSmoothingEnabled=!0,i.imageSmoothingQuality=`high`;let a=Math.max(256/n.naturalWidth,256/n.naturalHeight),o=n.naturalWidth*a,s=n.naturalHeight*a;i.drawImage(n,(256-o)/2,(256-s)/2,o,s),t(r.toDataURL(`image/png`))}catch(e){g({title:`Could not use image`,description:e instanceof Error?e.message:`The selected file could not be read.`,variant:`destructive`})}}async function ve(e,t){let n=e.target.files?.[0];if(e.target.value=``,!n)return;let r=URL.createObjectURL(n);try{await w(r,t)}finally{URL.revokeObjectURL(r)}}async function ye(e,t,n){n(!0);try{let n=await d(e);n.runCommand?(t(n.runCommand),g({title:`Success`,description:`Suggested: ${n.runCommand}`})):g({title:`No command found`,description:`Could not detect a dev script in package.json`})}catch(e){g({title:`Error`,description:e instanceof Error?e.message:`Failed to suggest command`,variant:`destructive`})}finally{n(!1)}}async function T(e,t,n){t!==n&&await h(e,t)}async function be(e,t,n,r,i){await p(e,{setupScript:t.trim()||null,validationScript:n.trim()||null,runCommand:r.trim()||null,commitMethod:i})}async function xe(e,t,n,r,i){(t!==r||JSON.stringify(n)!==JSON.stringify(i))&&await p(e,{allowAllCommands:t,allowedCommandPatterns:n})}async function Se(e,t,n){t!==n&&await p(e,{useBuiltInBrowser:t})}async function E(e,t,n){t!==n&&await p(e,{projectIcon:t})}async function Ce(e,t,n,r,i,a){n.setSaving(!0);try{await T(e,t.name,t.originalName),await be(e,t.value,t.validationScript,t.runCmd,t.commitMethod),await xe(e,t.allowAllCommands,t.allowedCommandPatterns,t.originalAllowAllCommands,t.originalAllowedCommandPatterns),await Se(e,t.useBuiltInBrowser,t.originalUseBuiltInBrowser),await E(e,t.projectIcon,t.originalProjectIcon),n.setOriginalName(t.name),n.setOriginalAllowAllCommands(t.allowAllCommands),n.setOriginalAllowedCommandPatterns(t.allowedCommandPatterns),n.setOriginalUseBuiltInBrowser(t.useBuiltInBrowser),n.setOriginalProjectIcon(t.projectIcon),r&&await r(),await a(),i(`/`)}catch(e){g({title:`Error`,description:e instanceof Error?e.message:`Failed to save settings`,variant:`destructive`})}finally{n.setSaving(!1)}}function we(e){let t=(0,x.c)(10),{allowAllCommands:n,patterns:r,disabled:i,onRemove:a}=e;if(n||r.length===0)return null;let s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,C.jsx)(se,{children:`Allowed command patterns`}),t[0]=s):s=t[0];let c;if(t[1]!==i||t[2]!==a||t[3]!==r){let e;t[5]!==i||t[6]!==a?(e=e=>(0,C.jsxs)(`li`,{className:`flex items-center justify-between rounded-md border border-border px-3 py-2`,children:[(0,C.jsx)(`code`,{className:l(o.mono,o.bodyMuted),children:e}),(0,C.jsx)(u,{type:`button`,variant:`ghost`,size:`sm`,disabled:i,onClick:()=>a(e),children:`Remove`})]},e),t[5]=i,t[6]=a,t[7]=e):e=t[7],c=r.map(e),t[1]=i,t[2]=a,t[3]=r,t[4]=c}else c=t[4];let d;return t[8]===c?d=t[9]:(d=(0,C.jsxs)(`div`,{className:`space-y-2 mt-3`,children:[s,(0,C.jsx)(`ul`,{className:`space-y-1`,children:c})]}),t[8]=c,t[9]=d),d}function Te(e){let t=(0,x.c)(21),{projectIcon:n,disabled:r,inputRef:i,onFileChange:a,onButtonClick:o,onRemove:s}=e,l;t[0]!==r||t[1]!==i||t[2]!==a?(l=(0,C.jsx)(`input`,{ref:i,type:`file`,accept:`image/*`,className:`sr-only`,onChange:a,disabled:r}),t[0]=r,t[1]=i,t[2]=a,t[3]=l):l=t[3];let u=n?`Change project icon`:`Choose project icon`,d;t[4]===n?d=t[5]:(d=n?(0,C.jsx)(`img`,{src:n,alt:``,className:`h-full w-full object-cover`}):(0,C.jsx)(c,{className:`h-4 w-4 text-muted-foreground`,strokeWidth:1.5}),t[4]=n,t[5]=d);let f;t[6]!==r||t[7]!==o||t[8]!==u||t[9]!==d?(f=(0,C.jsx)(pe,{asChild:!0,children:(0,C.jsx)(`button`,{type:`button`,className:`flex h-8 w-8 items-center justify-center overflow-hidden rounded-md border border-border bg-muted/40 outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:o,disabled:r,"aria-label":u,children:d})}),t[6]=r,t[7]=o,t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;t[11]!==r||t[12]!==s||t[13]!==n?(p=n&&(0,C.jsx)(y,{children:(0,C.jsx)(me,{disabled:r,onSelect:s,children:`Remove`})}),t[11]=r,t[12]=s,t[13]=n,t[14]=p):p=t[14];let m;t[15]!==f||t[16]!==p?(m=(0,C.jsxs)(b,{children:[f,p]}),t[15]=f,t[16]=p,t[17]=m):m=t[17];let h;return t[18]!==l||t[19]!==m?(h=(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l,m]}),t[18]=l,t[19]=m,t[20]=h):h=t[20],h}function Ee(e){let t=(0,x.c)(6),{saving:n,disabled:r,onClick:i}=e,a;t[0]===n?a=t[1]:(a=n?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(s,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`,t[0]=n,t[1]=a);let o;return t[2]!==r||t[3]!==i||t[4]!==a?(o=(0,C.jsx)(u,{onClick:i,disabled:r,children:a}),t[2]=r,t[3]=i,t[4]=a,t[5]=o):o=t[5],o}function De(e,t,n){let r=(0,x.c)(13),i;r[0]===e?i=r[1]:(i=function(t){return w(t,e)},r[0]=e,r[1]=i);let a=i,o,s;r[2]===a?(o=r[3],s=r[4]):(o=()=>{if(!f())return;let e=function(e){let t=e.detail.dataUrl;a(t)};return window.addEventListener(`tarsk:project-icon-selected`,e),()=>{window.removeEventListener(`tarsk:project-icon-selected`,e)}},s=[a],r[2]=a,r[3]=o,r[4]=s),(0,S.useEffect)(o,s);let c;r[5]===e?c=r[6]:(c=function(t){return ve(t,e)},r[5]=e,r[6]=c);let l=c,u;r[7]!==n||r[8]!==t?(u=function(){f()&&t?v(t):n.current?.click()},r[7]=n,r[8]=t,r[9]=u):u=r[9];let d=u,p;return r[10]!==d||r[11]!==l?(p={handleProjectIconChange:l,handleProjectIconButtonClick:d},r[10]=d,r[11]=l,r[12]=p):p=r[12],p}function Oe(e){let t=(0,x.c)(117),{projectId:n,onProjectUpdated:r}=e,c=i(),d=le(),[f,p]=(0,S.useState)(``),[m,h]=(0,S.useState)(``),[g,se]=(0,S.useState)(``),[v,pe]=(0,S.useState)(a.PullRequest),[y,me]=(0,S.useState)(``),[b,ge]=(0,S.useState)(!1),[w,ve]=(0,S.useState)(!1),[T,be]=(0,S.useState)(!0),[xe,Se]=(0,S.useState)(``),[E,Oe]=(0,S.useState)(!0),D;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(D=[],t[0]=D):D=t[0];let[O,ke]=(0,S.useState)(D),[Ae,je]=(0,S.useState)(!0),Me;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(Me=[],t[1]=Me):Me=t[1];let[Ne,Pe]=(0,S.useState)(Me),[k,Fe]=(0,S.useState)(!0),[Ie,Le]=(0,S.useState)(!0),[A,Re]=(0,S.useState)(null),[ze,Be]=(0,S.useState)(null),[Ve,He]=(0,S.useState)(null),Ue=(0,S.useRef)(null),We;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(We={setProjectPath:He,setName:p,setValue:h,setRunCmd:se,setCommitMethod:pe,setValidationScript:me,setAllowAllCommands:Oe,setAllowedCommandPatterns:ke,setUseBuiltInBrowser:Fe,setProjectIcon:Re,setOriginalName:Se,setOriginalAllowAllCommands:je,setOriginalAllowedCommandPatterns:Pe,setOriginalUseBuiltInBrowser:Le,setOriginalProjectIcon:Be,setLoading:be,setSaving:ge},t[2]=We):We=t[2];let Ge=We,Ke;t[3]===n?Ke=t[4]:(Ke=()=>_e(n,Ge),t[3]=n,t[4]=Ke);let j=Ke,qe,M;t[5]===n?(qe=t[6],M=t[7]):(qe=()=>{n&&be(!0)},M=[n],t[5]=n,t[6]=qe,t[7]=M),(0,S.useLayoutEffect)(qe,M);let Je,Ye;t[8]===j?(Je=t[9],Ye=t[10]):(Je=()=>{j()},Ye=[j],t[8]=j,t[9]=Je,t[10]=Ye),(0,S.useEffect)(Je,Ye);let Xe;t[11]===T?Xe=t[12]:(Xe=[T],t[11]=T,t[12]=Xe);let Ze=he(n,Xe),Qe;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=function(e){pe(e)},t[13]=Qe):Qe=t[13];let $e=Qe,{handleProjectIconChange:et,handleProjectIconButtonClick:tt}=De(Re,Ve,Ue),nt;t[14]===n?nt=t[15]:(nt=async()=>{n&&await ye(n,se,ve)},t[14]=n,t[15]=nt);let rt=nt,it;t[16]!==E||t[17]!==O||t[18]!==v||t[19]!==j||t[20]!==f||t[21]!==c||t[22]!==r||t[23]!==Ae||t[24]!==Ne||t[25]!==xe||t[26]!==ze||t[27]!==Ie||t[28]!==A||t[29]!==n||t[30]!==g||t[31]!==k||t[32]!==y||t[33]!==m?(it=async()=>{n&&await Ce(n,{name:f,value:m,runCmd:g,commitMethod:v,validationScript:y,allowAllCommands:E,allowedCommandPatterns:O,useBuiltInBrowser:k,projectIcon:A,originalName:xe,originalAllowAllCommands:Ae,originalAllowedCommandPatterns:Ne,originalUseBuiltInBrowser:Ie,originalProjectIcon:ze},Ge,r,c,j)},t[16]=E,t[17]=O,t[18]=v,t[19]=j,t[20]=f,t[21]=c,t[22]=r,t[23]=Ae,t[24]=Ne,t[25]=xe,t[26]=ze,t[27]=Ie,t[28]=A,t[29]=n,t[30]=g,t[31]=k,t[32]=y,t[33]=m,t[34]=it):it=t[34];let at=it,N=T||b,ot=T||w;if(!n){let e;return t[35]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,C.jsx)(ie,{title:`No project selected`,children:`Please select a project from the sidebar to view its settings.`}),t[35]=e):e=t[35],e}let P;t[36]!==N||t[37]!==at||t[38]!==b?(P=(0,C.jsx)(ue,{title:`Project Settings`,description:`Configure settings for your project.`,action:(0,C.jsx)(Ee,{saving:b,disabled:N,onClick:at}),sticky:!1}),t[36]=N,t[37]=at,t[38]=b,t[39]=P):P=t[39];let st;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(st=e=>p(e.target.value),t[40]=st):st=t[40];let F;t[41]!==T||t[42]!==f?(F=(0,C.jsx)(_,{title:`Project Name`,children:(0,C.jsx)(re,{id:`projectName`,value:f,onChange:st,placeholder:`Enter project name`,disabled:T})}),t[41]=T,t[42]=f,t[43]=F):F=t[43];let ct;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ct=e=>h(e.target.value),t[44]=ct):ct=t[44];let I;t[45]!==T||t[46]!==m?(I=(0,C.jsx)(_,{title:`Setup Script`,description:`This script runs automatically after cloning the repo for new threads.`,children:(0,C.jsx)(ce,{id:`setupScript`,value:m,onChange:ct,placeholder:`e.g. npm install`,className:`font-mono min-h-[80px] resize-none`,disabled:T})}),t[45]=T,t[46]=m,t[47]=I):I=t[47];let lt;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(lt=e=>me(e.target.value),t[48]=lt):lt=t[48];let L;t[49]!==T||t[50]!==y?(L=(0,C.jsx)(_,{title:`Validation Script`,description:`This script runs after each chat response. If it fails, Tarsk will try to fix issues automatically up to the retry limit.`,children:(0,C.jsx)(ce,{id:`validationScript`,value:y,onChange:lt,placeholder:`e.g. npm run lint && npm test`,className:`font-mono min-h-[80px] resize-none`,disabled:T})}),t[49]=T,t[50]=y,t[51]=L):L=t[51];let ut;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(ut=e=>se(e.target.value),t[52]=ut):ut=t[52];let R;t[53]!==T||t[54]!==g?(R=(0,C.jsx)(re,{id:`runCommand`,value:g,onChange:ut,placeholder:`e.g. npm run dev`,className:`font-mono pr-28`,disabled:T}),t[53]=T,t[54]=g,t[55]=R):R=t[55];let z;t[56]===w?z=t[57]:(z=w?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(s,{className:`h-3 w-3 animate-spin`}),`Suggesting...`]}):`Suggest`,t[56]=w,t[57]=z);let B;t[58]!==rt||t[59]!==ot||t[60]!==z?(B=(0,C.jsx)(u,{variant:`ghost`,size:`sm`,className:`absolute right-1 top-1 h-8`,onClick:rt,disabled:ot,children:z}),t[58]=rt,t[59]=ot,t[60]=z,t[61]=B):B=t[61];let V;t[62]!==R||t[63]!==B?(V=(0,C.jsx)(_,{title:`Run Command`,description:`The command to start the dev server. Leave empty to disable run functionality.`,children:(0,C.jsxs)(`div`,{className:`relative`,children:[R,B]})}),t[62]=R,t[63]=B,t[64]=V):V=t[64];let dt=v===a.PullRequest?`Feature branches are created and pull requests can be created.`:`Commits are made directly to the main branch without feature branches.`,H;t[65]!==v||t[66]!==T?(H=(0,C.jsx)(fe,{commitMethod:v,onCommitMethodChange:$e,disabled:T}),t[65]=v,t[66]=T,t[67]=H):H=t[67];let U;t[68]!==dt||t[69]!==H?(U=(0,C.jsx)(_,{title:`Commit Method`,description:dt,controlLayout:`row-end`,action:H}),t[68]=dt,t[69]=H,t[70]=U):U=t[70];let ft=!E,pt;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(pt=e=>Oe(!e),t[71]=pt):pt=t[71];let W;t[72]!==T||t[73]!==ft?(W=(0,C.jsx)(de,{value:ft,onChange:pt,disabled:T,ariaLabel:`Confirm Commands`}),t[72]=T,t[73]=ft,t[74]=W):W=t[74];let G;t[75]!==E||t[76]!==O||t[77]!==N?(G=!E&&O.length>0&&(0,C.jsx)(we,{allowAllCommands:E,patterns:O,disabled:N,onRemove:e=>ke(t=>t.filter(t=>t!==e))}),t[75]=E,t[76]=O,t[77]=N,t[78]=G):G=t[78];let K;t[79]!==W||t[80]!==G?(K=(0,C.jsx)(_,{title:`Confirm Commands`,description:`When enabled, the agent asks for approval before running bash commands, skill scripts, and browser shell calls.`,controlLayout:`row-end`,action:W,children:G}),t[79]=W,t[80]=G,t[81]=K):K=t[81];let q;t[82]!==N||t[83]!==k?(q=(0,C.jsx)(_,{title:`Built-in Browser`,description:`When enabled, Tarsk shows the Browser tab and opens detected dev URLs in the app. When disabled, the tab is hidden and URLs open in your system browser.`,controlLayout:`row-end`,action:(0,C.jsx)(de,{value:k,onChange:Fe,disabled:N,ariaLabel:`Built-in Browser`})}),t[82]=N,t[83]=k,t[84]=q):q=t[84];let mt;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(mt=()=>Re(null),t[85]=mt):mt=t[85];let J;t[86]!==N||t[87]!==tt||t[88]!==et||t[89]!==A?(J=(0,C.jsx)(_,{title:`Project Icon`,description:`Choose an image to use for this project on the Projects page. It will be center-cropped to a 256×256 PNG.`,controlLayout:`row-end`,action:(0,C.jsx)(Te,{projectIcon:A,disabled:N,inputRef:Ue,onFileChange:et,onButtonClick:tt,onRemove:mt})}),t[86]=N,t[87]=tt,t[88]=et,t[89]=A,t[90]=J):J=t[90];let Y;t[91]!==F||t[92]!==I||t[93]!==L||t[94]!==V||t[95]!==U||t[96]!==K||t[97]!==q||t[98]!==J?(Y=(0,C.jsx)(ae,{className:`max-w-none pt-6`,children:(0,C.jsxs)(ne,{children:[F,I,L,V,U,K,q,J]})}),t[91]=F,t[92]=I,t[93]=L,t[94]=V,t[95]=U,t[96]=K,t[97]=q,t[98]=J,t[99]=Y):Y=t[99];let X;t[100]!==P||t[101]!==Y?(X=(0,C.jsxs)(te,{className:`shrink-0`,children:[P,Y]}),t[100]=P,t[101]=Y,t[102]=X):X=t[102];let ht;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(ht=(0,C.jsx)(ee,{title:`Delete Project`}),t[103]=ht):ht=t[103];let gt;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(gt=(0,C.jsx)(`div`,{className:`min-w-0`,children:(0,C.jsx)(`p`,{className:l(o.bodyMuted),children:`Permanently removes the project, its threads, and all associated storage. This action cannot be undone.`})}),t[104]=gt):gt=t[104];let Z;t[105]!==f||t[106]!==n||t[107]!==d?(Z=()=>{n&&d({id:n,name:f})},t[105]=f,t[106]=n,t[107]=d,t[108]=Z):Z=t[108];let Q;t[109]!==N||t[110]!==Z?(Q=(0,C.jsxs)(te,{className:`shrink-0 rounded-none border-t border-table-border pt-6 mt-8`,children:[ht,(0,C.jsxs)(`div`,{className:`flex flex-col items-start gap-4`,children:[gt,(0,C.jsx)(u,{type:`button`,variant:`destructive`,disabled:N,onClick:Z,children:`Delete Project`})]})]}),t[109]=N,t[110]=Z,t[111]=Q):Q=t[111];let $;return t[112]!==Ze||t[113]!==n||t[114]!==X||t[115]!==Q?($=(0,C.jsxs)(oe,{loading:Ze,children:[X,Q]},n),t[112]=Ze,t[113]=n,t[114]=X,t[115]=Q,t[116]=$):$=t[116],$}export{Oe as default};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{s as i}from"./chunk-QFMPRPBF-COsSkB7x.js";import{Dt as a,ot as o}from"./dist-BWuYHVi8.js";import{Et as s,Gt as c}from"./dist-DIjomljy.js";import{t as l}from"./utils-CT-Dw22R.js";import{t as u}from"./button-DeNw35VZ.js";import{Bn as d,In as f,Lr as p,yt as m,zn as h}from"./api-BMo_Lz8f.js";import{t as g}from"./use-toast-xpb5jNtN.js";import{An as ee,Bn as te,Dn as _,Fn as ne,Ft as re,In as ie,Ln as ae,Nn as oe,Pt as se,Y as ce,i as le,kn as ue,s as v,vt as de}from"./index-DjaVbFDB.js";import{i as fe}from"./commit-method-fields-CD3PTIox.js";import{a as pe,n as y,r as me,t as b}from"./context-menu-Dx5Jy21w.js";import{t as he}from"./use-settings-page-loading-BTySlInF.js";var x=t(),S=e(n(),1),C=r();function ge(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>t(r),r.onerror=()=>n(Error(`The selected file is not a readable image.`)),r.src=e})}async function _e(e,t){if(!e){t.setLoading(!1);return}t.setLoading(!0);try{let n=await m(e);t.setProjectPath(n.projectPath??null),t.setName(n.name??``),t.setValue(n.setupScript??``),t.setValidationScript(n.validationScript??``),t.setRunCmd(n.runCommand??``),t.setCommitMethod(n.commitMethod??a.PullRequest),t.setAllowAllCommands(n.allowAllCommands!==!1),t.setAllowedCommandPatterns(n.allowedCommandPatterns??[]),t.setUseBuiltInBrowser(n.useBuiltInBrowser!==!1),t.setProjectIcon(n.projectIcon??null),t.setOriginalName(n.name??``),t.setOriginalAllowAllCommands(n.allowAllCommands!==!1),t.setOriginalAllowedCommandPatterns(n.allowedCommandPatterns??[]),t.setOriginalUseBuiltInBrowser(n.useBuiltInBrowser!==!1),t.setOriginalProjectIcon(n.projectIcon??null)}catch(e){g({title:`Error`,description:e instanceof Error?e.message:`Failed to load project settings`,variant:`destructive`})}finally{t.setLoading(!1)}}async function w(e,t){try{let n=await ge(e),r=document.createElement(`canvas`);r.width=256,r.height=256;let i=r.getContext(`2d`);if(!i)throw Error(`Could not prepare image conversion`);i.imageSmoothingEnabled=!0,i.imageSmoothingQuality=`high`;let a=Math.max(256/n.naturalWidth,256/n.naturalHeight),o=n.naturalWidth*a,s=n.naturalHeight*a;i.drawImage(n,(256-o)/2,(256-s)/2,o,s),t(r.toDataURL(`image/png`))}catch(e){g({title:`Could not use image`,description:e instanceof Error?e.message:`The selected file could not be read.`,variant:`destructive`})}}async function ve(e,t){let n=e.target.files?.[0];if(e.target.value=``,!n)return;let r=URL.createObjectURL(n);try{await w(r,t)}finally{URL.revokeObjectURL(r)}}async function ye(e,t,n){n(!0);try{let n=await f(e);n.runCommand?(t(n.runCommand),g({title:`Success`,description:`Suggested: ${n.runCommand}`})):g({title:`No command found`,description:`Could not detect a dev script in package.json`})}catch(e){g({title:`Error`,description:e instanceof Error?e.message:`Failed to suggest command`,variant:`destructive`})}finally{n(!1)}}async function T(e,t,n){t!==n&&await d(e,t)}async function be(e,t,n,r,i){await h(e,{setupScript:t.trim()||null,validationScript:n.trim()||null,runCommand:r.trim()||null,commitMethod:i})}async function xe(e,t,n,r,i){(t!==r||JSON.stringify(n)!==JSON.stringify(i))&&await h(e,{allowAllCommands:t,allowedCommandPatterns:n})}async function Se(e,t,n){t!==n&&await h(e,{useBuiltInBrowser:t})}async function E(e,t,n){t!==n&&await h(e,{projectIcon:t})}async function Ce(e,t,n,r,i,a){n.setSaving(!0);try{await T(e,t.name,t.originalName),await be(e,t.value,t.validationScript,t.runCmd,t.commitMethod),await xe(e,t.allowAllCommands,t.allowedCommandPatterns,t.originalAllowAllCommands,t.originalAllowedCommandPatterns),await Se(e,t.useBuiltInBrowser,t.originalUseBuiltInBrowser),await E(e,t.projectIcon,t.originalProjectIcon),n.setOriginalName(t.name),n.setOriginalAllowAllCommands(t.allowAllCommands),n.setOriginalAllowedCommandPatterns(t.allowedCommandPatterns),n.setOriginalUseBuiltInBrowser(t.useBuiltInBrowser),n.setOriginalProjectIcon(t.projectIcon),r&&await r(),await a(),i(`/`)}catch(e){g({title:`Error`,description:e instanceof Error?e.message:`Failed to save settings`,variant:`destructive`})}finally{n.setSaving(!1)}}function we(e){let t=(0,x.c)(10),{allowAllCommands:n,patterns:r,disabled:i,onRemove:a}=e;if(n||r.length===0)return null;let s;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,C.jsx)(se,{children:`Allowed command patterns`}),t[0]=s):s=t[0];let c;if(t[1]!==i||t[2]!==a||t[3]!==r){let e;t[5]!==i||t[6]!==a?(e=e=>(0,C.jsxs)(`li`,{className:`flex items-center justify-between rounded-md border border-border px-3 py-2`,children:[(0,C.jsx)(`code`,{className:l(o.mono,o.bodyMuted),children:e}),(0,C.jsx)(u,{type:`button`,variant:`ghost`,size:`sm`,disabled:i,onClick:()=>a(e),children:`Remove`})]},e),t[5]=i,t[6]=a,t[7]=e):e=t[7],c=r.map(e),t[1]=i,t[2]=a,t[3]=r,t[4]=c}else c=t[4];let d;return t[8]===c?d=t[9]:(d=(0,C.jsxs)(`div`,{className:`space-y-2 mt-3`,children:[s,(0,C.jsx)(`ul`,{className:`space-y-1`,children:c})]}),t[8]=c,t[9]=d),d}function Te(e){let t=(0,x.c)(21),{projectIcon:n,disabled:r,inputRef:i,onFileChange:a,onButtonClick:o,onRemove:s}=e,l;t[0]!==r||t[1]!==i||t[2]!==a?(l=(0,C.jsx)(`input`,{ref:i,type:`file`,accept:`image/*`,className:`sr-only`,onChange:a,disabled:r}),t[0]=r,t[1]=i,t[2]=a,t[3]=l):l=t[3];let u=n?`Change project icon`:`Choose project icon`,d;t[4]===n?d=t[5]:(d=n?(0,C.jsx)(`img`,{src:n,alt:``,className:`h-full w-full object-cover`}):(0,C.jsx)(c,{className:`h-4 w-4 text-muted-foreground`,strokeWidth:1.5}),t[4]=n,t[5]=d);let f;t[6]!==r||t[7]!==o||t[8]!==u||t[9]!==d?(f=(0,C.jsx)(pe,{asChild:!0,children:(0,C.jsx)(`button`,{type:`button`,className:`flex h-8 w-8 items-center justify-center overflow-hidden rounded-md border border-border bg-muted/40 outline-none focus-visible:ring-2 focus-visible:ring-ring`,onClick:o,disabled:r,"aria-label":u,children:d})}),t[6]=r,t[7]=o,t[8]=u,t[9]=d,t[10]=f):f=t[10];let p;t[11]!==r||t[12]!==s||t[13]!==n?(p=n&&(0,C.jsx)(y,{children:(0,C.jsx)(me,{disabled:r,onSelect:s,children:`Remove`})}),t[11]=r,t[12]=s,t[13]=n,t[14]=p):p=t[14];let m;t[15]!==f||t[16]!==p?(m=(0,C.jsxs)(b,{children:[f,p]}),t[15]=f,t[16]=p,t[17]=m):m=t[17];let h;return t[18]!==l||t[19]!==m?(h=(0,C.jsxs)(`div`,{className:`flex items-center gap-2`,children:[l,m]}),t[18]=l,t[19]=m,t[20]=h):h=t[20],h}function Ee(e){let t=(0,x.c)(6),{saving:n,disabled:r,onClick:i}=e,a;t[0]===n?a=t[1]:(a=n?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(s,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`,t[0]=n,t[1]=a);let o;return t[2]!==r||t[3]!==i||t[4]!==a?(o=(0,C.jsx)(u,{onClick:i,disabled:r,children:a}),t[2]=r,t[3]=i,t[4]=a,t[5]=o):o=t[5],o}function De(e,t,n){let r=(0,x.c)(13),i;r[0]===e?i=r[1]:(i=function(t){return w(t,e)},r[0]=e,r[1]=i);let a=i,o,s;r[2]===a?(o=r[3],s=r[4]):(o=()=>{if(!p())return;let e=function(e){let t=e.detail.dataUrl;a(t)};return window.addEventListener(`tarsk:project-icon-selected`,e),()=>{window.removeEventListener(`tarsk:project-icon-selected`,e)}},s=[a],r[2]=a,r[3]=o,r[4]=s),(0,S.useEffect)(o,s);let c;r[5]===e?c=r[6]:(c=function(t){return ve(t,e)},r[5]=e,r[6]=c);let l=c,u;r[7]!==n||r[8]!==t?(u=function(){p()&&t?v(t):n.current?.click()},r[7]=n,r[8]=t,r[9]=u):u=r[9];let d=u,f;return r[10]!==d||r[11]!==l?(f={handleProjectIconChange:l,handleProjectIconButtonClick:d},r[10]=d,r[11]=l,r[12]=f):f=r[12],f}function Oe(e){let t=(0,x.c)(117),{projectId:n,onProjectUpdated:r}=e,c=i(),d=le(),[f,p]=(0,S.useState)(``),[m,h]=(0,S.useState)(``),[g,se]=(0,S.useState)(``),[v,pe]=(0,S.useState)(a.PullRequest),[y,me]=(0,S.useState)(``),[b,ge]=(0,S.useState)(!1),[w,ve]=(0,S.useState)(!1),[T,be]=(0,S.useState)(!0),[xe,Se]=(0,S.useState)(``),[E,Oe]=(0,S.useState)(!0),D;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(D=[],t[0]=D):D=t[0];let[O,ke]=(0,S.useState)(D),[Ae,je]=(0,S.useState)(!0),Me;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(Me=[],t[1]=Me):Me=t[1];let[Ne,Pe]=(0,S.useState)(Me),[k,Fe]=(0,S.useState)(!0),[Ie,Le]=(0,S.useState)(!0),[A,Re]=(0,S.useState)(null),[ze,Be]=(0,S.useState)(null),[Ve,He]=(0,S.useState)(null),Ue=(0,S.useRef)(null),We;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(We={setProjectPath:He,setName:p,setValue:h,setRunCmd:se,setCommitMethod:pe,setValidationScript:me,setAllowAllCommands:Oe,setAllowedCommandPatterns:ke,setUseBuiltInBrowser:Fe,setProjectIcon:Re,setOriginalName:Se,setOriginalAllowAllCommands:je,setOriginalAllowedCommandPatterns:Pe,setOriginalUseBuiltInBrowser:Le,setOriginalProjectIcon:Be,setLoading:be,setSaving:ge},t[2]=We):We=t[2];let Ge=We,Ke;t[3]===n?Ke=t[4]:(Ke=()=>_e(n,Ge),t[3]=n,t[4]=Ke);let j=Ke,qe,M;t[5]===n?(qe=t[6],M=t[7]):(qe=()=>{n&&be(!0)},M=[n],t[5]=n,t[6]=qe,t[7]=M),(0,S.useLayoutEffect)(qe,M);let Je,Ye;t[8]===j?(Je=t[9],Ye=t[10]):(Je=()=>{j()},Ye=[j],t[8]=j,t[9]=Je,t[10]=Ye),(0,S.useEffect)(Je,Ye);let Xe;t[11]===T?Xe=t[12]:(Xe=[T],t[11]=T,t[12]=Xe);let Ze=he(n,Xe),Qe;t[13]===Symbol.for(`react.memo_cache_sentinel`)?(Qe=function(e){pe(e)},t[13]=Qe):Qe=t[13];let $e=Qe,{handleProjectIconChange:et,handleProjectIconButtonClick:tt}=De(Re,Ve,Ue),nt;t[14]===n?nt=t[15]:(nt=async()=>{n&&await ye(n,se,ve)},t[14]=n,t[15]=nt);let rt=nt,it;t[16]!==E||t[17]!==O||t[18]!==v||t[19]!==j||t[20]!==f||t[21]!==c||t[22]!==r||t[23]!==Ae||t[24]!==Ne||t[25]!==xe||t[26]!==ze||t[27]!==Ie||t[28]!==A||t[29]!==n||t[30]!==g||t[31]!==k||t[32]!==y||t[33]!==m?(it=async()=>{n&&await Ce(n,{name:f,value:m,runCmd:g,commitMethod:v,validationScript:y,allowAllCommands:E,allowedCommandPatterns:O,useBuiltInBrowser:k,projectIcon:A,originalName:xe,originalAllowAllCommands:Ae,originalAllowedCommandPatterns:Ne,originalUseBuiltInBrowser:Ie,originalProjectIcon:ze},Ge,r,c,j)},t[16]=E,t[17]=O,t[18]=v,t[19]=j,t[20]=f,t[21]=c,t[22]=r,t[23]=Ae,t[24]=Ne,t[25]=xe,t[26]=ze,t[27]=Ie,t[28]=A,t[29]=n,t[30]=g,t[31]=k,t[32]=y,t[33]=m,t[34]=it):it=t[34];let at=it,N=T||b,ot=T||w;if(!n){let e;return t[35]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,C.jsx)(ie,{title:`No project selected`,children:`Please select a project from the sidebar to view its settings.`}),t[35]=e):e=t[35],e}let P;t[36]!==N||t[37]!==at||t[38]!==b?(P=(0,C.jsx)(ue,{title:`Project Settings`,description:`Configure settings for your project.`,action:(0,C.jsx)(Ee,{saving:b,disabled:N,onClick:at}),sticky:!1}),t[36]=N,t[37]=at,t[38]=b,t[39]=P):P=t[39];let st;t[40]===Symbol.for(`react.memo_cache_sentinel`)?(st=e=>p(e.target.value),t[40]=st):st=t[40];let F;t[41]!==T||t[42]!==f?(F=(0,C.jsx)(_,{title:`Project Name`,children:(0,C.jsx)(re,{id:`projectName`,value:f,onChange:st,placeholder:`Enter project name`,disabled:T})}),t[41]=T,t[42]=f,t[43]=F):F=t[43];let ct;t[44]===Symbol.for(`react.memo_cache_sentinel`)?(ct=e=>h(e.target.value),t[44]=ct):ct=t[44];let I;t[45]!==T||t[46]!==m?(I=(0,C.jsx)(_,{title:`Setup Script`,description:`This script runs automatically after cloning the repo for new threads.`,children:(0,C.jsx)(ce,{id:`setupScript`,value:m,onChange:ct,placeholder:`e.g. npm install`,className:`font-mono min-h-[80px] resize-none`,disabled:T})}),t[45]=T,t[46]=m,t[47]=I):I=t[47];let lt;t[48]===Symbol.for(`react.memo_cache_sentinel`)?(lt=e=>me(e.target.value),t[48]=lt):lt=t[48];let L;t[49]!==T||t[50]!==y?(L=(0,C.jsx)(_,{title:`Validation Script`,description:`This script runs after each chat response. If it fails, Tarsk will try to fix issues automatically up to the retry limit.`,children:(0,C.jsx)(ce,{id:`validationScript`,value:y,onChange:lt,placeholder:`e.g. npm run lint && npm test`,className:`font-mono min-h-[80px] resize-none`,disabled:T})}),t[49]=T,t[50]=y,t[51]=L):L=t[51];let ut;t[52]===Symbol.for(`react.memo_cache_sentinel`)?(ut=e=>se(e.target.value),t[52]=ut):ut=t[52];let R;t[53]!==T||t[54]!==g?(R=(0,C.jsx)(re,{id:`runCommand`,value:g,onChange:ut,placeholder:`e.g. npm run dev`,className:`font-mono pr-28`,disabled:T}),t[53]=T,t[54]=g,t[55]=R):R=t[55];let z;t[56]===w?z=t[57]:(z=w?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(s,{className:`h-3 w-3 animate-spin`}),`Suggesting...`]}):`Suggest`,t[56]=w,t[57]=z);let B;t[58]!==rt||t[59]!==ot||t[60]!==z?(B=(0,C.jsx)(u,{variant:`ghost`,size:`sm`,className:`absolute right-1 top-1 h-8`,onClick:rt,disabled:ot,children:z}),t[58]=rt,t[59]=ot,t[60]=z,t[61]=B):B=t[61];let V;t[62]!==R||t[63]!==B?(V=(0,C.jsx)(_,{title:`Run Command`,description:`The command to start the dev server. Leave empty to disable run functionality.`,children:(0,C.jsxs)(`div`,{className:`relative`,children:[R,B]})}),t[62]=R,t[63]=B,t[64]=V):V=t[64];let dt=v===a.PullRequest?`Feature branches are created and pull requests can be created.`:`Commits are made directly to the main branch without feature branches.`,H;t[65]!==v||t[66]!==T?(H=(0,C.jsx)(fe,{commitMethod:v,onCommitMethodChange:$e,disabled:T}),t[65]=v,t[66]=T,t[67]=H):H=t[67];let U;t[68]!==dt||t[69]!==H?(U=(0,C.jsx)(_,{title:`Commit Method`,description:dt,controlLayout:`row-end`,action:H}),t[68]=dt,t[69]=H,t[70]=U):U=t[70];let ft=!E,pt;t[71]===Symbol.for(`react.memo_cache_sentinel`)?(pt=e=>Oe(!e),t[71]=pt):pt=t[71];let W;t[72]!==T||t[73]!==ft?(W=(0,C.jsx)(de,{value:ft,onChange:pt,disabled:T,ariaLabel:`Confirm Commands`}),t[72]=T,t[73]=ft,t[74]=W):W=t[74];let G;t[75]!==E||t[76]!==O||t[77]!==N?(G=!E&&O.length>0&&(0,C.jsx)(we,{allowAllCommands:E,patterns:O,disabled:N,onRemove:e=>ke(t=>t.filter(t=>t!==e))}),t[75]=E,t[76]=O,t[77]=N,t[78]=G):G=t[78];let K;t[79]!==W||t[80]!==G?(K=(0,C.jsx)(_,{title:`Confirm Commands`,description:`When enabled, the agent asks for approval before running bash commands, skill scripts, and browser shell calls.`,controlLayout:`row-end`,action:W,children:G}),t[79]=W,t[80]=G,t[81]=K):K=t[81];let q;t[82]!==N||t[83]!==k?(q=(0,C.jsx)(_,{title:`Built-in Browser`,description:`When enabled, Tarsk shows the Browser tab and opens detected dev URLs in the app. When disabled, the tab is hidden and URLs open in your system browser.`,controlLayout:`row-end`,action:(0,C.jsx)(de,{value:k,onChange:Fe,disabled:N,ariaLabel:`Built-in Browser`})}),t[82]=N,t[83]=k,t[84]=q):q=t[84];let mt;t[85]===Symbol.for(`react.memo_cache_sentinel`)?(mt=()=>Re(null),t[85]=mt):mt=t[85];let J;t[86]!==N||t[87]!==tt||t[88]!==et||t[89]!==A?(J=(0,C.jsx)(_,{title:`Project Icon`,description:`Choose an image to use for this project on the Projects page. It will be center-cropped to a 256×256 PNG.`,controlLayout:`row-end`,action:(0,C.jsx)(Te,{projectIcon:A,disabled:N,inputRef:Ue,onFileChange:et,onButtonClick:tt,onRemove:mt})}),t[86]=N,t[87]=tt,t[88]=et,t[89]=A,t[90]=J):J=t[90];let Y;t[91]!==F||t[92]!==I||t[93]!==L||t[94]!==V||t[95]!==U||t[96]!==K||t[97]!==q||t[98]!==J?(Y=(0,C.jsx)(ae,{className:`max-w-none pt-6`,children:(0,C.jsxs)(ne,{children:[F,I,L,V,U,K,q,J]})}),t[91]=F,t[92]=I,t[93]=L,t[94]=V,t[95]=U,t[96]=K,t[97]=q,t[98]=J,t[99]=Y):Y=t[99];let X;t[100]!==P||t[101]!==Y?(X=(0,C.jsxs)(te,{className:`shrink-0`,children:[P,Y]}),t[100]=P,t[101]=Y,t[102]=X):X=t[102];let ht;t[103]===Symbol.for(`react.memo_cache_sentinel`)?(ht=(0,C.jsx)(ee,{title:`Delete Project`}),t[103]=ht):ht=t[103];let gt;t[104]===Symbol.for(`react.memo_cache_sentinel`)?(gt=(0,C.jsx)(`div`,{className:`min-w-0`,children:(0,C.jsx)(`p`,{className:l(o.bodyMuted),children:`Permanently removes the project, its threads, and all associated storage. This action cannot be undone.`})}),t[104]=gt):gt=t[104];let Z;t[105]!==f||t[106]!==n||t[107]!==d?(Z=()=>{n&&d({id:n,name:f})},t[105]=f,t[106]=n,t[107]=d,t[108]=Z):Z=t[108];let Q;t[109]!==N||t[110]!==Z?(Q=(0,C.jsxs)(te,{className:`shrink-0 rounded-none border-t border-table-border pt-6 mt-8`,children:[ht,(0,C.jsxs)(`div`,{className:`flex flex-col items-start gap-4`,children:[gt,(0,C.jsx)(u,{type:`button`,variant:`destructive`,disabled:N,onClick:Z,children:`Delete Project`})]})]}),t[109]=N,t[110]=Z,t[111]=Q):Q=t[111];let $;return t[112]!==Ze||t[113]!==n||t[114]!==X||t[115]!==Q?($=(0,C.jsxs)(oe,{loading:Ze,children:[X,Q]},n),t[112]=Ze,t[113]=n,t[114]=X,t[115]=Q,t[116]=$):$=t[116],$}export{Oe as default};
|
package/dist/public/assets/{project-tools-view-DknCaJu_.js → project-tools-view-OnCN0jKz.js}
RENAMED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{s as i}from"./chunk-QFMPRPBF-COsSkB7x.js";import{
|
|
1
|
+
import{i as e}from"./rolldown-runtime-aKtaBQYM.js";import{n as t,o as n,t as r}from"./react-vendor-Ee0-5T4I.js";import{s as i}from"./chunk-QFMPRPBF-COsSkB7x.js";import{X as a,ot as o}from"./dist-BWuYHVi8.js";import{Et as s}from"./dist-DIjomljy.js";import{t as c}from"./utils-CT-Dw22R.js";import{t as l}from"./button-DeNw35VZ.js";import{yt as u,zn as d}from"./api-BMo_Lz8f.js";import{t as f}from"./use-toast-xpb5jNtN.js";import{Bn as p,Dn as m,In as h,Ln as g,Nn as _,kn as v,vt as y}from"./index-DjaVbFDB.js";import{t as b}from"./use-settings-page-loading-BTySlInF.js";var x=e(n(),1),S=t(),C=r(),w=a(),T=Math.ceil(w.length/2),E=[w.slice(0,T),w.slice(T)];function D(e){let t=(0,S.c)(14),{tool:n,enabled:r,disabled:i,onToggle:a}=e,s;t[0]!==a||t[1]!==n.name?(s=e=>a(n.name,e),t[0]=a,t[1]=n.name,t[2]=s):s=t[2];let l;t[3]!==i||t[4]!==r||t[5]!==s||t[6]!==n.displayName?(l=(0,C.jsx)(y,{value:r,onChange:s,disabled:i,ariaLabel:n.displayName}),t[3]=i,t[4]=r,t[5]=s,t[6]=n.displayName,t[7]=l):l=t[7];let u;t[8]===Symbol.for(`react.memo_cache_sentinel`)?(u=c(o.body,`truncate`),t[8]=u):u=t[8];let d;t[9]===n.displayName?d=t[10]:(d=(0,C.jsx)(`span`,{className:u,children:n.displayName}),t[9]=n.displayName,t[10]=d);let f;return t[11]!==l||t[12]!==d?(f=(0,C.jsxs)(`div`,{className:`grid min-h-10 grid-cols-[auto_minmax(0,1fr)] items-center gap-3 px-3 py-2`,children:[l,d]}),t[11]=l,t[12]=d,t[13]=f):f=t[13],f}function O(e){let t=(0,S.c)(13),{tools:n,disabledTools:r,disabled:i,forceEnabledTools:a,onToggle:o}=e,s;if(t[0]!==i||t[1]!==r||t[2]!==a||t[3]!==o||t[4]!==n){let e;t[6]!==i||t[7]!==r||t[8]!==a||t[9]!==o?(e=e=>(0,C.jsx)(D,{tool:e,enabled:!r.includes(e.name),disabled:i||a.has(e.name),onToggle:o},e.name),t[6]=i,t[7]=r,t[8]=a,t[9]=o,t[10]=e):e=t[10],s=n.map(e),t[0]=i,t[1]=r,t[2]=a,t[3]=o,t[4]=n,t[5]=s}else s=t[5];let c;return t[11]===s?c=t[12]:(c=(0,C.jsx)(`div`,{className:`divide-y divide-table-border`,children:s}),t[11]=s,t[12]=c),c}function k(e){let t=(0,S.c)(23),{disabledTools:n,onChange:r,disabled:i,forceEnabledTools:a}=e,o=i===void 0?!1:i,s;t[0]===a?s=t[1]:(s=new Set((a??[]).map(A)),t[0]=a,t[1]=s);let c=s,l;t[2]!==n||t[3]!==c||t[4]!==r?(l=function(e,t){let i=e.toLowerCase();if(!(c.has(i)&&!t)){if(t){r(n.filter(e=>e!==i));return}n.includes(i)||r([...n,i].sort())}},t[2]=n,t[3]=c,t[4]=r,t[5]=l):l=t[5];let u=l,d;t[6]!==o||t[7]!==n||t[8]!==c||t[9]!==u?(d=w.map(e=>(0,C.jsx)(D,{tool:e,enabled:!n.includes(e.name),disabled:o||c.has(e.name),onToggle:u},e.name)),t[6]=o,t[7]=n,t[8]=c,t[9]=u,t[10]=d):d=t[10];let f;t[11]===d?f=t[12]:(f=(0,C.jsx)(`div`,{className:`divide-y divide-table-border @md/settings-page:hidden`,children:d}),t[11]=d,t[12]=f);let p;t[13]!==o||t[14]!==n||t[15]!==c||t[16]!==u?(p=E.map((e,t)=>(0,C.jsx)(O,{tools:e,disabledTools:n,disabled:o,forceEnabledTools:c,onToggle:u},t)),t[13]=o,t[14]=n,t[15]=c,t[16]=u,t[17]=p):p=t[17];let m;t[18]===p?m=t[19]:(m=(0,C.jsx)(`div`,{className:`hidden @md/settings-page:grid @md/settings-page:grid-cols-2 divide-x divide-table-border`,children:p}),t[18]=p,t[19]=m);let h;return t[20]!==f||t[21]!==m?(h=(0,C.jsxs)(C.Fragment,{children:[f,m]}),t[20]=f,t[21]=m,t[22]=h):h=t[22],h}function A(e){return e.toLowerCase()}function j({projectId:e,onProjectUpdated:t}){let n=i(),[r,a]=(0,x.useState)([]),[o,c]=(0,x.useState)([]),[S,w]=(0,x.useState)(!1),[T,E]=(0,x.useState)(!1),[D,O]=(0,x.useState)(!0),[A,j]=(0,x.useState)(!1),M=(0,x.useCallback)(async()=>{if(!e){O(!1);return}O(!0);try{let t=await u(e),n=t.disabledTools??[],r=t.smartJsEnabled===!0;a(n),c(n),w(r),E(r)}catch(e){f({title:`Error`,description:e instanceof Error?e.message:`Failed to load tools settings`,variant:`destructive`})}finally{O(!1)}},[e]);(0,x.useLayoutEffect)(()=>{e&&O(!0)},[e]),(0,x.useEffect)(()=>{M()},[M]);let N=b(e,[D]);function P(){return JSON.stringify([...r].sort())!==JSON.stringify([...o].sort())}function F(){return P()||S!==T}async function I(){if(!(!e||!F())){j(!0);try{let i={};P()&&(i.disabledTools=r.length>0?r:null),S!==T&&(i.smartJsEnabled=S),await d(e,i),c(r),E(S),t&&await t(),await M(),n(`/`)}catch(e){f({title:`Error`,description:e instanceof Error?e.message:`Failed to save tools settings`,variant:`destructive`})}finally{j(!1)}}}function L(e){w(e),e&&a(e=>e.filter(e=>e!==`run_js`))}return e?(0,C.jsx)(_,{loading:N,children:(0,C.jsxs)(p,{className:`shrink-0`,children:[(0,C.jsx)(v,{title:`Tools`,description:`Control which tools the agent can use in this project. Disabled tools are hidden from the agent.`,action:(0,C.jsx)(l,{onClick:()=>void I(),disabled:A||D,children:A?(0,C.jsxs)(C.Fragment,{children:[(0,C.jsx)(s,{className:`mr-2 h-4 w-4 animate-spin`}),`Saving...`]}):`Save`}),sticky:!1}),(0,C.jsxs)(g,{className:`max-w-none pt-6`,children:[(0,C.jsx)(m,{title:`Smart JS`,description:`When enabled, the agent orchestrates tools by writing JavaScript for Run JS (except Ask, Write, and Subagent). Other tools stay available through callTool inside the worker.`,controlLayout:`row-end`,action:(0,C.jsx)(y,{value:S,onChange:L,disabled:D||A,ariaLabel:`Smart JS`})}),(0,C.jsx)(`div`,{className:`mt-8`,children:(0,C.jsx)(k,{disabledTools:r,onChange:a,disabled:D||A,forceEnabledTools:S?[`run_js`]:void 0})})]})]})}):(0,C.jsx)(h,{title:`No project selected`,children:`Please select a project from the sidebar to configure tools.`})}export{j as default};
|