tarsk 0.4.28 → 0.4.30
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 +774 -373
- package/dist/public/assets/{account-view-DcpSNB3N.js → account-view-wqPOnMfW.js} +1 -1
- package/dist/public/assets/alert-dialog-Dj0hDlZC.js +1 -0
- package/dist/public/assets/api-RbLAI1bg.js +1 -0
- package/dist/public/assets/{browser-tab-CiAz6nc1.js → browser-tab-BjqSmZHm.js} +1 -1
- package/dist/public/assets/chat-input-container-BNOl7YtC.js +21 -0
- package/dist/public/assets/codicon-ngg6Pgfi.ttf +0 -0
- package/dist/public/assets/context-menu-XD6khGRr.js +1 -0
- package/dist/public/assets/conversation-history-view-BRSNoBYn.js +1 -0
- package/dist/public/assets/css.worker-DyDu5ynT.js +89 -0
- package/dist/public/assets/{dialogs-config-vkfELnGl.js → dialogs-config-BXDglGdB.js} +14 -14
- package/dist/public/assets/diff-view-DiNlWcSj.js +3 -0
- package/dist/public/assets/explorer-tab-view-DbMBihAH.js +2 -0
- package/dist/public/assets/{explorer-tree-DTFYhczJ.js → explorer-tree-D0P-HUYS.js} +1 -1
- package/dist/public/assets/{explorer-view-C0KcZ8NQ.js → explorer-view-CL_9lhkq.js} +1 -1
- package/dist/public/assets/history-view-i7fGKCkc.js +1 -0
- package/dist/public/assets/html.worker-IWNXhnIC.js +502 -0
- package/dist/public/assets/index-BeLCtY82.css +1 -0
- package/dist/public/assets/index-CZZ6Jb9i.js +29 -0
- package/dist/public/assets/json.worker-c4h5s80L.js +58 -0
- package/dist/public/assets/markdown-renderer-CPSKOcqK.js +10 -0
- package/dist/public/assets/mcp-server-card-DFATg_Ie.js +1 -0
- package/dist/public/assets/monaco-BGyhgQtx.js +1209 -0
- package/dist/public/assets/monaco-Br_kD0ds.css +1 -0
- package/dist/public/assets/onboarding-5CTkrfwe.js +1 -0
- package/dist/public/assets/onboarding-dialog-gcZ9aKKp.js +1 -0
- package/dist/public/assets/page-toolbar-CbwENcML.js +1 -0
- package/dist/public/assets/project-settings-view-CRRJPGNL.js +1 -0
- package/dist/public/assets/providers-list-view-D3CIB4ou.js +1 -0
- package/dist/public/assets/radio-group-qCcnwXV3.js +1 -0
- package/dist/public/assets/react-vendor-Bpg1hd5i.js +22 -0
- package/dist/public/assets/resizable-BLhzHL_f.js +1 -0
- package/dist/public/assets/{run-stop-button-DZ4JFwdL.js → run-stop-button-CIuDOHFg.js} +2 -2
- package/dist/public/assets/settings-general-view-7Y0c9534.js +1 -0
- package/dist/public/assets/{settings-instructions-view-DWzAH2yN.js → settings-instructions-view-B-uTQrNZ.js} +1 -1
- package/dist/public/assets/settings-mcp-servers-view-nAMQQWHb.js +5 -0
- package/dist/public/assets/settings-models-skeleton-CffyGIvJ.js +1 -0
- package/dist/public/assets/settings-models-view-CMZh5LlR.js +1 -0
- package/dist/public/assets/settings-rules-view-BaNccq1v.js +8 -0
- package/dist/public/assets/{settings-skills-view-DV40_L1o.js → settings-skills-view-DBX7obT7.js} +2 -2
- package/dist/public/assets/{settings-slash-commands-view-BEk3BgOY.js → settings-slash-commands-view-BoT1nCir.js} +1 -1
- package/dist/public/assets/{settings-subagents-view-d3P4ylDX.js → settings-subagents-view-Cy87X2bs.js} +2 -2
- package/dist/public/assets/settings-view-CS-RnV6J.js +2 -0
- package/dist/public/assets/side-panel-container-B33_hnhc.js +2 -0
- package/dist/public/assets/skeleton-n47_ST9G.js +1 -0
- package/dist/public/assets/standard-list-item-BLTOBGFa.js +1 -0
- package/dist/public/assets/store-B9rEO6q-.js +4 -0
- package/dist/public/assets/{tab-context-DWD20a4z.js → tab-context-BUUT3x3d.js} +1 -1
- package/dist/public/assets/tabs--5y6mYhG.js +1 -0
- package/dist/public/assets/{terminal-panel-CkIe2d2K.js → terminal-panel-BCHLDUbD.js} +2 -2
- package/dist/public/assets/textarea-CwXpBxom.js +1 -0
- package/dist/public/assets/todos-view-k0k8R9NT.js +1 -0
- package/dist/public/assets/ts.worker-BwM5Ha3L.js +67719 -0
- package/dist/public/assets/use-font-size-BJl84s49.js +1 -0
- package/dist/public/assets/{use-toast-yY7qQuQP.js → use-toast-C5s-Xnwi.js} +1 -1
- package/dist/public/assets/{utils-BKss67Vg.js → utils-CDrGT12s.js} +1 -1
- package/dist/public/assets/{whisper-wasm-B7iuRPFr.js → whisper-wasm-C_Ot631g.js} +1 -1
- package/dist/public/index.html +24 -22
- package/package.json +2 -2
- package/dist/public/assets/alert-dialog-CQRWdGnn.js +0 -1
- package/dist/public/assets/api-CH5gAPs5.js +0 -1
- package/dist/public/assets/chat-input-container-C6U_WFFu.js +0 -21
- package/dist/public/assets/context-menu-A9p22S7d.js +0 -1
- package/dist/public/assets/conversation-history-view-CD_uVRNY.js +0 -1
- package/dist/public/assets/diff-view-CjbcDB6m.js +0 -3
- package/dist/public/assets/explorer-tab-view-BfycKUUW.js +0 -2
- package/dist/public/assets/history-view-Dn0hQIKU.js +0 -1
- package/dist/public/assets/index-Bdde81Uo.css +0 -1
- package/dist/public/assets/index-DKQVo4Vz.js +0 -29
- package/dist/public/assets/markdown-renderer-CNuyXHcy.js +0 -10
- package/dist/public/assets/mcp-server-card-DBEBe3Qh.js +0 -1
- package/dist/public/assets/monaco-SWcefg0q.js +0 -11
- package/dist/public/assets/onboarding-DslO5AS6.js +0 -1
- package/dist/public/assets/onboarding-dialog-CE-GhoDt.js +0 -1
- package/dist/public/assets/page-toolbar-CloU_Kvo.js +0 -1
- package/dist/public/assets/project-settings-view-CxD9JZoB.js +0 -1
- package/dist/public/assets/providers-list-view-CNxVBJlM.js +0 -1
- package/dist/public/assets/radio-group-Co0Lg6se.js +0 -1
- package/dist/public/assets/react-vendor-DyE9sO8V.js +0 -22
- package/dist/public/assets/resizable-dToeUeVD.js +0 -1
- package/dist/public/assets/settings-mcp-servers-view-q6gGMMVX.js +0 -5
- package/dist/public/assets/settings-models-view-BDDFQWWC.js +0 -1
- package/dist/public/assets/settings-rules-view-DsEwgDFr.js +0 -8
- package/dist/public/assets/settings-view-ClTMPafQ.js +0 -2
- package/dist/public/assets/side-panel-container-BAYoMt7B.js +0 -2
- package/dist/public/assets/skeleton-DveUQR4w.js +0 -1
- package/dist/public/assets/standard-list-item-BLlgm1qW.js +0 -1
- package/dist/public/assets/store-BcwWHqYr.js +0 -4
- package/dist/public/assets/tabs-CgvpwOBj.js +0 -1
- package/dist/public/assets/textarea-C2UIAa7y.js +0 -1
- package/dist/public/assets/todos-view-C-awG1dZ.js +0 -1
- /package/dist/public/assets/{dist-Bjt_i1zi.js → dist-CAVGqbBm.js} +0 -0
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Bi as t,Ci as n,Er as r,Jn as i,Kn as a,Li as o,Ln as s,Nr as c,On as l,Pt as u,Ri as d,Si as f,Un as p,Wn as m,_a as h,aa as g,et as _,ft as v,ha as y,ia as b,mi as x,oi as S,ot as C,pi as w,qn as T,qt as E,wr as D,xi as O,yi as k}from"./dialogs-config-BXDglGdB.js";import{D as ee}from"./react-vendor-Bpg1hd5i.js";import{Mt as A}from"./monaco-BGyhgQtx.js";import{a as j,t as M}from"./store-B9rEO6q-.js";import{t as N}from"./textarea-CwXpBxom.js";import{c as P,s as te,u as ne}from"./history-view-i7fGKCkc.js";import{b as re,t as ie}from"./chat-input-container-BNOl7YtC.js";import{t as F}from"./standard-list-item-BLTOBGFa.js";import{n as ae}from"./utils-CDrGT12s.js";import{t as oe}from"./page-toolbar-CbwENcML.js";import{n as se,r as ce,t as I}from"./resizable-BLhzHL_f.js";import{a as L,n as R,r as le,t as z}from"./context-menu-XD6khGRr.js";var B=e(h(),1),V=y(),H=c();function U(e){let t=(0,V.c)(17),{children:n,title:r,headerAction:i,footer:a}=e,o;t[0]===r?o=t[1]:(o=r&&(0,H.jsx)(`span`,{className:`text-sm font-semibold tracking-tight`,children:r}),t[0]=r,t[1]=o);let c;t[2]===o?c=t[3]:(c=(0,H.jsx)(`div`,{className:`flex items-center gap-2`,children:o}),t[2]=o,t[3]=c);let l;t[4]===i?l=t[5]:(l=i&&(0,H.jsx)(`div`,{className:`flex items-center gap-2 ml-auto`,children:i}),t[4]=i,t[5]=l);let u;t[6]!==c||t[7]!==l?(u=(0,H.jsxs)(`div`,{className:`flex items-center justify-between border-b border-sidebar-border px-4 py-6`,children:[c,l]}),t[6]=c,t[7]=l,t[8]=u):u=t[8];let d;t[9]===n?d=t[10]:(d=(0,H.jsx)(s,{className:`flex-1`,children:n}),t[9]=n,t[10]=d);let f;t[11]===a?f=t[12]:(f=a&&(0,H.jsx)(`div`,{className:`border-t border-sidebar-border`,children:a}),t[11]=a,t[12]=f);let p;return t[13]!==u||t[14]!==d||t[15]!==f?(p=(0,H.jsxs)(`div`,{className:`flex flex-col h-full`,children:[u,d,f]}),t[13]=u,t[14]=d,t[15]=f,t[16]=p):p=t[16],p}function ue(e){let t=[],n={};return e.forEach((e,r)=>{let i=e.path.split(`/`),a=t,o=``;for(let e=0;e<i.length-1;e++){if(o=o?`${o}/${i[e]}`:i[e],!n[o]){let t={id:`dir:${o}`,name:i[e],children:[]};n[o]=t,a.push(t)}a=n[o].children}a.push({id:`file:${e.path}`,name:i[i.length-1],fileIndex:r,status:e.status})}),t}var W={added:`text-green-500`,deleted:`text-red-500`,untracked:`text-green-500`,renamed:`text-blue-500`,modified:`text-orange-500`},G={added:`A`,deleted:`D`,untracked:`U`,renamed:`R`,modified:`M`};function K(e){return r(`status-badge font-mono text-xs font-semibold`,W[e]??`text-orange-500`)}function de(e){return G[e]??`M`}function fe(e){let i=(0,V.c)(37),{treeData:a,files:s,isLoading:c,error:l,selectedFileIndex:u,onFileSelect:f,onRevertFile:p}=e,m;i[0]===s?m=i[1]:(m=s.reduce(he,0),i[0]=s,i[1]=m);let h=m,g;i[2]===s?g=i[3]:(g=s.reduce(pe,0),i[2]=s,i[3]=g);let _=g,v=s.length===1?``:`s`,y;i[4]!==s.length||i[5]!==v?(y=(0,H.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[s.length,` file`,v]}),i[4]=s.length,i[5]=v,i[6]=y):y=i[6];let x;i[7]===h?x=i[8]:(x=(0,H.jsxs)(`span`,{className:`text-xs text-green-500`,children:[`+`,h]}),i[7]=h,i[8]=x);let C;i[9]===_?C=i[10]:(C=(0,H.jsxs)(`span`,{className:`text-xs text-red-500`,children:[`-`,_]}),i[9]=_,i[10]=C);let w;i[11]!==y||i[12]!==x||i[13]!==C?(w=(0,H.jsxs)(`div`,{className:`flex items-center gap-1`,children:[y,x,C]}),i[11]=y,i[12]=x,i[13]=C,i[14]=w):w=i[14];let T=w;if(c){let e;i[15]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center pt-3 pb-2`,children:(0,H.jsx)(n,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),i[15]=e):e=i[15];let t;return i[16]===T?t=i[17]:(t=(0,H.jsx)(U,{title:`Review Changes`,headerAction:T,children:e}),i[16]=T,i[17]=t),t}if(l){let e;i[18]===l?e=i[19]:(e=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,H.jsx)(`p`,{className:`text-destructive text-xs text-center`,children:l})}),i[18]=l,i[19]=e);let t;return i[20]!==T||i[21]!==e?(t=(0,H.jsx)(U,{title:`Review Changes`,headerAction:T,children:e}),i[20]=T,i[21]=e,i[22]=t):t=i[22],t}if(s.length===0){let e;i[23]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,H.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,H.jsx)(`p`,{className:`text-muted-foreground text-xs text-center`,children:`No changes to review`})}),i[23]=e):e=i[23];let t;return i[24]===T?t=i[25]:(t=(0,H.jsx)(U,{title:`Review Changes`,headerAction:T,children:e}),i[24]=T,i[25]=t),t}let E;i[26]!==s||i[27]!==f||i[28]!==p||i[29]!==u?(E=(e,n)=>{let{isOpen:i,toggle:a}=n,c=!!e.children,l=(0,H.jsxs)(F,{onClick:()=>{c?a():e.fileIndex!==void 0&&f(e.fileIndex)},selected:!c&&e.fileIndex===u,className:`gap-1.5`,children:[c?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(b,{className:r(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,i&&`rotate-90`)}),i?(0,H.jsx)(d,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,H.jsx)(o,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,H.jsx)(t,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,H.jsx)(`span`,{className:`truncate flex-1 min-w-0`,children:e.name}),!c&&e.status&&(0,H.jsx)(`span`,{className:K(e.status),children:de(e.status)})]});return c?l:(0,H.jsxs)(z,{children:[(0,H.jsx)(L,{asChild:!0,children:l}),(0,H.jsx)(R,{children:(0,H.jsxs)(le,{onClick:()=>{e.fileIndex!==void 0&&p?.(s[e.fileIndex])},children:[(0,H.jsx)(S,{className:`mr-2 h-3.5 w-3.5`}),`Revert Change`]})})]})},i[26]=s,i[27]=f,i[28]=p,i[29]=u,i[30]=E):E=i[30];let D;i[31]!==E||i[32]!==a?(D=(0,H.jsx)(`div`,{className:`flex-1 overflow-y-auto pt-3 pb-2 px-1`,children:(0,H.jsx)(re,{nodes:a,defaultOpen:!0,resetKey:a,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:E})}),i[31]=E,i[32]=a,i[33]=D):D=i[33];let O;return i[34]!==T||i[35]!==D?(O=(0,H.jsx)(U,{title:`Review Changes`,headerAction:T,children:D}),i[34]=T,i[35]=D,i[36]=O):O=i[36],O}function pe(e,t){return e+t.hunks.reduce(q,0)}function q(e,t){return e+t.changes.filter(me).length}function me(e){return e.type===`delete`}function he(e,t){return e+t.hunks.reduce(J,0)}function J(e,t){return e+t.changes.filter(ge).length}function ge(e){return e.type===`add`}function _e(e){let t=(0,V.c)(2),{isOpen:n}=e,r=n===void 0||n?`ml-[-40px]`:``,i;return t[0]===r?i=t[1]:(i=(0,H.jsx)(I,{withHandle:!0,className:r}),t[0]=r,t[1]=i),i}function ve(e){let t=(0,V.c)(35),{open:n,lineNumber:r,lineContent:o,initialComment:s,isEditing:c,onSave:l,onDelete:u,onClose:d}=e,[f,h]=(0,B.useState)((s===void 0?``:s)??``),g;t[0]!==l||t[1]!==f?(g=()=>{f.trim()&&l(f.trim())},t[0]=l,t[1]=f,t[2]=g):g=t[2];let _=g,v;t[3]===_?v=t[4]:(v=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),_())},t[3]=_,t[4]=v);let y=v,b;t[5]===d?b=t[6]:(b=e=>{e||d()},t[5]=d,t[6]=b);let x;t[7]===r?x=t[8]:(x=(0,H.jsx)(T,{children:(0,H.jsxs)(i,{className:`text-sm font-medium`,children:[`Comment on line `,r]})}),t[7]=r,t[8]=x);let S=o||` `,C;t[9]===S?C=t[10]:(C=(0,H.jsx)(`div`,{className:`rounded bg-muted px-3 py-2 font-mono text-xs text-muted-foreground overflow-x-auto whitespace-pre`,children:S}),t[9]=S,t[10]=C);let w;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(w=e=>h(e.target.value),t[11]=w):w=t[11];let E;t[12]!==y||t[13]!==f?(E=(0,H.jsx)(N,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:f,onChange:w,onKeyDown:y,rows:12,className:`resize-none text-sm`}),t[12]=y,t[13]=f,t[14]=E):E=t[14];let O;t[15]!==c||t[16]!==u?(O=c&&u&&(0,H.jsx)(D,{variant:`destructive`,size:`sm`,onClick:u,className:`mr-auto`,children:`Delete`}),t[15]=c,t[16]=u,t[17]=O):O=t[17];let k;t[18]===f?k=t[19]:(k=f.trim(),t[18]=f,t[19]=k);let ee=!k,A;t[20]!==_||t[21]!==ee?(A=(0,H.jsx)(D,{size:`sm`,onClick:_,disabled:ee,children:`Save`}),t[20]=_,t[21]=ee,t[22]=A):A=t[22];let j;t[23]!==O||t[24]!==A?(j=(0,H.jsxs)(a,{className:`gap-2 sm:gap-0`,children:[O,A]}),t[23]=O,t[24]=A,t[25]=j):j=t[25];let M;t[26]!==j||t[27]!==x||t[28]!==C||t[29]!==E?(M=(0,H.jsxs)(m,{className:`max-w-2xl`,children:[x,C,E,j]}),t[26]=j,t[27]=x,t[28]=C,t[29]=E,t[30]=M):M=t[30];let P;return t[31]!==n||t[32]!==M||t[33]!==b?(P=(0,H.jsx)(p,{open:n,onOpenChange:b,children:M}),t[31]=n,t[32]=M,t[33]=b,t[34]=P):P=t[34],P}function Y({threadId:e,onExit:t}){let{state:n,dispatch:i}=j(),{resolvedTheme:a}=ae(),[o,s]=(0,B.useState)([]),[c,d]=(0,B.useState)(!0),[p,m]=(0,B.useState)(null),[h,y]=(0,B.useState)(0),[S,T]=(0,B.useState)(!1),[N,re]=(0,B.useState)(!1),F=(0,B.useRef)(null),I=(0,B.useMemo)(()=>n.diffComments[e]??[],[n.diffComments,e]),L=(0,B.useCallback)(t=>{let r=n.diffComments[e]??[],a=typeof t==`function`?t(r):t;i({type:M.SetDiffComments,threadId:e,comments:a})},[i,e,n.diffComments]),[R,le]=(0,B.useState)(null),[z,V]=(0,B.useState)(null),[U,W]=(0,B.useState)(null),G=(0,B.useRef)(null),K=(0,B.useRef)(I),de=(0,B.useRef)(R),pe=(0,B.useRef)({isFullView:S,selectedFileIndex:h,files:o}),q=(0,B.useRef)({original:[],modified:[]}),me=(0,B.useRef)(!0);(0,B.useEffect)(()=>{K.current=I},[I]),(0,B.useEffect)(()=>{de.current=R},[R]),(0,B.useEffect)(()=>{pe.current={isFullView:S,selectedFileIndex:h,files:o}},[S,h,o]);let he=(0,B.useCallback)(()=>{F.current&&(N?F.current.expand():F.current.collapse())},[N]),J=(0,B.useCallback)(async()=>{if(e){d(!0),m(null);try{s((await v(e)).files||[]),y(0)}catch(e){m(e instanceof Error?e.message:`Failed to load diff`)}finally{d(!1)}}},[e]);(0,B.useEffect)(()=>{J()},[J]);let ge=(0,B.useCallback)(async t=>{try{await E(e,t.path),await J()}catch(e){m(e instanceof Error?e.message:`Failed to revert file`)}},[e,J]),Y=(0,B.useRef)(!1);(0,B.useEffect)(()=>{if((n.diffComments[e]??[]).length>0){Y.current=!0;return}u(e).then(t=>{t.diffComments&&t.diffComments.length>0&&i({type:M.SetDiffComments,threadId:e,comments:t.diffComments}),Y.current=!0}).catch(()=>{Y.current=!0})},[e]),(0,B.useEffect)(()=>{Y.current&&l(e,{diffComments:I}).catch(()=>{})},[e,I]);let ye=(0,B.useMemo)(()=>ue(o),[o]),X=e=>{if(e.hunks.length===0)return null;let t=1/0,n=0;return e.hunks.forEach(e=>{let r=Math.min(e.oldStart,e.newStart),i=e.oldStart+e.oldLines,a=e.newStart+e.newLines,o=Math.max(i,a);t=Math.min(t,r),n=Math.max(n,o)}),t===1/0?null:{startLine:Math.max(1,t-2),endLine:n+2}},be=(e,t,n)=>e.split(`
|
|
2
|
+
`).slice(t-1,n).join(`
|
|
3
|
+
`),xe=e=>{let t=X(e);return t?t.startLine<=1:!0},Se=e=>({ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,rb:`ruby`,go:`go`,rs:`rust`,java:`java`,kt:`kotlin`,swift:`swift`,c:`c`,cpp:`cpp`,h:`c`,hpp:`cpp`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`})[e.split(`.`).pop()??``]||`plaintext`,Z=o[h],Ce=Z?S?Z.oldContent:(()=>{let e=X(Z);return e?be(Z.oldContent,e.startLine,e.endLine):Z.oldContent})():``,we=Z?S?Z.newContent:(()=>{let e=X(Z);return e?be(Z.newContent,e.startLine,e.endLine):Z.newContent})():``,Q=(0,B.useCallback)(()=>{if(!me.current)return;let e=G.current;if(!e)return;let{isFullView:t,selectedFileIndex:n,files:r}=pe.current,i=K.current,a=de.current,o=r[n];if(!o)return;let s=(e,r)=>{let s=t?null:X(o),c=i.filter(e=>e.fileIndex===n&&e.side===r),l=new Set(c.map(e=>s?e.lineNumber-s.startLine+1:e.lineNumber)),u=e.getModel()?.getLineCount()??0,d=[];for(let e=1;e<=u;e++)l.has(e)||d.push({range:{startLineNumber:e,startColumn:1,endLineNumber:e,endColumn:1},options:{isWholeLine:!0,glyphMarginClassName:`diff-gutter-add-comment`,glyphMarginHoverMessage:{value:`$(add) Click to add a comment`},stickiness:A.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}});let f=c.map(e=>{let t=s?e.lineNumber-s.startLine+1:e.lineNumber;if(t<1)return null;let n=i.indexOf(e)===a;return{range:{startLineNumber:t,startColumn:1,endLineNumber:t,endColumn:1},options:{isWholeLine:!0,className:n?`diff-comment-active-line`:`diff-comment-marked-line`,glyphMarginClassName:n?`diff-comment-glyph-active`:`diff-comment-glyph`,glyphMarginHoverMessage:{value:e.comment},stickiness:A.TrackedRangeStickiness.NeverGrowsWhenTypingAtEdges}}}).filter(e=>e!==null);d.push(...f);let p=r===`original`?q.current.original:q.current.modified,m=e.deltaDecorations(p,d);r===`original`?q.current.original=m:q.current.modified=m};s(e.getOriginalEditor(),`original`),s(e.getModifiedEditor(),`modified`)},[]);(0,B.useEffect)(()=>{Q()},[Q,I,R,h,S,Z]),(0,B.useEffect)(()=>()=>{G.current=null,q.current={original:[],modified:[]}},[h]),(0,B.useEffect)(()=>()=>{me.current=!1,G.current&&=(G.current.getOriginalEditor().getModel()?.dispose(),G.current.getModifiedEditor().getModel()?.dispose(),G.current.dispose(),null),q.current={original:[],modified:[]}},[]);let Te=(0,B.useCallback)(e=>{G.current=e;let t=e=>e===A.MouseTargetType.GUTTER_GLYPH_MARGIN||e===A.MouseTargetType.GUTTER_LINE_NUMBERS||e===A.MouseTargetType.GUTTER_LINE_DECORATIONS||e===A.MouseTargetType.GUTTER_VIEW_ZONE,n=(e,n)=>{e.onMouseDown(r=>{if(!r.target?.position||!t(r.target.type))return;let i=r.target.position.lineNumber,{isFullView:a,selectedFileIndex:o,files:s}=pe.current,c=s[o];if(!c)return;let l=a?null:X(c),u=l?l.startLine+i-1:i,d=e.getModel()?.getLineContent(i)??``,f=K.current.find(e=>e.fileIndex===o&&e.lineNumber===u&&e.side===n);f?W(f):V({lineNumber:u,lineContent:d,side:n})})};n(e.getOriginalEditor(),`original`),n(e.getModifiedEditor(),`modified`),setTimeout(()=>{G.current===e&&Q()},150)},[Q]),Ee=(0,B.useCallback)(e=>{if(z&&Z){let t={id:`comment-${Date.now()}`,filePath:Z.path,fileIndex:h,lineNumber:z.lineNumber,lineContent:z.lineContent,comment:e,side:z.side};L(e=>[...e,t]),V(null)}else U&&(L(t=>t.map(t=>t.id===U.id?{...t,comment:e}:t)),W(null))},[z,U,Z,h,L]),De=(0,B.useCallback)(()=>{U&&(L(e=>e.filter(e=>e.id!==U.id)),W(null))},[U,L]),$=(0,B.useCallback)(e=>{if(I.length===0)return;let t=(e%I.length+I.length)%I.length,n=I[t];le(t),y(n.fileIndex),setTimeout(()=>{let e=G.current;if(!e)return;let t=o[n.fileIndex];if(!t)return;let r=S?null:X(t),i=r?n.lineNumber-r.startLine+1:n.lineNumber;(n.side===`original`?e.getOriginalEditor():e.getModifiedEditor()).revealLineInCenter(Math.max(1,i)),Q()},100)},[I,o,S,Q]),Oe=(0,B.useCallback)(()=>{$((R??0)-1)},[$,R]),ke=(0,B.useCallback)(()=>{$((R??-1)+1)},[$,R]),Ae=(0,B.useCallback)(async()=>{let r=n.projectModelSelections[e];if(!r)try{let e=await C(),t=Object.values(e).flat();if(t.length>0)r=t[0];else{console.error(`No models available to process comments`);return}}catch(e){console.error(`Failed to load models:`,e);return}let a=r.id,o=r.provider;try{let{prompt:n}=await _(e,I);L([]),i({type:M.SetPendingChatMessage,message:{threadId:e,message:n,model:a,provider:o}}),t()}catch(e){console.error(`Failed to fix comments:`,e),typeof window<`u`&&window.alert(`Failed to process comments. Please try again.`)}},[I,n.projectModelSelections,i,e,t,L]),je={readOnly:!0,renderSideBySide:!0,ignoreTrimWhitespace:!1,renderOverviewRuler:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},folding:!1,glyphMargin:!0,lineNumbers:Z&&(S||xe(Z))?`on`:`off`,diffWordWrap:`on`,originalEditable:!1,automaticLayout:!0};return(0,H.jsxs)(`div`,{className:`diff-view-root flex h-full flex-col`,children:[(0,H.jsx)(`div`,{className:`diff-body flex flex-1 overflow-hidden`,children:(0,H.jsxs)(ce,{direction:`horizontal`,children:[(0,H.jsx)(se,{ref:F,defaultSize:25,minSize:12,maxSize:40,collapsible:!0,collapsedSize:0,onCollapse:()=>re(!0),onExpand:()=>re(!1),className:`border-r border-transparent`,children:(0,H.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,H.jsx)(fe,{treeData:ye,files:o,isLoading:c,error:p,selectedFileIndex:h,onFileSelect:y,onRevertFile:ge})})}),(0,H.jsx)(_e,{isOpen:!N}),(0,H.jsx)(se,{className:`overflow-hidden bg-transparent`,children:(0,H.jsxs)(`div`,{className:`diff-editor-panel flex h-full bg-transparent flex-col overflow-hidden`,children:[(0,H.jsxs)(oe,{className:r(`bg-transparent`,N&&`h-auto py-3 flex-col items-start gap-3 md:flex-row md:items-center md:h-[71px] md:py-0 md:gap-2 justify-between`),children:[(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(D,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:he,children:[N?(0,H.jsx)(w,{className:`h-4 w-4`}):(0,H.jsx)(x,{className:`h-4 w-4`}),(0,H.jsx)(`span`,{className:`sr-only`,children:`Toggle file tree`})]}),(0,H.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:Z?Z.path:`Review Changes`})]}),(0,H.jsxs)(`div`,{className:r(`flex items-center gap-2`,N&&`ml-0`,!N&&`ml-auto`,`md:ml-auto`),children:[(0,H.jsx)(D,{variant:`ghost`,size:`sm`,onClick:()=>T(e=>!e),disabled:!Z,className:`h-8 gap-1 px-2 text-xs`,children:S?(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(k,{className:`h-3 w-3`}),` Show changes only`]}):(0,H.jsxs)(H.Fragment,{children:[(0,H.jsx)(f,{className:`h-3 w-3`}),` Show full file`]})}),I.length>0&&(0,H.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,H.jsxs)(te,{children:[(0,H.jsx)(ne,{asChild:!0,children:(0,H.jsx)(D,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Oe,disabled:(R??0)===0,children:(0,H.jsx)(g,{className:`h-3 w-3`})})}),(0,H.jsx)(P,{children:`Previous comment`})]}),(0,H.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:I.length===1?`1 Comment`:`Comment ${(R??0)+1} of ${I.length}`}),(0,H.jsxs)(te,{children:[(0,H.jsx)(ne,{asChild:!0,children:(0,H.jsx)(D,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:ke,disabled:(R??0)===I.length-1,children:(0,H.jsx)(b,{className:`h-3 w-3`})})}),(0,H.jsx)(P,{children:`Next comment`})]})]}),I.length>0&&(0,H.jsxs)(te,{children:[(0,H.jsx)(ne,{asChild:!0,children:(0,H.jsxs)(D,{size:`sm`,onClick:Ae,className:`h-8 gap-1 px-3 text-xs bg-foreground text-background hover:bg-foreground/90`,children:[(0,H.jsx)(O,{className:`h-3 w-3`}),`Fix all comments`]})}),(0,H.jsx)(P,{children:`Send all comments to Tarsk for resolution`})]})]})]}),(0,H.jsxs)(`div`,{className:`flex-1 bg-transparent relative`,children:[(0,H.jsx)(ee,{height:`100%`,language:Se(Z?.path||``),original:Ce,modified:we,theme:a===`dark`?`vs-dark`:`vs-light`,onMount:Te,options:je},`diff-${h}`),(0,H.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0`,children:(0,H.jsx)(ie,{})})]})]})})]})}),(0,H.jsx)(ve,{open:z!==null||U!==null,lineNumber:U?.lineNumber??z?.lineNumber??0,lineContent:U?.lineContent??z?.lineContent??``,initialComment:U?.comment,isEditing:U!==null,onSave:Ee,onDelete:De,onClose:()=>{V(null),W(null)}},`${U?.id??``}-${z?.lineNumber??``}-${z?.side??``}`)]})}export{Y as DiffView,Y as default};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/explorer-tree-D0P-HUYS.js","assets/rolldown-runtime-B1FJdls4.js","assets/dialogs-config-BXDglGdB.js","assets/api-RbLAI1bg.js","assets/alert-dialog-Dj0hDlZC.js","assets/react-vendor-Bpg1hd5i.js","assets/monaco-BGyhgQtx.js","assets/monaco-Br_kD0ds.css","assets/history-view-i7fGKCkc.js","assets/context-menu-XD6khGRr.js","assets/standard-list-item-BLTOBGFa.js","assets/use-toast-C5s-Xnwi.js","assets/tab-context-BUUT3x3d.js","assets/explorer-view-CL_9lhkq.js","assets/markdown-renderer-CPSKOcqK.js","assets/page-toolbar-CbwENcML.js","assets/store-B9rEO6q-.js","assets/utils-CDrGT12s.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Ln as t,Nr as n,_a as r,ha as i}from"./dialogs-config-BXDglGdB.js";import{Pt as a}from"./monaco-BGyhgQtx.js";import{a as o}from"./store-B9rEO6q-.js";import{n as s}from"./tab-context-BUUT3x3d.js";import{n as c,r as l,t as u}from"./resizable-BLhzHL_f.js";var d=i(),f=e(r(),1),p=n(),m=(0,f.lazy)(()=>a(()=>import(`./explorer-tree-D0P-HUYS.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11,12]))),h=(0,f.lazy)(()=>a(()=>import(`./explorer-view-CL_9lhkq.js`),__vite__mapDeps([13,1,2,3,14,6,7,8,15,11,16,5,17])));function g(){let e=(0,d.c)(17),{state:n}=o(),r=n.selectedThreadId,[i,a]=(0,f.useState)(null),{pendingExplorerPath:g,setPendingExplorerPath:v,explorerClearPath:y,setExplorerClearPath:b}=s(),x,S;e[0]!==g||e[1]!==v?(x=()=>{g&&(a({name:g.split(`/`).pop()??g,type:`file`,path:g}),v(null))},S=[g,v],e[0]=g,e[1]=v,e[2]=x,e[3]=S):(x=e[2],S=e[3]),(0,f.useEffect)(x,S);let C,w;e[4]!==y||e[5]!==b?(C=()=>{y&&(a(e=>e&&(e.path===y||e.path.startsWith(y+`/`)?null:e)),b(null))},w=[y,b],e[4]=y,e[5]=b,e[6]=C,e[7]=w):(C=e[6],w=e[7]),(0,f.useEffect)(C,w);let T;e[8]!==i?.path||e[9]!==r?(T=(0,p.jsx)(c,{defaultSize:25,minSize:15,maxSize:50,className:`overflow-hidden border-r border-border`,children:(0,p.jsx)(t,{className:`h-full`,children:r?(0,p.jsx)(f.Suspense,{fallback:(0,p.jsx)(`div`,{className:`space-y-1 px-2 py-2`,children:[1,2,3].map(_)}),children:(0,p.jsx)(m,{threadId:r,selectedPath:i?.path??null,onFileSelect:a})}):(0,p.jsx)(`p`,{className:`px-3 py-4 text-xs text-muted-foreground text-center`,children:`No thread selected.`})})}),e[8]=i?.path,e[9]=r,e[10]=T):T=e[10];let E;e[11]===Symbol.for(`react.memo_cache_sentinel`)?(E=(0,p.jsx)(u,{withHandle:!0}),e[11]=E):E=e[11];let D;e[12]===i?D=e[13]:(D=(0,p.jsx)(c,{className:`overflow-hidden`,children:(0,p.jsx)(f.Suspense,{fallback:null,children:(0,p.jsx)(h,{selectedFile:i})})}),e[12]=i,e[13]=D);let O;return e[14]!==T||e[15]!==D?(O=(0,p.jsx)(`div`,{className:`flex h-full flex-col overflow-hidden`,children:(0,p.jsxs)(l,{direction:`horizontal`,className:`flex-1 overflow-hidden`,children:[T,E,D]})}),e[14]=T,e[15]=D,e[16]=O):O=e[16],O}function _(e){return(0,p.jsx)(`div`,{className:`animate-pulse h-7 bg-muted rounded-full`},e)}export{g as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Ar as t,Bi as n,Sa as r,Ti as i,Ui as a,Vi as o,ba as s,ca as c,ua as l}from"./dialogs-config-vkfELnGl.js";import{t as u}from"./use-toast-yY7qQuQP.js";import{t as d}from"./standard-list-item-BLlgm1qW.js";import{a as f,c as p,i as m,n as h,r as g,t as _}from"./alert-dialog-CQRWdGnn.js";import{n as v}from"./tab-context-DWD20a4z.js";import{a as y,i as ee,n as b,r as x,t as S}from"./context-menu-A9p22S7d.js";import{n as C,o as w,r as T,s as E,t as D}from"./api-CH5gAPs5.js";var O=s(),k=e(r(),1),A=t();function te(e){let t=(0,O.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,k.useRef)(null),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{c.current?.focus(),c.current?.select()},u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,k.useEffect)(l,u);let f;t[2]!==i||t[3]!==r?(f=function(e){if(e.key===`Enter`){let e=c.current?.value.trim()??``;e?r(e):i()}else e.key===`Escape`&&i()},t[2]=i,t[3]=r,t[4]=f):f=t[4];let p=f,m;t[5]!==i||t[6]!==r?(m=function(){let e=c.current?.value.trim()??``;e?r(e):i()},t[5]=i,t[6]=r,t[7]=m):m=t[7];let h=m,g;t[8]!==n||t[9]!==h||t[10]!==p?(g=(0,A.jsx)(`input`,{ref:c,defaultValue:n,onKeyDown:p,onBlur:h,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-sm`,onClick:j}),t[8]=n,t[9]=h,t[10]=p,t[11]=g):g=t[11];let _;return t[12]!==o||t[13]!==s||t[14]!==a||t[15]!==g?(_=(0,A.jsxs)(d,{level:a,basePadding:o,children:[s,g]}),t[12]=o,t[13]=s,t[14]=a,t[15]=g,t[16]=_):_=t[16],_}function j(e){return e.stopPropagation()}function ne(e){let t=(0,O.c)(101),{node:r,level:s,selectedPath:u,expandedPaths:f,loadedDirs:p,loadingPaths:m,renamingPath:h,newItemIn:g,onToggleFolder:_,onSelectFile:v,onStartRename:C,onCommitRename:w,onCancelRename:T,onDelete:E,onNewFile:D,onNewFolder:k,onCommitNewItem:j,onCancelNewItem:P}=e,F;t[0]!==f||t[1]!==r.path?(F=f.has(r.path),t[0]=f,t[1]=r.path,t[2]=F):F=t[2];let I=F,L;t[3]!==m||t[4]!==r.path?(L=m.has(r.path),t[3]=m,t[4]=r.path,t[5]=L):L=t[5];let R=L,z,B;if(t[6]!==f||t[7]!==I||t[8]!==R||t[9]!==s||t[10]!==p||t[11]!==m||t[12]!==g||t[13]!==r||t[14]!==P||t[15]!==T||t[16]!==j||t[17]!==w||t[18]!==E||t[19]!==D||t[20]!==k||t[21]!==v||t[22]!==C||t[23]!==_||t[24]!==h||t[25]!==u){B=Symbol.for(`react.early_return_sentinel`);bb0:{let e=p.get(r.path)??[];z=h===r.path;let O=g?.dirPath===r.path&&I;if(r.type===`folder`){let M=r.ignored?`opacity-50`:void 0,F;t[28]!==r||t[29]!==_?(F=e=>{e.stopPropagation(),_(r)},t[28]=r,t[29]=_,t[30]=F):F=t[30];let L;t[31]!==I||t[32]!==R?(L=(0,A.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:R?(0,A.jsx)(i,{className:`h-3 w-3 animate-spin`}):I?(0,A.jsx)(l,{className:`h-3 w-3`}):(0,A.jsx)(c,{className:`h-3 w-3`})}),t[31]=I,t[32]=R,t[33]=L):L=t[33];let V;t[34]!==I||t[35]!==z||t[36]!==r||t[37]!==T||t[38]!==w?(V=z?(0,A.jsxs)(A.Fragment,{children:[I?(0,A.jsx)(o,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}),(0,A.jsx)(`input`,{autoFocus:!0,defaultValue:r.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?w(r,t):T()}else e.key===`Escape`&&T()},onBlur:e=>{let t=e.target.value.trim();t?w(r,t):T()},onClick:N,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-sm`})]}):(0,A.jsxs)(A.Fragment,{children:[I?(0,A.jsx)(o,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}),(0,A.jsx)(`span`,{className:`flex-1 truncate`,children:r.name})]}),t[34]=I,t[35]=z,t[36]=r,t[37]=T,t[38]=w,t[39]=V):V=t[39];let H;t[40]!==s||t[41]!==M||t[42]!==F||t[43]!==L||t[44]!==V?(H=(0,A.jsxs)(d,{level:s,basePadding:10,className:M,onClick:F,children:[L,V]}),t[40]=s,t[41]=M,t[42]=F,t[43]=L,t[44]=V,t[45]=H):H=t[45];let U=I&&(0,A.jsx)(`div`,{children:R&&!p.has(r.path)?(0,A.jsx)(`div`,{className:`animate-pulse h-4 bg-muted rounded mx-4 my-1`}):(0,A.jsxs)(A.Fragment,{children:[O&&(0,A.jsx)(te,{defaultValue:``,level:s+1,basePadding:g.type===`folder`?10:22,icon:g.type===`folder`?(0,A.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(a,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:j,onCancel:P}),e.map(e=>(0,A.jsx)(ne,{node:e,level:s+1,selectedPath:u,expandedPaths:f,loadedDirs:p,loadingPaths:m,renamingPath:h,newItemIn:g,onToggleFolder:_,onSelectFile:v,onStartRename:C,onCommitRename:w,onCancelRename:T,onDelete:E,onNewFile:D,onNewFolder:k,onCommitNewItem:j,onCancelNewItem:P},e.path))]})}),W;t[46]!==H||t[47]!==U?(W=(0,A.jsxs)(`div`,{children:[H,U]}),t[46]=H,t[47]=U,t[48]=W):W=t[48];let G=W,K;t[49]===G?K=t[50]:(K=(0,A.jsx)(y,{asChild:!0,children:G}),t[49]=G,t[50]=K);let q;t[51]!==r.path||t[52]!==D?(q=(0,A.jsx)(x,{onSelect:()=>D(r.path),children:`New File...`}),t[51]=r.path,t[52]=D,t[53]=q):q=t[53];let J;t[54]!==r.path||t[55]!==k?(J=(0,A.jsx)(x,{onSelect:()=>k(r.path),children:`New Folder...`}),t[54]=r.path,t[55]=k,t[56]=J):J=t[56];let Y;t[57]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,A.jsx)(ee,{}),t[57]=Y):Y=t[57];let X;t[58]!==r||t[59]!==C?(X=(0,A.jsx)(x,{onSelect:()=>C(r),children:`Rename...`}),t[58]=r,t[59]=C,t[60]=X):X=t[60];let Z;t[61]!==r||t[62]!==E?(Z=(0,A.jsx)(x,{onSelect:()=>E(r),className:`text-destructive focus:text-destructive`,children:`Delete`}),t[61]=r,t[62]=E,t[63]=Z):Z=t[63];let Q;t[64]!==q||t[65]!==J||t[66]!==X||t[67]!==Z?(Q=(0,A.jsxs)(b,{children:[q,J,Y,X,Z]}),t[64]=q,t[65]=J,t[66]=X,t[67]=Z,t[68]=Q):Q=t[68];let $;t[69]!==K||t[70]!==Q?($=(0,A.jsxs)(S,{children:[K,Q]}),t[69]=K,t[70]=Q,t[71]=$):$=t[71],B=$;break bb0}}t[6]=f,t[7]=I,t[8]=R,t[9]=s,t[10]=p,t[11]=m,t[12]=g,t[13]=r,t[14]=P,t[15]=T,t[16]=j,t[17]=w,t[18]=E,t[19]=D,t[20]=k,t[21]=v,t[22]=C,t[23]=_,t[24]=h,t[25]=u,t[26]=z,t[27]=B}else z=t[26],B=t[27];if(B!==Symbol.for(`react.early_return_sentinel`))return B;let V=u===r.path,H=r.ignored?`opacity-50`:void 0,U;t[72]!==r||t[73]!==v?(U=()=>v(r),t[72]=r,t[73]=v,t[74]=U):U=t[74];let W;t[75]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,A.jsx)(a,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),t[75]=W):W=t[75];let G;t[76]!==z||t[77]!==r||t[78]!==T||t[79]!==w?(G=z?(0,A.jsx)(`input`,{autoFocus:!0,defaultValue:r.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?w(r,t):T()}else e.key===`Escape`&&T()},onBlur:e=>{let t=e.target.value.trim();t?w(r,t):T()},onClick:M,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-sm`}):(0,A.jsx)(`span`,{className:`flex-1 truncate`,children:r.name}),t[76]=z,t[77]=r,t[78]=T,t[79]=w,t[80]=G):G=t[80];let K;t[81]!==s||t[82]!==V||t[83]!==H||t[84]!==U||t[85]!==G?(K=(0,A.jsxs)(d,{level:s,basePadding:22,selected:V,className:H,onClick:U,children:[W,G]}),t[81]=s,t[82]=V,t[83]=H,t[84]=U,t[85]=G,t[86]=K):K=t[86];let q=K,J;t[87]===q?J=t[88]:(J=(0,A.jsx)(y,{asChild:!0,children:q}),t[87]=q,t[88]=J);let Y;t[89]!==r||t[90]!==C?(Y=(0,A.jsx)(x,{onSelect:()=>C(r),children:`Rename...`}),t[89]=r,t[90]=C,t[91]=Y):Y=t[91];let X;t[92]!==r||t[93]!==E?(X=(0,A.jsx)(x,{onSelect:()=>E(r),className:`text-destructive focus:text-destructive`,children:`Delete`}),t[92]=r,t[93]=E,t[94]=X):X=t[94];let Z;t[95]!==Y||t[96]!==X?(Z=(0,A.jsxs)(b,{children:[Y,X]}),t[95]=Y,t[96]=X,t[97]=Z):Z=t[97];let Q;return t[98]!==J||t[99]!==Z?(Q=(0,A.jsxs)(S,{children:[J,Z]}),t[98]=J,t[99]=Z,t[100]=Q):Q=t[100],Q}function M(e){return e.stopPropagation()}function N(e){return e.stopPropagation()}function P({threadId:e,selectedPath:t,onFileSelect:r}){let[i,o]=(0,k.useState)(new Map),[s,c]=(0,k.useState)(new Set),[l,d]=(0,k.useState)(new Set),[ee,O]=(0,k.useState)(null),[j,M]=(0,k.useState)(null),[N,P]=(0,k.useState)(null),{explorerRefreshTick:F,pendingExplorerPath:I}=v();async function L(t){if(!(!e||i.has(t))){d(e=>new Set(e).add(t));try{let n=await w(e,t);o(e=>new Map(e).set(t,n.entries))}catch{u({title:`Error`,description:`Failed to load directory`,variant:`destructive`})}finally{d(e=>{let n=new Set(e);return n.delete(t),n})}}}let R=(0,k.useCallback)(async t=>{if(e){d(e=>new Set(e).add(t));try{let n=await w(e,t);o(e=>new Map(e).set(t,n.entries))}catch{u({title:`Error`,description:`Failed to reload directory`,variant:`destructive`})}finally{d(e=>{let n=new Set(e);return n.delete(t),n})}}},[e]);(0,k.useEffect)(()=>{e&&(o(new Map),c(new Set),d(new Set),O(null),M(null),L(``))},[e]),(0,k.useEffect)(()=>{if(F>0&&e){R(``);for(let e of s)R(e)}},[F]),(0,k.useEffect)(()=>{if(!I||!e)return;let t=I.split(`/`);t.pop();let n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);if(n.length!==0){c(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)L(e)}},[I,e]);function z(e){s.has(e.path)?c(t=>{let n=new Set(t);return n.delete(e.path),n}):(c(t=>new Set(t).add(e.path)),L(e.path))}function B(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}function V(e){P(e)}async function H(){if(!N)return;let t=N;P(null);try{await T(e,t.path),await R(B(t.path)),c(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),o(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n})}catch{u({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function U(e){M(null),O(e.path)}async function W(t,n){if(n===t.name){O(null);return}O(null);try{await E(e,t.path,n),await R(B(t.path)),t.type===`folder`&&(c(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),o(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}))}catch{u({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function G(e){O(null),s.has(e)||(c(t=>new Set(t).add(e)),L(e)),M({dirPath:e,type:`file`})}function K(e){O(null),s.has(e)||(c(t=>new Set(t).add(e)),L(e)),M({dirPath:e,type:`folder`})}async function q(t){if(!j)return;let{dirPath:n,type:r}=j;M(null);try{r===`file`?await D(e,n,t):await C(e,n,t),await R(n)}catch{u({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function J(){M(null)}let Y=i.get(``)??[],X=l.has(``),Z=j?.dirPath===``?(0,A.jsx)(te,{defaultValue:``,level:0,basePadding:j.type===`folder`?10:22,icon:j.type===`folder`?(0,A.jsx)(n,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(a,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:q,onCancel:J}):null;return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(_,{open:N!==null,onOpenChange:e=>!e&&P(null),children:(0,A.jsxs)(m,{children:[(0,A.jsx)(p,{children:`Move to Trash`}),(0,A.jsxs)(f,{children:[`Move “`,N?.name,`” to trash?`]}),(0,A.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,A.jsx)(g,{children:`Cancel`}),(0,A.jsx)(h,{onClick:()=>void H(),children:`Move to Trash`})]})]})}),(0,A.jsxs)(S,{children:[(0,A.jsx)(y,{asChild:!0,children:(0,A.jsx)(`div`,{className:`py-2 min-h-full`,children:X?(0,A.jsx)(`div`,{className:`space-y-1 px-2`,children:[1,2,3].map(e=>(0,A.jsx)(`div`,{className:`animate-pulse h-7 bg-muted rounded-full`},e))}):(0,A.jsxs)(A.Fragment,{children:[Z,Y.map(e=>(0,A.jsx)(ne,{node:e,level:0,selectedPath:t,expandedPaths:s,loadedDirs:i,loadingPaths:l,renamingPath:ee,newItemIn:j,onToggleFolder:z,onSelectFile:r,onStartRename:U,onCommitRename:W,onCancelRename:()=>O(null),onDelete:V,onNewFile:G,onNewFolder:K,onCommitNewItem:q,onCancelNewItem:J},e.path))]})})}),(0,A.jsxs)(b,{children:[(0,A.jsx)(x,{onSelect:()=>G(``),children:`New File...`}),(0,A.jsx)(x,{onSelect:()=>K(``),children:`New Folder...`})]})]})]})}export{P as default};
|
|
1
|
+
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Bi as t,Ci as n,Li as r,Nr as i,Ri as a,_a as o,ha as s,ia as c,oa as l}from"./dialogs-config-BXDglGdB.js";import{t as u}from"./use-toast-C5s-Xnwi.js";import{t as d}from"./standard-list-item-BLTOBGFa.js";import{a as f,c as p,i as m,n as h,r as g,t as _}from"./alert-dialog-Dj0hDlZC.js";import{n as v}from"./tab-context-BUUT3x3d.js";import{a as y,i as ee,n as b,r as x,t as S}from"./context-menu-XD6khGRr.js";import{n as C,o as w,r as T,s as E,t as D}from"./api-RbLAI1bg.js";var O=s(),k=e(o(),1),A=i();function te(e){let t=(0,O.c)(17),{defaultValue:n,onCommit:r,onCancel:i,level:a,basePadding:o,icon:s}=e,c=(0,k.useRef)(null),l,u;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(l=()=>{c.current?.focus(),c.current?.select()},u=[],t[0]=l,t[1]=u):(l=t[0],u=t[1]),(0,k.useEffect)(l,u);let f;t[2]!==i||t[3]!==r?(f=function(e){if(e.key===`Enter`){let e=c.current?.value.trim()??``;e?r(e):i()}else e.key===`Escape`&&i()},t[2]=i,t[3]=r,t[4]=f):f=t[4];let p=f,m;t[5]!==i||t[6]!==r?(m=function(){let e=c.current?.value.trim()??``;e?r(e):i()},t[5]=i,t[6]=r,t[7]=m):m=t[7];let h=m,g;t[8]!==n||t[9]!==h||t[10]!==p?(g=(0,A.jsx)(`input`,{ref:c,defaultValue:n,onKeyDown:p,onBlur:h,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-sm`,onClick:j}),t[8]=n,t[9]=h,t[10]=p,t[11]=g):g=t[11];let _;return t[12]!==o||t[13]!==s||t[14]!==a||t[15]!==g?(_=(0,A.jsxs)(d,{level:a,basePadding:o,children:[s,g]}),t[12]=o,t[13]=s,t[14]=a,t[15]=g,t[16]=_):_=t[16],_}function j(e){return e.stopPropagation()}function ne(e){let i=(0,O.c)(101),{node:o,level:s,selectedPath:u,expandedPaths:f,loadedDirs:p,loadingPaths:m,renamingPath:h,newItemIn:g,onToggleFolder:_,onSelectFile:v,onStartRename:C,onCommitRename:w,onCancelRename:T,onDelete:E,onNewFile:D,onNewFolder:k,onCommitNewItem:j,onCancelNewItem:P}=e,F;i[0]!==f||i[1]!==o.path?(F=f.has(o.path),i[0]=f,i[1]=o.path,i[2]=F):F=i[2];let I=F,L;i[3]!==m||i[4]!==o.path?(L=m.has(o.path),i[3]=m,i[4]=o.path,i[5]=L):L=i[5];let R=L,z,B;if(i[6]!==f||i[7]!==I||i[8]!==R||i[9]!==s||i[10]!==p||i[11]!==m||i[12]!==g||i[13]!==o||i[14]!==P||i[15]!==T||i[16]!==j||i[17]!==w||i[18]!==E||i[19]!==D||i[20]!==k||i[21]!==v||i[22]!==C||i[23]!==_||i[24]!==h||i[25]!==u){B=Symbol.for(`react.early_return_sentinel`);bb0:{let e=p.get(o.path)??[];z=h===o.path;let O=g?.dirPath===o.path&&I;if(o.type===`folder`){let M=o.ignored?`opacity-50`:void 0,F;i[28]!==o||i[29]!==_?(F=e=>{e.stopPropagation(),_(o)},i[28]=o,i[29]=_,i[30]=F):F=i[30];let L;i[31]!==I||i[32]!==R?(L=(0,A.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:R?(0,A.jsx)(n,{className:`h-3 w-3 animate-spin`}):I?(0,A.jsx)(l,{className:`h-3 w-3`}):(0,A.jsx)(c,{className:`h-3 w-3`})}),i[31]=I,i[32]=R,i[33]=L):L=i[33];let V;i[34]!==I||i[35]!==z||i[36]!==o||i[37]!==T||i[38]!==w?(V=z?(0,A.jsxs)(A.Fragment,{children:[I?(0,A.jsx)(a,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(r,{className:`h-4 w-4 flex-shrink-0`}),(0,A.jsx)(`input`,{autoFocus:!0,defaultValue:o.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?w(o,t):T()}else e.key===`Escape`&&T()},onBlur:e=>{let t=e.target.value.trim();t?w(o,t):T()},onClick:N,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-sm`})]}):(0,A.jsxs)(A.Fragment,{children:[I?(0,A.jsx)(a,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(r,{className:`h-4 w-4 flex-shrink-0`}),(0,A.jsx)(`span`,{className:`flex-1 truncate`,children:o.name})]}),i[34]=I,i[35]=z,i[36]=o,i[37]=T,i[38]=w,i[39]=V):V=i[39];let H;i[40]!==s||i[41]!==M||i[42]!==F||i[43]!==L||i[44]!==V?(H=(0,A.jsxs)(d,{level:s,basePadding:10,className:M,onClick:F,children:[L,V]}),i[40]=s,i[41]=M,i[42]=F,i[43]=L,i[44]=V,i[45]=H):H=i[45];let U=I&&(0,A.jsx)(`div`,{children:R&&!p.has(o.path)?(0,A.jsx)(`div`,{className:`animate-pulse h-4 bg-muted rounded mx-4 my-1`}):(0,A.jsxs)(A.Fragment,{children:[O&&(0,A.jsx)(te,{defaultValue:``,level:s+1,basePadding:g.type===`folder`?10:22,icon:g.type===`folder`?(0,A.jsx)(r,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(t,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:j,onCancel:P}),e.map(e=>(0,A.jsx)(ne,{node:e,level:s+1,selectedPath:u,expandedPaths:f,loadedDirs:p,loadingPaths:m,renamingPath:h,newItemIn:g,onToggleFolder:_,onSelectFile:v,onStartRename:C,onCommitRename:w,onCancelRename:T,onDelete:E,onNewFile:D,onNewFolder:k,onCommitNewItem:j,onCancelNewItem:P},e.path))]})}),W;i[46]!==H||i[47]!==U?(W=(0,A.jsxs)(`div`,{children:[H,U]}),i[46]=H,i[47]=U,i[48]=W):W=i[48];let G=W,K;i[49]===G?K=i[50]:(K=(0,A.jsx)(y,{asChild:!0,children:G}),i[49]=G,i[50]=K);let q;i[51]!==o.path||i[52]!==D?(q=(0,A.jsx)(x,{onSelect:()=>D(o.path),children:`New File...`}),i[51]=o.path,i[52]=D,i[53]=q):q=i[53];let J;i[54]!==o.path||i[55]!==k?(J=(0,A.jsx)(x,{onSelect:()=>k(o.path),children:`New Folder...`}),i[54]=o.path,i[55]=k,i[56]=J):J=i[56];let Y;i[57]===Symbol.for(`react.memo_cache_sentinel`)?(Y=(0,A.jsx)(ee,{}),i[57]=Y):Y=i[57];let X;i[58]!==o||i[59]!==C?(X=(0,A.jsx)(x,{onSelect:()=>C(o),children:`Rename...`}),i[58]=o,i[59]=C,i[60]=X):X=i[60];let Z;i[61]!==o||i[62]!==E?(Z=(0,A.jsx)(x,{onSelect:()=>E(o),className:`text-destructive focus:text-destructive`,children:`Delete`}),i[61]=o,i[62]=E,i[63]=Z):Z=i[63];let Q;i[64]!==q||i[65]!==J||i[66]!==X||i[67]!==Z?(Q=(0,A.jsxs)(b,{children:[q,J,Y,X,Z]}),i[64]=q,i[65]=J,i[66]=X,i[67]=Z,i[68]=Q):Q=i[68];let $;i[69]!==K||i[70]!==Q?($=(0,A.jsxs)(S,{children:[K,Q]}),i[69]=K,i[70]=Q,i[71]=$):$=i[71],B=$;break bb0}}i[6]=f,i[7]=I,i[8]=R,i[9]=s,i[10]=p,i[11]=m,i[12]=g,i[13]=o,i[14]=P,i[15]=T,i[16]=j,i[17]=w,i[18]=E,i[19]=D,i[20]=k,i[21]=v,i[22]=C,i[23]=_,i[24]=h,i[25]=u,i[26]=z,i[27]=B}else z=i[26],B=i[27];if(B!==Symbol.for(`react.early_return_sentinel`))return B;let V=u===o.path,H=o.ignored?`opacity-50`:void 0,U;i[72]!==o||i[73]!==v?(U=()=>v(o),i[72]=o,i[73]=v,i[74]=U):U=i[74];let W;i[75]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,A.jsx)(t,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),i[75]=W):W=i[75];let G;i[76]!==z||i[77]!==o||i[78]!==T||i[79]!==w?(G=z?(0,A.jsx)(`input`,{autoFocus:!0,defaultValue:o.name,onKeyDown:e=>{if(e.key===`Enter`){let t=e.target.value.trim();t?w(o,t):T()}else e.key===`Escape`&&T()},onBlur:e=>{let t=e.target.value.trim();t?w(o,t):T()},onClick:M,className:`flex-1 min-w-0 bg-transparent outline-none border border-border rounded px-1 text-sm`}):(0,A.jsx)(`span`,{className:`flex-1 truncate`,children:o.name}),i[76]=z,i[77]=o,i[78]=T,i[79]=w,i[80]=G):G=i[80];let K;i[81]!==s||i[82]!==V||i[83]!==H||i[84]!==U||i[85]!==G?(K=(0,A.jsxs)(d,{level:s,basePadding:22,selected:V,className:H,onClick:U,children:[W,G]}),i[81]=s,i[82]=V,i[83]=H,i[84]=U,i[85]=G,i[86]=K):K=i[86];let q=K,J;i[87]===q?J=i[88]:(J=(0,A.jsx)(y,{asChild:!0,children:q}),i[87]=q,i[88]=J);let Y;i[89]!==o||i[90]!==C?(Y=(0,A.jsx)(x,{onSelect:()=>C(o),children:`Rename...`}),i[89]=o,i[90]=C,i[91]=Y):Y=i[91];let X;i[92]!==o||i[93]!==E?(X=(0,A.jsx)(x,{onSelect:()=>E(o),className:`text-destructive focus:text-destructive`,children:`Delete`}),i[92]=o,i[93]=E,i[94]=X):X=i[94];let Z;i[95]!==Y||i[96]!==X?(Z=(0,A.jsxs)(b,{children:[Y,X]}),i[95]=Y,i[96]=X,i[97]=Z):Z=i[97];let Q;return i[98]!==J||i[99]!==Z?(Q=(0,A.jsxs)(S,{children:[J,Z]}),i[98]=J,i[99]=Z,i[100]=Q):Q=i[100],Q}function M(e){return e.stopPropagation()}function N(e){return e.stopPropagation()}function P({threadId:e,selectedPath:n,onFileSelect:i}){let[a,o]=(0,k.useState)(new Map),[s,c]=(0,k.useState)(new Set),[l,d]=(0,k.useState)(new Set),[ee,O]=(0,k.useState)(null),[j,M]=(0,k.useState)(null),[N,P]=(0,k.useState)(null),{explorerRefreshTick:F,pendingExplorerPath:I}=v();async function L(t){if(!(!e||a.has(t))){d(e=>new Set(e).add(t));try{let n=await w(e,t);o(e=>new Map(e).set(t,n.entries))}catch{u({title:`Error`,description:`Failed to load directory`,variant:`destructive`})}finally{d(e=>{let n=new Set(e);return n.delete(t),n})}}}let R=(0,k.useCallback)(async t=>{if(e){d(e=>new Set(e).add(t));try{let n=await w(e,t);o(e=>new Map(e).set(t,n.entries))}catch{u({title:`Error`,description:`Failed to reload directory`,variant:`destructive`})}finally{d(e=>{let n=new Set(e);return n.delete(t),n})}}},[e]);(0,k.useEffect)(()=>{e&&(o(new Map),c(new Set),d(new Set),O(null),M(null),L(``))},[e]),(0,k.useEffect)(()=>{if(F>0&&e){R(``);for(let e of s)R(e)}},[F]),(0,k.useEffect)(()=>{if(!I||!e)return;let t=I.split(`/`);t.pop();let n=[],r=``;for(let e of t)r=r?`${r}/${e}`:e,n.push(r);if(n.length!==0){c(e=>{let t=new Set(e);for(let e of n)t.add(e);return t});for(let e of n)L(e)}},[I,e]);function z(e){s.has(e.path)?c(t=>{let n=new Set(t);return n.delete(e.path),n}):(c(t=>new Set(t).add(e.path)),L(e.path))}function B(e){let t=e.lastIndexOf(`/`);return t>=0?e.slice(0,t):``}function V(e){P(e)}async function H(){if(!N)return;let t=N;P(null);try{await T(e,t.path),await R(B(t.path)),c(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),o(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n})}catch{u({title:`Error`,description:`Failed to move "${t.name}" to trash`,variant:`destructive`})}}function U(e){M(null),O(e.path)}async function W(t,n){if(n===t.name){O(null);return}O(null);try{await E(e,t.path,n),await R(B(t.path)),t.type===`folder`&&(c(e=>{let n=new Set(e);for(let e of n)(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}),o(e=>{let n=new Map(e);for(let e of n.keys())(e===t.path||e.startsWith(t.path+`/`))&&n.delete(e);return n}))}catch{u({title:`Error`,description:`Failed to rename "${t.name}"`,variant:`destructive`})}}function G(e){O(null),s.has(e)||(c(t=>new Set(t).add(e)),L(e)),M({dirPath:e,type:`file`})}function K(e){O(null),s.has(e)||(c(t=>new Set(t).add(e)),L(e)),M({dirPath:e,type:`folder`})}async function q(t){if(!j)return;let{dirPath:n,type:r}=j;M(null);try{r===`file`?await D(e,n,t):await C(e,n,t),await R(n)}catch{u({title:`Error`,description:`Failed to create ${r} "${t}"`,variant:`destructive`})}}function J(){M(null)}let Y=a.get(``)??[],X=l.has(``),Z=j?.dirPath===``?(0,A.jsx)(te,{defaultValue:``,level:0,basePadding:j.type===`folder`?10:22,icon:j.type===`folder`?(0,A.jsx)(r,{className:`h-4 w-4 flex-shrink-0`}):(0,A.jsx)(t,{className:`h-4 w-4 flex-shrink-0 text-muted-foreground`}),onCommit:q,onCancel:J}):null;return(0,A.jsxs)(A.Fragment,{children:[(0,A.jsx)(_,{open:N!==null,onOpenChange:e=>!e&&P(null),children:(0,A.jsxs)(m,{children:[(0,A.jsx)(p,{children:`Move to Trash`}),(0,A.jsxs)(f,{children:[`Move “`,N?.name,`” to trash?`]}),(0,A.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[(0,A.jsx)(g,{children:`Cancel`}),(0,A.jsx)(h,{onClick:()=>void H(),children:`Move to Trash`})]})]})}),(0,A.jsxs)(S,{children:[(0,A.jsx)(y,{asChild:!0,children:(0,A.jsx)(`div`,{className:`py-2 min-h-full`,children:X?(0,A.jsx)(`div`,{className:`space-y-1 px-2`,children:[1,2,3].map(e=>(0,A.jsx)(`div`,{className:`animate-pulse h-7 bg-muted rounded-full`},e))}):(0,A.jsxs)(A.Fragment,{children:[Z,Y.map(e=>(0,A.jsx)(ne,{node:e,level:0,selectedPath:n,expandedPaths:s,loadedDirs:a,loadingPaths:l,renamingPath:ee,newItemIn:j,onToggleFolder:z,onSelectFile:i,onStartRename:U,onCommitRename:W,onCancelRename:()=>O(null),onDelete:V,onNewFile:G,onNewFolder:K,onCommitNewItem:q,onCancelNewItem:J},e.path))]})})}),(0,A.jsxs)(b,{children:[(0,A.jsx)(x,{onSelect:()=>G(``),children:`New File...`}),(0,A.jsx)(x,{onSelect:()=>K(``),children:`New Folder...`})]})]})]})}export{P as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{
|
|
1
|
+
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Ci as t,Nr as n,Vi as r,_a as i,wr as a}from"./dialogs-config-BXDglGdB.js";import{E as o}from"./react-vendor-Bpg1hd5i.js";import{a as s}from"./store-B9rEO6q-.js";import{t as c}from"./use-toast-C5s-Xnwi.js";import{t as l}from"./markdown-renderer-CPSKOcqK.js";import{n as u}from"./utils-CDrGT12s.js";import{t as d}from"./page-toolbar-CbwENcML.js";import{a as f,c as p,i as m}from"./api-RbLAI1bg.js";var h=e(i(),1),g=n(),_=new Set([`png`,`jpg`,`jpeg`,`gif`,`webp`,`svg`,`ico`,`bmp`,`tiff`,`tif`]),v=new Set([`mp4`,`webm`,`mov`,`avi`]);function y(e){let t=e.split(`.`).pop()?.toLowerCase()??``;return _.has(t)?`image`:v.has(t)?`video`:null}function b(e){return(e.split(`.`).pop()?.toLowerCase()??``)===`md`}function x(e){return{ts:`typescript`,tsx:`typescript`,js:`javascript`,jsx:`javascript`,json:`json`,md:`markdown`,mdc:`markdown`,css:`css`,scss:`scss`,html:`html`,py:`python`,sh:`shell`,yaml:`yaml`,yml:`yaml`,xml:`xml`,sql:`sql`}[e.split(`.`).pop()??``]??`plaintext`}function S({selectedFile:e}){let{state:n}=s(),{resolvedTheme:i}=u(),_=n.selectedThreadId,v=(0,h.useRef)(null),[S,C]=(0,h.useState)(``),[w,T]=(0,h.useState)(``),[E,D]=(0,h.useState)(!1),[O,k]=(0,h.useState)(!1),[A,j]=(0,h.useState)(`edit`);(0,h.useEffect)(()=>()=>{v.current&&=(v.current.getModel()?.dispose(),v.current.dispose(),null)},[]);async function M(){if(!(!_||!e)){k(!0);try{await p(_,e.path,S),T(S),c({title:`Saved`,description:`${e.name} saved successfully.`})}catch(e){c({title:`Error`,description:e instanceof Error?e.message:`Failed to save file`,variant:`destructive`})}finally{k(!1)}}}let N=(0,h.useCallback)(async e=>{if(_){D(!0);try{let t=await m(_,e.path);C(t.content),T(t.content)}catch(e){c({title:`Error`,description:e instanceof Error?e.message:`Failed to load file`,variant:`destructive`})}finally{D(!1)}}},[_]);return(0,h.useEffect)(()=>{e&&_?(j(b(e.path)?`view`:`edit`),y(e.path)||N(e)):(j(`edit`),C(``),T(``))},[e,_,N]),_?(0,g.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,g.jsxs)(d,{className:`justify-between`,children:[(0,g.jsxs)(`div`,{className:`flex flex-col`,children:[(0,g.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:e?e.name:`Select a file to edit`}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e?e.path:`Browse and edit repository files`})]}),e&&!y(e.path)&&(0,g.jsxs)(`div`,{className:`flex gap-2`,children:[b(e.path)?(0,g.jsxs)(`div`,{className:`flex rounded-full border border-input bg-background p-0.5`,children:[(0,g.jsx)(a,{size:`sm`,variant:A===`view`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>j(`view`),children:`View`}),(0,g.jsx)(a,{size:`sm`,variant:A===`edit`?`secondary`:`ghost`,className:`h-7 px-3`,onClick:()=>j(`edit`),children:`Edit`})]}):null,(0,g.jsxs)(a,{size:`sm`,onClick:()=>void M(),disabled:O||!S||S===w,children:[O?(0,g.jsx)(t,{className:`h-4 w-4 animate-spin`}):null,`Save`]})]})]}),(0,g.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:(0,g.jsx)(`div`,{className:`h-full relative overflow-hidden`,children:E?(0,g.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,g.jsx)(t,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):e&&y(e.path)===`image`?(0,g.jsx)(`div`,{className:`flex items-center justify-center h-full p-4 overflow-auto`,children:(0,g.jsx)(`img`,{src:f(_,e.path),alt:e.name,className:`max-w-full max-h-full object-contain`})}):e&&y(e.path)===`video`?(0,g.jsx)(`div`,{className:`flex items-center justify-center h-full p-4`,children:(0,g.jsx)(`video`,{src:f(_,e.path),controls:!0,className:`max-w-full max-h-full`})}):e&&b(e.path)&&A===`view`?(0,g.jsx)(`div`,{className:`h-full overflow-auto p-6`,children:(0,g.jsx)(l,{content:S,enableMermaid:!0})}):e?(0,g.jsx)(o,{height:`100%`,language:x(e.path),value:S,onChange:e=>C(e??``),onMount:e=>{v.current=e},theme:i===`dark`?`vs-dark`:`vs-light`,options:{minimap:{enabled:!1},scrollBeyondLastLine:!1,wordWrap:`on`,automaticLayout:!0,fontSize:13,lineNumbers:`on`,renderLineHighlight:`line`,scrollbar:{vertical:`auto`,horizontal:`auto`}}}):(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center p-8`,children:[(0,g.jsx)(r,{className:`h-10 w-10 text-muted-foreground/50`}),(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`p`,{className:`text-sm font-medium text-muted-foreground`,children:`No file selected`}),(0,g.jsx)(`p`,{className:`text-xs text-muted-foreground mt-1`,children:`Select a file from the tree to edit it`})]})]})})})]}):(0,g.jsxs)(`div`,{className:`flex flex-col items-center justify-center h-full gap-3 text-center`,children:[(0,g.jsx)(r,{className:`h-8 w-8 text-muted-foreground`}),(0,g.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Select a thread to browse its files`})]})}export{S as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{i as e}from"./rolldown-runtime-B1FJdls4.js";import{Cr as t,Er as n,Fr as r,Ln as i,Nr as a,Qi as o,Rn as s,Rr as c,Sr as l,Yi as u,_a as d,_r as f,a as p,aa as m,ar as h,br as g,cr as _,dt as v,fr as y,ga as b,ha as x,hr as S,i as C,ia as w,lr as T,mr as E,n as D,oa as O,or as k,r as A,ra as j,sa as M,sr as ee,u as N,ur as te,vr as P,wr as F,xr as I,yr as ne,zn as re}from"./dialogs-config-BXDglGdB.js";var L=e(d(),1),R=e(b(),1),z=x(),B=a(),ie=[`top`,`right`,`bottom`,`left`],V=Math.min,H=Math.max,ae=Math.round,oe=Math.floor,U=e=>({x:e,y:e}),se={left:`right`,right:`left`,bottom:`top`,top:`bottom`},ce={start:`end`,end:`start`};function le(e,t,n){return H(e,V(t,n))}function W(e,t){return typeof e==`function`?e(t):e}function G(e){return e.split(`-`)[0]}function ue(e){return e.split(`-`)[1]}function de(e){return e===`x`?`y`:`x`}function fe(e){return e===`y`?`height`:`width`}var pe=new Set([`top`,`bottom`]);function K(e){return pe.has(G(e))?`y`:`x`}function me(e){return de(K(e))}function he(e,t,n){n===void 0&&(n=!1);let r=ue(e),i=me(e),a=fe(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=we(o)),[o,we(o)]}function ge(e){let t=we(e);return[_e(e),t,_e(t)]}function _e(e){return e.replace(/start|end/g,e=>ce[e])}var ve=[`left`,`right`],ye=[`right`,`left`],be=[`top`,`bottom`],xe=[`bottom`,`top`];function Se(e,t,n){switch(e){case`top`:case`bottom`:return n?t?ye:ve:t?ve:ye;case`left`:case`right`:return t?be:xe;default:return[]}}function Ce(e,t,n,r){let i=ue(e),a=Se(G(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(_e)))),a}function we(e){return e.replace(/left|right|bottom|top/g,e=>se[e])}function Te(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ee(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Te(e)}function De(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Oe(e,t,n){let{reference:r,floating:i}=e,a=K(t),o=me(t),s=fe(o),c=G(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(ue(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}async function ke(e,t){t===void 0&&(t={});let{x:n,y:r,platform:i,rects:a,elements:o,strategy:s}=e,{boundary:c=`clippingAncestors`,rootBoundary:l=`viewport`,elementContext:u=`floating`,altBoundary:d=!1,padding:f=0}=W(t,e),p=Ee(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=De(await i.getClippingRect({element:await(i.isElement==null?void 0:i.isElement(m))??!0?m:m.contextElement||await(i.getDocumentElement==null?void 0:i.getDocumentElement(o.floating)),boundary:c,rootBoundary:l,strategy:s})),g=u===`floating`?{x:n,y:r,width:a.floating.width,height:a.floating.height}:a.reference,_=await(i.getOffsetParent==null?void 0:i.getOffsetParent(o.floating)),v=await(i.isElement==null?void 0:i.isElement(_))&&await(i.getScale==null?void 0:i.getScale(_))||{x:1,y:1},y=De(i.convertOffsetParentRelativeRectToViewportRelativeRect?await i.convertOffsetParentRelativeRectToViewportRelativeRect({elements:o,rect:g,offsetParent:_,strategy:s}):g);return{top:(h.top-y.top+p.top)/v.y,bottom:(y.bottom-h.bottom+p.bottom)/v.y,left:(h.left-y.left+p.left)/v.x,right:(y.right-h.right+p.right)/v.x}}var Ae=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Oe(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:{...o,detectOverflow:o.detectOverflow??ke},elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=Oe(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},je=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=W(e,t)||{};if(l==null)return{};let d=Ee(u),f={x:n,y:r},p=me(i),m=fe(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=V(d[_],T),D=V(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=le(O,A,k),M=!c.arrow&&ue(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,ee=M?A<O?A-O:A-k:0;return{[p]:f[p]+ee,data:{[p]:j,centerOffset:A-j-ee,...M&&{alignmentOffset:ee}},reset:M}}}),Me=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=W(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=G(r),_=K(o),v=G(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[we(o)]:ge(o)),x=p!==`none`;!d&&x&&b.push(...Ce(o,m,p,y));let S=[o,...b],C=await s.detectOverflow(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=he(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==K(t))||T.every(e=>K(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=K(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}};function Ne(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Pe(e){return ie.some(t=>e[t]>=0)}var Fe=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=W(e,t);switch(i){case`referenceHidden`:{let e=Ne(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Pe(e)}}}case`escaped`:{let e=Ne(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Pe(e)}}}default:return{}}}}},Ie=new Set([`left`,`top`]);async function Le(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=G(n),s=ue(n),c=K(n)===`y`,l=Ie.has(o)?-1:1,u=a&&c?-1:1,d=W(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}var Re=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Le(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},ze=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i,platform:a}=t,{mainAxis:o=!0,crossAxis:s=!1,limiter:c={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...l}=W(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=K(G(i)),p=de(f),m=u[p],h=u[f];if(o){let e=p===`y`?`top`:`left`,t=p===`y`?`bottom`:`right`,n=m+d[e],r=m-d[t];m=le(n,m,r)}if(s){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=h+d[e],r=h-d[t];h=le(n,h,r)}let g=c.fn({...t,[p]:m,[f]:h});return{...g,data:{x:g.x-n,y:g.y-r,enabled:{[p]:o,[f]:s}}}}}},Be=function(e){return e===void 0&&(e={}),{options:e,fn(t){let{x:n,y:r,placement:i,rects:a,middlewareData:o}=t,{offset:s=0,mainAxis:c=!0,crossAxis:l=!0}=W(e,t),u={x:n,y:r},d=K(i),f=de(d),p=u[f],m=u[d],h=W(s,t),g=typeof h==`number`?{mainAxis:h,crossAxis:0}:{mainAxis:0,crossAxis:0,...h};if(c){let e=f===`y`?`height`:`width`,t=a.reference[f]-a.floating[e]+g.mainAxis,n=a.reference[f]+a.reference[e]-g.mainAxis;p<t?p=t:p>n&&(p=n)}if(l){let e=f===`y`?`width`:`height`,t=Ie.has(G(i)),n=a.reference[d]-a.floating[e]+(t&&o.offset?.[d]||0)+(t?0:g.crossAxis),r=a.reference[d]+a.reference[e]+(t?0:o.offset?.[d]||0)-(t?g.crossAxis:0);m<n?m=n:m>r&&(m=r)}return{[f]:p,[d]:m}}}},Ve=function(e){return e===void 0&&(e={}),{name:`size`,options:e,async fn(t){var n,r;let{placement:i,rects:a,platform:o,elements:s}=t,{apply:c=()=>{},...l}=W(e,t),u=await o.detectOverflow(t,l),d=G(i),f=ue(i),p=K(i)===`y`,{width:m,height:h}=a.floating,g,_;d===`top`||d===`bottom`?(g=d,_=f===(await(o.isRTL==null?void 0:o.isRTL(s.floating))?`start`:`end`)?`left`:`right`):(_=d,g=f===`end`?`top`:`bottom`);let v=h-u.top-u.bottom,y=m-u.left-u.right,b=V(h-u[g],v),x=V(m-u[_],y),S=!t.middlewareData.shift,C=b,w=x;if((n=t.middlewareData.shift)!=null&&n.enabled.x&&(w=y),(r=t.middlewareData.shift)!=null&&r.enabled.y&&(C=v),S&&!f){let e=H(u.left,0),t=H(u.right,0),n=H(u.top,0),r=H(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:H(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:H(u.top,u.bottom))}await c({...t,availableWidth:w,availableHeight:C});let T=await o.getDimensions(s.floating);return m!==T.width||h!==T.height?{reset:{rects:!0}}:{}}}};function He(){return typeof window<`u`}function Ue(e){return We(e)?(e.nodeName||``).toLowerCase():`#document`}function q(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function J(e){return((We(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function We(e){return He()?e instanceof Node||e instanceof q(e).Node:!1}function Y(e){return He()?e instanceof Element||e instanceof q(e).Element:!1}function X(e){return He()?e instanceof HTMLElement||e instanceof q(e).HTMLElement:!1}function Ge(e){return!He()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof q(e).ShadowRoot}var Ke=new Set([`inline`,`contents`]);function qe(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=Z(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!Ke.has(i)}var Je=new Set([`table`,`td`,`th`]);function Ye(e){return Je.has(Ue(e))}var Xe=[`:popover-open`,`:modal`];function Ze(e){return Xe.some(t=>{try{return e.matches(t)}catch{return!1}})}var Qe=[`transform`,`translate`,`scale`,`rotate`,`perspective`],$e=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],et=[`paint`,`layout`,`strict`,`content`];function tt(e){let t=rt(),n=Y(e)?Z(e):e;return Qe.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||$e.some(e=>(n.willChange||``).includes(e))||et.some(e=>(n.contain||``).includes(e))}function nt(e){let t=Q(e);for(;X(t)&&!at(t);){if(tt(t))return t;if(Ze(t))return null;t=Q(t)}return null}function rt(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}var it=new Set([`html`,`body`,`#document`]);function at(e){return it.has(Ue(e))}function Z(e){return q(e).getComputedStyle(e)}function ot(e){return Y(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function Q(e){if(Ue(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ge(e)&&e.host||J(e);return Ge(t)?t.host:t}function st(e){let t=Q(e);return at(t)?e.ownerDocument?e.ownerDocument.body:e.body:X(t)&&qe(t)?t:st(t)}function ct(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=st(e),i=r===e.ownerDocument?.body,a=q(r);if(i){let e=lt(a);return t.concat(a,a.visualViewport||[],qe(r)?r:[],e&&n?ct(e):[])}return t.concat(r,ct(r,[],n))}function lt(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function ut(e){let t=Z(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=X(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=ae(n)!==a||ae(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function dt(e){return Y(e)?e:e.contextElement}function ft(e){let t=dt(e);if(!X(t))return U(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=ut(t),o=(a?ae(n.width):n.width)/r,s=(a?ae(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var pt=U(0);function mt(e){let t=q(e);return!rt()||!t.visualViewport?pt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function ht(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==q(e)?!1:t}function gt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=dt(e),o=U(1);t&&(r?Y(r)&&(o=ft(r)):o=ft(e));let s=ht(a,n,r)?mt(a):U(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=q(a),t=r&&Y(r)?q(r):r,n=e,i=lt(n);for(;i&&r&&t!==n;){let e=ft(i),t=i.getBoundingClientRect(),r=Z(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=q(i),i=lt(n)}}return De({width:u,height:d,x:c,y:l})}function _t(e,t){let n=ot(e).scrollLeft;return t?t.left+n:gt(J(e)).left+n}function vt(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-_t(e,n),y:n.top+t.scrollTop}}function yt(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=J(r),s=t?Ze(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=U(1),u=U(0),d=X(r);if((d||!d&&!a)&&((Ue(r)!==`body`||qe(o))&&(c=ot(r)),X(r))){let e=gt(r);l=ft(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?vt(o,c):U(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function bt(e){return Array.from(e.getClientRects())}function xt(e){let t=J(e),n=ot(e),r=e.ownerDocument.body,i=H(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=H(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+_t(e),s=-n.scrollTop;return Z(r).direction===`rtl`&&(o+=H(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var St=25;function Ct(e,t){let n=q(e),r=J(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=rt();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=_t(r);if(l<=0){let e=r.ownerDocument,t=e.body,n=getComputedStyle(t),i=e.compatMode===`CSS1Compat`&&parseFloat(n.marginLeft)+parseFloat(n.marginRight)||0,o=Math.abs(r.clientWidth-t.clientWidth-i);o<=St&&(a-=o)}else l<=St&&(a+=l);return{width:a,height:o,x:s,y:c}}var wt=new Set([`absolute`,`fixed`]);function Tt(e,t){let n=gt(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=X(e)?ft(e):U(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Et(e,t,n){let r;if(t===`viewport`)r=Ct(e,n);else if(t===`document`)r=xt(J(e));else if(Y(t))r=Tt(t,n);else{let n=mt(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return De(r)}function Dt(e,t){let n=Q(e);return n===t||!Y(n)||at(n)?!1:Z(n).position===`fixed`||Dt(n,t)}function Ot(e,t){let n=t.get(e);if(n)return n;let r=ct(e,[],!1).filter(e=>Y(e)&&Ue(e)!==`body`),i=null,a=Z(e).position===`fixed`,o=a?Q(e):e;for(;Y(o)&&!at(o);){let t=Z(o),n=tt(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&wt.has(i.position)||qe(o)&&!n&&Dt(e,o))?r=r.filter(e=>e!==o):i=t,o=Q(o)}return t.set(e,r),r}function kt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Ze(t)?[]:Ot(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=Et(t,n,i);return e.top=H(r.top,e.top),e.right=V(r.right,e.right),e.bottom=V(r.bottom,e.bottom),e.left=H(r.left,e.left),e},Et(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function At(e){let{width:t,height:n}=ut(e);return{width:t,height:n}}function jt(e,t,n){let r=X(t),i=J(t),a=n===`fixed`,o=gt(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=U(0);function l(){c.x=_t(i)}if(r||!r&&!a)if((Ue(t)!==`body`||qe(i))&&(s=ot(t)),r){let e=gt(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?vt(i,s):U(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Mt(e){return Z(e).position===`static`}function Nt(e,t){if(!X(e)||Z(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return J(e)===n&&(n=n.ownerDocument.body),n}function Pt(e,t){let n=q(e);if(Ze(e))return n;if(!X(e)){let t=Q(e);for(;t&&!at(t);){if(Y(t)&&!Mt(t))return t;t=Q(t)}return n}let r=Nt(e,t);for(;r&&Ye(r)&&Mt(r);)r=Nt(r,t);return r&&at(r)&&Mt(r)&&!tt(r)?n:r||nt(e)||n}var Ft=async function(e){let t=this.getOffsetParent||Pt,n=this.getDimensions,r=await n(e.floating);return{reference:jt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function It(e){return Z(e).direction===`rtl`}var Lt={convertOffsetParentRelativeRectToViewportRelativeRect:yt,getDocumentElement:J,getClippingRect:kt,getOffsetParent:Pt,getElementRects:Ft,getClientRects:bt,getDimensions:At,getScale:ft,isElement:Y,isRTL:It};function Rt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function zt(e,t){let n=null,r,i=J(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=oe(d),h=oe(i.clientWidth-(u+f)),g=oe(i.clientHeight-(d+p)),_=oe(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:H(0,V(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Rt(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Bt(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=dt(e),u=i||a?[...l?ct(l):[],...ct(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?zt(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?gt(e):null;c&&g();function g(){let t=gt(e);h&&!Rt(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}var Vt=Re,Ht=ze,Ut=Me,Wt=Ve,Gt=Fe,Kt=je,qt=Be,Jt=(e,t,n)=>{let r=new Map,i={platform:Lt,...n},a={...i.platform,_c:r};return Ae(e,t,{...i,platform:a})},Yt=typeof document<`u`?L.useLayoutEffect:function(){};function Xt(e,t){if(e===t)return!0;if(typeof e!=typeof t)return!1;if(typeof e==`function`&&e.toString()===t.toString())return!0;let n,r,i;if(e&&t&&typeof e==`object`){if(Array.isArray(e)){if(n=e.length,n!==t.length)return!1;for(r=n;r--!==0;)if(!Xt(e[r],t[r]))return!1;return!0}if(i=Object.keys(e),n=i.length,n!==Object.keys(t).length)return!1;for(r=n;r--!==0;)if(!{}.hasOwnProperty.call(t,i[r]))return!1;for(r=n;r--!==0;){let n=i[r];if(!(n===`_owner`&&e.$$typeof)&&!Xt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function Zt(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function Qt(e,t){let n=Zt(e);return Math.round(t*n)/n}function $t(e){let t=L.useRef(e);return Yt(()=>{t.current=e}),t}function en(e){e===void 0&&(e={});let{placement:t=`bottom`,strategy:n=`absolute`,middleware:r=[],platform:i,elements:{reference:a,floating:o}={},transform:s=!0,whileElementsMounted:c,open:l}=e,[u,d]=L.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=L.useState(r);Xt(f,r)||p(r);let[m,h]=L.useState(null),[g,_]=L.useState(null),v=L.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=L.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=L.useRef(null),C=L.useRef(null),w=L.useRef(u),T=c!=null,E=$t(c),D=$t(i),O=$t(l),k=L.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Jt(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Xt(w.current,t)&&(w.current=t,R.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Yt(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=L.useRef(!1);Yt(()=>(A.current=!0,()=>{A.current=!1}),[]),Yt(()=>{if(b&&(S.current=b),x&&(C.current=x),b&&x){if(E.current)return E.current(b,x,k);k()}},[b,x,k,E,T]);let j=L.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=L.useMemo(()=>({reference:b,floating:x}),[b,x]),ee=L.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=Qt(M.floating,u.x),r=Qt(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...Zt(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return L.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:ee}),[u,k,j,M,ee])}var tn=e=>{function t(e){return{}.hasOwnProperty.call(e,`current`)}return{name:`arrow`,options:e,fn(n){let{element:r,padding:i}=typeof e==`function`?e(n):e;return r&&t(r)?r.current==null?{}:Kt({element:r.current,padding:i}).fn(n):r?Kt({element:r,padding:i}).fn(n):{}}}},nn=(e,t)=>({...Vt(e),options:[e,t]}),rn=(e,t)=>({...Ht(e),options:[e,t]}),an=(e,t)=>({...qt(e),options:[e,t]}),on=(e,t)=>({...Ut(e),options:[e,t]}),sn=(e,t)=>({...Wt(e),options:[e,t]}),cn=(e,t)=>({...Gt(e),options:[e,t]}),ln=(e,t)=>({...tn(e),options:[e,t]}),un=`Arrow`,dn=L.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,B.jsx)(S.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,B.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});dn.displayName=un;var fn=dn;function pn(e){let[t,n]=L.useState(void 0);return I(()=>{if(e){n({width:e.offsetWidth,height:e.offsetHeight});let t=new ResizeObserver(t=>{if(!Array.isArray(t)||!t.length)return;let r=t[0],i,a;if(`borderBoxSize`in r){let e=r.borderBoxSize,t=Array.isArray(e)?e[0]:e;i=t.inlineSize,a=t.blockSize}else i=e.offsetWidth,a=e.offsetHeight;n({width:i,height:a})});return t.observe(e,{box:`border-box`}),()=>t.unobserve(e)}else n(void 0)},[e]),t}var mn=`Popper`,[hn,gn]=l(mn),[_n,vn]=hn(mn),yn=e=>{let{__scopePopper:t,children:n}=e,[r,i]=L.useState(null);return(0,B.jsx)(_n,{scope:t,anchor:r,onAnchorChange:i,children:n})};yn.displayName=mn;var bn=`PopperAnchor`,xn=L.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:i,...a}=e,o=vn(bn,n),s=L.useRef(null),c=r(t,s),l=L.useRef(null);return L.useEffect(()=>{let e=l.current;l.current=i?.current||s.current,e!==l.current&&o.onAnchorChange(l.current)}),i?null:(0,B.jsx)(S.div,{...a,ref:c})});xn.displayName=bn;var Sn=`PopperContent`,[Cn,wn]=hn(Sn),Tn=L.forwardRef((e,t)=>{let{__scopePopper:n,side:i=`bottom`,sideOffset:a=0,align:o=`center`,alignOffset:s=0,arrowPadding:c=0,avoidCollisions:l=!0,collisionBoundary:u=[],collisionPadding:d=0,sticky:f=`partial`,hideWhenDetached:p=!1,updatePositionStrategy:m=`optimized`,onPlaced:h,...g}=e,_=vn(Sn,n),[v,y]=L.useState(null),b=r(t,e=>y(e)),[x,C]=L.useState(null),w=pn(x),T=w?.width??0,D=w?.height??0,O=i+(o===`center`?``:`-`+o),k=typeof d==`number`?d:{top:0,right:0,bottom:0,left:0,...d},A=Array.isArray(u)?u:[u],j=A.length>0,M={padding:k,boundary:A.filter(kn),altBoundary:j},{refs:ee,floatingStyles:N,placement:te,isPositioned:P,middlewareData:F}=en({strategy:`fixed`,placement:O,whileElementsMounted:(...e)=>Bt(...e,{animationFrame:m===`always`}),elements:{reference:_.anchor},middleware:[nn({mainAxis:a+D,alignmentAxis:s}),l&&rn({mainAxis:!0,crossAxis:!1,limiter:f===`partial`?an():void 0,...M}),l&&on({...M}),sn({...M,apply:({elements:e,rects:t,availableWidth:n,availableHeight:r})=>{let{width:i,height:a}=t.reference,o=e.floating.style;o.setProperty(`--radix-popper-available-width`,`${n}px`),o.setProperty(`--radix-popper-available-height`,`${r}px`),o.setProperty(`--radix-popper-anchor-width`,`${i}px`),o.setProperty(`--radix-popper-anchor-height`,`${a}px`)}}),x&&ln({element:x,padding:c}),An({arrowWidth:T,arrowHeight:D}),p&&cn({strategy:`referenceHidden`,...M})]}),[ne,re]=jn(te),R=E(h);I(()=>{P&&R?.()},[P,R]);let z=F.arrow?.x,ie=F.arrow?.y,V=F.arrow?.centerOffset!==0,[H,ae]=L.useState();return I(()=>{v&&ae(window.getComputedStyle(v).zIndex)},[v]),(0,B.jsx)(`div`,{ref:ee.setFloating,"data-radix-popper-content-wrapper":``,style:{...N,transform:P?N.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:H,"--radix-popper-transform-origin":[F.transformOrigin?.x,F.transformOrigin?.y].join(` `),...F.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,B.jsx)(Cn,{scope:n,placedSide:ne,onArrowChange:C,arrowX:z,arrowY:ie,shouldHideArrow:V,children:(0,B.jsx)(S.div,{"data-side":ne,"data-align":re,...g,ref:b,style:{...g.style,animation:P?void 0:`none`}})})})});Tn.displayName=Sn;var En=`PopperArrow`,Dn={top:`bottom`,right:`left`,bottom:`top`,left:`right`},On=L.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=wn(En,n),a=Dn[i.placedSide];return(0,B.jsx)(`span`,{ref:i.onArrowChange,style:{position:`absolute`,left:i.arrowX,top:i.arrowY,[a]:0,transformOrigin:{top:``,right:`0 0`,bottom:`center 0`,left:`100% 0`}[i.placedSide],transform:{top:`translateY(100%)`,right:`translateY(50%) rotate(90deg) translateX(-50%)`,bottom:`rotate(180deg)`,left:`translateY(50%) rotate(-90deg) translateX(50%)`}[i.placedSide],visibility:i.shouldHideArrow?`hidden`:void 0},children:(0,B.jsx)(fn,{...r,ref:t,style:{...r.style,display:`block`}})})});On.displayName=En;function kn(e){return e!==null}var An=e=>({name:`transformOrigin`,options:e,fn(t){let{placement:n,rects:r,middlewareData:i}=t,a=i.arrow?.centerOffset!==0,o=a?0:e.arrowWidth,s=a?0:e.arrowHeight,[c,l]=jn(n),u={start:`0%`,center:`50%`,end:`100%`}[l],d=(i.arrow?.x??0)+o/2,f=(i.arrow?.y??0)+s/2,p=``,m=``;return c===`bottom`?(p=a?u:`${d}px`,m=`${-s}px`):c===`top`?(p=a?u:`${d}px`,m=`${r.floating.height+s}px`):c===`right`?(p=`${-s}px`,m=a?u:`${f}px`):c===`left`&&(p=`${r.floating.width+s}px`,m=a?u:`${f}px`),{data:{x:p,y:m}}}});function jn(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Mn=yn,Nn=xn,Pn=Tn,Fn=On,In=Object.freeze({position:`absolute`,border:0,width:1,height:1,padding:0,margin:-1,overflow:`hidden`,clip:`rect(0, 0, 0, 0)`,whiteSpace:`nowrap`,wordWrap:`normal`}),Ln=`VisuallyHidden`,Rn=L.forwardRef((e,t)=>(0,B.jsx)(S.span,{...e,ref:t,style:{...In,...e.style}}));Rn.displayName=Ln;var zn=Rn,[Bn,Vn]=l(`Tooltip`,[gn]),Hn=gn(),Un=`TooltipProvider`,Wn=700,Gn=`tooltip.open`,[Kn,qn]=Bn(Un),Jn=e=>{let{__scopeTooltip:t,delayDuration:n=Wn,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=L.useRef(!0),s=L.useRef(!1),c=L.useRef(0);return L.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,B.jsx)(Kn,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:L.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:L.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:L.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Jn.displayName=Un;var Yn=`Tooltip`,[Xn,Zn]=Bn(Yn),Qn=e=>{let{__scopeTooltip:t,children:n,open:r,defaultOpen:i,onOpenChange:a,disableHoverableContent:o,delayDuration:s}=e,c=qn(Yn,e.__scopeTooltip),l=Hn(t),[u,d]=L.useState(null),f=g(),p=L.useRef(0),m=o??c.disableHoverableContent,h=s??c.delayDuration,_=L.useRef(!1),[v,y]=ne({prop:r,defaultProp:i??!1,onChange:e=>{e?(c.onOpen(),document.dispatchEvent(new CustomEvent(Gn))):c.onClose(),a?.(e)},caller:Yn}),b=L.useMemo(()=>v?_.current?`delayed-open`:`instant-open`:`closed`,[v]),x=L.useCallback(()=>{window.clearTimeout(p.current),p.current=0,_.current=!1,y(!0)},[y]),S=L.useCallback(()=>{window.clearTimeout(p.current),p.current=0,y(!1)},[y]),C=L.useCallback(()=>{window.clearTimeout(p.current),p.current=window.setTimeout(()=>{_.current=!0,y(!0),p.current=0},h)},[h,y]);return L.useEffect(()=>()=>{p.current&&=(window.clearTimeout(p.current),0)},[]),(0,B.jsx)(Mn,{...l,children:(0,B.jsx)(Xn,{scope:t,contentId:f,open:v,stateAttribute:b,trigger:u,onTriggerChange:d,onTriggerEnter:L.useCallback(()=>{c.isOpenDelayedRef.current?C():x()},[c.isOpenDelayedRef,C,x]),onTriggerLeave:L.useCallback(()=>{m?S():(window.clearTimeout(p.current),p.current=0)},[S,m]),onOpen:x,onClose:S,disableHoverableContent:m,children:n})})};Qn.displayName=Yn;var $n=`TooltipTrigger`,er=L.forwardRef((e,n)=>{let{__scopeTooltip:i,...a}=e,o=Zn($n,i),s=qn($n,i),c=Hn(i),l=r(n,L.useRef(null),o.onTriggerChange),u=L.useRef(!1),d=L.useRef(!1),f=L.useCallback(()=>u.current=!1,[]);return L.useEffect(()=>()=>document.removeEventListener(`pointerup`,f),[f]),(0,B.jsx)(Nn,{asChild:!0,...c,children:(0,B.jsx)(S.button,{"aria-describedby":o.open?o.contentId:void 0,"data-state":o.stateAttribute,...a,ref:l,onPointerMove:t(e.onPointerMove,e=>{e.pointerType!==`touch`&&!d.current&&!s.isPointerInTransitRef.current&&(o.onTriggerEnter(),d.current=!0)}),onPointerLeave:t(e.onPointerLeave,()=>{o.onTriggerLeave(),d.current=!1}),onPointerDown:t(e.onPointerDown,()=>{o.open&&o.onClose(),u.current=!0,document.addEventListener(`pointerup`,f,{once:!0})}),onFocus:t(e.onFocus,()=>{u.current||o.onOpen()}),onBlur:t(e.onBlur,o.onClose),onClick:t(e.onClick,o.onClose)})})});er.displayName=$n;var tr=`TooltipPortal`,[nr,rr]=Bn(tr,{forceMount:void 0}),ir=e=>{let{__scopeTooltip:t,forceMount:n,children:r,container:i}=e,a=Zn(tr,t);return(0,B.jsx)(nr,{scope:t,forceMount:n,children:(0,B.jsx)(_,{present:n||a.open,children:(0,B.jsx)(T,{asChild:!0,container:i,children:r})})})};ir.displayName=tr;var ar=`TooltipContent`,or=L.forwardRef((e,t)=>{let n=rr(ar,e.__scopeTooltip),{forceMount:r=n.forceMount,side:i=`top`,...a}=e,o=Zn(ar,e.__scopeTooltip);return(0,B.jsx)(_,{present:r||o.open,children:o.disableHoverableContent?(0,B.jsx)(dr,{side:i,...a,ref:t}):(0,B.jsx)(sr,{side:i,...a,ref:t})})}),sr=L.forwardRef((e,t)=>{let n=Zn(ar,e.__scopeTooltip),i=qn(ar,e.__scopeTooltip),a=L.useRef(null),o=r(t,a),[s,c]=L.useState(null),{trigger:l,onClose:u}=n,d=a.current,{onPointerInTransitChange:f}=i,p=L.useCallback(()=>{c(null),f(!1)},[f]),m=L.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=hr(r,mr(r,n.getBoundingClientRect())),a=gr(t.getBoundingClientRect());c(vr([...i,...a])),f(!0)},[f]);return L.useEffect(()=>()=>p(),[p]),L.useEffect(()=>{if(l&&d){let e=e=>m(e,d),t=e=>m(e,l);return l.addEventListener(`pointerleave`,e),d.addEventListener(`pointerleave`,t),()=>{l.removeEventListener(`pointerleave`,e),d.removeEventListener(`pointerleave`,t)}}},[l,d,m,p]),L.useEffect(()=>{if(s){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=l?.contains(t)||d?.contains(t),i=!_r(n,s);r?p():i&&(p(),u())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[l,d,s,u,p]),(0,B.jsx)(dr,{...e,ref:o})}),[cr,lr]=Bn(Yn,{isInside:!1}),ur=P(`TooltipContent`),dr=L.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=Zn(ar,n),l=Hn(n),{onClose:u}=c;return L.useEffect(()=>(document.addEventListener(Gn,u),()=>document.removeEventListener(Gn,u)),[u]),L.useEffect(()=>{if(c.trigger){let e=e=>{e.target?.contains(c.trigger)&&u()};return window.addEventListener(`scroll`,e,{capture:!0}),()=>window.removeEventListener(`scroll`,e,{capture:!0})}},[c.trigger,u]),(0,B.jsx)(y,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,B.jsxs)(Pn,{"data-state":c.stateAttribute,...l,...s,ref:t,style:{...s.style,"--radix-tooltip-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-tooltip-content-available-width":`var(--radix-popper-available-width)`,"--radix-tooltip-content-available-height":`var(--radix-popper-available-height)`,"--radix-tooltip-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-tooltip-trigger-height":`var(--radix-popper-anchor-height)`},children:[(0,B.jsx)(ur,{children:r}),(0,B.jsx)(cr,{scope:n,isInside:!0,children:(0,B.jsx)(zn,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});or.displayName=ar;var fr=`TooltipArrow`,pr=L.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Hn(n);return lr(fr,n).isInside?null:(0,B.jsx)(Fn,{...i,...r,ref:t})});pr.displayName=fr;function mr(e,t){let n=Math.abs(t.top-e.y),r=Math.abs(t.bottom-e.y),i=Math.abs(t.right-e.x),a=Math.abs(t.left-e.x);switch(Math.min(n,r,i,a)){case a:return`left`;case i:return`right`;case n:return`top`;case r:return`bottom`;default:throw Error(`unreachable`)}}function hr(e,t,n=5){let r=[];switch(t){case`top`:r.push({x:e.x-n,y:e.y+n},{x:e.x+n,y:e.y+n});break;case`bottom`:r.push({x:e.x-n,y:e.y-n},{x:e.x+n,y:e.y-n});break;case`left`:r.push({x:e.x+n,y:e.y-n},{x:e.x+n,y:e.y+n});break;case`right`:r.push({x:e.x-n,y:e.y-n},{x:e.x-n,y:e.y+n});break}return r}function gr(e){let{top:t,right:n,bottom:r,left:i}=e;return[{x:i,y:t},{x:n,y:t},{x:n,y:r},{x:i,y:r}]}function _r(e,t){let{x:n,y:r}=e,i=!1;for(let e=0,a=t.length-1;e<t.length;a=e++){let o=t[e],s=t[a],c=o.x,l=o.y,u=s.x,d=s.y;l>r!=d>r&&n<(u-c)*(r-l)/(d-l)+c&&(i=!i)}return i}function vr(e){let t=e.slice();return t.sort((e,t)=>e.x<t.x?-1:e.x>t.x?1:e.y<t.y?-1:+(e.y>t.y)),yr(t)}function yr(e){if(e.length<=1)return e.slice();let t=[];for(let n=0;n<e.length;n++){let r=e[n];for(;t.length>=2;){let e=t[t.length-1],n=t[t.length-2];if((e.x-n.x)*(r.y-n.y)>=(e.y-n.y)*(r.x-n.x))t.pop();else break}t.push(r)}t.pop();let n=[];for(let t=e.length-1;t>=0;t--){let r=e[t];for(;n.length>=2;){let e=n[n.length-1],t=n[n.length-2];if((e.x-t.x)*(r.y-t.y)>=(e.y-t.y)*(r.x-t.x))n.pop();else break}n.push(r)}return n.pop(),t.length===1&&n.length===1&&t[0].x===n[0].x&&t[0].y===n[0].y?t:t.concat(n)}var br=Jn,xr=Qn,Sr=er,Cr=or,wr=br,Tr=xr,Er=Sr,Dr=L.forwardRef((e,t)=>{let r=(0,z.c)(11),i,a,o;r[0]===e?(i=r[1],a=r[2],o=r[3]):({className:i,sideOffset:o,...a}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o);let s=o===void 0?4:o,c;r[4]===i?c=r[5]:(c=n(`z-50 overflow-hidden rounded-md border bg-popover px-3 py-1.5 text-sm text-popover-foreground shadow-md animate-in fade-in-0 zoom-in-95 data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=closed]:zoom-out-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,i),r[4]=i,r[5]=c);let l;return r[6]!==a||r[7]!==t||r[8]!==s||r[9]!==c?(l=(0,B.jsx)(Cr,{ref:t,sideOffset:s,className:c,...a}),r[6]=a,r[7]=t,r[8]=s,r[9]=c,r[10]=l):l=r[10],l});Dr.displayName=Cr.displayName;function Or(e){let t=L.useRef({value:e,previous:e});return L.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var kr=L.forwardRef((e,t)=>{let r=(0,z.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`w-full caption-bottom text-sm`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,B.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,B.jsx)(`table`,{ref:t,className:o,...a})}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});kr.displayName=`Table`;var Ar=L.forwardRef((e,t)=>{let r=(0,z.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`[&_tr]:border-b`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,B.jsx)(`thead`,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});Ar.displayName=`TableHeader`;var jr=L.forwardRef((e,t)=>{let r=(0,z.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`[&_tr:last-child]:border-0`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,B.jsx)(`tbody`,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});jr.displayName=`TableBody`;var Mr=L.forwardRef((e,t)=>{let r=(0,z.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`border-t bg-muted/50 font-medium [&>tr]:last:border-b-0`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,B.jsx)(`tfoot`,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});Mr.displayName=`TableFooter`;var Nr=L.forwardRef((e,t)=>{let r=(0,z.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`border-b transition-colors hover:bg-muted/50 data-[state=selected]:bg-muted`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,B.jsx)(`tr`,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});Nr.displayName=`TableRow`;var Pr=L.forwardRef((e,t)=>{let r=(0,z.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`h-12 px-4 text-left align-middle font-medium text-muted-foreground [&:has([role=checkbox])]:pr-0`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,B.jsx)(`th`,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});Pr.displayName=`TableHead`;var Fr=L.forwardRef((e,t)=>{let r=(0,z.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`p-4 align-middle [&:has([role=checkbox])]:pr-0`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,B.jsx)(`td`,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});Fr.displayName=`TableCell`;var Ir=L.forwardRef((e,t)=>{let r=(0,z.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`mt-4 text-sm text-muted-foreground`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,B.jsx)(`caption`,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});Ir.displayName=`TableCaption`;var Lr=[` `,`Enter`,`ArrowUp`,`ArrowDown`],Rr=[` `,`Enter`],zr=`Select`,[Br,Vr,Hr]=N(zr),[Ur,Wr]=l(zr,[Hr,gn]),Gr=gn(),[Kr,qr]=Ur(zr),[Jr,Yr]=Ur(zr),Xr=e=>{let{__scopeSelect:t,children:n,open:r,defaultOpen:i,onOpenChange:a,value:o,defaultValue:s,onValueChange:c,dir:l,name:u,autoComplete:d,disabled:f,required:p,form:m}=e,h=Gr(t),[_,v]=L.useState(null),[y,b]=L.useState(null),[x,S]=L.useState(!1),C=re(l),[w,T]=ne({prop:r,defaultProp:i??!1,onChange:a,caller:zr}),[E,D]=ne({prop:o,defaultProp:s,onChange:c,caller:zr}),O=L.useRef(null),k=_?m||!!_.closest(`form`):!0,[A,j]=L.useState(new Set),M=Array.from(A).map(e=>e.props.value).join(`;`);return(0,B.jsx)(Mn,{...h,children:(0,B.jsxs)(Kr,{required:p,scope:t,trigger:_,onTriggerChange:v,valueNode:y,onValueNodeChange:b,valueNodeHasChildren:x,onValueNodeHasChildrenChange:S,contentId:g(),value:E,onValueChange:D,open:w,onOpenChange:T,dir:C,triggerPointerDownPosRef:O,disabled:f,children:[(0,B.jsx)(Br.Provider,{scope:t,children:(0,B.jsx)(Jr,{scope:e.__scopeSelect,onNativeOptionAdd:L.useCallback(e=>{j(t=>new Set(t).add(e))},[]),onNativeOptionRemove:L.useCallback(e=>{j(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:n})}),k?(0,B.jsxs)(Wi,{"aria-hidden":!0,required:p,tabIndex:-1,name:u,autoComplete:d,value:E,onChange:e=>D(e.target.value),disabled:f,form:m,children:[E===void 0?(0,B.jsx)(`option`,{value:``}):null,Array.from(A)]},M):null]})})};Xr.displayName=zr;var Zr=`SelectTrigger`,Qr=L.forwardRef((e,n)=>{let{__scopeSelect:i,disabled:a=!1,...o}=e,s=Gr(i),c=qr(Zr,i),l=c.disabled||a,u=r(n,c.onTriggerChange),d=Vr(i),f=L.useRef(`touch`),[p,m,h]=Ki(e=>{let t=d().filter(e=>!e.disabled),n=qi(t,e,t.find(e=>e.value===c.value));n!==void 0&&c.onValueChange(n.value)}),g=e=>{l||(c.onOpenChange(!0),h()),e&&(c.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,B.jsx)(Nn,{asChild:!0,...s,children:(0,B.jsx)(S.button,{type:`button`,role:`combobox`,"aria-controls":c.contentId,"aria-expanded":c.open,"aria-required":c.required,"aria-autocomplete":`none`,dir:c.dir,"data-state":c.open?`open`:`closed`,disabled:l,"data-disabled":l?``:void 0,"data-placeholder":Gi(c.value)?``:void 0,...o,ref:u,onClick:t(o.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&g(e)}),onPointerDown:t(o.onPointerDown,e=>{f.current=e.pointerType;let t=e.target;t.hasPointerCapture(e.pointerId)&&t.releasePointerCapture(e.pointerId),e.button===0&&e.ctrlKey===!1&&e.pointerType===`mouse`&&(g(e),e.preventDefault())}),onKeyDown:t(o.onKeyDown,e=>{let t=p.current!==``;!(e.ctrlKey||e.altKey||e.metaKey)&&e.key.length===1&&m(e.key),!(t&&e.key===` `)&&Lr.includes(e.key)&&(g(),e.preventDefault())})})})});Qr.displayName=Zr;var $r=`SelectValue`,ei=L.forwardRef((e,t)=>{let{__scopeSelect:n,className:i,style:a,children:o,placeholder:s=``,...c}=e,l=qr($r,n),{onValueNodeHasChildrenChange:u}=l,d=o!==void 0,f=r(t,l.onValueNodeChange);return I(()=>{u(d)},[u,d]),(0,B.jsx)(S.span,{...c,ref:f,style:{pointerEvents:`none`},children:Gi(l.value)?(0,B.jsx)(B.Fragment,{children:s}):o})});ei.displayName=$r;var ti=`SelectIcon`,ni=L.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,B.jsx)(S.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});ni.displayName=ti;var ri=`SelectPortal`,ii=e=>(0,B.jsx)(T,{asChild:!0,...e});ii.displayName=ri;var ai=`SelectContent`,oi=L.forwardRef((e,t)=>{let n=qr(ai,e.__scopeSelect),[r,i]=L.useState();if(I(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?R.createPortal((0,B.jsx)(si,{scope:e.__scopeSelect,children:(0,B.jsx)(Br.Slot,{scope:e.__scopeSelect,children:(0,B.jsx)(`div`,{children:e.children})})}),t):null}return(0,B.jsx)(di,{...e,ref:t})});oi.displayName=ai;var $=10,[si,ci]=Ur(ai),li=`SelectContentImpl`,ui=f(`SelectContent.RemoveScroll`),di=L.forwardRef((e,n)=>{let{__scopeSelect:i,position:a=`item-aligned`,onCloseAutoFocus:o,onEscapeKeyDown:s,onPointerDownOutside:c,side:l,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:g,sticky:_,hideWhenDetached:v,avoidCollisions:b,...x}=e,S=qr(ai,i),[C,w]=L.useState(null),[T,E]=L.useState(null),D=r(n,e=>w(e)),[O,A]=L.useState(null),[j,M]=L.useState(null),N=Vr(i),[P,F]=L.useState(!1),I=L.useRef(!1);L.useEffect(()=>{if(C)return h(C)},[C]),ee();let ne=L.useCallback(e=>{let[t,...n]=N().map(e=>e.ref.current),[r]=n.slice(-1),i=document.activeElement;for(let n of e)if(n===i||(n?.scrollIntoView({block:`nearest`}),n===t&&T&&(T.scrollTop=0),n===r&&T&&(T.scrollTop=T.scrollHeight),n?.focus(),document.activeElement!==i))return},[N,T]),re=L.useCallback(()=>ne([O,C]),[ne,O,C]);L.useEffect(()=>{P&&re()},[P,re]);let{onOpenChange:R,triggerPointerDownPosRef:z}=S;L.useEffect(()=>{if(C){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(z.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(z.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():C.contains(n.target)||R(!1),document.removeEventListener(`pointermove`,t),z.current=null};return z.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[C,R,z]),L.useEffect(()=>{let e=()=>R(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[R]);let[ie,V]=Ki(e=>{let t=N().filter(e=>!e.disabled),n=qi(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),H=L.useCallback((e,t,n)=>{let r=!I.current&&!n;(S.value!==void 0&&S.value===t||r)&&(A(e),r&&(I.current=!0))},[S.value]),ae=L.useCallback(()=>C?.focus(),[C]),oe=L.useCallback((e,t,n)=>{let r=!I.current&&!n;(S.value!==void 0&&S.value===t||r)&&M(e)},[S.value]),U=a===`popper`?hi:pi,se=U===hi?{side:l,sideOffset:u,align:d,alignOffset:f,arrowPadding:p,collisionBoundary:m,collisionPadding:g,sticky:_,hideWhenDetached:v,avoidCollisions:b}:{};return(0,B.jsx)(si,{scope:i,content:C,viewport:T,onViewportChange:E,itemRefCallback:H,selectedItem:O,onItemLeave:ae,itemTextRefCallback:oe,focusSelectedItem:re,selectedItemText:j,position:a,isPositioned:P,searchRef:ie,children:(0,B.jsx)(k,{as:ui,allowPinchZoom:!0,children:(0,B.jsx)(te,{asChild:!0,trapped:S.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:t(o,e=>{S.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,B.jsx)(y,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:c,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>S.onOpenChange(!1),children:(0,B.jsx)(U,{role:`listbox`,id:S.contentId,"data-state":S.open?`open`:`closed`,dir:S.dir,onContextMenu:e=>e.preventDefault(),...x,...se,onPlaced:()=>F(!0),ref:D,style:{display:`flex`,flexDirection:`column`,outline:`none`,...x.style},onKeyDown:t(x.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&V(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=N().filter(e=>!e.disabled).map(e=>e.ref.current);if([`ArrowUp`,`End`].includes(e.key)&&(t=t.slice().reverse()),[`ArrowUp`,`ArrowDown`].includes(e.key)){let n=e.target,r=t.indexOf(n);t=t.slice(r+1)}setTimeout(()=>ne(t)),e.preventDefault()}})})})})})})});di.displayName=li;var fi=`SelectItemAlignedPosition`,pi=L.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:i,...a}=e,o=qr(ai,n),c=ci(ai,n),[l,u]=L.useState(null),[d,f]=L.useState(null),p=r(t,e=>f(e)),m=Vr(n),h=L.useRef(!1),g=L.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:y,focusSelectedItem:b}=c,x=L.useCallback(()=>{if(o.trigger&&o.valueNode&&l&&d&&_&&v&&y){let e=o.trigger.getBoundingClientRect(),t=d.getBoundingClientRect(),n=o.valueNode.getBoundingClientRect(),r=y.getBoundingClientRect();if(o.dir!==`rtl`){let i=r.left-t.left,a=n.left-i,o=e.left-a,c=e.width+o,u=Math.max(c,t.width),d=window.innerWidth-$,f=s(a,[$,Math.max($,d-u)]);l.style.minWidth=c+`px`,l.style.left=f+`px`}else{let i=t.right-r.right,a=window.innerWidth-n.right-i,o=window.innerWidth-e.right-a,c=e.width+o,u=Math.max(c,t.width),d=window.innerWidth-$,f=s(a,[$,Math.max($,d-u)]);l.style.minWidth=c+`px`,l.style.right=f+`px`}let a=m(),c=window.innerHeight-$*2,u=_.scrollHeight,f=window.getComputedStyle(d),p=parseInt(f.borderTopWidth,10),g=parseInt(f.paddingTop,10),b=parseInt(f.borderBottomWidth,10),x=parseInt(f.paddingBottom,10),S=p+g+u+x+b,C=Math.min(v.offsetHeight*5,S),w=window.getComputedStyle(_),T=parseInt(w.paddingTop,10),E=parseInt(w.paddingBottom,10),D=e.top+e.height/2-$,O=c-D,k=v.offsetHeight/2,A=v.offsetTop+k,j=p+g+A,M=S-j;if(j<=D){let e=a.length>0&&v===a[a.length-1].ref.current;l.style.bottom=`0px`;let t=d.clientHeight-_.offsetTop-_.offsetHeight,n=j+Math.max(O,k+(e?E:0)+t+b);l.style.height=n+`px`}else{let e=a.length>0&&v===a[0].ref.current;l.style.top=`0px`;let t=Math.max(D,p+_.offsetTop+(e?T:0)+k)+M;l.style.height=t+`px`,_.scrollTop=j-D+_.offsetTop}l.style.margin=`${$}px 0`,l.style.minHeight=C+`px`,l.style.maxHeight=c+`px`,i?.(),requestAnimationFrame(()=>h.current=!0)}},[m,o.trigger,o.valueNode,l,d,_,v,y,o.dir,i]);I(()=>x(),[x]);let[C,w]=L.useState();return I(()=>{d&&w(window.getComputedStyle(d).zIndex)},[d]),(0,B.jsx)(gi,{scope:n,contentWrapper:l,shouldExpandOnScrollRef:h,onScrollButtonChange:L.useCallback(e=>{e&&g.current===!0&&(x(),b?.(),g.current=!1)},[x,b]),children:(0,B.jsx)(`div`,{ref:u,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:C},children:(0,B.jsx)(S.div,{...a,ref:p,style:{boxSizing:`border-box`,maxHeight:`100%`,...a.style}})})})});pi.displayName=fi;var mi=`SelectPopperPosition`,hi=L.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=$,...a}=e,o=Gr(n);return(0,B.jsx)(Pn,{...o,...a,ref:t,align:r,collisionPadding:i,style:{boxSizing:`border-box`,...a.style,"--radix-select-content-transform-origin":`var(--radix-popper-transform-origin)`,"--radix-select-content-available-width":`var(--radix-popper-available-width)`,"--radix-select-content-available-height":`var(--radix-popper-available-height)`,"--radix-select-trigger-width":`var(--radix-popper-anchor-width)`,"--radix-select-trigger-height":`var(--radix-popper-anchor-height)`}})});hi.displayName=mi;var[gi,_i]=Ur(ai,{}),vi=`SelectViewport`,yi=L.forwardRef((e,n)=>{let{__scopeSelect:i,nonce:a,...o}=e,s=ci(vi,i),c=_i(vi,i),l=r(n,s.onViewportChange),u=L.useRef(0);return(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`style`,{dangerouslySetInnerHTML:{__html:`[data-radix-select-viewport]{scrollbar-width:none;-ms-overflow-style:none;-webkit-overflow-scrolling:touch;}[data-radix-select-viewport]::-webkit-scrollbar{display:none}`},nonce:a}),(0,B.jsx)(Br.Slot,{scope:i,children:(0,B.jsx)(S.div,{"data-radix-select-viewport":``,role:`presentation`,...o,ref:l,style:{position:`relative`,flex:1,overflow:`hidden auto`,...o.style},onScroll:t(o.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=c;if(r?.current&&n){let e=Math.abs(u.current-t.scrollTop);if(e>0){let r=window.innerHeight-$*2,i=parseFloat(n.style.minHeight),a=parseFloat(n.style.height),o=Math.max(i,a);if(o<r){let i=o+e,a=Math.min(r,i),s=i-a;n.style.height=a+`px`,n.style.bottom===`0px`&&(t.scrollTop=s>0?s:0,n.style.justifyContent=`flex-end`)}}}u.current=t.scrollTop})})})]})});yi.displayName=vi;var bi=`SelectGroup`,[xi,Si]=Ur(bi),Ci=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=g();return(0,B.jsx)(xi,{scope:n,id:i,children:(0,B.jsx)(S.div,{role:`group`,"aria-labelledby":i,...r,ref:t})})});Ci.displayName=bi;var wi=`SelectLabel`,Ti=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Si(wi,n);return(0,B.jsx)(S.div,{id:i.id,...r,ref:t})});Ti.displayName=wi;var Ei=`SelectItem`,[Di,Oi]=Ur(Ei),ki=L.forwardRef((e,n)=>{let{__scopeSelect:i,value:a,disabled:o=!1,textValue:s,...c}=e,l=qr(Ei,i),u=ci(Ei,i),d=l.value===a,[f,p]=L.useState(s??``),[m,h]=L.useState(!1),_=r(n,e=>u.itemRefCallback?.(e,a,o)),v=g(),y=L.useRef(`touch`),b=()=>{o||(l.onValueChange(a),l.onOpenChange(!1))};if(a===``)throw Error(`A <Select.Item /> must have a value prop that is not an empty string. This is because the Select value can be set to an empty string to clear the selection and show the placeholder.`);return(0,B.jsx)(Di,{scope:i,value:a,disabled:o,textId:v,isSelected:d,onItemTextChange:L.useCallback(e=>{p(t=>t||(e?.textContent??``).trim())},[]),children:(0,B.jsx)(Br.ItemSlot,{scope:i,value:a,disabled:o,textValue:f,children:(0,B.jsx)(S.div,{role:`option`,"aria-labelledby":v,"data-highlighted":m?``:void 0,"aria-selected":d&&m,"data-state":d?`checked`:`unchecked`,"aria-disabled":o||void 0,"data-disabled":o?``:void 0,tabIndex:o?void 0:-1,...c,ref:_,onFocus:t(c.onFocus,()=>h(!0)),onBlur:t(c.onBlur,()=>h(!1)),onClick:t(c.onClick,()=>{y.current!==`mouse`&&b()}),onPointerUp:t(c.onPointerUp,()=>{y.current===`mouse`&&b()}),onPointerDown:t(c.onPointerDown,e=>{y.current=e.pointerType}),onPointerMove:t(c.onPointerMove,e=>{y.current=e.pointerType,o?u.onItemLeave?.():y.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:t(c.onPointerLeave,e=>{e.currentTarget===document.activeElement&&u.onItemLeave?.()}),onKeyDown:t(c.onKeyDown,e=>{u.searchRef?.current!==``&&e.key===` `||(Rr.includes(e.key)&&b(),e.key===` `&&e.preventDefault())})})})})});ki.displayName=Ei;var Ai=`SelectItemText`,ji=L.forwardRef((e,t)=>{let{__scopeSelect:n,className:i,style:a,...o}=e,s=qr(Ai,n),c=ci(Ai,n),l=Oi(Ai,n),u=Yr(Ai,n),[d,f]=L.useState(null),p=r(t,e=>f(e),l.onItemTextChange,e=>c.itemTextRefCallback?.(e,l.value,l.disabled)),m=d?.textContent,h=L.useMemo(()=>(0,B.jsx)(`option`,{value:l.value,disabled:l.disabled,children:m},l.value),[l.disabled,l.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=u;return I(()=>(g(h),()=>_(h)),[g,_,h]),(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(S.span,{id:l.textId,...o,ref:p}),l.isSelected&&s.valueNode&&!s.valueNodeHasChildren?R.createPortal(o.children,s.valueNode):null]})});ji.displayName=Ai;var Mi=`SelectItemIndicator`,Ni=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Oi(Mi,n).isSelected?(0,B.jsx)(S.span,{"aria-hidden":!0,...r,ref:t}):null});Ni.displayName=Mi;var Pi=`SelectScrollUpButton`,Fi=L.forwardRef((e,t)=>{let n=ci(Pi,e.__scopeSelect),i=_i(Pi,e.__scopeSelect),[a,o]=L.useState(!1),s=r(t,i.onScrollButtonChange);return I(()=>{if(n.viewport&&n.isPositioned){let e=function(){o(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,B.jsx)(Ri,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Fi.displayName=Pi;var Ii=`SelectScrollDownButton`,Li=L.forwardRef((e,t)=>{let n=ci(Ii,e.__scopeSelect),i=_i(Ii,e.__scopeSelect),[a,o]=L.useState(!1),s=r(t,i.onScrollButtonChange);return I(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;o(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),a?(0,B.jsx)(Ri,{...e,ref:s,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Li.displayName=Ii;var Ri=L.forwardRef((e,n)=>{let{__scopeSelect:r,onAutoScroll:i,...a}=e,o=ci(`SelectScrollButton`,r),s=L.useRef(null),c=Vr(r),l=L.useCallback(()=>{s.current!==null&&(window.clearInterval(s.current),s.current=null)},[]);return L.useEffect(()=>()=>l(),[l]),I(()=>{c().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[c]),(0,B.jsx)(S.div,{"aria-hidden":!0,...a,ref:n,style:{flexShrink:0,...a.style},onPointerDown:t(a.onPointerDown,()=>{s.current===null&&(s.current=window.setInterval(i,50))}),onPointerMove:t(a.onPointerMove,()=>{o.onItemLeave?.(),s.current===null&&(s.current=window.setInterval(i,50))}),onPointerLeave:t(a.onPointerLeave,()=>{l()})})}),zi=`SelectSeparator`,Bi=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,B.jsx)(S.div,{"aria-hidden":!0,...r,ref:t})});Bi.displayName=zi;var Vi=`SelectArrow`,Hi=L.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Gr(n),a=qr(Vi,n),o=ci(Vi,n);return a.open&&o.position===`popper`?(0,B.jsx)(Fn,{...i,...r,ref:t}):null});Hi.displayName=Vi;var Ui=`SelectBubbleInput`,Wi=L.forwardRef(({__scopeSelect:e,value:t,...n},i)=>{let a=L.useRef(null),o=r(i,a),s=Or(t);return L.useEffect(()=>{let e=a.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(s!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[s,t]),(0,B.jsx)(S.select,{...n,style:{...In,...n.style},ref:o,defaultValue:t})});Wi.displayName=Ui;function Gi(e){return e===``||e===void 0}function Ki(e){let t=E(e),n=L.useRef(``),r=L.useRef(0),i=L.useCallback(e=>{let i=n.current+e;t(i),(function e(t){n.current=t,window.clearTimeout(r.current),t!==``&&(r.current=window.setTimeout(()=>e(``),1e3))})(i)},[t]),a=L.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return L.useEffect(()=>()=>window.clearTimeout(r.current),[]),[n,i,a]}function qi(e,t,n){let r=t.length>1&&Array.from(t).every(e=>e===t[0])?t[0]:t,i=n?e.indexOf(n):-1,a=Ji(e,Math.max(i,0));r.length===1&&(a=a.filter(e=>e!==n));let o=a.find(e=>e.textValue.toLowerCase().startsWith(r.toLowerCase()));return o===n?void 0:o}function Ji(e,t){return e.map((n,r)=>e[(t+r)%e.length])}var Yi=Xr,Xi=Qr,Zi=ei,Qi=ni,$i=ii,ea=oi,ta=yi,na=Ti,ra=ki,ia=ji,aa=Ni,oa=Fi,sa=Li,ca=Bi,la=Yi,ua=Zi,da=L.forwardRef((e,t)=>{let r=(0,z.c)(12),i,a,o;r[0]===e?(i=r[1],a=r[2],o=r[3]):({className:a,children:i,...o}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o);let s;r[4]===a?s=r[5]:(s=n(`flex h-10 w-full items-center justify-between rounded-md border border-input bg-background px-3 py-2 text-sm ring-offset-background placeholder:text-muted-foreground focus:outline-none focus:ring-2 focus:ring-ring focus:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 [&>span]:line-clamp-1`,a),r[4]=a,r[5]=s);let c;r[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,B.jsx)(Qi,{asChild:!0,children:(0,B.jsx)(O,{className:`h-4 w-4 opacity-50`})}),r[6]=c):c=r[6];let l;return r[7]!==i||r[8]!==o||r[9]!==t||r[10]!==s?(l=(0,B.jsxs)(Xi,{ref:t,className:s,...o,children:[i,c]}),r[7]=i,r[8]=o,r[9]=t,r[10]=s,r[11]=l):l=r[11],l});da.displayName=Xi.displayName;var fa=L.forwardRef((e,t)=>{let r=(0,z.c)(10),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`flex cursor-default items-center justify-center py-1`,i),r[3]=i,r[4]=o);let s;r[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,B.jsx)(j,{className:`h-4 w-4`}),r[5]=s):s=r[5];let c;return r[6]!==a||r[7]!==t||r[8]!==o?(c=(0,B.jsx)(oa,{ref:t,className:o,...a,children:s}),r[6]=a,r[7]=t,r[8]=o,r[9]=c):c=r[9],c});fa.displayName=oa.displayName;var pa=L.forwardRef((e,t)=>{let r=(0,z.c)(10),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`flex cursor-default items-center justify-center py-1`,i),r[3]=i,r[4]=o);let s;r[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,B.jsx)(O,{className:`h-4 w-4`}),r[5]=s):s=r[5];let c;return r[6]!==a||r[7]!==t||r[8]!==o?(c=(0,B.jsx)(sa,{ref:t,className:o,...a,children:s}),r[6]=a,r[7]=t,r[8]=o,r[9]=c):c=r[9],c});pa.displayName=sa.displayName;var ma=L.forwardRef((e,t)=>{let r=(0,z.c)(21),i,a,o,s;r[0]===e?(i=r[1],a=r[2],o=r[3],s=r[4]):({className:a,children:i,position:s,...o}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o,r[4]=s);let c=s===void 0?`popper`:s,l=c===`popper`&&`data-[side=bottom]:translate-y-1 data-[side=left]:-translate-x-1 data-[side=right]:translate-x-1 data-[side=top]:-translate-y-1`,u;r[5]!==a||r[6]!==l?(u=n(`relative z-50 max-h-96 min-w-[8rem] overflow-hidden rounded-md border bg-popover text-popover-foreground shadow-md data-[state=open]:animate-in data-[state=closed]:animate-out data-[state=closed]:fade-out-0 data-[state=open]:fade-in-0 data-[state=closed]:zoom-out-95 data-[state=open]:zoom-in-95 data-[side=bottom]:slide-in-from-top-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2`,l,a),r[5]=a,r[6]=l,r[7]=u):u=r[7];let d;r[8]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,B.jsx)(fa,{}),r[8]=d):d=r[8];let f=c===`popper`&&`h-[var(--radix-select-trigger-height)] w-full min-w-[var(--radix-select-trigger-width)]`,p;r[9]===f?p=r[10]:(p=n(`p-1`,f),r[9]=f,r[10]=p);let m;r[11]!==i||r[12]!==p?(m=(0,B.jsx)(ta,{className:p,children:i}),r[11]=i,r[12]=p,r[13]=m):m=r[13];let h;r[14]===Symbol.for(`react.memo_cache_sentinel`)?(h=(0,B.jsx)(pa,{}),r[14]=h):h=r[14];let g;return r[15]!==c||r[16]!==o||r[17]!==t||r[18]!==u||r[19]!==m?(g=(0,B.jsx)($i,{children:(0,B.jsxs)(ea,{ref:t,className:u,position:c,...o,children:[d,m,h]})}),r[15]=c,r[16]=o,r[17]=t,r[18]=u,r[19]=m,r[20]=g):g=r[20],g});ma.displayName=ea.displayName;var ha=L.forwardRef((e,t)=>{let r=(0,z.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`py-1.5 pl-8 pr-2 text-sm font-semibold`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,B.jsx)(na,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});ha.displayName=na.displayName;var ga=L.forwardRef((e,t)=>{let r=(0,z.c)(14),i,a,o;r[0]===e?(i=r[1],a=r[2],o=r[3]):({className:a,children:i,...o}=e,r[0]=e,r[1]=i,r[2]=a,r[3]=o);let s;r[4]===a?s=r[5]:(s=n(`relative flex w-full cursor-default select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50`,a),r[4]=a,r[5]=s);let c;r[6]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,B.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,B.jsx)(aa,{children:(0,B.jsx)(M,{className:`h-4 w-4`})})}),r[6]=c):c=r[6];let l;r[7]===i?l=r[8]:(l=(0,B.jsx)(ia,{children:i}),r[7]=i,r[8]=l);let u;return r[9]!==o||r[10]!==t||r[11]!==s||r[12]!==l?(u=(0,B.jsxs)(ra,{ref:t,className:s,...o,children:[c,l]}),r[9]=o,r[10]=t,r[11]=s,r[12]=l,r[13]=u):u=r[13],u});ga.displayName=ra.displayName;var _a=L.forwardRef((e,t)=>{let r=(0,z.c)(9),i,a;r[0]===e?(i=r[1],a=r[2]):({className:i,...a}=e,r[0]=e,r[1]=i,r[2]=a);let o;r[3]===i?o=r[4]:(o=n(`-mx-1 my-1 h-px bg-muted`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==t||r[7]!==o?(s=(0,B.jsx)(ca,{ref:t,className:o,...a}),r[5]=a,r[6]=t,r[7]=o,r[8]=s):s=r[8],s});_a.displayName=ca.displayName;var va=`__ALL_PROJECTS__`;function ya(e){let t=(0,z.c)(8),{text:n,maxLength:r}=e,i=r===void 0?100:r;if(n.length<=i){let e;return t[0]===n?e=t[1]:(e=(0,B.jsx)(B.Fragment,{children:n}),t[0]=n,t[1]=e),e}let a;t[2]!==i||t[3]!==n?(a=n.substring(0,i),t[2]=i,t[3]=n,t[4]=a):a=t[4];let o;t[5]===Symbol.for(`react.memo_cache_sentinel`)?(o=(0,B.jsx)(`span`,{className:`text-muted-foreground ml-2`,children:`...`}),t[5]=o):o=t[5];let s;return t[6]===a?s=t[7]:(s=(0,B.jsxs)(B.Fragment,{children:[a,o]}),t[6]=a,t[7]=s),s}function ba(e,t){let n=`${t} - `,r=e.title??e.threadId;return r.startsWith(n)?r.slice(n.length):r}async function xa(e){let t=[],n=new Set,r=``;for(let i of e)try{let e=await v(i.threadId);e?.messages&&(t.push(...e.messages),e.conversationIds&&e.conversationIds.forEach(e=>n.add(e)),e.lastUpdated>r&&(r=e.lastUpdated))}catch(e){console.warn(`Failed to load history for thread ${i.threadId}:`,e)}return t.sort((e,t)=>new Date(t.timestamp).getTime()-new Date(e.timestamp).getTime()),{messages:t,conversationIds:Array.from(n),lastUpdated:r??new Date().toISOString()}}var Sa=(0,L.memo)(function({isOpen:e,onClose:t,initialFilter:n,projects:r,inline:a}){let[s,l]=(0,L.useState)(null),[d,f]=(0,L.useState)(!1),[h,g]=(0,L.useState)(null),[_,y]=(0,L.useState)(0),[b,x]=(0,L.useState)(``),[S,T]=(0,L.useState)(``),E=(0,L.useCallback)(async e=>{f(!0),g(null);try{l(await v(e))}catch(e){g(e instanceof Error?e.message:`Failed to load conversation history`)}finally{f(!1)}},[]),O=(0,L.useCallback)(async e=>{if(e){f(!0),g(null);try{let t=r.find(t=>t.projectId===e);if(!t||t.threads.length===0){l({threadId:e,messages:[],lastUpdated:new Date().toISOString(),conversationIds:[]});return}l({threadId:e,...await xa(t.threads)})}catch(e){g(e instanceof Error?e.message:`Failed to load project history`)}finally{f(!1)}}},[r]),k=(0,L.useCallback)(async()=>{f(!0),g(null);try{l({threadId:va,...await xa(r.flatMap(e=>e.threads))})}catch(e){g(e instanceof Error?e.message:`Failed to load all projects history`)}finally{f(!1)}},[r]);(0,L.useEffect)(()=>{e&&n?n.type===`thread`?(T(n.id),x(``),y(0),E(n.id)):n.type===`project`&&(x(n.id),T(``),y(0),O(n.id)):e&&!n?(x(va),T(``),y(0),k()):e||(l(null),T(``),x(``),y(0),g(null))},[e,n,E,O,k]);let j=e=>{T(e),x(``),y(0),E(e)},M=e=>{x(e),T(``),y(0),e===va?k():O(e)},ee=e=>new Date(e).toLocaleString(),N=(e,t)=>{let n=new Date(e),r=new Date(t).getTime()-n.getTime();if(r<0)return{display:`0:00`,tooltip:`0 seconds`};let i=Math.floor(r/1e3),a=Math.floor(i/60),o=i%60,s=`${a}:${o.toString().padStart(2,`0`)}`,c;return c=a===0?`${o} second${o===1?``:`s`}`:o===0?`${a} minute${a===1?``:`s`}`:`${a} minute${a===1?``:`s`} ${o} second${o===1?``:`s`}`,{display:s,tooltip:c}},te=e=>({inputTokens:e.inputTokens??0,outputTokens:e.outputTokens??0});return e?(0,B.jsx)(`div`,{className:a?`h-full bg-background`:`fixed inset-0 z-50 bg-background`,children:(0,B.jsxs)(`div`,{className:`flex h-full flex-col`,children:[a?(0,B.jsxs)(`div`,{className:`flex items-center justify-between mb-6 px-6 pt-6`,children:[(0,B.jsxs)(`div`,{children:[(0,B.jsx)(`h1`,{className:`text-2xl font-bold`,children:`History`}),(0,B.jsx)(`p`,{className:`text-muted-foreground`,children:`View and browse conversation history across projects and threads.`})]}),(0,B.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,B.jsxs)(la,{value:b,onValueChange:M,children:[(0,B.jsx)(da,{className:`w-48`,children:(0,B.jsx)(ua,{placeholder:`Select project`})}),(0,B.jsxs)(ma,{children:[(0,B.jsx)(ga,{value:va,children:`All Projects`}),r.map(e=>(0,B.jsx)(ga,{value:e.projectId,children:e.name??e.projectId},e.projectId))]})]}),(0,B.jsxs)(la,{value:S,onValueChange:j,children:[(0,B.jsx)(da,{className:`w-48`,children:(0,B.jsx)(ua,{placeholder:`Select thread`})}),(0,B.jsx)(ma,{children:r.flatMap(e=>e.threads.map(t=>(0,B.jsx)(ga,{value:t.threadId,children:ba(t,e.name??e.projectId)},t.threadId)))})]})]})]}):(0,B.jsxs)(`div`,{className:`flex items-center justify-between border-b p-4`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,B.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Conversation History`}),(0,B.jsxs)(la,{value:S,onValueChange:j,children:[(0,B.jsx)(da,{className:`w-48`,children:(0,B.jsx)(ua,{placeholder:`Select thread`})}),(0,B.jsx)(ma,{children:r.flatMap(e=>e.threads.map(t=>(0,B.jsx)(ga,{value:t.threadId,children:ba(t,e.name??e.projectId)},t.threadId)))})]}),(0,B.jsxs)(la,{value:b,onValueChange:M,children:[(0,B.jsx)(da,{className:`w-48`,children:(0,B.jsx)(ua,{placeholder:`Select project`})}),(0,B.jsxs)(ma,{children:[(0,B.jsx)(ga,{value:va,children:`All Projects`}),r.map(e=>(0,B.jsx)(ga,{value:e.projectId,children:e.name??e.projectId},e.projectId))]})]})]}),(0,B.jsx)(F,{variant:`action`,size:`icon-sm`,onClick:t,children:(0,B.jsx)(c,{})})]}),s?.messages&&s.messages.length>0&&(0,B.jsxs)(`div`,{className:`flex items-center justify-between border-b ${a?`px-6 py-3`:`p-4`}`,children:[(0,B.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,B.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>{_>0&&y(_-1)},disabled:_===0,children:(0,B.jsx)(m,{className:`h-4 w-4 mr-1`})}),(0,B.jsx)(F,{variant:`outline`,size:`sm`,onClick:()=>{s?.messages&&_<s.messages.length-1&&y(_+1)},disabled:!s||_>=s.messages.length-1,children:(0,B.jsx)(w,{className:`h-4 w-4 ml-1`})})]}),(0,B.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[_+1,` of `,s?.messages.length??0,` messages`]})]}),(0,B.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:d?(0,B.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,B.jsxs)(`div`,{className:`text-center`,children:[(0,B.jsx)(o,{className:`h-8 w-8 animate-spin mx-auto mb-2`}),(0,B.jsx)(`p`,{children:`Loading conversation history...`})]})}):h?(0,B.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,B.jsxs)(D,{className:`max-w-md`,children:[(0,B.jsx)(C,{children:(0,B.jsx)(p,{className:`text-destructive`,children:`Error`})}),(0,B.jsxs)(A,{children:[(0,B.jsx)(`p`,{children:h}),(0,B.jsx)(F,{onClick:t,className:`mt-4`,children:`Close`})]})]})}):s?.messages?.length&&s.messages.length>0?(0,B.jsx)(i,{className:`h-full`,children:(0,B.jsx)(`div`,{className:a?`px-6 py-4`:`p-4`,children:(0,B.jsxs)(kr,{children:[(0,B.jsx)(Ar,{children:(0,B.jsxs)(Nr,{children:[(0,B.jsx)(Pr,{children:`Prompt`}),(0,B.jsx)(Pr,{children:`Answer`}),(0,B.jsx)(Pr,{className:`w-24`,children:`Model`}),(0,B.jsx)(Pr,{className:`w-24 text-right`,children:`Duration`}),(0,B.jsx)(Pr,{className:`w-20 text-right`,children:`Input Tokens`}),(0,B.jsx)(Pr,{className:`w-20 text-right`,children:`Output Tokens`}),(0,B.jsx)(Pr,{className:`w-32 text-right`,children:`Timestamp`})]})}),(0,B.jsx)(jr,{children:s.messages.map((e,t)=>{let{inputTokens:n,outputTokens:r}=te(e);return(0,B.jsxs)(Nr,{className:t===_?`bg-muted/50`:``,children:[(0,B.jsx)(Fr,{className:`max-w-md`,children:(0,B.jsx)(`div`,{className:`text-sm`,children:(0,B.jsx)(ya,{text:e.request.message})})}),(0,B.jsx)(Fr,{className:`max-w-md`,children:e.response?(0,B.jsx)(`div`,{className:`text-sm`,children:(0,B.jsx)(ya,{text:e.response.content})}):(0,B.jsx)(`span`,{className:`text-muted-foreground italic`,children:`No response`})}),(0,B.jsx)(Fr,{className:`text-sm`,children:(0,B.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,B.jsx)(u,{className:`h-3 w-3 text-muted-foreground`}),(0,B.jsx)(`span`,{className:`text-muted-foreground`,children:e.request.model})]})}),(0,B.jsx)(Fr,{className:`text-sm text-right`,children:e.response?(0,B.jsx)(wr,{children:(0,B.jsxs)(Tr,{children:[(0,B.jsx)(Er,{asChild:!0,children:(0,B.jsx)(`div`,{className:`cursor-help`,children:N(e.timestamp,e.response.completedAt).display})}),(0,B.jsx)(Dr,{children:(0,B.jsx)(`p`,{children:N(e.timestamp,e.response.completedAt).tooltip})})]})}):(0,B.jsx)(`span`,{className:`text-muted-foreground italic`,children:`-`})}),(0,B.jsx)(Fr,{className:`text-sm text-muted-foreground text-right`,children:n>0?n.toLocaleString():`-`}),(0,B.jsx)(Fr,{className:`text-sm text-muted-foreground text-right`,children:r>0?r.toLocaleString():`-`}),(0,B.jsx)(Fr,{className:`text-sm text-muted-foreground text-right`,children:ee(e.timestamp)})]},e.id)})})]})})}):(0,B.jsx)(`div`,{className:`flex h-full items-center justify-center p-6`,children:(0,B.jsxs)(`div`,{className:`max-w-md text-center space-y-2`,children:[(0,B.jsx)(`h3`,{className:`text-lg font-semibold`,children:`No History`}),(0,B.jsx)(`p`,{className:`text-muted-foreground`,children:`No conversation history found for this thread.`})]})})})]})}):null});export{pn as _,da as a,Dr as c,Rn as d,Nn as f,gn as g,Mn as h,ga as i,wr as l,Pn as m,la as n,Or as o,Fn as p,ma as r,Tr as s,Sa as t,Er as u};
|