1"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[99335],{1582:(e,t,s)=>{s.d(t,{di:()=>n,SL:()=>i,$b:()=>r,Bv:()=>o,$L:()=>l});var a=s(29713);let n={claude:[{value:"claude-opus-4.6",label:"Opus 4.6"},{value:"claude-opus-4-5-20251101",label:"Opus 4.5"},{value:"claude-sonnet-4-5-20250929",label:"Sonnet 4.5"},{value:"claude-haiku-4-5-20251001",label:"Haiku 4.5"},{value:"claude-opus-4-1-20250805",label:"Opus 4.1"},{value:"claude-sonnet-4-20250514",label:"Sonnet 4"}],codex:[{value:"openai/gpt-5.2-codex",label:"GPT-5.2-Codex"},{value:"openai/gpt-5.1",label:"GPT-5.1"},{value:"openai/gpt-5.1-codex",label:"GPT-5.1-Codex"},{value:"openai/gpt-5.1-codex-mini",label:"GPT-5.1-Codex mini"},{value:"openai/gpt-5",label:"GPT-5"},{value:"gpt-5-codex",label:"GPT-5-Codex"},{value:"openai/gpt-5-mini",label:"GPT-5 mini"},{value:"openai/gpt-5-nano",label:"GPT-5 nano"},{value:"gpt-5-pro",label:"GPT-5 pro"},{value:"openai/gpt-4.1",label:"GPT-4.1"}],copilot:[{value:"claude-sonnet-4.5",label:"Sonnet 4.5"},{value:"claude-sonnet-4",label:"Sonnet 4"},{value:"claude-haiku-4.5",label:"Haiku 4.5"},{value:"gpt-5",label:"GPT-5"}],cursor:[{value:"auto",label:"Auto"},{value:"composer-1",label:"Composer"},{value:"sonnet-4.5",label:"Sonnet 4.5"},{value:"sonnet-4.5-thinking",label:"Sonnet 4.5 Thinking"},{value:"gpt-5",label:"GPT-5"},{value:"gpt-5-codex",label:"GPT-5 Codex"},{value:"opus-4.1",label:"Opus 4.1"},{value:"grok",label:"Grok"}],gemini:[{value:"gemini-2.5-pro",label:"Gemini 2.5 Pro"},{value:"gemini-2.5-flash",label:"Gemini 2.5 Flash"},{value:"gemini-3-pro-preview-11-2025",label:"Gemini 3 Pro Preview (Paid)"}],opencode:[{value:"gpt-5",label:"GPT-5"},{value:"gpt-5-mini",label:"GPT-5 mini"},{value:"gpt-5-nano",label:"GPT-5 nano"},{value:"gpt-4.1",label:"GPT-4.1"},{value:"claude-opus-4-5-20251101",label:"Opus 4.5"},{value:"claude-sonnet-4-5-20250929",label:"Sonnet 4.5"},{value:"claude-sonnet-4-20250514",label:"Sonnet 4"},{value:"claude-opus-4-1-20250805",label:"Opus 4.1"}]},r={claude:"claude-opus-4.6",codex:"openai/gpt-5.2-codex",copilot:"claude-sonnet-4.5",cursor:"auto",gemini:"gemini-2.5-pro",opencode:"gpt-5"};function l(e,t){if(!e||!t)return t;let s=n[e.toLowerCase()];if(!s)return t;let a=s.find(e=>e.value===t);return a?a.label:t}let i=[{value:"claude",label:"Claude",icon:a.vO},{value:"codex",label:"Codex",icon:a.U1},{value:"copilot",label:"Copilot",icon:a.TA},{value:"cursor",label:"Cursor",icon:a.bs},{value:"gemini",label:"Gemini",icon:a.gU},{value:"opencode",label:"opencode",icon:a.gp}];function o(e){if(!e)return null;switch(e.toLowerCase()){case"claude":return a.vO;case"codex":return a.U1;case"copilot":return a.TA;case"cursor":return a.bs;case"gemini":return a.gU;case"opencode":return a.gp;default:return null}}},4194:(e,t,s)=>{s.d(t,{W:()=>r});var a=s(75393),n=s(465);function r({status:e,className:t="h-3 w-3"}){return"merged"===e?(0,a.jsx)("svg",{className:`${t} flex-shrink-0 text-purple-500`,viewBox:"0 0 16 16",fill:"currentColor",children:(0,a.jsx)("path",{d:"M5 3.254V3.25v.005a.75.75 0 110-.005v.004zm.45 1.9a2.25 2.25 0 10-1.95.218v5.256a2.25 2.25 0 101.5 0V7.123A5.735 5.735 0 009.25 9h1.378a2.251 2.251 0 100-1.5H9.25a4.25 4.25 0 01-3.8-2.346zM12.75 9a.75.75 0 100-1.5.75.75 0 000 1.5zm-8.5 4.5a.75.75 0 100-1.5.75.75 0 000 1.5z"})}):"closed"===e?(0,a.jsx)(n.A,{className:`${t} flex-shrink-0 text-red-500`}):(0,a.jsx)("svg",{className:`${t} flex-shrink-0 text-green-500`,viewBox:"0 0 16 16",fill:"currentColor",children:(0,a.jsx)("path",{d:"M1.5 3.25a2.25 2.25 0 113 2.122v5.256a2.251 2.251 0 11-1.5 0V5.372A2.25 2.25 0 011.5 3.25zm5.677-.177L9.573.677A.25.25 0 0110 .854V2.5h1A2.5 2.5 0 0113.5 5v5.628a2.251 2.251 0 11-1.5 0V5a1 1 0 00-1-1h-1v1.646a.25.25 0 01-.427.177L7.177 3.427a.25.25 0 010-.354zM3.75 2.5a.75.75 0 100 1.5.75.75 0 000-1.5zm0 9.5a.75.75 0 100 1.5.75.75 0 000-1.5zm8.25.75a.75.75 0 101.5 0 .75.75 0 00-1.5 0z"})})}},8281:(e,t,s)=>{s.d(t,{$:()=>l});var a=s(75393),n=s(78661),r=s(52483);function l({taskId:e,prStatus:t,isActive:s=!1,className:i=""}
1){let[o,c]=(0,n.useState)([]),[d,u]=(0,n.useState)(!0);if((0,n.useEffect)(()=>{let t=async()=>{try{let t=await fetch(`/api/tasks/${e}/check-runs`);if(t.ok){let e=await t.json();e.success&&e.checkRuns&&c(e.checkRuns)}}catch(e){console.error("Error fetching check runs:",e)}finally{u(!1)}};t();let s=setInterval(t,3e4);return()=>clearInterval(s)},[e]),"open"!==t||d||0===o.length)return null;let m=o.some(e=>"in_progress"===e.status||"queued"===e.status),x=o.some(e=>"failure"===e.conclusion||"cancelled"===e.conclusion),h=o.some(e=>"neutral"===e.conclusion),p=o.every(e=>"completed"===e.status&&"success"===e.conclusion),f=s?"bg-accent":"bg-card";return x?(0,a.jsx)("div",{className:`absolute -bottom-0.5 -right-0.5 ${f} rounded-full p-0.5 ${i}`,children:(0,a.jsx)("div",{className:"w-1 h-1 rounded-full bg-red-500"})}):m?(0,a.jsx)("div",{className:`absolute -bottom-0.5 -right-0.5 ${f} rounded-full p-0.5 ${i}`,children:(0,a.jsx)("div",{className:"w-1 h-1 rounded-full bg-yellow-500 animate-pulse"})}):h?(0,a.jsx)("div",{className:`absolute -bottom-0.5 -right-0.5 ${f} rounded-full p-0.5 ${i}`,children:(0,a.jsx)("div",{className:"w-1 h-1 rounded-full bg-blue-500"})}):p?(0,a.jsx)("div",{className:`absolute -bottom-0.5 -right-0.5 ${f} rounded-full p-0.5 ${i}`,children:(0,a.jsx)(r.A,{className:"w-1.5 h-1.5 text-green-500",strokeWidth:3})}):null}},29713:(e,t,s)=>{s.d(t,{vO:()=>n,U1:()=>r,TA:()=>l,bs:()=>i,gU:()=>c,gp:()=>d});var a=s(75393);s(78661);let n=e=>(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",preserveAspectRatio:"xMidYMid",viewBox:"0 0 256 257",...e,children:(0,a.jsx)("path",{fill:"#D97757",d:"m50.228 170.321 50.357-28.257.843-2.463-.843-1.361h-2.462l-8.426-.518-28.775-.778-24.952-1.037-24.175-1.296-6.092-1.297L0 125.796l.583-3.759 5.12-3.434 7.324.648 16.202 1.101 24.304 1.685 17.629 1.037 26.118 2.722h4.148l.583-1.685-1.426-1.037-1.101-1.037-25.147-17.045-27.22-18.017-14.258-10.37-7.713-5.25-3.888-4.925-1.685-10.758 7-7.713 9.397.649 2.398.648 9.527 7.323 20.35 15.75L94.817 91.9l3.889 3.24 1.555-1.102.195-.777-1.75-2.917-14.453-26.118-15.425-26.572-6.87-11.018-1.814-6.61c-.648-2.723-1.102-4.991-1.102-7.778l7.972-10.823L71.42 0 82.05 1.426l4.472 3.888 6.61 15.101 10.694 23.786 16.591 32.34 4.861 9.592 2.592 8.879.973 2.722h1.685v-1.556l1.36-18.211 2.528-22.36 2.463-28.776.843-8.1 4.018-9.722 7.971-5.25 6.222 2.981 5.12 7.324-.713 4.73-3.046 19.768-5.962 30.98-3.889 20.739h2.268l2.593-2.593 10.499-13.934 17.628-22.036 7.778-8.749 9.073-9.657 5.833-4.601h11.018l8.1 12.055-3.628 12.443-11.342 14.388-9.398 12.184-13.48 18.147-8.426 14.518.778 1.166 2.01-.194 30.46-6.481 16.462-2.982 19.637-3.37 8.88 4.148.971 4.213-3.5 8.62-20.998 5.184-24.628 4.926-36.682 8.685-.454.324.519.648 16.526 1.555 7.065.389h17.304l32.21 2.398 8.426 5.574 5.055 6.805-.843 5.184-12.962 6.611-17.498-4.148-40.83-9.721-14-3.5h-1.944v1.167l11.666 11.406 21.387 19.314 26.767 24.887 1.36 6.157-3.434 4.86-3.63-.518-23.526-17.693-9.073-7.972-20.545-17.304h-1.36v1.814l4.73 6.935 25.017 37.59 1.296 11.536-1.814 3.76-6.481 2.268-7.13-1.297-14.647-20.544-15.1-23.138-12.185-20.739-1.49.843-7.194 77.448-3.37 3.953-7.778 2.981-6.48-4.925-3.436-7.972 3.435-15.749 4.148-20.544 3.37-16.333 3.046-20.285 1.815-6.74-.13-.454-1.49.194-15.295 20.999-23.267 31.433-18.406 19.702-4.407 1.75-7.648-3.954.713-7.064 4.277-6.286 25.47-32.405 15.36-20.092 9.917-11.6-.065-1.686h-.583L44.07 198.125l-12.055 1.555-5.185-4.86.648-7.972 2.463-2.593 20.35-13.999-.064.065Z"})}),r=e=>(0,a.jsx)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",preserveAspectRatio:"xMidYMid",viewBox:"0 0 256 260",...e,children:(0,a.jsx)("path",{fill:"currentColor",d:"M239.184 106.203a64.716 64.716 0 0 0-5.576-53.103C219.452 28.459 191 15.784 163.213 21.74A65.586 65.586 0 0 0 52.096 45.22a64.716 64.716 0 0 0-43.23 31.36c-14.31 24.602-11.061 55.634 8.033 76.74a64.665 64.665 0 0 0 5.525 53.102c14.174 24.65 42.644 37.324 70.446 31.36a64.72 64.72 0 0 0 48.754 21.744c28.481.025 53.714-18.361 62.414-45.481a64.767 64.767 0 0 0 43.229-31.36c14.137-24.558 10.875-55.423-8.083-76.483Zm-97.56 136.338a48.397 48.397 0 0 1-31.105-11.255l1.535-.87 51.67-29.825a8.595 8.595 0 0 0 4.247-7.367v-72.85l21.845 12.636c.218.111.37.32.409.563v60.367c-.056 26.818-21.783 48.545-48.601 48.601Zm-104.466-44.61a48.345 48.345 0 0 1-5.781-32.589l1.534.921 51.722 29.826a8.339 8.339 0 0 0 8.441 0l63.181-36.425v25.221a.87.87 0 0 1-.358.665l-52.335 30.184c-23.257 13.398-52.97 5.431-66.404-17.803ZM23.549 85.38a48.499 48.499 0 0 1 25.58-21.333v61.39a8.288 8.288 0 0 0 4.195 7.316l62.874 36.272-21.845 12.636a.819.819 0 0 1-.767 0L41.353 151.53c-23.211-13.454-31.171-43.144-17.804-66.405v.256Zm179.466 41.695-63.08-36.63L161.73 77.86a.819.819 0 0 1 .768 0l52.233 30.184a48.6 48.6 0 0 1-7.316 87.635v-61.391a8.544 8.544 0 0 0-4.4-7.213Zm21.742-32.69-1.535-.922-51.619-30.081a8.39 8.39 0 0 0-8.492 0L99.98 99.808V74.587a.716.716 0 0 1 .307-.665l52.233-30.133a48.652 48.652 0 0 1 72.236 50.391v.205ZM88.061 139.097l-21.845-12.585a.87.87 0 0 1-.41-.614V65.685a48.652 48.652 0 0 1 79.757-37.346l-1.535.87-51.67 29.825a8.595 8.595 0 0 0-4.246 7.367l-.051 72.697Zm11.868-25.58 28.138-16.217 28.188 16.218v32.434l-28.086 16.218-28.188-16.218-.052-32.434Z"})}),l=e=>(0,a.jsxs)("svg",{xmlns:"http://www.w3.org/2000/svg",width:"1em",height:"1em",viewBox:"0 0 24 24",fill:"rgb(210, 168, 255)",...e,children:[(0,a.jsx)("path",{d:"M23.922 16.992c-.861 1.495-5.859 5.
1023-11.922 5.023-6.063 0-11.061-3.528-11.922-5.023A.641.641 0 0 1 0 16.736v-2.869a.841.841 0 0 1 .053-.22c.372-.935 1.347-2.292 2.605-2.656.167-.429.414-1.055.644-1.517a10.195 10.195 0 0 1-.052-1.086c0-1.331.282-2.499 1.132-3.368.397-.406.89-.717 1.474-.952 1.399-1.136 3.392-2.093 6.122-2.093 2.731 0 4.767.957 6.166 2.093.584.235 1.077.546 1.474.952.85.869 1.132 2.037 1.132 3.368 0 .368-.014.733-.052 1.086.23.462.477 1.088.644 1.517 1.258.364 2.233 1.721 2.605 2.656a.832.832 0 0 1 .053.22v2.869a.641.641 0 0 1-.078.256ZM12.172 11h-.344a4.323 4.323 0 0 1-.355.508C10.703 12.455 9.555 13 7.965 13c-1.725 0-2.989-.359-3.782-1.259a2.005 2.005 0 0 1-.085-.104L4 11.741v6.585c1.435.779 4.514 2.179 8 2.179 3.486 0 6.565-1.4 8-2.179v-6.585l-.098-.104s-.033.045-.085.104c-.793.9-2.057 1.259-3.782 1.259-1.59 0-2.738-.545-3.508-1.492a4.323 4.323 0 0 1-.355-.508h-.016.016Zm.641-2.935c.136 1.057.403 1.913.878 2.497.442.544 1.134.938 2.344.938 1.573 0 2.292-.337 2.657-.751.384-.435.558-1.15.558-2.361 0-1.14-.243-1.847-.705-2.319-.477-.488-1.319-.862-2.824-1.025-1.487-.161-2.192.138-2.533.529-.269.307-.437.808-.438 1.578v.021c0 .265.021.562.063.893Zm-1.626 0c.042-.331.063-.628.063-.894v-.02c-.001-.77-.169-1.271-.438-1.578-.341-.391-1.046-.69-2.533-.529-1.505.163-2.347.537-2.824 1.025-.462.472-.705 1.179-.705 2.319 0 1.211.175 1.926.558 2.361.365.414 1.084.751 2.657.751 1.21 0 1.902-.394 2.344-.938.475-.584.742-1.44.878-2.497Z"}),(0,a.jsx)("path",{d:"M14.5 14.25a1 1 0 0 1 1 1v2a1 1 0 0 1-2 0v-2a1 1 0 0 1 1-1Zm-5 0a1 1 0 0 1 1 1v2a1 1 0 0 1-2 0v-2a1 1 0 0 1 1-1Z"})]}),i=e=>(0,a.jsxs)("svg",{height:"1em",style:{flex:"none",lineHeight:1},viewBox:"0 0 466.73 532.09",width:"1em",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,a.jsx)("title",{children:"Cursor"}),(0,a.jsx)("path",{className:"fill-[#26251e] dark:fill-[#edecec]",d:"M457.43,125.94L244.42,2.96c-6.84-3.95-15.28-3.95-22.12,0L9.3,125.94c-5.75,3.32-9.3,9.46-9.3,16.11v247.99c0,6.65,3.55,12.79,9.3,16.11l213.01,122.98c6.84,3.95,15.28,3.95,22.12,0l213.01-122.98c5.75-3.32,9.3-9.46,9.3-16.11v-247.99c0-6.65-3.55-12.79-9.3-16.11h-.01ZM444.05,151.99l-205.63,356.16c-1.39,2.4-5.06,1.42-5.06-1.36v-233.21c0-4.66-2.49-8.97-6.53-11.31L24.87,145.67c-2.4-1.39-1.42-5.06,1.36-5.06h411.26c5.84,0,9.49,6.33,6.57,11.39h-.01Z"})]});var o=s(61314);let c=({className:e="w-6 h-6",width:t=24,height:s=24})=>(0,a.jsx)(o.default,{src:"/logos/gemini.svg",alt:"Gemini",width:t,height:s,className:e}),d=e=>(0,a.jsxs)("svg",{width:"1em",height:"1em",viewBox:"0 0 600 600",fill:"none",xmlns:"http://www.w3.org/2000/svg",...e,children:[(0,a.jsx)("rect",{width:"600",height:"600",fill:"black"}),(0,a.jsx)("path",{fillRule:"evenodd",clipRule:"evenodd",d:"M115 180H300V420H115V180ZM253.75 229.044H161.25V370.405H253.75V229.044Z",fill:"white"}),(0,a.jsx)("path",{d:"M346.25 180H485V229.044H392.5V370.405H485V419.449H346.25V180Z",fill:"white"})]})},29849:(e,t,s)=>{s.d(t,{M5:()=>c,ef:()=>o,em:()=>r,y9:()=>i,z$:()=>l});var a=s(32938),n=s(36680);let r=(0,a.eU)(!1);(0,a.eU)(null),(0,a.eU)(null),(0,a.eU)(null);let l=(0,n.tG)("create-task-last-project-id",null),i=(0,n.tG)("create-task-last-repo-owner",null),o=(0,n.tG)("create-task-last-repo-name",null),c=(0,a.eU)(null)},52616:(e,t,s)=>{s.d(t,{$M:()=>o,Zt:()=>n,cR:()=>i,hU:()=>r,xZ:()=>l});var a=s(68914);function n(e,t={}){let s=(0,a.U)().channel(`team:${e}`,{config:{presence:{key:e}}});return t.onTaskChange&&s.on("postgres_changes",{event:"*",schema:"public",table:"tasks",filter:`team_id=eq.${e}`},t.onTaskChange),t.onActivityChange&&s.on("postgres_changes",{event:"INSERT",schema:"public",table:"team_activity_log",filter:`team_id=eq.${e}`},t.onActivityChange),t.onMemberChange&&s.on("postgres_changes",{event:"*",schema:"public",table:"team_members",filter:`team_id=eq.${e}`},t.onMemberChange),t.onPresenceSync&&s.on("presence",{event:"sync"},()=>{let e=s.presenceState();t.onPresenceSync(e)}),t.onPresenceJoin&&s.on("presence",{event:"join"},e=>{t.onPresenceJoin(e.key,e.currentPresences,e.newPresences)}),t.onPresenceLeave&&s.on("presence",{event:"leave"},e=>{t.onPresenceLeave(e.key,e.currentPresences,e.leftPresences)}),s}async function r(e,t){await e.track({online_at:new Date().toISOString(),userId:t.userId,username:t.username,status:t.status||"online"})}async function l(e,t){await e.track({online_at:new Date().toISOString(),userId:t.userId,username:t.username,status:t.status})}async function i(e){let t=(0,a.U)();await t.removeChannel(e)}function o(e,t,s){let n=(0,a.U)(),r=function(e,t={}){let s=(0,a.U)().channel(`task:${e}`);return s.on("postgres_changes",{event:"UPDATE",schema:"public",table:"tasks",filter:`id=eq.${e}`},e=>{if(t.onTaskUpdate&&e.new){var s;((s=e.new)&&"object"==typeof s?"string"!=typeof s.id||"string"!=typeof s.status||"number"!=typeof s.progress||null!==s.error&&"string"!=typeof s.error:1)?(console.error("[Realtime] Invalid task payload received:",e.
1new),t.onError?.(Error("Invalid task payload received from realtime"))):t.onTaskUpdate(e.new)}}),s}(e,{onTaskUpdate:t,onError:s});return r.subscribe(e=>{"SUBSCRIBED"===e?console.log("Subscribed to task updates"):"CHANNEL_ERROR"===e&&(console.error("Error subscribing to task updates"),s?.(Error("Failed to subscribe to task updates")))}),()=>{console.log("Unsubscribing from task updates"),n.removeChannel(r)}}},59804:(e,t,s)=>{s.d(t,{K:()=>d});var a=s(43525),n=s(13071),r=s(17338),l=s(26397);let i={sound:{feedback:!0,completed:!0,error:!0},browser:{feedback:!0,completed:!0,error:!0},toast:{feedback:!0,completed:!0,error:!0}};async function o(){let e=await fetch("/api/user/notification-settings");if(!e.ok){if(401===e.status)return i;throw Error("Failed to fetch notification settings")}return(await e.json()).data.preferences}async function c(e){let t=await fetch("/api/user/notification-settings",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify(e)});if(!t.ok){let e=await t.json();throw Error(e.error?.message||"Failed to update notification settings")}return(await t.json()).data.preferences}function d(){let e=(0,a.jE)(),t=(0,n.I)({queryKey:l.Li.notifications(),queryFn:o,staleTime:3e5,gcTime:18e5}),s=(0,r.n)({mutationFn:c,onMutate:async t=>{await e.cancelQueries({queryKey:l.Li.notifications()});let s=e.getQueryData(l.Li.notifications());if(s){let a={...s};for(let e of["sound","browser","toast"])t[e]&&(a[e]={...a[e],...t[e]});e.setQueryData(l.Li.notifications(),a)}return{previousSettings:s}},onError:(t,s,a)=>{a?.previousSettings&&e.setQueryData(l.Li.notifications(),a.previousSettings)},onSettled:()=>{e.invalidateQueries({queryKey:l.Li.notifications()})}});return{preferences:t.isLoading?void 0:t.data??i,isLoading:t.isLoading,isError:t.isError,error:t.error,refetch:t.refetch,updateSetting:(e,t,a)=>{s.mutate({[e]:{[t]:a}})},updateChannel:(e,t)=>{s.mutate({[e]:t})},updateSettings:s.mutate,isUpdating:s.isPending,updateError:s.error}}},69634:(e,t,s)=>{s.d(t,{V:()=>p});var a=s(75393),n=s(73753),r=s(36144),l=s(29500),i=s(87934),o=s(35853),c=s(97277),d=s(73779),u=s(47350);function m(e){if(!e)return"N/A";switch(e.status){case"passed":return"Pass";case"failed":return"Fail";case"error":return"Error";case"timeout":return"Timeout";case"skipped":return"Skipped";default:return"Unknown"}}function x({verdict:e,isRunning:t=!1,reviewResult:s,securityResult:h,testingResult:p,className:f}){if(!(0,u.G)("MASTRA_QUALITY_GATES_ENABLED"))return null;if(t)return(0,a.jsx)(c.Bc,{delayDuration:200,children:(0,a.jsxs)(c.m_,{children:[(0,a.jsx)(c.k$,{asChild:!0,children:(0,a.jsxs)(o.E,{variant:"outline",className:(0,d.cn)("text-blue-600 border-blue-200 dark:text-blue-400 dark:border-blue-800",f),children:[(0,a.jsx)(n.A,{className:"h-3 w-3 animate-spin","aria-hidden":"true"}),(0,a.jsx)("span",{className:"text-[10px]",children:"Running Gates"})]})}),(0,a.jsx)(c.ZI,{side:"bottom",className:"text-xs",children:"Quality gates are currently running..."})]})});if(!e)return null;let g=`Review: ${m(s)} | Security: ${m(h)} | Testing: ${m(p)}`;return"passed"===e?(0,a.jsx)(c.Bc,{delayDuration:200,children:(0,a.jsxs)(c.m_,{children:[(0,a.jsx)(c.k$,{asChild:!0,children:(0,a.jsxs)(o.E,{variant:"outline",className:(0,d.cn)("text-green-600 border-green-200 dark:text-green-400 dark:border-green-800",f),"aria-label":"Quality gates passed",children:[(0,a.jsx)(r.A,{className:"h-3 w-3","aria-hidden":"true"}),(0,a.jsx)("span",{className:"text-[10px]",children:"Gates Passed"})]})}),(0,a.jsx)(c.ZI,{side:"bottom",className:"text-xs",children:g})]})}):"failed"===e?(0,a.jsx)(c.Bc,{delayDuration:200,children:(0,a.jsxs)(c.m_,{children:[(0,a.jsx)(c.k$,{asChild:!0,children:(0,a.jsxs)(o.E,{variant:"outline",className:(0,d.cn)("text-red-600 border-red-200 dark:text-red-400 dark:border-red-800",f),"aria-label":"Quality gates failed",children:[(0,a.jsx)(l.A,{className:"h-3 w-3","aria-hidden":"true"}),(0,a.jsx)("span",{className:"text-[10px]",children:"Gates Failed"})]})}),(0,a.jsx)(c.ZI,{side:"bottom",className:"text-xs",children:g})]})}):(0,a.jsx)(c.Bc,{delayDuration:200,children:(0,a.jsxs)(c.m_,{children:[(0,a.jsx)(c.k$,{asChild:!0,children:(0,a.jsxs)(o.E,{variant:"outline",className:(0,d.cn)("text-amber-600 border-amber-200 dark:text-amber-400 dark:border-amber-800",f),"aria-label":"Quality gates need review",children:[(0,a.jsx)(i.A,{className:"h-3 w-3","aria-hidden":"true"}),(0,a.jsx)("span",{className:"text-[10px]",children:"Review Needed"})]})}),(0,a.jsx)(c.ZI,{side:"bottom",className:"text-xs",children:g})]})})}var h=s(81663);function p({taskId:e,enabled:t=!0,className:s}){return(0,u.G)("MASTRA_QUALITY_GATES_ENABLED")&&t?(0,a.jsx)(f,{taskId:e,className:s}):null}function f({taskId:e,className:t}){let{results:s,isRunning:n}=(0,h.T)(e);return(0,a.jsx)(x,{verdict:s?.overallVerdict,isRunning:n,reviewResult:s?.reviewResult,securityResult:s?.securityResult,testingResult:s?.testingResult,className:t})}},75587:(e,t,s)=>{s.d(t,{Cw:()=>I,FC:()=>j,J4:()=>v,N7:()=>h,Nz:()=>S,OU:()=>D,P:()=>E,RY:()=>T,Z6:()=>f,dF:()=>N,de:()=>$,f_:()=>b,iV:()=>A,lH:()=>y,oy:()=>L,pK:()=>C,po:()=>g,tB:()=>w,tF:()=>k,wg:()=>R,xT:()=>p});var a=s(1667);let n="sidebar-width",r="sidebar-open",l="logs-pane-height",i="logs-pane-collapsed",o="selected-owner",c="selected-repo",d="show-files-pane",u="show-code-pane",m="show-preview-pane",x="show-chat-pane";function h(){let e=a.A.get(n);if(e){let t=parseInt(e,10);if(!isNaN(t)&&t>=200&&t<=600)return t}return 288}function p(e){e>=200&&e<=600&&a.A.set(n,e.toString(),{expires:365,sameSite:"strict"})}function f(){let e=a.A.get(r);return!!e&&"true"===e}function g(e){a.A.set(r,e.toString(),{expires:365,sameSite:"strict"})}function v(){let e=a.A.get(l);if(e){let t=parseInt(e,10);if(!isNaN(t)&&t>=100&&t<=600)return t}return 200}function j(e){e>=100&&e<=600&&a.A.set(l,e.toString(),{expires:365,sameSite:"strict"})}function b(){let e=a.A.get(i);return void 0===e||"true"===e}function w(e){a.A.set(i,e.toString(),{expires:365,sameSite:"strict"})}function k(e){a.A.set("install-dependencies",e.toString(),{expires:365,sameSite:"strict"})}function N(e){e>=1&&e<=300&&a.A.set("max-duration",e.toString(),{expires:365,sameSite:"strict"})}function y(e){a.A.set("keep-alive",e.toString(),{expires:365,sameSite:"strict"})}function C(e){e?a.A.set(o,e,{expires:365,sameSite:"strict"}):a.A.remove(o)}function A(e){e?a.A.set(c,e,{expires:365,sameSite:"strict"}):a.A.remove(c)}function E(){let e=a.A.get(d);return void 0===e||"true"===e}function S(e){a.A.set(d,e.toString(),{expires:365,sameSite:"strict"})}function $(){let e=a.A.get(u);return void 0===e||"true"===e}function T(e){a.A.set(u,e.toString(),{expires:365,sameSite:"strict"})}function I(){let e=a.A.get(m);return void 0!==e&&"true"===e}function D(e){a.A.set(m,e.toString(),{expires:365,sameSite:"strict"})}function L(){let e=a.A.get(x);return void 0===e||"true"===e}function R(e){a.A.set(x,e.toString(),{expires:365,sameSite:"strict"})}},81516:(e,t,s)=>{s.d(t,{n:()=>n,t:()=>r});var a=s(36680);let n=(0,a.tG)("task-prompt",""),r=(0,a.Iz)(e=>(0,a.tG)(`task-chat-input-${e}`,""))},81663:(e,t,s)=>{s.d(t,{T:()=>r});var a=s(78661),n=s(44139);function r(e){let[t,s]=(0,a.useState)(null),[r,l]=(0,a.useState)(!1),[i,o]=(0,a.useState)(!1),[c,d]=(0,a.useState)(null),u=(0,a.useRef)(null),m=(0,a.useRef)(null),x=(0,a.useCallback)(()=>{u.current&&(clearInterval(u.current),u.current=null)},[]),h=(0,a.useCallback)(async t=>{if(e)try{let a=await fetch(`/api/tasks/${e}/quality-gates`,{signal:t});if(!a.ok){if(503===a.status)return;throw Error(`Failed to fetch quality gate results (${a.status})`)}let n=(await a.json()).data;s(n),d(null),n&&i&&(o(!1),x())}catch(e){if(e instanceof DOMException&&"AbortError"===e.name)return;d(e instanceof Error?e.message:"Failed to fetch quality gate results")}},[e,i,x]),p=(0,a.useCallback)(async(t,s)=>{if(!e)return void n.oR.error("No task selected");o(!0),d(null);try{let a=await fetch(`/api/tasks/${e}/quality-gates`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({diff:t,standards:s?.standards,changedFiles:s?.changedFiles,existingTests:s?.existingTests})});if(!a.ok){let e=await a.json().catch(()=>({error:"Unknown error"}));throw Error(e.message||e.error||`Request failed (${a.status})`)}(await a.json()).data&&await h(),o(!1),x(),n.oR.success("Quality gates completed")}catch(t){let e=t instanceof Error?t.message:"Failed to run quality gates";d(e),o(!1),x(),n.oR.error(e)}},[e,h,x]);return(0,a.useEffect)(()=>
1{if(!e)return;let t=new AbortController;return m.current=t,l(!0),h(t.signal).finally(()=>{l(!1)}),()=>{t.abort(),m.current=null}},[e,h]),(0,a.useEffect)(()=>i&&e?(u.current=setInterval(()=>{h()},5e3),()=>{x()}):void x(),[i,e,h,x]),(0,a.useEffect)(()=>()=>{x(),m.current&&m.current.abort()},[x]),{results:t,isLoading:r,isRunning:i,error:c,triggerGates:p}}},83850:(e,t,s)=>{s.d(t,{e:()=>_});var a=s(75393),n=s(78661),r=s(98596),l=s(88974),i=s(75092),o=s(51935),c=s(71286),d=s(35853),u=s(97817),m=s(97277),x=s(80839),h=s(74319),p=s(32714),f=s(71132),g=s(73753),v=s(9256),j=s(1582),b=s(75587),w=s(75275),k=s(14487),N=s(44139),y=s(65586),C=s(81516),A=s(36680);let E=(0,A.tG)("last-selected-agent",null),S=(0,A.Iz)(e=>(0,A.tG)(`last-selected-model-${e}`,null));var $=s(89317),T=s(89315),I=s(49065),D=s(47350),L=s(86106),R=s(61450),P=s(17927);let M=[{value:"multi-agent",label:"Compare",icon:x.A,isLogo:!1},{value:"divider",label:"",icon:()=>null,isLogo:!1,isDivider:!0},...j.SL.map(e=>({...e,isLogo:!0}))],U=["claude-opus-4-5-20251101","claude-sonnet-4-5-20250929"];function _({onSubmit:e,isSubmitting:t,selectedOwner:s,selectedRepo:x,initialInstallDependencies:A=!1,initialMaxDuration:G=300,initialKeepAlive:z=!1,initialEnableSpecDrivenWorkflow:Z=!1,initialEnableClaudeFlow:B=!1,maxSandboxDuration:O=300,hideHeader:F=!1,hideRepoSelector:V=!1,hideVisibilitySelector:W=!1,forceVisibility:q,initialProjectId:J,hideProjectSelector:H=!1,disabled:K=!1}){let Q,X,[Y,ee]=(0,y.fp)(C.n),[et,es]=(0,y.fp)(E),[ea,en]=(0,n.useState)(et||"claude"),[er,el]=(0,n.use
1State)(j.$b.claude),[ei,eo]=(0,n.useState)([]),[ec,ed]=(0,y.fp)((0,$.k)(s)),[,eu]=(0,n.useState)(!1),{currentTeam:em}=(0,I.d)(),ex=(0,D.G)("TEAMS_ENABLED"),eh=ex&&!!em&&!W,[ep,ef]=(0,n.useState)(q||"team"),[eg,ev]=(0,n.useState)([]),[ej,eb]=(0,n.useState)(J??null),[ew,ek]=(0,n.useState)(!1);(0,n.useEffect)(()=>{(async()=>{if(!ex)return ev([]);ek(!0);try{let e="/api/projects";"team"===ep&&em&&(e=`/api/projects?teamId=${em.id}`);let t=await fetch(e);if(t.ok){let e=((await t.json()).data||[]).filter(e=>"active"===e.status||"draft"===e.status);ev(e),e.length>0&&eb(t=>t??e[0].id)}}catch(e){console.error("Failed to fetch projects:",e)}finally{ek(!1)}})()},[ex,em,ep]);let[eN,ey]=(0,n.useState)(A),[eC,eA]=(0,n.useState)(G),[eE,eS]=(0,n.useState)(z),[e$,eT]=(0,n.useState)(Z),[eI,eD]=(0,n.useState)(B),[eL,eR]=(0,n.useState)(!0),[eP,eM]=(0,n.useState)(!1),{connectors:eU}=(0,w.U)(),e_=(0,n.useRef)(null),eG=e=>{ey(e),(0,b.tF)(e)},ez=e=>{eA(e),(0,b.dF)(e)},eZ=e=>{eS(e),(0,b.lH)(e)},eB=(0,T.useSearchParams)();(0,n.useEffect)(()=>{let e=eB?.get("agent"),t=eB?.get("model"),s=eB?.get("projectId");if(e&&M.some(t=>t.value===e&&!("isDivider"in t&&t.isDivider))){if(en(e),t){let s=j.di[e];s?.some(e=>e.value===t)&&el(t)}}else et&&M.some(e=>e.value===et&&!("isDivider"in e&&e.isDivider))&&en(et);s&&eb(s),e_.current&&e_.current.focus()},[]);let eO=S(ea),eF=(0,y.md)(eO),eV=(0,y.Xr)(eO);(0,n.useEffect)(()=>{if(ea){"multi-agent"!==ea&&eo([]);let e=j.di[ea];if(eF&&e?.some(e=>e.value===eF))el(eF);else{let e=j.$b[ea];e&&el(e)}}},[ea,eF]),(0,n.useEffect)(()=>{s?(async()=>{eu(!0);try{if(ec&&ec.length>0)return void eu(!1);let e=await fetch(`/api/github/repos?owner=${s}`);if(e.ok){let t=await e.json();ed(t)}}catch(e){console.error("Error fetching repositories:",e)}finally{eu(!1)}})():ed(null)},[s,ec,ed]);let eW=async t=>{if(t.preventDefault(),!Y.trim())return;if("multi-agent"===ea&&0===ei.length)return void N.oR.error("Please select at least one model for multi-agent mode");if(!s||!x)return void e({prompt:Y.trim(),repoUrl:"",selectedAgent:ea,selectedModel:er,selectedModels:"multi-agent"===ea?ei:void 0,installDependencies:eN,maxDuration:eC,keepAlive:eE,enableSpecDrivenWorkflow:e$,enableClaudeFlow:eI,enableThinking:U.includes(er)&&eL,teamId:eh&&"team"===ep?em?.id:null,projectId:ej,visibility:eh?ep:"personal"});let a=ec?.find(e=>e.name===x);if(a&&"multi-agent"!==ea)try{let e=await fetch(`/api/api-keys/check?agent=${ea}&model=${er}`),t=await e.json();if(!t.hasKey){let e={anthropic:"Anthropic",openai:"OpenAI",cursor:"Cursor",gemini:"Gemini",aigateway:"AI Gateway"}[t.provider]||t.provider;N.oR.error(`${e} API key required`,{description:`Please add your ${e} API key in the user menu to use the ${t.agentName} agent with this model.`});return}}catch(e){console.error("Error checking API key:",e)}e({prompt:Y.trim(),repoUrl:a?.clone_url||"",selectedAgent:ea,selectedModel:er,selectedModels:"multi-agent"===ea?ei:void 0,installDependencies:eN,maxDuration:eC,keepAlive:eE,enableSpecDrivenWorkflow:e$,enableClaudeFlow:eI,enableThinking:U.includes(er)&&eL,teamId:eh&&"team"===ep?em?.id:null,projectId:ej,visibility:eh?ep:"personal"})};return(0,a.jsxs)("div",{className:F?"w-full":"w-full max-w-3xl",children:[!F&&(0,a.jsxs)("div",{className:"text-center mb-8",children:[(0,a.jsx)("div",{className:"flex justify-center mb-4",children:(0,a.jsx)("img",{src:"/logos/liatrio-labs-logo.png",alt:"Liatrio Labs",className:"h-16"})}),(0,a.jsx)("h1",{className:"text-4xl font-bold mb-4",children:"Liatrio Agent Platform"})]}),(0,a.jsxs)("form",{onSubmit:eW,children:[(0,a.jsxs)("div",{className:"relative border rounded-2xl shadow-sm overflow-hidden bg-muted/30 cursor-text",children:[(0,a.jsx)("div",{className:"relative bg-transparent",children:(0,a.jsx)(l.T,{ref:e_,id:"prompt",placeholder:"Describe what you want the AI agent to do...",value:Y,onChange:e=>ee(e.target.value),onKeyDown:e=>{if("Enter"===e.key&&!(window.innerWidth<768)&&!e.shiftKey&&(e.preventDefault(),Y.trim())){let t=e.currentTarget.closest("form");t&&t.dispatchEvent(new Event("submit",{bubbles:!0,cancelable:!0}))}},disabled:t,required:!0,rows:4,className:"w-full border-0 resize-none focus-visible:ring-0 focus-visible:ring-offset-0 p-4 text-base !bg-transparent shadow-none!"})}),(0,a.jsx)("div",{className:"p-4",children:(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-2 flex-1 min-w-0",children:[(0,a.jsxs)(i.l6,{value:ea,onValueChange:e=>{en(e),es(e)},disabled:t,children:[(0,a.jsx)(i.bq,{className:"w-auto sm:min-w-[120px] border-0 bg-transparent shadow-none focus:ring-0 h-8 shrink-0",children:(0,a.jsx)(i.yv,{placeholder:"Agent",children:ea&&((Q=M.find(e=>e.value===ea))?(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(Q.icon,{className:"w-4 h-4"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:Q.label})]}):null)})}),(0,a.jsx)(i.gC,{children:M.map(e=>
1"isDivider"in e&&e.isDivider?(0,a.jsx)("div",{className:"h-px bg-border my-1"},e.value):(0,a.jsx)(i.eb,{value:e.value,children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(e.icon,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:e.label})]})},e.value))})]}),"multi-agent"===ea?(0,a.jsxs)(i.l6,{value:"multi-select",onValueChange:()=>{},disabled:t,children:[(0,a.jsx)(i.bq,{className:"flex-1 sm:flex-none sm:w-auto sm:min-w-[140px] border-0 bg-transparent shadow-none focus:ring-0 h-8 min-w-0",children:(0,a.jsx)(i.yv,{children:0===ei.length?"Select models":`${ei.length} Selected`})}),(0,a.jsx)(i.gC,{children:M.filter(e=>"multi-agent"!==e.value).map(e=>(0,a.jsxs)("div",{children:[(0,a.jsx)("div",{className:"px-2 py-1.5 text-xs font-semibold text-muted-foreground",children:e.label}),j.di[e.value]?.map(t=>{let s=`${e.value}:${t.value}`,n=ei.includes(s);return(0,a.jsxs)("div",{className:"relative flex cursor-pointer select-none items-center rounded-sm py-1.5 pl-8 pr-2 text-sm outline-none hover:bg-accent hover:text-accent-foreground focus:bg-accent focus:text-accent-foreground data-[disabled]:pointer-events-none data-[disabled]:opacity-50",onClick:e=>{e.preventDefault(),eo(e=>n?e.filter(e=>e!==s):[...e,s])},children:[(0,a.jsx)("span",{className:"absolute left-2 flex h-3.5 w-3.5 items-center justify-center",children:n&&(0,a.jsx)("svg",{className:"h-4 w-4",fill:"none",stroke:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",strokeWidth:2,d:"M5 13l4 4L19 7"})})}),t.label]},s)})]},e.value))})]}):(0,a.jsxs)(i.l6,{value:er,onValueChange:e=>{el(e),eV(e)},disabled:t,children:[(0,a.jsx)(i.bq,{className:"flex-1 sm:flex-none sm:w-auto sm:min-w-[140px] border-0 bg-transparent shadow-none focus:ring-0 h-8 min-w-0",children:(0,a.jsx)(i.yv,{placeholder:"Model",className:"truncate"})}),(0,a.jsx)(i.gC,{children:j.di[ea]?.map(e=>(0,a.jsx)(i.eb,{value:e.value,children:e.label},e.value))||[]})]}),eh&&(0,a.jsxs)(i.l6,{value:ep,onValueChange:e=>{ef(e),eb(null)},disabled:t,children:[(0,a.jsx)(i.bq,{className:"w-auto min-w-[100px] border-0 bg-transparent shadow-none focus:ring-0 h-8 shrink-0",children:(0,a.jsx)(i.yv,{placeholder:"Visibility",children:"team"===ep?(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(L.A,{className:"w-3 h-3"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Team"})]}):(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(R.A,{className:"w-3 h-3"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:"Personal"})]})})}),(0,a.jsxs)(i.gC,{children:[(0,a.jsx)(i.eb,{value:"team",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(L.A,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Team"})]})}),(0,a.jsx)(i.eb,{value:"personal",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(R.A,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:"Personal"})]})})]})]}),ex&&eg.length>0&&!H&&(0,a.jsxs)(i.l6,{value:ej||eg[0]?.id||"",onValueChange:e=>eb(e),disabled:t||ew,children:[(0,a.jsx)(i.bq,{className:"w-auto min-w-[120px] border-0 bg-transparent shadow-none focus:ring-0 h-8 shrink-0",children:(0,a.jsx)(i.yv,{placeholder:"Project",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(P.A,{className:"w-3 h-3"}),(0,a.jsx)("span",{className:"hidden sm:inline truncate max-w-[80px]",children:eg.find(e=>e.id===ej)?.name||eg[0]?.name||"Project"})]})})}),(0,a.jsx)(i.gC,{children:eg.map(e=>(0,a.jsx)(i.eb,{value:e.id,children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)(P.A,{className:"w-4 h-4"}),(0,a.jsx)("span",{children:e.name})]})},e.id))})]}),(!eN||eC!==O||eE)&&(0,a.jsxs)("div",{className:"hidden sm:flex items-center gap-2 flex-wrap",children:[!eN&&(0,a.jsxs)(d.E,{variant:"secondary",className:"text-xs h-6 px-2 gap-1 bg-transparent border-0",children:["Skip Install",(0,a.jsx)(r.$,{variant:"ghost",size:"sm",className:"h-3 w-3 p-0 hover:bg-transparent",onClick:e=>{e.stopPropagation(),eG(!0)},children:(0,a.jsx)(h.A,{className:"h-2 w-2"})})]}),eC!==O&&(0,a.jsxs)(d.E,{variant:"secondary",className:"text-xs h-6 px-2 gap-1 bg-transparent border-0",children:[eC,"m",(0,a.jsx)(r.$,{variant:"ghost",size:"sm",className:"h-3 w-3 p-0 hover:bg-transparent",onClick:e=>{e.stopPropagation(),ez(O)},children:(0,a.jsx)(h.A,{className:"h-2 w-2"})})]}),eE&&(0,a.jsxs)(d.E,{variant:"secondary",className:"text-xs h-6 px-2 gap-1 bg-transparent border-0",children:["Keep Alive",(0,a.jsx)(r.$,{variant:"ghost",size:"sm",className:"h-3 w-3 p-0 hover:bg-transparent",onClick:e=>{e.stopPropagation(),eZ(!1)},children:(0,a.jsx)(h.A,{className:"h-2 w-2"})})]})]})]}),(0,a.jsx)("div",{className:"flex items-center gap-2 shrink-0",children:(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsxs)(m.Bc,{delayDuration:1500,skipDelayDuration:1500,children:[(0,a.jsxs)(m.m_,{children:[(0,a.jsx)(m.k$,{asChild:!0,children:(0,a.jsxs)(r.$,{type:"button",variant:"ghost",size:"sm",className:"rounded-full h-8 w-8 p-0 relative",onClick:()=>eM(!0),children:[(0,a.jsx)(p.A,{className:"h-4 w-4"}),eU.filter(e=>"connected"===e.status).length>0&&(0,a.jsx)(d.E,{variant:"secondary",className:"absolute -top-1 -right-1 h-4 min-w-4 p-0 flex items-center justify-center text-[10px] rounded-full",children:eU.filter(e=>"connected"===e.status).length})]})}),(0,a.jsx)(m.ZI,{children:(0,a.jsx)("p",{children:"MCP Servers"})})]}),(0,a.jsxs)(u.rI,{children:[(0,a.jsxs)(m.m_,{children:[(0,a.jsx)(m.k$,{asChild:!0,children:(0,a.jsx)(u.ty,{asChild:!0,children:(0,a.jsxs)(r.$,{type:"button",variant:"ghost",size:"sm",className:"rounded-full h-8 w-8 p-0 relative",children:[(0,a.jsx)(f.A,{className:"h-4 w-4"}
1),(X=[!eN,eC!==O,eE].filter(Boolean).length)>0?(0,a.jsx)(d.E,{variant:"secondary",className:"absolute -top-1 -right-1 h-4 min-w-4 p-0 flex items-center justify-center text-[10px] rounded-full sm:hidden",children:X}):null]})})}),(0,a.jsx)(m.ZI,{children:(0,a.jsx)("p",{children:"Task Options"})})]}),(0,a.jsxs)(u.SQ,{className:"w-72",align:"end",children:[(0,a.jsx)(u.lp,{children:"Task Options"}),(0,a.jsx)(u.mB,{}),(0,a.jsxs)("div",{className:"p-2 space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(o.S,{id:"install-deps",checked:eN,onCheckedChange:e=>eG(!0===e)}),(0,a.jsx)(c.J,{htmlFor:"install-deps",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"Install Dependencies?"})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(c.J,{htmlFor:"max-duration",className:"text-sm font-medium",children:"Maximum Duration"}),(0,a.jsxs)(i.l6,{value:eC.toString(),onValueChange:e=>ez(parseInt(e)),children:[(0,a.jsx)(i.bq,{id:"max-duration",className:"w-full h-8",children:(0,a.jsx)(i.yv,{})}),(0,a.jsxs)(i.gC,{children:[(0,a.jsx)(i.eb,{value:"5",children:"5 minutes"}),(0,a.jsx)(i.eb,{value:"10",children:"10 minutes"}),(0,a.jsx)(i.eb,{value:"15",children:"15 minutes"}),(0,a.jsx)(i.eb,{value:"30",children:"30 minutes"}),(0,a.jsx)(i.eb,{value:"45",children:"45 minutes"}),(0,a.jsx)(i.eb,{value:"60",children:"1 hour"}),(0,a.jsx)(i.eb,{value:"120",children:"2 hours"}),(0,a.jsx)(i.eb,{value:"180",children:"3 hours"}),(0,a.jsx)(i.eb,{value:"240",children:"4 hours"}),(0,a.jsx)(i.eb,{value:"300",children:"5 hours"})]})]})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(o.S,{id:"keep-alive",checked:eE,onCheckedChange:e=>eZ(!0===e)}),(0,a.jsxs)(c.J,{htmlFor:"keep-alive",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:["Keep Alive (",O,"m max)"]})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground pl-6",children:"Keep sandbox running after completion."})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(o.S,{id:"spec-driven-workflow",checked:e$,onCheckedChange:e=>eT(!0===e)}),(0,a.jsx)(c.J,{htmlFor:"spec-driven-workflow",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"Spec-Driven Workflow"})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground pl-6",children:"Install workflow slash commands for structured development."})]}),(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(o.S,{id:"claude-flow",checked:eI,onCheckedChange:e=>eD(!0===e)}),(0,a.jsx)(c.J,{htmlFor:"claude-flow",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"Claude Flow"})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground pl-6",children:"Install Claude Flow for multi-agent orchestration."})]}),U.includes(er)&&(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(o.S,{id:"enable-thinking",checked:eL,onCheckedChange:e=>eR(!0===e)}),(0,a.jsx)(c.J,{htmlFor:"enable-thinking",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70 cursor-pointer",children:"Extended Thinking"})]}),(0,a.jsx)("p",{className:"text-xs text-muted-foreground pl-6",children:"Enable extended thinking for deeper reasoning."})]})]})]})]})]}),(0,a.jsx)(r.$,{type:"submit",disabled:t||!Y.trim()||K,size:"sm",className:"rounded-full h-8 w-8 p-0",children:t?(0,a.jsx)(g.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(v.A,{className:"h-4 w-4"})})]})})]})})]}),"multi-agent"===ea&&ei.length>0&&(0,a.jsxs)("div",{className:"mt-2 text-xs text-muted-foreground text-center",children:["This will create ",ei.length," separate task",ei.length>
11?"s":""," (one for each selected model)"]})]}),(0,a.jsx)(k.s,{open:eP,onOpenChange:eM})]})}},87776:(e,t,s)=>{s.d(t,{Wh:()=>n,dL:()=>function e(t,s,a){if(!("u">typeof document&&document.hasFocus())&&"u">typeof Notification)if("granted"===Notification.permission){let e=new Notification(t,{body:s,icon:"/favicon.svg",tag:"task-feedback",requireInteraction:!0});a&&(e.onclick=()=>{window.focus(),a(),e.close()})}else"denied"!==Notification.permission&&Notification.requestPermission().then(n=>{"granted"===n&&e(t,s,a)})}}),s(78661);let a=null;function n(){try{a||(a=new(window.AudioContext||window.webkitAudioContext));let e=a;"suspended"===e.state&&e.resume().catch(()=>{});let t=e.currentTime,s=e.createOscillator(),n=e.createGain();s.type="sine",s.frequency.setValueAtTime(880,t),s.frequency.setValueAtTime(1047,t+.1),n.gain.setValueAtTime(.3,t),n.gain.exponentialRampToValueAtTime(.01,t+.3),s.connect(n),n.connect(e.destination),s.start(t),s.stop(t+.3);let r=e.createOscillator(),l=e.createGain();r.type="sine",r.frequency.setValueAtTime(1319,t+.15),l.gain.setValueAtTime(.2,t+.15),l.gain.exponentialRampToValueAtTime(.01,t+.45),r.connect(l),l.connect(e.destination),r.start(t+.15),r.stop(t+.45)}catch(e){console.warn("Failed to play global notification sound:",e)}}},99335:(e,t,s)=>{s.d(t,{AppLayout:()=>eM,s:()=>eR});var a=s(75393),n=s(78661),r=s(62230),l=s(98596),i=s(96166),o=s(21169),c=s(1512),d=s(73753),u=s(55050),m=s(94393),x=s(36144),h=s(49694),p=s(73779),f=s(9422),g=s.n(f),v=s(89315),j=s(1582),b=s(32251),w=s(51935),k=s(97277),N=s(44139),y=s(65586),C=s(36855),A=s(4194),E=s(8281),S=s(39226),$=s(13087),T=s(13393),I=s(2068),D=s(17927),L=s(26384),R=s(52386),P=s(80839),M=s(71132),U=s(49065),_=s(47350);function G(){let{currentTeam:e,userRole:t}=(0,U.d)(),s=(0,v.usePathname)();if(!(0,_.G)("TEAMS_ENABLED")||!e)return null;let n=e.id,r=e=>s===e||s.startsWith(e+"/");return(0,a.jsxs)("div",{className:"px-2 py-2",children:[(0,a.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide px-2 mb-2",children:"Team"}),(0,a.jsx)("nav",{className:"flex flex-col gap-1",children:(0,a.jsx)(g(),{href:`/teams/${n}/dashboard`,children:(0,a.jsxs)(l.$,{variant:r(`/teams/${n}/dashboard`)?"secondary":"ghost",size:"sm",className:"w-full justify-start h-8 px-2",children:[(0,a.jsx)(S.A,{className:"h-4 w-4 mr-2"}),"Dashboard"]})})}),(0,a.jsx)("div",{className:"text-xs font-medium text-muted-foreground px-2 mt-4 mb-2",children:"Requirements"}),(0,a.jsxs)("nav",{className:"flex flex-col gap-1",children:[(0,a.jsx)(g(),{href:`/teams/${n}/products`,children:(0,a.jsxs)(l.$,{variant:r(`/teams/${n}/products`)?"secondary":"ghost",size:"sm",className:"w-full justify-start h-8 px-2",children:[(0,a.jsx)($.A,{className:"h-4 w-4 mr-2"}),"Products"]})}),(0,a.jsx)(g(),{href:`/teams/${n}/prds`,children:(0,a.jsxs)(l.$,{variant:r(`/teams/${n}/prds`)?"secondary":"ghost",size:"sm",className:"w-full justify-start h-8 px-2",children:[(0,a.jsx)(T.A,{className:"h-4 w-4 mr-2"}),"PRDs"]})}),(0,a.jsx)(g(),{href:`/teams/${n}/specs`,children:(0,a.jsxs)(l.$,{variant:r(`/teams/${n}/specs`)?"secondary":"ghost",size:"sm",className:"w-full justify-start h-8 px-2",children:[(0,a.jsx)(I.A,{className:"h-4 w-4 mr-2"}),"Specs"]})})]}),(0,a.jsx)("div",{className:"text-xs font-medium text-muted-foreground px-2 mt-4 mb-2",children:"Execution"}),(0,a.jsxs)("nav",{className:"flex flex-col gap-1",children:[(0,a.jsx)(g(),{href:`/teams/${n}/projects`,children:(0,a.jsxs)(l.$,{variant:r(`/teams/${n}/projects`)?"secondary":"ghost",size:"sm",className:"w-full justify-start h-8 px-2",children:[(0,a.jsx)(D.A,{className:"h-4 w-4 mr-2"}),"Projects"]})}),(0,a.jsx)(g(),{href:`/teams/${n}/tasks`,children:(0,a.jsxs)(l.$,{variant:r(`/teams/${n}/tasks`)?"secondary":"ghost",size:"sm",className:"w-full justify-start h-8 px-2",children:[(0,a.jsx)(L.A,{className:"h-4 w-4 mr-2"}),"Tasks"]})}),(0,a.jsx)(g(),{href:`/teams/${n}/repos`,children:(0,a.jsxs)(l.$,{variant:r(`/teams/${n}/repos`)?"secondary":"ghost",size:"sm",className:"w-full justify-start h-8 px-2",children:[(0,a.jsx)(h.A,{className:"h-4 w-4 mr-2"}),"Repositories"]})}),(0,_.G)("VIBES_ENABLED")&&(0,a.jsx)(g(),{href:`/teams/${n}/vibes`,children:(0,a.jsxs)(l.$,{variant:r(`/teams/${n}/vibes`)?"secondary":"ghost",size:"sm",className:"w-full justify-start h-8 px-2",children:[(0,a.jsx)(R.A,{className:"h-4 w-4 mr-2 text-white"}),"Prototypes"]})})]}),("manager"===t||"owner"===t)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"text-xs font-medium text-muted-foreground px-2 mt-4 mb-2",children:"Management"}),(0,a.jsxs)("nav",{className:"flex flex-col gap-1",children:[(0,a.jsx)(g(),{href:`/teams/${n}/members`,children:(0,a.jsxs)(l.$,{variant:r(`/teams/${n}/members`)?"secondary":"ghost",size:"sm",className:"w-full justify-start h-8 px-2",children:[(0,a.jsx)(P.A,{className:"h-4 w-4 mr-2"}),"Members"]})}),(0,a.jsx)(g(),{href:`/teams/${n}/settings`,children:(0,a.jsxs)(l.$,{variant:r(`/teams/${n}/settings`)?"secondary":"ghost",size:"sm",className:"w-full justify-start h-8 px-2",children:[(0,a.jsx)(M.A,{className:"h-4 w-4 mr-2"}),"Settings"]})})]})]})]})}var z=s(74953);function Z(){let e=(0,v.usePathname)();if(!(0,_.G)("TEAMS_ENABLED")||!(0,_.G)("PERSONAL_ENABLED"))return null;let t=t=>e===t||e.startsWith(t+"/");return(0,a.jsxs)("div",{className:"px-2 py-2",children:[(0,a.jsx)("div",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide px-2 mb-2",children:"Personal"}),(0,a.jsx)("nav",{className:"flex flex-col gap-1",children:(0,a.jsx)(g(),{href:"/dashboard",children:(0,a.jsxs)(l.$,{variant:t("/dashboard")?"secondary":"ghost",size:"sm",className:"w-full justify-start h-8 px-2",children:[(0,a.jsx)(S.A,{className:"h-4 w-4 mr-2"}),"Dashboard"]})})}),(0,a.jsx)("div",{className:"text-xs font-medium text-muted-foreground px-2 mt-4 mb-2",children:"Requirements"}),(0,a.jsxs)("nav",{className:"flex flex-col gap-1",children:[(0,a.jsx)(g(),{href:"/products",children:(0,a.jsxs)(l.$,{variant:t("/products")?"secondary":"ghost",size:"sm",className:"w-full justify-start h-8 px-2",children:[(0,a.jsx)($.A,{className:"h-4 w-4 mr-2"}),"Products"]})}),(0,a.jsx)(g(),{href:"/prds",children:(0,a.jsxs)(l.$,{variant:t("/prds")?"secondary":"ghost",size:"sm",className:"w-full justify-start h-8 px-2",children:[(0,a.jsx)(T.A,{className:"h-4 w-4 mr-2"}),"PRDs"]})}),(0,a.jsx)(g(),{href:"/specs",children:(0,a.jsxs)(l.$,{variant:t("/specs")?"secondary":"ghost",size:"sm",className:"w-full justify-start h-8 px-2",children:[(0,a.jsx)(I.A,{className:"h-4 w-4 mr-2"}),"Specs"]})}),(0,a.jsx)(g(),{href:"/documents",children:(0,a.jsxs)(l.$,{variant:t("/documents")?"secondary":"ghost",size:"sm",className:"w-full justify-start h-8 px-2",children:[(0,a.jsx)(z.A,{className:"h-4 w-4 mr-2"}),"Documents"]})})]}),(0,a.jsx)("div",{className:"text-xs font-medium text-muted-foreground px-2 mt-4 mb-2",children:"Execution"}),(0,a.jsx)("nav",{className:"flex flex-col gap-1",children:(0,a.jsx)(g(),{href:"/projects",children:(0,a.jsxs)(l.$,{variant:t("/projects")?"secondary":"ghost",size:"sm",className:"w-full justify-start h-8 px-2",children:[(0,a.jsx)(D.A,{className:"h-4 w-4 mr-2"}),"Projects"]})})})]})}var B=s(35853),O=s(20105);let F={pending:"bg-muted",in_progress:"bg-blue-500 animate-pulse",completed:"bg-emerald-500",failed:"bg-red-500",skipped:"bg-muted-foreground
1/30"};function V({segments:e,fallbackProgress:t=0,className:s}){return e&&0!==e.length?(0,a.jsx)("div",{className:(0,p.cn)("flex gap-0.5 w-full overflow-hidden rounded-full bg-muted/20",s),role:"progressbar","aria-valuemin":0,"aria-valuemax":e.length,"aria-valuenow":e.filter(e=>"completed"===e.status||"skipped"===e.status).length,children:e.map(e=>(0,a.jsx)("div",{className:(0,p.cn)("flex-1 min-w-[2px] rounded-sm",F[e.status])},e.id))}):(0,a.jsx)(O.k,{value:t,className:s})}var W=s(62694),q=s(3459),J=s(68832),H=s(29713),K=s(11627);let Q={claude:H.vO,copilot:H.TA,gemini:H.gU,cursor:H.bs,codex:H.U1,opencode:H.gp},X={planned:{icon:m.A,color:"text-gray-500",bgColor:"bg-gray-500/10",label:"Planned"},pending:{icon:m.A,color:"text-yellow-500",bgColor:"bg-yellow-500/10",label:"Pending"},initializing:{icon:W.A,color:"text-blue-400",bgColor:"bg-blue-400/10",label:"Starting"},processing:{icon:W.A,color:"text-blue-500",bgColor:"bg-blue-500/10",label:"Running"},completed:{icon:x.A,color:"text-green-500",bgColor:"bg-green-500/10",label:"Completed"},error:{icon:u.A,color:"text-red-500",bgColor:"bg-red-500/10",label:"Error"},timed_out:{icon:u.A,color:"text-orange-500",bgColor:"bg-orange-500/10",label:"Timed Out"},stopped:{icon:u.A,color:"text-gray-500",bgColor:"bg-gray-500/10",label:"Stopped"},awaiting_feedback:{icon:m.A,color:"text-orange-500",bgColor:"bg-orange-500/10",label:"Awaiting"}};function Y({onLinkClick:e}){let t=(0,v.usePathname)(),s=(0,y.md)(C.e),{currentTeam:l}=(0,U.d)(),[i,o]=(0,n.useState)("my"),[c,d]=(0,n.useState)([]),[u,m]=(0,n.useState)(!0),x=(0,_.G)("TEAMS_ENABLED")&&!!l,h=(0,n.useCallback)(async()=>{if(s?.user?.id)try{let e=new URLSearchParams({tab:i,limit:"5"});l?.id&&e.set("teamId",l.id);let t=await fetch(`/api/tasks/recent?${e}`);if(t.ok){let e=await t.json();d(e.tasks||[])}}catch(e){console.error("Failed to fetch recent tasks:",e)}finally{m(!1)}},[s?.user?.id,l?.id,i]);return((0,n.useEffect)(()=>{h();let e=setInterval(h,1e4);return()=>clearInterval(e)},[h]),(0,n.useEffect)(()=>{let e=()=>{h()};return window.addEventListener("team-task-created",e),window.addEventListener("team-task-updated",e),window.addEventListener("team-task-deleted",e),()=>{window.removeEventListener("team-task-created",e),window.removeEventListener("team-task-updated",e),window.removeEventListener("team-task-deleted",e)}},[h]),s?.user)?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("div",{className:"flex items-center justify-end px-1",children:x&&(0,a.jsxs)("div",{className:"flex items-center gap-0.5 bg-muted/50 rounded-md p-0.5",children:[(0,a.jsx)("button",{onClick:()=>o("my"),className:(0,p.cn)("text-[10px] font-medium px-2 py-0.5 rounded transition-colors","my"===i?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"My Tasks"}),(0,a.jsx)("button",{onClick:()=>o("team"),className:(0,p.cn)("text-[10px] font-medium px-2 py-0.5 rounded transition-colors","team"===i?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Team"})]})}),(0,a.jsxs)("div",{className:"space-y-1",children:[u?[void 0,void 0,void 0].map((e,t)=>(0,a.jsx)("div",{className:"animate-pulse",children:(0,a.jsx)(r.Zp,{className:"p-0",children:(0,a.jsxs)(r.Wu,{className:"px-2.5 py-2",children:[(0,a.jsx)("div",{className:"h-3 w-3/4 bg-muted rounded mb-2"}),(0,a.jsx)("div",{className:"h-2 w-1/2 bg-muted rounded"})]})})},t)):0===c.length?(0,a.jsx)(r.Zp,{children:(0,a.jsx)(r.Wu,{className:"p-3 text-center text-xs text-muted-foreground",children:"my"===i?"No recent tasks":"No team activity yet"})}):c.map(s=>{let n=t===`/tasks/${s.id}`,l=X[s.status]||X.pending,o=l.icon,c=Q[s.selectedAgent||"claude"]||H.vO;return(0,a.jsx)(g(),{href:`/tasks/${s.id}`,onClick:e,className:(0,p.cn)("block rounded-lg",n&&"ring-1 ring-primary/50 ring-offset-0"),children:(0,a.jsx)(r.Zp,{className:(0,p.cn)("cursor-pointer transition-colors hover:bg-accent p-0 rounded-lg",n&&"bg-accent"),children:(0,a.jsxs)(r.Wu,{className:"px-3 py-2.5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,a.jsxs)(B.E,{variant:"outline",className:(0,p.cn)("h-5 px-1.5 text-[10px] gap-1 font-medium",l.bgColor,l.color,"border-transparent"),children:[(0,a.jsx)(o,{className:"h-3 w-3"}),l.label]}),(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(c,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground",children:function(e){let t=new Date(e),s=Math.floor((new Date().getTime()-t.getTime())/6e4);if(s<1)return"Just now";if(s<60)return`${s}m ago`;let a=Math.floor(s/60);if(a<24)return`${a}h ago`;let n=Math.floor(a/24);return`${n}d ago`}(s.updatedAt)})]})]}),(0,a.jsx)("p",{className:(0,p.cn)("text-sm font-medium leading-snug mb-1.5","processing"===s.status&&"bg-gradient-to-r from-muted-foreground from-20% via-white via-50% to-muted-foreground to-80% bg-clip-text text-transparent bg-[length:300%_100%] animate-[shimmer_1.5s_linear_infinite]"),children:s.title||s.prompt.slice(0,80)+(s.prompt.length>80?"...":"")}),"processing"===s.status&&(0,a.jsxs)("div",{className:"flex items-center gap-2 mb-1.5",children:[(0,a.jsx)(V,{segments:s.subtaskProgress?.segments,fallbackProgress:s.progress||0,className:"flex-1 h-1.5"}),(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground font-medium",children:s.subtaskProgress?`${Math.round(s.subtaskProgress.segments.filter(e=>"completed"===e.status||"skipped"===e.status).length/s.subtaskProgress.total*100)}%`:`${s.progress||0}%`})]}),s.project&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mb-1.5",children:[(0,a.jsx)(q.A,{className:"h-3.5 w-3.5 text-blue-500"}),(0,a.jsx)("span",{className:"text-xs text-muted-foreground truncate",children:s.project.name})]}),(s.spec||s.prd)&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 flex-wrap",children:[s.spec&&(0,a.jsx)(k.Bc,{delayDuration:200,children:(0,a.jsxs)(k.m_,{children:[(0,a.jsx)(k.k$,{asChild:!0,children:(0,a.jsxs)(B.E,{variant:"outline",className:"h-4 px-1.5 text-[9px] gap-0.5 bg-purple-500/10 text-purple-600 border-purple-500/20",children:[(0,a.jsx)(T.A,{className:"h-2.5 w-2.5"}
1),"Spec"]})}),(0,a.jsx)(k.ZI,{side:"top",className:"text-xs",children:s.spec.title})]})}),s.prd&&(0,a.jsx)(k.Bc,{delayDuration:200,children:(0,a.jsxs)(k.m_,{children:[(0,a.jsx)(k.k$,{asChild:!0,children:(0,a.jsxs)(B.E,{variant:"outline",className:"h-4 px-1.5 text-[9px] gap-0.5 bg-amber-500/10 text-amber-600 border-amber-500/20",children:[(0,a.jsx)(J.A,{className:"h-2.5 w-2.5"}),"PRD"]})}),(0,a.jsx)(k.ZI,{side:"top",className:"text-xs",children:s.prd.title})]})})]}),"team"===i&&s.creator&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 mt-1.5 pt-1.5 border-t border-border/50",children:[(0,a.jsxs)(K.eu,{className:"h-4 w-4",children:[(0,a.jsx)(K.BK,{src:s.creator.avatarUrl||void 0}),(0,a.jsx)(K.q5,{className:"text-[9px]",children:(s.creator.name||s.creator.username||"?").charAt(0).toUpperCase()})]}),(0,a.jsx)("span",{className:"text-[11px] text-muted-foreground truncate",children:s.creator.name||s.creator.username||"Unknown"})]})]})})},s.id)}),c.length>0&&(0,a.jsx)(g(),{href:x?`/teams/${l?.id}/tasks`:"/tasks",onClick:e,className:"block",children:(0,a.jsx)("button",{className:"w-full text-xs text-muted-foreground hover:text-foreground py-1.5 transition-colors",children:"View all tasks"})})]})]}):(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide px-1",children:"Recent Tasks"}),(0,a.jsx)(r.Zp,{children:(0,a.jsx)(r.Wu,{className:"p-3 text-center text-xs text-muted-foreground",children:"Sign in to view recent tasks"})})]})}var ee=s(86093);function et({onLinkClick:e}){let t=(0,v.usePathname)(),s=(0,y.md)(C.e),{currentTeam:l}=(0,U.d)(),[i,o]=(0,n.useState)("my"),[c,d]=(0,n.useState)([]),[u,m]=(0,n.useState)(!0),x=(0,_.G)("TEAMS_ENABLED")&&!!l,h=(0,n.useCallback)(async()=>{if(s?.user?.id)try{let e=new URLSearchParams({limit:"5"});l?.id&&"team"===i?e.set("teamId",l.id):l?.id&&"my"===i&&e.set("teamId",l.id);let t=await fetch(`/api/vibes/sessions/recent?${e}`);if(t.ok){let e=await t.json();d(e.data?.sessions||[])}}catch(e){console.error("Failed to fetch recent vibes sessions:",e)}finally{m(!1)}},[s?.user?.id,l?.id,i]);return((0,n.useEffect)(()=>{h();let e=setInterval(h,15e3);return()=>clearInterval(e)},[h]),s?.user)?(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)("div",{className:"flex items-center justify-end px-1",children:x&&(0,a.jsxs)("div",{className:"flex items-center gap-0.5 bg-muted/50 rounded-md p-0.5",children:[(0,a.jsx)("button",{onClick:()=>o("my"),className:(0,p.cn)("text-[10px] font-medium px-2 py-0.5 rounded transition-colors","my"===i?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"My Sessions"}),(0,a.jsx)("button",{onClick:()=>o("team"),className:(0,p.cn)("text-[10px] font-medium px-2 py-0.5 rounded transition-colors","team"===i?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:"Team"})]})}),(0,a.jsxs)("div",{className:"space-y-1",children:[u?[void 0,void 0,void 0].map((e,t)=>(0,a.jsx)("div",{className:"animate-pulse",children:(0,a.jsx)(r.Zp,{className:"p-0",children:(0,a.jsxs)(r.Wu,{className:"px-2.5 py-2",children:[(0,a.jsx)("div",{className:"h-3 w-3/4 bg-muted rounded mb-2"}),(0,a.jsx)("div",{className:"h-2 w-1/2 bg-muted rounded"})]})})},t)):0===c.length?(0,a.jsx)(r.Zp,{children:(0,a.jsx)(r.Wu,{className:"p-3 text-center text-xs text-muted-foreground",children:"my"===i?"No recent sessions":"No team sessions yet"})}):c.map(s=>{var n,i;let o=l?.id?`/teams/${l.id}/vibes?session=${s.id}`:`/vibes?session=${s.id}`,c=t?.includes("/vibes")&&t?.includes(l?.id||"")&&new URLSearchParams(window.location.search).get("session")===s.id;return(0,a.jsx)(g(),{href:o,onClick:e,className:(0,p.cn)("block rounded-lg",c&&"ring-1 ring-primary/50 ring-offset-0"),children:(0,a.jsx)(r.Zp,{className:(0,p.cn)("cursor-pointer transition-colors hover:bg-accent p-0 rounded-lg",c&&"bg-accent"),children:(0,a.jsxs)(r.Wu,{className:"px-3 py-2.5",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,a.jsx)(ee.A,{className:(0,p.cn)("h-2 w-2 fill-current",(n=s.status,i=!!s.sandboxId,"expired"===n?"text-red-500":"stopped"===n?"text-gray-400":"active"===n&&i?"text-green-500":"text-gray-400"))}),(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground capitalize",children:s.status})]}),(0,a.jsx)("span",{className:"text-[10px] text-muted-foreground",children:function(e){let t=new Date(e),s=Math.floor((new Date().getTime()-t.getTime())/6e4);if(s<1)return"Just now";if(s<60)return`${s}m ago`;let a=Math.floor(s/60);if(a<24)return`${a}h ago`;let n=Math.floor(a/24);return`${n}d ago`}(s.updatedAt)})]}),(0,a.jsx)("p",{className:"text-sm font-medium leading-snug truncate",children:s.title||"Untitled Session"})]})})},s.id)}),c.length>0&&(0,a.jsx)(g(),{href:x?`/teams/${l?.id}/vibes`:"/vibes",onClick:e,className:"block",children:(0,a.jsx)("button",{className:"w-full text-xs text-muted-foreground hover:text-foreground py-1.5 transition-colors",children:"View all sessions"})})]})]}):(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsxs)("div",{className:"text-xs font-medium text-muted-foreground uppercase tracking-wide px-1 flex items-center gap-1.5",children:[(0,a.jsx)(R.A,{className:"h-3 w-3"}),"Recent Vibes"]}),(0,a.jsx)(r.Zp,{children:(0,a.jsx)(r.Wu,{className:"p-3 text-center text-xs text-muted-foreground",children:"Sign in to view recent sessions"})})]})}var es=s(69634),ea=s(32938),en=s(36680);let er=(0,ea.eU)([]),el=(0,ea.eU)(new Set),ei=(0,en.tG)("intervention-notification-preferences",{toastEnabled:!0,soundEnabled:!0,browserEnabled:!0}),eo=(0,ea.eU)(e=>e(er).filter(e=>!e.dismissed).length),ec=(0,ea.eU)(e=>e(eo)>0);(0,ea.eU)(null,(e,t,s)=>{let a=e(er);a.some(e=>e.taskId===s.taskId)||t(er,[...a,{...s,dismissed:!1}])}),(0,ea.eU)(null,(e,t,s)=>{let a=e(er);t(er,a.map(e=>e.taskId===s?{...e,dismissed:!0}:e))}),(0,ea.eU)(null,(e,t,s)=>{let a=e(er);t(er,a.filter(e=>e.taskId!==s));let n=new Set(e(el));n.delete(s),t(el,n)});let ed=(0,ea.eU)(null,(e,t,s)=>{let a=new Set(e(el));a.add(s),t(el,a)});(0,ea.eU)(null,(e,t)=>{t(er,[]),t(el,new Set)});let eu=(0,ea.eU)(null,(e,t,s)=>{let a=new Map(e(er).map(e=>[e.taskId,e]));t(er,s.filter(e=>e.needsIntervention).map(e=>{let t=a.get(e.id);return t||{taskId:e.id,taskTitle:e.title||e.prompt.slice(0,50),specId:e.specId||void 0,reason:e.interventionReason||"Task requires intervention",timestamp:new Date,dismissed:!1}}))});var em=s(87776);function ex(){let e=(0,v.useRouter)(),t=(0,y.md)(er),[s,a]=(0,y.fp)(el),r=(0,y.Xr)(ed),l=(0,y.md)(ei),i=(0,n.useRef)(!0),o=(0,n.useRef)(new Set),c=(0,n.useCallback)(t=>{l.soundEnabled&&(0,em.Wh)(),l.browserEnabled&&(0,em.dL)("Task needs intervention",t.taskTitle,()=>{t.specId?e.push(`/specs/${t.specId}?highlight=${t.taskId}`):e.push(`/tasks/${t.taskId}`)}),l.toastEnabled&&N.oR.warning("Task needs intervention",{description:t.taskTitle,duration:1/0,action:{label:"View Task",onClick:()=>{t.specId?e.push(`/specs/${t.specId}?highlight=${t.taskId}`):e.push(`/tasks/${t.taskId}`)}}}),r(t.taskId)},[e,l,r]);return(0,n.useEffect)(()=>
1{if(i.current){i.current=!1,o.current=new Set(t.map(e=>e.taskId)),t.forEach(e=>{s.has(e.taskId)||a(t=>{let s=new Set(t);return s.add(e.taskId),s})});return}t.filter(e=>!s.has(e.taskId)&&!e.dismissed&&!o.current.has(e.taskId)).forEach(e=>{c(e)}),o.current=new Set(t.map(e=>e.taskId))},[t,s,c,a]),null}function eh({className:e}){let t=(0,y.md)(eo);return(0,y.md)(ec)?(0,a.jsx)("span",{className:(0,p.cn)("inline-flex items-center justify-center","bg-orange-500 text-white text-xs font-semibold","rounded-full h-4 min-w-4 px-1","animate-pulse-subtle",e),children:t}):null}var ep=s(61314),ef=s(65682);function eg({tasks:e,width:t=288}){let s=(0,v.usePathname)(),{refreshTasks:f,toggleSidebar:S}=eR(),$=(0,y.md)(C.e),{currentTeam:T}=(0,U.d)(),[I,D]=(0,n.useState)(!1),[L,R]=(0,n.useState)(!1),[P,M]=(0,n.useState)(!0),[z,B]=(0,n.useState)(!0),[O,F]=(0,n.useState)(!0),[V,W]=(0,n.useState)("tasks"),[q,J]=(0,n.useState)("tasks"),{resolvedTheme:H}=(0,ef.D)(),[Q,X]=(0,n.useState)(!1);(0,n.useEffect)(()=>{X(!0)},[]);let ee=(0,_.G)("TEAMS_ENABLED")&&!!T,ea=()=>{window.innerWidth<1024&&S()},en=(0,n.useMemo)(()=>{let t=new Map;return e.forEach(e=>{if(e.repoUrl)try{let s=new URL(e.repoUrl).pathname.split("/").filter(Boolean);if(s.length>=2){let a=s[0],n=s[1].replace(/\.git$/,""),r=`${a}/${n}`;if(t.has(r)){let s=t.get(r);s.taskCount++;let a=new Date(e.createdAt);a>s.lastUsed&&(s.lastUsed=a)}else t.set(r,{url:e.repoUrl,owner:a,name:n,taskCount:1,lastUsed:new Date(e.createdAt)})}}catch{}}),Array.from(t.values()).sort((e,t)=>t.lastUsed.getTime()-e.lastUsed.getTime())},[e]),er=async()=>{if(!P&&!z&&!O)return void N.oR.error("Please select at least one task type to delete");D(!0);try{let e=[];P&&e.push("completed"),z&&e.push("failed"),O&&e.push("stopped");let t=await fetch(`/api/tasks?action=${e.join(",")}`,{method:"DELETE"});if(t.ok){let e=await t.json();N.oR.success(e.message),await f(),R(!1)}else{let e=await t.json();N.oR.error(e.error||"Failed to delete tasks")}}catch(e){console.error("Error deleting tasks:",e),N.oR.error("Failed to delete tasks")}finally{D(!1)}};return $.user?(0,a.jsxs)("div",{className:"h-full border-r bg-muted px-2 md:px-3 pt-3 md:pt-5.5 pb-3 md:pb-4 overflow-y-auto",style:{width:`${t}px`},children:[(0,_.G)("TEAMS_ENABLED")&&(0,a.jsx)("div",{className:"mb-5 pb-3 border-b border-border/50 px-2",children:(0,a.jsxs)("div",{className:"pl-2",children:[(0,a.jsx)(ep.default,{src:Q&&"dark"===H?"/brand-logos/logo_Liatrio_reverse.svg":"/brand-logos/logo_Liatrio.svg",alt:"Liatrio",width:80,height:22,priority:!0}),(0,a.jsx)("p",{className:"text-[9px] font-semibold text-muted-foreground uppercase tracking-wider mt-1",children:"Enterprise Agentic Delivery"})]})}),(0,_.G)("TEAMS_ENABLED")&&(0,a.jsx)(G,{}),(0,a.jsx)(Z,{}),ee&&(0,a.jsxs)("div",{className:"mt-4 pt-3 border-t border-border/50",children:[(0,_.G)("VIBES_ENABLED")&&(0,a.jsxs)("div",{className:"flex items-center gap-1 mb-3 px-1",children:[(0,a.jsx)("button",{onClick:()=>J("tasks"),className:(0,p.cn)("text-xs font-medium tracking-wide transition-colors px-2 py-1 rounded","tasks"===q?"text-foreground bg-accent":"text-muted-foreground hover:text-foreground hover:bg-accent/50"),children:"Tasks"}),(0,a.jsx)("button",{onClick:()=>J("vibes"),className:(0,p.cn)("text-xs font-medium tracking-wide transition-colors px-2 py-1 rounded","vibes"===q?"text-foreground bg-accent":"text-muted-foreground hover:text-foreground hover:bg-accent/50"),children:"Prototypes"})]}),"tasks"===q&&(0,a.jsx)(Y,{onLinkClick:ea}),"vibes"===q&&(0,_.G)("VIBES_ENABLED")&&(0,a.jsx)(et,{onLinkClick:ea})]}),!ee&&(0,a.jsx)("div",{className:"mb-3 md:mb-4",children:(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsxs)("button",{onClick:()=>W("tasks"),className:(0,p.cn)("text-xs font-medium tracking-wide transition-colors px-2 py-1 rounded flex items-center gap-1","tasks"===V?"text-foreground bg-accent":"text-muted-foreground hover:text-foreground hover:bg-accent/50"),children:["Tasks",(0,a.jsx)(eh,{})]}),(0,a.jsx)("button",{onClick:()=>W("repos"),className:(0,p.cn)("text-xs font-medium tracking-wide transition-colors px-2 py-1 rounded","repos"===V?"text-foreground bg-accent":"text-muted-foreground hover:text-foreground hover:bg-accent/50"),children:"Repos"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(l.$,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>R(!0),disabled:I||0===e.length,title:"Delete Tasks",children:(0,a.jsx)(i.A,{className:"h-4 w-4"})}),(0,a.jsx)(g(),{href:"/",onClick:ea,children:(0,a.jsx)(l.$,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",title:"New Task",children:(0,a.jsx)(o.A,{className:"h-4 w-4"})})})]})]})}),!ee&&"tasks"===V&&(0,a.jsx)("div",{className:"space-y-1",children:0===e.length?(0,a.jsx)(r.Zp,{children:(0,a.jsx)(r.Wu,{className:"p-3 text-center text-xs text-muted-foreground",children:"No tasks yet. Create your first task!"})}):(0,a.jsxs)(a.Fragment,{children:[e.slice(0,10).map(e=>{let t,n,l=s===`/tasks/${e.id}`;return(0,a.jsx)(g(),{href:`/tasks/${e.id}`,onClick:ea,className:(0,p.cn)("block rounded-lg",l&&"ring-1 ring-primary/50 ring-offset-0"),children:(0,a.jsx)(r.Zp,{className:(0,p.cn)("cursor-pointer transition-colors hover:bg-accent p-0 rounded-lg",l&&"bg-accent"),children:(0,a.jsx)(r.Wu,{className:"px-3 py-2",children:(0,a.jsx)("div",{className:"flex gap-2",children:(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-1",children:[(0,a.jsx)("h3",{className:(0,p.cn)("text-xs font-medium truncate mb-0.5",("processing"===e.status||"initializing"===e.status)&&"bg-gradient-to-r from-muted-foreground from-20% via-white via-50% to-muted-foreground to-80% bg-clip-text text-transparent bg-[length:300%_100%] animate-[shimmer_1.5s_linear_infinite]"),children:(t=e.title||e.prompt).slice(0,50)+(t.length>50?"...":"")}),"planned"===e.status&&(0,a.jsx)(k.Bc,{delayDuration:200,children:(0,a.jsxs)(k.m_,{children:[(0,a.jsx)(k.k$,{asChild:!0,children:(0,a.jsx)(c.A,{className:"h-3 w-3 text-violet-500 flex-shrink-0"})}),(0,a.jsx)(k.ZI,{side:"right",className:"text-xs",children:"Planned"})]})}),"initializing"===e.status&&(0,a.jsx)(d.A,{className:"h-3 w-3 text-cyan-500 animate-spin flex-shrink-0"}),"error"===e.status&&(0,a.jsx)(u.A,{className:"h-3 w-3 text-red-500 flex-shrink-0"}),"timed_out"===e.status&&(0,a.jsx)(k.Bc,{delayDuration:200,children:(0,a.jsxs)(k.m_,{children:[(0,a.jsx)(k.k$,{asChild:!0,children:(0,a.jsx)(m.A,{className:"h-3 w-3 text-orange-500 flex-shrink-0"})}),(0,a.jsx)(k.ZI,{side:"right",className:"text-xs",children:"Timed out"})]})}),"stopped"===e.status&&(0,a.jsx)(u.A,{className:"h-3 w-3 text-orange-500 flex-shrink-0"}),"completed"===e.status&&e.manuallyCompleted&&(0,a.jsx)(k.Bc,{delayDuration:200,children:(0,a.jsxs)(k.m_,{children:[(0,a.jsx)(k.k$,{asChild:!0,children:(0,a.jsx)(x.A,{className:"h-3 w-3 text-emerald-500 flex-shrink-0"})}),(0,a.jsx)(k.ZI,{side:"right",className:"text-xs",children:"Manually completed"})]})})]}),e.repoUrl&&(0,a.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground mb-0.5",children:[e.prStatus&&(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(A.W,{status:e.prStatus}),(0,a.jsx)(E.$,{taskId:e.id,prStatus:e.prStatus,isActive:l})]}),(0,a.jsx)("span",{className:"truncate",children:(()=>
1{try{let t=new URL(e.repoUrl).pathname.split("/").filter(Boolean);if(t.length>=2)return`${t[0]}/${t[1].replace(/\.git$/,"")}`;return"Unknown repository"}catch{return"Invalid repository URL"}})()})]}),e.selectedAgent&&(0,a.jsxs)("div",{className:"flex items-center gap-1 text-xs text-muted-foreground",children:[(n=(0,j.Bv)(e.selectedAgent))?(0,a.jsx)(n,{className:"w-3 h-3"}):null,e.selectedModel&&(0,a.jsx)("span",{className:"truncate",children:(0,j.$L)(e.selectedAgent,e.selectedModel)})]}),(0,a.jsx)(es.V,{taskId:e.id,enabled:"completed"===e.status}),ee&&e.creator&&(0,a.jsxs)("div",{className:"flex items-center gap-1.5 text-xs text-muted-foreground mt-0.5",children:[(0,a.jsxs)(K.eu,{className:"h-3.5 w-3.5",children:[(0,a.jsx)(K.BK,{src:e.creator.avatarUrl||void 0}),(0,a.jsx)(K.q5,{className:"text-[8px]",children:(e.creator.name||e.creator.username||"?").charAt(0).toUpperCase()})]}),(0,a.jsx)("span",{className:"truncate",children:e.creator.name||e.creator.username||"Unknown"})]})]})})})})},e.id)}),e.length>=1&&(0,a.jsx)("div",{className:"pt-1",children:(0,a.jsx)(g(),{href:"/tasks",onClick:ea,children:(0,a.jsx)(l.$,{variant:"ghost",size:"sm",className:"w-full justify-start h-7 px-2 text-xs",children:"View All Tasks"})})})]})}),!ee&&"repos"===V&&(0,a.jsx)("div",{className:"space-y-1",children:0===en.length?(0,a.jsx)(r.Zp,{children:(0,a.jsx)(r.Wu,{className:"p-3 text-center text-xs text-muted-foreground",children:"No repositories yet. Create a task with a repository!"})}):en.map(e=>{let t=`/repos/${e.owner}/${e.name}`,n=s===t||s.startsWith(t+"/");return(0,a.jsx)(g(),{href:t,onClick:ea,className:(0,p.cn)("block rounded-lg",n&&"ring-1 ring-primary/50 ring-offset-0"),children:(0,a.jsx)(r.Zp,{className:(0,p.cn)("cursor-pointer transition-colors hover:bg-accent p-0 rounded-lg",n&&"bg-accent"),children:(0,a.jsx)(r.Wu,{className:"px-3 py-2",children:(0,a.jsxs)("div",{className:"flex gap-2 items-center",children:[(0,a.jsx)(h.A,{className:"h-4 w-4 text-muted-foreground flex-shrink-0"}),(0,a.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,a.jsxs)("h3",{className:"text-xs font-medium truncate mb-0.5",children:[e.owner,"/",e.name]}),(0,a.jsxs)("div",{className:"text-xs text-muted-foreground",children:[e.taskCount," ",1===e.taskCount?"task":"tasks"]})]})]})})})},`${e.owner}/${e.name}`)})}),(0,a.jsx)(b.Lt,{open:L,onOpenChange:R,children:(0,a.jsxs)(b.EO,{children:[(0,a.jsxs)(b.wd,{children:[(0,a.jsx)(b.r7,{children:"Delete Tasks"}),(0,a.jsx)(b.$v,{children:"Select which types of tasks you want to delete. This action cannot be undone."})]}),(0,a.jsx)("div",{className:"py-4",children:(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(w.S,{id:"delete-completed",checked:P,onCheckedChange:e=>M(!0===e)}),(0,a.jsx)("label",{htmlFor:"delete-completed",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Delete Completed Tasks"})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(w.S,{id:"delete-failed",checked:z,onCheckedChange:e=>B(!0===e)}),(0,a.jsx)("label",{htmlFor:"delete-failed",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Delete Failed Tasks"})]}),(0,a.jsxs)("div",{className:"flex items-center space-x-2",children:[(0,a.jsx)(w.S,{id:"delete-stopped",checked:O,onCheckedChange:e=>F(!0===e)}),(0,a.jsx)("label",{htmlFor:"delete-stopped",className:"text-sm font-medium leading-none peer-disabled:cursor-not-allowed peer-disabled:opacity-70",children:"Delete Stopped Tasks"})]})]})}),(0,a.jsxs)(b.ck,{children:[(0,a.jsx)(b.Zr,{children:"Cancel"}),(0,a.jsx)(b.Rx,{onClick:er,disabled:I||!P&&!z&&!O,className:"bg-red-600 hover:bg-red-700",children:I?"Deleting...":"Delete Tasks"})]})]})})]}):(0,a.jsxs)("div",{className:"h-full border-r bg-muted px-2 md:px-3 pt-3 md:pt-5.5 pb-3 md:pb-4 overflow-y-auto flex flex-col",style:{width:`${t}px`},children:[(0,a.jsx)("div",{className:"mb-3 md:mb-4",children:(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)("button",{onClick:()=>W("tasks"),className:(0,p.cn)("text-xs font-medium tracking-wide transition-colors px-2 py-1 rounded","tasks"===V?"text-foreground bg-accent":"text-muted-foreground hover:text-foreground hover:bg-accent/50"),children:"Tasks"}),(0,a.jsx)("button",{onClick:()=>W("repos"),className:(0,p.cn)("text-xs font-medium tracking-wide transition-colors px-2 py-1 rounded","repos"===V?"text-foreground bg-accent":"text-muted-foreground hover:text-foreground hover:bg-accent/50"),children:"Repos"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(l.$,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",onClick:()=>R(!0),disabled:!0,title:"Delete Tasks",children:(0,a.jsx)(i.A,{className:"h-4 w-4"})}),(0,a.jsx)(g(),{href:"/",onClick:ea,children:(0,a.jsx)(l.$,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",title:"New Task",children:(0,a.jsx)(o.A,{className:"h-4 w-4"})})})]})]})}),(0,a.jsxs)("div",{className:"space-y-1",children:["tasks"===V&&(0,a.jsx)(r.Zp,{children:(0,a.jsx)(r.Wu,{className:"p-3 text-center text-xs text-muted-foreground",children:"Sign in to view and create tasks"})}),"repos"===V&&(0,a.jsx)(r.Zp,{children:(0,a.jsx)(r.Wu,{className:"p-3 text-center text-xs text-muted-foreground",children:"Sign in to view repositories"})})]})]})}var ev=s(75587),ej=s(72436),eb=s(75275),ew=s(59804),ek=s(52616);let eN=(0,n.createContext)(null);function ey({children:e}){let{currentTeam:t,refreshTeams:s}=(0,U.d)(),r=t?.id;!function(){let{currentTeam:e}=(0,U.d)(),t=(0,n.useRef)(0),s=(0,n.useRef)(e?.id);(0,n.useEffect)(()=>{s.current=e?.id},[e?.id]);let a=(0,n.useCallback)(async()=>{let e=s.current;if(!e)return;let a=Date.now();if(!(a-t.current<3e4)){t.current=a;try{await fetch(`/api/teams/${e}/activity`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({timestamp:a})})}catch(e){console.debug("[Activity] Failed to report activity:",e)}}},[]);(0,n.useEffect)(()=>
1{if(!e?.id)return;let t=["mousemove","keydown","click","touchstart","scroll"],s=null,n=()=>{s||(s=requestAnimationFrame(()=>{a(),s=null}))};return t.forEach(e=>{window.addEventListener(e,n,{passive:!0})}),a(),()=>{t.forEach(e=>{window.removeEventListener(e,n)}),s&&cancelAnimationFrame(s)}},[e?.id,a])}();let l=(0,n.useCallback)(e=>{let t=e.payload;N.oR.info(`New task created by ${t.username||"a team member"}`,{description:t.title||"New task"}),window.dispatchEvent(new CustomEvent("team-task-created",{detail:e}))},[]),i=(0,n.useCallback)(e=>{let t=e.payload;"completed"===t.status?N.oR.success(`Task completed by ${t.username||"a team member"}`,{description:t.title||"Task"}):"error"===t.status&&N.oR.error("Task failed",{description:t.title||"Task"}),window.dispatchEvent(new CustomEvent("team-task-updated",{detail:e}))},[]),o=(0,n.useCallback)(e=>{window.dispatchEvent(new CustomEvent("team-task-deleted",{detail:e}))},[]),c=(0,n.useCallback)(e=>{let t=e.payload;N.oR.info(`${t.name||t.username} joined the team`),s?.()},[s]),d=(0,n.useCallback)(e=>{let t=e.payload;N.oR.info(`${t.name||t.username} left the team`),s?.()},[s]),u=(0,n.useCallback)(e=>{let t=e.payload;N.oR.info(`${t.name||t.username}'s role changed to ${t.newRole}`),s?.()},[s]),m=(0,n.useCallback)(e=>{window.dispatchEvent(new CustomEvent("team-presence-update",{detail:e}))},[]),x=(0,n.useCallback)(e=>{e?console.log("[TeamEvents] Connected to team events"):console.log("[TeamEvents] Connection lost, will attempt to reconnect...")},[]),h=(0,n.useMemo)(()=>({onTaskCreated:l,onTaskUpdated:i,onTaskDeleted:o,onMemberJoined:c,onMemberRemoved:d,onMemberRoleChanged:u,onPresenceUpdate:m,onConnectionChange:x}),[l,i,o,c,d,u,m,x]),{isConnected:p,lastEvent:f,reconnect:g}=function(e={}){let t=function(e={}){let{currentTeam:t}=(0,U.d)(),[s,a]=(0,n.useState)(!1),[r,l]=(0,n.useState)(null),[i,o]=(0,n.useState)([]),c=(0,n.useRef)(null),d=(0,n.useRef)(null),u=(0,n.useRef)(!1),m=(0,n.useRef)(e);(0,n.useEffect)(()=>{m.current=e});let x=t?.id,h=(0,n.useCallback)(()=>{d.current&&clearTimeout(d.current),u.current&&c.current&&m.current.userId&&m.current.username&&(u.current=!1,(0,ek.xZ)(c.current,{userId:m.current.userId,username:m.current.username,status:"online"})),d.current=setTimeout(()=>{c.current&&m.current.userId&&m.current.username&&(u.current=!0,(0,ek.xZ)(c.current,{userId:m.current.userId,username:m.current.username,status:"idle"}))},3e5)},[]);(0,n.useEffect)(()=>{let e=()=>h();return window.addEventListener("mousemove",e),window.addEventListener("keydown",e),window.addEventListener("click",e),window.addEventListener("scroll",e),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("keydown",e),window.removeEventListener("click",e),window.removeEventListener("scroll",e),d.current&&clearTimeout(d.current)}},[h]);let p=(0,n.useCallback)(()=>{c.current&&c.current.subscribe()},[]);return(0,n.useEffect)(()=>{if(!x)return;let t=(0,ek.Zt)(x,{onTaskChange:e=>{let t=function(e,t){let s,a=t.new||t.old;if(!a)return null;switch(t.eventType){case"INSERT":s="task.created";break;case"UPDATE":s="task.updated";break;case"DELETE":s="task.deleted";break;default:return null}return{id:`${t.eventType}-${a.id||Date.now()}`,type:s,teamId:e,payload:{taskId:a.id,title:a.title,status:a.status,progress:a.progress,userId:a.user_id},timestamp:Date.now()}}(x,e);if(t){l(t);let e=m.current;switch(t.type){case"task.created":e.onTaskCreated?.(t);break;case"task.updated":e.onTaskUpdated?.(t);break;case"task.deleted":e.onTaskDeleted?.(t)}}},onMemberChange:e=>{let t=function(e,t){let s,a=t.new||t.old;if(!a)return null;switch(t.eventType){case"INSERT":s="member.joined";break;case"DELETE":s="member.removed";break;case"UPDATE":s="member.role_changed";break;default:return null}return{id:`${t.eventType}-${a.user_id||Date.now()}`,type:s,teamId:e,payload:{userId:a.user_id,username:"",role:a.role},timestamp:Date.now()}}(x,e);if(t){l(t);let e=m.current;switch(t.type){case"member.joined":e.onMemberJoined?.(t);break;case"member.removed":e.onMemberRemoved?.(t);break;case"member.role_changed":e.onMemberRoleChanged?.(t)}}},onPresenceSync:e=>{let t=Object.values(e).flat();o(t);let s=m.current;
1t.forEach(e=>{let t={id:`presence-${e.userId}-${Date.now()}`,type:"presence.update",teamId:x,payload:{userId:e.userId,username:e.username,status:e.status},timestamp:Date.now()};s.onPresenceUpdate?.(t)})},onPresenceJoin:(e,t,s)=>{let a=m.current;s.forEach(e=>{let t={id:`presence-join-${e.userId}-${Date.now()}`,type:"presence.update",teamId:x,payload:{userId:e.userId,username:e.username,status:"online"},timestamp:Date.now()};l(t),a.onPresenceUpdate?.(t)})},onPresenceLeave:(e,t,s)=>{let a=m.current;s.forEach(e=>{let t={id:`presence-leave-${e.userId}-${Date.now()}`,type:"presence.update",teamId:x,payload:{userId:e.userId,username:e.username,status:"offline"},timestamp:Date.now()};l(t),a.onPresenceUpdate?.(t)})}});return c.current=t,t.subscribe(async s=>{"SUBSCRIBED"===s?(a(!0),m.current.onConnectionChange?.(!0),e.userId&&e.username&&(await (0,ek.hU)(t,{userId:e.userId,username:e.username,status:"online"}),h())):("CLOSED"===s||"CHANNEL_ERROR"===s)&&(a(!1),m.current.onConnectionChange?.(!1))}),()=>{d.current&&clearTimeout(d.current),(0,ek.cR)(t),c.current=null,a(!1)}},[x,e.userId,e.username,h]),{isConnected:s,lastEvent:r,reconnect:p,onlineUsers:i}}({onTaskCreated:e.onTaskCreated,onTaskUpdated:e.onTaskUpdated,onTaskDeleted:e.onTaskDeleted,onMemberJoined:e.onMemberJoined,onMemberRemoved:e.onMemberRemoved,onMemberRoleChanged:e.onMemberRoleChanged,onPresenceUpdate:e.onPresenceUpdate,onConnectionChange:e.onConnectionChange});return{isConnected:t.isConnected,lastEvent:t.lastEvent,reconnect:t.reconnect}}(r?h:{}),v=(0,n.useMemo)(()=>({isConnected:p,lastEvent:f,reconnect:g}),[p,f,g]);return(0,a.jsx)(eN.Provider,{value:v,children:e})}var eC=s(61196),eA=s(71286),eE=s(83850),eS=s(4172),e$=s(99313),eT=s(29849),eI=s(81516);function eD(){let e=(0,v.useRouter)(),{addTaskOptimistically:t,refreshTasks:s}=eR(),{currentTeam:r}=(0,U.d)(),l=(0,_.G)("TEAMS_ENABLED"),[i,o]=(0,y.fp)(eT.em),[c,d]=(0,n.useState)(!1),u=(0,y.Xr)(eI.n),[m]=(0,y.fp)(eT.z$),[x,h]=(0,y.fp)(eT.y9),[p,f]=(0,y.fp)(eT.ef),[g,j]=(0,y.fp)(eT.M5),[b,w]=(0,n.useState)(""),[k,C]=(0,n.useState)(""),A=(0,y.md)(e$.Z),E=!!g,S=g?.projectId||m;(0,n.useEffect)(()=>{i&&(g?.repoOwner&&g?.repoName?(w(g.repoOwner),C(g.repoName)):g?.repoOwner?(w(g.repoOwner),C("")):(x&&w(x),p&&C(p)))},[i,g,x,p]),(0,n.useEffect)(()=>{i||j(null)},[i,j]);let $=(0,n.useCallback)(async a=>{d(!0);try{let n=`https://github.com/${b}/${k}`,i={prompt:a.prompt,repoUrl:n,selectedAgent:a.selectedAgent,selectedModel:a.selectedModel,selectedModels:a.selectedModels,installDependencies:a.installDependencies,maxDuration:a.maxDuration,keepAlive:a.keepAlive,enableSpecDrivenWorkflow:a.enableSpecDrivenWorkflow,enableClaudeFlow:a.enableClaudeFlow,teamId:l&&r?r.id:null,projectId:a.projectId,visibility:l&&r?"team":"personal"},{id:c}=t({prompt:i.prompt,repoUrl:i.repoUrl,selectedAgent:i.selectedAgent,selectedModel:i.selectedModel,installDependencies:i.installDependencies,maxDuration:i.maxDuration}),d=await fetch("/api/tasks",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify(i)});if(!d.ok){let e=await d.json();throw Error(e.error?.message||"Failed to create task")}let m=await d.json(),x=m.task?.id||c;o(!1),u(""),N.oR.success("Task created successfully"),await s(),e.push(`/tasks/${x}`)}catch(e){N.oR.error(e instanceof Error?e.message:"Failed to create task")}finally{d(!1)}},[b,k,l,r,t,s,e,o,u]);return A.connected?(0,a.jsx)(eC.lG,{open:i,onOpenChange:o,children:(0,a.jsxs)(eC.Cf,{className:"sm:max-w-[800px]",children:[(0,a.jsx)(eC.c7,{children:(0,a.jsx)(eC.L3,{children:"Create New Task"})}),(0,a.jsxs)("div",{className:"space-y-4 py-4",children:[(0,a.jsxs)("div",{className:"space-y-2",children:[(0,a.jsx)(eA.J,{children:"Repository"}),(0,a.jsx)("div",{className:"flex items-center gap-2 p-2 border rounded-md bg-muted/30",children:(0,a.jsx)(eS.t,{selectedOwner:b,selectedRepo:k,onOwnerChange:e=>{w(e),h(e)},onRepoChange:e=>{C(e),f(e)},disabled:c,preferredOwner:r?.settings?.githubOrganization||void 0})})]}),(0,a.jsx)(eE.e,{onSubmit:$,isSubmitting:c,selectedOwner:b,selectedRepo:k,hideHeader:!0,hideVisibilitySelector:!0,forceVisibility:l&&r?"team":"personal",initialProjectId:S,hideProjectSelector:E,disabled:!b||!k})]})]})}):null}let eL=(0,n.createContext)(void 0),eR=()=>{let e=(0,n.useContext)(eL);if(!e)throw Error("useTasks must be used within AppLayout");return e};function eP({width:e}){return(0,a.jsxs)("div",{className:"h-full border-r bg-muted px-2 md:px-3 pb-3 pt-3 md:pt-5.5 overflow-y-auto",style:{width:`${e}px`},children:[(0,a.jsxs)("div",{className:"mb-3 md:mb-4",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,a.jsx)("div",{className:"flex-1"}),(0,a.jsxs)("div",{className:"flex items-center gap-1",children:[(0,a.jsx)(l.$,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",disabled:!0,title:"Delete Tasks",children:(0,a.jsx)(i.A,{className:"h-4 w-4"})}),(0,a.jsx)(g(),{href:"/",children:(0,a.jsx)(l.$,{variant:"ghost",size:"sm",className:"h-8 w-8 p-0",title:"New Task",children:(0,a.jsx)(o.A,{className:"h-4 w-4"})})})]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-1 px-1",children:[(0,a.jsx)("button",{className:"text-xs font-medium uppercase tracking-wide transition-colors px-2 py-1 rounded text-foreground bg-accent",disabled:!0,children:"Tasks"}),(0,a.jsx)("button",{className:"text-xs font-medium uppercase tracking-wide transition-colors px-2 py-1 rounded text-muted-foreground hover:text-foreground hover:bg-accent/50",disabled:!0,children:"Repos"})]})]}),(0,a.jsx)("div",{className:"space-y-1",children:Array.from({length:3}).map((e,t)=>(0,a.jsx)(r.Zp,{className:"animate-pulse h-[70px] rounded-lg",children:(0,a.jsx)(r.Wu,{className:"px-3 py-2"})},t))})]})}function eM({children:e,initialSidebarWidth:t,initialSidebarOpen:s,initialIsMobile:n}){return(0,a.jsx)(U.Z,{children:(0,a.jsx)(eU,{initialSidebarWidth:t,initialSidebarOpen:s,initialIsMobile:n,children:e})})}function eU({children:e,initialSidebarWidth:t,initialSidebarOpen:s,initialIsMobile:r}){var l;let i,o,c,d,{currentTeam:u}
1=(0,U.d)(),m=(0,y.md)(C.e),[x,h]=(0,n.useState)([]),[p,f]=(0,n.useState)(!0),{preferences:g}=(0,ew.K)();l=m.user?.id,i=(0,v.useRouter)(),o=(0,n.useRef)(new Set),c=(0,n.useRef)(new Map),d=(0,n.useCallback)((e,t)=>{if(!g)return;let s={feedback:"Task needs your attention",completed:"Task completed - ready for review",error:"Task failed"},a={feedback:e.title||e.prompt?.slice(0,50)||"A task is waiting for your feedback",completed:e.title||e.prompt?.slice(0,50)||"A task has completed successfully",error:e.title||e.prompt?.slice(0,50)||"A task encountered an error"};g.sound[t]&&(0,em.Wh)(),g.browser[t]&&(0,em.dL)(s[t],a[t],()=>{i.push(`/tasks/${e.id}`)}),g.toast[t]&&("error"===t?N.oR.error:"completed"===t?N.oR.success:N.oR.warning)(s[t],{description:a[t],duration:"feedback"===t?1/0:1e4,action:{label:"View Task",onClick:()=>{i.push(`/tasks/${e.id}`)}}})},[i,g]),(0,n.useEffect)(()=>{x.forEach(e=>{let t=c.current.get(e.id),s=e.status,a=`${e.id}-${s}`,n=!l||e.userId===l;n&&"awaiting_feedback"===s&&"awaiting_feedback"!==t&&!o.current.has(a)&&(o.current.add(a),d(e,"feedback")),n&&"completed"===s&&"processing"===t&&!o.current.has(a)&&(o.current.add(a),d(e,"completed")),n&&"error"===s&&"processing"===t&&!o.current.has(a)&&(o.current.add(a),d(e,"error")),c.current.set(e.id,s)});let e=new Set(x.map(e=>e.id));c.current.forEach((t,s)=>{e.has(s)||c.current.delete(s)})},[x,d,l]),x.filter(e=>"awaiting_feedback"===e.status).length,x.filter(e=>"completed"===e.status).length;let[j,b]=(0,n.useState)(()=>!r&&(s??!0)),[w,k]=(0,n.useState)(t||288),[A,E]=(0,n.useState)(!1),[S,$]=(0,n.useState)(!r),[T,I]=(0,n.useState)(!1),D=(0,n.useCallback)((e,t=!0)=>{b(e),t&&window.innerWidth>=1024&&(0,ev.po)(e)},[]);(0,n.useEffect)(()=>{let e=window.innerWidth>=1024;if(e!==S?($(e),e?e&&r&&b((0,ev.Z6)()??s??!0):b(!1)):e&&!r&&void 0===s&&(b(!0),(0,ev.po)(!0)),!t){let e=(0,ev.N7)();e!==w&&k(e)}I(!0)},[S,r,s,t,w]);let L=(0,n.useCallback)(()=>{D(!j)},[j,D]),R=(0,n.useCallback)(async()=>{try{let e="/api/tasks";u?.id&&(0,_.G)("TEAMS_ENABLED")&&(e+=`?teamId=${u.id}`);let t=await fetch(e);if(t.ok){let e=await t.json();h(e.tasks)}else 401===t.status&&h([])}catch(e){console.error("Error fetching tasks:",e)}finally{f(!1)}},[u?.id]);(0,n.useEffect)(()=>{R()},[R]),(0,n.useEffect)(()=>{let e=setInterval(()=>{R()},5e3);return()=>clearInterval(e)},[R]),(0,n.useEffect)(()=>{let e=()=>{let e=window.innerWidth>=1024;$(e),!e&&j?b(!1):!e||S||j||b((0,ev.Z6)()??!0)};return window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[j,S]);let P=(0,y.Xr)(eT.em),M=(0,y.Xr)(eu);return(0,n.useEffect)(()=>{M(x)},[x,M]),(0,n.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"b"===e.key&&(e.preventDefault(),L()),(e.metaKey||e.ctrlKey)&&"k"===e.key&&(e.preventDefault(),P(!0))};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[L,P]),(0,n.useEffect)(()=>{let e=e=>{if(!A)return;let t=e.clientX;t>=200&&t<=600&&(k(t),(0,ev.xT)(t))},t=()=>{E(!1)};return A&&(document.addEventListener("mousemove",e),document.addEventListener("mouseup",t),document.body.style.cursor="col-resize",document.body.style.userSelect="none"),()=>{document.removeEventListener("mousemove",e),document.removeEventListener("mouseup",t),document.body.style.cursor="",document.body.style.userSelect=""}},[A]),(0,a.jsx)(eL.Provider,{value:{refreshTasks:R,toggleSidebar:L,isSidebarOpen:j,isSidebarResizing:A,addTaskOptimistically:e=>{let t=(0,ej.Ak)(),s=u?.id&&(0,_.G)("TEAMS_ENABLED")?u.id:null,a={id:t,userId:"temp",prompt:e.prompt,title:null,repoUrl:e.repoUrl,selectedAgent:e.selectedAgent,selectedModel:e.selectedModel,installDependencies:e.installDependencies,maxDuration:e.maxDuration,keepAlive:!1,status:"pending",progress:0,logs:[],error:null,branchName:null,sandboxId:null,sandboxLastHeartbeat:null,sandboxHealthStatus:null,sandboxExtensionCount:null,agentSessionId:null,
1sandboxUrl:null,previewUrl:null,mcpServerIds:null,specId:null,featureId:null,prUrl:null,prNumber:null,prStatus:null,prMergeCommitSha:null,createdAt:new Date,updatedAt:new Date,completedAt:null,deletedAt:null,teamId:s,visibility:s?"team":"personal",projectId:null,productId:null,prdId:null,sourceTaskItemId:null,specContextProvided:!1,manuallyCompleted:!1,enableThinking:!0,continuationCount:null,needsIntervention:null,interventionReason:null,creator:null};return h(e=>[a,...e]),{id:t,optimisticTask:a}}},children:(0,a.jsx)(ey,{children:(0,a.jsx)(eb.O,{children:(0,a.jsxs)("div",{className:"h-dvh flex relative",style:{"--sidebar-width":`${w}px`,"--sidebar-open":j?"1":"0"},suppressHydrationWarning:!0,children:[j&&(0,a.jsx)("div",{className:"lg:hidden fixed inset-0 bg-black/50 z-30",onClick:()=>{D(!1,!1)}}),(0,a.jsx)("div",{className:` 2 fixed inset-y-0 left-0 z-40 3 ${A||!T?"":"transition-all duration-300 ease-in-out"} 4 ${j?"translate-x-0":"-translate-x-full"} 5 ${j?"pointer-events-auto":"pointer-events-none"} 6 `,style:{width:`${w}px`},children:(0,a.jsx)("div",{className:"h-full overflow-hidden",style:{width:`${w}px`},children:p?(0,a.jsx)(eP,{width:w}):(0,a.jsx)(eg,{tasks:x,width:w})})}),(0,a.jsxs)("div",{className:` 7 hidden lg:block fixed inset-y-0 cursor-col-resize group z-50 hover:bg-primary/20 8 ${A||!T?"":"transition-all duration-300 ease-in-out"} 9 ${j?"w-1 opacity-100":"w-0 opacity-0"} 10 `,onMouseDown:j?e=>{e.preventDefault(),E(!0)}:void 0,style:{left:j?`${w}px`:"0px"},children:[(0,a.jsx)("div",{className:"absolute inset-0 w-2 -ml-0.5"}),(0,a.jsx)("div",{className:"absolute inset-y-0 left-0 w-0.5 bg-primary/50 opacity-0 group-hover:opacity-100 transition-opacity"})]}),(0,a.jsx)("div",{className:`flex-1 overflow-auto flex flex-col ${A||!T?"":"transition-all duration-300 ease-in-out"}`,style:{marginLeft:S&&j?`${w+4}px`:"0px"},children:e}),(0,a.jsx)(eD,{}),(0,a.jsx)(ex,{})]})})})})}}}]);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.