tarsk 0.4.9 → 0.4.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (55) hide show
  1. package/dist/index.js +2829 -612
  2. package/dist/public/assets/account-view-BvHnxfR-.js +1 -0
  3. package/dist/public/assets/api-BfUK32d1.js +1 -0
  4. package/dist/public/assets/browser-tab-DYDpQIZc.js +1 -0
  5. package/dist/public/assets/context-menu-CoedP3Pg.js +1 -0
  6. package/dist/public/assets/conversation-history-view-CH3HrZK9.js +1 -0
  7. package/dist/public/assets/{dialogs-config-CdogKQE6.js → dialogs-config-Ofxg1Bn0.js} +13 -13
  8. package/dist/public/assets/diff-view-BAPFEZbh.js +3 -0
  9. package/dist/public/assets/explorer-tab-view-Dxet8lje.js +2 -0
  10. package/dist/public/assets/explorer-tree-DYE9rGNc.js +1 -0
  11. package/dist/public/assets/explorer-view-DgNDIV-D.js +1 -0
  12. package/dist/public/assets/history-view-BIN8vsvx.js +1 -0
  13. package/dist/public/assets/index-BOioHxIi.js +30 -0
  14. package/dist/public/assets/index-BVLzVjoR.css +1 -0
  15. package/dist/public/assets/onboarding-QnvOtCAY.js +1 -0
  16. package/dist/public/assets/onboarding-dialog-80pqyrMv.js +1 -0
  17. package/dist/public/assets/project-settings-view-Bi5zT3_9.js +1 -0
  18. package/dist/public/assets/provider-details-view-3tvO3r6m.js +1 -0
  19. package/dist/public/assets/providers-sidebar-CFwpsg_Y.js +1 -0
  20. package/dist/public/assets/react-vendor-Bi5X_3XM.js +17 -0
  21. package/dist/public/assets/settings-view-DWnpQjWE.js +2 -0
  22. package/dist/public/assets/store-BuY90jLM.js +2 -0
  23. package/dist/public/assets/terminal-panel-CLpupIW9.js +2 -0
  24. package/dist/public/assets/textarea-CxhrnOOz.js +1 -0
  25. package/dist/public/assets/todos-view-D2xLDhsC.js +1 -0
  26. package/dist/public/assets/{utils-B7eoN2Bj.js → utils-7CkwsQJ0.js} +1 -1
  27. package/dist/public/index.html +10 -10
  28. package/package.json +1 -1
  29. package/dist/public/assets/account-view-D2dv34vY.js +0 -1
  30. package/dist/public/assets/add-agent-view-DM__lVyy.js +0 -1
  31. package/dist/public/assets/add-rule-view-BomwxNHB.js +0 -7
  32. package/dist/public/assets/add-skill-view-JiUioTS0.js +0 -1
  33. package/dist/public/assets/add-slash-command-view--JU5d22L.js +0 -1
  34. package/dist/public/assets/conversation-history-view-C2i3vP6t.js +0 -1
  35. package/dist/public/assets/diff-view-BOokQeYx.js +0 -3
  36. package/dist/public/assets/file-tree-sidebar-BXedO8ZD.js +0 -1
  37. package/dist/public/assets/files-view-BK-J3s66.js +0 -1
  38. package/dist/public/assets/history-view-DtTMEZIl.js +0 -1
  39. package/dist/public/assets/index-BR4u03pf.js +0 -17
  40. package/dist/public/assets/index-LCD_R39p.css +0 -1
  41. package/dist/public/assets/mcp-manager-BNA3V6Cy.js +0 -1
  42. package/dist/public/assets/mcp-server-edit-view-B_xPUXV1.js +0 -5
  43. package/dist/public/assets/mcp-servers-sidebar-Cv-D6sy7.js +0 -1
  44. package/dist/public/assets/mcp-view-TSM0sRuR.js +0 -1
  45. package/dist/public/assets/onboarding-dialog-C3veuByQ.js +0 -1
  46. package/dist/public/assets/onboarding-gO0dp5Em.js +0 -1
  47. package/dist/public/assets/project-settings-view-CwvIMmXu.js +0 -1
  48. package/dist/public/assets/provider-details-view-Dcm9ZdOm.js +0 -1
  49. package/dist/public/assets/providers-sidebar-B5hxgXyK.js +0 -1
  50. package/dist/public/assets/radio-group-BQ7i054U.js +0 -1
  51. package/dist/public/assets/react-vendor-BNQTbRKd.js +0 -17
  52. package/dist/public/assets/settings-view-Di5K8IgA.js +0 -2
  53. package/dist/public/assets/store-CB5vVIg-.js +0 -2
  54. package/dist/public/assets/use-toast-DCmq-wgl.js +0 -1
  55. /package/dist/public/assets/{monaco-DKN4dKR5.js → monaco-CgzMkQ7t.js} +0 -0
@@ -0,0 +1,2 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/providers-sidebar-CFwpsg_Y.js","assets/rolldown-runtime-Dw2cE7zH.js","assets/index-BOioHxIi.js","assets/react-vendor-Bi5X_3XM.js","assets/history-view-BIN8vsvx.js","assets/dialogs-config-Ofxg1Bn0.js","assets/monaco-CgzMkQ7t.js","assets/onboarding-QnvOtCAY.js","assets/textarea-CxhrnOOz.js","assets/store-BuY90jLM.js","assets/utils-7CkwsQJ0.js","assets/index-BVLzVjoR.css","assets/provider-details-view-3tvO3r6m.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Yt as t,br as n,ra as r,ta as i}from"./dialogs-config-Ofxg1Bn0.js";import{_t as a,gt as o,ht as s,mt as c}from"./react-vendor-Bi5X_3XM.js";import{f as l,n as u,r as d,t as f}from"./index-BOioHxIi.js";var p=i(),m=e(r(),1),h=n(),g=(0,m.forwardRef)(function(e,t){let n=(0,p.c)(20),{sidebar:r,children:i,defaultSidebarSize:a,minSidebarSize:o,maxSidebarSize:s,minContentSize:c,collapsible:l,collapsedSize:m,className:g,onCollapse:_,onExpand:v}=e,y=a===void 0?25:a,b=o===void 0?20:o,x=s===void 0?30:s,S=c===void 0?40:c,C=l===void 0?!1:l,w=m===void 0?0:m,T=`h-full ${g===void 0?``:g}`,E;n[0]!==w||n[1]!==C||n[2]!==y||n[3]!==x||n[4]!==b||n[5]!==_||n[6]!==v||n[7]!==t||n[8]!==r?(E=(0,h.jsx)(u,{ref:t,defaultSize:y,minSize:b,maxSize:x,collapsible:C,collapsedSize:w,onCollapse:_,onExpand:v,className:`border-r border-transparent`,children:r}),n[0]=w,n[1]=C,n[2]=y,n[3]=x,n[4]=b,n[5]=_,n[6]=v,n[7]=t,n[8]=r,n[9]=E):E=n[9];let D;n[10]===Symbol.for(`react.memo_cache_sentinel`)?(D=(0,h.jsx)(f,{withHandle:!0,className:`ml-[-40px]`}),n[10]=D):D=n[10];let O;n[11]!==i||n[12]!==S?(O=(0,h.jsx)(u,{minSize:S,className:`overflow-hidden`,children:i}),n[11]=i,n[12]=S,n[13]=O):O=n[13];let k;n[14]!==O||n[15]!==E?(k=(0,h.jsxs)(d,{direction:`horizontal`,className:`h-full`,children:[E,D,O]}),n[14]=O,n[15]=E,n[16]=k):k=n[16];let A;return n[17]!==k||n[18]!==T?(A=(0,h.jsx)(`div`,{className:T,children:k}),n[17]=k,n[18]=T,n[19]=A):A=n[19],A}),_=(0,m.lazy)(()=>a(()=>import(`./providers-sidebar-CFwpsg_Y.js`),__vite__mapDeps([0,1,2,3,4,5,6,7,8,9,10,11]))),v=(0,m.lazy)(()=>a(()=>import(`./provider-details-view-3tvO3r6m.js`),__vite__mapDeps([12,1,2,3,4,5,6,7,8,9,10,11]))),y=[`providers`];function b(e){let t=(0,p.c)(5),{title:n}=e,r;t[0]===n?r=t[1]:(r=(0,h.jsx)(`h2`,{className:`text-lg font-semibold text-muted-foreground mb-2`,children:n}),t[0]=n,t[1]=r);let i;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(i=(0,h.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Content coming soon...`}),t[2]=i):i=t[2];let a;return t[3]===r?a=t[4]:(a=(0,h.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,h.jsxs)(`div`,{className:`text-center`,children:[r,i]})}),t[3]=r,t[4]=a),a}function x(){let e=(0,p.c)(30),{tab:t}=o(),n=s(),r=c(),i;if(e[0]!==r.search||e[1]!==t){let n=new URLSearchParams(r.search).get(`tab`);i=n&&y.includes(n)?n:t&&y.includes(t)?t:`providers`,e[0]=r.search,e[1]=t,e[2]=i}else i=e[2];let a=i,[u,d]=(0,m.useState)(!1),f=(0,m.useRef)(null),[x,C]=(0,m.useState)(null),w=S,T;e[3]===n?T=e[4]:(T=()=>{n(`/`)},e[3]=n,e[4]=T);let E=T,D;e[5]===n?D=e[6]:(D=e=>{C(e),n(`/settings?tab=providers`,{replace:!0})},e[5]=n,e[6]=D);let O=D,k,A;e[7]!==r.pathname||e[8]!==n?(k=()=>{[`/settings/account`,`/settings/project`,`/settings/mcp-servers`,`/settings/mcp-server-edit`,`/settings/add-skill`,`/settings/add-command`,`/settings/add-rule`,`/settings/add-agent`].some(e=>r.pathname.startsWith(e))&&n(`/settings/providers`,{replace:!0})},A=[r.pathname,n],e[7]=r.pathname,e[8]=n,e[9]=k,e[10]=A):(k=e[9],A=e[10]),(0,m.useEffect)(k,A);let j;e[11]!==E||e[12]!==O||e[13]!==x?(j=()=>(0,h.jsx)(l,{onTitleClose:E,subtitle:`Model Providers`,onResetOnboarding:w,children:(0,h.jsx)(`div`,{className:`px-2 py-2`,children:(0,h.jsx)(m.Suspense,{fallback:(0,h.jsx)(`div`,{className:`animate-pulse h-4 bg-muted rounded`}),children:(0,h.jsx)(_,{selectedProvider:x,onProviderSelect:O})})})}),e[11]=E,e[12]=O,e[13]=x,e[14]=j):j=e[14];let M=j,N;e[15]!==a||e[16]!==x?(N=()=>{switch(a){case`providers`:return(0,h.jsx)(m.Suspense,{fallback:(0,h.jsx)(b,{title:`Provider Details`}),children:(0,h.jsx)(v,{selectedProviderName:x})});default:return(0,h.jsx)(b,{title:`Settings`})}},e[15]=a,e[16]=x,e[17]=N):N=e[17];let P=N,F,I;e[18]===Symbol.for(`react.memo_cache_sentinel`)?(F=()=>d(!0),I=()=>d(!1),e[18]=F,e[19]=I):(F=e[18],I=e[19]);let L;e[20]===M?L=e[21]:(L=M(),e[20]=M,e[21]=L);let R=`h-full overflow-auto ${u?`ml-[40px]`:``}`,z;e[22]===P?z=e[23]:(z=P(),e[22]=P,e[23]=z);let B;e[24]!==R||e[25]!==z?(B=(0,h.jsx)(`div`,{className:R,children:z}),e[24]=R,e[25]=z,e[26]=B):B=e[26];let V;return e[27]!==B||e[28]!==L?(V=(0,h.jsx)(g,{ref:f,collapsible:!0,onCollapse:F,onExpand:I,sidebar:L,children:B}),e[27]=B,e[28]=L,e[29]=V):V=e[29],V}async function S(){try{await t()}catch(e){let t=e;console.error(`Failed to reset onboarding:`,t)}}export{x as default};
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{ra as t,ta as n}from"./dialogs-config-Ofxg1Bn0.js";function r(e){return typeof e==`string`?e.replace(/\\n/g,`
2
+ `).replace(/✅/g,`✓`):``}function i(e){if(!e||typeof e!=`string`)return null;let t=e.trim();if(!t)return null;let n=[],r=0;for(;r<t.length;){let e=t.indexOf(`[`,r);if(e===-1){let e=t.slice(r).trim();e&&n.push({type:`reasoning`,text:e});break}let i=t.slice(r,e).trim();i&&n.push({type:`reasoning`,text:i});let a=0,o=-1;for(let n=e;n<t.length;n++)if(t[n]===`[`)a++;else if(t[n]===`]`&&(a--,a===0)){o=n;break}if(o===-1){let r=t.slice(e).trim();r&&n.push({type:`reasoning`,text:r});break}try{let r=JSON.parse(t.slice(e,o+1));if(Array.isArray(r)){for(let e of r)if(e&&typeof e==`object`&&`type`in e){let t=e.type;(t===`tool-result`||t===`tool_use`)&&n.push(e)}}}catch{let r=t.slice(e,o+1).trim();r&&n.push({type:`reasoning`,text:r})}r=o+1}return n.length>0?n:null}function a(e){return e.map(e=>{if(typeof e==`object`&&e&&!(`type`in e)){let t=e;if(t.reasoning)return{type:`reasoning`,text:typeof t.reasoning==`string`?t.reasoning:JSON.stringify(t.reasoning)};let n=t.text??t.content??t.answer;if(n)return{type:`text`,text:typeof n==`string`?n:JSON.stringify(n)}}return e})}function o(e){let t=[];e.reasoning&&typeof e.reasoning==`string`&&t.push({type:`reasoning`,text:e.reasoning});let n=(typeof e.text==`string`?e.text:null)??(typeof e.content==`string`?e.content:null)??(typeof e.answer==`string`?e.answer:null);return n&&t.push({type:`text`,text:n}),t.length===0&&Object.keys(e).length>0&&t.push({type:`text`,text:JSON.stringify(e,null,2)}),t}function s(e){if(!e)return null;let t=e.trim();if(t.startsWith(`{`)||t.startsWith(`[`))try{let e=JSON.parse(t);if(Array.isArray(e))return a(e);if(typeof e==`object`&&e)return o(e)}catch{}let n=[],r=e.indexOf(`{`),i=e.indexOf(`[`),s=r===-1?i:i===-1?r:Math.min(r,i);if(s!==-1){let t=e.slice(s),r=Math.max(t.lastIndexOf(`]`),t.lastIndexOf(`}`));if(r!==-1){let e=t.substring(0,r+1);try{let i=JSON.parse(e);Array.isArray(i)?n.push(...a(i)):n.push(...o(i));let s=t.substring(r+1).trim();return s&&n.push({type:`text`,text:s}),n}catch{}}}return null}function c(e,t,n){let r=e[e.length-1];return r?.type===t?[...e.slice(0,-1),{type:t,chunks:[...r.chunks,n]}]:[...e,{type:t,chunks:[n]}]}function l(e,t){return e[e.length-1]?.type===`content`?[...e.slice(0,-1),{type:`content`,chunks:[t]}]:[...e,{type:`content`,chunks:[t]}]}function u(e){let t=[];for(let n of e){let e=n.chunks.join(``);if(n.type===`thinking`){let n=i(e)??[];t.push(...n)}else{let n=s(e)??(e.trim()?[{type:`text`,text:e}]:[]);t.push(...n)}}return t}function d(e){let t=u(e);return t.length===0?`...`:t.length===1&&t[0]?.type===`text`&&`text`in t[0]?t[0].text:JSON.stringify(t)}var f=n(),p=e(t(),1),m=function(e){return e.SetProjects=`SET_PROJECTS`,e.SetProjectsLoading=`SET_PROJECTS_LOADING`,e.SelectThread=`SELECT_THREAD`,e.SetMessages=`SET_MESSAGES`,e.AddMessage=`ADD_MESSAGE`,e.EnqueueChatMessage=`ENQUEUE_CHAT_MESSAGE`,e.RemoveQueuedChatMessage=`REMOVE_QUEUED_CHAT_MESSAGE`,e.SetStreaming=`SET_STREAMING`,e.AppendStreamContent=`APPEND_STREAM_CONTENT`,e.SetStreamContent=`SET_STREAM_CONTENT`,e.AppendStreamThinking=`APPEND_STREAM_THINKING`,e.AppendStreamChunk=`APPEND_STREAM_CHUNK`,e.SetStreamModel=`SET_STREAM_MODEL`,e.SetProjectModel=`SET_PROJECT_MODEL`,e.ResetStream=`RESET_STREAM`,e.StopStream=`STOP_STREAM`,e.ToggleSidebar=`TOGGLE_SIDEBAR`,e.SetCreatingProject=`SET_CREATING_PROJECT`,e.ConfigUpdated=`CONFIG_UPDATED`,e.SetProcessingThreads=`SET_PROCESSING_THREADS`,e.AddProcessingThread=`ADD_PROCESSING_THREAD`,e.RemoveProcessingThread=`REMOVE_PROCESSING_THREAD`,e.AddCreatingProject=`ADD_CREATING_PROJECT`,e.AddCreatingThread=`ADD_CREATING_THREAD`,e.RemoveCreatingProject=`REMOVE_CREATING_PROJECT`,e.RemoveCreatingThread=`REMOVE_CREATING_THREAD`,e.MarkThreadCompleted=`MARK_THREAD_COMPLETED`,e.ClearThreadCompleted=`CLEAR_THREAD_COMPLETED`,e.AddDeletingThread=`ADD_DELETING_THREAD`,e.RemoveDeletingThread=`REMOVE_DELETING_THREAD`,e.AddDeletingProject=`ADD_DELETING_PROJECT`,e.RemoveDeletingProject=`REMOVE_DELETING_PROJECT`,e.AppendCommandOutput=`APPEND_COMMAND_OUTPUT`,e.SetRunningCommand=`SET_RUNNING_COMMAND`,e.ClearCommandOutput=`CLEAR_COMMAND_OUTPUT`,e.ToggleTerminal=`TOGGLE_TERMINAL`,e.SetTerminalOpen=`SET_TERMINAL_OPEN`,e.QueueTerminalCommand=`QUEUE_TERMINAL_COMMAND`,e.ClearQueuedTerminalCommand=`CLEAR_QUEUED_TERMINAL_COMMAND`,e.AppendTerminalLine=`APPEND_TERMINAL_LINE`,e.ClearTerminalOutput=`CLEAR_TERMINAL_OUTPUT`,e.SetTerminalHeight=`SET_TERMINAL_HEIGHT`,e.SetTerminalCwd=`SET_TERMINAL_CWD`,e.SetTerminalRunning=`SET_TERMINAL_RUNNING`,e.SetTerminalHistory=`SET_TERMINAL_HISTORY`,e.SetTerminalHistoryIndex=`SET_TERMINAL_HISTORY_INDEX`,e.UpdateThreadTitle=`UPDATE_THREAD_TITLE`,e.ClearFocusChatInput=`CLEAR_FOCUS_CHAT_INPUT`,e.ClearMessages=`CLEAR_MESSAGES`,e.UpdateToolCallProgress=`UPDATE_TOOL_CALL_PROGRESS`,e.SetPendingChatMessage=`SET_PENDING_CHAT_MESSAGE`,e.ClearPendingChatMessage=`CLEAR_PENDING_CHAT_MESSAGE`,e.SetDiffComments=`SET_DIFF_COMMENTS`,e.ClearSelection=`CLEAR_SELECTION`,e}({}),h={projects:[],projectsLoading:!0,selectedThreadId:null,selectedProjectId:null,messages:[],queuedChatMessages:[],isStreaming:!1,streamingContent:``,streamingThinking:``,streamingSegments:[],streamingModel:``,projectModelSelections:{},sidebarOpen:!0,isCreatingProject:!1,configUpdatedAt:0,processingThreadIds:[],completedThreadIds:[],deletingThreadIds:[],deletingProjectIds:[],commandOutput:``,isRunningCommand:!1,terminalStates:{},focusChatInput:!1,toolCallProgress:{},pendingChatMessage:null,diffComments:{}};function g(e,t){switch(t.type){case m.SetProjects:{let n={...e.projectModelSelections};for(let e of t.projects)for(let t of e.threads){if(!t.model)continue;let e=n[t.threadId];n[t.threadId]={id:t.model,provider:t.modelProvider,name:e?.name??t.model,description:e?.description??``,context_length:e?.context_length,features:e?.features,input_modalities:e?.input_modalities,max_output:e?.max_output,pricing:e?.pricing,tarsk_use:e?.tarsk_use,coding_index:e?.coding_index,supportsImages:e?.supportsImages}}return{...e,projects:t.projects,projectModelSelections:n}}case m.SetProjectsLoading:return{...e,projectsLoading:t.projectsLoading};case m.SelectThread:return{...e,selectedThreadId:t.threadId,selectedProjectId:t.projectId,messages:t.initialMessages??[],focusChatInput:t.focusInput??!1};case m.ClearSelection:return{...e,selectedThreadId:null,selectedProjectId:null,messages:[]};case m.SetMessages:return{...e,messages:t.messages};case m.AddMessage:return{...e,messages:[...e.messages,t.message]};case m.EnqueueChatMessage:return{...e,queuedChatMessages:[...e.queuedChatMessages,t.message]};case m.RemoveQueuedChatMessage:return{...e,queuedChatMessages:e.queuedChatMessages.filter(e=>e.id!==t.queuedMessageId)};case m.SetStreaming:return{...e,isStreaming:t.isStreaming};case m.AppendStreamContent:return{...e,streamingContent:e.streamingContent+t.content};case m.SetStreamContent:{let n=l(e.streamingSegments,t.content);return{...e,streamingContent:t.content,streamingSegments:n}}case m.AppendStreamThinking:return{...e,streamingThinking:e.streamingThinking+t.content};case m.AppendStreamChunk:return{...e,streamingSegments:t.segments,streamingContent:t.chunkType===`content`?e.streamingContent+t.content:e.streamingContent,streamingThinking:t.chunkType===`thinking`?e.streamingThinking+t.content:e.streamingThinking};case m.SetStreamModel:return{...e,streamingModel:t.model};case m.SetProjectModel:return console.log(`[Store] SetProjectModel action:`,{threadId:t.threadId,model:{id:t.model.id,provider:t.model.provider}}),{...e,projects:e.projects.map(e=>({...e,threads:e.threads.map(e=>e.threadId===t.threadId?{...e,model:t.model.id,modelProvider:t.model.provider}:e)})),projectModelSelections:{...e.projectModelSelections,[t.threadId]:t.model}};case m.ResetStream:return{...e,streamingContent:``,streamingThinking:``,streamingSegments:[],streamingModel:``,isStreaming:!1,toolCallProgress:{}};case m.StopStream:return{...e,isStreaming:!1};case m.ToggleSidebar:return{...e,sidebarOpen:!e.sidebarOpen};case m.SetCreatingProject:return{...e,isCreatingProject:t.isCreating};case m.ConfigUpdated:return{...e,configUpdatedAt:Date.now()};case m.SetProcessingThreads:return{...e,processingThreadIds:t.threadIds};case m.AddProcessingThread:return{...e,processingThreadIds:e.processingThreadIds.includes(t.threadId)?e.processingThreadIds:[...e.processingThreadIds,t.threadId]};case m.RemoveProcessingThread:return{...e,processingThreadIds:e.processingThreadIds.filter(e=>e!==t.threadId)};case m.AddCreatingProject:return{...e,projects:[...e.projects,{projectId:t.projectId,name:t.projectName,gitUrl:t.gitUrl,threads:[{threadId:t.threadId,title:`thread-1`,path:``,currentBranch:``}]}]};case m.AddCreatingThread:return{...e,projects:e.projects.map(e=>e.projectId===t.projectId?{...e,threads:[...e.threads,{threadId:t.threadId,title:t.title,path:``,currentBranch:``}]}:e)};case m.RemoveCreatingProject:return{...e,projects:e.projects.filter(e=>e.projectId!==t.projectId)};case m.RemoveCreatingThread:return{...e,projects:e.projects.map(e=>e.projectId===t.projectId?{...e,threads:e.threads.filter(e=>e.threadId!==t.threadId)}:e)};case m.MarkThreadCompleted:return{...e,completedThreadIds:e.completedThreadIds.includes(t.threadId)?e.completedThreadIds:[...e.completedThreadIds,t.threadId]};case m.ClearThreadCompleted:return{...e,completedThreadIds:e.completedThreadIds.filter(e=>e!==t.threadId)};case m.AddDeletingThread:return{...e,deletingThreadIds:e.deletingThreadIds.includes(t.threadId)?e.deletingThreadIds:[...e.deletingThreadIds,t.threadId]};case m.RemoveDeletingThread:return{...e,deletingThreadIds:e.deletingThreadIds.filter(e=>e!==t.threadId)};case m.AddDeletingProject:return{...e,deletingProjectIds:e.deletingProjectIds.includes(t.projectId)?e.deletingProjectIds:[...e.deletingProjectIds,t.projectId]};case m.RemoveDeletingProject:return{...e,deletingProjectIds:e.deletingProjectIds.filter(e=>e!==t.projectId)};case m.AppendCommandOutput:return{...e,commandOutput:e.commandOutput+t.content};case m.SetRunningCommand:return{...e,isRunningCommand:t.isRunning};case m.ClearCommandOutput:return{...e,commandOutput:``};case m.ToggleTerminal:{let n=t.threadId,r=e.terminalStates[n]??{open:!1,queuedCommand:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1};return{...e,terminalStates:{...e.terminalStates,[n]:{...r,open:!r.open}}}}case m.SetTerminalOpen:{let n=t.threadId??`default`,r=e.terminalStates[n]??{open:!1,queuedCommand:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1};return{...e,terminalStates:{...e.terminalStates,[n]:{...r,open:t.open}}}}case m.QueueTerminalCommand:{let n=t.threadId,r=e.terminalStates[n]??{open:!1,queuedCommand:null,queuedRelativeFolder:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1};return{...e,terminalStates:{...e.terminalStates,[n]:{...r,queuedCommand:t.command,queuedRelativeFolder:t.relativeFolder??null,open:!0}}}}case m.ClearQueuedTerminalCommand:{let n=t.threadId,r=e.terminalStates[n]??{open:!1,queuedCommand:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1};return{...e,terminalStates:{...e.terminalStates,[n]:{...r,queuedCommand:null}}}}case m.AppendTerminalLine:{let n=t.threadId??`default`,r=e.terminalStates[n]??{open:!1,queuedCommand:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1};return{...e,terminalStates:{...e.terminalStates,[n]:{...r,outputLines:[...r.outputLines,t.line]}}}}case m.ClearTerminalOutput:{let n=t.threadId??`default`,r=e.terminalStates[n]??{open:!1,queuedCommand:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1};return{...e,terminalStates:{...e.terminalStates,[n]:{...r,outputLines:[]}}}}case m.SetTerminalHeight:{let n=t.threadId,r=e.terminalStates[n]??{open:!1,queuedCommand:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1};return{...e,terminalStates:{...e.terminalStates,[n]:{...r,height:t.height}}}}case m.SetTerminalCwd:{let n=t.threadId,r=e.terminalStates[n]??{open:!1,queuedCommand:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1};return{...e,terminalStates:{...e.terminalStates,[n]:{...r,cwd:t.cwd}}}}case m.SetTerminalRunning:{let n=t.threadId,r=e.terminalStates[n]??{open:!1,queuedCommand:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1};return{...e,terminalStates:{...e.terminalStates,[n]:{...r,isRunning:t.isRunning}}}}case m.SetTerminalHistory:{let n=t.threadId,r=e.terminalStates[n]??{open:!1,queuedCommand:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1};return{...e,terminalStates:{...e.terminalStates,[n]:{...r,history:t.history}}}}case m.SetTerminalHistoryIndex:{let n=t.threadId,r=e.terminalStates[n]??{open:!1,queuedCommand:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1};return{...e,terminalStates:{...e.terminalStates,[n]:{...r,historyIndex:t.index}}}}case m.UpdateThreadTitle:return{...e,projects:e.projects.map(e=>e.projectId===t.projectId?{...e,threads:e.threads.map(e=>e.threadId===t.threadId?{...e,title:t.title}:e)}:e)};case m.ClearFocusChatInput:return{...e,focusChatInput:!1};case m.ClearMessages:return{...e,messages:[]};case m.UpdateToolCallProgress:return{...e,toolCallProgress:{...e.toolCallProgress,[t.toolCallId]:t.progress}};case m.SetPendingChatMessage:return{...e,pendingChatMessage:t.message};case m.ClearPendingChatMessage:return{...e,pendingChatMessage:null};case m.SetDiffComments:return{...e,diffComments:{...e.diffComments,[t.threadId]:t.comments}};default:return e}}var _=(0,p.createContext)({state:h,dispatch:()=>{}});function v(){return(0,p.useContext)(_)}function y(e){let t=(0,f.c)(11),{state:n,dispatch:r}=v();if(!e){let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=[],t[0]=e):e=t[0];let n;return t[1]===Symbol.for(`react.memo_cache_sentinel`)?(n={terminalState:{open:!1,queuedCommand:null,queuedRelativeFolder:null,outputLines:e,height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1},dispatch:b},t[1]=n):n=t[1],n}let i;t[2]!==n.terminalStates||t[3]!==e?(i=n.terminalStates[e]||{open:!1,queuedCommand:null,outputLines:[],height:300,history:[],historyIndex:-1,cwd:`.`,isRunning:!1},t[2]=n.terminalStates,t[3]=e,t[4]=i):i=t[4];let a=i,o;t[5]!==r||t[6]!==e?(o=t=>{r({...t,threadId:e})},t[5]=r,t[6]=e,t[7]=o):o=t[7];let s=o,c;return t[8]!==s||t[9]!==a?(c={terminalState:a,dispatch:s},t[8]=s,t[9]=a,t[10]=c):c=t[10],c}function b(){}export{v as a,u as c,r as d,s as f,h as i,c as l,_ as n,y as o,i as p,g as r,d as s,m as t,l as u};
@@ -0,0 +1,2 @@
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Fi as t,Wi as n,Xt as r,br as i,ra as a}from"./dialogs-config-Ofxg1Bn0.js";import{a as o,o as s,t as c}from"./store-BuY90jLM.js";import{c as l}from"./index-BOioHxIi.js";var u=e(a(),1),d=i();function f(){let e=o().state,{selectedProjectId:i,selectedThreadId:a}=e,{terminalState:f,dispatch:p}=s(a),{queuedCommand:m,queuedRelativeFolder:h,outputLines:g,history:_,historyIndex:v,cwd:y,isRunning:b}=f,[x,S]=(0,u.useState)(``),[C,w]=(0,u.useState)([]),T=e.projects.flatMap(e=>e.threads).find(e=>e.threadId===a)?.path??null,E=!y||y===`.`||y===`./`?T:y,D=!E||E===T,{activeMainTab:O}=l(),k=(0,u.useRef)(null),A=(0,u.useRef)(null),j=(0,u.useRef)(0);(0,u.useEffect)(()=>{k.current&&(k.current.scrollTop=k.current.scrollHeight)},[C]),(0,u.useEffect)(()=>{w(g),j.current=g.length},[a,g]),(0,u.useEffect)(()=>{if(g.length===0)w([]),j.current=0;else if(g.length>j.current){let e=g.slice(j.current);w(t=>[...t,...e]),j.current=g.length}},[g]),(0,u.useEffect)(()=>{b||A.current?.focus()},[b]),(0,u.useEffect)(()=>{O===`terminal`&&A.current?.focus()},[O]);let M=(0,u.useCallback)(async(e,t)=>{if(!(!i||!a||!e.trim())){p({type:c.AppendTerminalLine,line:{type:`input`,content:e}}),p({type:c.SetTerminalHistory,history:[e,..._.filter(t=>t!==e)].slice(0,50)}),p({type:c.SetTerminalHistoryIndex,index:-1}),S(``),p({type:c.SetTerminalRunning,isRunning:!0});try{let n=await r(i,a,e,t??void 0);if(!n){p({type:c.AppendTerminalLine,line:{type:`system`,content:`Command started but no output stream received.`}}),p({type:c.SetTerminalRunning,isRunning:!1});return}let o=n.getReader(),s=new TextDecoder,l=``;for(;;){let{done:e,value:t}=await o.read();if(e)break;l+=s.decode(t,{stream:!0});let n=l.split(`
2
+ `);l=n.pop()??``;for(let e of n)if(e.trim())try{let t=JSON.parse(e);typeof t==`string`?p({type:c.AppendTerminalLine,line:{type:`output`,content:t}}):t.type===`error`?p({type:c.AppendTerminalLine,line:{type:`error`,content:t.message}}):t.type===`cwd`&&p({type:c.SetTerminalCwd,cwd:t.path})}catch{p({type:c.AppendTerminalLine,line:{type:`output`,content:e}})}}if(l.trim())try{let e=JSON.parse(l);typeof e==`string`?p({type:c.AppendTerminalLine,line:{type:`output`,content:e}}):e.type===`error`?p({type:c.AppendTerminalLine,line:{type:`error`,content:e.message}}):e.type===`cwd`&&p({type:c.SetTerminalCwd,cwd:e.path})}catch{p({type:c.AppendTerminalLine,line:{type:`output`,content:l}})}}catch(e){p({type:c.AppendTerminalLine,line:{type:`error`,content:e instanceof Error?e.message:`Failed to run command`}})}finally{p({type:c.SetTerminalRunning,isRunning:!1})}}},[i,a,p,_]);return(0,u.useEffect)(()=>{m&&!b&&(M(m,h??void 0),p({type:c.ClearQueuedTerminalCommand}))},[m,h,b,p,M]),(0,d.jsxs)(`div`,{className:`flex flex-col h-full bg-neutral-950 text-neutral-200 font-mono text-sm overflow-hidden`,children:[(0,d.jsxs)(`div`,{ref:k,className:`flex-1 overflow-y-auto p-4 space-y-0.5 terminal-scrollbar`,onClick:e=>{e.target===e.currentTarget&&A.current?.focus()},children:[C.length===0&&!b&&(0,d.jsx)(`div`,{className:`text-neutral-600 italic text-xs`,children:`Enter your commands below...`}),C.map((e,t)=>(0,d.jsxs)(`div`,{className:`whitespace-pre-wrap break-all leading-6 ${e.type===`input`?`flex items-start gap-2 text-neutral-200`:e.type===`error`?`text-red-400`:e.type===`system`?`text-blue-400`:``}`,children:[e.type===`input`&&(0,d.jsx)(n,{className:`h-4 w-4 mt-1 shrink-0 text-blue-400/70`}),(0,d.jsx)(`span`,{children:e.content})]},t))]}),(0,d.jsxs)(`div`,{className:`flex items-center gap-2 px-4 py-2 border-t border-white/5 bg-white/5`,children:[!D&&(0,d.jsx)(`span`,{className:`text-blue-400 text-xs font-bold whitespace-nowrap`,children:E.split(`/`).pop()}),(0,d.jsx)(n,{className:`h-4 w-4 text-blue-400 ${D?``:`-ml-1`}`}),(0,d.jsx)(`input`,{ref:A,type:`text`,className:`flex-1 bg-transparent border-none outline-none text-neutral-200 placeholder:text-neutral-700 h-6`,placeholder:b?`Running...`:`Type a command...`,value:x,onChange:e=>S(e.target.value),onKeyDown:e=>{if(e.key===`Enter`)M(x);else if(e.key===`ArrowUp`){e.preventDefault();let t=v+1;t<_.length&&(p({type:c.SetTerminalHistoryIndex,index:t}),S(_[t]))}else if(e.key===`ArrowDown`){e.preventDefault();let t=v-1;t>=0?(p({type:c.SetTerminalHistoryIndex,index:t}),S(_[t])):(p({type:c.SetTerminalHistoryIndex,index:-1}),S(``))}},disabled:b}),(0,d.jsxs)(`div`,{className:`flex items-center gap-1 px-1.5 py-0.5 rounded border border-white/10 bg-white/5`,children:[(0,d.jsx)(t,{className:`h-3 w-3 text-neutral-600`}),(0,d.jsx)(`span`,{className:`text-[10px] text-neutral-600 uppercase font-bold`,children:`Enter`})]})]})]})}export{f as TerminalPanel};
@@ -0,0 +1 @@
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Vn as t,br as n,ra as r,ta as i}from"./dialogs-config-Ofxg1Bn0.js";var a=i(),o=e(r(),1),s=n(),c=o.forwardRef((e,n)=>{let r=(0,a.c)(9),i,o;r[0]===e?(i=r[1],o=r[2]):({className:i,...o}=e,r[0]=e,r[1]=i,r[2]=o);let c;r[3]===i?c=r[4]:(c=t(`flex min-h-[80px] w-full rounded-md border border-input bg-background px-3 py-2 text-base ring-offset-background placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 disabled:cursor-not-allowed disabled:opacity-50 md:text-sm`,i),r[3]=i,r[4]=c);let l;return r[5]!==o||r[6]!==n||r[7]!==c?(l=(0,s.jsx)(`textarea`,{className:c,ref:n,...o}),r[5]=o,r[6]=n,r[7]=c,r[8]=l):l=r[8],l});c.displayName=`Textarea`;export{c as t};
@@ -0,0 +1 @@
1
+ import"./dialogs-config-Ofxg1Bn0.js";import"./react-vendor-Bi5X_3XM.js";import"./store-BuY90jLM.js";import"./textarea-CxhrnOOz.js";import"./history-view-BIN8vsvx.js";import{u as e}from"./index-BOioHxIi.js";export{e as TodosView};
@@ -1 +1 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Fi as t}from"./dialogs-config-CdogKQE6.js";var n=e(t(),1),r=(e,t,n,r,i,a,o,s)=>{let c=document.documentElement,l=[`light`,`dark`];function u(t){(Array.isArray(e)?e:[e]).forEach(e=>{let n=e===`class`,r=n&&a?i.map(e=>a[e]||e):i;n?(c.classList.remove(...r),c.classList.add(a&&a[t]?a[t]:t)):c.setAttribute(e,t)}),d(t)}function d(e){s&&l.includes(e)&&(c.style.colorScheme=e)}function f(){return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}if(r)u(r);else try{let e=localStorage.getItem(t)||n;u(o&&e===`system`?f():e)}catch{}},i=[`light`,`dark`],a=`(prefers-color-scheme: dark)`,o=typeof window>`u`,s=n.createContext(void 0),c={setTheme:e=>{},themes:[]},l=()=>n.useContext(s)??c,u=e=>n.useContext(s)?n.createElement(n.Fragment,null,e.children):n.createElement(f,{...e}),d=[`light`,`dark`],f=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:r=!0,enableColorScheme:o=!0,storageKey:c=`theme`,themes:l=d,defaultTheme:u=r?`system`:`light`,attribute:f=`data-theme`,value:_,children:v,nonce:y,scriptProps:b})=>{let[x,S]=n.useState(()=>m(c,u)),[C,w]=n.useState(()=>x===`system`?g():x),T=_?Object.values(_):l,E=n.useCallback(e=>{let n=e;if(!n)return;e===`system`&&r&&(n=g());let a=_?_[n]:n,s=t?h(y):null,c=document.documentElement,l=e=>{e===`class`?(c.classList.remove(...T),a&&c.classList.add(a)):e.startsWith(`data-`)&&(a?c.setAttribute(e,a):c.removeAttribute(e))};if(Array.isArray(f)?f.forEach(l):l(f),o){let e=i.includes(u)?u:null,t=i.includes(n)?n:e;c.style.colorScheme=t}s?.()},[y]),D=n.useCallback(e=>{let t=typeof e==`function`?e(x):e;S(t);try{localStorage.setItem(c,t)}catch{}},[x]),O=n.useCallback(t=>{w(g(t)),x===`system`&&r&&!e&&E(`system`)},[x,e]);n.useEffect(()=>{let e=window.matchMedia(a);return e.addListener(O),O(e),()=>e.removeListener(O)},[O]),n.useEffect(()=>{let e=e=>{e.key===c&&(e.newValue?S(e.newValue):D(u))};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[D]),n.useEffect(()=>{E(e??x)},[e,x]);let k=n.useMemo(()=>({theme:x,setTheme:D,forcedTheme:e,resolvedTheme:x===`system`?C:x,themes:r?[...l,`system`]:l,systemTheme:r?C:void 0}),[x,D,e,C,r,l]);return n.createElement(s.Provider,{value:k},n.createElement(p,{forcedTheme:e,storageKey:c,attribute:f,enableSystem:r,enableColorScheme:o,defaultTheme:u,value:_,themes:l,nonce:y,scriptProps:b}),v)},p=n.memo(({forcedTheme:e,storageKey:t,attribute:i,enableSystem:a,enableColorScheme:o,defaultTheme:s,value:c,themes:l,nonce:u,scriptProps:d})=>{let f=JSON.stringify([i,t,s,e,l,c,a,o]).slice(1,-1);return n.createElement(`script`,{...d,suppressHydrationWarning:!0,nonce:typeof window>`u`?u:``,dangerouslySetInnerHTML:{__html:`(${r.toString()})(${f})`}})}),m=(e,t)=>{if(o)return;let n;try{n=localStorage.getItem(e)||void 0}catch{}return n||t},h=e=>{let t=document.createElement(`style`);return e&&t.setAttribute(`nonce`,e),t.appendChild(document.createTextNode(`*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`)),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},g=e=>(e||=window.matchMedia(a),e.matches?`dark`:`light`);export{l as n,u as t};
1
+ import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{ra as t}from"./dialogs-config-Ofxg1Bn0.js";var n=e(t(),1),r=(e,t,n,r,i,a,o,s)=>{let c=document.documentElement,l=[`light`,`dark`];function u(t){(Array.isArray(e)?e:[e]).forEach(e=>{let n=e===`class`,r=n&&a?i.map(e=>a[e]||e):i;n?(c.classList.remove(...r),c.classList.add(a&&a[t]?a[t]:t)):c.setAttribute(e,t)}),d(t)}function d(e){s&&l.includes(e)&&(c.style.colorScheme=e)}function f(){return window.matchMedia(`(prefers-color-scheme: dark)`).matches?`dark`:`light`}if(r)u(r);else try{let e=localStorage.getItem(t)||n;u(o&&e===`system`?f():e)}catch{}},i=[`light`,`dark`],a=`(prefers-color-scheme: dark)`,o=typeof window>`u`,s=n.createContext(void 0),c={setTheme:e=>{},themes:[]},l=()=>n.useContext(s)??c,u=e=>n.useContext(s)?n.createElement(n.Fragment,null,e.children):n.createElement(f,{...e}),d=[`light`,`dark`],f=({forcedTheme:e,disableTransitionOnChange:t=!1,enableSystem:r=!0,enableColorScheme:o=!0,storageKey:c=`theme`,themes:l=d,defaultTheme:u=r?`system`:`light`,attribute:f=`data-theme`,value:_,children:v,nonce:y,scriptProps:b})=>{let[x,S]=n.useState(()=>m(c,u)),[C,w]=n.useState(()=>x===`system`?g():x),T=_?Object.values(_):l,E=n.useCallback(e=>{let n=e;if(!n)return;e===`system`&&r&&(n=g());let a=_?_[n]:n,s=t?h(y):null,c=document.documentElement,l=e=>{e===`class`?(c.classList.remove(...T),a&&c.classList.add(a)):e.startsWith(`data-`)&&(a?c.setAttribute(e,a):c.removeAttribute(e))};if(Array.isArray(f)?f.forEach(l):l(f),o){let e=i.includes(u)?u:null,t=i.includes(n)?n:e;c.style.colorScheme=t}s?.()},[y]),D=n.useCallback(e=>{let t=typeof e==`function`?e(x):e;S(t);try{localStorage.setItem(c,t)}catch{}},[x]),O=n.useCallback(t=>{w(g(t)),x===`system`&&r&&!e&&E(`system`)},[x,e]);n.useEffect(()=>{let e=window.matchMedia(a);return e.addListener(O),O(e),()=>e.removeListener(O)},[O]),n.useEffect(()=>{let e=e=>{e.key===c&&(e.newValue?S(e.newValue):D(u))};return window.addEventListener(`storage`,e),()=>window.removeEventListener(`storage`,e)},[D]),n.useEffect(()=>{E(e??x)},[e,x]);let k=n.useMemo(()=>({theme:x,setTheme:D,forcedTheme:e,resolvedTheme:x===`system`?C:x,themes:r?[...l,`system`]:l,systemTheme:r?C:void 0}),[x,D,e,C,r,l]);return n.createElement(s.Provider,{value:k},n.createElement(p,{forcedTheme:e,storageKey:c,attribute:f,enableSystem:r,enableColorScheme:o,defaultTheme:u,value:_,themes:l,nonce:y,scriptProps:b}),v)},p=n.memo(({forcedTheme:e,storageKey:t,attribute:i,enableSystem:a,enableColorScheme:o,defaultTheme:s,value:c,themes:l,nonce:u,scriptProps:d})=>{let f=JSON.stringify([i,t,s,e,l,c,a,o]).slice(1,-1);return n.createElement(`script`,{...d,suppressHydrationWarning:!0,nonce:typeof window>`u`?u:``,dangerouslySetInnerHTML:{__html:`(${r.toString()})(${f})`}})}),m=(e,t)=>{if(o)return;let n;try{n=localStorage.getItem(e)||void 0}catch{}return n||t},h=e=>{let t=document.createElement(`style`);return e&&t.setAttribute(`nonce`,e),t.appendChild(document.createTextNode(`*,*::before,*::after{-webkit-transition:none!important;-moz-transition:none!important;-o-transition:none!important;-ms-transition:none!important;transition:none!important}`)),document.head.appendChild(t),()=>{window.getComputedStyle(document.body),setTimeout(()=>{document.head.removeChild(t)},1)}},g=e=>(e||=window.matchMedia(a),e.matches?`dark`:`light`);export{l as n,u as t};
@@ -19,17 +19,17 @@
19
19
  <meta name="apple-mobile-web-app-title" content="Tarsk" />
20
20
 
21
21
  <title>Tarsk</title>
22
- <script type="module" crossorigin src="/assets/index-BR4u03pf.js"></script>
22
+ <script type="module" crossorigin src="/assets/index-BOioHxIi.js"></script>
23
23
  <link rel="modulepreload" crossorigin href="/assets/rolldown-runtime-Dw2cE7zH.js">
24
- <link rel="modulepreload" crossorigin href="/assets/dialogs-config-CdogKQE6.js">
25
- <link rel="modulepreload" crossorigin href="/assets/history-view-DtTMEZIl.js">
26
- <link rel="modulepreload" crossorigin href="/assets/monaco-DKN4dKR5.js">
27
- <link rel="modulepreload" crossorigin href="/assets/react-vendor-BNQTbRKd.js">
28
- <link rel="modulepreload" crossorigin href="/assets/onboarding-gO0dp5Em.js">
29
- <link rel="modulepreload" crossorigin href="/assets/use-toast-DCmq-wgl.js">
30
- <link rel="modulepreload" crossorigin href="/assets/store-CB5vVIg-.js">
31
- <link rel="modulepreload" crossorigin href="/assets/utils-B7eoN2Bj.js">
32
- <link rel="stylesheet" crossorigin href="/assets/index-LCD_R39p.css">
24
+ <link rel="modulepreload" crossorigin href="/assets/dialogs-config-Ofxg1Bn0.js">
25
+ <link rel="modulepreload" crossorigin href="/assets/history-view-BIN8vsvx.js">
26
+ <link rel="modulepreload" crossorigin href="/assets/monaco-CgzMkQ7t.js">
27
+ <link rel="modulepreload" crossorigin href="/assets/react-vendor-Bi5X_3XM.js">
28
+ <link rel="modulepreload" crossorigin href="/assets/onboarding-QnvOtCAY.js">
29
+ <link rel="modulepreload" crossorigin href="/assets/textarea-CxhrnOOz.js">
30
+ <link rel="modulepreload" crossorigin href="/assets/store-BuY90jLM.js">
31
+ <link rel="modulepreload" crossorigin href="/assets/utils-7CkwsQJ0.js">
32
+ <link rel="stylesheet" crossorigin href="/assets/index-BVLzVjoR.css">
33
33
  </head>
34
34
  <body class="font-sans antialiased">
35
35
  <div id="root"></div>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "tarsk",
3
- "version": "0.4.9",
3
+ "version": "0.4.12",
4
4
  "description": "CLI for Tarsk - Project Threads Manager",
5
5
  "keywords": [
6
6
  "cli",
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Fi as t,Ir as n,Kn as r,Nt as i,X as a,Xn as o,li as s,wi as c,zr as l}from"./dialogs-config-CdogKQE6.js";import{t as u}from"./use-toast-DCmq-wgl.js";var d=e(t(),1),f=o();function p(){let[e,t]=(0,d.useState)(null),[o,p]=(0,d.useState)(!0);(0,d.useEffect)(()=>{m();let e=()=>{document.visibilityState===`visible`&&m()};return document.addEventListener(`visibilitychange`,e),()=>document.removeEventListener(`visibilitychange`,e)},[]);async function m(){p(!0);try{t(await a())}catch(e){u({title:`Error`,description:e instanceof Error?e.message:`Failed to load account info`,variant:`destructive`})}finally{p(!1)}}function h(){i(`https://buy.stripe.com/14AcN6feK0Jjbheb2H3Nm03?client_reference_id=${e?.clientReferenceId??``}`)}function g(){i(`https://buy.stripe.com/9B67sMd6CgIh70Y0o33Nm04?client_reference_id=${e?.clientReferenceId??``}`)}if(o)return(0,f.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,f.jsx)(l,{className:`h-5 w-5 animate-spin text-muted-foreground`})});let _=e?.plan===`unlimited-pro`;return(0,f.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,f.jsxs)(`div`,{className:`mb-6`,children:[(0,f.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Account`}),(0,f.jsx)(`p`,{className:`text-muted-foreground`,children:`Manage your Tarsk plan and prompt balance.`})]}),(0,f.jsxs)(`div`,{className:`space-y-6`,children:[(0,f.jsxs)(`div`,{className:`flex gap-4`,children:[(0,f.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-2`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[(0,f.jsx)(n,{className:`h-4 w-4`}),`Balance`]}),(0,f.jsx)(`div`,{className:`flex items-end gap-2`,children:_?(0,f.jsx)(`span`,{className:`text-3xl font-bold`,children:`Unlimited`}):(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(`span`,{className:`text-3xl font-bold`,children:e?.promptsRemaining.toLocaleString()??0}),(0,f.jsx)(`span`,{className:`text-muted-foreground mb-1 text-sm`,children:`prompts remaining`})]})})]}),(0,f.jsxs)(`div`,{className:`flex-1 rounded-xl border bg-card p-5 space-y-3`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2 text-sm font-medium text-muted-foreground`,children:[(0,f.jsx)(s,{className:`h-4 w-4`}),`Current Plan`]}),(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(`span`,{className:`text-lg font-semibold`,children:_?`Unlimited Pro`:`Pay as you go`}),_&&(0,f.jsx)(`span`,{className:`rounded-full bg-primary/10 px-2 py-0.5 text-xs font-medium text-primary`,children:`Active`})]}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:_?`You have unlimited prompts with no restrictions.`:`Purchase prompts as needed. Upgrade to Pro for unlimited access.`})]})]}),!_&&(0,f.jsxs)(`div`,{className:`space-y-3`,children:[(0,f.jsx)(`h2`,{className:`text-sm font-semibold text-muted-foreground uppercase tracking-wide`,children:`Add Prompts`}),(0,f.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsx)(`div`,{className:`flex items-center gap-2`,children:(0,f.jsx)(`span`,{className:`font-semibold`,children:`1,000 Prompts`})}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Top up your balance with 1,000 additional prompts for $5.`})]}),(0,f.jsx)(r,{onClick:h,className:`shrink-0`,children:`Top Up Balance`})]}),(0,f.jsxs)(`div`,{className:`rounded-xl border bg-card p-5 flex items-center justify-between gap-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-1`,children:[(0,f.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,f.jsx)(s,{className:`h-4 w-4 text-primary`}),(0,f.jsx)(`span`,{className:`font-semibold`,children:`Unlimited Pro Plan`})]}),(0,f.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Unlimited prompts for $100 and lifetime access to Tarsk.`}),(0,f.jsxs)(`ul`,{className:`text-sm text-muted-foreground space-y-0.5`,children:[(0,f.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(c,{className:`h-3 w-3 text-primary`}),`Unlimited prompts`]}),(0,f.jsxs)(`li`,{className:`flex items-center gap-1.5`,children:[(0,f.jsx)(c,{className:`h-3 w-3 text-primary`}),`Priority access`]})]})]}),(0,f.jsx)(r,{onClick:g,className:`shrink-0`,children:`Purchase`})]})]})]})]})}export{p as default};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Fi as t,I as n,Kn as r,Xn as i,c as a,l as o,xi as s,zr as c}from"./dialogs-config-CdogKQE6.js";import"./react-vendor-BNQTbRKd.js";import"./history-view-DtTMEZIl.js";import{t as l}from"./use-toast-DCmq-wgl.js";import{a as u}from"./index-BR4u03pf.js";import{n as d,t as f}from"./radio-group-BQ7i054U.js";var p=e(t(),1),m=i();function h({threadId:e,onAgentCreated:t}){let[i,h]=(0,p.useState)(``),[g,_]=(0,p.useState)(``),[v,y]=(0,p.useState)(``),[b,x]=(0,p.useState)(`local`),[S,C]=(0,p.useState)(!1),w=i.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),T=w.length>0&&w.length<=64;return e?(0,m.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,m.jsxs)(`div`,{className:`mb-6`,children:[(0,m.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Add Agent`}),(0,m.jsx)(`p`,{className:`text-muted-foreground`,children:`Create a new subagent. The agent will be saved as an AGENT.md file in the .agents/agents folder.`})]}),(0,m.jsxs)(`div`,{className:`space-y-6`,children:[(0,m.jsxs)(`div`,{className:`space-y-2`,children:[(0,m.jsx)(o,{htmlFor:`agentName`,children:`Agent Name`}),(0,m.jsx)(a,{id:`agentName`,value:i,onChange:e=>h(e.target.value),placeholder:`e.g. Security Reviewer`,disabled:S}),i&&(0,m.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Folder name: `,(0,m.jsx)(`span`,{className:`font-mono`,children:w||`...`})]})]}),(0,m.jsxs)(`div`,{className:`space-y-2`,children:[(0,m.jsx)(o,{htmlFor:`agentDescription`,children:`Description`}),(0,m.jsx)(u,{id:`agentDescription`,value:g,onChange:e=>_(e.target.value),placeholder:`Describe what this agent does and when it should be invoked`,className:`resize-none min-h-[120px]`,disabled:S})]}),(0,m.jsxs)(`div`,{className:`space-y-2`,children:[(0,m.jsx)(o,{htmlFor:`agentTools`,children:`Allowed Tools (optional)`}),(0,m.jsx)(a,{id:`agentTools`,value:v,onChange:e=>y(e.target.value),placeholder:`e.g. read grep glob`,disabled:S}),(0,m.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Space-separated list of tools this agent can use. Leave empty to allow all coding tools.`})]}),(0,m.jsxs)(`div`,{className:`space-y-2`,children:[(0,m.jsx)(o,{children:`Scope`}),(0,m.jsxs)(f,{value:b,onValueChange:e=>x(e),className:`flex gap-4`,disabled:S,children:[(0,m.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,m.jsx)(d,{value:`local`,id:`scope-local`}),(0,m.jsx)(o,{htmlFor:`scope-local`,className:`font-normal cursor-pointer`,children:`Local (this project)`})]}),(0,m.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,m.jsx)(d,{value:`global`,id:`scope-global`,disabled:!0}),(0,m.jsx)(o,{htmlFor:`scope-global`,className:`font-normal cursor-pointer text-muted-foreground`,children:`Global (coming soon)`})]})]}),(0,m.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b===`local`?`This agent will only be available for this project.`:`This agent will be available across all projects (coming soon).`})]}),(0,m.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,m.jsx)(r,{onClick:async()=>{if(!(!T||!g.trim()||!e)){C(!0);try{let r=await n(e,w,g.trim(),v.trim()||void 0);l({title:`Agent created`,description:`Agent '${w}' was created successfully.`}),h(``),_(``),y(``),x(`local`),t?.(r.path,`AGENT.md`)}catch(e){l({title:`Error`,description:e instanceof Error?e.message:`Failed to create agent`,variant:`destructive`})}finally{C(!1)}}},disabled:!T||!g.trim()||S,children:S?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(c,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,m.jsxs)(m.Fragment,{children:[`Continue`,(0,m.jsx)(s,{className:`ml-2 h-4 w-4`})]})})})]})]}):(0,m.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,m.jsxs)(`div`,{className:`text-center`,children:[(0,m.jsx)(`h2`,{className:`text-lg font-semibold text-muted-foreground mb-2`,children:`No Thread Selected`}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Please select a thread to add an agent.`})]})})}export{h as default};
@@ -1,7 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{$n as t,Fi as n,Kn as r,Ni as i,Ut as a,Xn as o,c as s,l as c,xi as l,zr as u}from"./dialogs-config-CdogKQE6.js";import{i as d,r as f}from"./react-vendor-BNQTbRKd.js";import"./history-view-DtTMEZIl.js";import{t as p}from"./use-toast-DCmq-wgl.js";import{a as m}from"./index-BR4u03pf.js";import{n as h,t as g}from"./radio-group-BQ7i054U.js";var _=i(),v=e(n(),1),y=o(),b=v.forwardRef((e,n)=>{let r=(0,_.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=t(`peer inline-flex h-6 w-11 shrink-0 cursor-pointer items-center rounded-full border-2 border-transparent transition-colors focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2 focus-visible:ring-offset-background disabled:cursor-not-allowed disabled:opacity-50 data-[state=checked]:bg-primary data-[state=unchecked]:bg-input`,i),r[3]=i,r[4]=o);let s;r[5]===Symbol.for(`react.memo_cache_sentinel`)?(s=(0,y.jsx)(d,{className:t(`pointer-events-none block h-5 w-5 rounded-full bg-background shadow-lg ring-0 transition-transform data-[state=checked]:translate-x-5 data-[state=unchecked]:translate-x-0`)}),r[5]=s):s=r[5];let c;return r[6]!==a||r[7]!==n||r[8]!==o?(c=(0,y.jsx)(f,{className:o,...a,ref:n,children:s}),r[6]=a,r[7]=n,r[8]=o,r[9]=c):c=r[9],c});b.displayName=f.displayName;function x({threadId:e,onRuleCreated:t}){let[n,i]=(0,v.useState)(``),[o,d]=(0,v.useState)(``),[f,_]=(0,v.useState)(!1),[x,S]=(0,v.useState)(`local`),[C,w]=(0,v.useState)(!1),T=n.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),E=T.length>0&&T.length<=64;return e?(0,y.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,y.jsxs)(`div`,{className:`mb-6`,children:[(0,y.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Add Rule`}),(0,y.jsx)(`p`,{className:`text-muted-foreground`,children:`Create a new agent rule. The rule will be saved as a .md file in the .agents/rules folder.`})]}),(0,y.jsxs)(`div`,{className:`space-y-6`,children:[(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsx)(c,{htmlFor:`ruleName`,children:`Rule Name`}),(0,y.jsx)(s,{id:`ruleName`,value:n,onChange:e=>i(e.target.value),placeholder:`e.g. Code Style Guide`,disabled:C}),n&&(0,y.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`File name: `,(0,y.jsxs)(`span`,{className:`font-mono`,children:[T||`...`,`.md`]})]})]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsx)(c,{htmlFor:`ruleDescription`,children:`Description`}),(0,y.jsx)(m,{id:`ruleDescription`,value:o,onChange:e=>d(e.target.value),placeholder:`Describe when Tarsk should apply this rule...`,className:`resize-none min-h-[120px]`,disabled:C})]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,y.jsx)(c,{htmlFor:`alwaysApply`,children:`Always Apply`}),(0,y.jsx)(b,{id:`alwaysApply`,checked:f,onCheckedChange:_,disabled:C})]}),(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:f?`This rule will be automatically added to context for all conversations.`:`Only the rule description will be added to context, allowing the agent to read the rule file when needed.`})]}),(0,y.jsxs)(`div`,{className:`space-y-2`,children:[(0,y.jsx)(c,{children:`Scope`}),(0,y.jsxs)(g,{value:x,onValueChange:e=>S(e),className:`flex gap-4`,disabled:C,children:[(0,y.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,y.jsx)(h,{value:`local`,id:`scope-local`}),(0,y.jsx)(c,{htmlFor:`scope-local`,className:`font-normal cursor-pointer`,children:`Local (this project)`})]}),(0,y.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,y.jsx)(h,{value:`global`,id:`scope-global`,disabled:!0}),(0,y.jsx)(c,{htmlFor:`scope-global`,className:`font-normal cursor-pointer text-muted-foreground`,children:`Global (coming soon)`})]})]}),(0,y.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:x===`local`?`This rule will only be available for this project.`:`This rule will be available across all projects (coming soon).`})]}),(0,y.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,y.jsx)(r,{onClick:async()=>{if(!(!E||!e)){w(!0);try{let n=`---
2
- description: ${o.trim()}
3
- alwaysApply: ${f}
4
- ---
5
-
6
- Place your rule instructions here as markdown.
7
- `;await a(e,`.agents/rules/${T}.md`,n),p({title:`Rule created`,description:`Rule '${T}' was created successfully.`}),i(``),d(``),_(!1),S(`local`),t?.(T)}catch(e){p({title:`Error`,description:e instanceof Error?e.message:`Failed to create rule`,variant:`destructive`})}finally{w(!1)}}},disabled:!E||!o.trim()||C,children:C?(0,y.jsxs)(y.Fragment,{children:[(0,y.jsx)(u,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,y.jsxs)(y.Fragment,{children:[`Continue`,(0,y.jsx)(l,{className:`ml-2 h-4 w-4`})]})})})]})]}):(0,y.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,y.jsxs)(`div`,{className:`text-center`,children:[(0,y.jsx)(`h2`,{className:`text-lg font-semibold text-muted-foreground mb-2`,children:`No Thread Selected`}),(0,y.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Please select a thread to add a rule.`})]})})}export{x as default};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Fi as t,Kn as n,L as r,Xn as i,c as a,l as o,xi as s,zr as c}from"./dialogs-config-CdogKQE6.js";import"./react-vendor-BNQTbRKd.js";import"./history-view-DtTMEZIl.js";import{t as l}from"./use-toast-DCmq-wgl.js";import{a as u}from"./index-BR4u03pf.js";import{n as d,t as f}from"./radio-group-BQ7i054U.js";var p=e(t(),1),m=i();function h({threadId:e,onSkillCreated:t}){let[i,h]=(0,p.useState)(``),[g,_]=(0,p.useState)(``),[v,y]=(0,p.useState)(`local`),[b,x]=(0,p.useState)(!1),S=i.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),C=S.length>0&&S.length<=64;return e?(0,m.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,m.jsxs)(`div`,{className:`mb-6`,children:[(0,m.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Add Skill`}),(0,m.jsx)(`p`,{className:`text-muted-foreground`,children:`Create a new agent skill. The skill will be saved as a SKILL.md file in the .agents/skills folder.`})]}),(0,m.jsxs)(`div`,{className:`space-y-6`,children:[(0,m.jsxs)(`div`,{className:`space-y-2`,children:[(0,m.jsx)(o,{htmlFor:`skillName`,children:`Skill Name`}),(0,m.jsx)(a,{id:`skillName`,value:i,onChange:e=>h(e.target.value),placeholder:`e.g. Code Review`,disabled:b}),i&&(0,m.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Folder name: `,(0,m.jsx)(`span`,{className:`font-mono`,children:S||`...`})]})]}),(0,m.jsxs)(`div`,{className:`space-y-2`,children:[(0,m.jsx)(o,{htmlFor:`skillDescription`,children:`Description`}),(0,m.jsx)(u,{id:`skillDescription`,value:g,onChange:e=>_(e.target.value),placeholder:`Describe when Tarsk should apply this skill`,className:`resize-none min-h-[120px]`,disabled:b})]}),(0,m.jsxs)(`div`,{className:`space-y-2`,children:[(0,m.jsx)(o,{children:`Scope`}),(0,m.jsxs)(f,{value:v,onValueChange:e=>y(e),className:`flex gap-4`,disabled:b,children:[(0,m.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,m.jsx)(d,{value:`local`,id:`scope-local`}),(0,m.jsx)(o,{htmlFor:`scope-local`,className:`font-normal cursor-pointer`,children:`Local (this project)`})]}),(0,m.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,m.jsx)(d,{value:`global`,id:`scope-global`,disabled:!0}),(0,m.jsx)(o,{htmlFor:`scope-global`,className:`font-normal cursor-pointer text-muted-foreground`,children:`Global (coming soon)`})]})]}),(0,m.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:v===`local`?`This skill will only be available for this project.`:`This skill will be available across all projects (coming soon).`})]}),(0,m.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,m.jsx)(n,{onClick:async()=>{if(!(!C||!g.trim()||!e)){x(!0);try{let n=await r(e,S,g.trim());l({title:`Skill created`,description:`Skill '${S}' was created successfully.`}),h(``),_(``),y(`local`),t?.(n.path,`SKILL.md`)}catch(e){l({title:`Error`,description:e instanceof Error?e.message:`Failed to create skill`,variant:`destructive`})}finally{x(!1)}}},disabled:!C||!g.trim()||b,children:b?(0,m.jsxs)(m.Fragment,{children:[(0,m.jsx)(c,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,m.jsxs)(m.Fragment,{children:[`Continue`,(0,m.jsx)(s,{className:`ml-2 h-4 w-4`})]})})})]})]}):(0,m.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,m.jsxs)(`div`,{className:`text-center`,children:[(0,m.jsx)(`h2`,{className:`text-lg font-semibold text-muted-foreground mb-2`,children:`No Thread Selected`}),(0,m.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Please select a thread to add a skill.`})]})})}export{h as default};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Fi as t,Kn as n,P as r,Xn as i,c as a,l as o,xi as s,zr as c}from"./dialogs-config-CdogKQE6.js";import"./react-vendor-BNQTbRKd.js";import"./history-view-DtTMEZIl.js";import{t as l}from"./use-toast-DCmq-wgl.js";import{n as u,t as d}from"./radio-group-BQ7i054U.js";var f=e(t(),1),p=i();function m({projectId:e,threadId:t,onCommandCreated:i}){let[m,h]=(0,f.useState)(``),[g,_]=(0,f.useState)(``),[v,y]=(0,f.useState)(``),[b,x]=(0,f.useState)(`default`),[S,C]=(0,f.useState)(`local`),[w,T]=(0,f.useState)(!1),E=m.toLowerCase().replace(/\s+/g,`-`).replace(/[^a-z0-9-]/g,``).replace(/-+/g,`-`).replace(/^-|-$/g,``),D=E.length>0&&E.length<=64;return e?(0,p.jsxs)(`div`,{className:`max-w-2xl mx-auto p-6`,children:[(0,p.jsxs)(`div`,{className:`mb-6`,children:[(0,p.jsx)(`h1`,{className:`text-2xl font-bold`,children:`Add Slash Command`}),(0,p.jsx)(`p`,{className:`text-muted-foreground`,children:`Create a new slash command. The command will be saved as a .md file in the ~/.agents/commands folder.`})]}),(0,p.jsxs)(`div`,{className:`space-y-6`,children:[(0,p.jsxs)(`div`,{className:`space-y-2`,children:[(0,p.jsx)(o,{htmlFor:`commandName`,children:`Command Name`}),(0,p.jsx)(a,{id:`commandName`,value:m,onChange:e=>h(e.target.value),placeholder:`e.g. review`,disabled:w}),m&&(0,p.jsxs)(`p`,{className:`text-xs text-muted-foreground`,children:[`Command: `,(0,p.jsxs)(`span`,{className:`font-mono`,children:[`/`,E||`...`]})]})]}),(0,p.jsxs)(`div`,{className:`space-y-2`,children:[(0,p.jsx)(o,{htmlFor:`commandDescription`,children:`Description`}),(0,p.jsx)(a,{id:`commandDescription`,value:g,onChange:e=>_(e.target.value),placeholder:`Brief description shown in autocomplete`,disabled:w})]}),(0,p.jsxs)(`div`,{className:`space-y-2`,children:[(0,p.jsx)(o,{htmlFor:`argumentHint`,children:`Argument Hint (optional)`}),(0,p.jsx)(a,{id:`argumentHint`,value:v,onChange:e=>y(e.target.value),placeholder:`e.g. <focus-area> or <branch-name>`,disabled:w}),(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:`Shows after the command name to guide users what to type`})]}),(0,p.jsxs)(`div`,{className:`space-y-2`,children:[(0,p.jsx)(o,{children:`Mode`}),(0,p.jsxs)(d,{value:b,onValueChange:e=>x(e),className:`flex gap-4`,disabled:w,children:[(0,p.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,p.jsx)(u,{value:`default`,id:`mode-default`}),(0,p.jsx)(o,{htmlFor:`mode-default`,className:`font-normal cursor-pointer`,children:`Default`})]}),(0,p.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,p.jsx)(u,{value:`plan`,id:`mode-plan`}),(0,p.jsx)(o,{htmlFor:`mode-plan`,className:`font-normal cursor-pointer`,children:`Plan`})]})]}),(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:b===`default`?`Standard chat mode`:`Activates plan mode when this command is used`})]}),(0,p.jsxs)(`div`,{className:`space-y-2`,children:[(0,p.jsx)(o,{children:`Scope`}),(0,p.jsxs)(d,{value:S,onValueChange:e=>C(e),className:`flex gap-4`,disabled:w,children:[(0,p.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,p.jsx)(u,{value:`local`,id:`scope-local`}),(0,p.jsx)(o,{htmlFor:`scope-local`,className:`font-normal cursor-pointer`,children:`Local (this project)`})]}),(0,p.jsxs)(`div`,{className:`flex items-center space-x-2`,children:[(0,p.jsx)(u,{value:`global`,id:`scope-global`,disabled:!0}),(0,p.jsx)(o,{htmlFor:`scope-global`,className:`font-normal cursor-pointer text-muted-foreground`,children:`Global (coming soon)`})]})]}),(0,p.jsx)(`p`,{className:`text-xs text-muted-foreground`,children:S===`local`?`This command will only be available for this project.`:`This command will be available across all projects (coming soon).`})]}),(0,p.jsx)(`div`,{className:`border-t pt-4 flex justify-end`,children:(0,p.jsx)(n,{onClick:async()=>{if(!(!D||!e)){T(!0);try{await r(E,``,{description:g.trim()||void 0,argumentHint:v.trim()||void 0,mode:b===`plan`?`plan`:void 0},S===`global`?`global`:`project`,t??void 0),l({title:`Command created`,description:`Command '/${E}' was created successfully.`}),h(``),_(``),y(``),x(`default`),C(`local`),i?.(E)}catch(e){l({title:`Error`,description:e instanceof Error?e.message:`Failed to create command`,variant:`destructive`})}finally{T(!1)}}},disabled:!D||w,children:w?(0,p.jsxs)(p.Fragment,{children:[(0,p.jsx)(c,{className:`mr-2 h-4 w-4 animate-spin`}),`Creating...`]}):(0,p.jsxs)(p.Fragment,{children:[`Continue`,(0,p.jsx)(s,{className:`ml-2 h-4 w-4`})]})})})]})]}):(0,p.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,p.jsxs)(`div`,{className:`text-center`,children:[(0,p.jsx)(`h2`,{className:`text-lg font-semibold text-muted-foreground mb-2`,children:`No Project Selected`}),(0,p.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Please select a project to add a slash command.`})]})})}export{m as default};
@@ -1 +0,0 @@
1
- import"./dialogs-config-CdogKQE6.js";import{t as e}from"./history-view-DtTMEZIl.js";export{e as ConversationHistoryView,e as default};
@@ -1,3 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{$n as t,Fi as n,Ir as r,Kn as i,Lr as a,Ni as o,Nr as s,Or as c,Qr as l,Si as u,Xn as d,Z as f,Zr as p,cn as m,dn as ee,ei as h,fn as te,in as g,kr as _,ln as ne,pn as v,q as y,rt as b,vt as x,xi as S,zr as C}from"./dialogs-config-CdogKQE6.js";import{n as w}from"./react-vendor-BNQTbRKd.js";import{a as T,t as E}from"./store-CB5vVIg-.js";import{c as D,s as O,u as k}from"./history-view-DtTMEZIl.js";import{n as A}from"./utils-B7eoN2Bj.js";import"./onboarding-gO0dp5Em.js";import{a as j,c as M,g as N,h as re,i as ie,n as P,o as ae,r as oe,s as se}from"./index-BR4u03pf.js";import"./monaco-DKN4dKR5.js";var F=o(),I=e(n(),1),L=d();function ce(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 R={added:`text-green-500`,deleted:`text-red-500`,untracked:`text-green-500`,renamed:`text-blue-500`,modified:`text-orange-500`},z={added:`A`,deleted:`D`,untracked:`U`,renamed:`R`,modified:`M`};function le(e){return t(`status-badge font-mono text-xs font-semibold`,R[e]??`text-orange-500`)}function B(e){return z[e]??`M`}function ue(e){let n=(0,F.c)(20),{treeData:r,files:i,isLoading:a,error:o,selectedFileIndex:s,onFileSelect:c,onExit:u}=e;if(a){let e;n[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`div`,{className:`flex-1 flex items-center justify-center pt-3 pb-2`,children:(0,L.jsx)(C,{className:`h-6 w-6 animate-spin text-muted-foreground`})}),n[0]=e):e=n[0];let t;return n[1]===u?t=n[2]:(t=(0,L.jsx)(M,{onTitleClose:u,subtitle:`Review Changes`,children:e}),n[1]=u,n[2]=t),t}if(o){let e;n[3]===o?e=n[4]:(e=(0,L.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,L.jsx)(`p`,{className:`text-destructive text-xs text-center`,children:o})}),n[3]=o,n[4]=e);let t;return n[5]!==u||n[6]!==e?(t=(0,L.jsx)(M,{onTitleClose:u,subtitle:`Review Changes`,children:e}),n[5]=u,n[6]=e,n[7]=t):t=n[7],t}if(i.length===0){let e;n[8]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,L.jsx)(`div`,{className:`flex-1 flex items-center justify-center p-4 pt-7 pb-2`,children:(0,L.jsx)(`p`,{className:`text-muted-foreground text-xs text-center`,children:`No changes to review`})}),n[8]=e):e=n[8];let t;return n[9]===u?t=n[10]:(t=(0,L.jsx)(M,{onTitleClose:u,subtitle:`Review Changes`,children:e}),n[9]=u,n[10]=t),t}let d;n[11]!==c||n[12]!==s?(d=(e,n)=>{let{isOpen:r,toggle:i}=n,a=!!e.children;return(0,L.jsxs)(re,{onClick:()=>{a?i():e.fileIndex!==void 0&&c(e.fileIndex)},selected:!a&&e.fileIndex===s,className:`gap-1.5`,children:[a?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(S,{className:t(`h-3.5 w-3.5 shrink-0 text-muted-foreground transition-transform`,r&&`rotate-90`)}),r?(0,L.jsx)(l,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}):(0,L.jsx)(p,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`})]}):(0,L.jsx)(h,{className:`h-3.5 w-3.5 shrink-0 text-muted-foreground`}),(0,L.jsx)(`span`,{className:`truncate flex-1 min-w-0`,children:e.name}),!a&&e.status&&(0,L.jsx)(`span`,{className:le(e.status),children:B(e.status)})]})},n[11]=c,n[12]=s,n[13]=d):d=n[13];let f;n[14]!==d||n[15]!==r?(f=(0,L.jsx)(`div`,{className:`flex-1 overflow-y-auto pt-3 pb-2 px-1`,children:(0,L.jsx)(N,{nodes:r,defaultOpen:!0,resetKey:r,indent:16,childContainerClassName:`ml-4 border-l border-sidebar-border pl-2`,renderNode:d})}),n[14]=d,n[15]=r,n[16]=f):f=n[16];let m;return n[17]!==u||n[18]!==f?(m=(0,L.jsx)(M,{onTitleClose:u,subtitle:`Review Changes`,children:f}),n[17]=u,n[18]=f,n[19]=m):m=n[19],m}function de(e){let t=(0,F.c)(2),{isOpen:n}=e,r=n===void 0||n?`ml-[-40px]`:``,i;return t[0]===r?i=t[1]:(i=(0,L.jsx)(P,{withHandle:!0,className:r}),t[0]=r,t[1]=i),i}function fe(e){let t=(0,F.c)(35),{open:n,lineNumber:r,lineContent:a,initialComment:o,isEditing:s,onSave:c,onDelete:l,onClose:u}=e,[d,f]=(0,I.useState)((o===void 0?``:o)??``),p;t[0]!==c||t[1]!==d?(p=()=>{d.trim()&&c(d.trim())},t[0]=c,t[1]=d,t[2]=p):p=t[2];let h=p,g;t[3]===h?g=t[4]:(g=e=>{(e.metaKey||e.ctrlKey)&&e.key===`Enter`&&(e.preventDefault(),h())},t[3]=h,t[4]=g);let _=g,y;t[5]===u?y=t[6]:(y=e=>{e||u()},t[5]=u,t[6]=y);let b;t[7]===r?b=t[8]:(b=(0,L.jsx)(te,{children:(0,L.jsxs)(v,{className:`text-sm font-medium`,children:[`Comment on line `,r]})}),t[7]=r,t[8]=b);let x=a||` `,S;t[9]===x?S=t[10]:(S=(0,L.jsx)(`div`,{className:`rounded bg-muted px-3 py-2 font-mono text-xs text-muted-foreground overflow-x-auto whitespace-pre`,children:x}),t[9]=x,t[10]=S);let C;t[11]===Symbol.for(`react.memo_cache_sentinel`)?(C=e=>f(e.target.value),t[11]=C):C=t[11];let w;t[12]!==_||t[13]!==d?(w=(0,L.jsx)(j,{autoFocus:!0,placeholder:`Add a comment... (Cmd+Enter to save)`,value:d,onChange:C,onKeyDown:_,rows:12,className:`resize-none text-sm`}),t[12]=_,t[13]=d,t[14]=w):w=t[14];let T;t[15]!==s||t[16]!==l?(T=s&&l&&(0,L.jsx)(i,{variant:`destructive`,size:`sm`,onClick:l,className:`mr-auto`,children:`Delete`}),t[15]=s,t[16]=l,t[17]=T):T=t[17];let E;t[18]===d?E=t[19]:(E=d.trim(),t[18]=d,t[19]=E);let D=!E,O;t[20]!==h||t[21]!==D?(O=(0,L.jsx)(i,{size:`sm`,onClick:h,disabled:D,children:`Save`}),t[20]=h,t[21]=D,t[22]=O):O=t[22];let k;t[23]!==T||t[24]!==O?(k=(0,L.jsxs)(ee,{className:`gap-2 sm:gap-0`,children:[T,O]}),t[23]=T,t[24]=O,t[25]=k):k=t[25];let A;t[26]!==k||t[27]!==b||t[28]!==S||t[29]!==w?(A=(0,L.jsxs)(ne,{className:`max-w-2xl`,children:[b,S,w,k]}),t[26]=k,t[27]=b,t[28]=S,t[29]=w,t[30]=A):A=t[30];let M;return t[31]!==n||t[32]!==A||t[33]!==y?(M=(0,L.jsx)(m,{open:n,onOpenChange:y,children:A}),t[31]=n,t[32]=A,t[33]=y,t[34]=M):M=t[34],M}function V({threadId:e,onExit:n}){let{state:o,dispatch:l}=T(),{resolvedTheme:d}=A(),[p,m]=(0,I.useState)([]),[ee,h]=(0,I.useState)(!0),[te,ne]=(0,I.useState)(null),[v,C]=(0,I.useState)(0),[j,M]=(0,I.useState)(!1),[N,re]=(0,I.useState)(!1),P=(0,I.useRef)(null),F=(0,I.useMemo)(()=>o.diffComments[e]??[],[o.diffComments,e]),R=(0,I.useCallback)(t=>{let n=o.diffComments[e]??[],r=typeof t==`function`?t(n):t;l({type:E.SetDiffComments,threadId:e,comments:r})},[l,e,o.diffComments]),[z,le]=(0,I.useState)(null),[B,V]=(0,I.useState)(null),[H,U]=(0,I.useState)(null),W=(0,I.useRef)(null),G=(0,I.useRef)(F),pe=(0,I.useRef)(z),K=(0,I.useRef)({isFullView:j,selectedFileIndex:v,files:p}),q=(0,I.useRef)({original:[],modified:[]}),me=(0,I.useRef)(!0);(0,I.useEffect)(()=>{G.current=F},[F]),(0,I.useEffect)(()=>{pe.current=z},[z]),(0,I.useEffect)(()=>{K.current={isFullView:j,selectedFileIndex:v,files:p}},[j,v,p]);let he=(0,I.useCallback)(()=>{P.current&&(N?P.current.expand():P.current.collapse())},[N]),ge=(0,I.useCallback)(async()=>{if(e){h(!0),ne(null);try{m((await b(e)).files||[]),C(0)}catch(e){ne(e instanceof Error?e.message:`Failed to load diff`)}finally{h(!1)}}},[e]);(0,I.useEffect)(()=>{ge()},[ge]);let J=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if((o.diffComments[e]??[]).length>0){J.current=!0;return}x(e).then(t=>{t.diffComments&&t.diffComments.length>0&&l({type:E.SetDiffComments,threadId:e,comments:t.diffComments}),J.current=!0}).catch(()=>{J.current=!0})},[e]),(0,I.useEffect)(()=>{J.current&&g(e,{diffComments:F}).catch(()=>{})},[e,F]);let _e=(0,I.useMemo)(()=>ce(p),[p]),Y=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}},ve=(e,t,n)=>e.split(`
2
- `).slice(t-1,n).join(`
3
- `),ye=e=>{let t=Y(e);return t?t.startLine<=1:!0},be=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`,X=(0,I.useMemo)(()=>p.map(e=>{let t=0,n=0;return e.hunks.forEach(e=>{e.changes.forEach(e=>{e.type===`add`&&t++,e.type===`delete`&&n++})}),{additions:t,deletions:n}}),[p]),Z=p[v],xe=Z?j?Z.oldContent:(()=>{let e=Y(Z);return e?ve(Z.oldContent,e.startLine,e.endLine):Z.oldContent})():``,Se=Z?j?Z.newContent:(()=>{let e=Y(Z);return e?ve(Z.newContent,e.startLine,e.endLine):Z.newContent})():``,Ce=(0,I.useMemo)(()=>X.reduce((e,t)=>e+t.additions,0),[X]),we=(0,I.useMemo)(()=>X.reduce((e,t)=>e+t.deletions,0),[X]),Q=(0,I.useCallback)(()=>{if(!me.current)return;let e=W.current;if(!e)return;let{isFullView:t,selectedFileIndex:n,files:r}=K.current,i=G.current,a=pe.current,o=r[n];if(!o)return;let s=(e,r)=>{let s=t?null:Y(o),c=i.filter(e=>e.fileIndex===n&&e.side===r).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`,glyphMarginHoverMessage:{value:e.comment}}}}).filter(e=>e!==null),l=r===`original`?q.current.original:q.current.modified,u=e.deltaDecorations(l,c);r===`original`?q.current.original=u:q.current.modified=u};s(e.getOriginalEditor(),`original`),s(e.getModifiedEditor(),`modified`)},[]);(0,I.useEffect)(()=>{Q()},[Q,F,z,v,j,Z]),(0,I.useEffect)(()=>()=>{W.current=null,q.current={original:[],modified:[]}},[v]),(0,I.useEffect)(()=>()=>{me.current=!1,W.current=null,q.current={original:[],modified:[]}},[]);let Te=(0,I.useCallback)(e=>{W.current=e;let t=(e,t)=>{e.onMouseDown(n=>{if(!n.target?.position)return;let r=n.target.position.lineNumber,{isFullView:i,selectedFileIndex:a,files:o}=K.current,s=o[a];if(!s)return;let c=i?null:Y(s),l=c?c.startLine+r-1:r,u=e.getModel()?.getLineContent(r)??``,d=G.current.find(e=>e.fileIndex===a&&e.lineNumber===l&&e.side===t);d?U(d):V({lineNumber:l,lineContent:u,side:t})})};t(e.getOriginalEditor(),`original`),t(e.getModifiedEditor(),`modified`),setTimeout(()=>{W.current===e&&Q()},150)},[Q]),Ee=(0,I.useCallback)(e=>{if(B&&Z){let t={id:`comment-${Date.now()}`,filePath:Z.path,fileIndex:v,lineNumber:B.lineNumber,lineContent:B.lineContent,comment:e,side:B.side};R(e=>[...e,t]),V(null)}else H&&(R(t=>t.map(t=>t.id===H.id?{...t,comment:e}:t)),U(null))},[B,H,Z,v,R]),De=(0,I.useCallback)(()=>{H&&(R(e=>e.filter(e=>e.id!==H.id)),U(null))},[H,R]),$=(0,I.useCallback)(e=>{if(F.length===0)return;let t=(e%F.length+F.length)%F.length,n=F[t];le(t),C(n.fileIndex),setTimeout(()=>{let e=W.current;if(!e)return;let t=p[n.fileIndex];if(!t)return;let r=j?null:Y(t),i=r?n.lineNumber-r.startLine+1:n.lineNumber;(n.side===`original`?e.getOriginalEditor():e.getModifiedEditor()).revealLineInCenter(Math.max(1,i)),Q()},100)},[F,p,j,Q]),Oe=(0,I.useCallback)(()=>{$((z??0)-1)},[$,z]),ke=(0,I.useCallback)(()=>{$((z??-1)+1)},[$,z]),Ae=(0,I.useCallback)(async()=>{let t=o.projectModelSelections[e];if(!t)try{let e=await f(),n=Object.values(e).flat();if(n.length>0)t=n[0];else{console.error(`No models available to process comments`);return}}catch(e){console.error(`Failed to load models:`,e);return}let r=t.id,i=t.provider;try{let{prompt:t}=await y(e,F);R([]),l({type:E.SetPendingChatMessage,message:{threadId:e,message:t,model:r,provider:i}}),n()}catch(e){console.error(`Failed to fix comments:`,e),typeof window<`u`&&window.alert(`Failed to process comments. Please try again.`)}},[F,o.projectModelSelections,l,e,n,R]),je={readOnly:!0,renderSideBySide:!0,ignoreTrimWhitespace:!1,renderOverviewRuler:!0,scrollBeyondLastLine:!1,minimap:{enabled:!1},folding:!1,lineNumbers:Z&&(j||ye(Z))?`on`:`off`,diffWordWrap:`on`,originalEditable:!1,automaticLayout:!0,theme:d===`dark`?`vs-dark`:`vs-light`};return(0,L.jsxs)(`div`,{className:`diff-view-root flex h-full flex-col`,children:[(0,L.jsx)(`div`,{className:`diff-body flex flex-1 overflow-hidden`,children:(0,L.jsxs)(ie,{direction:`horizontal`,children:[(0,L.jsx)(oe,{ref:P,defaultSize:25,minSize:12,maxSize:40,collapsible:!0,collapsedSize:0,onCollapse:()=>re(!0),onExpand:()=>re(!1),className:`border-r border-transparent mr-[40px]`,children:(0,L.jsx)(`div`,{className:`h-full overflow-hidden`,children:(0,L.jsx)(ue,{treeData:_e,files:p,isLoading:ee,error:te,selectedFileIndex:v,onFileSelect:C,onExit:n})})}),(0,L.jsx)(de,{isOpen:!N}),(0,L.jsx)(oe,{minSize:40,className:`overflow-hidden bg-transparent ml-[-40px]`,children:(0,L.jsxs)(`div`,{className:`diff-editor-panel flex h-full bg-transparent flex-col overflow-hidden`,children:[(0,L.jsxs)(ae,{className:t(`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,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsxs)(i,{variant:`ghost`,size:`icon`,className:`h-8 w-8 text-muted-foreground shrink-0`,onClick:he,children:[N?(0,L.jsx)(c,{className:`h-4 w-4`}):(0,L.jsx)(_,{className:`h-4 w-4`}),(0,L.jsx)(`span`,{className:`sr-only`,children:`Toggle file tree`})]}),(0,L.jsxs)(`div`,{className:`flex flex-col`,children:[(0,L.jsx)(`span`,{className:`text-sm font-medium text-foreground`,children:Z?Z.path:`Review Changes`}),(0,L.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,L.jsxs)(`span`,{className:`text-xs text-muted-foreground`,children:[p.length,` file`,p.length===1?``:`s`]}),(0,L.jsxs)(`span`,{className:`text-xs text-green-500`,children:[`+`,Ce]}),(0,L.jsxs)(`span`,{className:`text-xs text-red-500`,children:[`-`,we]})]})]})]}),(0,L.jsxs)(`div`,{className:t(`flex items-center gap-2`,N&&`ml-0`,!N&&`ml-auto`,`md:ml-auto`),children:[(0,L.jsx)(i,{variant:`ghost`,size:`sm`,onClick:()=>M(e=>!e),disabled:!Z,className:`h-8 gap-1 px-2 text-xs`,children:j?(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(s,{className:`h-3 w-3`}),` Show changes only`]}):(0,L.jsxs)(L.Fragment,{children:[(0,L.jsx)(a,{className:`h-3 w-3`}),` Show full file`]})}),F.length>0&&(0,L.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,L.jsxs)(O,{children:[(0,L.jsx)(k,{asChild:!0,children:(0,L.jsx)(i,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:Oe,disabled:(z??0)===0,children:(0,L.jsx)(u,{className:`h-3 w-3`})})}),(0,L.jsx)(D,{children:`Previous comment`})]}),(0,L.jsx)(`span`,{className:`text-xs text-muted-foreground whitespace-nowrap`,children:F.length===1?`1 Comment`:`Comment ${(z??0)+1} of ${F.length}`}),(0,L.jsxs)(O,{children:[(0,L.jsx)(k,{asChild:!0,children:(0,L.jsx)(i,{variant:`ghost`,size:`icon`,className:`h-8 w-8 rounded-full`,onClick:ke,disabled:(z??0)===F.length-1,children:(0,L.jsx)(S,{className:`h-3 w-3`})})}),(0,L.jsx)(D,{children:`Next comment`})]})]}),F.length>0&&(0,L.jsxs)(O,{children:[(0,L.jsx)(k,{asChild:!0,children:(0,L.jsxs)(i,{size:`sm`,onClick:Ae,className:`h-8 gap-1 px-3 text-xs bg-foreground text-background hover:bg-foreground/90`,children:[(0,L.jsx)(r,{className:`h-3 w-3`}),`Fix all comments`]})}),(0,L.jsx)(D,{children:`Send all comments to Tarsk for resolution`})]})]})]}),(0,L.jsxs)(`div`,{className:`flex-1 bg-transparent ml-[40px] relative`,children:[(0,L.jsx)(w,{height:`100%`,language:be(Z?.path||``),original:xe,modified:Se,onMount:Te,options:je},`diff-${v}`),(0,L.jsx)(`div`,{className:`absolute bottom-0 left-0 right-0`,children:(0,L.jsx)(se,{})})]})]})})]})}),(0,L.jsx)(fe,{open:B!==null||H!==null,lineNumber:H?.lineNumber??B?.lineNumber??0,lineContent:H?.lineContent??B?.lineContent??``,initialComment:H?.comment,isEditing:H!==null,onSave:Ee,onDelete:De,onClose:()=>{V(null),U(null)}},`${H?.id??``}-${B?.lineNumber??``}-${B?.side??``}`)]})}export{V as DiffView,V as default};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Ci as t,Fi as n,Kn as r,Ni as i,Qr as a,Ti as o,U as s,Xn as c,Zr as l,bt as u,ei as d,fr as f,wr as p,xi as m,zr as h}from"./dialogs-config-CdogKQE6.js";import{X as g}from"./react-vendor-BNQTbRKd.js";import{c as _,l as v,s as y,u as b}from"./history-view-DtTMEZIl.js";import{t as x}from"./use-toast-DCmq-wgl.js";import{d as S,f as C,h as w,l as T,m as E,p as D,u as O}from"./index-BR4u03pf.js";var k=e(n(),1),A=i(),j=c();function M(e){let t=(0,A.c)(19),{open:n,onOpenChange:r,folderName:i,folderPath:a,threadId:o,onDeleteComplete:c}=e,l;t[0]!==i||t[1]!==a||t[2]!==c||t[3]!==r||t[4]!==o?(l=async()=>{try{await s(o,a),c(a),r(!1),x({title:`Success`,description:`Folder "${i}" deleted.`})}catch(e){let t=e;x({title:`Error`,description:t instanceof Error?t.message:`Failed to delete folder`,variant:`destructive`})}},t[0]=i,t[1]=a,t[2]=c,t[3]=r,t[4]=o,t[5]=l):l=t[5];let u=l,d;t[6]===Symbol.for(`react.memo_cache_sentinel`)?(d=(0,j.jsx)(E,{children:`Delete Folder`}),t[6]=d):d=t[6];let f;t[7]===i?f=t[8]:(f=(0,j.jsxs)(D,{children:[`Are you sure you want to delete "`,i,`" and all files inside it? This action cannot be undone.`]}),t[7]=i,t[8]=f);let p;t[9]===Symbol.for(`react.memo_cache_sentinel`)?(p=(0,j.jsx)(S,{children:`Cancel`}),t[9]=p):p=t[9];let m;t[10]===u?m=t[11]:(m=(0,j.jsxs)(`div`,{className:`flex gap-3 justify-end`,children:[p,(0,j.jsx)(O,{onClick:u,className:`bg-red-600 hover:bg-red-700`,children:`Delete`})]}),t[10]=u,t[11]=m);let h;t[12]!==f||t[13]!==m?(h=(0,j.jsxs)(C,{children:[d,f,m]}),t[12]=f,t[13]=m,t[14]=h):h=t[14];let g;return t[15]!==r||t[16]!==n||t[17]!==h?(g=(0,j.jsx)(T,{open:n,onOpenChange:r,children:h}),t[15]=r,t[16]=n,t[17]=h,t[18]=g):g=t[18],g}function N(e){let n=(0,A.c)(76),{node:i,selectedPath:s,level:c,openFolders:u,onToggleFolder:h,onSelectFile:g,onAddSkill:x,onAddRule:S,onAddCommand:C,onAddAgent:T,onDeleteFolder:E,onDeleteFile:D,threadId:O}=e,P;n[0]!==i.id||n[1]!==u?(P=u.has(i.id),n[0]=i.id,n[1]=u,n[2]=P):P=n[2];let F=P,I=s===i.path,[L,R]=(0,k.useState)(!1),z=i.path===`.agents/skills`,B=i.path===`.agents/rules`,V=i.path===`.agents/commands`,H=i.path===`.agents/agents`;if(i.type===`folder`){let e;n[3]!==i.id||n[4]!==h?(e=e=>{e.stopPropagation(),h(i.id)},n[3]=i.id,n[4]=h,n[5]=e):e=n[5];let o,d;n[6]===F?(o=n[7],d=n[8]):(o=(0,j.jsx)(`span`,{className:`text-muted-foreground w-3 flex-shrink-0`,children:F?(0,j.jsx)(t,{className:`h-3 w-3`}):(0,j.jsx)(m,{className:`h-3 w-3`})}),d=F?(0,j.jsx)(a,{className:`h-4 w-4 flex-shrink-0`}):(0,j.jsx)(l,{className:`h-4 w-4 flex-shrink-0`}),n[6]=F,n[7]=o,n[8]=d);let k=`flex-1 truncate ${i.virtual?`text-muted-foreground italic`:``}`,A;n[9]!==i.name||n[10]!==k?(A=(0,j.jsx)(`span`,{className:k,children:i.name}),n[9]=i.name,n[10]=k,n[11]=A):A=n[11];let P;n[12]!==H||n[13]!==V||n[14]!==B||n[15]!==z||n[16]!==T||n[17]!==C||n[18]!==S||n[19]!==x?(P=(z||B||V||H)&&(0,j.jsx)(v,{children:(0,j.jsxs)(y,{children:[(0,j.jsx)(b,{asChild:!0,children:(0,j.jsx)(r,{variant:`action`,size:`icon-sm`,className:`shrink-0 opacity-0 group-hover:opacity-100`,onClick:e=>{e.stopPropagation(),z?x():B?S():V?C():H&&T()},children:(0,j.jsx)(p,{})})}),(0,j.jsx)(_,{children:z?`Add skill`:B?`Add rule`:V?`Add command`:`Add agent`})]})}),n[12]=H,n[13]=V,n[14]=B,n[15]=z,n[16]=T,n[17]=C,n[18]=S,n[19]=x,n[20]=P):P=n[20];let I;n[21]!==H||n[22]!==V||n[23]!==B||n[24]!==z?(I=!z&&!B&&!V&&!H&&(0,j.jsx)(v,{children:(0,j.jsxs)(y,{children:[(0,j.jsx)(b,{asChild:!0,children:(0,j.jsx)(r,{variant:`action`,size:`icon-sm`,className:`shrink-0 opacity-0 group-hover:opacity-100`,onClick:e=>{e.stopPropagation(),R(!0)},children:(0,j.jsx)(f,{})})}),(0,j.jsx)(_,{children:`Delete folder`})]})}),n[21]=H,n[22]=V,n[23]=B,n[24]=z,n[25]=I):I=n[25];let U;n[26]!==c||n[27]!==e||n[28]!==o||n[29]!==d||n[30]!==A||n[31]!==P||n[32]!==I?(U=(0,j.jsxs)(w,{level:c,basePadding:10,onClick:e,children:[o,d,A,P,I]}),n[26]=c,n[27]=e,n[28]=o,n[29]=d,n[30]=A,n[31]=P,n[32]=I,n[33]=U):U=n[33];let W;n[34]!==F||n[35]!==c||n[36]!==i.children||n[37]!==T||n[38]!==C||n[39]!==S||n[40]!==x||n[41]!==D||n[42]!==E||n[43]!==g||n[44]!==h||n[45]!==u||n[46]!==s||n[47]!==O?(W=F&&i.children&&(0,j.jsx)(`div`,{className:`ml-8 border-l border-sidebar-border`,children:i.children.map(e=>(0,j.jsx)(N,{node:e,selectedPath:s,level:c+1,openFolders:u,onToggleFolder:h,onSelectFile:g,onAddSkill:x,onAddRule:S,onAddCommand:C,onAddAgent:T,onDeleteFolder:E,onDeleteFile:D,threadId:O},e.id))}),n[34]=F,n[35]=c,n[36]=i.children,n[37]=T,n[38]=C,n[39]=S,n[40]=x,n[41]=D,n[42]=E,n[43]=g,n[44]=h,n[45]=u,n[46]=s,n[47]=O,n[48]=W):W=n[48];let G;n[49]!==i.name||n[50]!==i.path||n[51]!==E||n[52]!==L||n[53]!==O?(G=(0,j.jsx)(M,{open:L,onOpenChange:R,folderName:i.name,folderPath:i.path,threadId:O,onDeleteComplete:E}),n[49]=i.name,n[50]=i.path,n[51]=E,n[52]=L,n[53]=O,n[54]=G):G=n[54];let K;return n[55]!==W||n[56]!==G||n[57]!==U?(K=(0,j.jsxs)(`div`,{children:[U,W,G]}),n[55]=W,n[56]=G,n[57]=U,n[58]=K):K=n[58],K}let U;n[59]!==i||n[60]!==g?(U=e=>{e.stopPropagation(),g(i)},n[59]=i,n[60]=g,n[61]=U):U=n[61];let W;n[62]===i.path?W=n[63]:(W=i.path===`AGENTS.md`?(0,j.jsx)(o,{className:`h-4 w-4 flex-shrink-0`}):(0,j.jsx)(d,{className:`h-4 w-4 flex-shrink-0`}),n[62]=i.path,n[63]=W);let G=i.path===`AGENTS.md`?`Instructions`:i.name,K;n[64]===G?K=n[65]:(K=(0,j.jsx)(`span`,{className:`flex-1 truncate`,children:G}),n[64]=G,n[65]=K);let q;n[66]!==i||n[67]!==D?(q=i.path.endsWith(`.md`)&&(0,j.jsx)(v,{children:(0,j.jsxs)(y,{children:[(0,j.jsx)(b,{asChild:!0,children:(0,j.jsx)(r,{variant:`action`,size:`icon-sm`,className:`shrink-0 opacity-0 group-hover:opacity-100`,onClick:e=>{e.stopPropagation(),D(i)},children:(0,j.jsx)(f,{})})}),(0,j.jsx)(_,{children:`Delete file`})]})}),n[66]=i,n[67]=D,n[68]=q):q=n[68];let J;return n[69]!==I||n[70]!==c||n[71]!==U||n[72]!==W||n[73]!==K||n[74]!==q?(J=(0,j.jsxs)(w,{level:c,basePadding:22,selected:I,onClick:U,children:[W,K,q]}),n[69]=I,n[70]=c,n[71]=U,n[72]=W,n[73]=K,n[74]=q,n[75]=J):J=n[75],J}function P({threadId:e,selectedPath:t,onFileSelect:n,className:r,expandPath:i,onAddSkill:a,onAddCommand:o,onAddRule:c,onAddAgent:l}){let d=g(),[f,p]=(0,k.useState)([]),[m,_]=(0,k.useState)(!1),[v,y]=(0,k.useState)(new Set),[b,S]=(0,k.useState)(!1),C=(0,k.useCallback)(async()=>{if(e){_(!0);try{p(await u(e)),y(new Set),S(!0)}catch(e){x({title:`Error`,description:e instanceof Error?e.message:`Failed to load files`,variant:`destructive`})}finally{_(!1)}}},[e]);(0,k.useEffect)(()=>{C()},[C]),(0,k.useEffect)(()=>{!b||!i||!f.length||y(e=>{let t=new Set(e),n=i.substring(0,i.lastIndexOf(`/`));if(n){let e=n.split(`/`),r=``;for(let n of e){r=r?`${r}/${n}`:n;let e=f.find(e=>e.path===r&&e.type===`folder`);e&&t.add(e.id)}}return t})},[i,b,f]);let w=(0,k.useCallback)(e=>{y(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),T=(0,k.useCallback)(()=>{a?a():d(`/settings/add-skill`)},[d,a]),E=(0,k.useCallback)(()=>{c?c():d(`/settings/add-rule?threadId=${e}`,{replace:!0})},[d,e,c]),D=(0,k.useCallback)(()=>{o?o():d(`/settings/add-command`)},[d,o]),O=(0,k.useCallback)(()=>{l?l():d(`/settings/add-agent`)},[d,l]),A=(0,k.useCallback)(e=>{C()},[C]),M=(0,k.useCallback)(async t=>{try{await s(e,t.path),x({title:`File deleted`,description:`${t.path===`AGENTS.md`?`Instructions`:t.name} has been deleted successfully.`}),C()}catch(e){x({title:`Error`,description:e instanceof Error?e.message:`Failed to delete file`,variant:`destructive`})}},[e,C]);return(0,j.jsx)(j.Fragment,{children:(0,j.jsx)(`div`,{className:`h-full overflow-y-auto py-2 ${r}`,children:m?(0,j.jsx)(`div`,{className:`flex items-center justify-center h-full`,children:(0,j.jsx)(h,{className:`h-5 w-5 animate-spin text-muted-foreground`})}):f.map(r=>(0,j.jsx)(N,{node:r,selectedPath:t,level:0,openFolders:v,onToggleFolder:w,onSelectFile:n,onAddSkill:T,onAddRule:E,onAddCommand:D,onAddAgent:O,onDeleteFolder:A,onDeleteFile:M,threadId:e},r.id))})})}export{P as default};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{Fi as t,Kn as n,Ut as r,Xn as i,ti as a,yt as o,zr as s}from"./dialogs-config-CdogKQE6.js";import{Q as c,Y as l,t as u}from"./react-vendor-BNQTbRKd.js";import{a as d}from"./store-CB5vVIg-.js";import{n as f}from"./utils-B7eoN2Bj.js";import{t as p}from"./use-toast-DCmq-wgl.js";import{o as m}from"./index-BR4u03pf.js";import"./monaco-DKN4dKR5.js";var h=e(t(),1),g=i();function _(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 v({selectedFile:e,onFileSelect:t}){let{state:i}=d(),{resolvedTheme:v}=f(),y=l(),[b]=c(),x=i.selectedThreadId,[S,C]=(0,h.useState)(``),[w,T]=(0,h.useState)(``),[E,D]=(0,h.useState)(!1),[O,k]=(0,h.useState)(!1);(0,h.useEffect)(()=>{let e=b.get(`skill`);if(e&&x){t({id:e,name:`SKILL.md`,type:`file`,path:e});let n=new URLSearchParams(b);n.delete(`skill`);let r=`${y.pathname}${n.toString()?`?${n.toString()}`:``}`;window.history.replaceState({},``,r)}},[b,x,t,y.pathname]);let A=async()=>{if(!(!x||!e)){k(!0);try{await r(x,e.path,S),T(S),p({title:`Saved`,description:`${e.path===`AGENTS.md`?`Instructions`:e.name} saved successfully.`})}catch(e){p({title:`Error`,description:e instanceof Error?e.message:`Failed to save file`,variant:`destructive`})}finally{k(!1)}}},j=(0,h.useCallback)(async e=>{if(x){D(!0);try{let t=await o(x,e.path);C(t.content),T(t.content)}catch(e){p({title:`Error`,description:e instanceof Error?e.message:`Failed to load file`,variant:`destructive`})}finally{D(!1)}}},[x]);return(0,h.useEffect)(()=>{e&&x?j(e):(C(``),T(``))},[e,x,j]),x?(0,g.jsxs)(`div`,{className:`flex flex-col h-full`,children:[(0,g.jsxs)(m,{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.path===`AGENTS.md`?`Instructions`:e.name:`Select a file to edit`}),(0,g.jsx)(`span`,{className:`text-xs text-muted-foreground`,children:e?e.path:`Browse and edit agent skills, rules, commands, and markdown files`})]}),e&&(0,g.jsx)(`div`,{className:`flex gap-1`,children:(0,g.jsxs)(n,{size:`sm`,onClick:()=>void A(),disabled:O||!S||S===w,children:[O?(0,g.jsx)(s,{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)(s,{className:`h-6 w-6 animate-spin text-muted-foreground`})}):e?(0,g.jsx)(u,{height:`100%`,language:_(e.path),value:S,onChange:e=>C(e??``),theme:v===`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)(a,{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)(a,{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 AI files`})]})}export{v as default};
@@ -1 +0,0 @@
1
- import{r as e}from"./rolldown-runtime-Dw2cE7zH.js";import{$n as t,An as n,Bn as r,Ci as i,Dn as a,En as o,Fi as s,Fn as c,Gn as l,Hn as u,In as d,Kn as f,Ln as p,Mn as m,Ni as h,On as g,Pi as _,Pn as v,Qn as y,Rn as b,Si as x,Tn as S,Vn as C,Wn as w,Xn as T,a as E,bi as D,hi as O,i as k,kn as A,m as j,o as M,or as N,s as P,tt as ee,ui as te,wi as F,wn as ne,xi as re,zn as ie}from"./dialogs-config-CdogKQE6.js";var ae=[`top`,`right`,`bottom`,`left`],I=Math.min,L=Math.max,oe=Math.round,se=Math.floor,R=e=>({x:e,y:e}),ce={left:`right`,right:`left`,bottom:`top`,top:`bottom`},le={start:`end`,end:`start`};function ue(e,t,n){return L(e,I(t,n))}function z(e,t){return typeof e==`function`?e(t):e}function B(e){return e.split(`-`)[0]}function de(e){return e.split(`-`)[1]}function fe(e){return e===`x`?`y`:`x`}function pe(e){return e===`y`?`height`:`width`}var me=new Set([`top`,`bottom`]);function V(e){return me.has(B(e))?`y`:`x`}function he(e){return fe(V(e))}function ge(e,t,n){n===void 0&&(n=!1);let r=de(e),i=he(e),a=pe(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=Te(o)),[o,Te(o)]}function _e(e){let t=Te(e);return[ve(e),t,ve(t)]}function ve(e){return e.replace(/start|end/g,e=>le[e])}var ye=[`left`,`right`],be=[`right`,`left`],xe=[`top`,`bottom`],Se=[`bottom`,`top`];function Ce(e,t,n){switch(e){case`top`:case`bottom`:return n?t?be:ye:t?ye:be;case`left`:case`right`:return t?xe:Se;default:return[]}}function we(e,t,n,r){let i=de(e),a=Ce(B(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(ve)))),a}function Te(e){return e.replace(/left|right|bottom|top/g,e=>ce[e])}function Ee(e){return{top:0,right:0,bottom:0,left:0,...e}}function De(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Ee(e)}function Oe(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 ke(e,t,n){let{reference:r,floating:i}=e,a=V(t),o=he(t),s=pe(o),c=B(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(de(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 Ae(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}=z(t,e),p=De(f),m=o[d?u===`floating`?`reference`:`floating`:u],h=Oe(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=Oe(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 je=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}=ke(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??Ae},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}=ke(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}},Me=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}=z(e,t)||{};if(l==null)return{};let d=De(u),f={x:n,y:r},p=he(i),m=pe(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=I(d[_],T),D=I(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=ue(O,A,k),M=!c.arrow&&de(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),Ne=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}=z(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=B(r),_=V(o),v=B(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[Te(o)]:_e(o)),x=p!==`none`;!d&&x&&b.push(...we(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=ge(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`&&_!==V(t))||T.every(e=>V(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=V(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 Pe(e,t){return{top:e.top-t.height,right:e.right-t.width,bottom:e.bottom-t.height,left:e.left-t.width}}function Fe(e){return ae.some(t=>e[t]>=0)}var Ie=function(e){return e===void 0&&(e={}),{name:`hide`,options:e,async fn(t){let{rects:n,platform:r}=t,{strategy:i=`referenceHidden`,...a}=z(e,t);switch(i){case`referenceHidden`:{let e=Pe(await r.detectOverflow(t,{...a,elementContext:`reference`}),n.reference);return{data:{referenceHiddenOffsets:e,referenceHidden:Fe(e)}}}case`escaped`:{let e=Pe(await r.detectOverflow(t,{...a,altBoundary:!0}),n.floating);return{data:{escapedOffsets:e,escaped:Fe(e)}}}default:return{}}}}},Le=new Set([`left`,`top`]);async function Re(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=B(n),s=de(n),c=V(n)===`y`,l=Le.has(o)?-1:1,u=a&&c?-1:1,d=z(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 ze=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 Re(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}}}}},Be=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}=z(e,t),u={x:n,y:r},d=await a.detectOverflow(t,l),f=V(B(i)),p=fe(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=ue(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=ue(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}}}}}},Ve=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}=z(e,t),u={x:n,y:r},d=V(i),f=fe(d),p=u[f],m=u[d],h=z(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=Le.has(B(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}}}},He=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}=z(e,t),u=await o.detectOverflow(t,l),d=B(i),f=de(i),p=V(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=I(h-u[g],v),x=I(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=L(u.left,0),t=L(u.right,0),n=L(u.top,0),r=L(u.bottom,0);p?w=m-2*(e!==0||t!==0?e+t:L(u.left,u.right)):C=h-2*(n!==0||r!==0?n+r:L(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 Ue(){return typeof window<`u`}function We(e){return Ge(e)?(e.nodeName||``).toLowerCase():`#document`}function H(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function U(e){return((Ge(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function Ge(e){return Ue()?e instanceof Node||e instanceof H(e).Node:!1}function W(e){return Ue()?e instanceof Element||e instanceof H(e).Element:!1}function G(e){return Ue()?e instanceof HTMLElement||e instanceof H(e).HTMLElement:!1}function Ke(e){return!Ue()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof H(e).ShadowRoot}var qe=new Set([`inline`,`contents`]);function Je(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=K(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!qe.has(i)}var Ye=new Set([`table`,`td`,`th`]);function Xe(e){return Ye.has(We(e))}var Ze=[`:popover-open`,`:modal`];function Qe(e){return Ze.some(t=>{try{return e.matches(t)}catch{return!1}})}var $e=[`transform`,`translate`,`scale`,`rotate`,`perspective`],et=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],tt=[`paint`,`layout`,`strict`,`content`];function nt(e){let t=it(),n=W(e)?K(e):e;return $e.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)||et.some(e=>(n.willChange||``).includes(e))||tt.some(e=>(n.contain||``).includes(e))}function rt(e){let t=q(e);for(;G(t)&&!ot(t);){if(nt(t))return t;if(Qe(t))return null;t=q(t)}return null}function it(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}var at=new Set([`html`,`body`,`#document`]);function ot(e){return at.has(We(e))}function K(e){return H(e).getComputedStyle(e)}function st(e){return W(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function q(e){if(We(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Ke(e)&&e.host||U(e);return Ke(t)?t.host:t}function ct(e){let t=q(e);return ot(t)?e.ownerDocument?e.ownerDocument.body:e.body:G(t)&&Je(t)?t:ct(t)}function lt(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=ct(e),i=r===e.ownerDocument?.body,a=H(r);if(i){let e=ut(a);return t.concat(a,a.visualViewport||[],Je(r)?r:[],e&&n?lt(e):[])}return t.concat(r,lt(r,[],n))}function ut(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function dt(e){let t=K(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=G(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=oe(n)!==a||oe(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function ft(e){return W(e)?e:e.contextElement}function pt(e){let t=ft(e);if(!G(t))return R(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=dt(t),o=(a?oe(n.width):n.width)/r,s=(a?oe(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}var mt=R(0);function ht(e){let t=H(e);return!it()||!t.visualViewport?mt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function gt(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==H(e)?!1:t}function _t(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=ft(e),o=R(1);t&&(r?W(r)&&(o=pt(r)):o=pt(e));let s=gt(a,n,r)?ht(a):R(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=H(a),t=r&&W(r)?H(r):r,n=e,i=ut(n);for(;i&&r&&t!==n;){let e=pt(i),t=i.getBoundingClientRect(),r=K(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=H(i),i=ut(n)}}return Oe({width:u,height:d,x:c,y:l})}function vt(e,t){let n=st(e).scrollLeft;return t?t.left+n:_t(U(e)).left+n}function yt(e,t){let n=e.getBoundingClientRect();return{x:n.left+t.scrollLeft-vt(e,n),y:n.top+t.scrollTop}}function bt(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=U(r),s=t?Qe(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=R(1),u=R(0),d=G(r);if((d||!d&&!a)&&((We(r)!==`body`||Je(o))&&(c=st(r)),G(r))){let e=_t(r);l=pt(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?yt(o,c):R(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 xt(e){return Array.from(e.getClientRects())}function St(e){let t=U(e),n=st(e),r=e.ownerDocument.body,i=L(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=L(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+vt(e),s=-n.scrollTop;return K(r).direction===`rtl`&&(o+=L(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}var Ct=25;function wt(e,t){let n=H(e),r=U(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=it();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}let l=vt(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<=Ct&&(a-=o)}else l<=Ct&&(a+=l);return{width:a,height:o,x:s,y:c}}var Tt=new Set([`absolute`,`fixed`]);function Et(e,t){let n=_t(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=G(e)?pt(e):R(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Dt(e,t,n){let r;if(t===`viewport`)r=wt(e,n);else if(t===`document`)r=St(U(e));else if(W(t))r=Et(t,n);else{let n=ht(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Oe(r)}function Ot(e,t){let n=q(e);return n===t||!W(n)||ot(n)?!1:K(n).position===`fixed`||Ot(n,t)}function kt(e,t){let n=t.get(e);if(n)return n;let r=lt(e,[],!1).filter(e=>W(e)&&We(e)!==`body`),i=null,a=K(e).position===`fixed`,o=a?q(e):e;for(;W(o)&&!ot(o);){let t=K(o),n=nt(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&Tt.has(i.position)||Je(o)&&!n&&Ot(e,o))?r=r.filter(e=>e!==o):i=t,o=q(o)}return t.set(e,r),r}function At(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Qe(t)?[]:kt(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=Dt(t,n,i);return e.top=L(r.top,e.top),e.right=I(r.right,e.right),e.bottom=I(r.bottom,e.bottom),e.left=L(r.left,e.left),e},Dt(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function jt(e){let{width:t,height:n}=dt(e);return{width:t,height:n}}function Mt(e,t,n){let r=G(t),i=U(t),a=n===`fixed`,o=_t(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=R(0);function l(){c.x=vt(i)}if(r||!r&&!a)if((We(t)!==`body`||Je(i))&&(s=st(t)),r){let e=_t(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?yt(i,s):R(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 Nt(e){return K(e).position===`static`}function Pt(e,t){if(!G(e)||K(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return U(e)===n&&(n=n.ownerDocument.body),n}function Ft(e,t){let n=H(e);if(Qe(e))return n;if(!G(e)){let t=q(e);for(;t&&!ot(t);){if(W(t)&&!Nt(t))return t;t=q(t)}return n}let r=Pt(e,t);for(;r&&Xe(r)&&Nt(r);)r=Pt(r,t);return r&&ot(r)&&Nt(r)&&!nt(r)?n:r||rt(e)||n}var It=async function(e){let t=this.getOffsetParent||Ft,n=this.getDimensions,r=await n(e.floating);return{reference:Mt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Lt(e){return K(e).direction===`rtl`}var Rt={convertOffsetParentRelativeRectToViewportRelativeRect:bt,getDocumentElement:U,getClippingRect:At,getOffsetParent:Ft,getElementRects:It,getClientRects:xt,getDimensions:jt,getScale:pt,isElement:W,isRTL:Lt};function zt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Bt(e,t){let n=null,r,i=U(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=se(d),h=se(i.clientWidth-(u+f)),g=se(i.clientHeight-(d+p)),_=se(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:L(0,I(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&&!zt(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 Vt(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=ft(e),u=i||a?[...l?lt(l):[],...lt(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Bt(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?_t(e):null;c&&g();function g(){let t=_t(e);h&&!zt(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 Ht=ze,Ut=Be,Wt=Ne,Gt=He,Kt=Ie,qt=Me,Jt=Ve,Yt=(e,t,n)=>{let r=new Map,i={platform:Rt,...n},a={...i.platform,_c:r};return je(e,t,{...i,platform:a})},J=e(s(),1),Xt=e(_(),1),Zt=typeof document<`u`?J.useLayoutEffect:function(){};function Qt(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(!Qt(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)&&!Qt(e[n],t[n]))return!1}return!0}return e!==e&&t!==t}function $t(e){return typeof window>`u`?1:(e.ownerDocument.defaultView||window).devicePixelRatio||1}function en(e,t){let n=$t(e);return Math.round(t*n)/n}function tn(e){let t=J.useRef(e);return Zt(()=>{t.current=e}),t}function nn(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]=J.useState({x:0,y:0,strategy:n,placement:t,middlewareData:{},isPositioned:!1}),[f,p]=J.useState(r);Qt(f,r)||p(r);let[m,h]=J.useState(null),[g,_]=J.useState(null),v=J.useCallback(e=>{e!==S.current&&(S.current=e,h(e))},[]),y=J.useCallback(e=>{e!==C.current&&(C.current=e,_(e))},[]),b=a||m,x=o||g,S=J.useRef(null),C=J.useRef(null),w=J.useRef(u),T=c!=null,E=tn(c),D=tn(i),O=tn(l),k=J.useCallback(()=>{if(!S.current||!C.current)return;let e={placement:t,strategy:n,middleware:f};D.current&&(e.platform=D.current),Yt(S.current,C.current,e).then(e=>{let t={...e,isPositioned:O.current!==!1};A.current&&!Qt(w.current,t)&&(w.current=t,Xt.flushSync(()=>{d(t)}))})},[f,t,n,D,O]);Zt(()=>{l===!1&&w.current.isPositioned&&(w.current.isPositioned=!1,d(e=>({...e,isPositioned:!1})))},[l]);let A=J.useRef(!1);Zt(()=>(A.current=!0,()=>{A.current=!1}),[]),Zt(()=>{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=J.useMemo(()=>({reference:S,floating:C,setReference:v,setFloating:y}),[v,y]),M=J.useMemo(()=>({reference:b,floating:x}),[b,x]),N=J.useMemo(()=>{let e={position:n,left:0,top:0};if(!M.floating)return e;let t=en(M.floating,u.x),r=en(M.floating,u.y);return s?{...e,transform:`translate(`+t+`px, `+r+`px)`,...$t(M.floating)>=1.5&&{willChange:`transform`}}:{position:n,left:t,top:r}},[n,s,M.floating,u.x,u.y]);return J.useMemo(()=>({...u,update:k,refs:j,elements:M,floatingStyles:N}),[u,k,j,M,N])}var rn=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?{}:qt({element:r.current,padding:i}).fn(n):r?qt({element:r,padding:i}).fn(n):{}}}},an=(e,t)=>({...Ht(e),options:[e,t]}),on=(e,t)=>({...Ut(e),options:[e,t]}),sn=(e,t)=>({...Jt(e),options:[e,t]}),cn=(e,t)=>({...Wt(e),options:[e,t]}),ln=(e,t)=>({...Gt(e),options:[e,t]}),un=(e,t)=>({...Kt(e),options:[e,t]}),dn=(e,t)=>({...rn(e),options:[e,t]}),Y=T(),fn=`Arrow`,pn=J.forwardRef((e,t)=>{let{children:n,width:r=10,height:i=5,...a}=e;return(0,Y.jsx)(u.svg,{...a,ref:t,width:r,height:i,viewBox:`0 0 30 10`,preserveAspectRatio:`none`,children:e.asChild?n:(0,Y.jsx)(`polygon`,{points:`0,0 30,0 15,10`})})});pn.displayName=fn;var mn=pn;function hn(e){let[t,n]=J.useState(void 0);return C(()=>{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 gn=`Popper`,[_n,vn]=ie(gn),[yn,bn]=_n(gn),xn=e=>{let{__scopePopper:t,children:n}=e,[r,i]=J.useState(null);return(0,Y.jsx)(yn,{scope:t,anchor:r,onAnchorChange:i,children:n})};xn.displayName=gn;var Sn=`PopperAnchor`,Cn=J.forwardRef((e,t)=>{let{__scopePopper:n,virtualRef:r,...i}=e,a=bn(Sn,n),o=J.useRef(null),s=y(t,o),c=J.useRef(null);return J.useEffect(()=>{let e=c.current;c.current=r?.current||o.current,e!==c.current&&a.onAnchorChange(c.current)}),r?null:(0,Y.jsx)(u.div,{...i,ref:s})});Cn.displayName=Sn;var wn=`PopperContent`,[Tn,En]=_n(wn),Dn=J.forwardRef((e,t)=>{let{__scopePopper:n,side:r=`bottom`,sideOffset:i=0,align:a=`center`,alignOffset:o=0,arrowPadding:s=0,avoidCollisions:c=!0,collisionBoundary:l=[],collisionPadding:d=0,sticky:f=`partial`,hideWhenDetached:p=!1,updatePositionStrategy:m=`optimized`,onPlaced:h,...g}=e,_=bn(wn,n),[v,x]=J.useState(null),S=y(t,e=>x(e)),[w,T]=J.useState(null),E=hn(w),D=E?.width??0,O=E?.height??0,k=r+(a===`center`?``:`-`+a),A=typeof d==`number`?d:{top:0,right:0,bottom:0,left:0,...d},j=Array.isArray(l)?l:[l],M=j.length>0,N={padding:A,boundary:j.filter(jn),altBoundary:M},{refs:P,floatingStyles:ee,placement:te,isPositioned:F,middlewareData:ne}=nn({strategy:`fixed`,placement:k,whileElementsMounted:(...e)=>Vt(...e,{animationFrame:m===`always`}),elements:{reference:_.anchor},middleware:[an({mainAxis:i+O,alignmentAxis:o}),c&&on({mainAxis:!0,crossAxis:!1,limiter:f===`partial`?sn():void 0,...N}),c&&cn({...N}),ln({...N,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`)}}),w&&dn({element:w,padding:s}),Mn({arrowWidth:D,arrowHeight:O}),p&&un({strategy:`referenceHidden`,...N})]}),[re,ie]=Nn(te),ae=b(h);C(()=>{F&&ae?.()},[F,ae]);let I=ne.arrow?.x,L=ne.arrow?.y,oe=ne.arrow?.centerOffset!==0,[se,R]=J.useState();return C(()=>{v&&R(window.getComputedStyle(v).zIndex)},[v]),(0,Y.jsx)(`div`,{ref:P.setFloating,"data-radix-popper-content-wrapper":``,style:{...ee,transform:F?ee.transform:`translate(0, -200%)`,minWidth:`max-content`,zIndex:se,"--radix-popper-transform-origin":[ne.transformOrigin?.x,ne.transformOrigin?.y].join(` `),...ne.hide?.referenceHidden&&{visibility:`hidden`,pointerEvents:`none`}},dir:e.dir,children:(0,Y.jsx)(Tn,{scope:n,placedSide:re,onArrowChange:T,arrowX:I,arrowY:L,shouldHideArrow:oe,children:(0,Y.jsx)(u.div,{"data-side":re,"data-align":ie,...g,ref:S,style:{...g.style,animation:F?void 0:`none`}})})})});Dn.displayName=wn;var On=`PopperArrow`,kn={top:`bottom`,right:`left`,bottom:`top`,left:`right`},An=J.forwardRef(function(e,t){let{__scopePopper:n,...r}=e,i=En(On,n),a=kn[i.placedSide];return(0,Y.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,Y.jsx)(mn,{...r,ref:t,style:{...r.style,display:`block`}})})});An.displayName=On;function jn(e){return e!==null}var Mn=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]=Nn(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 Nn(e){let[t,n=`center`]=e.split(`-`);return[t,n]}var Pn=xn,Fn=Cn,In=Dn,Ln=An,Rn=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`}),zn=`VisuallyHidden`,Bn=J.forwardRef((e,t)=>(0,Y.jsx)(u.span,{...e,ref:t,style:{...Rn,...e.style}}));Bn.displayName=zn;var Vn=Bn,[Hn,Un]=ie(`Tooltip`,[vn]),Wn=vn(),Gn=`TooltipProvider`,Kn=700,qn=`tooltip.open`,[Jn,Yn]=Hn(Gn),Xn=e=>{let{__scopeTooltip:t,delayDuration:n=Kn,skipDelayDuration:r=300,disableHoverableContent:i=!1,children:a}=e,o=J.useRef(!0),s=J.useRef(!1),c=J.useRef(0);return J.useEffect(()=>{let e=c.current;return()=>window.clearTimeout(e)},[]),(0,Y.jsx)(Jn,{scope:t,isOpenDelayedRef:o,delayDuration:n,onOpen:J.useCallback(()=>{window.clearTimeout(c.current),o.current=!1},[]),onClose:J.useCallback(()=>{window.clearTimeout(c.current),c.current=window.setTimeout(()=>o.current=!0,r)},[r]),isPointerInTransitRef:s,onPointerInTransitChange:J.useCallback(e=>{s.current=e},[]),disableHoverableContent:i,children:a})};Xn.displayName=Gn;var Zn=`Tooltip`,[Qn,$n]=Hn(Zn),er=e=>{let{__scopeTooltip:t,children:r,open:i,defaultOpen:a,onOpenChange:o,disableHoverableContent:s,delayDuration:c}=e,l=Yn(Zn,e.__scopeTooltip),u=Wn(t),[d,f]=J.useState(null),p=n(),m=J.useRef(0),h=s??l.disableHoverableContent,_=c??l.delayDuration,v=J.useRef(!1),[y,b]=g({prop:i,defaultProp:a??!1,onChange:e=>{e?(l.onOpen(),document.dispatchEvent(new CustomEvent(qn))):l.onClose(),o?.(e)},caller:Zn}),x=J.useMemo(()=>y?v.current?`delayed-open`:`instant-open`:`closed`,[y]),S=J.useCallback(()=>{window.clearTimeout(m.current),m.current=0,v.current=!1,b(!0)},[b]),C=J.useCallback(()=>{window.clearTimeout(m.current),m.current=0,b(!1)},[b]),w=J.useCallback(()=>{window.clearTimeout(m.current),m.current=window.setTimeout(()=>{v.current=!0,b(!0),m.current=0},_)},[_,b]);return J.useEffect(()=>()=>{m.current&&=(window.clearTimeout(m.current),0)},[]),(0,Y.jsx)(Pn,{...u,children:(0,Y.jsx)(Qn,{scope:t,contentId:p,open:y,stateAttribute:x,trigger:d,onTriggerChange:f,onTriggerEnter:J.useCallback(()=>{l.isOpenDelayedRef.current?w():S()},[l.isOpenDelayedRef,w,S]),onTriggerLeave:J.useCallback(()=>{h?C():(window.clearTimeout(m.current),m.current=0)},[C,h]),onOpen:S,onClose:C,disableHoverableContent:h,children:r})})};er.displayName=Zn;var tr=`TooltipTrigger`,nr=J.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=$n(tr,n),a=Yn(tr,n),o=Wn(n),s=y(t,J.useRef(null),i.onTriggerChange),l=J.useRef(!1),d=J.useRef(!1),f=J.useCallback(()=>l.current=!1,[]);return J.useEffect(()=>()=>document.removeEventListener(`pointerup`,f),[f]),(0,Y.jsx)(Fn,{asChild:!0,...o,children:(0,Y.jsx)(u.button,{"aria-describedby":i.open?i.contentId:void 0,"data-state":i.stateAttribute,...r,ref:s,onPointerMove:c(e.onPointerMove,e=>{e.pointerType!==`touch`&&!d.current&&!a.isPointerInTransitRef.current&&(i.onTriggerEnter(),d.current=!0)}),onPointerLeave:c(e.onPointerLeave,()=>{i.onTriggerLeave(),d.current=!1}),onPointerDown:c(e.onPointerDown,()=>{i.open&&i.onClose(),l.current=!0,document.addEventListener(`pointerup`,f,{once:!0})}),onFocus:c(e.onFocus,()=>{l.current||i.onOpen()}),onBlur:c(e.onBlur,i.onClose),onClick:c(e.onClick,i.onClose)})})});nr.displayName=tr;var rr=`TooltipPortal`,[ir,ar]=Hn(rr,{forceMount:void 0}),or=e=>{let{__scopeTooltip:t,forceMount:n,children:i,container:a}=e,o=$n(rr,t);return(0,Y.jsx)(ir,{scope:t,forceMount:n,children:(0,Y.jsx)(r,{present:n||o.open,children:(0,Y.jsx)(A,{asChild:!0,container:a,children:i})})})};or.displayName=rr;var sr=`TooltipContent`,cr=J.forwardRef((e,t)=>{let n=ar(sr,e.__scopeTooltip),{forceMount:i=n.forceMount,side:a=`top`,...o}=e,s=$n(sr,e.__scopeTooltip);return(0,Y.jsx)(r,{present:i||s.open,children:s.disableHoverableContent?(0,Y.jsx)(pr,{side:a,...o,ref:t}):(0,Y.jsx)(lr,{side:a,...o,ref:t})})}),lr=J.forwardRef((e,t)=>{let n=$n(sr,e.__scopeTooltip),r=Yn(sr,e.__scopeTooltip),i=J.useRef(null),a=y(t,i),[o,s]=J.useState(null),{trigger:c,onClose:l}=n,u=i.current,{onPointerInTransitChange:d}=r,f=J.useCallback(()=>{s(null),d(!1)},[d]),p=J.useCallback((e,t)=>{let n=e.currentTarget,r={x:e.clientX,y:e.clientY},i=_r(r,gr(r,n.getBoundingClientRect())),a=vr(t.getBoundingClientRect());s(br([...i,...a])),d(!0)},[d]);return J.useEffect(()=>()=>f(),[f]),J.useEffect(()=>{if(c&&u){let e=e=>p(e,u),t=e=>p(e,c);return c.addEventListener(`pointerleave`,e),u.addEventListener(`pointerleave`,t),()=>{c.removeEventListener(`pointerleave`,e),u.removeEventListener(`pointerleave`,t)}}},[c,u,p,f]),J.useEffect(()=>{if(o){let e=e=>{let t=e.target,n={x:e.clientX,y:e.clientY},r=c?.contains(t)||u?.contains(t),i=!yr(n,o);r?f():i&&(f(),l())};return document.addEventListener(`pointermove`,e),()=>document.removeEventListener(`pointermove`,e)}},[c,u,o,l,f]),(0,Y.jsx)(pr,{...e,ref:a})}),[ur,dr]=Hn(Zn,{isInside:!1}),fr=l(`TooltipContent`),pr=J.forwardRef((e,t)=>{let{__scopeTooltip:n,children:r,"aria-label":i,onEscapeKeyDown:a,onPointerDownOutside:o,...s}=e,c=$n(sr,n),l=Wn(n),{onClose:u}=c;return J.useEffect(()=>(document.addEventListener(qn,u),()=>document.removeEventListener(qn,u)),[u]),J.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,Y.jsx)(m,{asChild:!0,disableOutsidePointerEvents:!1,onEscapeKeyDown:a,onPointerDownOutside:o,onFocusOutside:e=>e.preventDefault(),onDismiss:u,children:(0,Y.jsxs)(In,{"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,Y.jsx)(fr,{children:r}),(0,Y.jsx)(ur,{scope:n,isInside:!0,children:(0,Y.jsx)(Vn,{id:c.contentId,role:`tooltip`,children:i||r})})]})})});cr.displayName=sr;var mr=`TooltipArrow`,hr=J.forwardRef((e,t)=>{let{__scopeTooltip:n,...r}=e,i=Wn(n);return dr(mr,n).isInside?null:(0,Y.jsx)(Ln,{...i,...r,ref:t})});hr.displayName=mr;function gr(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 _r(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 vr(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 yr(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 br(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?1:0),xr(t)}function xr(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 Sr=Xn,Cr=er,wr=nr,Tr=cr,X=h(),Er=Sr,Dr=Cr,Or=wr,kr=J.forwardRef((e,n)=>{let r=(0,X.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=t(`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]!==n||r[8]!==s||r[9]!==c?(l=(0,Y.jsx)(Tr,{ref:n,sideOffset:s,className:c,...a}),r[6]=a,r[7]=n,r[8]=s,r[9]=c,r[10]=l):l=r[10],l});kr.displayName=Tr.displayName;function Ar(e){let t=J.useRef({value:e,previous:e});return J.useMemo(()=>(t.current.value!==e&&(t.current.previous=t.current.value,t.current.value=e),t.current.previous),[e])}var jr=J.forwardRef((e,n)=>{let r=(0,X.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=t(`w-full caption-bottom text-sm`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==n||r[7]!==o?(s=(0,Y.jsx)(`div`,{className:`relative w-full overflow-auto`,children:(0,Y.jsx)(`table`,{ref:n,className:o,...a})}),r[5]=a,r[6]=n,r[7]=o,r[8]=s):s=r[8],s});jr.displayName=`Table`;var Mr=J.forwardRef((e,n)=>{let r=(0,X.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=t(`[&_tr]:border-b`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==n||r[7]!==o?(s=(0,Y.jsx)(`thead`,{ref:n,className:o,...a}),r[5]=a,r[6]=n,r[7]=o,r[8]=s):s=r[8],s});Mr.displayName=`TableHeader`;var Nr=J.forwardRef((e,n)=>{let r=(0,X.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=t(`[&_tr:last-child]:border-0`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==n||r[7]!==o?(s=(0,Y.jsx)(`tbody`,{ref:n,className:o,...a}),r[5]=a,r[6]=n,r[7]=o,r[8]=s):s=r[8],s});Nr.displayName=`TableBody`;var Pr=J.forwardRef((e,n)=>{let r=(0,X.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=t(`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]!==n||r[7]!==o?(s=(0,Y.jsx)(`tfoot`,{ref:n,className:o,...a}),r[5]=a,r[6]=n,r[7]=o,r[8]=s):s=r[8],s});Pr.displayName=`TableFooter`;var Fr=J.forwardRef((e,n)=>{let r=(0,X.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=t(`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]!==n||r[7]!==o?(s=(0,Y.jsx)(`tr`,{ref:n,className:o,...a}),r[5]=a,r[6]=n,r[7]=o,r[8]=s):s=r[8],s});Fr.displayName=`TableRow`;var Z=J.forwardRef((e,n)=>{let r=(0,X.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=t(`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]!==n||r[7]!==o?(s=(0,Y.jsx)(`th`,{ref:n,className:o,...a}),r[5]=a,r[6]=n,r[7]=o,r[8]=s):s=r[8],s});Z.displayName=`TableHead`;var Q=J.forwardRef((e,n)=>{let r=(0,X.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=t(`p-4 align-middle [&:has([role=checkbox])]:pr-0`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==n||r[7]!==o?(s=(0,Y.jsx)(`td`,{ref:n,className:o,...a}),r[5]=a,r[6]=n,r[7]=o,r[8]=s):s=r[8],s});Q.displayName=`TableCell`;var Ir=J.forwardRef((e,n)=>{let r=(0,X.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=t(`mt-4 text-sm text-muted-foreground`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==n||r[7]!==o?(s=(0,Y.jsx)(`caption`,{ref:n,className:o,...a}),r[5]=a,r[6]=n,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]=j(zr),[Ur,Wr]=ie(zr,[Hr,vn]),Gr=vn(),[Kr,qr]=Ur(zr),[Jr,Yr]=Ur(zr),Xr=e=>{let{__scopeSelect:t,children:r,open:i,defaultOpen:a,onOpenChange:o,value:s,defaultValue:c,onValueChange:l,dir:u,name:d,autoComplete:f,disabled:m,required:h,form:_}=e,v=Gr(t),[y,b]=J.useState(null),[x,S]=J.useState(null),[C,w]=J.useState(!1),T=p(u),[E,D]=g({prop:i,defaultProp:a??!1,onChange:o,caller:zr}),[O,k]=g({prop:s,defaultProp:c,onChange:l,caller:zr}),A=J.useRef(null),j=y?_||!!y.closest(`form`):!0,[M,N]=J.useState(new Set),P=Array.from(M).map(e=>e.props.value).join(`;`);return(0,Y.jsx)(Pn,{...v,children:(0,Y.jsxs)(Kr,{required:h,scope:t,trigger:y,onTriggerChange:b,valueNode:x,onValueNodeChange:S,valueNodeHasChildren:C,onValueNodeHasChildrenChange:w,contentId:n(),value:O,onValueChange:k,open:E,onOpenChange:D,dir:T,triggerPointerDownPosRef:A,disabled:m,children:[(0,Y.jsx)(Br.Provider,{scope:t,children:(0,Y.jsx)(Jr,{scope:e.__scopeSelect,onNativeOptionAdd:J.useCallback(e=>{N(t=>new Set(t).add(e))},[]),onNativeOptionRemove:J.useCallback(e=>{N(t=>{let n=new Set(t);return n.delete(e),n})},[]),children:r})}),j?(0,Y.jsxs)(Wi,{"aria-hidden":!0,required:h,tabIndex:-1,name:d,autoComplete:f,value:O,onChange:e=>k(e.target.value),disabled:m,form:_,children:[O===void 0?(0,Y.jsx)(`option`,{value:``}):null,Array.from(M)]},P):null]})})};Xr.displayName=zr;var Zr=`SelectTrigger`,Qr=J.forwardRef((e,t)=>{let{__scopeSelect:n,disabled:r=!1,...i}=e,a=Gr(n),o=qr(Zr,n),s=o.disabled||r,l=y(t,o.onTriggerChange),d=Vr(n),f=J.useRef(`touch`),[p,m,h]=Ki(e=>{let t=d().filter(e=>!e.disabled),n=qi(t,e,t.find(e=>e.value===o.value));n!==void 0&&o.onValueChange(n.value)}),g=e=>{s||(o.onOpenChange(!0),h()),e&&(o.triggerPointerDownPosRef.current={x:Math.round(e.pageX),y:Math.round(e.pageY)})};return(0,Y.jsx)(Fn,{asChild:!0,...a,children:(0,Y.jsx)(u.button,{type:`button`,role:`combobox`,"aria-controls":o.contentId,"aria-expanded":o.open,"aria-required":o.required,"aria-autocomplete":`none`,dir:o.dir,"data-state":o.open?`open`:`closed`,disabled:s,"data-disabled":s?``:void 0,"data-placeholder":Gi(o.value)?``:void 0,...i,ref:l,onClick:c(i.onClick,e=>{e.currentTarget.focus(),f.current!==`mouse`&&g(e)}),onPointerDown:c(i.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:c(i.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=J.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,children:a,placeholder:o=``,...s}=e,c=qr($r,n),{onValueNodeHasChildrenChange:l}=c,d=a!==void 0,f=y(t,c.onValueNodeChange);return C(()=>{l(d)},[l,d]),(0,Y.jsx)(u.span,{...s,ref:f,style:{pointerEvents:`none`},children:Gi(c.value)?(0,Y.jsx)(Y.Fragment,{children:o}):a})});ei.displayName=$r;var ti=`SelectIcon`,ni=J.forwardRef((e,t)=>{let{__scopeSelect:n,children:r,...i}=e;return(0,Y.jsx)(u.span,{"aria-hidden":!0,...i,ref:t,children:r||`▼`})});ni.displayName=ti;var ri=`SelectPortal`,ii=e=>(0,Y.jsx)(A,{asChild:!0,...e});ii.displayName=ri;var ai=`SelectContent`,oi=J.forwardRef((e,t)=>{let n=qr(ai,e.__scopeSelect),[r,i]=J.useState();if(C(()=>{i(new DocumentFragment)},[]),!n.open){let t=r;return t?Xt.createPortal((0,Y.jsx)(si,{scope:e.__scopeSelect,children:(0,Y.jsx)(Br.Slot,{scope:e.__scopeSelect,children:(0,Y.jsx)(`div`,{children:e.children})})}),t):null}return(0,Y.jsx)(di,{...e,ref:t})});oi.displayName=ai;var $=10,[si,ci]=Ur(ai),li=`SelectContentImpl`,ui=w(`SelectContent.RemoveScroll`),di=J.forwardRef((e,t)=>{let{__scopeSelect:n,position:r=`item-aligned`,onCloseAutoFocus:i,onEscapeKeyDown:s,onPointerDownOutside:l,side:u,sideOffset:d,align:f,alignOffset:p,arrowPadding:h,collisionBoundary:g,collisionPadding:_,sticky:v,hideWhenDetached:b,avoidCollisions:x,...C}=e,w=qr(ai,n),[T,E]=J.useState(null),[D,O]=J.useState(null),k=y(t,e=>E(e)),[A,j]=J.useState(null),[M,N]=J.useState(null),P=Vr(n),[ee,te]=J.useState(!1),F=J.useRef(!1);J.useEffect(()=>{if(T)return ne(T)},[T]),o();let re=J.useCallback(e=>{let[t,...n]=P().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&&D&&(D.scrollTop=0),n===r&&D&&(D.scrollTop=D.scrollHeight),n?.focus(),document.activeElement!==i))return},[P,D]),ie=J.useCallback(()=>re([A,T]),[re,A,T]);J.useEffect(()=>{ee&&ie()},[ee,ie]);let{onOpenChange:ae,triggerPointerDownPosRef:I}=w;J.useEffect(()=>{if(T){let e={x:0,y:0},t=t=>{e={x:Math.abs(Math.round(t.pageX)-(I.current?.x??0)),y:Math.abs(Math.round(t.pageY)-(I.current?.y??0))}},n=n=>{e.x<=10&&e.y<=10?n.preventDefault():T.contains(n.target)||ae(!1),document.removeEventListener(`pointermove`,t),I.current=null};return I.current!==null&&(document.addEventListener(`pointermove`,t),document.addEventListener(`pointerup`,n,{capture:!0,once:!0})),()=>{document.removeEventListener(`pointermove`,t),document.removeEventListener(`pointerup`,n,{capture:!0})}}},[T,ae,I]),J.useEffect(()=>{let e=()=>ae(!1);return window.addEventListener(`blur`,e),window.addEventListener(`resize`,e),()=>{window.removeEventListener(`blur`,e),window.removeEventListener(`resize`,e)}},[ae]);let[L,oe]=Ki(e=>{let t=P().filter(e=>!e.disabled),n=qi(t,e,t.find(e=>e.ref.current===document.activeElement));n&&setTimeout(()=>n.ref.current.focus())}),se=J.useCallback((e,t,n)=>{let r=!F.current&&!n;(w.value!==void 0&&w.value===t||r)&&(j(e),r&&(F.current=!0))},[w.value]),R=J.useCallback(()=>T?.focus(),[T]),ce=J.useCallback((e,t,n)=>{let r=!F.current&&!n;(w.value!==void 0&&w.value===t||r)&&N(e)},[w.value]),le=r===`popper`?hi:pi,ue=le===hi?{side:u,sideOffset:d,align:f,alignOffset:p,arrowPadding:h,collisionBoundary:g,collisionPadding:_,sticky:v,hideWhenDetached:b,avoidCollisions:x}:{};return(0,Y.jsx)(si,{scope:n,content:T,viewport:D,onViewportChange:O,itemRefCallback:se,selectedItem:A,onItemLeave:R,itemTextRefCallback:ce,focusSelectedItem:ie,selectedItemText:M,position:r,isPositioned:ee,searchRef:L,children:(0,Y.jsx)(S,{as:ui,allowPinchZoom:!0,children:(0,Y.jsx)(a,{asChild:!0,trapped:w.open,onMountAutoFocus:e=>{e.preventDefault()},onUnmountAutoFocus:c(i,e=>{w.trigger?.focus({preventScroll:!0}),e.preventDefault()}),children:(0,Y.jsx)(m,{asChild:!0,disableOutsidePointerEvents:!0,onEscapeKeyDown:s,onPointerDownOutside:l,onFocusOutside:e=>e.preventDefault(),onDismiss:()=>w.onOpenChange(!1),children:(0,Y.jsx)(le,{role:`listbox`,id:w.contentId,"data-state":w.open?`open`:`closed`,dir:w.dir,onContextMenu:e=>e.preventDefault(),...C,...ue,onPlaced:()=>te(!0),ref:k,style:{display:`flex`,flexDirection:`column`,outline:`none`,...C.style},onKeyDown:c(C.onKeyDown,e=>{let t=e.ctrlKey||e.altKey||e.metaKey;if(e.key===`Tab`&&e.preventDefault(),!t&&e.key.length===1&&oe(e.key),[`ArrowUp`,`ArrowDown`,`Home`,`End`].includes(e.key)){let t=P().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(()=>re(t)),e.preventDefault()}})})})})})})});di.displayName=li;var fi=`SelectItemAlignedPosition`,pi=J.forwardRef((e,t)=>{let{__scopeSelect:n,onPlaced:r,...i}=e,a=qr(ai,n),o=ci(ai,n),[s,c]=J.useState(null),[l,f]=J.useState(null),p=y(t,e=>f(e)),m=Vr(n),h=J.useRef(!1),g=J.useRef(!0),{viewport:_,selectedItem:v,selectedItemText:b,focusSelectedItem:x}=o,S=J.useCallback(()=>{if(a.trigger&&a.valueNode&&s&&l&&_&&v&&b){let e=a.trigger.getBoundingClientRect(),t=l.getBoundingClientRect(),n=a.valueNode.getBoundingClientRect(),i=b.getBoundingClientRect();if(a.dir!==`rtl`){let r=i.left-t.left,a=n.left-r,o=e.left-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-$,f=d(a,[$,Math.max($,u-l)]);s.style.minWidth=c+`px`,s.style.left=f+`px`}else{let r=t.right-i.right,a=window.innerWidth-n.right-r,o=window.innerWidth-e.right-a,c=e.width+o,l=Math.max(c,t.width),u=window.innerWidth-$,f=d(a,[$,Math.max($,u-l)]);s.style.minWidth=c+`px`,s.style.right=f+`px`}let o=m(),c=window.innerHeight-$*2,u=_.scrollHeight,f=window.getComputedStyle(l),p=parseInt(f.borderTopWidth,10),g=parseInt(f.paddingTop,10),y=parseInt(f.borderBottomWidth,10),x=parseInt(f.paddingBottom,10),S=p+g+u+x+y,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=o.length>0&&v===o[o.length-1].ref.current;s.style.bottom=`0px`;let t=l.clientHeight-_.offsetTop-_.offsetHeight,n=j+Math.max(O,k+(e?E:0)+t+y);s.style.height=n+`px`}else{let e=o.length>0&&v===o[0].ref.current;s.style.top=`0px`;let t=Math.max(D,p+_.offsetTop+(e?T:0)+k)+M;s.style.height=t+`px`,_.scrollTop=j-D+_.offsetTop}s.style.margin=`${$}px 0`,s.style.minHeight=C+`px`,s.style.maxHeight=c+`px`,r?.(),requestAnimationFrame(()=>h.current=!0)}},[m,a.trigger,a.valueNode,s,l,_,v,b,a.dir,r]);C(()=>S(),[S]);let[w,T]=J.useState();return C(()=>{l&&T(window.getComputedStyle(l).zIndex)},[l]),(0,Y.jsx)(gi,{scope:n,contentWrapper:s,shouldExpandOnScrollRef:h,onScrollButtonChange:J.useCallback(e=>{e&&g.current===!0&&(S(),x?.(),g.current=!1)},[S,x]),children:(0,Y.jsx)(`div`,{ref:c,style:{display:`flex`,flexDirection:`column`,position:`fixed`,zIndex:w},children:(0,Y.jsx)(u.div,{...i,ref:p,style:{boxSizing:`border-box`,maxHeight:`100%`,...i.style}})})})});pi.displayName=fi;var mi=`SelectPopperPosition`,hi=J.forwardRef((e,t)=>{let{__scopeSelect:n,align:r=`start`,collisionPadding:i=$,...a}=e,o=Gr(n);return(0,Y.jsx)(In,{...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=J.forwardRef((e,t)=>{let{__scopeSelect:n,nonce:r,...i}=e,a=ci(vi,n),o=_i(vi,n),s=y(t,a.onViewportChange),l=J.useRef(0);return(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.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:r}),(0,Y.jsx)(Br.Slot,{scope:n,children:(0,Y.jsx)(u.div,{"data-radix-select-viewport":``,role:`presentation`,...i,ref:s,style:{position:`relative`,flex:1,overflow:`hidden auto`,...i.style},onScroll:c(i.onScroll,e=>{let t=e.currentTarget,{contentWrapper:n,shouldExpandOnScrollRef:r}=o;if(r?.current&&n){let e=Math.abs(l.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`)}}}l.current=t.scrollTop})})})]})});yi.displayName=vi;var bi=`SelectGroup`,[xi,Si]=Ur(bi),Ci=J.forwardRef((e,t)=>{let{__scopeSelect:r,...i}=e,a=n();return(0,Y.jsx)(xi,{scope:r,id:a,children:(0,Y.jsx)(u.div,{role:`group`,"aria-labelledby":a,...i,ref:t})})});Ci.displayName=bi;var wi=`SelectLabel`,Ti=J.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e,i=Si(wi,n);return(0,Y.jsx)(u.div,{id:i.id,...r,ref:t})});Ti.displayName=wi;var Ei=`SelectItem`,[Di,Oi]=Ur(Ei),ki=J.forwardRef((e,t)=>{let{__scopeSelect:r,value:i,disabled:a=!1,textValue:o,...s}=e,l=qr(Ei,r),d=ci(Ei,r),f=l.value===i,[p,m]=J.useState(o??``),[h,g]=J.useState(!1),_=y(t,e=>d.itemRefCallback?.(e,i,a)),v=n(),b=J.useRef(`touch`),x=()=>{a||(l.onValueChange(i),l.onOpenChange(!1))};if(i===``)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,Y.jsx)(Di,{scope:r,value:i,disabled:a,textId:v,isSelected:f,onItemTextChange:J.useCallback(e=>{m(t=>t||(e?.textContent??``).trim())},[]),children:(0,Y.jsx)(Br.ItemSlot,{scope:r,value:i,disabled:a,textValue:p,children:(0,Y.jsx)(u.div,{role:`option`,"aria-labelledby":v,"data-highlighted":h?``:void 0,"aria-selected":f&&h,"data-state":f?`checked`:`unchecked`,"aria-disabled":a||void 0,"data-disabled":a?``:void 0,tabIndex:a?void 0:-1,...s,ref:_,onFocus:c(s.onFocus,()=>g(!0)),onBlur:c(s.onBlur,()=>g(!1)),onClick:c(s.onClick,()=>{b.current!==`mouse`&&x()}),onPointerUp:c(s.onPointerUp,()=>{b.current===`mouse`&&x()}),onPointerDown:c(s.onPointerDown,e=>{b.current=e.pointerType}),onPointerMove:c(s.onPointerMove,e=>{b.current=e.pointerType,a?d.onItemLeave?.():b.current===`mouse`&&e.currentTarget.focus({preventScroll:!0})}),onPointerLeave:c(s.onPointerLeave,e=>{e.currentTarget===document.activeElement&&d.onItemLeave?.()}),onKeyDown:c(s.onKeyDown,e=>{d.searchRef?.current!==``&&e.key===` `||(Rr.includes(e.key)&&x(),e.key===` `&&e.preventDefault())})})})})});ki.displayName=Ei;var Ai=`SelectItemText`,ji=J.forwardRef((e,t)=>{let{__scopeSelect:n,className:r,style:i,...a}=e,o=qr(Ai,n),s=ci(Ai,n),c=Oi(Ai,n),l=Yr(Ai,n),[d,f]=J.useState(null),p=y(t,e=>f(e),c.onItemTextChange,e=>s.itemTextRefCallback?.(e,c.value,c.disabled)),m=d?.textContent,h=J.useMemo(()=>(0,Y.jsx)(`option`,{value:c.value,disabled:c.disabled,children:m},c.value),[c.disabled,c.value,m]),{onNativeOptionAdd:g,onNativeOptionRemove:_}=l;return C(()=>(g(h),()=>_(h)),[g,_,h]),(0,Y.jsxs)(Y.Fragment,{children:[(0,Y.jsx)(u.span,{id:c.textId,...a,ref:p}),c.isSelected&&o.valueNode&&!o.valueNodeHasChildren?Xt.createPortal(a.children,o.valueNode):null]})});ji.displayName=Ai;var Mi=`SelectItemIndicator`,Ni=J.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return Oi(Mi,n).isSelected?(0,Y.jsx)(u.span,{"aria-hidden":!0,...r,ref:t}):null});Ni.displayName=Mi;var Pi=`SelectScrollUpButton`,Fi=J.forwardRef((e,t)=>{let n=ci(Pi,e.__scopeSelect),r=_i(Pi,e.__scopeSelect),[i,a]=J.useState(!1),o=y(t,r.onScrollButtonChange);return C(()=>{if(n.viewport&&n.isPositioned){let e=function(){a(t.scrollTop>0)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,Y.jsx)(Ri,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop-=t.offsetHeight)}}):null});Fi.displayName=Pi;var Ii=`SelectScrollDownButton`,Li=J.forwardRef((e,t)=>{let n=ci(Ii,e.__scopeSelect),r=_i(Ii,e.__scopeSelect),[i,a]=J.useState(!1),o=y(t,r.onScrollButtonChange);return C(()=>{if(n.viewport&&n.isPositioned){let e=function(){let e=t.scrollHeight-t.clientHeight;a(Math.ceil(t.scrollTop)<e)},t=n.viewport;return e(),t.addEventListener(`scroll`,e),()=>t.removeEventListener(`scroll`,e)}},[n.viewport,n.isPositioned]),i?(0,Y.jsx)(Ri,{...e,ref:o,onAutoScroll:()=>{let{viewport:e,selectedItem:t}=n;e&&t&&(e.scrollTop+=t.offsetHeight)}}):null});Li.displayName=Ii;var Ri=J.forwardRef((e,t)=>{let{__scopeSelect:n,onAutoScroll:r,...i}=e,a=ci(`SelectScrollButton`,n),o=J.useRef(null),s=Vr(n),l=J.useCallback(()=>{o.current!==null&&(window.clearInterval(o.current),o.current=null)},[]);return J.useEffect(()=>()=>l(),[l]),C(()=>{s().find(e=>e.ref.current===document.activeElement)?.ref.current?.scrollIntoView({block:`nearest`})},[s]),(0,Y.jsx)(u.div,{"aria-hidden":!0,...i,ref:t,style:{flexShrink:0,...i.style},onPointerDown:c(i.onPointerDown,()=>{o.current===null&&(o.current=window.setInterval(r,50))}),onPointerMove:c(i.onPointerMove,()=>{a.onItemLeave?.(),o.current===null&&(o.current=window.setInterval(r,50))}),onPointerLeave:c(i.onPointerLeave,()=>{l()})})}),zi=`SelectSeparator`,Bi=J.forwardRef((e,t)=>{let{__scopeSelect:n,...r}=e;return(0,Y.jsx)(u.div,{"aria-hidden":!0,...r,ref:t})});Bi.displayName=zi;var Vi=`SelectArrow`,Hi=J.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,Y.jsx)(Ln,{...i,...r,ref:t}):null});Hi.displayName=Vi;var Ui=`SelectBubbleInput`,Wi=J.forwardRef(({__scopeSelect:e,value:t,...n},r)=>{let i=J.useRef(null),a=y(r,i),o=Ar(t);return J.useEffect(()=>{let e=i.current;if(!e)return;let n=window.HTMLSelectElement.prototype,r=Object.getOwnPropertyDescriptor(n,`value`).set;if(o!==t&&r){let n=new Event(`change`,{bubbles:!0});r.call(e,t),e.dispatchEvent(n)}},[o,t]),(0,Y.jsx)(u.select,{...n,style:{...Rn,...n.style},ref:a,defaultValue:t})});Wi.displayName=Ui;function Gi(e){return e===``||e===void 0}function Ki(e){let t=b(e),n=J.useRef(``),r=J.useRef(0),i=J.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=J.useCallback(()=>{n.current=``,window.clearTimeout(r.current)},[]);return J.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=J.forwardRef((e,n)=>{let r=(0,X.c)(12),a,o,s;r[0]===e?(a=r[1],o=r[2],s=r[3]):({className:o,children:a,...s}=e,r[0]=e,r[1]=a,r[2]=o,r[3]=s);let c;r[4]===o?c=r[5]:(c=t(`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`,o),r[4]=o,r[5]=c);let l;r[6]===Symbol.for(`react.memo_cache_sentinel`)?(l=(0,Y.jsx)(Qi,{asChild:!0,children:(0,Y.jsx)(i,{className:`h-4 w-4 opacity-50`})}),r[6]=l):l=r[6];let u;return r[7]!==a||r[8]!==s||r[9]!==n||r[10]!==c?(u=(0,Y.jsxs)(Xi,{ref:n,className:c,...s,children:[a,l]}),r[7]=a,r[8]=s,r[9]=n,r[10]=c,r[11]=u):u=r[11],u});da.displayName=Xi.displayName;var fa=J.forwardRef((e,n)=>{let r=(0,X.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=t(`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,Y.jsx)(D,{className:`h-4 w-4`}),r[5]=s):s=r[5];let c;return r[6]!==a||r[7]!==n||r[8]!==o?(c=(0,Y.jsx)(oa,{ref:n,className:o,...a,children:s}),r[6]=a,r[7]=n,r[8]=o,r[9]=c):c=r[9],c});fa.displayName=oa.displayName;var pa=J.forwardRef((e,n)=>{let r=(0,X.c)(10),a,o;r[0]===e?(a=r[1],o=r[2]):({className:a,...o}=e,r[0]=e,r[1]=a,r[2]=o);let s;r[3]===a?s=r[4]:(s=t(`flex cursor-default items-center justify-center py-1`,a),r[3]=a,r[4]=s);let c;r[5]===Symbol.for(`react.memo_cache_sentinel`)?(c=(0,Y.jsx)(i,{className:`h-4 w-4`}),r[5]=c):c=r[5];let l;return r[6]!==o||r[7]!==n||r[8]!==s?(l=(0,Y.jsx)(sa,{ref:n,className:s,...o,children:c}),r[6]=o,r[7]=n,r[8]=s,r[9]=l):l=r[9],l});pa.displayName=sa.displayName;var ma=J.forwardRef((e,n)=>{let r=(0,X.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=t(`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,Y.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=t(`p-1`,f),r[9]=f,r[10]=p);let m;r[11]!==i||r[12]!==p?(m=(0,Y.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,Y.jsx)(pa,{}),r[14]=h):h=r[14];let g;return r[15]!==c||r[16]!==o||r[17]!==n||r[18]!==u||r[19]!==m?(g=(0,Y.jsx)($i,{children:(0,Y.jsxs)(ea,{ref:n,className:u,position:c,...o,children:[d,m,h]})}),r[15]=c,r[16]=o,r[17]=n,r[18]=u,r[19]=m,r[20]=g):g=r[20],g});ma.displayName=ea.displayName;var ha=J.forwardRef((e,n)=>{let r=(0,X.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=t(`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]!==n||r[7]!==o?(s=(0,Y.jsx)(na,{ref:n,className:o,...a}),r[5]=a,r[6]=n,r[7]=o,r[8]=s):s=r[8],s});ha.displayName=na.displayName;var ga=J.forwardRef((e,n)=>{let r=(0,X.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=t(`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,Y.jsx)(`span`,{className:`absolute left-2 flex h-3.5 w-3.5 items-center justify-center`,children:(0,Y.jsx)(aa,{children:(0,Y.jsx)(F,{className:`h-4 w-4`})})}),r[6]=c):c=r[6];let l;r[7]===i?l=r[8]:(l=(0,Y.jsx)(ia,{children:i}),r[7]=i,r[8]=l);let u;return r[9]!==o||r[10]!==n||r[11]!==s||r[12]!==l?(u=(0,Y.jsxs)(ra,{ref:n,className:s,...o,children:[c,l]}),r[9]=o,r[10]=n,r[11]=s,r[12]=l,r[13]=u):u=r[13],u});ga.displayName=ra.displayName;var _a=J.forwardRef((e,n)=>{let r=(0,X.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=t(`-mx-1 my-1 h-px bg-muted`,i),r[3]=i,r[4]=o);let s;return r[5]!==a||r[6]!==n||r[7]!==o?(s=(0,Y.jsx)(ca,{ref:n,className:o,...a}),r[5]=a,r[6]=n,r[7]=o,r[8]=s):s=r[8],s});_a.displayName=ca.displayName;var va=`__ALL_PROJECTS__`;function ya(e){let t=(0,X.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,Y.jsx)(Y.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,Y.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,Y.jsxs)(Y.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 ee(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()}}function Sa({isOpen:e,onClose:t,initialFilter:n,projects:r}){let[i,a]=(0,J.useState)(null),[o,s]=(0,J.useState)(!1),[c,l]=(0,J.useState)(null),[u,d]=(0,J.useState)(0),[p,m]=(0,J.useState)(``),[h,g]=(0,J.useState)(``),_=(0,J.useCallback)(async e=>{s(!0),l(null);try{a(await ee(e))}catch(e){l(e instanceof Error?e.message:`Failed to load conversation history`)}finally{s(!1)}},[]),y=(0,J.useCallback)(async e=>{if(e){s(!0),l(null);try{let t=r.find(t=>t.projectId===e);if(!t||t.threads.length===0){a({threadId:e,messages:[],lastUpdated:new Date().toISOString(),conversationIds:[]});return}a({threadId:e,...await xa(t.threads)})}catch(e){l(e instanceof Error?e.message:`Failed to load project history`)}finally{s(!1)}}},[r]),b=(0,J.useCallback)(async()=>{s(!0),l(null);try{a({threadId:va,...await xa(r.flatMap(e=>e.threads))})}catch(e){l(e instanceof Error?e.message:`Failed to load all projects history`)}finally{s(!1)}},[r]);(0,J.useEffect)(()=>{e&&n?n.type===`thread`?(g(n.id),m(``),d(0),_(n.id)):n.type===`project`&&(m(n.id),g(``),d(0),y(n.id)):e||(a(null),g(``),m(``),d(0),l(null))},[e,n,_,y]);let S=e=>{g(e),m(``),d(0),_(e)},C=e=>{m(e),g(``),d(0),e===va?b():y(e)},w=e=>new Date(e).toLocaleString(),T=(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}},D=e=>({inputTokens:e.inputTokens??0,outputTokens:e.outputTokens??0});return e?(0,Y.jsx)(`div`,{className:`fixed inset-0 z-50 bg-background`,children:(0,Y.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center justify-between border-b p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-4`,children:[(0,Y.jsx)(`h2`,{className:`text-lg font-semibold`,children:`Conversation History`}),n?.type===`thread`&&(0,Y.jsxs)(la,{value:h,onValueChange:S,children:[(0,Y.jsx)(da,{className:`w-48`,children:(0,Y.jsx)(ua,{placeholder:`Select thread`})}),(0,Y.jsx)(ma,{children:r.flatMap(e=>e.threads.map(t=>(0,Y.jsx)(ga,{value:t.threadId,children:ba(t,e.name??e.projectId)},t.threadId)))})]}),(0,Y.jsxs)(la,{value:p,onValueChange:C,children:[(0,Y.jsx)(da,{className:`w-48`,children:(0,Y.jsx)(ua,{placeholder:`Select project`})}),(0,Y.jsxs)(ma,{children:[(0,Y.jsx)(ga,{value:va,children:`All Projects`}),r.map(e=>(0,Y.jsx)(ga,{value:e.projectId,children:e.name??e.projectId},e.projectId))]})]})]}),(0,Y.jsx)(f,{variant:`action`,size:`icon-sm`,onClick:t,children:(0,Y.jsx)(N,{})})]}),i?.messages.length&&i.messages.length>0&&(0,Y.jsxs)(`div`,{className:`flex items-center justify-between border-b p-4`,children:[(0,Y.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Y.jsx)(f,{variant:`outline`,size:`sm`,onClick:()=>{u>0&&d(u-1)},disabled:u===0,children:(0,Y.jsx)(x,{className:`h-4 w-4 mr-1`})}),(0,Y.jsx)(f,{variant:`outline`,size:`sm`,onClick:()=>{i?.messages&&u<i.messages.length-1&&d(u+1)},disabled:!i||u>=i.messages.length-1,children:(0,Y.jsx)(re,{className:`h-4 w-4 ml-1`})})]}),(0,Y.jsxs)(`div`,{className:`text-sm text-muted-foreground`,children:[u+1,` of `,i?.messages.length??0,` messages`]})]}),(0,Y.jsx)(`div`,{className:`flex-1 overflow-hidden`,children:o?(0,Y.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Y.jsxs)(`div`,{className:`text-center`,children:[(0,Y.jsx)(O,{className:`h-8 w-8 animate-spin mx-auto mb-2`}),(0,Y.jsx)(`p`,{children:`Loading conversation history...`})]})}):c?(0,Y.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Y.jsxs)(k,{className:`max-w-md`,children:[(0,Y.jsx)(M,{children:(0,Y.jsx)(P,{className:`text-destructive`,children:`Error`})}),(0,Y.jsxs)(E,{children:[(0,Y.jsx)(`p`,{children:c}),(0,Y.jsx)(f,{onClick:t,className:`mt-4`,children:`Close`})]})]})}):i?.messages?.length&&i.messages.length>0?(0,Y.jsx)(v,{className:`h-full`,children:(0,Y.jsx)(`div`,{className:`p-4`,children:(0,Y.jsxs)(jr,{children:[(0,Y.jsx)(Mr,{children:(0,Y.jsxs)(Fr,{children:[(0,Y.jsx)(Z,{children:`Prompt`}),(0,Y.jsx)(Z,{children:`Answer`}),(0,Y.jsx)(Z,{className:`w-24`,children:`Model`}),(0,Y.jsx)(Z,{className:`w-24 text-right`,children:`Duration`}),(0,Y.jsx)(Z,{className:`w-20 text-right`,children:`Input Tokens`}),(0,Y.jsx)(Z,{className:`w-20 text-right`,children:`Output Tokens`}),(0,Y.jsx)(Z,{className:`w-32 text-right`,children:`Timestamp`})]})}),(0,Y.jsx)(Nr,{children:i.messages.map((e,t)=>{let{inputTokens:n,outputTokens:r}=D(e);return(0,Y.jsxs)(Fr,{className:t===u?`bg-muted/50`:``,children:[(0,Y.jsx)(Q,{className:`max-w-md`,children:(0,Y.jsx)(`div`,{className:`text-sm`,children:(0,Y.jsx)(ya,{text:e.request.message})})}),(0,Y.jsx)(Q,{className:`max-w-md`,children:e.response?(0,Y.jsx)(`div`,{className:`text-sm`,children:(0,Y.jsx)(ya,{text:e.response.content})}):(0,Y.jsx)(`span`,{className:`text-muted-foreground italic`,children:`No response`})}),(0,Y.jsx)(Q,{className:`text-sm`,children:(0,Y.jsxs)(`div`,{className:`flex items-center gap-1`,children:[(0,Y.jsx)(te,{className:`h-3 w-3 text-muted-foreground`}),(0,Y.jsx)(`span`,{className:`text-muted-foreground`,children:e.request.model})]})}),(0,Y.jsx)(Q,{className:`text-sm text-right`,children:e.response?(0,Y.jsx)(Er,{children:(0,Y.jsxs)(Dr,{children:[(0,Y.jsx)(Or,{asChild:!0,children:(0,Y.jsx)(`div`,{className:`cursor-help`,children:T(e.timestamp,e.response.completedAt).display})}),(0,Y.jsx)(kr,{children:(0,Y.jsx)(`p`,{children:T(e.timestamp,e.response.completedAt).tooltip})})]})}):(0,Y.jsx)(`span`,{className:`text-muted-foreground italic`,children:`-`})}),(0,Y.jsx)(Q,{className:`text-sm text-muted-foreground text-right`,children:n>0?n.toLocaleString():`-`}),(0,Y.jsx)(Q,{className:`text-sm text-muted-foreground text-right`,children:r>0?r.toLocaleString():`-`}),(0,Y.jsx)(Q,{className:`text-sm text-muted-foreground text-right`,children:w(e.timestamp)})]},e.id)})})]})})}):(0,Y.jsx)(`div`,{className:`flex h-full items-center justify-center`,children:(0,Y.jsxs)(k,{className:`max-w-md`,children:[(0,Y.jsx)(M,{children:(0,Y.jsx)(P,{children:`No History`})}),(0,Y.jsxs)(E,{children:[(0,Y.jsx)(`p`,{children:`No conversation history found for this thread.`}),(0,Y.jsx)(f,{onClick:t,className:`mt-4`,children:`Close`})]})]})})})]})}):null}export{hn as _,da as a,kr as c,Bn as d,Fn as f,vn as g,Pn as h,ga as i,Er as l,In as m,la as n,Ar as o,Ln as p,ma as r,Dr as s,Sa as t,Or as u};