tower-studio 0.1.8 → 0.1.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.next/BUILD_ID +1 -1
- package/.next/build-manifest.json +3 -3
- package/.next/cache/.previewinfo +1 -1
- package/.next/cache/.rscinfo +1 -1
- package/.next/diagnostics/route-bundle-stats.json +37 -37
- package/.next/fallback-build-manifest.json +3 -3
- package/.next/prerender-manifest.json +3 -3
- package/.next/server/app/_global-error.html +1 -1
- package/.next/server/app/_global-error.rsc +1 -1
- package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
- package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/_not-found/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/_not-found/page/server-reference-manifest.json +23 -23
- package/.next/server/app/_not-found/page.js.nft.json +1 -1
- package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/.next/server/app/_not-found.html +1 -1
- package/.next/server/app/_not-found.rsc +13 -13
- package/.next/server/app/_not-found.segments/_full.segment.rsc +13 -13
- package/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
- package/.next/server/app/_not-found.segments/_index.segment.rsc +8 -8
- package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
- package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/api/browse-fs/route.js.nft.json +1 -1
- package/.next/server/app/api/files/assets/[projectId]/[filename]/route.js.nft.json +1 -1
- package/.next/server/app/api/git/route.js.nft.json +1 -1
- package/.next/server/app/api/internal/assets/[projectId]/[filename]/route.js.nft.json +1 -1
- package/.next/server/app/api/internal/assets/reveal/route.js.nft.json +1 -1
- package/.next/server/app/api/internal/assistant/chat/route.js.nft.json +1 -1
- package/.next/server/app/api/internal/assistant/images/route.js.nft.json +1 -1
- package/.next/server/app/api/internal/assistant/sessions/route.js.nft.json +1 -1
- package/.next/server/app/api/internal/cache/[...segments]/route.js.nft.json +1 -1
- package/.next/server/app/api/internal/hooks/upload/route.js.nft.json +1 -1
- package/.next/server/app/api/internal/terminal/[taskId]/start/route.js.nft.json +1 -1
- package/.next/server/app/api/tasks/[taskId]/merge/route.js.nft.json +1 -1
- package/.next/server/app/index.html +1 -1
- package/.next/server/app/index.rsc +13 -13
- package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
- package/.next/server/app/index.segments/_full.segment.rsc +13 -13
- package/.next/server/app/index.segments/_head.segment.rsc +4 -4
- package/.next/server/app/index.segments/_index.segment.rsc +8 -8
- package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/missions/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/missions/page/server-reference-manifest.json +51 -51
- package/.next/server/app/missions/page.js.nft.json +1 -1
- package/.next/server/app/missions/page_client-reference-manifest.js +1 -1
- package/.next/server/app/onboarding/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/onboarding/page/server-reference-manifest.json +23 -23
- package/.next/server/app/onboarding/page.js.nft.json +1 -1
- package/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
- package/.next/server/app/onboarding.html +1 -1
- package/.next/server/app/onboarding.rsc +15 -15
- package/.next/server/app/onboarding.segments/_full.segment.rsc +15 -15
- package/.next/server/app/onboarding.segments/_head.segment.rsc +4 -4
- package/.next/server/app/onboarding.segments/_index.segment.rsc +8 -8
- package/.next/server/app/onboarding.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/onboarding.segments/onboarding.segment.rsc +3 -3
- package/.next/server/app/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/page/server-reference-manifest.json +23 -23
- package/.next/server/app/page.js.nft.json +1 -1
- package/.next/server/app/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/settings/page/server-reference-manifest.json +32 -32
- package/.next/server/app/settings/page.js.nft.json +1 -1
- package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
- package/.next/server/app/settings.html +1 -1
- package/.next/server/app/settings.rsc +15 -15
- package/.next/server/app/settings.segments/_full.segment.rsc +15 -15
- package/.next/server/app/settings.segments/_head.segment.rsc +4 -4
- package/.next/server/app/settings.segments/_index.segment.rsc +8 -8
- package/.next/server/app/settings.segments/_tree.segment.rsc +1 -1
- package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +4 -4
- package/.next/server/app/settings.segments/settings.segment.rsc +3 -3
- package/.next/server/app/workspaces/[workspaceId]/archive/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/archive/page/server-reference-manifest.json +77 -77
- package/.next/server/app/workspaces/[workspaceId]/archive/page.js.nft.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/archive/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspaces/[workspaceId]/assets/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/assets/page/server-reference-manifest.json +64 -64
- package/.next/server/app/workspaces/[workspaceId]/assets/page.js.nft.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/assets/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspaces/[workspaceId]/notes/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/notes/page/server-reference-manifest.json +55 -55
- package/.next/server/app/workspaces/[workspaceId]/notes/page.js.nft.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/notes/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspaces/[workspaceId]/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/page/server-reference-manifest.json +51 -51
- package/.next/server/app/workspaces/[workspaceId]/page.js.nft.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/server-reference-manifest.json +23 -23
- package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page.js.nft.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/server-reference-manifest.json +56 -56
- package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js.nft.json +1 -1
- package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
- package/.next/server/app/workspaces/page/react-loadable-manifest.json +1 -1
- package/.next/server/app/workspaces/page/server-reference-manifest.json +41 -41
- package/.next/server/app/workspaces/page.js.nft.json +1 -1
- package/.next/server/app/workspaces/page_client-reference-manifest.js +1 -1
- package/.next/server/chunks/10ge_next_dist_esm_build_templates_app-route_13~vb_i.js +2 -2
- package/.next/server/chunks/[root-of-the-server]__043lk8~._.js +2 -2
- package/.next/server/chunks/ssr/0~.g_src_app_workspaces_[workspaceId]_tasks_[taskId]_task-page-client_tsx_0bbseig._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0.8y0n9._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__01ws4-7._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__02ipahf._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0bk3s4l._.js +1 -1
- package/.next/server/chunks/ssr/{[root-of-the-server]__0~jc3l5._.js → [root-of-the-server]__0i1tzvg._.js} +2 -2
- package/.next/server/chunks/ssr/{[root-of-the-server]__0hvz_0c._.js → [root-of-the-server]__0i52qt7._.js} +2 -2
- package/.next/server/chunks/ssr/[root-of-the-server]__0l~dc3x._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0rs7pkn._.js +1 -1
- package/.next/server/chunks/ssr/[root-of-the-server]__0sysz2q._.js +3 -3
- package/.next/server/chunks/ssr/[root-of-the-server]__0y-lkvf._.js +1 -1
- package/.next/server/chunks/ssr/{[root-of-the-server]__0mab0km._.js → [root-of-the-server]__0yuwh~5._.js} +2 -2
- package/.next/server/chunks/ssr/[root-of-the-server]__12f810l._.js +1 -1
- package/.next/server/chunks/ssr/{tower_00.hg6u._.js → tower_0.csoof._.js} +2 -2
- package/.next/server/chunks/ssr/{tower_12sld1c._.js → tower_005_jvc._.js} +2 -2
- package/.next/server/chunks/ssr/{tower_09~lpto._.js → tower_0c8unc1._.js} +2 -2
- package/.next/server/chunks/ssr/{tower_0gzwyem._.js → tower_0cmuq4n._.js} +2 -2
- package/.next/server/chunks/ssr/tower_0ih8lcc._.js +3 -0
- package/.next/server/chunks/ssr/tower_0kl_bfy._.js +1 -1
- package/.next/server/chunks/ssr/tower_0mz4ut.._.js +1 -1
- package/.next/server/chunks/ssr/tower_0pcqezm._.js +1 -1
- package/.next/server/chunks/ssr/{tower_0vo6u9i._.js → tower_0tjo~2z._.js} +2 -2
- package/.next/server/chunks/ssr/tower_0wvk~r.._.js +1 -1
- package/.next/server/chunks/ssr/tower_10p15te._.js +1 -1
- package/.next/server/chunks/ssr/tower_117pzh8._.js +1 -1
- package/.next/server/chunks/ssr/tower_11q5_.m._.js +1 -1
- package/.next/server/chunks/ssr/tower_138qlx5._.js +1 -1
- package/.next/server/chunks/ssr/{tower_src_08t.wy-._.js → tower_src_0lq.aoc._.js} +2 -2
- package/.next/server/chunks/ssr/tower_src_actions_agent-actions_ts_0j.e1tn._.js +1 -1
- package/.next/server/chunks/ssr/tower_src_actions_file-actions_ts_0424lna._.js +1 -1
- package/.next/server/chunks/ssr/tower_src_app_missions_missions-client_tsx_0a9vjyr._.js +1 -1
- package/.next/server/chunks/ssr/tower_src_app_onboarding_page_tsx_0_3krz1._.js +1 -1
- package/.next/server/chunks/ssr/tower_src_app_settings_page_tsx_0vo5e-o._.js +1 -1
- package/.next/server/chunks/ssr/tower_src_app_workspaces_[workspaceId]_assets_assets-page-client_tsx_0zfgzhi._.js +1 -1
- package/.next/server/chunks/ssr/tower_src_app_workspaces_[workspaceId]_board-page-client_tsx_0kjp1u0._.js +1 -1
- package/.next/server/chunks/tower_0a-x6m.._.js +1 -1
- package/.next/server/chunks/tower_src_0..vg-t._.js +1 -1
- package/.next/server/instrumentation.js.nft.json +1 -1
- package/.next/server/middleware-build-manifest.js +3 -3
- package/.next/server/pages/404.html +1 -1
- package/.next/server/pages/500.html +1 -1
- package/.next/server/server-reference-manifest.js +1 -1
- package/.next/server/server-reference-manifest.json +198 -198
- package/.next/static/chunks/{0kubr70r_r2f2.js → 01499ombtjk9..js} +1 -1
- package/.next/static/chunks/{05j6t69jmpqju.js → 0465wja5wuj_t.js} +1 -1
- package/.next/static/chunks/{0_.pyr2jhdqa2.js → 04zt_ewq9gd.f.js} +2 -2
- package/.next/static/chunks/{0a2blrvqw8t5y.js → 07ll8eylriw_..js} +1 -1
- package/.next/static/chunks/{049.9ha2n6os5.js → 08kdkf9zhbx5h.js} +1 -1
- package/.next/static/chunks/{0z61ts2ro9_k3.js → 0_dgukndtuspa.js} +1 -1
- package/.next/static/chunks/{07a_xadb-3w1a.js → 0focg9l2pd5qe.js} +1 -1
- package/.next/static/chunks/{0-64z7pmj57~d.js → 0jod832.e8dvp.js} +1 -1
- package/.next/static/chunks/{00xbbu.nlx92z.js → 0o0v~cegree8o.js} +1 -1
- package/.next/static/chunks/{0kc-95qs2~eid.js → 0uukquowg_doj.js} +1 -1
- package/.next/static/chunks/{0kojsk~4uroqj.js → 0v593lcts~8.5.js} +1 -1
- package/.next/static/chunks/0yz33_rbgu2sz.js +1 -0
- package/.next/static/chunks/{0_c8duf92i~xg.js → 0~2w0fbj7o3fv.js} +1 -1
- package/.next/static/chunks/{0z-ecklemrfx-.js → 12p4plfwlovc5.js} +1 -1
- package/.next/static/chunks/{0kt2vohpgb7h6.js → 13juk.piouzom.js} +1 -1
- package/.next/trace +2 -2
- package/.next/trace-build +1 -1
- package/package.json +1 -1
- package/.next/server/chunks/ssr/tower_02he7d6._.js +0 -3
- package/.next/static/chunks/0ttrpz.l-v-yv.js +0 -1
- /package/.next/static/{6AW1vTU7iJEkEhqIH0txT → uSvLXzMcHlsrWUxtSBOMM}/_buildManifest.js +0 -0
- /package/.next/static/{6AW1vTU7iJEkEhqIH0txT → uSvLXzMcHlsrWUxtSBOMM}/_clientMiddlewareManifest.js +0 -0
- /package/.next/static/{6AW1vTU7iJEkEhqIH0txT → uSvLXzMcHlsrWUxtSBOMM}/_ssgManifest.js +0 -0
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[
|
|
1
|
+
module.exports=[157337,a=>{"use strict";var b=a.i(441388);let c=(0,b.createServerReference)("40399a19bc838316ffdccd30cf1aaf685d0f6ebf6a",b.callServer,void 0,b.findSourceMapURL,"getConfigValues");a.s(["getConfigValues",0,c])},580283,a=>{"use strict";var b=a.i(348273),c=a.i(707466);a.s(["EmptyState",0,function({icon:a,title:d,description:e,action:f,className:g}){return(0,b.jsxs)("div",{className:(0,c.cn)("flex h-48 flex-col items-center justify-center gap-2 text-center",g),children:[a&&(0,b.jsx)(a,{className:"h-10 w-10 text-muted-foreground/40"}),(0,b.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:d}),e&&(0,b.jsx)("p",{className:"text-xs text-muted-foreground/60",children:e}),f&&(0,b.jsx)("div",{className:"mt-2",children:f})]})}])},481030,a=>{"use strict";var b=a.i(163683),c=a.i(944921),d=a.i(340626),e=a.i(707466);let f=(0,d.cva)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});a.s(["Badge",0,function({className:a,variant:d="default",render:g,...h}){var i;return i={defaultTagName:"span",props:(0,b.mergeProps)({className:(0,e.cn)(f({variant:d}),a)},h),render:g,state:{slot:"badge",variant:d}},(0,c.useRenderElement)(i.defaultTagName??"div",i,i)}],481030)},438515,a=>{"use strict";var b=a.i(441388);let c=(0,b.createServerReference)("40d3c7de8b64ddb900e3f7ac46ac802673feb23198",b.callServer,void 0,b.findSourceMapURL,"stopPtyExecution");a.s(["stopPtyExecution",0,c])},843027,a=>{"use strict";var b=a.i(441388);let c=(0,b.createServerReference)("784ae1b90278fff4ac2f4d261a8f5298a3e7986b0a",b.callServer,void 0,b.findSourceMapURL,"startPtyExecution");a.s(["startPtyExecution",0,c])},251787,659560,a=>{"use strict";var b=a.i(441388);let c=(0,b.createServerReference)("607d47f7159f261048faf87ff026b8508d0239fdaa",b.callServer,void 0,b.findSourceMapURL,"resumePtyExecution");a.s(["resumePtyExecution",0,c],251787);let d=(0,a.i(173250).default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);a.s(["RotateCcw",0,d],659560)},958372,a=>{"use strict";var b=a.i(441388);let c=(0,b.createServerReference)("40501732ea446df50236c8eec161d0fa22375ef8db",b.callServer,void 0,b.findSourceMapURL,"openInTerminal");a.s(["openInTerminal",0,c])}];
|
|
2
2
|
|
|
3
|
-
//# sourceMappingURL=
|
|
3
|
+
//# sourceMappingURL=tower_src_0lq.aoc._.js.map
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
module.exports=[200082,a=>{"use strict";var b=a.i(998503),c=a.i(284527),d=a.i(391313),e=a.i(605389),f=a.i(703714),g=a.i(787084),h=a.i(988594),i=a.i(697265);class j extends Error{code;provider;constructor(a,b,c){super(c),this.code=a,this.provider=b,this.name="AiProviderError"}}async function k(a){return c.db.aiCapabilityConfig.findUnique({where:{slot:a}})}async function l(a){let b=await k(a),c=b?.provider??"claude",d=b?.model??void 0,e=i.providerRegistry.get(c);if(!e)throw new j("CLI_NOT_FOUND",c,`Provider "${c}" 未注册`);let f=e.cli?.adapter;if(!f)throw new j("UNSUPPORTED_MODE",c,`Provider "${c}" 不支持 CLI 模式`);return{adapter:f,provider:e,model:d}}var m=a.i(924868),n=a.i(446786),o=a.i(814747),p=a.i(126892);let q=g.logger.create("agent-actions"),r=(0,o.join)((0,n.tmpdir)(),"tower-signals");async function s(a,b){try{await (0,m.mkdir)(r,{recursive:!0,mode:448}),await (0,m.writeFile)((0,o.join)(r,`exit-${a}`),String(b),{mode:384})}catch{}}function t(a,b){try{return JSON.parse(a)}catch{throw Error(`CLI Profile ${b} 格式损坏,请在 Settings 中修复`)}}async function u(a,b){let e=await c.db.taskMessage.create({data:{role:"USER",content:b,taskId:a}});return(0,d.revalidatePath)("/workspaces"),{userMessage:e}}async function v(a){return c.db.taskMessage.findMany({where:{taskId:a},orderBy:{createdAt:"asc"}})}async function w(a,b="CLAUDE_CODE",e,f){let g=await c.db.taskExecution.create({data:{taskId:a,agent:b,status:"RUNNING",startedAt:new Date,worktreePath:e??null,worktreeBranch:f??null}});return await c.db.task.update({where:{id:a},data:{status:"IN_PROGRESS"}}),(0,d.revalidatePath)("/workspaces"),g}async function x(a,b="FAILED"){let e=await c.db.taskExecution.update({where:{id:a},data:{status:b,endedAt:new Date}});return(0,d.revalidatePath)("/workspaces"),e}async function y(b){let{destroySession:e,getSession:f}=await a.A(93322),g=f(b),h=g?.getBuffer()??"",i=await c.db.taskExecution.findFirst({where:{taskId:b,status:"RUNNING"},orderBy:{createdAt:"desc"}}),j=await c.db.task.findUnique({where:{id:b},include:{project:{select:{localPath:!0}}}});if(e(b),i){await c.db.taskExecution.update({where:{id:i.id},data:{status:"COMPLETED",endedAt:new Date}}),await c.db.task.update({where:{id:b},data:{status:"IN_REVIEW"}});let d=i.worktreePath||j?.project?.localPath||null,{captureExecutionSummary:e}=await a.A(528814);await e(i.id,b,0,h,d)}(0,d.revalidatePath)("/workspaces")}async function z(a){return c.db.taskExecution.findMany({where:{taskId:a},orderBy:{createdAt:"desc"},include:{insightNote:{select:{id:!0,title:!0,content:!0}}}})}async function A(b,e){let g=await c.db.task.findUnique({where:{id:b},include:{project:!0}});if(!g)throw Error("Task not found");if(!g.project?.localPath)throw Error("Project has no local path configured");await c.db.taskExecution.updateMany({where:{taskId:b,status:"RUNNING",NOT:{sessionId:e}},data:{status:"FAILED",endedAt:new Date}});let i=await c.db.taskExecution.findFirst({where:{taskId:b,sessionId:e},orderBy:{createdAt:"desc"}});if(!i)throw Error("Previous execution not found");let j=i.worktreePath??g.project.localPath,k=g.subPath?(0,o.join)(j,g.subPath):j,m=await c.db.cliProfile.findFirst({where:{isDefault:!0}});if(!m)throw Error("No default CLI profile found — run seed first");let n=t(m.baseArgs,"baseArgs"),p=t(m.envVars,"envVars"),r=await (0,h.readConfigValue)("terminal.idleTimeoutSec",180),{adapter:u}=await l("terminal"),v=u.buildEnvOverrides({taskId:b,taskTitle:g.title,apiUrl:`http://localhost:${process.env.PORT||"3000"}`,callbackUrl:i.callbackUrl??void 0}),w=await c.db.taskExecution.update({where:{id:i.id},data:{status:"RUNNING",endedAt:null}});await c.db.task.update({where:{id:b},data:{status:"IN_PROGRESS"}}),(0,d.revalidatePath)("/workspaces");let x=await (0,h.readConfigValue)("onboarding.username",""),y=u.buildSpawnArgs({taskId:b,prompt:"",cwd:k,resumeSessionId:e,profileArgs:[...n,...x?["--append-system-prompt",`The user's name is ${x}.`]:[]],profileEnvVars:p,envOverrides:v}),z=/no conversation found with session id|unknown session|session .* not found/i;return(0,f.createSession)(b,y.command,y.args,k,()=>{},async d=>{await s(b,d);let f=await c.db.taskExecution.findUnique({where:{id:w.id}});if(f?.status!=="RUNNING")return;let{getSession:h}=await a.A(93322),j=h(b),k=j?.getBuffer()??"";if(0!==d&&z.test(k)){q.info("Session resume failed — retrying with fresh execution",{taskId:b,previousSessionId:e}),await c.db.taskExecution.update({where:{id:w.id},data:{status:"FAILED",endedAt:new Date}}).catch(()=>{});try{await C(b,g.title)}catch(a){q.error("Fresh execution retry also failed",a,{taskId:b})}return}await c.db.taskExecution.update({where:{id:w.id},data:{status:0===d?"COMPLETED":"FAILED",endedAt:new Date}}).catch(()=>{});let l=i.worktreePath||g.project.localPath,{captureExecutionSummary:m}=await a.A(528814);await m(w.id,b,d,k,l);let{dispatchTaskCompletionEvent:n}=await a.A(414961);await n({taskId:b,taskTitle:g.title,status:0===d?"COMPLETED":"FAILED",executionId:w.id,workspaceId:g.project.workspaceId}),0===d&&await c.db.task.update({where:{id:b},data:{status:"IN_REVIEW"}}).catch(()=>{})},y.env,void 0,1e3*r),{executionId:w.id,worktreePath:i.worktreePath??j??null}}async function B(b){let e=await c.db.task.findUnique({where:{id:b},include:{project:!0}});if(!e)throw Error("Task not found");if(!e.project?.localPath)throw Error("Project has no local path configured");let g=await c.db.taskExecution.findFirst({where:{taskId:b},orderBy:{createdAt:"desc"}}),{destroySession:i}=await a.A(93322);i(b),await c.db.taskExecution.updateMany({where:{taskId:b,status:"RUNNING"},data:{status:"FAILED",endedAt:new Date}});let j=g?.worktreePath??e.project.localPath,k=e.subPath?(0,o.join)(j,e.subPath):j,m=await c.db.cliProfile.findFirst({where:{isDefault:!0}});if(!m)throw Error("No default CLI profile found — run seed first");let n=t(m.baseArgs,"baseArgs"),p=t(m.envVars,"envVars"),q=await (0,h.readConfigValue)("terminal.idleTimeoutSec",180),{adapter:r,provider:u}=await l("terminal"),v=r.buildEnvOverrides({taskId:b,taskTitle:e.title,apiUrl:`http://localhost:${process.env.PORT||"3000"}`}),w=await c.db.taskExecution.create({data:{taskId:b,agent:u.agentFieldValue,status:"RUNNING",startedAt:new Date,worktreePath:g?.worktreePath??null,worktreeBranch:g?.worktreeBranch??null}});await c.db.task.update({where:{id:b},data:{status:"IN_PROGRESS"}}),(0,d.revalidatePath)("/workspaces");let x=await (0,h.readConfigValue)("onboarding.username",""),y=r.buildSpawnArgs({taskId:b,prompt:"",cwd:k,continueLatest:!0,profileArgs:[...n,...x?["--append-system-prompt",`The user's name is ${x}.`]:[]],profileEnvVars:p,envOverrides:v});return(0,f.createSession)(b,y.command,y.args,k,()=>{},async d=>{await s(b,d);let f=await c.db.taskExecution.findUnique({where:{id:w.id}});if(f?.status!=="RUNNING")return;let{getSession:h}=await a.A(93322),i=h(b),j=i?.getBuffer()??"";await c.db.taskExecution.update({where:{id:w.id},data:{status:0===d?"COMPLETED":"FAILED",endedAt:new Date}}).catch(()=>{});let k=g?.worktreePath||e.project.localPath,{captureExecutionSummary:l}=await a.A(528814);await l(w.id,b,d,j,k);let{dispatchTaskCompletionEvent:m}=await a.A(414961);await m({taskId:b,taskTitle:e.title,status:0===d?"COMPLETED":"FAILED",executionId:w.id,workspaceId:e.project.workspaceId}),0===d&&await c.db.task.update({where:{id:b},data:{status:"IN_REVIEW"}}).catch(()=>{})},y.env,void 0,1e3*q),{executionId:w.id,worktreePath:g?.worktreePath??j??null}}async function C(b,g,i,j){let k,p,r=await c.db.task.findUnique({where:{id:b},include:{project:!0}});if(!r)throw Error("Task not found");if(!r.project?.localPath)throw Error("Project has no local path configured");let u=await (0,h.readConfigValue)("system.maxConcurrentExecutions",20);if(await c.db.taskExecution.count({where:{status:"RUNNING"}})>=u)throw Error(`已达并发上限(${u}),请等待其他任务完成后再启动`);let v=await c.db.cliProfile.findFirst({where:{isDefault:!0}});if(!v)throw Error("No default CLI profile found — run seed first");let w=t(v.baseArgs,"baseArgs"),x=t(v.envVars,"envVars"),y=await (0,h.readConfigValue)("terminal.idleTimeoutSec",180),{adapter:z,provider:A,model:B}=await l("terminal");await c.db.taskExecution.updateMany({where:{taskId:b,status:"RUNNING"},data:{status:"FAILED",endedAt:new Date}}),"IN_PROGRESS"!==r.status&&(await c.db.task.update({where:{id:b},data:{status:"IN_PROGRESS"}}),(0,d.revalidatePath)("/workspaces"));let C=await c.db.taskMessage.findMany({where:{taskId:b},orderBy:{createdAt:"desc"},take:10}),D=[`Task: ${r.title}`,r.description?`Description: ${r.description}`:"",C.length>0?`Recent conversation:
|
|
2
|
-
${C.reverse().map(a=>`${a.role}: ${a.content}`).join("\n")}`:"",g.trim()?`User message: ${g}`:""].filter(Boolean).join("\n\n"),E=i??r.promptId;if(E){let a=await c.db.agentPrompt.findUnique({where:{id:E}});a?.content&&(p=await (0,m.mkdtemp)((0,o.join)((0,n.tmpdir)(),"tower-pty-")),k=(0,o.join)(p,"instructions.md"),await (0,m.writeFile)(k,a.content,"utf-8"))}let F=null,G=null;if(r.baseBranch&&r.project.localPath){let{worktreePath:a,worktreeBranch:c}=await (0,e.createWorktree)(r.project.localPath,b,r.baseBranch);F=a,G=c}let H=F??r.project.localPath,I=r.subPath?(0,o.join)(H,r.subPath):H,J=await c.db.taskExecution.create({data:{taskId:b,agent:A.agentFieldValue,status:"RUNNING",startedAt:new Date,worktreePath:F??null,worktreeBranch:G??null,callbackUrl:j??null}});if(r.project.localPath)try{let b,{execFileSync:d}=await a.A(144264);(b=F&&r.baseBranch?d("git",["merge-base",r.baseBranch,"HEAD"],{cwd:F,encoding:"utf-8",timeout:5e3}).trim():d("git",["rev-parse","HEAD"],{cwd:r.project.localPath,encoding:"utf-8",timeout:5e3}).trim())&&await c.db.taskExecution.update({where:{id:J.id},data:{forkCommit:b}})}catch{}let K="";if(k){let{readFile:b}=await a.A(260815);K+=await b(k,"utf-8")}let L=await (0,h.readConfigValue)("onboarding.username","");L&&(K+=(K?"\n":"")+`The user's name is ${L}.`);let M=z.buildSpawnArgs({taskId:b,prompt:D,cwd:I,profileArgs:[...w,...K?["--append-system-prompt",K]:[],...B?["--model",B]:[]],profileEnvVars:x,envOverrides:z.buildEnvOverrides({taskId:b,taskTitle:r.title,apiUrl:`http://localhost:${process.env.PORT||"3000"}`,callbackUrl:j??void 0})});return(0,f.createSession)(b,M.command,M.args,I,()=>{},async d=>{await s(b,d);let e=await c.db.taskExecution.findUnique({where:{id:J.id}});if(e?.status!=="RUNNING")return;let{getSession:f}=await a.A(93322),g=f(b),h=g?.getBuffer()??"";await c.db.taskExecution.update({where:{id:J.id},data:{status:0===d?"COMPLETED":"FAILED",endedAt:new Date}}).catch(a=>{q.error("Failed to update execution status",a)});let i=F||r.project.localPath,{captureExecutionSummary:j}=await a.A(528814);await j(J.id,b,d,h,i);let{dispatchTaskCompletionEvent:k}=await a.A(414961);await k({taskId:b,taskTitle:r.title,status:0===d?"COMPLETED":"FAILED",executionId:J.id,workspaceId:r.project.workspaceId}),0===d&&await c.db.task.update({where:{id:b},data:{status:"IN_REVIEW"}}).catch(a=>{q.error("Failed to update task status",a)}),p&&await (0,m.rm)(p,{recursive:!0,force:!0}).catch(()=>{})},M.env,void 0,1e3*y),{executionId:J.id,worktreePath:F??H??null}}async function D(){return(await c.db.taskExecution.findMany({where:{status:"RUNNING"},orderBy:{startedAt:"asc"},include:{task:{include:{project:{include:{workspace:!0}}}}}})).map(a=>({executionId:a.id,taskId:a.taskId,taskTitle:a.task.title,projectId:a.task.project.id,projectName:a.task.project.name,projectAlias:a.task.project.alias,projectLocalPath:a.task.project.localPath,workspaceId:a.task.project.workspace.id,workspaceName:a.task.project.workspace.name,worktreePath:a.worktreePath,startedAt:a.startedAt?.toISOString()??null}))}(0,p.ensureServerEntryExports)([u,v,w,x,y,z,A,B,C,D]),(0,b.registerServerReference)(u,"
|
|
2
|
+
${C.reverse().map(a=>`${a.role}: ${a.content}`).join("\n")}`:"",g.trim()?`User message: ${g}`:""].filter(Boolean).join("\n\n"),E=i??r.promptId;if(E){let a=await c.db.agentPrompt.findUnique({where:{id:E}});a?.content&&(p=await (0,m.mkdtemp)((0,o.join)((0,n.tmpdir)(),"tower-pty-")),k=(0,o.join)(p,"instructions.md"),await (0,m.writeFile)(k,a.content,"utf-8"))}let F=null,G=null;if(r.baseBranch&&r.project.localPath){let{worktreePath:a,worktreeBranch:c}=await (0,e.createWorktree)(r.project.localPath,b,r.baseBranch);F=a,G=c}let H=F??r.project.localPath,I=r.subPath?(0,o.join)(H,r.subPath):H,J=await c.db.taskExecution.create({data:{taskId:b,agent:A.agentFieldValue,status:"RUNNING",startedAt:new Date,worktreePath:F??null,worktreeBranch:G??null,callbackUrl:j??null}});if(r.project.localPath)try{let b,{execFileSync:d}=await a.A(144264);(b=F&&r.baseBranch?d("git",["merge-base",r.baseBranch,"HEAD"],{cwd:F,encoding:"utf-8",timeout:5e3}).trim():d("git",["rev-parse","HEAD"],{cwd:r.project.localPath,encoding:"utf-8",timeout:5e3}).trim())&&await c.db.taskExecution.update({where:{id:J.id},data:{forkCommit:b}})}catch{}let K="";if(k){let{readFile:b}=await a.A(260815);K+=await b(k,"utf-8")}let L=await (0,h.readConfigValue)("onboarding.username","");L&&(K+=(K?"\n":"")+`The user's name is ${L}.`);let M=z.buildSpawnArgs({taskId:b,prompt:D,cwd:I,profileArgs:[...w,...K?["--append-system-prompt",K]:[],...B?["--model",B]:[]],profileEnvVars:x,envOverrides:z.buildEnvOverrides({taskId:b,taskTitle:r.title,apiUrl:`http://localhost:${process.env.PORT||"3000"}`,callbackUrl:j??void 0})});return(0,f.createSession)(b,M.command,M.args,I,()=>{},async d=>{await s(b,d);let e=await c.db.taskExecution.findUnique({where:{id:J.id}});if(e?.status!=="RUNNING")return;let{getSession:f}=await a.A(93322),g=f(b),h=g?.getBuffer()??"";await c.db.taskExecution.update({where:{id:J.id},data:{status:0===d?"COMPLETED":"FAILED",endedAt:new Date}}).catch(a=>{q.error("Failed to update execution status",a)});let i=F||r.project.localPath,{captureExecutionSummary:j}=await a.A(528814);await j(J.id,b,d,h,i);let{dispatchTaskCompletionEvent:k}=await a.A(414961);await k({taskId:b,taskTitle:r.title,status:0===d?"COMPLETED":"FAILED",executionId:J.id,workspaceId:r.project.workspaceId}),0===d&&await c.db.task.update({where:{id:b},data:{status:"IN_REVIEW"}}).catch(a=>{q.error("Failed to update task status",a)}),p&&await (0,m.rm)(p,{recursive:!0,force:!0}).catch(()=>{})},M.env,void 0,1e3*y),{executionId:J.id,worktreePath:F??H??null}}async function D(){return(await c.db.taskExecution.findMany({where:{status:"RUNNING"},orderBy:{startedAt:"asc"},include:{task:{include:{project:{include:{workspace:!0}}}}}})).map(a=>({executionId:a.id,taskId:a.taskId,taskTitle:a.task.title,projectId:a.task.project.id,projectName:a.task.project.name,projectAlias:a.task.project.alias,projectLocalPath:a.task.project.localPath,workspaceId:a.task.project.workspace.id,workspaceName:a.task.project.workspace.name,worktreePath:a.worktreePath,startedAt:a.startedAt?.toISOString()??null}))}(0,p.ensureServerEntryExports)([u,v,w,x,y,z,A,B,C,D]),(0,b.registerServerReference)(u,"60fd02be1199a75ab601e3d0cf94400db69ad080f4",null),(0,b.registerServerReference)(v,"40c781bcf5f2d820e508850bc2999667fea2af4b4e",null),(0,b.registerServerReference)(w,"78e3691aa6b1ec2884874a5aeb698d9155b46db783",null),(0,b.registerServerReference)(x,"60330564158ae1a77022ac7d952c883e50f212369f",null),(0,b.registerServerReference)(y,"40d3c7de8b64ddb900e3f7ac46ac802673feb23198",null),(0,b.registerServerReference)(z,"4047135f0933191c5ee458162e6e6d92a29ed59f4b",null),(0,b.registerServerReference)(A,"607d47f7159f261048faf87ff026b8508d0239fdaa",null),(0,b.registerServerReference)(B,"40f21730f368b920d8bd0817480ffbbc2b201c3e95",null),(0,b.registerServerReference)(C,"784ae1b90278fff4ac2f4d261a8f5298a3e7986b0a",null),(0,b.registerServerReference)(D,"0014f15c969c980aa4f372768360135b01c9760165",null),a.s(["continueLatestPtyExecution",0,B,"getActiveExecutionsAcrossWorkspaces",0,D,"getTaskExecutions",0,z,"getTaskMessages",0,v,"resumePtyExecution",0,A,"sendTaskMessage",0,u,"startPtyExecution",0,C,"startTaskExecution",0,w,"stopPtyExecution",0,y,"stopTaskExecution",0,x],200082)}];
|
|
3
3
|
|
|
4
4
|
//# sourceMappingURL=tower_src_actions_agent-actions_ts_0j.e1tn._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[623296,a=>{"use strict";a.s([],552262),a.i(552262),a.i(
|
|
1
|
+
module.exports=[623296,a=>{"use strict";a.s([],552262),a.i(552262),a.i(210027),a.i(681033),a.i(202907),a.i(706639),a.i(550860),a.i(23826),a.i(407005),a.i(508976),a.i(97368);var b=a.i(441388);let c=(0,b.createServerReference)("6061dab0055fbe4a8a8e76d2431e6aef6842ac91ce",b.callServer,void 0,b.findSourceMapURL,"revealInFinder");a.s(["revealInFinder",0,c],623296)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=tower_src_actions_file-actions_ts_0424lna._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[917691,a=>{"use strict";var b=a.i(348273),c=a.i(399424),d=a.i(282980),e=a.i(441388);let f=(0,e.createServerReference)("00752bfe863d97d0ed6a191b4afceab5c641608e58",e.callServer,void 0,e.findSourceMapURL,"getActiveExecutionsAcrossWorkspaces");var g=a.i(150942);let h=[{id:"1x1",label:"1×1",cols:1,rows:1,minHeight:"480px",desc:"Focus mode"},{id:"2x1",label:"2×1",cols:2,rows:1,minHeight:"480px",desc:"Side by side"},{id:"3x2",label:"3×2",cols:3,rows:2,minHeight:"300px",desc:"Default"},{id:"2x2",label:"2×2",cols:2,rows:2,minHeight:"300px",desc:"Balanced"},{id:"4x2",label:"4×2",cols:4,rows:2,minHeight:"240px",desc:"Wide monitor"},{id:"3x3",label:"3×3",cols:3,rows:3,minHeight:"240px",desc:"Max overview"}];var i=a.i(344838),j=a.i(422917),k=a.i(580283),l=a.i(173250);let m=(0,l.default)("rocket",[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]]);var n=a.i(373346);function o({cols:a,rows:c,active:d}){let e=Array.from({length:a*c});return(0,b.jsx)("div",{className:`grid gap-[1px] w-7 h-5 p-[3px] rounded-sm border shrink-0 ${d?"border-primary bg-primary/10":"border-border bg-muted"}`,style:{gridTemplateColumns:`repeat(${a}, 1fr)`,gridTemplateRows:`repeat(${c}, 1fr)`},children:e.map((a,c)=>(0,b.jsx)("div",{className:`rounded-[1px] min-w-0 min-h-0 ${d?"bg-primary":"bg-muted-foreground/40"}`},c))})}let p="custom";function q({value:a,customValue:e,onChange:f}){let{t:g}=(0,d.useI18n)(),[i,k]=(0,c.useState)(!1),l=(0,c.useRef)(null),m=a===p,r=m?null:h.find(b=>b.id===a)??h[2],[s,t]=(0,c.useState)(e?.cols??2),[u,v]=(0,c.useState)(e?.rows??2),[w,x]=(0,c.useState)({minCols:1,maxCols:5,minRows:1,maxRows:5});(0,c.useEffect)(()=>{(0,n.getConfigValues)(["missions.grid.minCols","missions.grid.maxCols","missions.grid.minRows","missions.grid.maxRows"]).then(a=>{x({minCols:a["missions.grid.minCols"]??1,maxCols:a["missions.grid.maxCols"]??5,minRows:a["missions.grid.minRows"]??1,maxRows:a["missions.grid.maxRows"]??5})})},[]),(0,c.useEffect)(()=>{e&&(t(e.cols),v(e.rows))},[e?.cols,e?.rows]),(0,c.useEffect)(()=>{if(i)return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a);function a(a){l.current&&!l.current.contains(a.target)&&k(!1)}},[i]);let y=(a,b,c)=>Math.max(b,Math.min(c,a)),z=m?s:r?.cols??2,A=m?u:r?.rows??2,B=m?`${s}\xd7${u}`:r?.label??"";return(0,b.jsxs)("div",{ref:l,className:"relative",children:[(0,b.jsxs)(j.Button,{variant:"outline",onClick:()=>k(a=>!a),className:"gap-2",children:[(0,b.jsx)(o,{cols:z,rows:A,active:!1}),(0,b.jsx)("span",{children:B}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"▼"})]}),i&&(0,b.jsxs)("div",{className:"absolute right-0 z-50 mt-1 w-72 rounded-lg border border-border bg-popover shadow-xl p-3",children:[(0,b.jsx)("h5",{className:"text-sm font-semibold text-foreground mb-3",children:g("missions.gridPreset")}),(0,b.jsxs)("div",{className:"flex flex-col gap-0.5",children:[h.map(c=>{let d=c.id===a;return(0,b.jsxs)("button",{onClick:()=>{f(c.id),k(!1)},className:`flex items-center gap-3 px-3 py-2.5 rounded-lg transition-colors ${d?"bg-primary/10":"hover:bg-accent"}`,children:[(0,b.jsx)(o,{cols:c.cols,rows:c.rows,active:d}),(0,b.jsx)("span",{className:`text-sm font-medium flex-1 text-left ${d?"text-primary":"text-foreground"}`,children:c.label}),(0,b.jsx)("span",{className:`text-xs ${d?"text-primary/60":"text-muted-foreground"}`,children:c.desc})]},c.id)}),(0,b.jsxs)("div",{className:"mt-1 border-t border-border pt-2",children:[(0,b.jsxs)("button",{onClick:()=>{m||f(p,{cols:s,rows:u})},className:`flex items-center gap-3 px-3 py-2.5 rounded-lg transition-colors w-full ${m?"bg-primary/10":"hover:bg-accent"}`,children:[(0,b.jsx)(o,{cols:s,rows:u,active:m}),(0,b.jsx)("span",{className:`text-sm font-medium flex-1 text-left ${m?"text-primary":"text-foreground"}`,children:g("missions.gridCustom")}),(0,b.jsxs)("span",{className:`text-xs ${m?"text-primary/60":"text-muted-foreground"}`,children:[s,"×",u]})]}),m&&(0,b.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2",children:[(0,b.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground",children:g("missions.gridCols")}),(0,b.jsx)("input",{type:"number",min:w.minCols,max:w.maxCols,value:s,onChange:a=>{let b;t(b=y(Number(a.target.value),w.minCols,w.maxCols)),f(p,{cols:b,rows:u})},className:"h-7 w-14 rounded-md border border-border bg-background px-2 text-sm text-center"})]}),(0,b.jsx)("span",{className:"text-muted-foreground",children:"×"}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground",children:g("missions.gridRows")}),(0,b.jsx)("input",{type:"number",min:w.minRows,max:w.maxRows,value:u,onChange:a=>{let b;v(b=y(Number(a.target.value),w.minRows,w.maxRows)),f(p,{cols:s,rows:b})},className:"h-7 w-14 rounded-md border border-border bg-background px-2 text-sm text-center"})]})]})]})]})]})]})}var r=a.i(830383),s=a.i(223982),t=a.i(496752),u=a.i(851033),v=a.i(971605);let w=(0,l.default)("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),x=(0,l.default)("arrow-up-right",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);var y=a.i(17787);let z=(0,l.default)("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);var A=a.i(348160),B=a.i(481030),C=a.i(530470),D=a.i(511153);let E=(0,t.default)(async()=>{},{loadableGenerated:{modules:[7468]},ssr:!1,loading:()=>(0,b.jsx)("div",{className:"h-full w-full bg-[#0a0a0a] animate-pulse"})});function F({execution:a,isRemoving:e,removeReason:f,onStop:g,onSessionEnd:h}){let{t:i}=(0,d.useI18n)(),k=(0,u.useRouter)(),{attributes:l,listeners:m,setNodeRef:n,transform:o,transition:p}=(0,s.useSortable)({id:a.executionId}),q={transform:v.CSS.Transform.toString(o),transition:p,opacity:+!e},[r,t]=(0,c.useState)(()=>a.startedAt?Math.floor((Date.now()-new Date(a.startedAt).getTime())/1e3):0);(0,c.useEffect)(()=>{if(e)return;let b=setInterval(()=>{t(a.startedAt?Math.floor((Date.now()-new Date(a.startedAt).getTime())/1e3):0)},1e3);return()=>clearInterval(b)},[a.startedAt,e]);let G=Math.floor(r/60),H=`${G}m ${r%60}s`;async function I(){if(a.projectLocalPath)try{await (0,C.openInTerminal)(a.projectLocalPath)}catch{D.toast.error(i("preview.terminalError"))}}return(0,b.jsxs)("div",{ref:n,style:q,className:"border border-border rounded-lg overflow-hidden flex flex-col transition-opacity duration-300",...l,children:[(0,b.jsxs)("div",{className:"h-10 px-3 flex items-center gap-1 border-b border-border bg-card shrink-0",children:[(0,b.jsx)("button",{...m,"aria-label":i("missions.dragHandle"),"aria-roledescription":"sortable",className:"cursor-grab text-muted-foreground hover:text-foreground mr-1",children:(0,b.jsx)(w,{className:"h-3.5 w-3.5"})}),(0,b.jsxs)("span",{className:"text-[11px] text-muted-foreground truncate flex-1",children:[a.workspaceName," ›"," ",a.projectAlias||a.projectName," ›"," ",(0,b.jsx)("span",{className:"text-foreground font-semibold",children:a.taskTitle})]}),e?(0,b.jsx)(B.Badge,{variant:"outline",className:"text-[11px] text-muted-foreground bg-muted ml-1 shrink-0",children:"stopped"===f?i("missions.statusStopped"):i("missions.statusCompleted")}):(0,b.jsx)(B.Badge,{variant:"outline",className:"text-[11px] text-primary border-primary/30 bg-primary/10 ml-1 shrink-0",children:i("missions.statusRunning")}),(0,b.jsx)("span",{className:"text-[11px] text-muted-foreground ml-1 shrink-0",children:H}),a.projectLocalPath&&(0,b.jsxs)(A.Tooltip,{children:[(0,b.jsx)(A.TooltipTrigger,{render:(0,b.jsx)(j.Button,{variant:"ghost",size:"icon",className:"ml-1 shrink-0 text-muted-foreground",onClick:I}),children:(0,b.jsx)(z,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(A.TooltipContent,{children:i("missions.openInTerminal")})]}),(0,b.jsxs)(A.Tooltip,{children:[(0,b.jsx)(A.TooltipTrigger,{render:(0,b.jsx)(j.Button,{variant:"ghost",size:"icon",className:"ml-1 shrink-0 text-muted-foreground",onClick:()=>k.push(`/workspaces/${a.workspaceId}/tasks/${a.taskId}`)}),children:(0,b.jsx)(x,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(A.TooltipContent,{children:i("missions.openFullView")})]}),(0,b.jsxs)(A.Tooltip,{children:[(0,b.jsx)(A.TooltipTrigger,{render:(0,b.jsx)(j.Button,{variant:"destructive",size:"icon",className:"ml-1 shrink-0",onClick:()=>g(a.taskId),disabled:e}),children:(0,b.jsx)(y.X,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(A.TooltipContent,{children:i("missions.stopTask")})]})]}),(0,b.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,b.jsx)(E,{taskId:a.taskId,worktreePath:a.worktreePath??a.projectLocalPath,onSessionEnd:b=>h?.(a.taskId,b),useCanvasRenderer:!0})})]})}let G=(0,e.createServerReference)("405db9c308819894533cadb1f94d352e7157dc789f",e.callServer,void 0,e.findSourceMapURL,"getWorkspacesWithRecentTasks"),H=(0,e.createServerReference)("40885ffe8d26dfe1f311fb236979c64024264bbf18",e.callServer,void 0,e.findSourceMapURL,"getProjectTasks");var I=a.i(686765),J=a.i(480346),K=a.i(755811);let L=(0,l.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);var M=a.i(659560),N=a.i(55213);let O={TODO:"TODO",IN_PROGRESS:"Running",IN_REVIEW:"Review"},P={LOW:"Low",MEDIUM:"Med",HIGH:"High",CRITICAL:"Crit"};function Q({status:a}){return(0,b.jsx)("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${{TODO:"bg-slate-100 text-slate-600 dark:bg-slate-800 dark:text-slate-400",IN_PROGRESS:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",IN_REVIEW:"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400"}[a]??"bg-slate-100 text-slate-600"}`,children:O[a]??a})}function R({task:a,isRunning:c,launchingId:d,onLaunchNew:e,onResume:f,t:g}){let h=a.executions?.[0]?.sessionId,i=d===a.id;return(0,b.jsxs)("div",{className:"group/task flex items-center gap-2 px-3 py-1.5 hover:bg-accent/50 cursor-default",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("p",{className:`text-sm truncate ${c?"italic text-muted-foreground":""}`,children:a.title}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5 mt-0.5",children:[(0,b.jsx)(Q,{status:a.status}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:P[a.priority]??a.priority})]})]}),c?(0,b.jsx)("span",{className:"text-[10px] italic text-muted-foreground shrink-0",children:g("missions.alreadyMonitored")}):(0,b.jsxs)("div",{className:"flex items-center gap-1 opacity-0 group-hover/task:opacity-100 transition-opacity shrink-0",children:[h&&(0,b.jsxs)(j.Button,{variant:"outline",className:"h-6 px-2 text-xs",onClick:()=>f(a.id,h),disabled:i,title:g("missions.continueSession"),children:[(0,b.jsx)(M.RotateCcw,{className:"h-3 w-3 mr-1"}),g("missions.continueLabel")]}),(0,b.jsxs)(j.Button,{variant:"outline",className:"h-6 px-2 text-xs",onClick:()=>e(a.id),disabled:i,title:g("missions.launchNew"),children:[(0,b.jsx)(L,{className:"h-3 w-3 mr-1"}),i?"...":g("missions.launchNewLabel")]})]})]})}function S({open:a,onOpenChange:e,onLaunchNew:f,onResume:g,runningTaskIds:h,launchingId:j}){let{t:k}=(0,d.useI18n)(),[l,m]=(0,c.useState)([]),[n,o]=(0,c.useState)(""),[p,q]=(0,c.useState)(""),[r,s]=(0,c.useState)([]);(0,c.useEffect)(()=>{a&&(o(""),q(""),s([]),G(100).then(m).catch(()=>D.toast.error(k("missions.error.launchFailed"))))},[a,k]),(0,c.useEffect)(()=>{p?H(p).then(a=>{s(a.filter(a=>"TODO"===a.status||"IN_PROGRESS"===a.status||"IN_REVIEW"===a.status))}).catch(()=>D.toast.error(k("missions.error.launchFailed"))):s([])},[p,k]);let t=l.find(a=>a.id===n),u=t?.projects??[];return(0,b.jsx)(K.Dialog,{open:a,onOpenChange:e,children:(0,b.jsxs)(K.DialogContent,{className:"max-w-lg max-h-[70vh] flex flex-col",children:[(0,b.jsx)(K.DialogHeader,{children:(0,b.jsx)(K.DialogTitle,{children:k("missions.fullPickerTitle")})}),(0,b.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,b.jsxs)(i.Select,{value:n,onValueChange:a=>{o(a??""),q("")},children:[(0,b.jsx)(i.SelectTrigger,{id:"full-picker-ws",className:"w-48 h-8",children:(0,b.jsx)("span",{className:"truncate",children:l.find(a=>a.id===n)?.name??k("missions.launcher.selectWorkspace")})}),(0,b.jsx)(i.SelectContent,{children:l.map(a=>(0,b.jsx)(i.SelectItem,{value:a.id,children:a.name},a.id))})]}),(0,b.jsxs)(i.Select,{value:p,onValueChange:a=>q(a??""),disabled:!n,children:[(0,b.jsx)(i.SelectTrigger,{id:"full-picker-proj",className:"w-48 h-8",children:(0,b.jsx)("span",{className:"truncate",children:u.find(a=>a.id===p)?.name??k("missions.launcher.selectProject")})}),(0,b.jsx)(i.SelectContent,{children:u.map(a=>(0,b.jsx)(i.SelectItem,{value:a.id,children:a.alias??a.name},a.id))})]})]}),(0,b.jsx)(N.ScrollArea,{className:"flex-1 min-h-0 -mx-2",children:0===r.length&&p?(0,b.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:k("missions.launcher.noTasks")}):0===r.length?(0,b.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:k("missions.fullPickerHint")}):r.map(a=>(0,b.jsx)(R,{task:a,isRunning:h.has(a.id),launchingId:j,onLaunchNew:f,onResume:g,t:k},a.id))})]})})}function T({open:a,onOpenChange:e,onLaunched:f,runningTaskIds:g=new Set,anchorRef:h}){let{t:i}=(0,d.useI18n)(),k=(0,c.useRef)(null),[l,m]=(0,c.useState)([]),[n,o]=(0,c.useState)(!1),[p,q]=(0,c.useState)(null),[r,s]=(0,c.useState)(!1);(0,c.useEffect)(()=>{a&&(o(!0),G(3).then(m).catch(()=>D.toast.error(i("missions.error.launchFailed"))).finally(()=>o(!1)))},[a,i]),(0,c.useEffect)(()=>{if(a)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b);function b(a){let b=a.target;if(k.current&&!k.current.contains(b)){if(h?.current&&h.current.contains(b))return;e(!1)}}},[a,e,h]);let t=(0,c.useCallback)(async a=>{try{q(a),await (0,I.startPtyExecution)(a,""),f(a),e(!1),s(!1)}catch{D.toast.error(i("missions.error.launchFailed"))}finally{q(null)}},[f,e,i]),u=(0,c.useCallback)(async(a,b)=>{try{q(a),await (0,J.resumePtyExecution)(a,b),f(a),e(!1),s(!1)}catch{D.toast.error(i("missions.error.launchFailed"))}finally{q(null)}},[f,e,i]),v=(0,c.useCallback)(()=>{e(!1),s(!0)},[e]);return a||r?(0,b.jsxs)(b.Fragment,{children:[a&&(0,b.jsxs)("div",{ref:k,className:"absolute right-0 z-50 mt-1 w-96 rounded-lg border border-border bg-popover shadow-xl flex flex-col overflow-hidden",style:{maxHeight:"480px"},children:[(0,b.jsx)("div",{className:"px-3 py-2 border-b border-border shrink-0",children:(0,b.jsx)("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:i("missions.pickerTitle")})}),(0,b.jsx)(N.ScrollArea,{className:"flex-1 min-h-0",children:n?(0,b.jsx)("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"Loading..."}):0===l.length?(0,b.jsx)("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:i("missions.noAvailableTasks")}):l.map(a=>(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"sticky top-0 z-10 px-3 py-1.5 bg-popover border-b border-border/50",children:(0,b.jsx)("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:a.name})}),a.projects.map(a=>0===a._count.tasks?null:(0,b.jsxs)("div",{className:"mb-1",children:[(0,b.jsx)("div",{className:"px-3 pt-2 pb-0.5",children:(0,b.jsx)("span",{className:"text-xs font-medium text-foreground",children:a.alias??a.name})}),a.tasks.map(a=>(0,b.jsx)(R,{task:a,isRunning:g.has(a.id),launchingId:p,onLaunchNew:t,onResume:u,t:i},a.id))]},a.id))]},a.id))}),(0,b.jsx)("div",{className:"shrink-0 border-t border-border",children:(0,b.jsx)(j.Button,{variant:"ghost",className:"w-full rounded-none text-xs text-primary font-medium",onClick:v,children:i("missions.showMoreTasks")})})]}),(0,b.jsx)(S,{open:r,onOpenChange:s,onLaunchNew:t,onResume:u,runningTaskIds:g,launchingId:p})]}):null}a.s(["MissionsClient",0,function({initialExecutions:a}){let{t:e}=(0,d.useI18n)(),[l,n]=(0,c.useState)(a),[o,p]=(0,c.useState)(()=>"3x2"),[t,u]=(0,c.useState)(()=>({cols:2,rows:2})),[v,w]=(0,c.useState)(!1),[x,y]=(0,c.useState)(""),z=(0,c.useRef)(null),[A,B]=(0,c.useState)(new Map),C=(0,c.useRef)(A);(0,c.useEffect)(()=>{C.current=A},[A]);let E=(0,c.useRef)(new Map),G=h.find(a=>a.id===o)??h[2],H="custom"===o?t.cols:G.cols,I="custom"===o?t.rows:G.rows,J=(0,c.useRef)(null),[K,L]=(0,c.useState)("480px");(0,c.useEffect)(()=>{let a=J.current;if(!a)return;let b=()=>{let b=(a.clientHeight-32-16*(I-1))/I;L(`${Math.max(b,200)}px`)};b();let c=new ResizeObserver(b);return c.observe(a),()=>c.disconnect()},[I]);let M=(0,c.useCallback)((a,b)=>{a&&(p(a),localStorage.setItem("missions-grid-preset",a),"custom"===a&&b&&(u(b),localStorage.setItem("missions-grid-custom",JSON.stringify(b))))},[]),N=(0,r.useSensors)((0,r.useSensor)(r.PointerSensor,{activationConstraint:{distance:8}})),O=(0,c.useCallback)(a=>{let{active:b,over:c}=a;c&&b.id!==c.id&&n(a=>{let d=a.findIndex(a=>a.executionId===b.id),e=a.findIndex(a=>a.executionId===c.id);return(0,s.arrayMove)(a,d,e)})},[]),P=(0,c.useCallback)((a,b)=>{if(C.current.has(a))return;B(c=>new Map([...c,[a,b]]));let c=setTimeout(()=>{n(b=>b.filter(b=>b.executionId!==a)),B(b=>{let c=new Map(b);return c.delete(a),c}),E.current.delete(a)},500);E.current.set(a,c)},[]);(0,c.useEffect)(()=>{let a=setInterval(async()=>{try{let a=await f();n(b=>{let c=C.current,{merged:d,goneIds:e}=function({prev:a,fresh:b,removingIds:c}){let d=new Set(b.map(a=>a.executionId)),e=[];a.forEach(a=>{d.has(a.executionId)||c.has(a.executionId)||e.push(a.executionId)});let f=a.filter(a=>d.has(a.executionId)||c.has(a.executionId)),g=new Set(a.map(a=>a.executionId));return{merged:[...f,...b.filter(a=>!g.has(a.executionId))],goneIds:e}}({prev:b,fresh:a,removingIds:new Set(c.keys())});return e.forEach(a=>P(a,"completed")),d})}catch{}},4e3);return()=>clearInterval(a)},[P]),(0,c.useEffect)(()=>{let a=E.current;return()=>{a.forEach(a=>clearTimeout(a))}},[]);let Q=(0,c.useCallback)(async a=>{try{await (0,g.stopPtyExecution)(a),n(b=>{let c=b.find(b=>b.taskId===a);return c&&P(c.executionId,"stopped"),b})}catch{D.toast.error(e("missions.error.stopFailed"))}},[P,e]),R=(0,c.useCallback)((a,b)=>{n(b=>{let c=b.find(b=>b.taskId===a);return c&&P(c.executionId,"completed"),b})},[P]),S=(0,c.useCallback)(a=>{f().then(a=>{n(b=>{let c=new Set(b.map(a=>a.executionId));return[...b,...a.filter(a=>!c.has(a.executionId))]})}).catch(()=>{})},[]),U=Array.from(new Map(l.map(a=>[a.workspaceId,a.workspaceName])).entries()).map(([a,b])=>({id:a,name:b})),V=x?l.filter(a=>a.workspaceId===x):l,W=new Set(l.map(a=>a.taskId));return(0,b.jsxs)("div",{className:"flex h-full flex-col",children:[(0,b.jsxs)("div",{className:"header-sm shrink-0 px-4 flex items-center gap-3",children:[(0,b.jsx)("h1",{className:"text-base font-semibold",children:e("missions.pageTitle")}),(0,b.jsxs)(i.Select,{value:x,onValueChange:a=>y(a??""),children:[(0,b.jsx)(i.SelectTrigger,{className:"w-36 h-8",children:(0,b.jsx)("span",{className:"truncate",children:x?U.find(a=>a.id===x)?.name??e("missions.filterAll"):e("missions.filterAll")})}),(0,b.jsxs)(i.SelectContent,{children:[(0,b.jsx)(i.SelectItem,{value:"",children:e("missions.filterAll")}),U.map(a=>(0,b.jsx)(i.SelectItem,{value:a.id,children:a.name},a.id))]})]}),(0,b.jsx)("div",{className:"flex-1"}),(0,b.jsx)(q,{value:o,customValue:t,onChange:M}),(0,b.jsxs)("div",{className:"relative",children:[(0,b.jsx)(j.Button,{ref:z,onClick:()=>w(a=>!a),children:e("missions.launchTask")}),(0,b.jsx)(T,{open:v,onOpenChange:w,onLaunched:S,runningTaskIds:W,anchorRef:z})]})]}),(0,b.jsx)("div",{ref:J,className:"flex-1 overflow-auto min-h-0 p-4",children:0===V.length&&0===A.size?(0,b.jsx)(k.EmptyState,{icon:m,title:e("missions.emptyTitle"),description:e("missions.emptyDesc"),className:"h-full",action:(0,b.jsx)(j.Button,{onClick:()=>w(!0),children:e("missions.launchTask")})}):(0,b.jsx)(r.DndContext,{id:"missions-dnd",sensors:N,collisionDetection:r.closestCenter,onDragEnd:O,children:(0,b.jsx)(s.SortableContext,{items:V.map(a=>a.executionId),strategy:s.rectSortingStrategy,children:(0,b.jsx)("div",{className:"grid gap-4",style:{gridTemplateColumns:`repeat(${H}, 1fr)`,gridAutoRows:K},children:V.map(a=>(0,b.jsx)(F,{execution:a,isRemoving:A.has(a.executionId),removeReason:A.get(a.executionId),onStop:Q,onSessionEnd:R},a.executionId))})})})})]})}],917691)}];
|
|
1
|
+
module.exports=[917691,a=>{"use strict";var b=a.i(348273),c=a.i(399424),d=a.i(282980),e=a.i(441388);let f=(0,e.createServerReference)("0014f15c969c980aa4f372768360135b01c9760165",e.callServer,void 0,e.findSourceMapURL,"getActiveExecutionsAcrossWorkspaces");var g=a.i(438515);let h=[{id:"1x1",label:"1×1",cols:1,rows:1,minHeight:"480px",desc:"Focus mode"},{id:"2x1",label:"2×1",cols:2,rows:1,minHeight:"480px",desc:"Side by side"},{id:"3x2",label:"3×2",cols:3,rows:2,minHeight:"300px",desc:"Default"},{id:"2x2",label:"2×2",cols:2,rows:2,minHeight:"300px",desc:"Balanced"},{id:"4x2",label:"4×2",cols:4,rows:2,minHeight:"240px",desc:"Wide monitor"},{id:"3x3",label:"3×3",cols:3,rows:3,minHeight:"240px",desc:"Max overview"}];var i=a.i(344838),j=a.i(422917),k=a.i(580283),l=a.i(173250);let m=(0,l.default)("rocket",[["path",{d:"M12 15v5s3.03-.55 4-2c1.08-1.62 0-5 0-5",key:"qeys4"}],["path",{d:"M4.5 16.5c-1.5 1.26-2 5-2 5s3.74-.5 5-2c.71-.84.7-2.13-.09-2.91a2.18 2.18 0 0 0-2.91-.09",key:"u4xsad"}],["path",{d:"M9 12a22 22 0 0 1 2-3.95A12.88 12.88 0 0 1 22 2c0 2.72-.78 7.5-6 11a22.4 22.4 0 0 1-4 2z",key:"676m9"}],["path",{d:"M9 12H4s.55-3.03 2-4c1.62-1.08 5 .05 5 .05",key:"92ym6u"}]]);var n=a.i(157337);function o({cols:a,rows:c,active:d}){let e=Array.from({length:a*c});return(0,b.jsx)("div",{className:`grid gap-[1px] w-7 h-5 p-[3px] rounded-sm border shrink-0 ${d?"border-primary bg-primary/10":"border-border bg-muted"}`,style:{gridTemplateColumns:`repeat(${a}, 1fr)`,gridTemplateRows:`repeat(${c}, 1fr)`},children:e.map((a,c)=>(0,b.jsx)("div",{className:`rounded-[1px] min-w-0 min-h-0 ${d?"bg-primary":"bg-muted-foreground/40"}`},c))})}let p="custom";function q({value:a,customValue:e,onChange:f}){let{t:g}=(0,d.useI18n)(),[i,k]=(0,c.useState)(!1),l=(0,c.useRef)(null),m=a===p,r=m?null:h.find(b=>b.id===a)??h[2],[s,t]=(0,c.useState)(e?.cols??2),[u,v]=(0,c.useState)(e?.rows??2),[w,x]=(0,c.useState)({minCols:1,maxCols:5,minRows:1,maxRows:5});(0,c.useEffect)(()=>{(0,n.getConfigValues)(["missions.grid.minCols","missions.grid.maxCols","missions.grid.minRows","missions.grid.maxRows"]).then(a=>{x({minCols:a["missions.grid.minCols"]??1,maxCols:a["missions.grid.maxCols"]??5,minRows:a["missions.grid.minRows"]??1,maxRows:a["missions.grid.maxRows"]??5})})},[]),(0,c.useEffect)(()=>{e&&(t(e.cols),v(e.rows))},[e?.cols,e?.rows]),(0,c.useEffect)(()=>{if(i)return document.addEventListener("mousedown",a),()=>document.removeEventListener("mousedown",a);function a(a){l.current&&!l.current.contains(a.target)&&k(!1)}},[i]);let y=(a,b,c)=>Math.max(b,Math.min(c,a)),z=m?s:r?.cols??2,A=m?u:r?.rows??2,B=m?`${s}\xd7${u}`:r?.label??"";return(0,b.jsxs)("div",{ref:l,className:"relative",children:[(0,b.jsxs)(j.Button,{variant:"outline",onClick:()=>k(a=>!a),className:"gap-2",children:[(0,b.jsx)(o,{cols:z,rows:A,active:!1}),(0,b.jsx)("span",{children:B}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:"▼"})]}),i&&(0,b.jsxs)("div",{className:"absolute right-0 z-50 mt-1 w-72 rounded-lg border border-border bg-popover shadow-xl p-3",children:[(0,b.jsx)("h5",{className:"text-sm font-semibold text-foreground mb-3",children:g("missions.gridPreset")}),(0,b.jsxs)("div",{className:"flex flex-col gap-0.5",children:[h.map(c=>{let d=c.id===a;return(0,b.jsxs)("button",{onClick:()=>{f(c.id),k(!1)},className:`flex items-center gap-3 px-3 py-2.5 rounded-lg transition-colors ${d?"bg-primary/10":"hover:bg-accent"}`,children:[(0,b.jsx)(o,{cols:c.cols,rows:c.rows,active:d}),(0,b.jsx)("span",{className:`text-sm font-medium flex-1 text-left ${d?"text-primary":"text-foreground"}`,children:c.label}),(0,b.jsx)("span",{className:`text-xs ${d?"text-primary/60":"text-muted-foreground"}`,children:c.desc})]},c.id)}),(0,b.jsxs)("div",{className:"mt-1 border-t border-border pt-2",children:[(0,b.jsxs)("button",{onClick:()=>{m||f(p,{cols:s,rows:u})},className:`flex items-center gap-3 px-3 py-2.5 rounded-lg transition-colors w-full ${m?"bg-primary/10":"hover:bg-accent"}`,children:[(0,b.jsx)(o,{cols:s,rows:u,active:m}),(0,b.jsx)("span",{className:`text-sm font-medium flex-1 text-left ${m?"text-primary":"text-foreground"}`,children:g("missions.gridCustom")}),(0,b.jsxs)("span",{className:`text-xs ${m?"text-primary/60":"text-muted-foreground"}`,children:[s,"×",u]})]}),m&&(0,b.jsxs)("div",{className:"flex items-center gap-3 px-3 py-2",children:[(0,b.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground",children:g("missions.gridCols")}),(0,b.jsx)("input",{type:"number",min:w.minCols,max:w.maxCols,value:s,onChange:a=>{let b;t(b=y(Number(a.target.value),w.minCols,w.maxCols)),f(p,{cols:b,rows:u})},className:"h-7 w-14 rounded-md border border-border bg-background px-2 text-sm text-center"})]}),(0,b.jsx)("span",{className:"text-muted-foreground",children:"×"}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground",children:g("missions.gridRows")}),(0,b.jsx)("input",{type:"number",min:w.minRows,max:w.maxRows,value:u,onChange:a=>{let b;v(b=y(Number(a.target.value),w.minRows,w.maxRows)),f(p,{cols:s,rows:b})},className:"h-7 w-14 rounded-md border border-border bg-background px-2 text-sm text-center"})]})]})]})]})]})]})}var r=a.i(830383),s=a.i(223982),t=a.i(496752),u=a.i(851033),v=a.i(971605);let w=(0,l.default)("grip-vertical",[["circle",{cx:"9",cy:"12",r:"1",key:"1vctgf"}],["circle",{cx:"9",cy:"5",r:"1",key:"hp0tcf"}],["circle",{cx:"9",cy:"19",r:"1",key:"fkjjf6"}],["circle",{cx:"15",cy:"12",r:"1",key:"1tmaij"}],["circle",{cx:"15",cy:"5",r:"1",key:"19l28e"}],["circle",{cx:"15",cy:"19",r:"1",key:"f4zoj3"}]]),x=(0,l.default)("arrow-up-right",[["path",{d:"M7 7h10v10",key:"1tivn9"}],["path",{d:"M7 17 17 7",key:"1vkiza"}]]);var y=a.i(17787);let z=(0,l.default)("square-terminal",[["path",{d:"m7 11 2-2-2-2",key:"1lz0vl"}],["path",{d:"M11 13h4",key:"1p7l4v"}],["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",ry:"2",key:"1m3agn"}]]);var A=a.i(348160),B=a.i(481030),C=a.i(958372),D=a.i(511153);let E=(0,t.default)(async()=>{},{loadableGenerated:{modules:[7468]},ssr:!1,loading:()=>(0,b.jsx)("div",{className:"h-full w-full bg-[#0a0a0a] animate-pulse"})});function F({execution:a,isRemoving:e,removeReason:f,onStop:g,onSessionEnd:h}){let{t:i}=(0,d.useI18n)(),k=(0,u.useRouter)(),{attributes:l,listeners:m,setNodeRef:n,transform:o,transition:p}=(0,s.useSortable)({id:a.executionId}),q={transform:v.CSS.Transform.toString(o),transition:p,opacity:+!e},[r,t]=(0,c.useState)(()=>a.startedAt?Math.floor((Date.now()-new Date(a.startedAt).getTime())/1e3):0);(0,c.useEffect)(()=>{if(e)return;let b=setInterval(()=>{t(a.startedAt?Math.floor((Date.now()-new Date(a.startedAt).getTime())/1e3):0)},1e3);return()=>clearInterval(b)},[a.startedAt,e]);let G=Math.floor(r/60),H=`${G}m ${r%60}s`;async function I(){if(a.projectLocalPath)try{await (0,C.openInTerminal)(a.projectLocalPath)}catch{D.toast.error(i("preview.terminalError"))}}return(0,b.jsxs)("div",{ref:n,style:q,className:"border border-border rounded-lg overflow-hidden flex flex-col transition-opacity duration-300",...l,children:[(0,b.jsxs)("div",{className:"h-10 px-3 flex items-center gap-1 border-b border-border bg-card shrink-0",children:[(0,b.jsx)("button",{...m,"aria-label":i("missions.dragHandle"),"aria-roledescription":"sortable",className:"cursor-grab text-muted-foreground hover:text-foreground mr-1",children:(0,b.jsx)(w,{className:"h-3.5 w-3.5"})}),(0,b.jsxs)("span",{className:"text-[11px] text-muted-foreground truncate flex-1",children:[a.workspaceName," ›"," ",a.projectAlias||a.projectName," ›"," ",(0,b.jsx)("span",{className:"text-foreground font-semibold",children:a.taskTitle})]}),e?(0,b.jsx)(B.Badge,{variant:"outline",className:"text-[11px] text-muted-foreground bg-muted ml-1 shrink-0",children:"stopped"===f?i("missions.statusStopped"):i("missions.statusCompleted")}):(0,b.jsx)(B.Badge,{variant:"outline",className:"text-[11px] text-primary border-primary/30 bg-primary/10 ml-1 shrink-0",children:i("missions.statusRunning")}),(0,b.jsx)("span",{className:"text-[11px] text-muted-foreground ml-1 shrink-0",children:H}),a.projectLocalPath&&(0,b.jsxs)(A.Tooltip,{children:[(0,b.jsx)(A.TooltipTrigger,{render:(0,b.jsx)(j.Button,{variant:"ghost",size:"icon",className:"ml-1 shrink-0 text-muted-foreground",onClick:I}),children:(0,b.jsx)(z,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(A.TooltipContent,{children:i("missions.openInTerminal")})]}),(0,b.jsxs)(A.Tooltip,{children:[(0,b.jsx)(A.TooltipTrigger,{render:(0,b.jsx)(j.Button,{variant:"ghost",size:"icon",className:"ml-1 shrink-0 text-muted-foreground",onClick:()=>k.push(`/workspaces/${a.workspaceId}/tasks/${a.taskId}`)}),children:(0,b.jsx)(x,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(A.TooltipContent,{children:i("missions.openFullView")})]}),(0,b.jsxs)(A.Tooltip,{children:[(0,b.jsx)(A.TooltipTrigger,{render:(0,b.jsx)(j.Button,{variant:"destructive",size:"icon",className:"ml-1 shrink-0",onClick:()=>g(a.taskId),disabled:e}),children:(0,b.jsx)(y.X,{className:"h-3.5 w-3.5"})}),(0,b.jsx)(A.TooltipContent,{children:i("missions.stopTask")})]})]}),(0,b.jsx)("div",{className:"flex-1 overflow-hidden",children:(0,b.jsx)(E,{taskId:a.taskId,worktreePath:a.worktreePath??a.projectLocalPath,onSessionEnd:b=>h?.(a.taskId,b),useCanvasRenderer:!0})})]})}let G=(0,e.createServerReference)("40affac6e2d94f941de4352ef66bc770b735ee2daa",e.callServer,void 0,e.findSourceMapURL,"getWorkspacesWithRecentTasks"),H=(0,e.createServerReference)("4063c8bcd08de88b4feaf9e92348e0eddc2352cd43",e.callServer,void 0,e.findSourceMapURL,"getProjectTasks");var I=a.i(843027),J=a.i(251787),K=a.i(755811);let L=(0,l.default)("play",[["path",{d:"M5 5a2 2 0 0 1 3.008-1.728l11.997 6.998a2 2 0 0 1 .003 3.458l-12 7A2 2 0 0 1 5 19z",key:"10ikf1"}]]);var M=a.i(659560),N=a.i(55213);let O={TODO:"TODO",IN_PROGRESS:"Running",IN_REVIEW:"Review"},P={LOW:"Low",MEDIUM:"Med",HIGH:"High",CRITICAL:"Crit"};function Q({status:a}){return(0,b.jsx)("span",{className:`text-[10px] px-1.5 py-0.5 rounded font-medium ${{TODO:"bg-slate-100 text-slate-600 dark:bg-slate-800 dark:text-slate-400",IN_PROGRESS:"bg-blue-100 text-blue-700 dark:bg-blue-900/30 dark:text-blue-400",IN_REVIEW:"bg-amber-100 text-amber-700 dark:bg-amber-900/30 dark:text-amber-400"}[a]??"bg-slate-100 text-slate-600"}`,children:O[a]??a})}function R({task:a,isRunning:c,launchingId:d,onLaunchNew:e,onResume:f,t:g}){let h=a.executions?.[0]?.sessionId,i=d===a.id;return(0,b.jsxs)("div",{className:"group/task flex items-center gap-2 px-3 py-1.5 hover:bg-accent/50 cursor-default",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("p",{className:`text-sm truncate ${c?"italic text-muted-foreground":""}`,children:a.title}),(0,b.jsxs)("div",{className:"flex items-center gap-1.5 mt-0.5",children:[(0,b.jsx)(Q,{status:a.status}),(0,b.jsx)("span",{className:"text-[10px] text-muted-foreground",children:P[a.priority]??a.priority})]})]}),c?(0,b.jsx)("span",{className:"text-[10px] italic text-muted-foreground shrink-0",children:g("missions.alreadyMonitored")}):(0,b.jsxs)("div",{className:"flex items-center gap-1 opacity-0 group-hover/task:opacity-100 transition-opacity shrink-0",children:[h&&(0,b.jsxs)(j.Button,{variant:"outline",className:"h-6 px-2 text-xs",onClick:()=>f(a.id,h),disabled:i,title:g("missions.continueSession"),children:[(0,b.jsx)(M.RotateCcw,{className:"h-3 w-3 mr-1"}),g("missions.continueLabel")]}),(0,b.jsxs)(j.Button,{variant:"outline",className:"h-6 px-2 text-xs",onClick:()=>e(a.id),disabled:i,title:g("missions.launchNew"),children:[(0,b.jsx)(L,{className:"h-3 w-3 mr-1"}),i?"...":g("missions.launchNewLabel")]})]})]})}function S({open:a,onOpenChange:e,onLaunchNew:f,onResume:g,runningTaskIds:h,launchingId:j}){let{t:k}=(0,d.useI18n)(),[l,m]=(0,c.useState)([]),[n,o]=(0,c.useState)(""),[p,q]=(0,c.useState)(""),[r,s]=(0,c.useState)([]);(0,c.useEffect)(()=>{a&&(o(""),q(""),s([]),G(100).then(m).catch(()=>D.toast.error(k("missions.error.launchFailed"))))},[a,k]),(0,c.useEffect)(()=>{p?H(p).then(a=>{s(a.filter(a=>"TODO"===a.status||"IN_PROGRESS"===a.status||"IN_REVIEW"===a.status))}).catch(()=>D.toast.error(k("missions.error.launchFailed"))):s([])},[p,k]);let t=l.find(a=>a.id===n),u=t?.projects??[];return(0,b.jsx)(K.Dialog,{open:a,onOpenChange:e,children:(0,b.jsxs)(K.DialogContent,{className:"max-w-lg max-h-[70vh] flex flex-col",children:[(0,b.jsx)(K.DialogHeader,{children:(0,b.jsx)(K.DialogTitle,{children:k("missions.fullPickerTitle")})}),(0,b.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,b.jsxs)(i.Select,{value:n,onValueChange:a=>{o(a??""),q("")},children:[(0,b.jsx)(i.SelectTrigger,{id:"full-picker-ws",className:"w-48 h-8",children:(0,b.jsx)("span",{className:"truncate",children:l.find(a=>a.id===n)?.name??k("missions.launcher.selectWorkspace")})}),(0,b.jsx)(i.SelectContent,{children:l.map(a=>(0,b.jsx)(i.SelectItem,{value:a.id,children:a.name},a.id))})]}),(0,b.jsxs)(i.Select,{value:p,onValueChange:a=>q(a??""),disabled:!n,children:[(0,b.jsx)(i.SelectTrigger,{id:"full-picker-proj",className:"w-48 h-8",children:(0,b.jsx)("span",{className:"truncate",children:u.find(a=>a.id===p)?.name??k("missions.launcher.selectProject")})}),(0,b.jsx)(i.SelectContent,{children:u.map(a=>(0,b.jsx)(i.SelectItem,{value:a.id,children:a.alias??a.name},a.id))})]})]}),(0,b.jsx)(N.ScrollArea,{className:"flex-1 min-h-0 -mx-2",children:0===r.length&&p?(0,b.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:k("missions.launcher.noTasks")}):0===r.length?(0,b.jsx)("p",{className:"text-sm text-muted-foreground text-center py-8",children:k("missions.fullPickerHint")}):r.map(a=>(0,b.jsx)(R,{task:a,isRunning:h.has(a.id),launchingId:j,onLaunchNew:f,onResume:g,t:k},a.id))})]})})}function T({open:a,onOpenChange:e,onLaunched:f,runningTaskIds:g=new Set,anchorRef:h}){let{t:i}=(0,d.useI18n)(),k=(0,c.useRef)(null),[l,m]=(0,c.useState)([]),[n,o]=(0,c.useState)(!1),[p,q]=(0,c.useState)(null),[r,s]=(0,c.useState)(!1);(0,c.useEffect)(()=>{a&&(o(!0),G(3).then(m).catch(()=>D.toast.error(i("missions.error.launchFailed"))).finally(()=>o(!1)))},[a,i]),(0,c.useEffect)(()=>{if(a)return document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b);function b(a){let b=a.target;if(k.current&&!k.current.contains(b)){if(h?.current&&h.current.contains(b))return;e(!1)}}},[a,e,h]);let t=(0,c.useCallback)(async a=>{try{q(a),await (0,I.startPtyExecution)(a,""),f(a),e(!1),s(!1)}catch{D.toast.error(i("missions.error.launchFailed"))}finally{q(null)}},[f,e,i]),u=(0,c.useCallback)(async(a,b)=>{try{q(a),await (0,J.resumePtyExecution)(a,b),f(a),e(!1),s(!1)}catch{D.toast.error(i("missions.error.launchFailed"))}finally{q(null)}},[f,e,i]),v=(0,c.useCallback)(()=>{e(!1),s(!0)},[e]);return a||r?(0,b.jsxs)(b.Fragment,{children:[a&&(0,b.jsxs)("div",{ref:k,className:"absolute right-0 z-50 mt-1 w-96 rounded-lg border border-border bg-popover shadow-xl flex flex-col overflow-hidden",style:{maxHeight:"480px"},children:[(0,b.jsx)("div",{className:"px-3 py-2 border-b border-border shrink-0",children:(0,b.jsx)("p",{className:"text-xs font-semibold text-muted-foreground uppercase tracking-wide",children:i("missions.pickerTitle")})}),(0,b.jsx)(N.ScrollArea,{className:"flex-1 min-h-0",children:n?(0,b.jsx)("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:"Loading..."}):0===l.length?(0,b.jsx)("div",{className:"flex items-center justify-center py-8 text-sm text-muted-foreground",children:i("missions.noAvailableTasks")}):l.map(a=>(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"sticky top-0 z-10 px-3 py-1.5 bg-popover border-b border-border/50",children:(0,b.jsx)("span",{className:"text-[11px] font-semibold text-muted-foreground uppercase tracking-wider",children:a.name})}),a.projects.map(a=>0===a._count.tasks?null:(0,b.jsxs)("div",{className:"mb-1",children:[(0,b.jsx)("div",{className:"px-3 pt-2 pb-0.5",children:(0,b.jsx)("span",{className:"text-xs font-medium text-foreground",children:a.alias??a.name})}),a.tasks.map(a=>(0,b.jsx)(R,{task:a,isRunning:g.has(a.id),launchingId:p,onLaunchNew:t,onResume:u,t:i},a.id))]},a.id))]},a.id))}),(0,b.jsx)("div",{className:"shrink-0 border-t border-border",children:(0,b.jsx)(j.Button,{variant:"ghost",className:"w-full rounded-none text-xs text-primary font-medium",onClick:v,children:i("missions.showMoreTasks")})})]}),(0,b.jsx)(S,{open:r,onOpenChange:s,onLaunchNew:t,onResume:u,runningTaskIds:g,launchingId:p})]}):null}a.s(["MissionsClient",0,function({initialExecutions:a}){let{t:e}=(0,d.useI18n)(),[l,n]=(0,c.useState)(a),[o,p]=(0,c.useState)(()=>"3x2"),[t,u]=(0,c.useState)(()=>({cols:2,rows:2})),[v,w]=(0,c.useState)(!1),[x,y]=(0,c.useState)(""),z=(0,c.useRef)(null),[A,B]=(0,c.useState)(new Map),C=(0,c.useRef)(A);(0,c.useEffect)(()=>{C.current=A},[A]);let E=(0,c.useRef)(new Map),G=h.find(a=>a.id===o)??h[2],H="custom"===o?t.cols:G.cols,I="custom"===o?t.rows:G.rows,J=(0,c.useRef)(null),[K,L]=(0,c.useState)("480px");(0,c.useEffect)(()=>{let a=J.current;if(!a)return;let b=()=>{let b=(a.clientHeight-32-16*(I-1))/I;L(`${Math.max(b,200)}px`)};b();let c=new ResizeObserver(b);return c.observe(a),()=>c.disconnect()},[I]);let M=(0,c.useCallback)((a,b)=>{a&&(p(a),localStorage.setItem("missions-grid-preset",a),"custom"===a&&b&&(u(b),localStorage.setItem("missions-grid-custom",JSON.stringify(b))))},[]),N=(0,r.useSensors)((0,r.useSensor)(r.PointerSensor,{activationConstraint:{distance:8}})),O=(0,c.useCallback)(a=>{let{active:b,over:c}=a;c&&b.id!==c.id&&n(a=>{let d=a.findIndex(a=>a.executionId===b.id),e=a.findIndex(a=>a.executionId===c.id);return(0,s.arrayMove)(a,d,e)})},[]),P=(0,c.useCallback)((a,b)=>{if(C.current.has(a))return;B(c=>new Map([...c,[a,b]]));let c=setTimeout(()=>{n(b=>b.filter(b=>b.executionId!==a)),B(b=>{let c=new Map(b);return c.delete(a),c}),E.current.delete(a)},500);E.current.set(a,c)},[]);(0,c.useEffect)(()=>{let a=setInterval(async()=>{try{let a=await f();n(b=>{let c=C.current,{merged:d,goneIds:e}=function({prev:a,fresh:b,removingIds:c}){let d=new Set(b.map(a=>a.executionId)),e=[];a.forEach(a=>{d.has(a.executionId)||c.has(a.executionId)||e.push(a.executionId)});let f=a.filter(a=>d.has(a.executionId)||c.has(a.executionId)),g=new Set(a.map(a=>a.executionId));return{merged:[...f,...b.filter(a=>!g.has(a.executionId))],goneIds:e}}({prev:b,fresh:a,removingIds:new Set(c.keys())});return e.forEach(a=>P(a,"completed")),d})}catch{}},4e3);return()=>clearInterval(a)},[P]),(0,c.useEffect)(()=>{let a=E.current;return()=>{a.forEach(a=>clearTimeout(a))}},[]);let Q=(0,c.useCallback)(async a=>{try{await (0,g.stopPtyExecution)(a),n(b=>{let c=b.find(b=>b.taskId===a);return c&&P(c.executionId,"stopped"),b})}catch{D.toast.error(e("missions.error.stopFailed"))}},[P,e]),R=(0,c.useCallback)((a,b)=>{n(b=>{let c=b.find(b=>b.taskId===a);return c&&P(c.executionId,"completed"),b})},[P]),S=(0,c.useCallback)(a=>{f().then(a=>{n(b=>{let c=new Set(b.map(a=>a.executionId));return[...b,...a.filter(a=>!c.has(a.executionId))]})}).catch(()=>{})},[]),U=Array.from(new Map(l.map(a=>[a.workspaceId,a.workspaceName])).entries()).map(([a,b])=>({id:a,name:b})),V=x?l.filter(a=>a.workspaceId===x):l,W=new Set(l.map(a=>a.taskId));return(0,b.jsxs)("div",{className:"flex h-full flex-col",children:[(0,b.jsxs)("div",{className:"header-sm shrink-0 px-4 flex items-center gap-3",children:[(0,b.jsx)("h1",{className:"text-base font-semibold",children:e("missions.pageTitle")}),(0,b.jsxs)(i.Select,{value:x,onValueChange:a=>y(a??""),children:[(0,b.jsx)(i.SelectTrigger,{className:"w-36 h-8",children:(0,b.jsx)("span",{className:"truncate",children:x?U.find(a=>a.id===x)?.name??e("missions.filterAll"):e("missions.filterAll")})}),(0,b.jsxs)(i.SelectContent,{children:[(0,b.jsx)(i.SelectItem,{value:"",children:e("missions.filterAll")}),U.map(a=>(0,b.jsx)(i.SelectItem,{value:a.id,children:a.name},a.id))]})]}),(0,b.jsx)("div",{className:"flex-1"}),(0,b.jsx)(q,{value:o,customValue:t,onChange:M}),(0,b.jsxs)("div",{className:"relative",children:[(0,b.jsx)(j.Button,{ref:z,onClick:()=>w(a=>!a),children:e("missions.launchTask")}),(0,b.jsx)(T,{open:v,onOpenChange:w,onLaunched:S,runningTaskIds:W,anchorRef:z})]})]}),(0,b.jsx)("div",{ref:J,className:"flex-1 overflow-auto min-h-0 p-4",children:0===V.length&&0===A.size?(0,b.jsx)(k.EmptyState,{icon:m,title:e("missions.emptyTitle"),description:e("missions.emptyDesc"),className:"h-full",action:(0,b.jsx)(j.Button,{onClick:()=>w(!0),children:e("missions.launchTask")})}):(0,b.jsx)(r.DndContext,{id:"missions-dnd",sensors:N,collisionDetection:r.closestCenter,onDragEnd:O,children:(0,b.jsx)(s.SortableContext,{items:V.map(a=>a.executionId),strategy:s.rectSortingStrategy,children:(0,b.jsx)("div",{className:"grid gap-4",style:{gridTemplateColumns:`repeat(${H}, 1fr)`,gridAutoRows:K},children:V.map(a=>(0,b.jsx)(F,{execution:a,isRemoving:A.has(a.executionId),removeReason:A.get(a.executionId),onStop:Q,onSessionEnd:R},a.executionId))})})})})]})}],917691)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=tower_src_app_missions_missions-client_tsx_0a9vjyr._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[585664,a=>{"use strict";var b=a.i(348273),c=a.i(399424),d=a.i(851033),e=a.i(706193),f=a.i(422917),g=a.i(524513),h=a.i(560874),i=a.i(707466);function j({className:a,size:c="default",...d}){return(0,b.jsx)("div",{"data-slot":"card","data-size":c,className:(0,i.cn)("group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",a),...d})}function k({className:a,...c}){return(0,b.jsx)("div",{"data-slot":"card-content",className:(0,i.cn)("px-4 group-data-[size=sm]/card:px-3",a),...c})}var l=a.i(348754),m=a.i(235022),n=a.i(17787),o=a.i(737316),p=a.i(136913),q=a.i(526116),r=a.i(282980);function s({adapterType:a,adapterLabel:d,onResult:e}){let[g,h]=(0,c.useState)(!1),[t,u]=(0,c.useState)(null),{t:v}=(0,r.useI18n)();async function w(){if(!g){h(!0),u(null);try{let b=await fetch("/api/adapters/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({adapterType:a})}),c=await b.json();u(c),e?.(c)}catch{let a={ok:!1,checks:[{name:"network_error",passed:!1,message:"Network request failed"}]};u(a),e?.(a)}finally{h(!1)}}}return(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:"rounded-lg bg-emerald-100 dark:bg-emerald-900/30 p-2",children:(0,b.jsx)(o.Terminal,{className:"h-5 w-5 text-emerald-600 dark:text-emerald-400"})}),(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"font-semibold",children:v("settings.aiTools.cliVerification")}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:v("settings.aiTools.cliVerificationDesc")})]})]}),(0,b.jsx)(j,{children:(0,b.jsxs)(k,{className:"p-6 space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)("div",{children:d&&(0,b.jsx)("p",{className:"font-medium",children:d})}),(0,b.jsx)(f.Button,{onClick:w,disabled:g,variant:"outline",children:g?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(l.Loader2,{className:"h-4 w-4 animate-spin mr-2"}),v("settings.aiTools.testing")]}):v("settings.aiTools.testConnection")})]}),t&&(0,b.jsxs)("div",{className:(0,i.cn)("rounded-lg border p-4 space-y-3",t.ok?"bg-green-50 border-green-200 dark:bg-green-950/20 dark:border-green-800":"bg-red-50 border-red-200 dark:bg-red-950/20 dark:border-red-800"),children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[t.ok?(0,b.jsx)(p.CheckCircle2,{className:"h-4 w-4 text-green-600 dark:text-green-400"}):(0,b.jsx)(q.XCircle,{className:"h-4 w-4 text-red-600 dark:text-red-400"}),(0,b.jsx)("span",{className:(0,i.cn)("text-sm font-medium",t.ok?"text-green-700 dark:text-green-300":"text-red-700 dark:text-red-300"),children:v(t.ok?"settings.aiTools.testPassed":"settings.aiTools.testFailed")})]}),(0,b.jsx)("div",{className:"space-y-2",children:t.checks.map(c=>(0,b.jsxs)("div",{className:"flex items-start gap-2 text-sm",children:[c.passed?(0,b.jsx)(m.Check,{className:"h-4 w-4 text-green-500 mt-0.5 shrink-0"}):(0,b.jsx)(n.X,{className:"h-4 w-4 text-red-500 mt-0.5 shrink-0"}),(0,b.jsx)("span",{className:(0,i.cn)(c.passed?"text-green-700 dark:text-green-300":"text-red-700 dark:text-red-300"),children:c.message})]},`${a}-${c.name}`))})]})]})})]})}var t=a.i(441388);let u=(0,t.createServerReference)("4005c118a2d5014fae5b4e81f1834a65959012cb0a",t.callServer,void 0,t.findSourceMapURL,"completeOnboarding");var v=a.i(964344),w=a.i(173250);let x=(0,w.default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);var y=a.i(280844),z=a.i(148997),A=a.i(772253),B=a.i(538186),C=a.i(167727);let D=(0,w.default)("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),E=(0,w.default)("languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);var F=a.i(709222),G=a.i(657673);function H({step:a}){let c=[x,o.Terminal,y.GitBranch][a-1]??x,d=["Profile","Connect","Configure"][a-1]??"";return(0,b.jsxs)("div",{className:"relative h-full w-full overflow-hidden",children:[(0,b.jsx)("div",{className:"absolute inset-0 opacity-[0.07] text-white",style:{backgroundImage:"radial-gradient(circle, currentColor 1px, transparent 1px)",backgroundSize:"24px 24px"}}),(0,b.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{width:"380px",height:"380px",background:"radial-gradient(circle, oklch(0.80 0.14 75 / 0.25) 0%, oklch(0.80 0.14 75 / 0.08) 45%, transparent 70%)",animation:"ob-pulse 6s ease-in-out infinite"}}),(0,b.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full border border-amber-400/25",style:{width:"260px",height:"260px",animation:"ob-spin 20s linear infinite"},children:(0,b.jsx)("div",{className:"absolute -top-1.5 left-1/2 -translate-x-1/2 h-3 w-3 rounded-full bg-amber-400",style:{boxShadow:"0 0 16px oklch(0.80 0.14 75 / 0.7)"}})}),(0,b.jsxs)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full border border-amber-400/15",style:{width:"380px",height:"380px",animation:"ob-spin 30s linear infinite reverse"},children:[(0,b.jsx)("div",{className:"absolute -top-1 left-1/2 -translate-x-1/2 h-2 w-2 rounded-full bg-amber-400/70"}),(0,b.jsx)("div",{className:"absolute -bottom-1 left-1/2 -translate-x-1/2 h-1.5 w-1.5 rounded-full bg-amber-400/50"})]}),(0,b.jsx)("svg",{className:"absolute",style:{top:"18%",right:"22%",animation:"ob-float 8s ease-in-out infinite"},width:"44",height:"50",viewBox:"0 0 40 46",fill:"none",children:(0,b.jsx)("path",{d:"M20 1 L38 12 L38 34 L20 45 L2 34 L2 12 Z",stroke:"oklch(0.80 0.14 75 / 0.4)",strokeWidth:"1.5",fill:"oklch(0.80 0.14 75 / 0.06)"})}),(0,b.jsx)("svg",{className:"absolute",style:{bottom:"22%",left:"18%",animation:"ob-float 10s ease-in-out 2s infinite"},width:"32",height:"36",viewBox:"0 0 40 46",fill:"none",children:(0,b.jsx)("path",{d:"M20 1 L38 12 L38 34 L20 45 L2 34 L2 12 Z",stroke:"oklch(0.80 0.14 75 / 0.3)",strokeWidth:"1.5",fill:"oklch(0.80 0.14 75 / 0.05)"})}),(0,b.jsx)("div",{className:"absolute h-3.5 w-3.5 rounded-full bg-amber-400/40",style:{top:"30%",left:"28%",animation:"ob-float 7s ease-in-out 1s infinite"}}),(0,b.jsx)("div",{className:"absolute h-2.5 w-2.5 rounded-full bg-amber-400/30",style:{top:"65%",right:"30%",animation:"ob-float 9s ease-in-out 3s infinite"}}),(0,b.jsx)("div",{className:"absolute h-2 w-2 rounded-full bg-amber-400/20",style:{top:"45%",right:"15%",animation:"ob-float 6s ease-in-out 0.5s infinite"}}),(0,b.jsxs)("svg",{className:"absolute inset-0 h-full w-full text-white opacity-[0.12]",children:[(0,b.jsx)("line",{x1:"30%",y1:"25%",x2:"70%",y2:"45%",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"4 6",style:{animation:"ob-dash 12s linear infinite"}}),(0,b.jsx)("line",{x1:"65%",y1:"30%",x2:"35%",y2:"70%",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"4 6",style:{animation:"ob-dash 15s linear infinite reverse"}})]}),(0,b.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 flex items-center justify-center",children:(0,b.jsx)("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl border border-amber-400/35 bg-amber-500/10 backdrop-blur-sm transition-all duration-700",style:{boxShadow:"0 0 50px oklch(0.80 0.14 75 / 0.2)"},children:(0,b.jsx)(c,{className:"h-7 w-7 text-amber-400"})})}),(0,b.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 translate-y-12 text-center",children:(0,b.jsx)("p",{className:"text-[11px] font-medium tracking-widest uppercase text-amber-400/60",children:d})})]})}let I={host:"",ownerMatch:"*",localPathTemplate:""};a.s(["default",0,function(){let a,i,j,k=(0,d.useRouter)(),{t:l,locale:n,setLocale:p}=(0,r.useI18n)(),{theme:q,setTheme:t}=(0,e.useTheme)(),[w,J]=(0,c.useState)(!1),[K,L]=(0,c.useState)(1),[M,N]=(0,c.useState)(""),[O,P]=(0,c.useState)(null),[Q,R]=(0,c.useState)([]),[S,T]=(0,c.useState)({...I}),[U,V]=(0,c.useState)(!0),[W,X]=(0,c.useState)(0),[Y,Z]=(0,c.useState)(!1),[$,_]=(0,c.useState)(!1);(0,c.useEffect)(()=>J(!0),[]);let aa=[{value:"light",label:(0,b.jsx)(B.Sun,{className:"h-4 w-4"})},{value:"dark",label:(0,b.jsx)(C.Moon,{className:"h-4 w-4"})},{value:"system",label:(0,b.jsx)(D,{className:"h-4 w-4"})}];function ab(){L(a=>a+1)}function ac(){L(a=>Math.max(1,a-1))}async function ad(){_(!0);try{Q.length>0&&await (0,v.setConfigValue)("git.pathMappingRules",Q),await u(M.trim()),k.replace("/workspaces")}catch{_(!1)}}let ae=[{icon:x,label:l("onboarding.step1.title")},{icon:o.Terminal,label:l("onboarding.step2.title")},{icon:y.GitBranch,label:l("onboarding.step3.title")}];return(0,b.jsxs)("div",{className:"flex h-screen bg-background",children:[(0,b.jsx)("div",{className:"hidden xl:block xl:w-3/5 border-r border-border/50 bg-[oklch(0.13_0.006_260)]",children:(0,b.jsx)(H,{step:K})}),(0,b.jsx)("div",{className:"flex w-full flex-col items-center px-8 pt-[10vh] pb-10 xl:w-2/5 xl:px-16 overflow-y-auto",children:(0,b.jsxs)("div",{className:"w-full max-w-lg space-y-6",children:[(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,b.jsx)("img",{src:"/logo.png",alt:"Tower",className:"h-8 w-8 rounded-lg"}),(0,b.jsx)("span",{className:"text-lg font-semibold tracking-tight",children:"Tower"})]}),(0,b.jsx)("div",{className:"flex items-center gap-1.5",children:ae.map((a,c)=>{let d=c+1,e=d===K,f=d<K,g=a.icon;return(0,b.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[c>0&&(0,b.jsx)("div",{className:`h-px w-4 transition-colors duration-500 ${f?"bg-primary":"bg-border"}`}),(0,b.jsxs)("div",{className:`flex items-center gap-1 shrink-0 rounded-full px-2 py-1 text-[11px] font-medium whitespace-nowrap transition-all duration-500 ${e?"bg-primary text-primary-foreground shadow-sm":f?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"}`,children:[f?(0,b.jsx)(m.Check,{className:"h-3 w-3 shrink-0"}):(0,b.jsx)(g,{className:"h-3 w-3 shrink-0"}),(0,b.jsx)("span",{children:a.label})]})]},c)})})]}),(0,b.jsxs)("div",{children:[1===K&&(0,b.jsxs)("div",{className:"space-y-7 animate-in fade-in slide-in-from-left-4 duration-500",children:[(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:l("onboarding.step1.title")}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed",children:l("onboarding.step1.desc")})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:"onboarding-username",className:"text-sm font-medium",children:l("onboarding.step1.usernameLabel")}),(0,b.jsx)("input",{id:"onboarding-username",type:"text",value:M,onChange:a=>N(a.target.value),placeholder:l("onboarding.step1.usernamePlaceholder"),className:"flex h-10 w-full rounded-lg border border-input bg-transparent px-3 py-2 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",maxLength:64,autoFocus:!0,autoComplete:"username"})]}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,b.jsxs)("div",{className:"space-y-2.5",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(E,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,b.jsx)("label",{className:"text-sm font-medium",children:l("settings.language")})]}),(0,b.jsx)(h.SegmentedControl,{options:[{value:"zh",label:"中文"},{value:"en",label:"English"}].map(a=>({value:a.value,label:a.label})),value:n,onChange:a=>p(a)})]}),(0,b.jsxs)("div",{className:"space-y-2.5",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(B.Sun,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,b.jsx)("label",{className:"text-sm font-medium",children:l("settings.theme")})]}),w?(0,b.jsx)(h.SegmentedControl,{options:aa.map(a=>({value:a.value,label:a.label})),value:q??"system",onChange:a=>t(a)}):(0,b.jsx)("div",{className:"inline-flex h-8 rounded-md border border-border bg-muted p-1 gap-1 w-[120px]"})]})]}),(0,b.jsx)("div",{className:"flex justify-end pt-3",children:(0,b.jsxs)(f.Button,{onClick:ab,disabled:0===M.trim().length,className:"px-5",children:[l("onboarding.step1.next"),(0,b.jsx)(A.ChevronRight,{className:"h-4 w-4 ml-1"})]})})]}),2===K&&(0,b.jsxs)("div",{className:"space-y-7 animate-in fade-in slide-in-from-left-4 duration-500",children:[(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:l("onboarding.step2.title")}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed",children:l("onboarding.step2.desc")})]}),(0,b.jsx)(s,{adapterType:"claude_code",adapterLabel:"Claude CLI",onResult:P}),(0,b.jsxs)("div",{className:"flex items-center justify-between pt-3",children:[(0,b.jsxs)(f.Button,{variant:"ghost",className:"text-muted-foreground",onClick:ac,children:[(0,b.jsx)(z.ChevronLeft,{className:"h-4 w-4 mr-1"}),l("onboarding.back")]}),(0,b.jsxs)(f.Button,{onClick:ab,disabled:!O?.ok,className:"px-5",children:[l("onboarding.step1.next"),(0,b.jsx)(A.ChevronRight,{className:"h-4 w-4 ml-1"})]})]})]}),3===K&&(0,b.jsxs)("div",{className:"space-y-5 animate-in fade-in slide-in-from-left-4 duration-500",children:[(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:l("onboarding.step3.title")}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed",children:l("onboarding.step3.desc")})]}),Q.length>0&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:l("onboarding.step3.added").replace("{count}",String(Q.length))}),Q.map(a=>(0,b.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/30 px-3 py-2",children:[(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsxs)("p",{className:"text-sm font-medium truncate",children:[a.host,(0,b.jsx)("span",{className:"text-muted-foreground",children:"*"!==a.ownerMatch?` / ${a.ownerMatch}`:""})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground font-mono truncate",children:a.localPathTemplate})]}),(0,b.jsx)(f.Button,{variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>{var b;return b=a.id,void R(a=>a.filter(a=>a.id!==b))},children:(0,b.jsx)(G.Trash2,{className:"h-3.5 w-3.5"})})]},a.id))]}),U?(0,b.jsxs)("div",{className:"space-y-3 rounded-lg border border-border p-4",children:[(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium",children:l("onboarding.step3.hostLabel")}),(0,b.jsx)(g.Input,{value:S.host,onChange:a=>T(b=>({...b,host:a.target.value})),placeholder:l("onboarding.step3.hostPlaceholder"),className:"h-9",autoFocus:!0})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium",children:l("onboarding.step3.ownerLabel")}),(0,b.jsx)(g.Input,{value:S.ownerMatch,onChange:a=>T(b=>({...b,ownerMatch:a.target.value})),placeholder:l("onboarding.step3.ownerPlaceholder"),className:"h-9"})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium",children:l("onboarding.step3.pathLabel")}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(g.Input,{value:S.localPathTemplate,onChange:a=>T(b=>({...b,localPathTemplate:a.target.value})),placeholder:l("onboarding.step3.pathPlaceholder"),className:"h-9 font-mono text-xs flex-1"}),(0,b.jsx)("button",{type:"button",onClick:()=>{Z(a=>(a||X(2),!a))},className:`shrink-0 rounded-full px-2.5 py-1 text-[11px] font-mono font-medium transition-colors ${Y?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:"{path}"})]}),(0,b.jsx)("p",{className:"text-[11px] text-muted-foreground",children:l(Y?"onboarding.step3.pathHintFull":"onboarding.step3.pathHintRepo")})]}),S.localPathTemplate&&(a=S.localPathTemplate.trim().replace(/\/+$/,""),i=Y?`${a}/{path}`:a,j=[{label:"GitHub SSH",url:"git@github.com:user/my-app.git"},{label:"GitHub HTTPS",url:"https://github.com/user/my-app.git"},{label:"GitLab Subgroup",url:"https://gitlab.com/org/team/sub/my-api.git"}],(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{className:"text-xs font-medium",children:l("onboarding.step3.previewLabel")}),(0,b.jsx)("div",{className:"flex gap-1 flex-wrap",children:j.map((a,c)=>(0,b.jsx)("button",{type:"button",onClick:()=>X(c),className:`rounded-md px-2 py-1 text-[11px] font-medium transition-colors ${W===c?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:a.label},c))}),(0,b.jsxs)("div",{className:"rounded-md bg-muted/50 px-3 py-2 space-y-1",children:[(0,b.jsx)("p",{className:"font-mono text-[11px] text-muted-foreground truncate",children:j[W].url}),(0,b.jsxs)("p",{className:"font-mono text-xs",children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"→ "}),(0,b.jsx)("span",{className:"text-primary",children:function(a,b){if(!a||!b)return"";let c=b.trim(),d=[],e=c.match(/^git@[^:]+:(.+)$/);if(e)d=e[1].replace(/\.git\/?$/,"").split("/").filter(Boolean);else try{let a=new URL(c);d=decodeURIComponent(a.pathname).replace(/\.git\/?$/,"").split("/").filter(Boolean)}catch{return""}if(!d.length)return"";let f=d[0],g=d[d.length-1],h=d.join("/");if(a.includes("{path}"))return a.replace("{path}",h).replace("{owner}",f).replace("{repo}",g).replace(/\/+$/,"");let i=a.replace("{owner}",f).replace("{repo}","").replace(/\/+$/,"");return`${i}/${g}`}(i,j[W].url)})]})]})]})),(0,b.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[Q.length>0&&(0,b.jsx)(f.Button,{variant:"ghost",onClick:()=>V(!1),children:l("settings.config.git.cancel")}),(0,b.jsxs)(f.Button,{onClick:function(){if(!S.host.trim()||!S.localPathTemplate.trim())return;let a=S.localPathTemplate.trim().replace(/\/+$/,""),b=Y?`${a}/{path}`:a,c={id:crypto.randomUUID(),host:S.host.trim(),ownerMatch:S.ownerMatch.trim()||"*",localPathTemplate:b,priority:Q.length};R(a=>[...a,c]),T({...I}),Z(!1),V(!1)},disabled:!S.host.trim()||!S.localPathTemplate.trim(),children:[(0,b.jsx)(m.Check,{className:"h-4 w-4 mr-1"}),l("settings.config.git.save")]})]})]}):(0,b.jsxs)(f.Button,{variant:"outline",onClick:()=>{T({...I}),V(!0)},children:[(0,b.jsx)(F.Plus,{className:"h-4 w-4 mr-1"}),l("settings.config.git.addRule")]}),(0,b.jsxs)("div",{className:"flex items-center justify-between pt-3",children:[(0,b.jsxs)(f.Button,{variant:"ghost",className:"text-muted-foreground",onClick:ac,children:[(0,b.jsx)(z.ChevronLeft,{className:"h-4 w-4 mr-1"}),l("onboarding.back")]}),(0,b.jsxs)(f.Button,{onClick:ad,disabled:$,className:"px-5",children:[l("onboarding.complete"),(0,b.jsx)(m.Check,{className:"h-4 w-4 ml-1"})]})]})]})]}),(0,b.jsx)("div",{className:"pt-6 text-xs text-muted-foreground",children:l("onboarding.stepIndicator").replace("{current}",String(K)).replace("{total}",String(3))})]})})]})}],585664)}];
|
|
1
|
+
module.exports=[585664,a=>{"use strict";var b=a.i(348273),c=a.i(399424),d=a.i(851033),e=a.i(706193),f=a.i(422917),g=a.i(524513),h=a.i(560874),i=a.i(707466);function j({className:a,size:c="default",...d}){return(0,b.jsx)("div",{"data-slot":"card","data-size":c,className:(0,i.cn)("group/card flex flex-col gap-4 overflow-hidden rounded-xl bg-card py-4 text-sm text-card-foreground ring-1 ring-foreground/10 has-data-[slot=card-footer]:pb-0 has-[>img:first-child]:pt-0 data-[size=sm]:gap-3 data-[size=sm]:py-3 data-[size=sm]:has-data-[slot=card-footer]:pb-0 *:[img:first-child]:rounded-t-xl *:[img:last-child]:rounded-b-xl",a),...d})}function k({className:a,...c}){return(0,b.jsx)("div",{"data-slot":"card-content",className:(0,i.cn)("px-4 group-data-[size=sm]/card:px-3",a),...c})}var l=a.i(348754),m=a.i(235022),n=a.i(17787),o=a.i(737316),p=a.i(136913),q=a.i(526116),r=a.i(282980);function s({adapterType:a,adapterLabel:d,onResult:e}){let[g,h]=(0,c.useState)(!1),[t,u]=(0,c.useState)(null),{t:v}=(0,r.useI18n)();async function w(){if(!g){h(!0),u(null);try{let b=await fetch("/api/adapters/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({adapterType:a})}),c=await b.json();u(c),e?.(c)}catch{let a={ok:!1,checks:[{name:"network_error",passed:!1,message:"Network request failed"}]};u(a),e?.(a)}finally{h(!1)}}}return(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsx)("div",{className:"rounded-lg bg-emerald-100 dark:bg-emerald-900/30 p-2",children:(0,b.jsx)(o.Terminal,{className:"h-5 w-5 text-emerald-600 dark:text-emerald-400"})}),(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"font-semibold",children:v("settings.aiTools.cliVerification")}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:v("settings.aiTools.cliVerificationDesc")})]})]}),(0,b.jsx)(j,{children:(0,b.jsxs)(k,{className:"p-6 space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between",children:[(0,b.jsx)("div",{children:d&&(0,b.jsx)("p",{className:"font-medium",children:d})}),(0,b.jsx)(f.Button,{onClick:w,disabled:g,variant:"outline",children:g?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(l.Loader2,{className:"h-4 w-4 animate-spin mr-2"}),v("settings.aiTools.testing")]}):v("settings.aiTools.testConnection")})]}),t&&(0,b.jsxs)("div",{className:(0,i.cn)("rounded-lg border p-4 space-y-3",t.ok?"bg-green-50 border-green-200 dark:bg-green-950/20 dark:border-green-800":"bg-red-50 border-red-200 dark:bg-red-950/20 dark:border-red-800"),children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[t.ok?(0,b.jsx)(p.CheckCircle2,{className:"h-4 w-4 text-green-600 dark:text-green-400"}):(0,b.jsx)(q.XCircle,{className:"h-4 w-4 text-red-600 dark:text-red-400"}),(0,b.jsx)("span",{className:(0,i.cn)("text-sm font-medium",t.ok?"text-green-700 dark:text-green-300":"text-red-700 dark:text-red-300"),children:v(t.ok?"settings.aiTools.testPassed":"settings.aiTools.testFailed")})]}),(0,b.jsx)("div",{className:"space-y-2",children:t.checks.map(c=>(0,b.jsxs)("div",{className:"flex items-start gap-2 text-sm",children:[c.passed?(0,b.jsx)(m.Check,{className:"h-4 w-4 text-green-500 mt-0.5 shrink-0"}):(0,b.jsx)(n.X,{className:"h-4 w-4 text-red-500 mt-0.5 shrink-0"}),(0,b.jsx)("span",{className:(0,i.cn)(c.passed?"text-green-700 dark:text-green-300":"text-red-700 dark:text-red-300"),children:c.message})]},`${a}-${c.name}`))})]})]})})]})}var t=a.i(441388);let u=(0,t.createServerReference)("4050d3cd9ba24becee3da103dd8463aa030c2303b5",t.callServer,void 0,t.findSourceMapURL,"completeOnboarding");var v=a.i(948355),w=a.i(173250);let x=(0,w.default)("user",[["path",{d:"M19 21v-2a4 4 0 0 0-4-4H9a4 4 0 0 0-4 4v2",key:"975kel"}],["circle",{cx:"12",cy:"7",r:"4",key:"17ys0d"}]]);var y=a.i(280844),z=a.i(148997),A=a.i(772253),B=a.i(538186),C=a.i(167727);let D=(0,w.default)("monitor",[["rect",{width:"20",height:"14",x:"2",y:"3",rx:"2",key:"48i651"}],["line",{x1:"8",x2:"16",y1:"21",y2:"21",key:"1svkeh"}],["line",{x1:"12",x2:"12",y1:"17",y2:"21",key:"vw1qmm"}]]),E=(0,w.default)("languages",[["path",{d:"m5 8 6 6",key:"1wu5hv"}],["path",{d:"m4 14 6-6 2-3",key:"1k1g8d"}],["path",{d:"M2 5h12",key:"or177f"}],["path",{d:"M7 2h1",key:"1t2jsx"}],["path",{d:"m22 22-5-10-5 10",key:"don7ne"}],["path",{d:"M14 18h6",key:"1m8k6r"}]]);var F=a.i(709222),G=a.i(657673);function H({step:a}){let c=[x,o.Terminal,y.GitBranch][a-1]??x,d=["Profile","Connect","Configure"][a-1]??"";return(0,b.jsxs)("div",{className:"relative h-full w-full overflow-hidden",children:[(0,b.jsx)("div",{className:"absolute inset-0 opacity-[0.07] text-white",style:{backgroundImage:"radial-gradient(circle, currentColor 1px, transparent 1px)",backgroundSize:"24px 24px"}}),(0,b.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full",style:{width:"380px",height:"380px",background:"radial-gradient(circle, oklch(0.80 0.14 75 / 0.25) 0%, oklch(0.80 0.14 75 / 0.08) 45%, transparent 70%)",animation:"ob-pulse 6s ease-in-out infinite"}}),(0,b.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full border border-amber-400/25",style:{width:"260px",height:"260px",animation:"ob-spin 20s linear infinite"},children:(0,b.jsx)("div",{className:"absolute -top-1.5 left-1/2 -translate-x-1/2 h-3 w-3 rounded-full bg-amber-400",style:{boxShadow:"0 0 16px oklch(0.80 0.14 75 / 0.7)"}})}),(0,b.jsxs)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 rounded-full border border-amber-400/15",style:{width:"380px",height:"380px",animation:"ob-spin 30s linear infinite reverse"},children:[(0,b.jsx)("div",{className:"absolute -top-1 left-1/2 -translate-x-1/2 h-2 w-2 rounded-full bg-amber-400/70"}),(0,b.jsx)("div",{className:"absolute -bottom-1 left-1/2 -translate-x-1/2 h-1.5 w-1.5 rounded-full bg-amber-400/50"})]}),(0,b.jsx)("svg",{className:"absolute",style:{top:"18%",right:"22%",animation:"ob-float 8s ease-in-out infinite"},width:"44",height:"50",viewBox:"0 0 40 46",fill:"none",children:(0,b.jsx)("path",{d:"M20 1 L38 12 L38 34 L20 45 L2 34 L2 12 Z",stroke:"oklch(0.80 0.14 75 / 0.4)",strokeWidth:"1.5",fill:"oklch(0.80 0.14 75 / 0.06)"})}),(0,b.jsx)("svg",{className:"absolute",style:{bottom:"22%",left:"18%",animation:"ob-float 10s ease-in-out 2s infinite"},width:"32",height:"36",viewBox:"0 0 40 46",fill:"none",children:(0,b.jsx)("path",{d:"M20 1 L38 12 L38 34 L20 45 L2 34 L2 12 Z",stroke:"oklch(0.80 0.14 75 / 0.3)",strokeWidth:"1.5",fill:"oklch(0.80 0.14 75 / 0.05)"})}),(0,b.jsx)("div",{className:"absolute h-3.5 w-3.5 rounded-full bg-amber-400/40",style:{top:"30%",left:"28%",animation:"ob-float 7s ease-in-out 1s infinite"}}),(0,b.jsx)("div",{className:"absolute h-2.5 w-2.5 rounded-full bg-amber-400/30",style:{top:"65%",right:"30%",animation:"ob-float 9s ease-in-out 3s infinite"}}),(0,b.jsx)("div",{className:"absolute h-2 w-2 rounded-full bg-amber-400/20",style:{top:"45%",right:"15%",animation:"ob-float 6s ease-in-out 0.5s infinite"}}),(0,b.jsxs)("svg",{className:"absolute inset-0 h-full w-full text-white opacity-[0.12]",children:[(0,b.jsx)("line",{x1:"30%",y1:"25%",x2:"70%",y2:"45%",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"4 6",style:{animation:"ob-dash 12s linear infinite"}}),(0,b.jsx)("line",{x1:"65%",y1:"30%",x2:"35%",y2:"70%",stroke:"currentColor",strokeWidth:"1",strokeDasharray:"4 6",style:{animation:"ob-dash 15s linear infinite reverse"}})]}),(0,b.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 -translate-y-1/2 flex items-center justify-center",children:(0,b.jsx)("div",{className:"flex h-16 w-16 items-center justify-center rounded-2xl border border-amber-400/35 bg-amber-500/10 backdrop-blur-sm transition-all duration-700",style:{boxShadow:"0 0 50px oklch(0.80 0.14 75 / 0.2)"},children:(0,b.jsx)(c,{className:"h-7 w-7 text-amber-400"})})}),(0,b.jsx)("div",{className:"absolute left-1/2 top-1/2 -translate-x-1/2 translate-y-12 text-center",children:(0,b.jsx)("p",{className:"text-[11px] font-medium tracking-widest uppercase text-amber-400/60",children:d})})]})}let I={host:"",ownerMatch:"*",localPathTemplate:""};a.s(["default",0,function(){let a,i,j,k=(0,d.useRouter)(),{t:l,locale:n,setLocale:p}=(0,r.useI18n)(),{theme:q,setTheme:t}=(0,e.useTheme)(),[w,J]=(0,c.useState)(!1),[K,L]=(0,c.useState)(1),[M,N]=(0,c.useState)(""),[O,P]=(0,c.useState)(null),[Q,R]=(0,c.useState)([]),[S,T]=(0,c.useState)({...I}),[U,V]=(0,c.useState)(!0),[W,X]=(0,c.useState)(0),[Y,Z]=(0,c.useState)(!1),[$,_]=(0,c.useState)(!1);(0,c.useEffect)(()=>J(!0),[]);let aa=[{value:"light",label:(0,b.jsx)(B.Sun,{className:"h-4 w-4"})},{value:"dark",label:(0,b.jsx)(C.Moon,{className:"h-4 w-4"})},{value:"system",label:(0,b.jsx)(D,{className:"h-4 w-4"})}];function ab(){L(a=>a+1)}function ac(){L(a=>Math.max(1,a-1))}async function ad(){_(!0);try{Q.length>0&&await (0,v.setConfigValue)("git.pathMappingRules",Q),await u(M.trim()),k.replace("/workspaces")}catch{_(!1)}}let ae=[{icon:x,label:l("onboarding.step1.title")},{icon:o.Terminal,label:l("onboarding.step2.title")},{icon:y.GitBranch,label:l("onboarding.step3.title")}];return(0,b.jsxs)("div",{className:"flex h-screen bg-background",children:[(0,b.jsx)("div",{className:"hidden xl:block xl:w-3/5 border-r border-border/50 bg-[oklch(0.13_0.006_260)]",children:(0,b.jsx)(H,{step:K})}),(0,b.jsx)("div",{className:"flex w-full flex-col items-center px-8 pt-[10vh] pb-10 xl:w-2/5 xl:px-16 overflow-y-auto",children:(0,b.jsxs)("div",{className:"w-full max-w-lg space-y-6",children:[(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2.5",children:[(0,b.jsx)("img",{src:"/logo.png",alt:"Tower",className:"h-8 w-8 rounded-lg"}),(0,b.jsx)("span",{className:"text-lg font-semibold tracking-tight",children:"Tower"})]}),(0,b.jsx)("div",{className:"flex items-center gap-1.5",children:ae.map((a,c)=>{let d=c+1,e=d===K,f=d<K,g=a.icon;return(0,b.jsxs)("div",{className:"flex items-center gap-1.5 shrink-0",children:[c>0&&(0,b.jsx)("div",{className:`h-px w-4 transition-colors duration-500 ${f?"bg-primary":"bg-border"}`}),(0,b.jsxs)("div",{className:`flex items-center gap-1 shrink-0 rounded-full px-2 py-1 text-[11px] font-medium whitespace-nowrap transition-all duration-500 ${e?"bg-primary text-primary-foreground shadow-sm":f?"bg-primary/10 text-primary":"bg-muted text-muted-foreground"}`,children:[f?(0,b.jsx)(m.Check,{className:"h-3 w-3 shrink-0"}):(0,b.jsx)(g,{className:"h-3 w-3 shrink-0"}),(0,b.jsx)("span",{children:a.label})]})]},c)})})]}),(0,b.jsxs)("div",{children:[1===K&&(0,b.jsxs)("div",{className:"space-y-7 animate-in fade-in slide-in-from-left-4 duration-500",children:[(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:l("onboarding.step1.title")}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed",children:l("onboarding.step1.desc")})]}),(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{htmlFor:"onboarding-username",className:"text-sm font-medium",children:l("onboarding.step1.usernameLabel")}),(0,b.jsx)("input",{id:"onboarding-username",type:"text",value:M,onChange:a=>N(a.target.value),placeholder:l("onboarding.step1.usernamePlaceholder"),className:"flex h-10 w-full rounded-lg border border-input bg-transparent px-3 py-2 text-sm shadow-sm transition-colors placeholder:text-muted-foreground focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring/50",maxLength:64,autoFocus:!0,autoComplete:"username"})]}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-6",children:[(0,b.jsxs)("div",{className:"space-y-2.5",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(E,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,b.jsx)("label",{className:"text-sm font-medium",children:l("settings.language")})]}),(0,b.jsx)(h.SegmentedControl,{options:[{value:"zh",label:"中文"},{value:"en",label:"English"}].map(a=>({value:a.value,label:a.label})),value:n,onChange:a=>p(a)})]}),(0,b.jsxs)("div",{className:"space-y-2.5",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(B.Sun,{className:"h-3.5 w-3.5 text-muted-foreground"}),(0,b.jsx)("label",{className:"text-sm font-medium",children:l("settings.theme")})]}),w?(0,b.jsx)(h.SegmentedControl,{options:aa.map(a=>({value:a.value,label:a.label})),value:q??"system",onChange:a=>t(a)}):(0,b.jsx)("div",{className:"inline-flex h-8 rounded-md border border-border bg-muted p-1 gap-1 w-[120px]"})]})]}),(0,b.jsx)("div",{className:"flex justify-end pt-3",children:(0,b.jsxs)(f.Button,{onClick:ab,disabled:0===M.trim().length,className:"px-5",children:[l("onboarding.step1.next"),(0,b.jsx)(A.ChevronRight,{className:"h-4 w-4 ml-1"})]})})]}),2===K&&(0,b.jsxs)("div",{className:"space-y-7 animate-in fade-in slide-in-from-left-4 duration-500",children:[(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:l("onboarding.step2.title")}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed",children:l("onboarding.step2.desc")})]}),(0,b.jsx)(s,{adapterType:"claude_code",adapterLabel:"Claude CLI",onResult:P}),(0,b.jsxs)("div",{className:"flex items-center justify-between pt-3",children:[(0,b.jsxs)(f.Button,{variant:"ghost",className:"text-muted-foreground",onClick:ac,children:[(0,b.jsx)(z.ChevronLeft,{className:"h-4 w-4 mr-1"}),l("onboarding.back")]}),(0,b.jsxs)(f.Button,{onClick:ab,disabled:!O?.ok,className:"px-5",children:[l("onboarding.step1.next"),(0,b.jsx)(A.ChevronRight,{className:"h-4 w-4 ml-1"})]})]})]}),3===K&&(0,b.jsxs)("div",{className:"space-y-5 animate-in fade-in slide-in-from-left-4 duration-500",children:[(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:l("onboarding.step3.title")}),(0,b.jsx)("p",{className:"text-sm text-muted-foreground leading-relaxed",children:l("onboarding.step3.desc")})]}),Q.length>0&&(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("p",{className:"text-xs font-medium text-muted-foreground",children:l("onboarding.step3.added").replace("{count}",String(Q.length))}),Q.map(a=>(0,b.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-border bg-muted/30 px-3 py-2",children:[(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsxs)("p",{className:"text-sm font-medium truncate",children:[a.host,(0,b.jsx)("span",{className:"text-muted-foreground",children:"*"!==a.ownerMatch?` / ${a.ownerMatch}`:""})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground font-mono truncate",children:a.localPathTemplate})]}),(0,b.jsx)(f.Button,{variant:"ghost",size:"icon",className:"shrink-0 text-muted-foreground hover:text-destructive",onClick:()=>{var b;return b=a.id,void R(a=>a.filter(a=>a.id!==b))},children:(0,b.jsx)(G.Trash2,{className:"h-3.5 w-3.5"})})]},a.id))]}),U?(0,b.jsxs)("div",{className:"space-y-3 rounded-lg border border-border p-4",children:[(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium",children:l("onboarding.step3.hostLabel")}),(0,b.jsx)(g.Input,{value:S.host,onChange:a=>T(b=>({...b,host:a.target.value})),placeholder:l("onboarding.step3.hostPlaceholder"),className:"h-9",autoFocus:!0})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium",children:l("onboarding.step3.ownerLabel")}),(0,b.jsx)(g.Input,{value:S.ownerMatch,onChange:a=>T(b=>({...b,ownerMatch:a.target.value})),placeholder:l("onboarding.step3.ownerPlaceholder"),className:"h-9"})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium",children:l("onboarding.step3.pathLabel")}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(g.Input,{value:S.localPathTemplate,onChange:a=>T(b=>({...b,localPathTemplate:a.target.value})),placeholder:l("onboarding.step3.pathPlaceholder"),className:"h-9 font-mono text-xs flex-1"}),(0,b.jsx)("button",{type:"button",onClick:()=>{Z(a=>(a||X(2),!a))},className:`shrink-0 rounded-full px-2.5 py-1 text-[11px] font-mono font-medium transition-colors ${Y?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:"{path}"})]}),(0,b.jsx)("p",{className:"text-[11px] text-muted-foreground",children:l(Y?"onboarding.step3.pathHintFull":"onboarding.step3.pathHintRepo")})]}),S.localPathTemplate&&(a=S.localPathTemplate.trim().replace(/\/+$/,""),i=Y?`${a}/{path}`:a,j=[{label:"GitHub SSH",url:"git@github.com:user/my-app.git"},{label:"GitHub HTTPS",url:"https://github.com/user/my-app.git"},{label:"GitLab Subgroup",url:"https://gitlab.com/org/team/sub/my-api.git"}],(0,b.jsxs)("div",{className:"space-y-2",children:[(0,b.jsx)("label",{className:"text-xs font-medium",children:l("onboarding.step3.previewLabel")}),(0,b.jsx)("div",{className:"flex gap-1 flex-wrap",children:j.map((a,c)=>(0,b.jsx)("button",{type:"button",onClick:()=>X(c),className:`rounded-md px-2 py-1 text-[11px] font-medium transition-colors ${W===c?"bg-primary text-primary-foreground":"bg-muted text-muted-foreground hover:text-foreground"}`,children:a.label},c))}),(0,b.jsxs)("div",{className:"rounded-md bg-muted/50 px-3 py-2 space-y-1",children:[(0,b.jsx)("p",{className:"font-mono text-[11px] text-muted-foreground truncate",children:j[W].url}),(0,b.jsxs)("p",{className:"font-mono text-xs",children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"→ "}),(0,b.jsx)("span",{className:"text-primary",children:function(a,b){if(!a||!b)return"";let c=b.trim(),d=[],e=c.match(/^git@[^:]+:(.+)$/);if(e)d=e[1].replace(/\.git\/?$/,"").split("/").filter(Boolean);else try{let a=new URL(c);d=decodeURIComponent(a.pathname).replace(/\.git\/?$/,"").split("/").filter(Boolean)}catch{return""}if(!d.length)return"";let f=d[0],g=d[d.length-1],h=d.join("/");if(a.includes("{path}"))return a.replace("{path}",h).replace("{owner}",f).replace("{repo}",g).replace(/\/+$/,"");let i=a.replace("{owner}",f).replace("{repo}","").replace(/\/+$/,"");return`${i}/${g}`}(i,j[W].url)})]})]})]})),(0,b.jsxs)("div",{className:"flex justify-end gap-2 pt-1",children:[Q.length>0&&(0,b.jsx)(f.Button,{variant:"ghost",onClick:()=>V(!1),children:l("settings.config.git.cancel")}),(0,b.jsxs)(f.Button,{onClick:function(){if(!S.host.trim()||!S.localPathTemplate.trim())return;let a=S.localPathTemplate.trim().replace(/\/+$/,""),b=Y?`${a}/{path}`:a,c={id:crypto.randomUUID(),host:S.host.trim(),ownerMatch:S.ownerMatch.trim()||"*",localPathTemplate:b,priority:Q.length};R(a=>[...a,c]),T({...I}),Z(!1),V(!1)},disabled:!S.host.trim()||!S.localPathTemplate.trim(),children:[(0,b.jsx)(m.Check,{className:"h-4 w-4 mr-1"}),l("settings.config.git.save")]})]})]}):(0,b.jsxs)(f.Button,{variant:"outline",onClick:()=>{T({...I}),V(!0)},children:[(0,b.jsx)(F.Plus,{className:"h-4 w-4 mr-1"}),l("settings.config.git.addRule")]}),(0,b.jsxs)("div",{className:"flex items-center justify-between pt-3",children:[(0,b.jsxs)(f.Button,{variant:"ghost",className:"text-muted-foreground",onClick:ac,children:[(0,b.jsx)(z.ChevronLeft,{className:"h-4 w-4 mr-1"}),l("onboarding.back")]}),(0,b.jsxs)(f.Button,{onClick:ad,disabled:$,className:"px-5",children:[l("onboarding.complete"),(0,b.jsx)(m.Check,{className:"h-4 w-4 ml-1"})]})]})]})]}),(0,b.jsx)("div",{className:"pt-6 text-xs text-muted-foreground",children:l("onboarding.stepIndicator").replace("{current}",String(K)).replace("{total}",String(3))})]})})]})}],585664)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=tower_src_app_onboarding_page_tsx_0_3krz1._.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
module.exports=[3476,a=>{"use strict";var b=a.i(348273),c=a.i(399424),d=a.i(851033),e=a.i(706193),f=a.i(282980),g=a.i(422917),h=a.i(524513),i=a.i(302512),j=a.i(648667),k=a.i(481030),l=a.i(661964),m=a.i(755811),n=a.i(707466),o=a.i(885950),p=a.i(173250);let q=(0,p.default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);var r=a.i(529917);let s=(0,p.default)("sliders-horizontal",[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]);var t=a.i(737316),u=a.i(901927),v=a.i(17787),w=a.i(709222);let x=(0,p.default)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);var y=a.i(657673);let z=(0,p.default)("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]),A=(0,p.default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);var B=a.i(348754),C=a.i(235022),D=a.i(136913),E=a.i(526116),F=a.i(246215),G=a.i(964344),H=a.i(373346),I=a.i(441388);let J=(0,I.createServerReference)("00a9c86933bffc986aa1d3edb0840fa93c30665ee8",I.callServer,void 0,I.findSourceMapURL,"getAvailableTerminalApps");var K=a.i(523053);let L=(0,I.createServerReference)("401f3c229a32e689b677c476454a24ec193057b779",I.callServer,void 0,I.findSourceMapURL,"createPrompt"),M=(0,I.createServerReference)("605161cd6943eeca1a6c70d433a78ad3a3bf3ff5ae",I.callServer,void 0,I.findSourceMapURL,"updatePrompt"),N=(0,I.createServerReference)("40e56a77f5a892b4b45c275b4622200f40fecf3e26",I.callServer,void 0,I.findSourceMapURL,"deletePrompt"),O=(0,I.createServerReference)("6081279e24f626570e52bd4fc221b4f41bd3e05f1c",I.callServer,void 0,I.findSourceMapURL,"setDefaultPrompt"),P=(0,I.createServerReference)("00f381b15451687e39889f6fbd259c1f05764130f7",I.callServer,void 0,I.findSourceMapURL,"getDefaultCliProfile"),Q=(0,I.createServerReference)("606a14eb7dbdea526e4b7cd7eb1dd26935b81900d3",I.callServer,void 0,I.findSourceMapURL,"updateCliProfile");function R({options:a,value:c,onChange:d}){return(0,b.jsx)("div",{className:"inline-flex rounded-lg border border-border/50 bg-muted/30 p-1 gap-0.5",children:a.map(a=>(0,b.jsx)("button",{type:"button",onClick:()=>d(a.value),className:(0,n.cn)("rounded-md px-3.5 py-1.5 text-sm font-medium transition-all duration-200 cursor-pointer",c===a.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:a.label},a.value))})}function S({label:a,description:c,children:d,className:e}){return(0,b.jsxs)("div",{className:(0,n.cn)("flex items-center justify-between py-4 border-b border-border/50 last:border-0",e),children:[(0,b.jsxs)("div",{className:"min-w-0 flex-1 pr-4",children:[(0,b.jsx)("div",{className:"text-sm font-medium",children:a}),c&&(0,b.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:c})]}),(0,b.jsx)("div",{className:"shrink-0",children:d})]})}let T=[{id:"general",labelKey:"settings.general",descKey:"settings.generalDesc",icon:o.Settings,accent:"blue"},{id:"ai-tools",labelKey:"settings.aiTools.title",descKey:"settings.aiTools.cliVerificationDesc",icon:q,accent:"emerald"},{id:"prompts",labelKey:"settings.prompts",descKey:"settings.promptsDesc",icon:r.FileText,accent:"violet"},{id:"config",labelKey:"settings.config",descKey:"settings.configDesc",icon:s,accent:"amber"},{id:"cli-profile",labelKey:"settings.cliProfile.title",descKey:"settings.cliProfile.navDesc",icon:t.Terminal,accent:"cyan"},{id:"notifications",labelKey:"settings.notifications.title",descKey:"settings.notifications.navDesc",icon:u.Bell,accent:"rose"}],U={blue:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},emerald:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},violet:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},amber:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},cyan:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},rose:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"}},V="ai-manager:default-cli-adapter",W=[{type:"claude_local",label:"Claude Code",source:"builtin"}],X={host:"",ownerMatch:"*",localPathTemplate:"",priority:0};function Y(){let a=(0,d.useRouter)(),{t:o}=(0,f.useI18n)(),{theme:p,setTheme:q}=(0,e.useTheme)(),{locale:r,setLocale:s}=(0,f.useI18n)(),[t,u]=(0,c.useState)("general"),I=(0,c.useRef)(null),[Y,Z]=(0,c.useState)({left:0,width:0}),[$,_]=(0,c.useState)(!1),[aa,ab]=(0,c.useState)("Terminal"),[ac,ad]=(0,c.useState)([]),[ae,af]=(0,c.useState)(180),[ag,ah]=(0,c.useState)("claude_local"),[ai,aj]=(0,c.useState)(null),[ak,al]=(0,c.useState)({}),[am,an]=(0,c.useState)([]),[ao,ap]=(0,c.useState)(!1),[aq,ar]=(0,c.useState)(null),[as,at]=(0,c.useState)(null),[au,av]=(0,c.useState)(""),[aw,ax]=(0,c.useState)(""),[ay,az]=(0,c.useState)(""),[aA,aB]=(0,c.useState)([]),[aC,aD]=(0,c.useState)(null),[aE,aF]=(0,c.useState)({...X}),[aG,aH]=(0,c.useState)(!1),[aI,aJ]=(0,c.useState)({...X}),[aK,aL]=(0,c.useState)(!1),[aM,aN]=(0,c.useState)(0),[aO,aP]=(0,c.useState)(null),[aQ,aR]=(0,c.useState)({maxUploadMb:50,maxConcurrent:3}),[aS,aT]=(0,c.useState)({timeoutSec:30}),[aU,aV]=(0,c.useState)({resultLimit:20,allModeCap:5,debounceMs:250,snippetLength:80}),[aW,aX]=(0,c.useState)({minCols:1,maxCols:5,minRows:1,maxRows:5}),[aY,aZ]=(0,c.useState)(null),[a$,a_]=(0,c.useState)(!1),[a0,a1]=(0,c.useState)(""),[a2,a3]=(0,c.useState)(null),[a4,a5]=(0,c.useState)(""),[a6,a7]=(0,c.useState)(""),[a8,a9]=(0,c.useState)(""),[ba,bb]=(0,c.useState)(""),[bc,bd]=(0,c.useState)(!0),[be,bf]=(0,c.useState)(!0);(0,c.useEffect)(()=>_(!0),[]),(0,c.useEffect)(()=>{(0,F.getConfigValue)("terminal.app","Terminal").then(ab),(0,F.getConfigValue)("terminal.idleTimeoutSec",180).then(af),J().then(ad)},[]),(0,c.useEffect)(()=>{let a=localStorage.getItem(V);a&&ah(a)},[]),(0,c.useEffect)(()=>{(0,K.getPrompts)().then(an)},[]);let bg=async()=>{try{let a=await fetch("/api/internal/hooks/install");if(a.ok){let b=await a.json();aZ(b)}}catch{}};async function bh(){await (0,G.setConfigValue)("terminal.app",aa)}async function bi(){let a=Math.max(180,ae);af(a),await (0,G.setConfigValue)("terminal.idleTimeoutSec",a)}async function bj(a){if(!ai){aj(a),al(b=>{let c={...b};return delete c[a],c});try{let b=await fetch("/api/adapters/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({adapterType:a})}),c=await b.json();al(b=>({...b,[a]:c}))}catch{al(b=>({...b,[a]:{ok:!1,checks:[{name:"network_error",passed:!1,message:"Network request failed"}]}}))}finally{aj(null)}}}(0,c.useEffect)(()=>{(0,F.getConfigValue)("git.pathMappingRules",[]).then(aB),(0,F.getConfigValue)("hooks.autoUploadTypes",["png","jpg","jpeg","gif","webp","svg","pdf","md","txt","json"]).then(a=>{a1(a.join(", "))}),bg(),(0,H.getConfigValues)(["system.maxUploadBytes","system.maxConcurrentExecutions","git.timeoutSec","search.resultLimit","search.allModeCap","search.debounceMs","search.snippetLength","missions.grid.minCols","missions.grid.maxCols","missions.grid.minRows","missions.grid.maxRows"]).then(a=>{aR({maxUploadMb:Math.round((a["system.maxUploadBytes"]??0x3200000)/1024/1024),maxConcurrent:a["system.maxConcurrentExecutions"]??3}),aT({timeoutSec:a["git.timeoutSec"]??30}),aV({resultLimit:a["search.resultLimit"]??20,allModeCap:a["search.allModeCap"]??5,debounceMs:a["search.debounceMs"]??250,snippetLength:a["search.snippetLength"]??80}),aX({minCols:a["missions.grid.minCols"]??1,maxCols:a["missions.grid.maxCols"]??5,minRows:a["missions.grid.minRows"]??1,maxRows:a["missions.grid.maxRows"]??5})})},[]),(0,c.useEffect)(()=>{P().then(a=>{a&&(a3(a),a5(a.command),a7(function(a){try{let b=JSON.parse(a);return Array.isArray(b)?b.join("\n"):""}catch{return""}}(a.baseArgs)),a9(function(a){try{let b=JSON.parse(a);if("object"!=typeof b||Array.isArray(b)||null===b)return"";return Object.entries(b).map(([a,b])=>`${a}=${b}`).join("\n")}catch{return""}}(a.envVars))),bd(!1)})},[]),(0,c.useEffect)(()=>{(0,F.getConfigValue)("notification.enabled",!0).then(bf)},[]);let bk=(0,c.useCallback)(()=>{ar(null),av(""),ax(""),az(""),ap(!0)},[]),bl=(0,c.useCallback)(a=>{ar(a),av(a.name),ax(a.description??""),az(a.content),ap(!0)},[]),bm=(0,c.useCallback)(async()=>{au.trim()&&ay.trim()&&(aq?await M(aq.id,{name:au.trim(),description:aw.trim()||void 0,content:ay.trim()}):await L({name:au.trim(),description:aw.trim()||void 0,content:ay.trim()}),ap(!1),an(await (0,K.getPrompts)()),a.refresh())},[au,aw,ay,aq,a]),bn=(0,c.useCallback)(async()=>{as&&(await N(as),at(null),an(await (0,K.getPrompts)()),a.refresh())},[as,a]),bo=(0,c.useCallback)(async b=>{await O(b),an(await (0,K.getPrompts)()),a.refresh()},[a]),bp=async()=>{await (0,G.setConfigValue)("system.maxUploadBytes",1024*aQ.maxUploadMb*1024),await (0,G.setConfigValue)("system.maxConcurrentExecutions",aQ.maxConcurrent)},bq=async()=>{await (0,G.setConfigValue)("git.timeoutSec",aS.timeoutSec)},br=async()=>{await (0,G.setConfigValue)("search.resultLimit",aU.resultLimit),await (0,G.setConfigValue)("search.allModeCap",aU.allModeCap),await (0,G.setConfigValue)("search.debounceMs",aU.debounceMs),await (0,G.setConfigValue)("search.snippetLength",aU.snippetLength)},bs=async()=>{let a=Math.min(aW.minCols,aW.maxCols),b=Math.max(aW.minCols,aW.maxCols),c=Math.min(aW.minRows,aW.maxRows),d=Math.max(aW.minRows,aW.maxRows);aX({minCols:a,maxCols:b,minRows:c,maxRows:d}),await (0,G.setConfigValue)("missions.grid.minCols",a),await (0,G.setConfigValue)("missions.grid.maxCols",b),await (0,G.setConfigValue)("missions.grid.minRows",c),await (0,G.setConfigValue)("missions.grid.maxRows",d)},bt=async()=>{let a=a0.split(",").map(a=>a.trim()).filter(Boolean);await (0,G.setConfigValue)("hooks.autoUploadTypes",a)},bu=async()=>{if(aY){a_(!0);try{let a=aY.installed?"DELETE":"POST";await fetch("/api/internal/hooks/install",{method:a}),await bg()}finally{a_(!1)}}},bv=async()=>{if(!aI.host.trim()||!aI.localPathTemplate.trim())return;let a=aI.localPathTemplate.trim().replace(/\/+$/,""),b=aK?`${a}/{path}`:a,c=[...aA,{id:crypto.randomUUID(),host:aI.host.trim(),ownerMatch:aI.ownerMatch.trim()||"*",localPathTemplate:b,priority:aI.priority}];await (0,G.setConfigValue)("git.pathMappingRules",c),aB(c),aJ({...X}),aL(!1),aH(!1)},bw=async a=>{if(!aE.host.trim()||!aE.localPathTemplate.trim())return;let b=aA.map(b=>b.id===a?{...b,host:aE.host.trim(),ownerMatch:aE.ownerMatch.trim()||"*",localPathTemplate:aE.localPathTemplate.trim(),priority:aE.priority}:b);await (0,G.setConfigValue)("git.pathMappingRules",b),aB(b),aD(null)},bx=async a=>{let b=aA.filter(b=>b.id!==a);await (0,G.setConfigValue)("git.pathMappingRules",b),aB(b),aP(null)},by=(0,c.useCallback)(async()=>{if(a2){try{let a=JSON.stringify(a6.split("\n").map(a=>a.trim()).filter(Boolean)),b={};a8.split("\n").map(a=>a.trim()).filter(Boolean).forEach(a=>{let c=a.indexOf("=");if(c>0){let d=a.slice(0,c).trim(),e=a.slice(c+1).trim();b[d]=e}});let c=JSON.stringify(b);await Q(a2.id,{command:a4,baseArgs:a,envVars:c}),bb("saved")}catch{bb("error")}setTimeout(()=>bb(""),2e3)}},[a2,a4,a6,a8]);async function bz(){let a=!be;bf(a),await (0,G.setConfigValue)("notification.enabled",a)}let bA=(0,c.useCallback)(()=>{a.back()},[a]);(0,c.useEffect)(()=>{let a=I.current;if(!a)return;let b=a.querySelector(`[data-section="${t}"]`);if(!b)return;let c=a.getBoundingClientRect(),d=b.getBoundingClientRect();Z({left:d.left-c.left,width:d.width})},[t]);let bB=T.find(a=>a.id===t),bC=bB?U[bB.accent]:U.blue;return(0,b.jsxs)("div",{className:"flex h-full flex-col bg-background",children:[(0,b.jsx)("div",{className:"flex-shrink-0 border-b bg-card/50 backdrop-blur-sm",children:(0,b.jsxs)("div",{className:"mx-auto max-w-5xl px-6",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between pb-3 pt-5",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:o("settings.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:o("settings.configDesc")})]}),(0,b.jsxs)(g.Button,{variant:"outline",onClick:bA,className:"gap-1.5 bg-card shadow-sm cursor-pointer",children:[(0,b.jsx)(v.X,{className:"h-3.5 w-3.5"}),"ESC"]})]}),(0,b.jsxs)("div",{ref:I,className:"relative flex gap-1 overflow-x-auto",children:[T.map(a=>{let c=a.icon,d=t===a.id,e=U[a.accent];return(0,b.jsxs)("button",{"data-section":a.id,onClick:()=>u(a.id),className:(0,n.cn)("relative flex items-center gap-2 rounded-t-lg px-4 py-2.5","text-sm font-medium whitespace-nowrap cursor-pointer","transition-colors duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",d?`${e.text} bg-background`:"text-muted-foreground hover:text-foreground hover:bg-muted/50"),children:[(0,b.jsx)("span",{className:(0,n.cn)("flex h-6 w-6 items-center justify-center rounded-md","transition-colors duration-200",d?e.bg:"bg-transparent"),children:(0,b.jsx)(c,{className:"h-3.5 w-3.5"})}),(0,b.jsx)("span",{children:o(a.labelKey)})]},a.id)}),(0,b.jsx)("div",{className:(0,n.cn)("absolute bottom-0 h-0.5 rounded-full","transition-all duration-250 ease-out",bC.indicator),style:{left:Y.left,width:Y.width}})]})]})}),(0,b.jsx)("div",{className:"flex-1 overflow-auto",children:(0,b.jsxs)("div",{className:"mx-auto max-w-4xl px-6 py-8",children:[bB&&(0,b.jsxs)("div",{className:"mb-6 flex items-start gap-4",children:[(0,b.jsx)("div",{className:(0,n.cn)("flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-xl","ring-1",bC.bg,bC.text,bC.ring),children:(0,b.jsx)(bB.icon,{className:"h-5 w-5"})}),(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("h2",{className:"text-lg font-semibold leading-tight",children:o(bB.labelKey)}),(0,b.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:o(bB.descKey)})]})]}),(0,b.jsx)("div",{className:"mb-6 border-t"}),function(){switch(t){case"general":let a;return a=[{value:"light",label:o("settings.themeLight")},{value:"dark",label:o("settings.themeDark")},{value:"system",label:o("settings.themeSystem")}],(0,b.jsxs)("div",{className:"divide-y divide-border/50",children:[(0,b.jsx)(S,{label:o("settings.theme"),description:o("settings.themeDesc"),children:$?(0,b.jsx)(R,{options:a,value:p??"system",onChange:a=>q(a)}):(0,b.jsx)("div",{className:"inline-flex h-9 rounded-lg border border-border/50 bg-muted/30 p-1 w-[200px]"})}),(0,b.jsx)(S,{label:o("settings.language"),description:o("settings.languageDesc"),children:(0,b.jsx)(R,{options:[{value:"zh",label:"中文"},{value:"en",label:"English"}],value:r,onChange:a=>s(a)})}),(0,b.jsxs)("div",{className:"py-4 border-b border-border/50",children:[(0,b.jsx)("div",{className:"flex items-center justify-between",children:(0,b.jsxs)("div",{className:"min-w-0 flex-1 pr-4",children:[(0,b.jsx)("div",{className:"text-sm font-medium",children:o("settings.terminal.label")}),(0,b.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:o("settings.terminal.desc")})]})}),(0,b.jsxs)("div",{className:"mt-3 flex flex-col gap-2",children:[ac.length>0&&(0,b.jsx)("div",{className:"flex flex-wrap gap-2",children:ac.map(a=>(0,b.jsx)("button",{type:"button",onClick:()=>{ab(a.value),(0,G.setConfigValue)("terminal.app",a.value)},className:(0,n.cn)("rounded-lg border px-3.5 py-1.5 text-xs font-medium transition-all duration-200 cursor-pointer",aa===a.value?"border-foreground bg-accent text-foreground font-medium":"border-border text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:a.name},a.value))}),(0,b.jsx)("input",{type:"text",value:aa,onChange:a=>ab(a.target.value),onBlur:bh,placeholder:o("settings.terminal.placeholder"),className:"h-9 w-64 rounded-lg border border-border/50 bg-muted/30 px-3 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500/30"})]})]}),(0,b.jsx)(S,{label:o("settings.terminal.idleTimeout"),description:o("settings.terminal.idleTimeoutDesc"),children:(0,b.jsx)("input",{type:"number",value:ae,onChange:a=>af(Number(a.target.value)),onBlur:bi,min:180,className:"h-9 w-28 rounded-lg border border-border/50 bg-muted/30 px-3 text-sm text-right focus:outline-none focus:ring-2 focus:ring-blue-500/30"})})]});case"ai-tools":return(0,b.jsx)("ul",{className:"divide-y rounded-xl border border-border bg-card",children:W.map(a=>{let c=ag===a.type,d=ai===a.type,e=ak[a.type];return(0,b.jsx)("li",{children:(0,b.jsxs)("div",{className:"px-5 py-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,b.jsx)("span",{className:"font-medium",children:a.label}),(0,b.jsx)(k.Badge,{variant:"outline",children:o("label.builtin")}),c&&(0,b.jsxs)(k.Badge,{variant:"secondary",className:"shrink-0",children:[(0,b.jsx)(x,{className:"h-3 w-3 mr-1 fill-yellow-400 text-yellow-400"}),o("settings.prompts.default")]}),e&&(0,b.jsx)(k.Badge,{variant:e.ok?"secondary":"destructive",className:(0,n.cn)("shrink-0",e.ok&&"bg-green-600 text-white hover:bg-green-700"),children:e.ok?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(D.CheckCircle2,{className:"h-3 w-3 mr-1"}),o("settings.aiTools.testPassed")]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(E.XCircle,{className:"h-3 w-3 mr-1"}),o("settings.aiTools.testFailed")]})})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:a.type})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[!c&&(0,b.jsxs)(g.Button,{variant:"outline",size:"sm",onClick:()=>{var b;ah(b=a.type),localStorage.setItem(V,b)},children:[(0,b.jsx)(x,{className:"h-3.5 w-3.5 mr-1.5 text-muted-foreground"}),o("settings.prompts.setDefault")]}),(0,b.jsx)(g.Button,{variant:"outline",size:"sm",onClick:()=>bj(a.type),disabled:d,children:d?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(B.Loader2,{className:"h-3.5 w-3.5 animate-spin mr-1.5"}),o("settings.aiTools.testing")]}):o("settings.aiTools.testConnection")}),"external"===a.source&&(0,b.jsx)(g.Button,{variant:"outline",size:"icon-sm",className:"h-8 w-8 text-destructive hover:text-destructive",title:o("common.delete"),children:(0,b.jsx)(y.Trash2,{className:"h-4 w-4"})})]})]}),e&&(0,b.jsx)("div",{className:"mt-3 rounded-md border border-border bg-muted/30 px-4 py-3",children:(0,b.jsx)("div",{className:"space-y-1.5",children:e.checks.map(c=>(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,b.jsx)("span",{className:(0,n.cn)("w-1.5 h-1.5 rounded-full shrink-0",c.passed?"bg-green-500":"bg-red-500")}),(0,b.jsx)("span",{className:(0,n.cn)(c.passed?"text-foreground":"text-red-700 dark:text-red-300"),children:c.message})]},`${a.type}-${c.name}`))})})]})},a.type)})});case"prompts":return $?(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsx)("div",{className:"flex justify-end",children:(0,b.jsxs)(g.Button,{onClick:bk,variant:"default",children:[(0,b.jsx)(w.Plus,{className:"h-4 w-4 mr-2"}),o("settings.prompts.newPrompt")]})}),0===am.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center rounded-lg border border-dashed border-border/50",children:[(0,b.jsx)("p",{className:"text-muted-foreground",children:o("settings.prompts.empty")}),(0,b.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:o("settings.prompts.emptyHint")})]}):(0,b.jsx)("div",{className:"rounded-xl border border-border/50 divide-y divide-border/50",children:am.map(a=>(0,b.jsxs)("div",{className:"flex items-center justify-between px-4 py-3.5 hover:bg-muted/30 transition-colors",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("h4",{className:"text-sm font-medium truncate",children:a.name}),a.isDefault&&(0,b.jsxs)(k.Badge,{variant:"secondary",className:"shrink-0 rounded-full text-xs",children:[(0,b.jsx)(x,{className:"h-3 w-3 mr-1 fill-yellow-400 text-yellow-400"}),o("settings.prompts.default")]})]}),a.description&&(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground truncate",children:a.description})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 shrink-0 ml-4",children:[(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-sm",onClick:()=>bo(a.id),title:o("settings.prompts.setDefault"),children:(0,b.jsx)(x,{className:(0,n.cn)("h-4 w-4",a.isDefault?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})}),(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-sm",onClick:()=>bl(a),title:o("settings.prompts.editPrompt"),children:(0,b.jsx)(z,{className:"h-4 w-4"})}),(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-sm",onClick:()=>at(a.id),className:"text-destructive",title:o("settings.prompts.delete"),children:(0,b.jsx)(y.Trash2,{className:"h-4 w-4"})})]})]},a.id))}),(0,b.jsx)(m.Dialog,{open:ao,onOpenChange:ap,children:(0,b.jsxs)(m.DialogContent,{children:[(0,b.jsxs)(m.DialogHeader,{children:[(0,b.jsx)(m.DialogTitle,{children:aq?o("settings.prompts.editPrompt"):o("settings.prompts.newPrompt")}),(0,b.jsx)(m.DialogDescription,{children:aq?o("settings.prompts.editPrompt"):o("settings.prompts.newPrompt")})]}),(0,b.jsxs)("div",{className:"space-y-4 py-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)(j.Label,{htmlFor:"prompt-name",children:o("settings.prompts.promptName")}),(0,b.jsx)(h.Input,{id:"prompt-name",value:au,onChange:a=>av(a.target.value),placeholder:o("settings.prompts.promptNamePlaceholder"),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)(j.Label,{htmlFor:"prompt-description",children:o("settings.prompts.promptDescription")}),(0,b.jsx)(h.Input,{id:"prompt-description",value:aw,onChange:a=>ax(a.target.value),placeholder:o("settings.prompts.promptDescriptionPlaceholder"),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)(j.Label,{htmlFor:"prompt-content",children:o("settings.prompts.promptContent")}),(0,b.jsx)(i.Textarea,{id:"prompt-content",value:ay,onChange:a=>az(a.target.value),placeholder:o("settings.prompts.promptContentPlaceholder"),rows:8,className:"mt-1.5 font-mono text-sm"})]})]}),(0,b.jsxs)(m.DialogFooter,{children:[(0,b.jsx)(g.Button,{variant:"outline",onClick:()=>ap(!1),children:o("settings.prompts.cancel")}),(0,b.jsx)(g.Button,{onClick:bm,disabled:!au.trim()||!ay.trim(),children:o("settings.prompts.save")})]})]})}),(0,b.jsx)(m.Dialog,{open:!!as,onOpenChange:a=>!a&&at(null),children:(0,b.jsxs)(m.DialogContent,{children:[(0,b.jsxs)(m.DialogHeader,{children:[(0,b.jsx)(m.DialogTitle,{children:o("settings.prompts.deleteConfirmTitle")}),(0,b.jsx)(m.DialogDescription,{children:o("settings.prompts.deleteConfirmMessage")})]}),(0,b.jsxs)(m.DialogFooter,{children:[(0,b.jsx)(g.Button,{variant:"outline",onClick:()=>at(null),children:o("settings.prompts.cancel")}),(0,b.jsx)(g.Button,{variant:"destructive",onClick:bn,children:o("settings.prompts.delete")})]})]})})]}):(0,b.jsx)("div",{className:"h-32 rounded-lg bg-muted animate-pulse"});case"config":let c,d,e;return(0,b.jsxs)("div",{className:"space-y-8",children:[(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.git.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.git.desc")})]}),(0,b.jsxs)(g.Button,{onClick:()=>{aJ({...X}),aH(!0)},children:[(0,b.jsx)(w.Plus,{className:"mr-2 h-4 w-4"}),o("settings.config.git.addRule")]})]}),(0,b.jsxs)("div",{className:"space-y-3",children:[0!==aA.length||aG?(0,b.jsx)("ul",{className:"divide-y rounded-xl border border-border bg-card",children:aA.map(a=>aC===a.id?(0,b.jsxs)("li",{className:"px-5 py-4 bg-muted/20",children:[(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground",children:o("settings.config.git.host")}),(0,b.jsx)(h.Input,{value:aE.host,onChange:a=>aF(b=>({...b,host:a.target.value})),placeholder:o("settings.config.git.hostPlaceholder"),className:"text-sm"})]}),(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground",children:o("settings.config.git.ownerMatch")}),(0,b.jsx)(h.Input,{value:aE.ownerMatch,onChange:a=>aF(b=>({...b,ownerMatch:a.target.value})),placeholder:o("settings.config.git.ownerMatchPlaceholder"),className:"text-sm"})]}),(0,b.jsxs)("div",{className:"space-y-1 col-span-2",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground",children:o("settings.config.git.localPathTemplate")}),(0,b.jsx)(h.Input,{value:aE.localPathTemplate,onChange:a=>aF(b=>({...b,localPathTemplate:a.target.value})),placeholder:o("settings.config.git.localPathTemplatePlaceholder"),className:"text-sm font-mono"})]}),(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground",children:o("settings.config.git.priority")}),(0,b.jsx)(h.Input,{type:"number",value:aE.priority,onChange:a=>aF(b=>({...b,priority:Number(a.target.value)})),className:"text-sm w-24"})]})]}),(0,b.jsxs)("div",{className:"flex justify-end gap-2 mt-3",children:[(0,b.jsx)(g.Button,{variant:"ghost",size:"sm",onClick:()=>aD(null),children:o("settings.config.git.cancel")}),(0,b.jsx)(g.Button,{size:"sm",onClick:()=>bw(a.id),children:o("settings.config.git.save")})]})]},a.id):(0,b.jsx)("li",{className:"group px-5 py-4 hover:bg-muted/20 transition-colors",children:(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"font-medium text-sm",children:a.host}),"*"!==a.ownerMatch&&(0,b.jsxs)("span",{className:"text-xs text-muted-foreground",children:["/ ",a.ownerMatch]}),(0,b.jsxs)(k.Badge,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:[o("settings.config.git.priority")," ",a.priority]})]}),(0,b.jsx)("p",{className:"mt-0.5 font-mono text-xs text-muted-foreground truncate",children:a.localPathTemplate})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{aD(a.id),aF({host:a.host,ownerMatch:a.ownerMatch,localPathTemplate:a.localPathTemplate,priority:a.priority})},title:o("settings.config.git.edit"),children:(0,b.jsx)(z,{className:"h-4 w-4"})}),(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-sm",onClick:()=>aP(a.id),className:"text-destructive",title:o("settings.config.git.delete"),children:(0,b.jsx)(y.Trash2,{className:"h-4 w-4"})})]})]})},a.id))}):(0,b.jsx)("div",{className:"rounded-xl border border-dashed border-border p-8 text-center",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:o("settings.config.git.noRules")})}),aG&&(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/20 p-5 space-y-4",children:[(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium",children:o("settings.config.git.host")}),(0,b.jsx)(h.Input,{value:aI.host,onChange:a=>aJ(b=>({...b,host:a.target.value})),placeholder:o("settings.config.git.hostPlaceholder"),className:"text-sm",autoFocus:!0})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium",children:o("settings.config.git.ownerMatch")}),(0,b.jsx)(h.Input,{value:aI.ownerMatch,onChange:a=>aJ(b=>({...b,ownerMatch:a.target.value})),placeholder:o("settings.config.git.ownerMatchPlaceholder"),className:"text-sm"})]})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium",children:o("settings.config.git.localPathTemplate")}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(h.Input,{value:aI.localPathTemplate,onChange:a=>aJ(b=>({...b,localPathTemplate:a.target.value})),placeholder:o("settings.config.git.localPathTemplatePlaceholder"),className:"text-sm font-mono flex-1"}),(0,b.jsx)("button",{type:"button",onClick:()=>aL(a=>!a),className:(0,n.cn)("shrink-0 rounded-full px-2.5 py-1 text-[11px] font-mono font-medium transition-colors cursor-pointer",aK?"bg-foreground text-background":"bg-muted text-muted-foreground hover:text-foreground"),children:"{path}"})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:aK?o("onboarding.step3.pathHintFull"):o("onboarding.step3.pathHintRepo")})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium",children:o("settings.config.git.priority")}),(0,b.jsx)(h.Input,{type:"number",value:aI.priority,onChange:a=>aJ(b=>({...b,priority:Number(a.target.value)})),className:"text-sm w-24"})]}),aI.localPathTemplate&&(c=aI.localPathTemplate.trim().replace(/\/+$/,""),d=aK?`${c}/{path}`:c,e=[{label:"GitHub SSH",url:"git@github.com:user/my-app.git"},{label:"GitHub HTTPS",url:"https://github.com/user/my-app.git"},{label:"GitLab Subgroup",url:"https://gitlab.com/org/team/sub/my-api.git"}],(0,b.jsxs)("div",{className:"rounded-lg bg-muted/40 border border-border px-4 py-3 space-y-2",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:o("onboarding.step3.previewLabel")}),(0,b.jsx)("div",{className:"flex gap-1",children:e.map((a,c)=>(0,b.jsx)("button",{type:"button",onClick:()=>aN(c),className:(0,n.cn)("rounded-md px-2 py-0.5 text-[11px] font-medium transition-colors cursor-pointer",aM===c?"bg-foreground text-background":"bg-muted text-muted-foreground hover:text-foreground"),children:a.label},c))})]}),(0,b.jsxs)("div",{className:"space-y-0.5",children:[(0,b.jsx)("p",{className:"font-mono text-[11px] text-muted-foreground truncate",children:e[aM].url}),(0,b.jsxs)("p",{className:"font-mono text-sm",children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"→ "}),(0,b.jsx)("span",{className:"text-foreground font-medium",children:function(a,b){if(!a||!b)return"";let c=b.trim(),d=[],e=c.match(/^git@[^:]+:(.+)$/);if(e)d=e[1].replace(/\.git\/?$/,"").split("/").filter(Boolean);else try{let a=new URL(c);d=decodeURIComponent(a.pathname).replace(/\.git\/?$/,"").split("/").filter(Boolean)}catch{return""}if(!d.length)return"";let f=d[0],g=d[d.length-1],h=d.join("/");if(a.includes("{path}"))return a.replace("{path}",h).replace("{owner}",f).replace("{repo}",g).replace(/\/+$/,"");let i=a.replace("{owner}",f).replace("{repo}","").replace(/\/+$/,"");return`${i}/${g}`}(d,e[aM].url)})]})]})]})),(0,b.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,b.jsx)(g.Button,{variant:"ghost",size:"sm",onClick:()=>aH(!1),children:o("settings.config.git.cancel")}),(0,b.jsxs)(g.Button,{size:"sm",onClick:bv,disabled:!aI.host.trim()||!aI.localPathTemplate.trim(),children:[(0,b.jsx)(A,{className:"h-3.5 w-3.5 mr-1.5"}),o("settings.config.git.save")]})]})]})]})]}),(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.system.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.system.desc")})]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.system.maxUpload")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.system.maxUploadHint")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(h.Input,{type:"number",min:1,max:500,value:aQ.maxUploadMb,onChange:a=>aR(b=>({...b,maxUploadMb:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"}),(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:"MB"})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.system.maxConcurrent")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.system.maxConcurrentHint")})]}),(0,b.jsx)(h.Input,{type:"number",min:1,max:10,value:aQ.maxConcurrent,onChange:a=>aR(b=>({...b,maxConcurrent:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]})]}),(0,b.jsx)(g.Button,{onClick:bp,className:"rounded-lg",children:o("common.save")})]}),(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.gitParams.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.gitParams.desc")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.gitParams.timeout")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.gitParams.timeoutHint")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(h.Input,{type:"number",min:5,max:300,value:aS.timeoutSec,onChange:a=>aT(b=>({...b,timeoutSec:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"}),(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:"s"})]})]}),(0,b.jsx)(g.Button,{onClick:bq,className:"rounded-lg",children:o("common.save")})]}),(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.search.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.search.desc")})]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.search.resultLimit")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.search.resultLimitHint")})]}),(0,b.jsx)(h.Input,{type:"number",min:5,max:100,value:aU.resultLimit,onChange:a=>aV(b=>({...b,resultLimit:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.search.allModeCap")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.search.allModeCapHint")})]}),(0,b.jsx)(h.Input,{type:"number",min:1,max:20,value:aU.allModeCap,onChange:a=>aV(b=>({...b,allModeCap:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.search.debounceMs")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.search.debounceMsHint")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(h.Input,{type:"number",min:50,max:1e3,value:aU.debounceMs,onChange:a=>aV(b=>({...b,debounceMs:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"}),(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:"ms"})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.search.snippetLength")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.search.snippetLengthHint")})]}),(0,b.jsx)(h.Input,{type:"number",min:20,max:500,value:aU.snippetLength,onChange:a=>aV(b=>({...b,snippetLength:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]})]}),(0,b.jsx)(g.Button,{onClick:br,className:"rounded-lg",children:o("common.save")})]}),(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.missions.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.missions.desc")})]}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsx)("label",{className:"text-sm font-medium flex-1",children:o("settings.config.missions.minCols")}),(0,b.jsx)(h.Input,{type:"number",min:1,max:10,value:aW.minCols,onChange:a=>aX(b=>({...b,minCols:Number(a.target.value)})),className:"w-20 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsx)("label",{className:"text-sm font-medium flex-1",children:o("settings.config.missions.maxCols")}),(0,b.jsx)(h.Input,{type:"number",min:1,max:10,value:aW.maxCols,onChange:a=>aX(b=>({...b,maxCols:Number(a.target.value)})),className:"w-20 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsx)("label",{className:"text-sm font-medium flex-1",children:o("settings.config.missions.minRows")}),(0,b.jsx)(h.Input,{type:"number",min:1,max:10,value:aW.minRows,onChange:a=>aX(b=>({...b,minRows:Number(a.target.value)})),className:"w-20 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsx)("label",{className:"text-sm font-medium flex-1",children:o("settings.config.missions.maxRows")}),(0,b.jsx)(h.Input,{type:"number",min:1,max:10,value:aW.maxRows,onChange:a=>aX(b=>({...b,maxRows:Number(a.target.value)})),className:"w-20 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]})]}),(0,b.jsx)(g.Button,{onClick:bs,className:"rounded-lg",children:o("common.save")})]}),(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.hooks.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.hooks.desc")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.hooks.autoUploadTypes")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.hooks.autoUploadTypesHint")})]}),(0,b.jsx)(h.Input,{value:a0,onChange:a=>a1(a.target.value),placeholder:"png, jpg, jpeg, gif, webp, svg, pdf",className:"w-80 rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsx)(g.Button,{onClick:bt,className:"rounded-lg",children:o("common.save")}),(0,b.jsxs)("div",{className:"flex items-center gap-4 pt-4 border-t border-border/50",children:[(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:aY?.installed?o("settings.config.hooks.installed"):o("settings.config.hooks.notInstalled")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.hooks.installHint")})]}),(0,b.jsx)(g.Button,{variant:aY?.installed?"destructive":"default",onClick:bu,disabled:a$||!aY,className:"rounded-lg",children:aY?.installed?o("settings.config.hooks.uninstall"):o("settings.config.hooks.install")})]})]}),(0,b.jsx)(m.Dialog,{open:!!aO,onOpenChange:a=>!a&&aP(null),children:(0,b.jsxs)(m.DialogContent,{children:[(0,b.jsxs)(m.DialogHeader,{children:[(0,b.jsx)(m.DialogTitle,{children:o("settings.config.git.deleteConfirm")}),(0,b.jsx)(m.DialogDescription,{children:o("settings.config.git.deleteConfirmMessage")})]}),(0,b.jsxs)(m.DialogFooter,{children:[(0,b.jsx)(g.Button,{variant:"outline",onClick:()=>aP(null),children:o("settings.config.git.cancel")}),(0,b.jsx)(g.Button,{variant:"destructive",onClick:()=>aO&&bx(aO),children:o("settings.config.git.delete")})]})]})})]});case"cli-profile":return bc?(0,b.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,b.jsx)(B.Loader2,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):a2?(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"flex items-center gap-2 mb-2",children:(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.cliProfile.command")})}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:o("settings.cliProfile.commandHint")}),(0,b.jsx)(h.Input,{type:"text",value:a4,onChange:a=>a5(a.target.value),placeholder:o("settings.cliProfile.commandPlaceholder"),className:"w-full rounded-lg border-border/50 bg-zinc-900 dark:bg-zinc-950 text-cyan-400 font-mono text-sm px-4 py-2.5 focus:ring-2 focus:ring-cyan-500/30 placeholder:text-zinc-600"})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.cliProfile.baseArgs")}),(0,b.jsx)(k.Badge,{variant:"secondary",className:"text-xs rounded-full px-2 py-0",children:"one per line"})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:o("settings.cliProfile.baseArgsHint")}),(0,b.jsx)(i.Textarea,{value:a6,onChange:a=>a7(a.target.value),placeholder:o("settings.cliProfile.baseArgsPlaceholder"),rows:4,className:"w-full rounded-lg border-border/50 bg-zinc-900 dark:bg-zinc-950 text-cyan-400 font-mono text-sm px-4 py-3 leading-relaxed focus:ring-2 focus:ring-cyan-500/30 placeholder:text-zinc-600 resize-none"})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.cliProfile.envVars")}),(0,b.jsx)(k.Badge,{variant:"secondary",className:"text-xs rounded-full px-2 py-0",children:"KEY=VALUE per line"})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:o("settings.cliProfile.envVarsHint")}),(0,b.jsx)(i.Textarea,{value:a8,onChange:a=>a9(a.target.value),placeholder:o("settings.cliProfile.envVarsPlaceholder"),rows:4,className:"w-full rounded-lg border-border/50 bg-zinc-900 dark:bg-zinc-950 text-cyan-400 font-mono text-sm px-4 py-3 leading-relaxed focus:ring-2 focus:ring-cyan-500/30 placeholder:text-zinc-600 resize-none"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsxs)(g.Button,{onClick:by,className:"rounded-lg",children:[(0,b.jsx)(A,{className:"h-4 w-4 mr-2"}),o("common.save")]}),"saved"===ba&&(0,b.jsxs)("span",{className:"inline-flex items-center gap-1 text-sm text-emerald-600 dark:text-emerald-400 animate-in fade-in duration-300",children:[(0,b.jsx)(C.Check,{className:"h-4 w-4"}),o("settings.cliProfile.saved")]}),"error"===ba&&(0,b.jsxs)("span",{className:"inline-flex items-center gap-1 text-sm text-red-600 dark:text-red-400 animate-in fade-in duration-300",children:[(0,b.jsx)(E.XCircle,{className:"h-4 w-4"}),o("settings.cliProfile.saveError")]})]})]}):(0,b.jsx)("div",{className:"text-sm text-muted-foreground",children:o("settings.cliProfile.noProfile")});case"notifications":return(0,b.jsx)("div",{className:"divide-y divide-border/50",children:(0,b.jsxs)("div",{className:"flex items-center justify-between py-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-sm font-medium",children:o("settings.notifications.enable")}),(0,b.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:o("settings.notifications.enableDesc")})]}),(0,b.jsx)(l.Switch,{checked:be,onCheckedChange:bz})]})})}}()]})})]})}a.s(["default",0,function(){return(0,b.jsx)(Y,{})}],3476)}];
|
|
1
|
+
module.exports=[3476,a=>{"use strict";var b=a.i(348273),c=a.i(399424),d=a.i(851033),e=a.i(706193),f=a.i(282980),g=a.i(422917),h=a.i(524513),i=a.i(302512),j=a.i(648667),k=a.i(481030),l=a.i(661964),m=a.i(755811),n=a.i(707466),o=a.i(885950),p=a.i(173250);let q=(0,p.default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);var r=a.i(529917);let s=(0,p.default)("sliders-horizontal",[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]);var t=a.i(737316),u=a.i(901927),v=a.i(17787),w=a.i(709222);let x=(0,p.default)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);var y=a.i(657673);let z=(0,p.default)("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]),A=(0,p.default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);var B=a.i(348754),C=a.i(235022),D=a.i(136913),E=a.i(526116),F=a.i(784108),G=a.i(948355),H=a.i(157337),I=a.i(441388);let J=(0,I.createServerReference)("0008e29d67b3a272dcb6583c4035eded39e6fc79b4",I.callServer,void 0,I.findSourceMapURL,"getAvailableTerminalApps");var K=a.i(745771);let L=(0,I.createServerReference)("40dab4ce3686723e1500d7ddda2b44e3570a6ea7f6",I.callServer,void 0,I.findSourceMapURL,"createPrompt"),M=(0,I.createServerReference)("6071a1e1d8668dd307ab4ef8d5d93548a89309dee0",I.callServer,void 0,I.findSourceMapURL,"updatePrompt"),N=(0,I.createServerReference)("40a58db332155a3a9a01888dbb09e9b32fa61aa303",I.callServer,void 0,I.findSourceMapURL,"deletePrompt"),O=(0,I.createServerReference)("60995789eba8497a2f6b2ec42ca4668ab2f07aff83",I.callServer,void 0,I.findSourceMapURL,"setDefaultPrompt"),P=(0,I.createServerReference)("00b923ff3bcd87dc4bfc1e2251b0ecceaea297e2f0",I.callServer,void 0,I.findSourceMapURL,"getDefaultCliProfile"),Q=(0,I.createServerReference)("60a0bff7d37c83705f278c14cdd76d883dfc8b3b4b",I.callServer,void 0,I.findSourceMapURL,"updateCliProfile");function R({options:a,value:c,onChange:d}){return(0,b.jsx)("div",{className:"inline-flex rounded-lg border border-border/50 bg-muted/30 p-1 gap-0.5",children:a.map(a=>(0,b.jsx)("button",{type:"button",onClick:()=>d(a.value),className:(0,n.cn)("rounded-md px-3.5 py-1.5 text-sm font-medium transition-all duration-200 cursor-pointer",c===a.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:a.label},a.value))})}function S({label:a,description:c,children:d,className:e}){return(0,b.jsxs)("div",{className:(0,n.cn)("flex items-center justify-between py-4 border-b border-border/50 last:border-0",e),children:[(0,b.jsxs)("div",{className:"min-w-0 flex-1 pr-4",children:[(0,b.jsx)("div",{className:"text-sm font-medium",children:a}),c&&(0,b.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:c})]}),(0,b.jsx)("div",{className:"shrink-0",children:d})]})}let T=[{id:"general",labelKey:"settings.general",descKey:"settings.generalDesc",icon:o.Settings,accent:"blue"},{id:"ai-tools",labelKey:"settings.aiTools.title",descKey:"settings.aiTools.cliVerificationDesc",icon:q,accent:"emerald"},{id:"prompts",labelKey:"settings.prompts",descKey:"settings.promptsDesc",icon:r.FileText,accent:"violet"},{id:"config",labelKey:"settings.config",descKey:"settings.configDesc",icon:s,accent:"amber"},{id:"cli-profile",labelKey:"settings.cliProfile.title",descKey:"settings.cliProfile.navDesc",icon:t.Terminal,accent:"cyan"},{id:"notifications",labelKey:"settings.notifications.title",descKey:"settings.notifications.navDesc",icon:u.Bell,accent:"rose"}],U={blue:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},emerald:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},violet:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},amber:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},cyan:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},rose:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"}},V="ai-manager:default-cli-adapter",W=[{type:"claude_local",label:"Claude Code",source:"builtin"}],X={host:"",ownerMatch:"*",localPathTemplate:"",priority:0};function Y(){let a=(0,d.useRouter)(),{t:o}=(0,f.useI18n)(),{theme:p,setTheme:q}=(0,e.useTheme)(),{locale:r,setLocale:s}=(0,f.useI18n)(),[t,u]=(0,c.useState)("general"),I=(0,c.useRef)(null),[Y,Z]=(0,c.useState)({left:0,width:0}),[$,_]=(0,c.useState)(!1),[aa,ab]=(0,c.useState)("Terminal"),[ac,ad]=(0,c.useState)([]),[ae,af]=(0,c.useState)(180),[ag,ah]=(0,c.useState)("claude_local"),[ai,aj]=(0,c.useState)(null),[ak,al]=(0,c.useState)({}),[am,an]=(0,c.useState)([]),[ao,ap]=(0,c.useState)(!1),[aq,ar]=(0,c.useState)(null),[as,at]=(0,c.useState)(null),[au,av]=(0,c.useState)(""),[aw,ax]=(0,c.useState)(""),[ay,az]=(0,c.useState)(""),[aA,aB]=(0,c.useState)([]),[aC,aD]=(0,c.useState)(null),[aE,aF]=(0,c.useState)({...X}),[aG,aH]=(0,c.useState)(!1),[aI,aJ]=(0,c.useState)({...X}),[aK,aL]=(0,c.useState)(!1),[aM,aN]=(0,c.useState)(0),[aO,aP]=(0,c.useState)(null),[aQ,aR]=(0,c.useState)({maxUploadMb:50,maxConcurrent:3}),[aS,aT]=(0,c.useState)({timeoutSec:30}),[aU,aV]=(0,c.useState)({resultLimit:20,allModeCap:5,debounceMs:250,snippetLength:80}),[aW,aX]=(0,c.useState)({minCols:1,maxCols:5,minRows:1,maxRows:5}),[aY,aZ]=(0,c.useState)(null),[a$,a_]=(0,c.useState)(!1),[a0,a1]=(0,c.useState)(""),[a2,a3]=(0,c.useState)(null),[a4,a5]=(0,c.useState)(""),[a6,a7]=(0,c.useState)(""),[a8,a9]=(0,c.useState)(""),[ba,bb]=(0,c.useState)(""),[bc,bd]=(0,c.useState)(!0),[be,bf]=(0,c.useState)(!0);(0,c.useEffect)(()=>_(!0),[]),(0,c.useEffect)(()=>{(0,F.getConfigValue)("terminal.app","Terminal").then(ab),(0,F.getConfigValue)("terminal.idleTimeoutSec",180).then(af),J().then(ad)},[]),(0,c.useEffect)(()=>{let a=localStorage.getItem(V);a&&ah(a)},[]),(0,c.useEffect)(()=>{(0,K.getPrompts)().then(an)},[]);let bg=async()=>{try{let a=await fetch("/api/internal/hooks/install");if(a.ok){let b=await a.json();aZ(b)}}catch{}};async function bh(){await (0,G.setConfigValue)("terminal.app",aa)}async function bi(){let a=Math.max(180,ae);af(a),await (0,G.setConfigValue)("terminal.idleTimeoutSec",a)}async function bj(a){if(!ai){aj(a),al(b=>{let c={...b};return delete c[a],c});try{let b=await fetch("/api/adapters/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({adapterType:a})}),c=await b.json();al(b=>({...b,[a]:c}))}catch{al(b=>({...b,[a]:{ok:!1,checks:[{name:"network_error",passed:!1,message:"Network request failed"}]}}))}finally{aj(null)}}}(0,c.useEffect)(()=>{(0,F.getConfigValue)("git.pathMappingRules",[]).then(aB),(0,F.getConfigValue)("hooks.autoUploadTypes",["png","jpg","jpeg","gif","webp","svg","pdf","md","txt","json"]).then(a=>{a1(a.join(", "))}),bg(),(0,H.getConfigValues)(["system.maxUploadBytes","system.maxConcurrentExecutions","git.timeoutSec","search.resultLimit","search.allModeCap","search.debounceMs","search.snippetLength","missions.grid.minCols","missions.grid.maxCols","missions.grid.minRows","missions.grid.maxRows"]).then(a=>{aR({maxUploadMb:Math.round((a["system.maxUploadBytes"]??0x3200000)/1024/1024),maxConcurrent:a["system.maxConcurrentExecutions"]??3}),aT({timeoutSec:a["git.timeoutSec"]??30}),aV({resultLimit:a["search.resultLimit"]??20,allModeCap:a["search.allModeCap"]??5,debounceMs:a["search.debounceMs"]??250,snippetLength:a["search.snippetLength"]??80}),aX({minCols:a["missions.grid.minCols"]??1,maxCols:a["missions.grid.maxCols"]??5,minRows:a["missions.grid.minRows"]??1,maxRows:a["missions.grid.maxRows"]??5})})},[]),(0,c.useEffect)(()=>{P().then(a=>{a&&(a3(a),a5(a.command),a7(function(a){try{let b=JSON.parse(a);return Array.isArray(b)?b.join("\n"):""}catch{return""}}(a.baseArgs)),a9(function(a){try{let b=JSON.parse(a);if("object"!=typeof b||Array.isArray(b)||null===b)return"";return Object.entries(b).map(([a,b])=>`${a}=${b}`).join("\n")}catch{return""}}(a.envVars))),bd(!1)})},[]),(0,c.useEffect)(()=>{(0,F.getConfigValue)("notification.enabled",!0).then(bf)},[]);let bk=(0,c.useCallback)(()=>{ar(null),av(""),ax(""),az(""),ap(!0)},[]),bl=(0,c.useCallback)(a=>{ar(a),av(a.name),ax(a.description??""),az(a.content),ap(!0)},[]),bm=(0,c.useCallback)(async()=>{au.trim()&&ay.trim()&&(aq?await M(aq.id,{name:au.trim(),description:aw.trim()||void 0,content:ay.trim()}):await L({name:au.trim(),description:aw.trim()||void 0,content:ay.trim()}),ap(!1),an(await (0,K.getPrompts)()),a.refresh())},[au,aw,ay,aq,a]),bn=(0,c.useCallback)(async()=>{as&&(await N(as),at(null),an(await (0,K.getPrompts)()),a.refresh())},[as,a]),bo=(0,c.useCallback)(async b=>{await O(b),an(await (0,K.getPrompts)()),a.refresh()},[a]),bp=async()=>{await (0,G.setConfigValue)("system.maxUploadBytes",1024*aQ.maxUploadMb*1024),await (0,G.setConfigValue)("system.maxConcurrentExecutions",aQ.maxConcurrent)},bq=async()=>{await (0,G.setConfigValue)("git.timeoutSec",aS.timeoutSec)},br=async()=>{await (0,G.setConfigValue)("search.resultLimit",aU.resultLimit),await (0,G.setConfigValue)("search.allModeCap",aU.allModeCap),await (0,G.setConfigValue)("search.debounceMs",aU.debounceMs),await (0,G.setConfigValue)("search.snippetLength",aU.snippetLength)},bs=async()=>{let a=Math.min(aW.minCols,aW.maxCols),b=Math.max(aW.minCols,aW.maxCols),c=Math.min(aW.minRows,aW.maxRows),d=Math.max(aW.minRows,aW.maxRows);aX({minCols:a,maxCols:b,minRows:c,maxRows:d}),await (0,G.setConfigValue)("missions.grid.minCols",a),await (0,G.setConfigValue)("missions.grid.maxCols",b),await (0,G.setConfigValue)("missions.grid.minRows",c),await (0,G.setConfigValue)("missions.grid.maxRows",d)},bt=async()=>{let a=a0.split(",").map(a=>a.trim()).filter(Boolean);await (0,G.setConfigValue)("hooks.autoUploadTypes",a)},bu=async()=>{if(aY){a_(!0);try{let a=aY.installed?"DELETE":"POST";await fetch("/api/internal/hooks/install",{method:a}),await bg()}finally{a_(!1)}}},bv=async()=>{if(!aI.host.trim()||!aI.localPathTemplate.trim())return;let a=aI.localPathTemplate.trim().replace(/\/+$/,""),b=aK?`${a}/{path}`:a,c=[...aA,{id:crypto.randomUUID(),host:aI.host.trim(),ownerMatch:aI.ownerMatch.trim()||"*",localPathTemplate:b,priority:aI.priority}];await (0,G.setConfigValue)("git.pathMappingRules",c),aB(c),aJ({...X}),aL(!1),aH(!1)},bw=async a=>{if(!aE.host.trim()||!aE.localPathTemplate.trim())return;let b=aA.map(b=>b.id===a?{...b,host:aE.host.trim(),ownerMatch:aE.ownerMatch.trim()||"*",localPathTemplate:aE.localPathTemplate.trim(),priority:aE.priority}:b);await (0,G.setConfigValue)("git.pathMappingRules",b),aB(b),aD(null)},bx=async a=>{let b=aA.filter(b=>b.id!==a);await (0,G.setConfigValue)("git.pathMappingRules",b),aB(b),aP(null)},by=(0,c.useCallback)(async()=>{if(a2){try{let a=JSON.stringify(a6.split("\n").map(a=>a.trim()).filter(Boolean)),b={};a8.split("\n").map(a=>a.trim()).filter(Boolean).forEach(a=>{let c=a.indexOf("=");if(c>0){let d=a.slice(0,c).trim(),e=a.slice(c+1).trim();b[d]=e}});let c=JSON.stringify(b);await Q(a2.id,{command:a4,baseArgs:a,envVars:c}),bb("saved")}catch{bb("error")}setTimeout(()=>bb(""),2e3)}},[a2,a4,a6,a8]);async function bz(){let a=!be;bf(a),await (0,G.setConfigValue)("notification.enabled",a)}let bA=(0,c.useCallback)(()=>{a.back()},[a]);(0,c.useEffect)(()=>{let a=I.current;if(!a)return;let b=a.querySelector(`[data-section="${t}"]`);if(!b)return;let c=a.getBoundingClientRect(),d=b.getBoundingClientRect();Z({left:d.left-c.left,width:d.width})},[t]);let bB=T.find(a=>a.id===t),bC=bB?U[bB.accent]:U.blue;return(0,b.jsxs)("div",{className:"flex h-full flex-col bg-background",children:[(0,b.jsx)("div",{className:"flex-shrink-0 border-b bg-card/50 backdrop-blur-sm",children:(0,b.jsxs)("div",{className:"mx-auto max-w-5xl px-6",children:[(0,b.jsxs)("div",{className:"flex items-center justify-between pb-3 pt-5",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:o("settings.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:o("settings.configDesc")})]}),(0,b.jsxs)(g.Button,{variant:"outline",onClick:bA,className:"gap-1.5 bg-card shadow-sm cursor-pointer",children:[(0,b.jsx)(v.X,{className:"h-3.5 w-3.5"}),"ESC"]})]}),(0,b.jsxs)("div",{ref:I,className:"relative flex gap-1 overflow-x-auto",children:[T.map(a=>{let c=a.icon,d=t===a.id,e=U[a.accent];return(0,b.jsxs)("button",{"data-section":a.id,onClick:()=>u(a.id),className:(0,n.cn)("relative flex items-center gap-2 rounded-t-lg px-4 py-2.5","text-sm font-medium whitespace-nowrap cursor-pointer","transition-colors duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",d?`${e.text} bg-background`:"text-muted-foreground hover:text-foreground hover:bg-muted/50"),children:[(0,b.jsx)("span",{className:(0,n.cn)("flex h-6 w-6 items-center justify-center rounded-md","transition-colors duration-200",d?e.bg:"bg-transparent"),children:(0,b.jsx)(c,{className:"h-3.5 w-3.5"})}),(0,b.jsx)("span",{children:o(a.labelKey)})]},a.id)}),(0,b.jsx)("div",{className:(0,n.cn)("absolute bottom-0 h-0.5 rounded-full","transition-all duration-250 ease-out",bC.indicator),style:{left:Y.left,width:Y.width}})]})]})}),(0,b.jsx)("div",{className:"flex-1 overflow-auto",children:(0,b.jsxs)("div",{className:"mx-auto max-w-4xl px-6 py-8",children:[bB&&(0,b.jsxs)("div",{className:"mb-6 flex items-start gap-4",children:[(0,b.jsx)("div",{className:(0,n.cn)("flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-xl","ring-1",bC.bg,bC.text,bC.ring),children:(0,b.jsx)(bB.icon,{className:"h-5 w-5"})}),(0,b.jsxs)("div",{className:"min-w-0",children:[(0,b.jsx)("h2",{className:"text-lg font-semibold leading-tight",children:o(bB.labelKey)}),(0,b.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:o(bB.descKey)})]})]}),(0,b.jsx)("div",{className:"mb-6 border-t"}),function(){switch(t){case"general":let a;return a=[{value:"light",label:o("settings.themeLight")},{value:"dark",label:o("settings.themeDark")},{value:"system",label:o("settings.themeSystem")}],(0,b.jsxs)("div",{className:"divide-y divide-border/50",children:[(0,b.jsx)(S,{label:o("settings.theme"),description:o("settings.themeDesc"),children:$?(0,b.jsx)(R,{options:a,value:p??"system",onChange:a=>q(a)}):(0,b.jsx)("div",{className:"inline-flex h-9 rounded-lg border border-border/50 bg-muted/30 p-1 w-[200px]"})}),(0,b.jsx)(S,{label:o("settings.language"),description:o("settings.languageDesc"),children:(0,b.jsx)(R,{options:[{value:"zh",label:"中文"},{value:"en",label:"English"}],value:r,onChange:a=>s(a)})}),(0,b.jsxs)("div",{className:"py-4 border-b border-border/50",children:[(0,b.jsx)("div",{className:"flex items-center justify-between",children:(0,b.jsxs)("div",{className:"min-w-0 flex-1 pr-4",children:[(0,b.jsx)("div",{className:"text-sm font-medium",children:o("settings.terminal.label")}),(0,b.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:o("settings.terminal.desc")})]})}),(0,b.jsxs)("div",{className:"mt-3 flex flex-col gap-2",children:[ac.length>0&&(0,b.jsx)("div",{className:"flex flex-wrap gap-2",children:ac.map(a=>(0,b.jsx)("button",{type:"button",onClick:()=>{ab(a.value),(0,G.setConfigValue)("terminal.app",a.value)},className:(0,n.cn)("rounded-lg border px-3.5 py-1.5 text-xs font-medium transition-all duration-200 cursor-pointer",aa===a.value?"border-foreground bg-accent text-foreground font-medium":"border-border text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:a.name},a.value))}),(0,b.jsx)("input",{type:"text",value:aa,onChange:a=>ab(a.target.value),onBlur:bh,placeholder:o("settings.terminal.placeholder"),className:"h-9 w-64 rounded-lg border border-border/50 bg-muted/30 px-3 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500/30"})]})]}),(0,b.jsx)(S,{label:o("settings.terminal.idleTimeout"),description:o("settings.terminal.idleTimeoutDesc"),children:(0,b.jsx)("input",{type:"number",value:ae,onChange:a=>af(Number(a.target.value)),onBlur:bi,min:180,className:"h-9 w-28 rounded-lg border border-border/50 bg-muted/30 px-3 text-sm text-right focus:outline-none focus:ring-2 focus:ring-blue-500/30"})})]});case"ai-tools":return(0,b.jsx)("ul",{className:"divide-y rounded-xl border border-border bg-card",children:W.map(a=>{let c=ag===a.type,d=ai===a.type,e=ak[a.type];return(0,b.jsx)("li",{children:(0,b.jsxs)("div",{className:"px-5 py-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,b.jsx)("span",{className:"font-medium",children:a.label}),(0,b.jsx)(k.Badge,{variant:"outline",children:o("label.builtin")}),c&&(0,b.jsxs)(k.Badge,{variant:"secondary",className:"shrink-0",children:[(0,b.jsx)(x,{className:"h-3 w-3 mr-1 fill-yellow-400 text-yellow-400"}),o("settings.prompts.default")]}),e&&(0,b.jsx)(k.Badge,{variant:e.ok?"secondary":"destructive",className:(0,n.cn)("shrink-0",e.ok&&"bg-green-600 text-white hover:bg-green-700"),children:e.ok?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(D.CheckCircle2,{className:"h-3 w-3 mr-1"}),o("settings.aiTools.testPassed")]}):(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(E.XCircle,{className:"h-3 w-3 mr-1"}),o("settings.aiTools.testFailed")]})})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:a.type})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[!c&&(0,b.jsxs)(g.Button,{variant:"outline",size:"sm",onClick:()=>{var b;ah(b=a.type),localStorage.setItem(V,b)},children:[(0,b.jsx)(x,{className:"h-3.5 w-3.5 mr-1.5 text-muted-foreground"}),o("settings.prompts.setDefault")]}),(0,b.jsx)(g.Button,{variant:"outline",size:"sm",onClick:()=>bj(a.type),disabled:d,children:d?(0,b.jsxs)(b.Fragment,{children:[(0,b.jsx)(B.Loader2,{className:"h-3.5 w-3.5 animate-spin mr-1.5"}),o("settings.aiTools.testing")]}):o("settings.aiTools.testConnection")}),"external"===a.source&&(0,b.jsx)(g.Button,{variant:"outline",size:"icon-sm",className:"h-8 w-8 text-destructive hover:text-destructive",title:o("common.delete"),children:(0,b.jsx)(y.Trash2,{className:"h-4 w-4"})})]})]}),e&&(0,b.jsx)("div",{className:"mt-3 rounded-md border border-border bg-muted/30 px-4 py-3",children:(0,b.jsx)("div",{className:"space-y-1.5",children:e.checks.map(c=>(0,b.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,b.jsx)("span",{className:(0,n.cn)("w-1.5 h-1.5 rounded-full shrink-0",c.passed?"bg-green-500":"bg-red-500")}),(0,b.jsx)("span",{className:(0,n.cn)(c.passed?"text-foreground":"text-red-700 dark:text-red-300"),children:c.message})]},`${a.type}-${c.name}`))})})]})},a.type)})});case"prompts":return $?(0,b.jsxs)("div",{className:"space-y-4",children:[(0,b.jsx)("div",{className:"flex justify-end",children:(0,b.jsxs)(g.Button,{onClick:bk,variant:"default",children:[(0,b.jsx)(w.Plus,{className:"h-4 w-4 mr-2"}),o("settings.prompts.newPrompt")]})}),0===am.length?(0,b.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center rounded-lg border border-dashed border-border/50",children:[(0,b.jsx)("p",{className:"text-muted-foreground",children:o("settings.prompts.empty")}),(0,b.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:o("settings.prompts.emptyHint")})]}):(0,b.jsx)("div",{className:"rounded-xl border border-border/50 divide-y divide-border/50",children:am.map(a=>(0,b.jsxs)("div",{className:"flex items-center justify-between px-4 py-3.5 hover:bg-muted/30 transition-colors",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("h4",{className:"text-sm font-medium truncate",children:a.name}),a.isDefault&&(0,b.jsxs)(k.Badge,{variant:"secondary",className:"shrink-0 rounded-full text-xs",children:[(0,b.jsx)(x,{className:"h-3 w-3 mr-1 fill-yellow-400 text-yellow-400"}),o("settings.prompts.default")]})]}),a.description&&(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground truncate",children:a.description})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 shrink-0 ml-4",children:[(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-sm",onClick:()=>bo(a.id),title:o("settings.prompts.setDefault"),children:(0,b.jsx)(x,{className:(0,n.cn)("h-4 w-4",a.isDefault?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})}),(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-sm",onClick:()=>bl(a),title:o("settings.prompts.editPrompt"),children:(0,b.jsx)(z,{className:"h-4 w-4"})}),(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-sm",onClick:()=>at(a.id),className:"text-destructive",title:o("settings.prompts.delete"),children:(0,b.jsx)(y.Trash2,{className:"h-4 w-4"})})]})]},a.id))}),(0,b.jsx)(m.Dialog,{open:ao,onOpenChange:ap,children:(0,b.jsxs)(m.DialogContent,{children:[(0,b.jsxs)(m.DialogHeader,{children:[(0,b.jsx)(m.DialogTitle,{children:aq?o("settings.prompts.editPrompt"):o("settings.prompts.newPrompt")}),(0,b.jsx)(m.DialogDescription,{children:aq?o("settings.prompts.editPrompt"):o("settings.prompts.newPrompt")})]}),(0,b.jsxs)("div",{className:"space-y-4 py-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)(j.Label,{htmlFor:"prompt-name",children:o("settings.prompts.promptName")}),(0,b.jsx)(h.Input,{id:"prompt-name",value:au,onChange:a=>av(a.target.value),placeholder:o("settings.prompts.promptNamePlaceholder"),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)(j.Label,{htmlFor:"prompt-description",children:o("settings.prompts.promptDescription")}),(0,b.jsx)(h.Input,{id:"prompt-description",value:aw,onChange:a=>ax(a.target.value),placeholder:o("settings.prompts.promptDescriptionPlaceholder"),className:"mt-1.5"})]}),(0,b.jsxs)("div",{children:[(0,b.jsx)(j.Label,{htmlFor:"prompt-content",children:o("settings.prompts.promptContent")}),(0,b.jsx)(i.Textarea,{id:"prompt-content",value:ay,onChange:a=>az(a.target.value),placeholder:o("settings.prompts.promptContentPlaceholder"),rows:8,className:"mt-1.5 font-mono text-sm"})]})]}),(0,b.jsxs)(m.DialogFooter,{children:[(0,b.jsx)(g.Button,{variant:"outline",onClick:()=>ap(!1),children:o("settings.prompts.cancel")}),(0,b.jsx)(g.Button,{onClick:bm,disabled:!au.trim()||!ay.trim(),children:o("settings.prompts.save")})]})]})}),(0,b.jsx)(m.Dialog,{open:!!as,onOpenChange:a=>!a&&at(null),children:(0,b.jsxs)(m.DialogContent,{children:[(0,b.jsxs)(m.DialogHeader,{children:[(0,b.jsx)(m.DialogTitle,{children:o("settings.prompts.deleteConfirmTitle")}),(0,b.jsx)(m.DialogDescription,{children:o("settings.prompts.deleteConfirmMessage")})]}),(0,b.jsxs)(m.DialogFooter,{children:[(0,b.jsx)(g.Button,{variant:"outline",onClick:()=>at(null),children:o("settings.prompts.cancel")}),(0,b.jsx)(g.Button,{variant:"destructive",onClick:bn,children:o("settings.prompts.delete")})]})]})})]}):(0,b.jsx)("div",{className:"h-32 rounded-lg bg-muted animate-pulse"});case"config":let c,d,e;return(0,b.jsxs)("div",{className:"space-y-8",children:[(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.git.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.git.desc")})]}),(0,b.jsxs)(g.Button,{onClick:()=>{aJ({...X}),aH(!0)},children:[(0,b.jsx)(w.Plus,{className:"mr-2 h-4 w-4"}),o("settings.config.git.addRule")]})]}),(0,b.jsxs)("div",{className:"space-y-3",children:[0!==aA.length||aG?(0,b.jsx)("ul",{className:"divide-y rounded-xl border border-border bg-card",children:aA.map(a=>aC===a.id?(0,b.jsxs)("li",{className:"px-5 py-4 bg-muted/20",children:[(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground",children:o("settings.config.git.host")}),(0,b.jsx)(h.Input,{value:aE.host,onChange:a=>aF(b=>({...b,host:a.target.value})),placeholder:o("settings.config.git.hostPlaceholder"),className:"text-sm"})]}),(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground",children:o("settings.config.git.ownerMatch")}),(0,b.jsx)(h.Input,{value:aE.ownerMatch,onChange:a=>aF(b=>({...b,ownerMatch:a.target.value})),placeholder:o("settings.config.git.ownerMatchPlaceholder"),className:"text-sm"})]}),(0,b.jsxs)("div",{className:"space-y-1 col-span-2",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground",children:o("settings.config.git.localPathTemplate")}),(0,b.jsx)(h.Input,{value:aE.localPathTemplate,onChange:a=>aF(b=>({...b,localPathTemplate:a.target.value})),placeholder:o("settings.config.git.localPathTemplatePlaceholder"),className:"text-sm font-mono"})]}),(0,b.jsxs)("div",{className:"space-y-1",children:[(0,b.jsx)("label",{className:"text-xs text-muted-foreground",children:o("settings.config.git.priority")}),(0,b.jsx)(h.Input,{type:"number",value:aE.priority,onChange:a=>aF(b=>({...b,priority:Number(a.target.value)})),className:"text-sm w-24"})]})]}),(0,b.jsxs)("div",{className:"flex justify-end gap-2 mt-3",children:[(0,b.jsx)(g.Button,{variant:"ghost",size:"sm",onClick:()=>aD(null),children:o("settings.config.git.cancel")}),(0,b.jsx)(g.Button,{size:"sm",onClick:()=>bw(a.id),children:o("settings.config.git.save")})]})]},a.id):(0,b.jsx)("li",{className:"group px-5 py-4 hover:bg-muted/20 transition-colors",children:(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"font-medium text-sm",children:a.host}),"*"!==a.ownerMatch&&(0,b.jsxs)("span",{className:"text-xs text-muted-foreground",children:["/ ",a.ownerMatch]}),(0,b.jsxs)(k.Badge,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:[o("settings.config.git.priority")," ",a.priority]})]}),(0,b.jsx)("p",{className:"mt-0.5 font-mono text-xs text-muted-foreground truncate",children:a.localPathTemplate})]}),(0,b.jsxs)("div",{className:"flex items-center gap-1 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{aD(a.id),aF({host:a.host,ownerMatch:a.ownerMatch,localPathTemplate:a.localPathTemplate,priority:a.priority})},title:o("settings.config.git.edit"),children:(0,b.jsx)(z,{className:"h-4 w-4"})}),(0,b.jsx)(g.Button,{variant:"ghost",size:"icon-sm",onClick:()=>aP(a.id),className:"text-destructive",title:o("settings.config.git.delete"),children:(0,b.jsx)(y.Trash2,{className:"h-4 w-4"})})]})]})},a.id))}):(0,b.jsx)("div",{className:"rounded-xl border border-dashed border-border p-8 text-center",children:(0,b.jsx)("p",{className:"text-sm text-muted-foreground",children:o("settings.config.git.noRules")})}),aG&&(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/20 p-5 space-y-4",children:[(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium",children:o("settings.config.git.host")}),(0,b.jsx)(h.Input,{value:aI.host,onChange:a=>aJ(b=>({...b,host:a.target.value})),placeholder:o("settings.config.git.hostPlaceholder"),className:"text-sm",autoFocus:!0})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium",children:o("settings.config.git.ownerMatch")}),(0,b.jsx)(h.Input,{value:aI.ownerMatch,onChange:a=>aJ(b=>({...b,ownerMatch:a.target.value})),placeholder:o("settings.config.git.ownerMatchPlaceholder"),className:"text-sm"})]})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium",children:o("settings.config.git.localPathTemplate")}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(h.Input,{value:aI.localPathTemplate,onChange:a=>aJ(b=>({...b,localPathTemplate:a.target.value})),placeholder:o("settings.config.git.localPathTemplatePlaceholder"),className:"text-sm font-mono flex-1"}),(0,b.jsx)("button",{type:"button",onClick:()=>aL(a=>!a),className:(0,n.cn)("shrink-0 rounded-full px-2.5 py-1 text-[11px] font-mono font-medium transition-colors cursor-pointer",aK?"bg-foreground text-background":"bg-muted text-muted-foreground hover:text-foreground"),children:"{path}"})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:aK?o("onboarding.step3.pathHintFull"):o("onboarding.step3.pathHintRepo")})]}),(0,b.jsxs)("div",{className:"space-y-1.5",children:[(0,b.jsx)("label",{className:"text-xs font-medium",children:o("settings.config.git.priority")}),(0,b.jsx)(h.Input,{type:"number",value:aI.priority,onChange:a=>aJ(b=>({...b,priority:Number(a.target.value)})),className:"text-sm w-24"})]}),aI.localPathTemplate&&(c=aI.localPathTemplate.trim().replace(/\/+$/,""),d=aK?`${c}/{path}`:c,e=[{label:"GitHub SSH",url:"git@github.com:user/my-app.git"},{label:"GitHub HTTPS",url:"https://github.com/user/my-app.git"},{label:"GitLab Subgroup",url:"https://gitlab.com/org/team/sub/my-api.git"}],(0,b.jsxs)("div",{className:"rounded-lg bg-muted/40 border border-border px-4 py-3 space-y-2",children:[(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:o("onboarding.step3.previewLabel")}),(0,b.jsx)("div",{className:"flex gap-1",children:e.map((a,c)=>(0,b.jsx)("button",{type:"button",onClick:()=>aN(c),className:(0,n.cn)("rounded-md px-2 py-0.5 text-[11px] font-medium transition-colors cursor-pointer",aM===c?"bg-foreground text-background":"bg-muted text-muted-foreground hover:text-foreground"),children:a.label},c))})]}),(0,b.jsxs)("div",{className:"space-y-0.5",children:[(0,b.jsx)("p",{className:"font-mono text-[11px] text-muted-foreground truncate",children:e[aM].url}),(0,b.jsxs)("p",{className:"font-mono text-sm",children:[(0,b.jsx)("span",{className:"text-muted-foreground",children:"→ "}),(0,b.jsx)("span",{className:"text-foreground font-medium",children:function(a,b){if(!a||!b)return"";let c=b.trim(),d=[],e=c.match(/^git@[^:]+:(.+)$/);if(e)d=e[1].replace(/\.git\/?$/,"").split("/").filter(Boolean);else try{let a=new URL(c);d=decodeURIComponent(a.pathname).replace(/\.git\/?$/,"").split("/").filter(Boolean)}catch{return""}if(!d.length)return"";let f=d[0],g=d[d.length-1],h=d.join("/");if(a.includes("{path}"))return a.replace("{path}",h).replace("{owner}",f).replace("{repo}",g).replace(/\/+$/,"");let i=a.replace("{owner}",f).replace("{repo}","").replace(/\/+$/,"");return`${i}/${g}`}(d,e[aM].url)})]})]})]})),(0,b.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,b.jsx)(g.Button,{variant:"ghost",size:"sm",onClick:()=>aH(!1),children:o("settings.config.git.cancel")}),(0,b.jsxs)(g.Button,{size:"sm",onClick:bv,disabled:!aI.host.trim()||!aI.localPathTemplate.trim(),children:[(0,b.jsx)(A,{className:"h-3.5 w-3.5 mr-1.5"}),o("settings.config.git.save")]})]})]})]})]}),(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.system.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.system.desc")})]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.system.maxUpload")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.system.maxUploadHint")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(h.Input,{type:"number",min:1,max:500,value:aQ.maxUploadMb,onChange:a=>aR(b=>({...b,maxUploadMb:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"}),(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:"MB"})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.system.maxConcurrent")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.system.maxConcurrentHint")})]}),(0,b.jsx)(h.Input,{type:"number",min:1,max:10,value:aQ.maxConcurrent,onChange:a=>aR(b=>({...b,maxConcurrent:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]})]}),(0,b.jsx)(g.Button,{onClick:bp,className:"rounded-lg",children:o("common.save")})]}),(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.gitParams.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.gitParams.desc")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.gitParams.timeout")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.gitParams.timeoutHint")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(h.Input,{type:"number",min:5,max:300,value:aS.timeoutSec,onChange:a=>aT(b=>({...b,timeoutSec:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"}),(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:"s"})]})]}),(0,b.jsx)(g.Button,{onClick:bq,className:"rounded-lg",children:o("common.save")})]}),(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.search.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.search.desc")})]}),(0,b.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.search.resultLimit")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.search.resultLimitHint")})]}),(0,b.jsx)(h.Input,{type:"number",min:5,max:100,value:aU.resultLimit,onChange:a=>aV(b=>({...b,resultLimit:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.search.allModeCap")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.search.allModeCapHint")})]}),(0,b.jsx)(h.Input,{type:"number",min:1,max:20,value:aU.allModeCap,onChange:a=>aV(b=>({...b,allModeCap:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.search.debounceMs")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.search.debounceMsHint")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-2",children:[(0,b.jsx)(h.Input,{type:"number",min:50,max:1e3,value:aU.debounceMs,onChange:a=>aV(b=>({...b,debounceMs:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"}),(0,b.jsx)("span",{className:"text-sm text-muted-foreground",children:"ms"})]})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.search.snippetLength")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.search.snippetLengthHint")})]}),(0,b.jsx)(h.Input,{type:"number",min:20,max:500,value:aU.snippetLength,onChange:a=>aV(b=>({...b,snippetLength:Number(a.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]})]}),(0,b.jsx)(g.Button,{onClick:br,className:"rounded-lg",children:o("common.save")})]}),(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.missions.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.missions.desc")})]}),(0,b.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsx)("label",{className:"text-sm font-medium flex-1",children:o("settings.config.missions.minCols")}),(0,b.jsx)(h.Input,{type:"number",min:1,max:10,value:aW.minCols,onChange:a=>aX(b=>({...b,minCols:Number(a.target.value)})),className:"w-20 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsx)("label",{className:"text-sm font-medium flex-1",children:o("settings.config.missions.maxCols")}),(0,b.jsx)(h.Input,{type:"number",min:1,max:10,value:aW.maxCols,onChange:a=>aX(b=>({...b,maxCols:Number(a.target.value)})),className:"w-20 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsx)("label",{className:"text-sm font-medium flex-1",children:o("settings.config.missions.minRows")}),(0,b.jsx)(h.Input,{type:"number",min:1,max:10,value:aW.minRows,onChange:a=>aX(b=>({...b,minRows:Number(a.target.value)})),className:"w-20 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsx)("label",{className:"text-sm font-medium flex-1",children:o("settings.config.missions.maxRows")}),(0,b.jsx)(h.Input,{type:"number",min:1,max:10,value:aW.maxRows,onChange:a=>aX(b=>({...b,maxRows:Number(a.target.value)})),className:"w-20 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]})]}),(0,b.jsx)(g.Button,{onClick:bs,className:"rounded-lg",children:o("common.save")})]}),(0,b.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("h3",{className:"text-sm font-semibold",children:o("settings.config.hooks.title")}),(0,b.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:o("settings.config.hooks.desc")})]}),(0,b.jsxs)("div",{className:"flex items-center gap-4",children:[(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.config.hooks.autoUploadTypes")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.hooks.autoUploadTypesHint")})]}),(0,b.jsx)(h.Input,{value:a0,onChange:a=>a1(a.target.value),placeholder:"png, jpg, jpeg, gif, webp, svg, pdf",className:"w-80 rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,b.jsx)(g.Button,{onClick:bt,className:"rounded-lg",children:o("common.save")}),(0,b.jsxs)("div",{className:"flex items-center gap-4 pt-4 border-t border-border/50",children:[(0,b.jsxs)("div",{className:"flex-1",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:aY?.installed?o("settings.config.hooks.installed"):o("settings.config.hooks.notInstalled")}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground",children:o("settings.config.hooks.installHint")})]}),(0,b.jsx)(g.Button,{variant:aY?.installed?"destructive":"default",onClick:bu,disabled:a$||!aY,className:"rounded-lg",children:aY?.installed?o("settings.config.hooks.uninstall"):o("settings.config.hooks.install")})]})]}),(0,b.jsx)(m.Dialog,{open:!!aO,onOpenChange:a=>!a&&aP(null),children:(0,b.jsxs)(m.DialogContent,{children:[(0,b.jsxs)(m.DialogHeader,{children:[(0,b.jsx)(m.DialogTitle,{children:o("settings.config.git.deleteConfirm")}),(0,b.jsx)(m.DialogDescription,{children:o("settings.config.git.deleteConfirmMessage")})]}),(0,b.jsxs)(m.DialogFooter,{children:[(0,b.jsx)(g.Button,{variant:"outline",onClick:()=>aP(null),children:o("settings.config.git.cancel")}),(0,b.jsx)(g.Button,{variant:"destructive",onClick:()=>aO&&bx(aO),children:o("settings.config.git.delete")})]})]})})]});case"cli-profile":return bc?(0,b.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,b.jsx)(B.Loader2,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):a2?(0,b.jsxs)("div",{className:"space-y-6",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"flex items-center gap-2 mb-2",children:(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.cliProfile.command")})}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:o("settings.cliProfile.commandHint")}),(0,b.jsx)(h.Input,{type:"text",value:a4,onChange:a=>a5(a.target.value),placeholder:o("settings.cliProfile.commandPlaceholder"),className:"w-full rounded-lg border-border/50 bg-zinc-900 dark:bg-zinc-950 text-cyan-400 font-mono text-sm px-4 py-2.5 focus:ring-2 focus:ring-cyan-500/30 placeholder:text-zinc-600"})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.cliProfile.baseArgs")}),(0,b.jsx)(k.Badge,{variant:"secondary",className:"text-xs rounded-full px-2 py-0",children:"one per line"})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:o("settings.cliProfile.baseArgsHint")}),(0,b.jsx)(i.Textarea,{value:a6,onChange:a=>a7(a.target.value),placeholder:o("settings.cliProfile.baseArgsPlaceholder"),rows:4,className:"w-full rounded-lg border-border/50 bg-zinc-900 dark:bg-zinc-950 text-cyan-400 font-mono text-sm px-4 py-3 leading-relaxed focus:ring-2 focus:ring-cyan-500/30 placeholder:text-zinc-600 resize-none"})]}),(0,b.jsxs)("div",{children:[(0,b.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,b.jsx)("label",{className:"text-sm font-medium",children:o("settings.cliProfile.envVars")}),(0,b.jsx)(k.Badge,{variant:"secondary",className:"text-xs rounded-full px-2 py-0",children:"KEY=VALUE per line"})]}),(0,b.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:o("settings.cliProfile.envVarsHint")}),(0,b.jsx)(i.Textarea,{value:a8,onChange:a=>a9(a.target.value),placeholder:o("settings.cliProfile.envVarsPlaceholder"),rows:4,className:"w-full rounded-lg border-border/50 bg-zinc-900 dark:bg-zinc-950 text-cyan-400 font-mono text-sm px-4 py-3 leading-relaxed focus:ring-2 focus:ring-cyan-500/30 placeholder:text-zinc-600 resize-none"})]}),(0,b.jsxs)("div",{className:"flex items-center gap-3",children:[(0,b.jsxs)(g.Button,{onClick:by,className:"rounded-lg",children:[(0,b.jsx)(A,{className:"h-4 w-4 mr-2"}),o("common.save")]}),"saved"===ba&&(0,b.jsxs)("span",{className:"inline-flex items-center gap-1 text-sm text-emerald-600 dark:text-emerald-400 animate-in fade-in duration-300",children:[(0,b.jsx)(C.Check,{className:"h-4 w-4"}),o("settings.cliProfile.saved")]}),"error"===ba&&(0,b.jsxs)("span",{className:"inline-flex items-center gap-1 text-sm text-red-600 dark:text-red-400 animate-in fade-in duration-300",children:[(0,b.jsx)(E.XCircle,{className:"h-4 w-4"}),o("settings.cliProfile.saveError")]})]})]}):(0,b.jsx)("div",{className:"text-sm text-muted-foreground",children:o("settings.cliProfile.noProfile")});case"notifications":return(0,b.jsx)("div",{className:"divide-y divide-border/50",children:(0,b.jsxs)("div",{className:"flex items-center justify-between py-4",children:[(0,b.jsxs)("div",{children:[(0,b.jsx)("div",{className:"text-sm font-medium",children:o("settings.notifications.enable")}),(0,b.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:o("settings.notifications.enableDesc")})]}),(0,b.jsx)(l.Switch,{checked:be,onCheckedChange:bz})]})})}}()]})})]})}a.s(["default",0,function(){return(0,b.jsx)(Y,{})}],3476)}];
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=tower_src_app_settings_page_tsx_0vo5e-o._.js.map
|