@ulpi/cli 0.1.11 → 0.1.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-GSFWS32F.js → chunk-3YFN5ZOR.js} +1 -1
- package/dist/{ci-RMMSML3A.js → ci-EXYAXQVI.js} +1 -1
- package/dist/{doctor-ILXW63Q2.js → doctor-2EHFGL6W.js} +1 -1
- package/dist/{history-TKPFJAL3.js → history-MXKIYCX4.js} +1 -1
- package/dist/index.js +8 -8
- package/dist/portal/apps/portal/.next/BUILD_ID +1 -1
- package/dist/portal/apps/portal/.next/app-build-manifest.json +113 -113
- package/dist/portal/apps/portal/.next/app-path-routes-manifest.json +25 -25
- package/dist/portal/apps/portal/.next/build-manifest.json +2 -2
- package/dist/portal/apps/portal/.next/prerender-manifest.json +106 -106
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/billing/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/codemap/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/dashboard/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/history/[sha]/transcript/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/history/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/jobs/[id]/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/jobs/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/loop/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/mcps/[name]/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/mcps/catalog/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/mcps/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/mcps/secrets/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/mcps/submissions/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/mcps/usage/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/memory/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/memory/settings/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/memory/timeline/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/notifications/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/parallel/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/prd/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/repos/[id]/guards/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/repos/[id]/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/repos/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/review/config/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/review/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/review/plan/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/review/queue/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/rules/[id]/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/rules/new/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/rules/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/rules/pipelines/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/sessions/[sessionId]/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/sessions/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/settings/github/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/settings/installations/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/settings/keys/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/settings/members/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/settings/orgs/new/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/settings/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/skills/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/sprints/[batchId]/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/sprints/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/(dashboard)/templates/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/_not-found.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/_not-found.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/auth/callback/page_client-reference-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/app/auth/callback.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/auth/callback.rsc +1 -1
- package/dist/portal/apps/portal/.next/server/app/billing.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/billing.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/codemap.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/codemap.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/dashboard.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/dashboard.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/history.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/history.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/jobs.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/jobs.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/loop.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/loop.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/mcps/catalog.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/mcps/catalog.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/mcps/secrets.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/mcps/secrets.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/mcps/submissions.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/mcps/submissions.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/mcps/usage.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/mcps/usage.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/mcps.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/mcps.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/memory/settings.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/memory/settings.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/memory/timeline.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/memory/timeline.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/memory.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/memory.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/notifications.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/notifications.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/parallel.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/parallel.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/prd.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/prd.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/repos.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/repos.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/review/config.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/review/config.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/review/plan.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/review/plan.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/review/queue.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/review/queue.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/review.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/review.meta +2 -0
- package/dist/portal/apps/portal/.next/server/app/review.rsc +2 -2
- package/dist/portal/apps/portal/.next/server/app/rules/new.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/rules/new.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/rules/pipelines.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/rules/pipelines.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/rules.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/rules.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/sessions.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/sessions.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/settings/github.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/settings/github.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/settings/installations.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/settings/installations.rsc +2 -2
- package/dist/portal/apps/portal/.next/server/app/settings/keys.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/settings/keys.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/settings/members.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/settings/members.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/settings/orgs/new.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/settings/orgs/new.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/settings.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/settings.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/skills.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/skills.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/sprints.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/sprints.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app/templates.html +1 -1
- package/dist/portal/apps/portal/.next/server/app/templates.rsc +3 -3
- package/dist/portal/apps/portal/.next/server/app-paths-manifest.json +25 -25
- package/dist/portal/apps/portal/.next/server/chunks/1522.js +1 -1
- package/dist/portal/apps/portal/.next/server/pages/404.html +1 -1
- package/dist/portal/apps/portal/.next/server/pages/500.html +1 -1
- package/dist/portal/apps/portal/.next/static/chunks/380-71bdca6a9260da3e.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/3958-9975252472a218aa.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/7525-85f4ca4276511230.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/7889-a8be276e20a74863.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/8744-29d969a2ddf40afe.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/{8934-bb365eb647fb2d5a.js → 8934-9fbad2b348b6ada1.js} +1 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/codemap/page-e85b24075b2ae8e9.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/dashboard/page-701be25e4930fcb6.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/jobs/[id]/page-b0ac38d08f846f50.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/layout-4232b69653c5fbbf.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/mcps/[name]/page-f5283ca4a2a1141b.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/mcps/catalog/page-9b228ecfe1982eba.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/mcps/page-d8028301dcd11348.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/memory/page-34fe9bf93ef853d0.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/memory/settings/page-5c9c471c9425d814.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/memory/timeline/page-590f707b60b9ba47.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/notifications/page-46a9b033af7430e6.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/repos/page-155cd1007250e5da.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/review/config/page-5ffb558d24a57b2c.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/review/queue/page-9fe0df848d23c383.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/rules/page-e17685f3220da942.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/rules/pipelines/page-589f30a41f066568.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/sessions/page-4ff5d7490cc0d260.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/settings/page-045a30e0bd843279.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/skills/page-2bd816bd8e62dc04.js +1 -0
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/templates/page-28a51e2788c5798d.js +1 -0
- package/dist/portal/apps/portal/package.json +0 -1
- package/dist/{start-BRB2XW3T.js → start-6SLTMLI4.js} +1 -1
- package/dist/{update-HBWHFHUW.js → update-563P3ZIS.js} +1 -1
- package/dist/{version-checker-BQP7DVQ4.js → version-checker-JHHM4OTR.js} +1 -1
- package/package.json +1 -1
- package/dist/portal/apps/portal/.next/static/chunks/380-52bab5fc966d7cf9.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/3958-eebe9ad88e40b2c1.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/7525-8d416b046f9add2a.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/7889-a3331988a8344d05.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/8744-d545a53c9709467b.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/codemap/page-bf1ece66c1b05822.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/dashboard/page-936391d6b330f0cc.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/jobs/[id]/page-dba3c6050ccf9243.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/layout-05fc9732a636a609.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/mcps/[name]/page-f24841b78e8c05c0.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/mcps/catalog/page-2ff0e6b6a5d76dac.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/mcps/page-2476b9c29c44c372.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/memory/page-afe7f7a5b78650f2.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/memory/settings/page-a3be96ef297c8e33.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/memory/timeline/page-4e3dd7e30a9946f0.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/notifications/page-df5f393a51d8e17b.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/repos/page-a0bcc68a119f63e1.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/review/config/page-770321f5a71a29a3.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/review/queue/page-33687733a5398264.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/rules/page-ac19551ab9f2128d.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/rules/pipelines/page-96ecfcce3a60ebb2.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/sessions/page-0b140fb8bbc53097.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/settings/page-ec4076cedf8df275.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/skills/page-81f63d5d894b0b03.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/templates/page-263e03b6690d36f5.js +0 -1
- /package/dist/portal/apps/portal/.next/static/{SG8tUyluXEA9HzEKtf-oo → p-7mo3JdIgTzhlpqhShmK}/_buildManifest.js +0 -0
- /package/dist/portal/apps/portal/.next/static/{SG8tUyluXEA9HzEKtf-oo → p-7mo3JdIgTzhlpqhShmK}/_ssgManifest.js +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7525],{33:(e,t,n)=>{n.d(t,{U:()=>s});var r=n(8111);function l(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n=100===t?e/10:e;return n>=8?"text-emerald-400":n>=6?"text-amber-400":n>=4?"text-orange-400":"text-red-400"}function s(e){let{score:t,onRequestAiScore:n,aiScoreLoading:s=!1,aiScoringAvailable:o=!1,scale:a=10}=e,i=100===a?Math.round(t.overall).toString():t.overall.toFixed(1);return(0,r.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-surface-900 p-5",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold text-white",children:"Quality Score"}),(0,r.jsxs)("span",{className:"text-lg font-bold ".concat(l(t.overall,a)),children:[i,"/",100===a?"100":"10"]}),t.isAiScore&&(0,r.jsxs)("span",{className:"rounded-full bg-primary-500/10 px-2 py-0.5 text-[10px] font-medium text-primary-400 border border-primary-500/20",children:["AI ",t.aiModel?"(".concat(t.aiModel,")"):""]})]}),o&&!t.isAiScore&&n&&(0,r.jsx)("button",{onClick:n,disabled:s,className:"rounded-lg bg-primary-500/10 px-3 py-1.5 text-xs font-medium text-primary-400 transition-colors hover:bg-primary-500/20 disabled:opacity-50",children:s?"Scoring...":"AI Score"})]}),(0,r.jsx)("div",{className:"space-y-2.5",children:t.breakdown.map(e=>(0,r.jsxs)("div",{className:"group",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,r.jsx)("span",{className:"text-xs text-gray-400 capitalize",children:e.name}),(0,r.jsx)("span",{className:"text-xs font-medium ".concat(l(e.score)),children:e.score.toFixed(1)})]}),(0,r.jsx)("div",{className:"h-1.5 w-full rounded-full bg-white/[0.06]",children:(0,r.jsx)("div",{className:"h-full rounded-full transition-all ".concat(function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:10,n=100===t?e/10:e;return n>=8?"bg-emerald-500":n>=6?"bg-amber-500":n>=4?"bg-orange-500":"bg-red-500"}(e.score)),style:{width:"".concat(Math.min(10*e.score,100),"%")}})}),e.details&&(0,r.jsx)("p",{className:"mt-0.5 text-[10px] text-gray-600 opacity-0 group-hover:opacity-100 transition-opacity",children:e.details})]},e.name))}),t.suggestions.length>0&&(0,r.jsxs)("div",{className:"mt-4 pt-3 border-t border-white/[0.04]",children:[(0,r.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-500 mb-2",children:"Suggestions"}),(0,r.jsx)("ul",{className:"space-y-1",children:t.suggestions.map((e,t)=>(0,r.jsxs)("li",{className:"text-xs text-gray-400 flex gap-2",children:[(0,r.jsx)("span",{className:"text-gray-600 shrink-0",children:"-"}),(0,r.jsx)("span",{children:e})]},t))})]})]})}},64:(e,t,n)=>{n.d(t,{U:()=>s});var r=n(5271),l=n(9396);function s(e){var t,n,s,o,a;let{markdown:i,onMarkdownChange:c,readOnly:d,initialState:u,onExtraKeyDown:x}=e,[m,p]=(0,r.useState)(null!=(t=null==u?void 0:u.annotations)?t:[]),[h,b]=(0,r.useState)(null!=(n=null==u?void 0:u.inlineEdits)?n:[]),[g,f]=(0,r.useState)(null!=(s=null==u?void 0:u.priorities)?s:[]),[y,v]=(0,r.useState)(null!=(o=null==u?void 0:u.risks)?o:[]),[w,j]=(0,r.useState)(null!=(a=null==u?void 0:u.instructions)?a:[]),[N,k]=(0,r.useState)(new Set),[C,E]=(0,r.useState)(""),[S,I]=(0,r.useState)(null),[A,D]=(0,r.useState)(null),[P,M]=(0,r.useState)("notes"),[L,R]=(0,r.useState)(!1),[z,T]=(0,r.useState)(null),[U,q]=(0,r.useState)(null),[F,_]=(0,r.useState)(""),[W,K]=(0,r.useState)(null),[O,B]=(0,r.useState)({visible:!1,x:0,y:0,mode:"block",sectionIdx:null}),[G,H]=(0,r.useState)(null),[J,X]=(0,r.useState)(null),[$,Q]=(0,r.useState)(!1),[Y,Z]=(0,r.useState)(!1),[,V]=(0,r.useState)(0);(0,r.useEffect)(()=>{let e=setInterval(()=>V(e=>e+1),3e4);return()=>clearInterval(e)},[]);let ee=(0,r.useMemo)(()=>(0,l.Dx)(i),[i]),et=(0,r.useMemo)(()=>{let e=new Map;for(let n of m){var t;if(!n.sectionId||"global"===n.sectionId)continue;let r=null!=(t=e.get(n.sectionId))?t:[];r.push(n),e.set(n.sectionId,r)}return e},[m]),en=(0,r.useMemo)(()=>{if(!C.trim())return m;let e=C.toLowerCase();return m.filter(t=>t.text.toLowerCase().includes(e)||t.type.toLowerCase().includes(e))},[m,C]),er=en.filter(e=>"global"===e.sectionId),el=(0,r.useMemo)(()=>{let e=new Map;for(let t of en)t.sectionId&&"global"!==t.sectionId&&(e.has(t.sectionId)||e.set(t.sectionId,[]),e.get(t.sectionId).push(t));return e},[en]),es=(0,r.useCallback)(e=>{k(t=>{let n=new Set(t);return n.has(e)?n.delete(e):n.add(e),n})},[]),eo=(0,r.useCallback)((e,t)=>{var n,r;if(!W)return;let l={id:crypto.randomUUID(),type:W.type,text:W.selectedText?"> ".concat(W.selectedText,"\n\n").concat(e):e,sectionId:null!==W.sectionIdx?null!=(r=null==(n=ee[W.sectionIdx])?void 0:n.id)?r:String(W.sectionIdx):"global",createdAt:Date.now(),imagePaths:t};p(e=>[...e,l]),K(null)},[W,ee]),ea=(0,r.useCallback)(()=>{let e=window.getSelection();if(!e||e.isCollapsed||!e.toString().trim())return void R(!1);let t=e.toString().trim(),n=e.getRangeAt(0),r=n.getBoundingClientRect(),l=n.startContainer,s=null;for(;l;){if(l instanceof HTMLElement){let e=l.getAttribute("data-section-idx");if(null!==e){s=Number(e);break}}l=l.parentNode}_(t),q(s),T(r),R(!0)},[]),ei=(0,r.useCallback)(()=>{R(!1)},[]),ec=(0,r.useCallback)(e=>{var t;R(!1),K({visible:!0,title:"Add ".concat(e),sectionIdx:U,type:"instruction"===e?"instruction":e,selectedText:F}),null==(t=window.getSelection())||t.removeAllRanges()},[U,F]),ed=(0,r.useCallback)((e,t)=>{e.preventDefault();let n=window.getSelection(),r=n&&!n.isCollapsed&&n.toString().trim().length>0;B({visible:!0,x:e.clientX,y:e.clientY,mode:r?"selection":"block",sectionIdx:t}),r&&(_(n.toString().trim()),q(t))},[]),eu=(0,r.useCallback)(e=>{let t=O.sectionIdx;switch(e.type){case"comment":case"suggest":case"concern":case"question":{var n;let r=null!=(n=({comment:"comment",suggest:"suggestion",concern:"concern",question:"question"})[e.type])?n:"comment";K({visible:!0,title:"Add ".concat(r),sectionIdx:t,type:r,selectedText:"selection"===O.mode?F:void 0});break}case"instruction":K({visible:!0,title:"Add Instruction",sectionIdx:t,type:"instruction"});break;case"edit":d||I(t);break;case"priority":H(t);break;case"risk":X(t)}B(e=>({...e,visible:!1}))},[O,F,d]),ex=(0,r.useCallback)(e=>{var t;if(null===S)return;let n=ee[S];if(!n)return;let r=null!=(t=n.id)?t:String(S);b(t=>[...t.filter(e=>e.blockId!==r),{blockId:r,originalContent:n.content,editedContent:e}]);let l=i.split("\n"),s=n.content.split("\n"),o=e.split("\n");l.splice(n.startLine,s.length,...o),null==c||c(l.join("\n")),I(null)},[S,ee,i,c]),em=(0,r.useCallback)((e,t)=>{var n,r;if(null===G)return;let l=null!=(r=null==(n=ee[G])?void 0:n.id)?r:String(G);f(n=>[...n.filter(e=>e.sectionId!==l),{sectionId:l,priority:e,note:t}]),H(null)},[G,ee]),ep=(0,r.useCallback)(()=>{var e,t;if(null===G)return;let n=null!=(t=null==(e=ee[G])?void 0:e.id)?t:String(G);f(e=>e.filter(e=>e.sectionId!==n)),H(null)},[G,ee]),eh=(0,r.useCallback)((e,t)=>{var n,r;if(null===J)return;let l=null!=(r=null==(n=ee[J])?void 0:n.id)?r:String(J);v(n=>[...n.filter(e=>e.sectionId!==l),{sectionId:l,level:e,description:t}]),X(null)},[J,ee]),eb=(0,r.useCallback)(()=>{var e,t;if(null===J)return;let n=null!=(t=null==(e=ee[J])?void 0:e.id)?t:String(J);v(e=>e.filter(e=>e.sectionId!==n)),X(null)},[J,ee]),eg=(0,r.useCallback)((e,t,n)=>{j(r=>[...r,{id:crypto.randomUUID(),sectionId:e,instruction:t,priority:n,createdAt:Date.now()}])},[]),ef=(0,r.useCallback)(e=>{j(t=>t.filter(t=>t.id!==e))},[]),ey=(0,r.useCallback)(()=>{var e;let t={comments:0,questions:0,concerns:0,suggestions:0,approvals:0,instructions:0,globalComments:0};for(let e of m)"comment"===e.type?t.comments++:"question"===e.type?t.questions++:"concern"===e.type?t.concerns++:"suggestion"===e.type?t.suggestions++:"approval"===e.type?t.approvals++:"instruction"===e.type?t.instructions++:"global_comment"===e.type&&t.globalComments++;let n=m.find(e=>"global_comment"===e.type);return{annotationCount:m.length,annotationsByType:t,editCount:h.length,instructionCount:w.length,priorityCount:g.length,riskCount:y.length,globalComment:null==n||null==(e=n.text)?void 0:e.slice(0,200)}},[m,h,w,g,y]),ev=(0,r.useRef)(W);ev.current=W,(0,r.useEffect)(()=>{function e(e){let t=e.target,n="TEXTAREA"===t.tagName||"INPUT"===t.tagName||"SELECT"===t.tagName||"true"===t.contentEditable;if("Escape"===e.key)return Y?void Z(!1):$?void Q(!1):O.visible?void B(e=>({...e,visible:!1})):null!==G?void H(null):null!==J?void X(null):null!==S?void I(null):void 0;if(!n&&!ev.current&&(null==x||!x(e,A)))switch(e.key){case"?":e.preventDefault(),Z(e=>!e);break;case"j":e.preventDefault(),D(e=>{let t=(null!=e?e:-1)+1;return t<ee.length?t:e});break;case"k":e.preventDefault(),D(e=>{let t=(null!=e?e:1)-1;return t>=0?t:e});break;case"a":case"A":e.preventDefault(),K({visible:!0,title:"Add Global Comment",sectionIdx:null,type:"global_comment"});break;case"c":null!==A&&(e.preventDefault(),K({visible:!0,title:"Add Comment",sectionIdx:A,type:"comment"}));break;case"e":null===A||d||(e.preventDefault(),I(A));break;case"i":e.preventDefault(),M(e=>"instructions"===e?"notes":"instructions");break;case"p":null!==A&&(e.preventDefault(),H(e=>e===A?null:A),X(null));break;case"r":null!==A&&(e.preventDefault(),X(e=>e===A?null:A),H(null))}}return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[Y,$,O.visible,G,J,S,A,ee.length,d,x]);let ew=(0,r.useCallback)(()=>{p([]),b([]),f([]),v([]),j([]),k(new Set),E(""),I(null),D(null),K(null),B({visible:!1,x:0,y:0,mode:"block",sectionIdx:null}),H(null),X(null),Q(!1),Z(!1)},[]);return{sections:ee,annotations:m,setAnnotations:p,sectionAnnotations:et,filteredAnnotations:en,filteredGlobal:er,filteredSectionGroups:el,annotationFilter:C,setAnnotationFilter:E,handleAnnotationSubmit:eo,inlineEdits:h,setInlineEdits:b,editingSectionIdx:S,setEditingSectionIdx:I,handleEditCommit:ex,priorities:g,setPriorities:f,priorityPopoverSection:G,setPriorityPopoverSection:H,handleSetPriority:em,handleRemovePriority:ep,risks:y,setRisks:v,riskPopoverSection:J,setRiskPopoverSection:X,handleSetRisk:eh,handleRemoveRisk:eb,instructions:w,setInstructions:j,handleAddInstruction:eg,handleDeleteInstruction:ef,collapsedSections:N,toggleSection:es,focusedSection:A,setFocusedSection:D,toolbarVisible:L,toolbarRect:z,handleMouseUp:ea,handleContentMouseDown:ei,handleToolbarAction:ec,contextMenu:O,setContextMenu:B,handleContextMenu:ed,handleContextMenuAction:eu,commentDialog:W,setCommentDialog:K,rightPanel:P,setRightPanel:M,showExport:$,setShowExport:Q,showKeyboard:Y,setShowKeyboard:Z,buildConfirmationSummary:ey,resetEditorState:ew}}},422:(e,t,n)=>{n.d(t,{J:()=>s,h:()=>l});var r=n(7811);function l(){return"local"===r.env.NEXT_PUBLIC_ULPI_MODE,"https://ulpi-cloud-api.ngrok.app"}function s(){return"local"===r.env.NEXT_PUBLIC_ULPI_MODE||!0==="https://ulpi-cloud-api.ngrok.app".includes("localhost")}},656:(e,t,n)=>{n.d(t,{w:()=>x});var r=n(8111),l=n(5271),s=n(8054),o=n(8221),a=n(8913),i=n(9156),c=n(3881),d=n(7774);let u=[{type:"comment",icon:o.A,label:"Comment"},{type:"suggestion",icon:a.A,label:"Suggest"},{type:"concern",icon:i.A,label:"Concern"},{type:"question",icon:c.A,label:"Question"},{type:"instruction",icon:d.A,label:"Instruct"}];function x(e){let{visible:t,rect:n,onAction:o}=e,[a,i]=(0,l.useState)({x:0,y:0});return((0,l.useEffect)(()=>{if(!t||!n)return;let e=n.left+(n.width-360)/2,r=n.top-48-8+window.scrollY;e=Math.max(8,Math.min(e,window.innerWidth-360-8)),n.top-48-8<0&&(r=n.bottom+8+window.scrollY),i({x:e,y:r})},[t,n]),t&&n)?(0,s.createPortal)((0,r.jsx)("div",{className:"fixed rounded-xl border border-white/[0.08] bg-surface-900 shadow-xl z-50 p-1.5 flex gap-1",style:{left:"".concat(a.x,"px"),top:"".concat(a.y,"px")},onMouseDown:e=>e.preventDefault(),children:u.map(e=>(0,r.jsxs)("button",{className:"flex items-center gap-1.5 px-3 py-2 rounded-lg text-sm text-gray-400 hover:bg-white/[0.04] hover:text-gray-200 transition-colors",onClick:()=>o(e.type),title:e.label,children:[(0,r.jsx)(e.icon,{size:14}),(0,r.jsx)("span",{children:e.label})]},e.type))}),document.body):null}},1224:(e,t,n)=>{n.d(t,{C:()=>m});var r=n(8111),l=n(5271),s=n(2214),o=n(839),a=n(7325),i=n(9413),c=n(4285),d=n(6062);function u(e){let{content:t,isCode:n=!1,onCommit:s,onCancel:o}=e,[a,i]=(0,l.useState)(t),c=(0,l.useRef)(null);return(0,l.useEffect)(()=>{i(t)},[t]),(0,l.useEffect)(()=>{var e,t;null==(e=c.current)||e.focus(),null==(t=c.current)||t.select()},[]),(0,l.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"Enter"===e.key?(e.preventDefault(),s(a)):"Escape"===e.key&&(e.preventDefault(),o())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[a,s,o]),(0,r.jsxs)("div",{className:"relative border-2 border-primary-500 rounded-md bg-primary-500/5 p-2 my-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 px-2.5 py-2 bg-primary-500/15 rounded border border-primary-500/30 mb-2",children:[(0,r.jsx)("span",{className:"text-sm font-medium text-primary-300",children:"Editing"}),(0,r.jsx)("span",{className:"text-xs text-gray-500 ml-auto",children:"Cmd+Enter to save, Esc to cancel"})]}),(0,r.jsx)("textarea",{ref:c,className:"w-full min-h-24 p-3 text-sm leading-relaxed bg-surface-800 border border-white/[0.06] rounded-md text-gray-200 focus:outline-none focus:border-primary-500 resize-y transition-colors ".concat(n?"font-mono":""),value:a,onChange:e=>i(e.target.value),spellCheck:!n}),(0,r.jsxs)("div",{className:"flex items-center justify-end gap-2 mt-2",children:[(0,r.jsx)("button",{className:"px-3 py-1.5 text-sm border border-white/[0.06] text-gray-400 rounded-md hover:bg-white/[0.04] transition-colors",onClick:o,children:"Cancel"}),(0,r.jsx)("button",{className:"px-3 py-1.5 text-sm bg-primary-600 text-white rounded-md hover:bg-primary-700 transition-colors",onClick:()=>s(a),children:"Save Changes"})]})]})}var x=n(9396);function m(e){let{sections:t,markdown:n,sectionAnnotations:m,collapsedSections:p,focusedSection:h,editingSectionIdx:b,priorities:g,risks:f,onToggleSection:y,onContextMenu:v,onEditCommit:w,onEditCancel:j,onAddComment:N,renderAnnotationImage:k}=e,C=(0,l.useMemo)(()=>[o.A],[]),E=(0,l.useMemo)(()=>[a.A],[]);return(0,r.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-surface-900 p-6 md:p-8 space-y-1",children:[t.map((e,t)=>{var n;let l=p.has(t),o=null!=(n=m.get(e.id))?n:[],a=h===t,S=b===t,I=g.find(t=>t.sectionId===e.id),A=f.find(t=>t.sectionId===e.id),D=o.length>0?o[0].type:null,P=D?x.D5[D]:"";return(0,r.jsxs)("div",{"data-section-idx":t,className:"relative group rounded-lg transition-colors duration-150 ".concat(a?"bg-primary-500/5 ring-1 ring-primary-500/30":""," ").concat(P?"border-l-[3px] ".concat(P," pl-3"):""),onContextMenu:e=>v(e,t),children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 cursor-pointer py-1 hover:bg-white/[0.02] rounded -mx-2 px-2",onClick:()=>y(t),children:[l?(0,r.jsx)(i.A,{size:16,className:"text-gray-600"}):(0,r.jsx)(c.A,{size:16,className:"text-gray-600"}),(0,r.jsx)("span",{className:"font-semibold text-white ".concat(e.level<=2?"text-lg":"text-base"),children:e.title}),o.length>0&&(0,r.jsx)("span",{className:"ml-2 px-1.5 py-0.5 rounded-full text-[10px] font-medium bg-primary-500/20 text-primary-400",children:o.length}),I&&(0,r.jsx)("span",{className:"ml-1 px-1.5 py-0.5 rounded-full text-[10px] font-medium border ".concat("must-have"===I.priority?"bg-red-500/15 text-red-300 border-red-500/30":"should-have"===I.priority?"bg-amber-500/15 text-amber-300 border-amber-500/30":"nice-to-have"===I.priority?"bg-blue-500/15 text-blue-300 border-blue-500/30":"bg-white/[0.04] text-gray-400 border-white/[0.06]"),children:I.priority}),A&&(0,r.jsxs)("span",{className:"ml-1 px-1.5 py-0.5 rounded-full text-[10px] font-medium border ".concat("high"===A.level?"bg-red-500/15 text-red-300 border-red-500/30":"medium"===A.level?"bg-amber-500/15 text-amber-300 border-amber-500/30":"bg-green-500/15 text-green-300 border-green-500/30"),children:["risk: ",A.level]}),(0,r.jsx)("button",{onClick:e=>{e.stopPropagation(),N(t)},className:"ml-auto opacity-0 group-hover:opacity-100 transition-opacity p-1 rounded hover:bg-white/[0.06]",title:"Add annotation",children:(0,r.jsx)(d.A,{size:14,className:"text-gray-500"})})]}),!l&&(S?(0,r.jsx)("div",{className:"pl-6",children:(0,r.jsx)(u,{content:e.content,isCode:e.content.includes("```"),onCommit:w,onCancel:j})}):(0,r.jsx)("div",{className:"md-render pl-6 prose prose-invert prose-sm max-w-none",children:(0,r.jsx)(s.oz,{remarkPlugins:C,rehypePlugins:E,children:e.content.replace(/^#{1,6}\s+.+\n?/,"")})})),!l&&o.length>0&&!S&&(0,r.jsx)("div",{className:"ml-6 mt-2 space-y-2",children:o.map(e=>(0,r.jsxs)("div",{className:"border-l-2 ".concat(x.D5[e.type]," rounded-r-lg p-3 text-sm"),children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,r.jsx)("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded border ".concat(x.s0[e.type]),children:e.type}),(0,r.jsx)("span",{className:"text-[10px] text-gray-600",children:(0,x.fF)(e.createdAt)})]}),(0,r.jsx)("p",{className:"text-gray-300 whitespace-pre-wrap text-xs",children:e.text}),e.imagePaths&&e.imagePaths.length>0&&k&&(0,r.jsx)("div",{className:"flex gap-2 mt-2 flex-wrap",children:e.imagePaths.map((e,t)=>k(e,t))})]},e.id))})]},t)}),0===t.length&&n&&(0,r.jsx)("div",{className:"prose prose-invert prose-sm max-w-none",children:(0,r.jsx)(s.oz,{remarkPlugins:C,rehypePlugins:E,children:n})}),!n&&(0,r.jsx)("div",{className:"flex items-center justify-center py-16",children:(0,r.jsx)("p",{className:"text-sm text-gray-500",children:"No content available"})})]})}},2630:(e,t,n)=>{n.d(t,{O:()=>i});var r=n(8111),l=n(5271),s=n(8054),o=n(921);let a=[{id:"markdown",label:"Markdown",extension:".md",description:"Annotated markdown with review comments, priorities, and risks."},{id:"github",label:"GitHub Issue",extension:".md",description:"Formatted for GitHub Issues with checklist and annotations."},{id:"jira",label:"Jira",extension:".md",description:"Jira-compatible format with ADF-style headers, tables, and {code} blocks."},{id:"json",label:"JSON",extension:".json",description:"Raw JSON export of all review data."}];function i(e){let{visible:t,title:n,markdown:i,annotations:c,priorities:d,risks:u,sections:x,onClose:m,defaultFormat:p}=e,[h,b]=(0,l.useState)("markdown"),[g,f]=(0,l.useState)(!1),y=(0,l.useCallback)(e=>{"Escape"===e.key&&m()},[m]);(0,l.useEffect)(()=>{if(t)return document.addEventListener("keydown",y),()=>document.removeEventListener("keydown",y)},[t,y]),(0,l.useEffect)(()=>{t&&(b(null!=p?p:"markdown"),f(!1))},[t,p]);let v=(0,l.useMemo)(()=>t?function(e,t,n,r,l,s,o){var a,i,c,d,u,x,m,p,h,b,g,f;let y=t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"").slice(0,60)||"review";switch(e){case"markdown":{let e="# Review: ".concat(t,"\n\n");if(r.length>0){for(let t of(e+="## Annotations (".concat(r.length,")\n\n"),r)){let n=t.sectionId&&"global"!==t.sectionId?null==(a=o.find(e=>e.id===t.sectionId))?void 0:a.title:"Global";e+="- **[".concat(t.type,"]** ").concat(n?"(".concat(n,") "):"").concat(t.text,"\n")}e+="\n"}if(l.length>0){for(let t of(e+="## Priorities\n\n",l)){let n=null!=(c=null==(i=o.find(e=>e.id===t.sectionId))?void 0:i.title)?c:t.sectionId;e+="- **".concat(t.priority,"**: ").concat(n).concat(t.note?" - ".concat(t.note):"","\n")}e+="\n"}if(s.length>0){for(let t of(e+="## Risks\n\n",s)){let n=null!=(u=null==(d=o.find(e=>e.id===t.sectionId))?void 0:d.title)?u:t.sectionId;e+="- **".concat(t.level,"**: ").concat(n).concat(t.description?" - ".concat(t.description):"","\n")}e+="\n"}return{content:e+="## Plan\n\n".concat(n),filename:"".concat(y,"-review.md")}}case"github":{let e="## Review Summary\n\n";if(e+="- Annotations: ".concat(r.length,"\n"),e+="- Priorities: ".concat(l.length,"\n"),e+="- Risks: ".concat(s.length,"\n\n"),r.length>0){for(let t of(e+="### Comments\n\n",r))e+="- [ ] **".concat(t.type,"**: ").concat(t.text,"\n");e+="\n"}return e+="<details><summary>Full Plan</summary>\n\n".concat(n,"\n\n</details>"),{content:"# ".concat(t,"\n\n").concat(e),filename:"".concat(y,"-github-issue.md")}}case"jira":{let e="h1. ".concat(t,"\n\n");if(r.length>0){for(let t of(e+="h2. Annotations\n\n",e+="||Type||Section||Comment||\n",r)){let n=t.sectionId&&"global"!==t.sectionId?null==(x=o.find(e=>e.id===t.sectionId))?void 0:x.title:"Global",r=t.text.replace(/\|/g,"\\|").replace(/\n/g," ");e+="|".concat(t.type,"|").concat(null!=n?n:"—","|").concat(r,"|\n")}e+="\n"}if(l.length>0){for(let t of(e+="h2. Priorities\n\n",e+="||Section||Priority||Note||\n",l)){let n=null!=(p=null==(m=o.find(e=>e.id===t.sectionId))?void 0:m.title)?p:t.sectionId;e+="|".concat(n,"|").concat(t.priority,"|").concat(null!=(h=t.note)?h:"—","|\n")}e+="\n"}if(s.length>0){for(let t of(e+="h2. Risks\n\n",e+="||Section||Level||Description||\n",s)){let n=null!=(g=null==(b=o.find(e=>e.id===t.sectionId))?void 0:b.title)?g:t.sectionId,r=(null!=(f=t.description)?f:"—").replace(/\|/g,"\\|").replace(/\n/g," ");e+="|".concat(n,"|").concat(t.level,"|").concat(r,"|\n")}e+="\n"}let a=n.replace(/^### (.+)/gm,"h3. $1").replace(/^## (.+)/gm,"h2. $1").replace(/^# (.+)/gm,"h1. $1").replace(/```(\w*)\n([\s\S]*?)```/g,(e,t,n)=>"{code:language=".concat(t||"none","}\n").concat(n,"{code}")).replace(/\*\*(.+?)\*\*/g,"*$1*").replace(/^- /gm,"* ");return{content:e+="h2. Plan\n\n".concat(a),filename:"".concat(y,"-review-jira.md")}}case"json":return{content:JSON.stringify({title:t,annotations:r,priorities:l,risks:s,exportedAt:new Date().toISOString()},null,2),filename:"".concat(y,"-review.json")}}}(h,n,i,c,d,u,x):null,[t,h,n,i,c,d,u,x]);async function w(){if(v){try{await navigator.clipboard.writeText(v.content)}catch(t){let e=document.createElement("textarea");e.value=v.content,e.style.position="fixed",e.style.opacity="0",document.body.appendChild(e),e.select(),document.execCommand("copy"),document.body.removeChild(e)}f(!0),setTimeout(()=>f(!1),2e3)}}if(!t)return null;let j=a.find(e=>e.id===h);return(0,s.createPortal)((0,r.jsx)("div",{className:"fixed inset-0 bg-black/75 backdrop-blur-sm flex items-center justify-center z-50",onClick:e=>{e.target===e.currentTarget&&m()},children:(0,r.jsxs)("div",{className:"bg-surface-900 border border-white/[0.08] rounded-xl w-full max-w-lg shadow-2xl",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between p-6 border-b border-white/[0.06]",children:[(0,r.jsx)("h2",{className:"text-lg font-semibold text-white",children:"Export Plan"}),(0,r.jsx)("button",{className:"text-gray-500 hover:text-gray-200 transition-colors",onClick:m,children:(0,r.jsx)(o.A,{size:18})})]}),(0,r.jsxs)("div",{className:"p-6 space-y-4",children:[(0,r.jsx)("div",{className:"flex gap-2",children:a.map(e=>(0,r.jsxs)("button",{className:"flex-1 p-3 border rounded-lg text-left transition-colors ".concat(h===e.id?"bg-white/[0.04] ring-2 ring-primary-500 border-primary-500/30":"border-white/[0.06] hover:bg-white/[0.04]"),onClick:()=>{b(e.id),f(!1)},children:[(0,r.jsx)("span",{className:"block text-sm font-medium text-white",children:e.label}),(0,r.jsx)("span",{className:"block text-xs text-gray-500",children:e.extension})]},e.id))}),(0,r.jsx)("p",{className:"text-sm text-gray-400",children:j.description}),(0,r.jsxs)("div",{className:"border border-white/[0.06] rounded-lg overflow-hidden",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 bg-surface-800 border-b border-white/[0.06]",children:[(0,r.jsx)("span",{className:"text-xs text-gray-500",children:"Preview"}),(0,r.jsx)("span",{className:"text-xs text-gray-400 font-mono",children:null==v?void 0:v.filename})]}),(0,r.jsx)("pre",{className:"max-h-60 overflow-y-auto p-4 bg-surface-800 text-xs font-mono text-gray-400 whitespace-pre-wrap",children:(0,r.jsx)("code",{children:null==v?void 0:v.content})})]}),(0,r.jsxs)("div",{className:"flex gap-3",children:[(0,r.jsx)("button",{className:"flex-1 py-2.5 bg-white/[0.04] hover:bg-white/[0.06] text-gray-400 text-sm font-medium rounded-lg border border-white/[0.06] transition-colors",onClick:w,children:g?"Copied!":"Copy to Clipboard"}),(0,r.jsxs)("button",{className:"flex-1 py-2.5 bg-primary-500 hover:bg-primary-600 text-white text-sm font-medium rounded-lg transition-all",onClick:function(){v&&function(e,t){let n=new Blob([e],{type:"text/plain;charset=utf-8"}),r=URL.createObjectURL(n),l=document.createElement("a");l.href=r,l.download=t,l.style.display="none",document.body.appendChild(l),l.click(),document.body.removeChild(l),URL.revokeObjectURL(r)}(v.content,v.filename)},children:["Download ",j.extension]})]})]})]})}),document.body)}},3446:(e,t,n)=>{n.d(t,{Kv:()=>c,HI:()=>x,Xk:()=>d,yC:()=>u});var r=n(8111),l=n(5271),s=n(422),o=n(7811);class a{async request(e,t){let n="".concat(this.baseUrl).concat(e);if(this.repo){let e=n.includes("?")?"&":"?";n="".concat(n).concat(e,"repo=").concat(encodeURIComponent(this.repo))}let r=o.env.NEXT_PUBLIC_ULPI_API_SECRET,l=await fetch(n,{...t,headers:{"Content-Type":"application/json",...r?{"X-Ulpi-Secret":r}:{},...null==t?void 0:t.headers}});if(!l.ok)throw Error((await l.json().catch(()=>({error:l.statusText}))).error||"API error: ".concat(l.status));return l.json()}async get(e){return this.request(e)}async post(e,t){return this.request(e,{method:"POST",body:t?JSON.stringify(t):void 0})}async put(e,t){return this.request(e,{method:"PUT",body:t?JSON.stringify(t):void 0})}async delete(e){return this.request(e,{method:"DELETE"})}constructor(){this.repo=null,this.baseUrl=(0,s.h)()}}let i=(0,l.createContext)({mode:"cloud",localClient:null});function c(e){let{children:t}=e,n=(0,l.useMemo)(()=>{let e=(0,s.J)()?"local":"cloud";return{mode:e,localClient:"local"===e?new a:null}},[]);return(0,r.jsx)(i,{value:n,children:t})}function d(){return(0,l.useContext)(i).mode}function u(){let{localClient:e}=(0,l.useContext)(i);if(!e)throw Error("LocalApiClient not available in cloud mode");return e}function x(){return(0,l.useContext)(i)}},4780:(e,t,n)=>{n.d(t,{_:()=>C});var r=n(8111),l=n(5271),s=n(8054),o=n(921),a=n(8913),i=n(8982),c=n(7666),d=n(1729),u=n(9903),x=n(3163),m=n(6342),p=n(3468),h=n(8786);let b=[{tool:"pen",icon:c.A,label:"Pen"},{tool:"arrow",icon:d.A,label:"Arrow"},{tool:"circle",icon:u.A,label:"Circle"},{tool:"text",icon:x.A,label:"Text"}],g=[{value:"#ef4444",label:"Red"},{value:"#3b82f6",label:"Blue"},{value:"#22c55e",label:"Green"},{value:"#eab308",label:"Yellow"},{value:"#000000",label:"Black"},{value:"#ffffff",label:"White"}],f=[{value:2,label:"Thin"},{value:4,label:"Medium"},{value:8,label:"Thick"}];function y(){return"".concat(Date.now(),"-").concat(Math.random().toString(36).slice(2,9))}function v(e,t){let n=e.getBoundingClientRect(),r=e.width/n.width,l=e.height/n.height;return{x:(t.clientX-n.left)*r,y:(t.clientY-n.top)*l}}function w(e,t,n,r){if(!(t.length<2)){e.strokeStyle=n,e.lineWidth=r,e.lineCap="round",e.lineJoin="round",e.beginPath(),e.moveTo(t[0].x,t[0].y);for(let n=1;n<t.length;n++)e.lineTo(t[n].x,t[n].y);e.stroke()}}function j(e,t,n,r,l){let s=Math.max(4*l,12),o=Math.atan2(n.y-t.y,n.x-t.x);e.strokeStyle=r,e.lineWidth=l,e.lineCap="round",e.lineJoin="round",e.beginPath(),e.moveTo(t.x,t.y),e.lineTo(n.x,n.y),e.stroke(),e.beginPath(),e.moveTo(n.x,n.y),e.lineTo(n.x-s*Math.cos(o-Math.PI/6),n.y-s*Math.sin(o-Math.PI/6)),e.moveTo(n.x,n.y),e.lineTo(n.x-s*Math.cos(o+Math.PI/6),n.y-s*Math.sin(o+Math.PI/6)),e.stroke()}function N(e,t,n,r,l){let s=Math.abs(n.x-t.x),o=Math.abs(n.y-t.y);e.strokeStyle=r,e.lineWidth=l,e.lineCap="round",e.beginPath(),e.ellipse(t.x,t.y,s,o,0,0,2*Math.PI),e.stroke()}function k(e){let{imageSrc:t,onSave:n,onCancel:a}=e,[i,c]=(0,l.useState)([]),[d,u]=(0,l.useState)("pen"),[x,k]=(0,l.useState)("#ef4444"),[C,E]=(0,l.useState)(4),[S,I]=(0,l.useState)({width:800,height:600}),[A,D]=(0,l.useState)(!1),P=(0,l.useRef)(null),M=(0,l.useRef)(null),L=(0,l.useRef)(null),R=(0,l.useRef)(null),z=(0,l.useRef)({width:0,height:0}),T=(0,l.useRef)([]),U=(0,l.useRef)(null);(0,l.useEffect)(()=>{let e=new Image;e.crossOrigin="anonymous",e.onload=()=>{if(R.current=e,z.current={width:e.naturalWidth,height:e.naturalHeight},L.current){let t=L.current.clientWidth;if(t>0){let n=Math.round(t/(e.naturalWidth/e.naturalHeight));I({width:t,height:n})}else I({width:e.naturalWidth,height:e.naturalHeight})}},e.src=t},[t]),(0,l.useEffect)(()=>{let e=L.current;if(!e)return;let t=new ResizeObserver(e=>{let{width:t,height:n}=z.current;if(0!==t&&0!==n)for(let r of e){let e=r.contentRect.width;if(e<=0)continue;let l=Math.floor(e),s=Math.round(l/(t/n));I(e=>e.width===l&&e.height===s?e:{width:l,height:s})}});return t.observe(e),()=>t.disconnect()},[]),(0,l.useEffect)(()=>{let e=P.current,t=null==e?void 0:e.getContext("2d"),n=R.current;if(e&&t&&n)for(let r of(t.clearRect(0,0,e.width,e.height),t.drawImage(n,0,0,e.width,e.height),i))switch(r.tool){case"pen":w(t,r.points,r.color,r.lineWidth);break;case"arrow":r.points.length>=2&&j(t,r.points[0],r.points[1],r.color,r.lineWidth);break;case"circle":r.points.length>=2&&N(t,r.points[0],r.points[1],r.color,r.lineWidth);break;case"text":r.points.length>=1&&r.text&&function(e,t,n,r,l){e.fillStyle=r,e.font="".concat(l,"px sans-serif"),e.textBaseline="top";let s=n.split("\n");for(let n=0;n<s.length;n++)e.fillText(s[n],t.x,t.y+n*(l+2))}(t,r.points[0],r.text,r.color,4*r.lineWidth+12)}},[i,S]),(0,l.useEffect)(()=>{if(!A){let e=M.current,t=null==e?void 0:e.getContext("2d");e&&t&&t.clearRect(0,0,e.width,e.height)}},[A,S]),(0,l.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"z"===e.key&&(e.preventDefault(),c(e=>e.slice(0,-1))),"Escape"===e.key&&a()};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[a]);let q=(0,l.useCallback)(e=>{let t=M.current;if(!t)return;e.preventDefault();let n=v(t,e.nativeEvent);if("text"===d){let e=prompt("Enter text:");e&&c(t=>[...t,{id:y(),tool:"text",color:x,lineWidth:C,points:[n],text:e}]);return}D(!0),U.current=n,T.current=[n]},[d,x,C]),F=(0,l.useCallback)(e=>{if(!A)return;let t=M.current,n=null==t?void 0:t.getContext("2d");if(!t||!n)return;e.preventDefault();let r=v(t,e.nativeEvent);switch(n.clearRect(0,0,t.width,t.height),d){case"pen":T.current.push(r),w(n,T.current,x,C);break;case"arrow":U.current&&j(n,U.current,r,x,C);break;case"circle":U.current&&N(n,U.current,r,x,C)}},[A,d,x,C]),_=(0,l.useCallback)(e=>{if(!A)return;e.preventDefault();let t=M.current;if(!t)return;let n=v(t,e.nativeEvent),r=null;switch(d){case"pen":T.current.push(n),T.current.length>=2&&(r={id:y(),tool:"pen",color:x,lineWidth:C,points:[...T.current]});break;case"arrow":U.current&&(r={id:y(),tool:"arrow",color:x,lineWidth:C,points:[U.current,n]});break;case"circle":U.current&&(r={id:y(),tool:"circle",color:x,lineWidth:C,points:[U.current,n]})}D(!1),T.current=[],U.current=null,r&&c(e=>[...e,r])},[A,d,x,C]),W=(0,l.useCallback)(()=>{let e=P.current;e&&n(e.toDataURL("image/png"))},[n]),K=i.length>0;return(0,s.createPortal)((0,r.jsxs)("div",{className:"fixed inset-0 z-50 bg-black/90 flex flex-col",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2.5 bg-surface-900 border-b border-white/[0.06] flex-wrap shrink-0",children:[(0,r.jsx)("div",{className:"flex items-center gap-1",children:b.map(e=>{let{tool:t,icon:n,label:l}=e;return(0,r.jsxs)("button",{type:"button",className:"flex items-center gap-1.5 px-2.5 py-1.5 rounded text-xs font-medium transition-colors ".concat(d===t?"bg-primary-500 text-white":"text-gray-400 hover:bg-white/[0.04] hover:text-gray-200"),onClick:()=>u(t),title:l,children:[(0,r.jsx)(n,{size:14}),(0,r.jsx)("span",{children:l})]},t)})}),(0,r.jsx)("div",{className:"w-px h-5 bg-white/[0.06]"}),(0,r.jsx)("div",{className:"flex items-center gap-1.5",children:g.map(e=>{let{value:t,label:n}=e;return(0,r.jsx)("button",{type:"button",className:"w-5 h-5 rounded-full cursor-pointer transition-all ".concat(x===t?"ring-2 ring-primary-500 ring-offset-1 ring-offset-surface-900 scale-110":"hover:scale-110"),onClick:()=>k(t),title:n,style:{backgroundColor:t,border:"#ffffff"===t?"1px solid #d1d5db":"none"}},t)})}),(0,r.jsx)("div",{className:"w-px h-5 bg-white/[0.06]"}),(0,r.jsx)("div",{className:"flex items-center gap-1",children:f.map(e=>{let{value:t,label:n}=e;return(0,r.jsxs)("button",{type:"button",className:"flex items-center gap-1.5 px-2 py-1.5 rounded text-xs font-medium transition-colors ".concat(C===t?"bg-primary-500 text-white":"text-gray-400 hover:bg-white/[0.04] hover:text-gray-200"),onClick:()=>E(t),title:"".concat(n," line"),children:[(0,r.jsx)("span",{className:"w-5 rounded-full",style:{height:"".concat(t,"px"),backgroundColor:C===t?"white":x}}),(0,r.jsx)("span",{children:n})]},t)})}),(0,r.jsx)("div",{className:"w-px h-5 bg-white/[0.06]"}),(0,r.jsxs)("div",{className:"flex items-center gap-1",children:[(0,r.jsxs)("button",{type:"button",className:"flex items-center gap-1 px-2 py-1.5 rounded text-xs font-medium transition-colors text-gray-400 hover:bg-white/[0.04] hover:text-gray-200 ".concat(K?"":"opacity-40 cursor-not-allowed"),onClick:()=>c(e=>e.slice(0,-1)),disabled:!K,title:"Undo (Ctrl+Z)",children:[(0,r.jsx)(m.A,{size:14}),(0,r.jsx)("span",{children:"Undo"})]}),(0,r.jsxs)("button",{type:"button",className:"flex items-center gap-1 px-2 py-1.5 rounded text-xs font-medium transition-colors text-red-400 hover:bg-red-500/10 hover:text-red-300 ".concat(K?"":"opacity-40 cursor-not-allowed"),onClick:()=>c([]),disabled:!K,title:"Clear all",children:[(0,r.jsx)(p.A,{size:14}),(0,r.jsx)("span",{children:"Clear"})]})]}),(0,r.jsx)("div",{className:"flex-1"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("button",{type:"button",className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium text-gray-400 hover:text-gray-200 hover:bg-white/[0.04] transition-colors",onClick:a,children:[(0,r.jsx)(o.A,{size:14}),"Cancel"]}),(0,r.jsxs)("button",{type:"button",className:"flex items-center gap-1.5 px-3 py-1.5 rounded-lg text-sm font-medium bg-primary-500 hover:bg-primary-600 text-white transition-all",onClick:W,children:[(0,r.jsx)(h.A,{size:14}),"Save"]})]})]}),(0,r.jsx)("div",{ref:L,className:"flex-1 min-h-0 flex items-center justify-center p-4 overflow-auto",children:(0,r.jsxs)("div",{style:{position:"relative",width:"100%",maxWidth:S.width},children:[(0,r.jsx)("canvas",{ref:P,width:S.width,height:S.height,style:{display:"block",width:"100%",height:"auto"}}),(0,r.jsx)("canvas",{ref:M,width:S.width,height:S.height,style:{position:"absolute",top:0,left:0,width:"100%",height:"100%",cursor:"text"===d?"text":"crosshair"},onMouseDown:q,onMouseMove:F,onMouseUp:_,onMouseLeave:_})]})})]}),document.body)}function C(e){let{visible:t,title:n,placeholder:c="Enter your comment...",sessionId:d,onUploadImage:u,imageUrl:x,onSubmit:m,onCancel:p}=e,[h,b]=(0,l.useState)(""),[g,f]=(0,l.useState)([]),[y,v]=(0,l.useState)(null),[w,j]=(0,l.useState)(null),N=(0,l.useRef)(null),C=(0,l.useRef)(null);async function E(e){if(u)try{let t=await u(e);j(null),f(e=>[...e,t.filename])}catch(e){j(e instanceof Error?e.message:"Upload failed"),setTimeout(()=>j(null),3e3)}}async function S(e){var t;let n=null==(t=e.clipboardData)?void 0:t.items;if(n){for(let t of Array.from(n))if(t.type.startsWith("image/")){e.preventDefault();let n=t.getAsFile();if(!n)continue;await E(n);break}}}async function I(e){let t=e.target.files;if(t){for(let e of Array.from(t))await E(e);e.target.value=""}}async function A(e){if(null!==y&&u){try{let t=await fetch(e),n=await t.blob(),r=await u(n);f(e=>e.map((e,t)=>t===y?r.filename:e))}catch(e){j(e instanceof Error?e.message:"Failed to save annotation"),setTimeout(()=>j(null),3e3)}v(null)}}function D(){let e=h.trim();(e||g.length>0)&&(m(e,g.length>0?g:void 0),b(""),f([]))}return((0,l.useEffect)(()=>{t&&(b(""),f([]),v(null),j(null),setTimeout(()=>{var e;return null==(e=N.current)?void 0:e.focus()},50))},[t]),(0,l.useEffect)(()=>{if(!t)return;let e=e=>{"Escape"===e.key&&(null!==y?v(null):p())};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[t,p,y]),t)?null!==y&&g[y]&&x?(0,r.jsx)(k,{imageSrc:x(g[y]),onSave:A,onCancel:()=>v(null)}):(0,s.createPortal)((0,r.jsx)("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-50 flex items-center justify-center",onClick:p,children:(0,r.jsxs)("div",{className:"bg-surface-900 border border-white/[0.08] rounded-xl shadow-2xl w-full max-w-md mx-4",onClick:e=>e.stopPropagation(),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 border-b border-white/[0.06]",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold text-white",children:n}),(0,r.jsx)("button",{className:"text-gray-500 hover:text-gray-200 transition-colors p-1 rounded hover:bg-white/[0.04]",onClick:p,children:(0,r.jsx)(o.A,{size:16})})]}),(0,r.jsxs)("div",{className:"p-5",children:[(0,r.jsx)("textarea",{ref:N,value:h,onChange:e=>b(e.target.value),onKeyDown:function(e){"Enter"!==e.key||e.shiftKey||(e.preventDefault(),D())},onPaste:S,placeholder:c,rows:4,className:"w-full bg-surface-800 border border-white/[0.06] rounded-lg px-4 py-3 text-sm text-gray-200 placeholder:text-gray-600 focus:outline-none focus:border-primary-500/50 resize-none"}),w&&(0,r.jsx)("p",{className:"text-xs text-red-400 mt-2",children:w}),g.length>0&&x&&(0,r.jsx)("div",{className:"flex gap-2 flex-wrap mt-3",children:g.map((e,t)=>(0,r.jsxs)("div",{className:"relative group",children:[(0,r.jsx)("img",{src:x(e),className:"w-16 h-16 object-cover rounded-lg border border-white/[0.06]",alt:""}),(0,r.jsx)("button",{className:"absolute inset-0 flex items-center justify-center bg-black/50 rounded-lg opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>v(t),title:"Draw on image",children:(0,r.jsx)(a.A,{size:16,className:"text-white"})}),(0,r.jsx)("button",{className:"absolute -top-1.5 -right-1.5 w-5 h-5 rounded-full bg-surface-800 text-white text-xs flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",onClick:()=>f(e=>e.filter((e,n)=>n!==t)),children:(0,r.jsx)(o.A,{size:10})})]},t))})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between px-5 py-4 border-t border-white/[0.06]",children:[(0,r.jsx)("span",{className:"text-xs text-gray-600",children:"Shift+Enter for new line"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[d&&u&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("button",{type:"button",className:"p-2 rounded-lg text-gray-500 hover:text-gray-200 hover:bg-white/[0.04] transition-colors",onClick:()=>{var e;return null==(e=C.current)?void 0:e.click()},title:"Attach image",children:(0,r.jsx)(i.A,{size:16})}),(0,r.jsx)("input",{ref:C,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:I})]}),(0,r.jsx)("button",{className:"px-4 py-2 rounded-lg text-sm font-medium text-gray-400 hover:text-gray-200 hover:bg-white/[0.04] transition-colors",onClick:p,children:"Cancel"}),(0,r.jsx)("button",{className:"px-4 py-2 rounded-lg text-sm font-medium bg-primary-500 hover:bg-primary-600 text-white transition-all disabled:opacity-50",onClick:D,disabled:!h.trim()&&0===g.length,children:"Submit"})]})]})]})}),document.body):null}},7107:(e,t,n)=>{n.d(t,{KK:()=>u,ju:()=>h,mP:()=>m,wL:()=>c});var r=n(8111),l=n(5271),s=n(8054),o=n(6718),a=n(921);let i=[{key:"j",desc:"Next section"},{key:"k",desc:"Previous section"},{key:"a",desc:"Add global comment"},{key:"c",desc:"Comment on focused section"},{key:"e",desc:"Edit focused block"},{key:"i",desc:"Toggle Instructions panel"},{key:"p",desc:"Set priority on section"},{key:"r",desc:"Flag risk on section"},{key:"?",desc:"Toggle this overlay"},{key:"⌘ Enter",desc:"Approve plan"},{key:"d",desc:"Request changes"},{key:"Esc",desc:"Close modal/overlay"}];function c(e){let{onClose:t,shortcuts:n}=e;return(0,l.useEffect)(()=>{let e=e=>{"Escape"===e.key&&(e.preventDefault(),t())};return document.addEventListener("keydown",e),()=>document.removeEventListener("keydown",e)},[t]),(0,s.createPortal)((0,r.jsx)("div",{className:"fixed inset-0 bg-black/70 backdrop-blur-sm z-50 flex items-center justify-center",onClick:t,children:(0,r.jsxs)("div",{className:"bg-surface-900 border border-white/[0.08] rounded-xl shadow-2xl w-full max-w-sm mx-4 p-6",onClick:e=>e.stopPropagation(),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,r.jsxs)("h3",{className:"text-sm font-semibold text-white flex items-center gap-2",children:[(0,r.jsx)(o.A,{size:16})," Keyboard Shortcuts"]}),(0,r.jsx)("button",{onClick:t,className:"text-gray-500 hover:text-gray-200 transition-colors",children:(0,r.jsx)(a.A,{size:16})})]}),(0,r.jsx)("div",{className:"space-y-2",children:(null!=n?n:i).map(e=>(0,r.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,r.jsx)("span",{className:"text-gray-400",children:e.desc}),(0,r.jsx)("kbd",{className:"bg-surface-800 px-2 py-0.5 rounded text-gray-200 font-mono border border-white/[0.06]",children:e.key})]},e.key))})]})}),document.body)}function d(e){let{label:t,count:n,color:l}=e;return(0,r.jsxs)("div",{className:"flex items-center justify-between bg-white/[0.02] border border-white/[0.06] rounded-lg px-3 py-2",children:[(0,r.jsx)("span",{className:"text-sm text-gray-400",children:t}),(0,r.jsx)("span",{className:"text-sm font-bold tabular-nums ".concat(l),children:n})]})}function u(e){let{isOpen:t,actionName:n,variant:o,summary:a,onConfirm:i,onCancel:c}=e,u=(0,l.useRef)(null),x=(0,l.useRef)(null),m=(0,l.useCallback)(e=>{"Escape"===e.key?(e.preventDefault(),e.stopPropagation(),c()):"Enter"!==e.key||e.metaKey||e.ctrlKey||(e.preventDefault(),e.stopPropagation(),i())},[i,c]);if((0,l.useEffect)(()=>{if(t){var e;return x.current=document.activeElement,null==(e=u.current)||e.focus(),document.addEventListener("keydown",m,!0),document.body.style.overflow="hidden",()=>{var e;document.removeEventListener("keydown",m,!0),document.body.style.overflow="",null==(e=x.current)||e.focus()}}},[t,m]),!t)return null;let{annotationsByType:p,editCount:h,instructionCount:b,priorityCount:g,riskCount:f,globalComment:y}=a,v=p.comments>0||p.questions>0||p.concerns>0||p.suggestions>0||p.approvals>0||p.globalComments>0,w=v||h>0||b>0||g>0||f>0;return(0,s.createPortal)((0,r.jsx)("div",{className:"fixed inset-0 bg-black/50 backdrop-blur-sm z-[90] flex items-center justify-center",onClick:c,children:(0,r.jsxs)("div",{ref:u,role:"dialog","aria-modal":"true",tabIndex:-1,className:"w-full max-w-md bg-surface-900 border border-white/[0.08] rounded-2xl shadow-2xl flex flex-col focus:outline-none mx-4",onClick:e=>e.stopPropagation(),children:[(0,r.jsxs)("div",{className:"px-6 py-5 border-b border-white/[0.06]",children:[(0,r.jsxs)("h2",{className:"text-lg font-semibold text-white",children:["Confirm: ",n]}),(0,r.jsx)("p",{className:"text-sm text-gray-500 mt-1",children:w?"The following feedback will be included with your decision.":"No feedback attached. The decision will be submitted as-is."})]}),(0,r.jsxs)("div",{className:"px-6 py-5 space-y-4 max-h-[50vh] overflow-y-auto",children:[v&&(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-xs font-bold text-gray-600 uppercase tracking-widest mb-2",children:"Annotations"}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[p.comments>0&&(0,r.jsx)(d,{label:"Comments",count:p.comments,color:"text-gray-400"}),p.questions>0&&(0,r.jsx)(d,{label:"Questions",count:p.questions,color:"text-primary-400"}),p.concerns>0&&(0,r.jsx)(d,{label:"Concerns",count:p.concerns,color:"text-amber-400"}),p.suggestions>0&&(0,r.jsx)(d,{label:"Suggestions",count:p.suggestions,color:"text-blue-400"}),p.approvals>0&&(0,r.jsx)(d,{label:"Approvals",count:p.approvals,color:"text-emerald-400"}),p.globalComments>0&&(0,r.jsx)(d,{label:"Global Comments",count:p.globalComments,color:"text-gray-500"})]})]}),(h>0||b>0||g>0||f>0)&&(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-xs font-bold text-gray-600 uppercase tracking-widest mb-2",children:"Metadata"}),(0,r.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[h>0&&(0,r.jsx)(d,{label:"Inline Edits",count:h,color:"text-primary-400"}),b>0&&(0,r.jsx)(d,{label:"Instructions",count:b,color:"text-blue-400"}),g>0&&(0,r.jsx)(d,{label:"Priorities Set",count:g,color:"text-amber-400"}),f>0&&(0,r.jsx)(d,{label:"Risks Flagged",count:f,color:"text-red-400"})]})]}),y&&(0,r.jsxs)("div",{children:[(0,r.jsx)("h3",{className:"text-xs font-bold text-gray-600 uppercase tracking-widest mb-2",children:"Global Comment Preview"}),(0,r.jsx)("p",{className:"text-sm text-gray-400 bg-white/[0.02] border border-white/[0.06] rounded-lg p-3 line-clamp-3",children:y})]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-end gap-3 px-6 py-4 border-t border-white/[0.06]",children:[(0,r.jsx)("button",{className:"px-4 py-2 rounded-lg text-sm font-medium text-gray-400 hover:text-gray-200 hover:bg-white/[0.04] transition-colors",onClick:c,children:"Cancel"}),(0,r.jsx)("button",{className:"px-5 py-2 rounded-lg text-sm font-bold transition-all ".concat("approve"===o?"bg-emerald-600 text-white hover:bg-emerald-500 shadow-lg shadow-emerald-600/25":"deny"===o?"bg-red-500 text-white hover:bg-red-400 shadow-lg shadow-red-500/25":"bg-primary-500 text-white hover:bg-primary-600"),onClick:i,children:n})]}),(0,r.jsxs)("div",{className:"px-6 pb-3 flex items-center justify-center gap-3 text-xs text-gray-600",children:[(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("kbd",{className:"bg-surface-800 border border-white/[0.06] rounded px-1.5 py-0.5 font-mono text-[0.65rem]",children:"Enter"}),(0,r.jsx)("span",{children:"to confirm"})]}),(0,r.jsxs)("span",{className:"flex items-center gap-1",children:[(0,r.jsx)("kbd",{className:"bg-surface-800 border border-white/[0.06] rounded px-1.5 py-0.5 font-mono text-[0.65rem]",children:"Esc"}),(0,r.jsx)("span",{children:"to cancel"})]})]})]})}),document.body)}let x=[{value:"must-have",label:"Must Have",color:"bg-red-500/15 text-red-300 border-red-500/30"},{value:"should-have",label:"Should Have",color:"bg-amber-500/15 text-amber-300 border-amber-500/30"},{value:"nice-to-have",label:"Nice to Have",color:"bg-blue-500/15 text-blue-300 border-blue-500/30"},{value:"out-of-scope",label:"Out of Scope",color:"bg-white/[0.04] text-gray-400 border-white/[0.06]"}];function m(e){let{visible:t,sectionTitle:n,currentLevel:o,currentReason:a,anchorRect:i,onSubmit:c,onRemove:d,onClose:u}=e,[m,p]=(0,l.useState)(null!=o?o:"should-have"),[h,b]=(0,l.useState)(null!=a?a:""),g=(0,l.useRef)(null);if((0,l.useEffect)(()=>{p(null!=o?o:"should-have"),b(null!=a?a:"")},[t,o,a]),(0,l.useEffect)(()=>{if(!t)return;let e=e=>{"Escape"===e.key&&u()},n=e=>{g.current&&!g.current.contains(e.target)&&u()};return document.addEventListener("keydown",e),document.addEventListener("mousedown",n),()=>{document.removeEventListener("keydown",e),document.removeEventListener("mousedown",n)}},[t,u]),!t)return null;let f=i?{position:"fixed",top:i.bottom+4,left:Math.min(i.left,window.innerWidth-300),zIndex:50}:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:50};return(0,s.createPortal)((0,r.jsxs)("div",{ref:g,className:"bg-surface-900 border border-white/[0.08] rounded-xl shadow-2xl w-72 p-4",style:f,children:[(0,r.jsx)("h4",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider mb-1",children:"Set Priority"}),(0,r.jsx)("p",{className:"text-sm text-gray-400 truncate mb-3",children:n}),(0,r.jsx)("div",{className:"flex gap-1.5 mb-3",children:x.map(e=>(0,r.jsx)("button",{className:"flex-1 px-2 py-1.5 rounded-lg text-xs font-medium border transition-colors ".concat(m===e.value?e.color+" ring-1 ring-primary-500":"border-white/[0.06] text-gray-500 hover:bg-white/[0.04]"),onClick:()=>p(e.value),children:e.label},e.value))}),(0,r.jsx)("input",{type:"text",value:h,onChange:e=>b(e.target.value),placeholder:"Reason (optional)",className:"w-full px-3 py-2 bg-surface-800 border border-white/[0.06] rounded-lg text-sm text-gray-200 placeholder:text-gray-600 focus:outline-none focus:border-primary-500/50 mb-3",onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),c(m,h||void 0))}}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[o?(0,r.jsx)("button",{className:"text-xs text-red-400 hover:text-red-300 transition-colors",onClick:d,children:"Remove"}):(0,r.jsx)("span",{}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"px-3 py-1.5 text-xs text-gray-400 hover:text-gray-200 transition-colors",onClick:u,children:"Cancel"}),(0,r.jsx)("button",{className:"px-3 py-1.5 text-xs bg-primary-500 text-white rounded-lg hover:bg-primary-600 transition-all",onClick:()=>c(m,h||void 0),children:"Set"})]})]})]}),document.body)}let p=[{value:"high",label:"High",color:"bg-red-500/15 text-red-300 border-red-500/30"},{value:"medium",label:"Medium",color:"bg-amber-500/15 text-amber-300 border-amber-500/30"},{value:"low",label:"Low",color:"bg-green-500/15 text-green-300 border-green-500/30"}];function h(e){let{visible:t,sectionTitle:n,currentLevel:o,currentDescription:a,anchorRect:i,onSubmit:c,onRemove:d,onClose:u}=e,[x,m]=(0,l.useState)(null!=o?o:"medium"),[h,b]=(0,l.useState)(null!=a?a:""),g=(0,l.useRef)(null);if((0,l.useEffect)(()=>{m(null!=o?o:"medium"),b(null!=a?a:"")},[t,o,a]),(0,l.useEffect)(()=>{if(!t)return;let e=e=>{"Escape"===e.key&&u()},n=e=>{g.current&&!g.current.contains(e.target)&&u()};return document.addEventListener("keydown",e),document.addEventListener("mousedown",n),()=>{document.removeEventListener("keydown",e),document.removeEventListener("mousedown",n)}},[t,u]),!t)return null;let f=i?{position:"fixed",top:i.bottom+4,left:Math.min(i.left,window.innerWidth-300),zIndex:50}:{position:"fixed",top:"50%",left:"50%",transform:"translate(-50%, -50%)",zIndex:50};return(0,s.createPortal)((0,r.jsxs)("div",{ref:g,className:"bg-surface-900 border border-white/[0.08] rounded-xl shadow-2xl w-72 p-4",style:f,children:[(0,r.jsx)("h4",{className:"text-xs font-semibold text-gray-500 uppercase tracking-wider mb-1",children:"Flag Risk"}),(0,r.jsx)("p",{className:"text-sm text-gray-400 truncate mb-3",children:n}),(0,r.jsx)("div",{className:"flex gap-1.5 mb-3",children:p.map(e=>(0,r.jsx)("button",{className:"flex-1 px-2 py-1.5 rounded-lg text-xs font-medium border transition-colors ".concat(x===e.value?e.color+" ring-1 ring-primary-500":"border-white/[0.06] text-gray-500 hover:bg-white/[0.04]"),onClick:()=>m(e.value),children:e.label},e.value))}),(0,r.jsx)("input",{type:"text",value:h,onChange:e=>b(e.target.value),placeholder:"Description (optional)",className:"w-full px-3 py-2 bg-surface-800 border border-white/[0.06] rounded-lg text-sm text-gray-200 placeholder:text-gray-600 focus:outline-none focus:border-primary-500/50 mb-3",onKeyDown:e=>{"Enter"===e.key&&(e.preventDefault(),c(x,h||void 0))}}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[o?(0,r.jsx)("button",{className:"text-xs text-red-400 hover:text-red-300 transition-colors",onClick:d,children:"Remove"}):(0,r.jsx)("span",{}),(0,r.jsxs)("div",{className:"flex gap-2",children:[(0,r.jsx)("button",{className:"px-3 py-1.5 text-xs text-gray-400 hover:text-gray-200 transition-colors",onClick:u,children:"Cancel"}),(0,r.jsx)("button",{className:"px-3 py-1.5 text-xs bg-primary-500 text-white rounded-lg hover:bg-primary-600 transition-all",onClick:()=>c(x,h||void 0),children:"Set"})]})]})]}),document.body)}},9283:(e,t,n)=>{n.d(t,{y:()=>d});var r=n(8111),l=n(5271),s=n(4451),o=n(8183),a=n(6062),i=n(3468),c=n(9396);function d(e){let{annotations:t,filteredAnnotations:n,filteredGlobal:l,filteredSectionGroups:s,annotationFilter:o,setAnnotationFilter:a,sections:i,priorities:c,risks:d,instructions:m,onRemoveAnnotation:p,onAddGlobalComment:h,onAddInstruction:b,onDeleteInstruction:g,renderAnnotationImage:f,extraTabs:y=[],activeTab:v,onTabChange:w}=e,j=[{id:"notes",label:"Notes (".concat(t.length,")")},{id:"instructions",label:"Instr (".concat(m.length,")")},...y.map(e=>({id:e.id,label:void 0!==e.count?"".concat(e.label," (").concat(e.count,")"):e.label}))];return(0,r.jsxs)("aside",{className:"hidden lg:flex w-80 border-l border-white/[0.06] bg-surface-900 overflow-y-auto flex-shrink-0 flex-col",children:[(0,r.jsx)("div",{className:"flex border-b border-white/[0.06]",children:j.map(e=>(0,r.jsx)("button",{onClick:()=>w(e.id),className:"flex-1 px-3 py-2.5 text-xs font-semibold uppercase tracking-wider transition-colors ".concat(v===e.id?"text-primary-400 border-b-2 border-primary-500":"text-gray-500 hover:text-gray-300"),children:e.label},e.id))}),"notes"===v&&(0,r.jsx)(u,{annotations:t,filteredAnnotations:n,filteredGlobal:l,filteredSectionGroups:s,annotationFilter:o,setAnnotationFilter:a,sections:i,priorities:c,risks:d,onRemoveAnnotation:p,onAddGlobalComment:h,renderAnnotationImage:f}),"instructions"===v&&(0,r.jsx)(x,{instructions:m,sections:i,onAdd:b,onDelete:g}),y.map(e=>v===e.id&&(0,r.jsx)("div",{className:"flex-1 overflow-y-auto",children:e.render()},e.id))]})}function u(e){let{annotations:t,filteredAnnotations:n,filteredGlobal:l,filteredSectionGroups:i,annotationFilter:c,setAnnotationFilter:d,sections:u,priorities:x,risks:m,onRemoveAnnotation:h,onAddGlobalComment:b,renderAnnotationImage:g}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsxs)("div",{className:"p-4 border-b border-white/[0.06] flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-sm font-semibold text-white",children:"Annotations"}),(0,r.jsxs)("button",{onClick:b,className:"flex items-center gap-1 px-2 py-1 rounded-lg text-xs font-medium text-primary-400 hover:bg-primary-500/10 transition-colors",title:"Add global comment",children:[(0,r.jsx)(s.A,{size:12})," Add"]})]}),t.length>0&&(0,r.jsx)("div",{className:"px-4 py-2 border-b border-white/[0.06]",children:(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)(o.A,{size:14,className:"absolute left-2.5 top-1/2 -translate-y-1/2 text-gray-600"}),(0,r.jsx)("input",{type:"text",placeholder:"Filter annotations...",value:c,onChange:e=>d(e.target.value),className:"w-full pl-8 pr-3 py-1.5 bg-surface-800 border border-white/[0.06] rounded-lg text-sm text-gray-200 placeholder:text-gray-600 focus:outline-none focus:border-primary-500/50"})]})}),(0,r.jsx)("div",{className:"flex-1 overflow-y-auto",children:0===n.length&&0===x.length&&0===m.length?(0,r.jsxs)("div",{className:"p-6 text-center",children:[(0,r.jsx)(a.A,{size:32,className:"mx-auto text-gray-600 mb-2"}),(0,r.jsx)("p",{className:"text-sm text-gray-500",children:"No annotations yet"}),(0,r.jsx)("p",{className:"text-xs text-gray-600 mt-1",children:"Select text or right-click on sections to add annotations"})]}):(0,r.jsxs)("div",{className:"pb-2",children:[l.length>0&&(0,r.jsxs)("div",{className:"px-3 pt-3 pb-1",children:[(0,r.jsx)("h3",{className:"text-[10px] font-bold uppercase tracking-widest text-gray-600 mb-2",children:"Global Comments"}),(0,r.jsx)("div",{className:"space-y-2",children:l.map(e=>(0,r.jsx)(p,{ann:e,onRemove:h,renderImage:g},e.id))})]}),Array.from(i.entries()).map(e=>{var t,n;let[l,s]=e;return(0,r.jsxs)("div",{className:"px-3 pt-3 pb-1",children:[(0,r.jsx)("h3",{className:"text-[10px] font-bold uppercase tracking-widest text-gray-600 mb-2 truncate",children:null!=(n=null==(t=u.find(e=>e.id===l))?void 0:t.title)?n:l}),(0,r.jsx)("div",{className:"space-y-2",children:s.map(e=>(0,r.jsx)(p,{ann:e,onRemove:h,renderImage:g},e.id))})]},l)}),x.length>0&&(0,r.jsxs)("div",{className:"px-3 pt-3 pb-1",children:[(0,r.jsx)("h3",{className:"text-[10px] font-bold uppercase tracking-widest text-gray-600 mb-2",children:"Priorities"}),(0,r.jsx)("div",{className:"space-y-2",children:x.map(e=>{var t,n;let l=null!=(n=null==(t=u.find(t=>t.id===e.sectionId))?void 0:t.title)?n:e.sectionId,s="must-have"===e.priority?"bg-red-500/15 text-red-300 border-red-500/30":"should-have"===e.priority?"bg-amber-500/15 text-amber-300 border-amber-500/30":"nice-to-have"===e.priority?"bg-blue-500/15 text-blue-300 border-blue-500/30":"bg-white/[0.04] text-gray-400 border-white/[0.06]";return(0,r.jsxs)("div",{className:"bg-white/[0.02] rounded-xl p-3 border-l-[3px] border-l-amber-400",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,r.jsx)("span",{className:"text-sm text-gray-400 truncate",children:l}),(0,r.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium border ".concat(s),children:e.priority})]}),e.note&&(0,r.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:e.note})]},e.sectionId)})})]}),m.length>0&&(0,r.jsxs)("div",{className:"px-3 pt-3 pb-1",children:[(0,r.jsx)("h3",{className:"text-[10px] font-bold uppercase tracking-widest text-gray-600 mb-2",children:"Risks"}),(0,r.jsx)("div",{className:"space-y-2",children:m.map(e=>{var t,n;let l=null!=(n=null==(t=u.find(t=>t.id===e.sectionId))?void 0:t.title)?n:e.sectionId,s="high"===e.level?"bg-red-500/15 text-red-300 border-red-500/30":"medium"===e.level?"bg-amber-500/15 text-amber-300 border-amber-500/30":"bg-green-500/15 text-green-300 border-green-500/30";return(0,r.jsxs)("div",{className:"bg-white/[0.02] rounded-xl p-3 border-l-[3px] border-l-red-400",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-1",children:[(0,r.jsx)("span",{className:"text-sm text-gray-400 truncate",children:l}),(0,r.jsx)("span",{className:"inline-flex items-center px-2 py-0.5 rounded-full text-xs font-medium border ".concat(s),children:e.level})]}),e.description&&(0,r.jsx)("p",{className:"text-xs text-gray-500 mt-1",children:e.description})]},e.sectionId)})})]})]})})]})}function x(e){let{instructions:t,sections:n,onAdd:s,onDelete:o}=e,[a,d]=(0,l.useState)(null),u=(0,l.useMemo)(()=>{let e=new Map;for(let r of t){var n;let t=null!=(n=e.get(r.sectionId))?n:[];t.push(r),e.set(r.sectionId,t)}return e},[t]);return(0,r.jsxs)("div",{className:"flex-1 overflow-y-auto p-4 space-y-4",children:[n.map((e,t)=>{var n;let l=null!=(n=u.get(e.id))?n:[];return(0,r.jsxs)("div",{className:"space-y-2",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h4",{className:"text-xs font-medium text-gray-500 uppercase tracking-wider truncate",children:e.title}),(0,r.jsx)("button",{className:"w-6 h-6 flex items-center justify-center border border-white/[0.06] rounded text-sm text-gray-500 hover:bg-primary-500 hover:border-primary-500 hover:text-white transition-colors",onClick:()=>d(a===t?null:t),title:"Add instruction",children:a===t?"-":"+"})]}),a===t&&(0,r.jsx)(m,{sectionId:e.id,onSubmit:(e,t,n)=>{s(e,t,n),d(null)},onCancel:()=>d(null)}),l.length>0&&(0,r.jsx)("div",{className:"space-y-2",children:l.map(e=>(0,r.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-3",children:[(0,r.jsx)("p",{className:"text-sm text-gray-300 leading-relaxed",children:e.instruction}),(0,r.jsxs)("div",{className:"flex items-center justify-between mt-2 pt-2 border-t border-white/[0.04]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[e.priority&&(0,r.jsx)("span",{className:"inline-flex px-2 py-0.5 rounded-full text-xs font-medium border ".concat("must"===e.priority?"text-red-300 bg-red-500/15 border-red-500/30":"should"===e.priority?"text-amber-300 bg-amber-500/15 border-amber-500/30":"text-gray-400 bg-white/[0.04] border-white/[0.06]"),children:e.priority}),(0,r.jsx)("span",{className:"text-[10px] text-gray-600",children:(0,c.fF)(e.createdAt)})]}),(0,r.jsx)("button",{onClick:()=>o(e.id),className:"text-gray-600 hover:text-red-400 transition-colors",title:"Delete",children:(0,r.jsx)(i.A,{size:12})})]})]},e.id))})]},e.id)}),0===t.length&&(0,r.jsxs)("div",{className:"text-center py-8",children:[(0,r.jsx)("p",{className:"text-sm text-gray-500",children:"No instructions yet"}),(0,r.jsx)("p",{className:"text-xs text-gray-600 mt-1",children:"Click + on a section to add implementation directives"})]})]})}function m(e){let{sectionId:t,onSubmit:n,onCancel:s}=e,[o,a]=(0,l.useState)(""),[i,c]=(0,l.useState)("");return(0,r.jsxs)("div",{className:"bg-white/[0.02] border border-white/[0.06] rounded-lg p-3 space-y-3",children:[(0,r.jsx)("textarea",{className:"w-full min-h-16 p-2.5 text-sm bg-surface-800 border border-white/[0.06] rounded-md text-gray-200 placeholder:text-gray-600 focus:outline-none focus:border-primary-500/50 resize-y transition-colors",value:o,onChange:e=>a(e.target.value),onKeyDown:e=>{"Enter"===e.key&&(e.metaKey||e.ctrlKey)&&(e.preventDefault(),o.trim()&&n(t,o.trim(),i||void 0)),"Escape"===e.key&&s()},placeholder:"Enter instruction...",rows:3,autoFocus:!0}),(0,r.jsxs)("select",{className:"w-full p-2 text-sm bg-surface-800 border border-white/[0.06] rounded-md text-gray-400 focus:outline-none focus:border-primary-500/50",value:i,onChange:e=>c(e.target.value),children:[(0,r.jsx)("option",{value:"",children:"No priority"}),(0,r.jsx)("option",{value:"must",children:"Must"}),(0,r.jsx)("option",{value:"should",children:"Should"}),(0,r.jsx)("option",{value:"nice-to-have",children:"Nice to have"})]}),(0,r.jsxs)("div",{className:"flex items-center justify-end gap-2",children:[(0,r.jsx)("button",{className:"px-3 py-1.5 text-sm border border-white/[0.06] text-gray-400 rounded-md hover:bg-white/[0.04] transition-colors",onClick:s,children:"Cancel"}),(0,r.jsx)("button",{className:"px-3 py-1.5 text-sm bg-primary-500 text-white rounded-md hover:bg-primary-600 disabled:opacity-40 transition-all",onClick:()=>{o.trim()&&n(t,o.trim(),i||void 0)},disabled:!o.trim(),children:"Add"})]})]})}function p(e){let{ann:t,onRemove:n,renderImage:l}=e;return(0,r.jsxs)("div",{className:"border-l-2 ".concat(c.D5[t.type]," rounded-r-lg p-3 group"),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded border ".concat(c.s0[t.type]),children:t.type}),(0,r.jsx)("span",{className:"text-[10px] text-gray-600",children:(0,c.fF)(t.createdAt)})]}),(0,r.jsx)("button",{onClick:()=>n(t.id),className:"text-gray-600 hover:text-red-400 text-xs transition-colors opacity-0 group-hover:opacity-100",children:(0,r.jsx)(i.A,{size:12})})]}),(0,r.jsx)("p",{className:"text-sm text-gray-300 mt-1 whitespace-pre-wrap",children:t.text}),t.imagePaths&&t.imagePaths.length>0&&l&&(0,r.jsx)("div",{className:"flex gap-1.5 mt-2 flex-wrap",children:t.imagePaths.map((e,t)=>l(e,t))})]})}},9396:(e,t,n)=>{n.d(t,{D5:()=>r,Dx:()=>o,fF:()=>s,s0:()=>l});let r={comment:"border-blue-400 bg-blue-500/10",suggestion:"border-violet-400 bg-violet-500/10",concern:"border-amber-400 bg-amber-500/10",question:"border-cyan-400 bg-cyan-500/10",approval:"border-emerald-400 bg-emerald-500/10",instruction:"border-orange-400 bg-orange-500/10",global_comment:"border-blue-400 bg-blue-500/10"},l={comment:"bg-blue-500/10 text-blue-300 border-blue-500/20",suggestion:"bg-violet-500/10 text-violet-300 border-violet-500/20",concern:"bg-amber-500/10 text-amber-300 border-amber-500/20",question:"bg-cyan-500/10 text-cyan-300 border-cyan-500/20",approval:"bg-emerald-500/10 text-emerald-300 border-emerald-500/20",instruction:"bg-orange-500/10 text-orange-300 border-orange-500/20",global_comment:"bg-blue-500/10 text-blue-300 border-blue-500/20"};function s(e){let t=Math.floor((Date.now()-e)/1e3);if(t<60)return"just now";let n=Math.floor(t/60);if(n<60)return"".concat(n,"m ago");let r=Math.floor(n/60);if(r<24)return"".concat(r,"h ago");let l=Math.floor(r/24);return"".concat(l,"d ago")}function o(e){if(!e)return[];let t=e.split("\n"),n=[],r=null,l=new Set;function s(e){let t=e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")||"section",n=t,r=2;for(;l.has(n);)n="".concat(t,"-").concat(r++);return l.add(n),n}for(let e=0;e<t.length;e++){var o,a,i;let l=null!=(o=t[e])?o:"",c=l.match(/^(#{1,6})\s+(.+)/);c?(r&&n.push({id:s(r.title),title:r.title,level:r.level,content:r.lines.join("\n"),startLine:r.startLine}),r={title:null!=(a=c[2])?a:"",level:(null!=(i=c[1])?i:"#").length,lines:[l],startLine:e}):r?r.lines.push(l):l.trim()&&(r={title:"Overview",level:1,lines:[l],startLine:e})}return r&&n.push({id:s(r.title),title:r.title,level:r.level,content:r.lines.join("\n"),startLine:r.startLine}),n}},9951:(e,t,n)=>{n.d(t,{t:()=>c});var r=n(8111),l=n(5271),s=n(8054);let o={comment:"\uD83D\uDCAC",suggest:"✏️",concern:"⚠️",question:"❓",annotate:"➕",edit:"✏️",instruction:"\uD83D\uDCCB",priority:"\uD83C\uDFF7️",risk:"⚠️"},a=[{icon:"comment",label:"Add Comment",action:{type:"comment"}},{icon:"suggest",label:"Suggest Change",action:{type:"suggest"}},{icon:"concern",label:"Raise Concern",action:{type:"concern"}},{icon:"question",label:"Ask Question",action:{type:"question"}}],i=[{icon:"annotate",label:"Annotate Block",submenu:[{icon:"comment",label:"Comment",action:{type:"comment"}},{icon:"suggest",label:"Suggest",action:{type:"suggest"}},{icon:"concern",label:"Concern",action:{type:"concern"}},{icon:"question",label:"Question",action:{type:"question"}}]},{separator:!0,icon:"",label:""},{icon:"edit",label:"Edit Block",action:{type:"edit"}},{separator:!0,icon:"",label:""},{icon:"instruction",label:"Add Instruction",action:{type:"instruction"}},{icon:"priority",label:"Set Priority",action:{type:"priority"}},{icon:"risk",label:"Flag Risk",action:{type:"risk"}}];function c(e){let{visible:t,x:n,y:c,mode:d,onAction:u,onClose:x}=e,m=(0,l.useRef)(null),[p,h]=(0,l.useState)({x:n,y:c}),[b,g]=(0,l.useState)(null);return((0,l.useEffect)(()=>{if(t)h({x:Math.max(10,Math.min(n,window.innerWidth-220-10)),y:Math.max(10,Math.min(c,window.innerHeight-400-10))})},[t,n,c]),(0,l.useEffect)(()=>{if(!t)return;let e=e=>{m.current&&!m.current.contains(e.target)&&x()},n=e=>{"Escape"===e.key&&x()},r=()=>x();return document.addEventListener("mousedown",e),document.addEventListener("keydown",n),document.addEventListener("scroll",r,!0),()=>{document.removeEventListener("mousedown",e),document.removeEventListener("keydown",n),document.removeEventListener("scroll",r,!0)}},[t,x]),t)?(0,s.createPortal)((0,r.jsx)("div",{ref:m,className:"fixed rounded-xl border border-white/[0.08] bg-surface-900 shadow-2xl z-50 min-w-48 py-1",style:{left:"".concat(p.x,"px"),top:"".concat(p.y,"px")},children:("selection"===d?a:i).map((e,t)=>{var n;if(e.separator)return(0,r.jsx)("div",{className:"h-px bg-white/[0.06] my-1"},"sep-".concat(t));let l=!!e.submenu,s=b===e.label;return(0,r.jsxs)("div",{children:[(0,r.jsxs)("button",{className:"flex items-center gap-3 w-full px-3 py-2 text-sm text-gray-400 hover:bg-white/[0.04] hover:text-gray-200 cursor-pointer rounded-lg mx-1 transition-colors duration-150",onClick:()=>{e.submenu?g(b===e.label?null:e.label):e.action&&(u(e.action),x())},children:[(0,r.jsx)("span",{className:"w-5 text-center",children:null!=(n=o[e.icon])?n:"\uD83D\uDCDD"}),(0,r.jsx)("span",{className:"flex-1 text-left",children:e.label}),l&&(0,r.jsx)("span",{className:"text-gray-600 text-xs",children:"▶"})]}),l&&s&&(0,r.jsx)("div",{className:"ml-4 border-l border-white/[0.06]",children:e.submenu.map(e=>{var t;return(0,r.jsxs)("button",{className:"flex items-center gap-3 w-full px-3 py-2 text-sm text-gray-400 hover:bg-white/[0.04] hover:text-gray-200 cursor-pointer rounded-lg mx-1 transition-colors duration-150",onClick:()=>{e.action&&(u(e.action),x())},children:[(0,r.jsx)("span",{className:"w-5 text-center",children:null!=(t=o[e.icon])?t:"\uD83D\uDCDD"}),(0,r.jsx)("span",{className:"flex-1 text-left",children:e.label})]},e.label)})})]},e.label)})}),document.body):null}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7889],{422:(e,t,r)=>{r.d(t,{J:()=>n,h:()=>l});var a=r(7811);function l(){return"local"===a.env.NEXT_PUBLIC_ULPI_MODE,"https://ulpi-cloud-api.ngrok.app"}function n(){return"local"===a.env.NEXT_PUBLIC_ULPI_MODE||!0==="https://ulpi-cloud-api.ngrok.app".includes("localhost")}},2853:(e,t,r)=>{r.d(t,{PV:()=>n,QE:()=>i,nr:()=>c,y_:()=>o});var a=r(5271),l=r(3446);let n={taskSource:"prompt",prompt:"",prdFileName:"",prdContent:"",agentName:"claude",model:"",trackerName:"json",trackerConfig:{},trackerFileName:"",trackerFileContent:"",sourceBranch:"",autoCommit:!1,errorStrategy:"retry",maxRetries:3,maxIterations:0,timeout:0,iterationDelayMs:0,fallbackAgents:"",promptTemplate:""},s=new Set(["idle","stopped","error"]);function o(e){let t=(0,l.yC)(),[r,n]=(0,a.useState)(null),[o,i]=(0,a.useState)(!0),c=(0,a.useCallback)(async()=>{try{let r=e?"/api/loop/status?jobId=".concat(encodeURIComponent(e)):"/api/loop/status",a=await t.get(r);n(a)}catch(e){n({status:"idle",enabled:!1,hasEngine:!1})}finally{i(!1)}},[t,e]);(0,a.useEffect)(()=>{c()},[c]);let d=(null==r?void 0:r.hasEngine)===!0&&!s.has(r.status);return(0,a.useEffect)(()=>{if(!d)return;let e=setInterval(()=>void c(),3e3);return()=>clearInterval(e)},[d,c]),{status:r,loading:o,hasActiveEngine:d,refresh:c}}function i(){let e=(0,l.yC)(),[t,r]=(0,a.useState)([]),[n,s]=(0,a.useState)(null),o=(0,a.useCallback)(async()=>{try{var t;let a=await e.get("/api/jobs");r(null!=(t=a.jobs)?t:[])}catch(e){}},[e]);(0,a.useEffect)(()=>{o()},[o]);let i=t.some(e=>"running"===e.status||"queued"===e.status);(0,a.useEffect)(()=>{if(!i)return;let e=setInterval(()=>void o(),5e3);return()=>clearInterval(e)},[i,o]);let c=(0,a.useCallback)(async t=>{await e.delete("/api/jobs/".concat(t)),o()},[e,o]),d=(0,a.useCallback)(async t=>{await e.post("/api/jobs/".concat(t,"/cancel")),o()},[e,o]),u=(0,a.useCallback)(async t=>{s(t);try{let r=await e.post("/api/jobs/".concat(t,"/rerun"));return o(),r}finally{s(null)}},[e,o]);return{jobs:t,refresh:o,deleteJob:c,stopJob:d,rerunJob:u,rerunningId:n}}function c(e,t){let r=(0,l.yC)(),[n,s]=(0,a.useState)(null),[o,i]=(0,a.useState)(null),c=(0,a.useRef)(null);return(0,a.useEffect)(()=>{if(o)return c.current&&clearTimeout(c.current),c.current=setTimeout(()=>i(null),5e3),()=>{c.current&&clearTimeout(c.current)}},[o]),{start:(0,a.useCallback)(async a=>{s("start"),i(null);try{var l;let n={agentName:a.agentName};if(a.model&&(n.agentConfig={model:a.model}),"prompt"===a.taskSource&&a.prompt.trim())n.prompt=a.prompt.trim();else if("prd"===a.taskSource&&a.prdContent)n.prdContent=a.prdContent;else if(n.trackerName=a.trackerName,a.trackerFileContent)n.trackerFileContent=a.trackerFileContent,n.trackerFileName=a.trackerFileName;else{let e=Object.entries(a.trackerConfig).filter(e=>{let[,t]=e;return""!==t.trim()});e.length>0&&(n.trackerConfig=Object.fromEntries(e))}a.autoCommit&&(n.autoCommit=!0),"retry"!==a.errorStrategy&&(n.errorStrategy=a.errorStrategy),a.maxRetries>0&&3!==a.maxRetries&&(n.maxRetries=a.maxRetries),a.maxIterations>0&&(n.maxIterations=a.maxIterations),a.timeout>0&&(n.timeout=a.timeout),a.iterationDelayMs>0&&(n.iterationDelayMs=a.iterationDelayMs);let s=a.fallbackAgents.split(",").map(e=>e.trim()).filter(Boolean);s.length>0&&(n.fallbackAgents=s),a.promptTemplate.trim()&&(n.promptTemplate=a.promptTemplate.trim());let o=await r.post("/api/loop/start",n);return i(null!=(l=o.message)?l:"Run started."),e(),t(),{jobId:o.jobId}}catch(e){return i(e instanceof Error?e.message:"Failed to start run."),{}}finally{s(null)}},[r,e,t]),runAction:(0,a.useCallback)(async(a,l,n)=>{s(a),i(null);try{var o;let s=await r.post("/api/loop/".concat(a),n?{jobId:n}:{});i(null!=(o=s.message)?o:"".concat(l," executed.")),e(),"stop"===a&&t()}catch(e){i(e instanceof Error?e.message:"".concat(l," failed"))}finally{s(null)}},[r,e,t]),actionRunning:n,actionMessage:o}}},3025:(e,t,r)=>{r.d(t,{s:()=>n});var a=r(8111),l=r(3446);function n(e){let{children:t,featureName:r="This feature"}=e;return"cloud"===(0,l.Xk)()?(0,a.jsx)("div",{className:"space-y-6",children:(0,a.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-surface-900 p-8 text-center",children:[(0,a.jsx)("svg",{className:"mx-auto h-10 w-10 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25m18 0A2.25 2.25 0 0 0 18.75 3H5.25A2.25 2.25 0 0 0 3 5.25m18 0V12a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 12V5.25"})}),(0,a.jsxs)("p",{className:"mt-3 text-sm text-gray-400",children:[r," is available in local mode."]}),(0,a.jsx)("p",{className:"mt-1 text-xs text-gray-600",children:"Connect to a local ULPI API server to use this feature."})]})}):(0,a.jsx)(a.Fragment,{children:t})}},3310:(e,t,r)=>{r.d(t,{F_:()=>l,fZ:()=>n,jw:()=>a});let a=[{value:"claude",label:"Claude Code",models:[{value:"claude-sonnet-4-6",label:"Sonnet 4.6"},{value:"claude-opus-4-6",label:"Opus 4.6"},{value:"claude-haiku-4-5-20251001",label:"Haiku 4.5"},{value:"claude-opus-4-5-20251101",label:"Opus 4.5"},{value:"claude-sonnet-4-5-20250929",label:"Sonnet 4.5"}]},{value:"gemini",label:"Gemini CLI",models:[{value:"gemini-2.5-pro",label:"2.5 Pro"},{value:"gemini-2.5-flash",label:"2.5 Flash"},{value:"gemini-3-pro-preview",label:"3 Pro (Preview)"},{value:"gemini-3-flash-preview",label:"3 Flash (Preview)"}]},{value:"opencode",label:"OpenCode",models:[{value:"anthropic/claude-sonnet-4-6",label:"Claude Sonnet 4.6"},{value:"anthropic/claude-opus-4-6",label:"Claude Opus 4.6"},{value:"openai/gpt-5.3-codex",label:"GPT-5.3 Codex"},{value:"google/gemini-2.5-pro",label:"Gemini 2.5 Pro"}]},{value:"codex",label:"Codex",models:[{value:"gpt-5.3-codex",label:"GPT-5.3 Codex"},{value:"gpt-5.3-codex-spark",label:"GPT-5.3 Codex Spark"},{value:"gpt-5.2-codex",label:"GPT-5.2 Codex"},{value:"gpt-5.1-codex-max",label:"GPT-5.1 Codex Max"},{value:"gpt-5-codex-mini",label:"GPT-5 Codex Mini"}]},{value:"kiro",label:"Kiro",models:[{value:"auto",label:"Auto"},{value:"claude-opus-4.6",label:"Claude Opus 4.6"},{value:"claude-sonnet-4.5",label:"Claude Sonnet 4.5"},{value:"claude-sonnet-4",label:"Claude Sonnet 4"},{value:"claude-haiku-4.5",label:"Claude Haiku 4.5"}]},{value:"factory-droid",label:"Factory Droid",models:[]}];function l(e){var t,r;return null!=(r=null==(t=a.find(t=>t.value===e))?void 0:t.models)?r:[]}function n(e){let t=l(e);return t.length>0?t[0].value:""}},3446:(e,t,r)=>{r.d(t,{Kv:()=>c,HI:()=>m,Xk:()=>d,yC:()=>u});var a=r(8111),l=r(5271),n=r(422),s=r(7811);class o{async request(e,t){let r="".concat(this.baseUrl).concat(e);if(this.repo){let e=r.includes("?")?"&":"?";r="".concat(r).concat(e,"repo=").concat(encodeURIComponent(this.repo))}let a=s.env.NEXT_PUBLIC_ULPI_API_SECRET,l=await fetch(r,{...t,headers:{"Content-Type":"application/json",...a?{"X-Ulpi-Secret":a}:{},...null==t?void 0:t.headers}});if(!l.ok)throw Error((await l.json().catch(()=>({error:l.statusText}))).error||"API error: ".concat(l.status));return l.json()}async get(e){return this.request(e)}async post(e,t){return this.request(e,{method:"POST",body:t?JSON.stringify(t):void 0})}async put(e,t){return this.request(e,{method:"PUT",body:t?JSON.stringify(t):void 0})}async delete(e){return this.request(e,{method:"DELETE"})}constructor(){this.repo=null,this.baseUrl=(0,n.h)()}}let i=(0,l.createContext)({mode:"cloud",localClient:null});function c(e){let{children:t}=e,r=(0,l.useMemo)(()=>{let e=(0,n.J)()?"local":"cloud";return{mode:e,localClient:"local"===e?new o:null}},[]);return(0,a.jsx)(i,{value:r,children:t})}function d(){return(0,l.useContext)(i).mode}function u(){let{localClient:e}=(0,l.useContext)(i);if(!e)throw Error("LocalApiClient not available in cloud mode");return e}function m(){return(0,l.useContext)(i)}},3951:(e,t,r)=>{r.d(t,{G:()=>l});var a=r(8111);function l(e){let{rows:t=3,variant:r="skeleton",className:l=""}=e;return"spinner"===r?(0,a.jsx)("div",{className:"flex items-center justify-center py-16 ".concat(l),children:(0,a.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,a.jsx)("div",{className:"h-7 w-7 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}),(0,a.jsx)("p",{className:"text-xs text-gray-500",children:"Loading..."})]})}):(0,a.jsx)("div",{className:"space-y-3 ".concat(l),children:Array.from({length:t}).map((e,t)=>(0,a.jsx)("div",{className:"animate-pulse rounded-xl border border-white/[0.04] bg-surface-800/50 p-4",children:(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsx)("div",{className:"h-8 w-8 rounded-lg bg-white/[0.06]"}),(0,a.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,a.jsx)("div",{className:"h-3.5 w-1/3 rounded bg-white/[0.06]"}),(0,a.jsx)("div",{className:"h-3 w-2/3 rounded bg-white/[0.04]"})]}),(0,a.jsx)("div",{className:"h-5 w-16 rounded-full bg-white/[0.04]"})]})},t))})}},4632:(e,t,r)=>{r.d(t,{p:()=>n});var a=r(8111);function l(){return(0,a.jsx)("svg",{className:"h-10 w-10 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 7.5l-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5m6 4.125 2.25 2.25m0 0 2.25 2.25M12 13.875l2.25-2.25M12 13.875l-2.25 2.25M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"})})}function n(e){let{icon:t,title:r,description:n,action:s,className:o=""}=e;return(0,a.jsxs)("div",{className:"flex flex-col items-center justify-center rounded-2xl border border-dashed border-white/[0.06] bg-surface-800/30 px-6 py-16 text-center ".concat(o),children:[(0,a.jsx)("div",{className:"mb-4",children:null!=t?t:(0,a.jsx)(l,{})}),(0,a.jsx)("h3",{className:"text-sm font-medium text-gray-300",children:r}),n&&(0,a.jsx)("p",{className:"mt-1.5 max-w-sm text-xs text-gray-500",children:n}),s&&(0,a.jsx)("button",{onClick:s.onClick,className:"mt-5 rounded-lg bg-primary-500 px-4 py-2 text-xs font-semibold text-white transition-colors hover:bg-primary-600",children:s.label})]})}},4736:(e,t,r)=>{var a=r(1504);r.o(a,"useParams")&&r.d(t,{useParams:function(){return a.useParams}}),r.o(a,"usePathname")&&r.d(t,{usePathname:function(){return a.usePathname}}),r.o(a,"useRouter")&&r.d(t,{useRouter:function(){return a.useRouter}}),r.o(a,"useSearchParams")&&r.d(t,{useSearchParams:function(){return a.useSearchParams}})},5079:(e,t,r)=>{r.d(t,{Q:()=>d,x:()=>i});var a=r(8111),l=r(5271),n=r(3446),s=r(2853),o=r(3310);let i=[{value:"json",label:"JSON File",fields:[{key:"path",label:"File Path",placeholder:"./tasks.json",required:!1}]},{value:"markdown",label:"Markdown TODO",fields:[{key:"path",label:"File Path",placeholder:"./TODO.md",required:!1}]},{value:"github",label:"GitHub Issues",fields:[{key:"token",label:"GitHub Token",placeholder:"ghp_...",required:!0,secret:!0},{key:"repo",label:"Repository",placeholder:"owner/repo",required:!0}]},{value:"jira",label:"Jira",fields:[{key:"baseUrl",label:"Base URL",placeholder:"https://company.atlassian.net",required:!0},{key:"email",label:"Email",placeholder:"you@company.com",required:!0},{key:"apiToken",label:"API Token",placeholder:"...",required:!0,secret:!0},{key:"project",label:"Project Key",placeholder:"PROJ",required:!0}]},{value:"linear",label:"Linear",fields:[{key:"apiKey",label:"API Key",placeholder:"lin_api_...",required:!0,secret:!0},{key:"teamKey",label:"Team Key",placeholder:"ENG",required:!0}]}];function c(e){let{checked:t,onChange:r}=e;return(0,a.jsx)("button",{type:"button",role:"switch","aria-checked":t,onClick:()=>r(!t),className:"relative inline-flex h-5 w-9 shrink-0 cursor-pointer rounded-full border-2 border-transparent transition-colors ".concat(t?"bg-primary-500":"bg-surface-700"),children:(0,a.jsx)("span",{className:"pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow-sm transition-transform ".concat(t?"translate-x-4":"translate-x-0")})})}function d(e){let{onStart:t,initialPrdFilename:r,initialAgent:d,initialModel:u}=e,m=(0,n.yC)(),[p,x]=(0,l.useState)(()=>({...s.PV,...d?{agentName:d}:{},...u?{model:u}:{}})),[g,b]=(0,l.useState)(!1),[f,h]=(0,l.useState)(null),[y,k]=(0,l.useState)([]),[v,j]=(0,l.useState)(""),w=(0,l.useRef)(null),N=(0,l.useRef)(null),C=(0,l.useRef)(!1);(0,l.useEffect)(()=>{r&&!C.current&&(C.current=!0,(async()=>{try{let e=await m.get("/api/prd/load?filename=".concat(encodeURIComponent(r)));e.markdown&&x(t=>({...t,taskSource:"prd",prdFileName:r,prdContent:e.markdown}))}catch(e){}})())},[m,r]);let S=i.find(e=>e.value===p.trackerName),T="json"===p.trackerName||"markdown"===p.trackerName;(0,l.useEffect)(()=>{(async()=>{try{var e,t;let r=await m.get("/api/loop/branches");k(null!=(e=r.branches)?e:[]),j(null!=(t=r.current)?t:"")}catch(e){}})()},[m]);let I=(e,t)=>{x(r=>({...r,[e]:t})),h(null)},_=e=>t=>{var r;let a=null==(r=t.target.files)?void 0:r[0];if(!a)return;let l=new FileReader;l.onload=()=>{let t=l.result;"prd"===e?x(e=>({...e,prdFileName:a.name,prdContent:t})):x(e=>({...e,trackerFileName:a.name,trackerFileContent:t})),h(null)},l.readAsText(a)},A=()=>{if("prompt"===p.taskSource&&!p.prompt.trim()||"prd"===p.taskSource&&!p.prdContent)return!1;if("tracker"===p.taskSource){if(T&&!p.trackerFileContent)return!1;if(!S)return!0;for(let t of S.fields){var e;if(t.required&&!(null==(e=p.trackerConfig[t.key])?void 0:e.trim()))return!1}}return!0};return(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"mb-4 text-base font-semibold text-white",children:"New Run"}),(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsx)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:"Task Source"}),(0,a.jsx)("div",{className:"flex gap-1 rounded-lg border border-white/[0.08] bg-surface-800 p-1",children:[{value:"prompt",label:"Prompt"},{value:"prd",label:"PRD File"},{value:"tracker",label:"Task Tracker"}].map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>I("taskSource",e.value),className:"flex-1 rounded-md px-3 py-1.5 text-xs font-medium transition-colors ".concat(p.taskSource===e.value?"bg-primary-500 text-white":"text-gray-400 hover:text-gray-300"),children:e.label},e.value))})]}),"prompt"===p.taskSource&&(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:["Prompt ",(0,a.jsx)("span",{className:"ml-0.5 text-red-400",children:"*"})]}),(0,a.jsx)("textarea",{value:p.prompt,onChange:e=>I("prompt",e.target.value),placeholder:"Describe the task you want the agent to complete...",className:"min-h-[100px] w-full resize-y rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2.5 text-sm text-white placeholder:text-gray-600 focus:border-primary-500/50 focus:outline-none"})]}),"prd"===p.taskSource&&(0,a.jsxs)("div",{className:"mb-4",children:[(0,a.jsxs)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:["PRD File ",(0,a.jsx)("span",{className:"ml-0.5 text-red-400",children:"*"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>{var e;return null==(e=w.current)?void 0:e.click()},className:"inline-flex items-center gap-2 rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2 text-sm text-gray-300 transition-colors hover:bg-surface-700 hover:text-white",children:[(0,a.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"})}),"Browse"]}),p.prdFileName&&(0,a.jsx)("span",{className:"truncate text-sm text-gray-400",children:p.prdFileName}),(0,a.jsx)("input",{ref:w,type:"file",accept:".md,.txt,.markdown",onChange:_("prd"),className:"hidden"})]}),(0,a.jsx)("p",{className:"mt-1 text-[11px] text-gray-600",children:"Markdown file with structured tasks. Supports headings, checklists, and numbered lists."})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-4 ".concat("tracker"===p.taskSource?"sm:grid-cols-3":"sm:grid-cols-2"),children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:"Agent"}),(0,a.jsx)("select",{value:p.agentName,onChange:e=>{let t=e.target.value;x(e=>({...e,agentName:t,model:(0,o.fZ)(t)})),h(null)},className:"w-full rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2 text-sm text-white focus:border-primary-500/50 focus:outline-none",children:o.jw.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:"Model"}),(()=>{let e=(0,o.F_)(p.agentName);return(0,a.jsx)("select",{value:p.model,onChange:e=>I("model",e.target.value),disabled:0===e.length,className:"w-full rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2 text-sm text-white focus:border-primary-500/50 focus:outline-none disabled:opacity-50 disabled:cursor-not-allowed",children:0===e.length?(0,a.jsx)("option",{value:"",children:"(default)"}):e.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))})})()]}),"tracker"===p.taskSource&&(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:"Task Tracker"}),(0,a.jsx)("select",{value:p.trackerName,onChange:e=>{var t;return t=e.target.value,void(x(e=>({...e,trackerName:t,trackerConfig:{},trackerFileName:"",trackerFileContent:""})),h(null))},className:"w-full rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2 text-sm text-white focus:border-primary-500/50 focus:outline-none",children:i.map(e=>(0,a.jsx)("option",{value:e.value,children:e.label},e.value))})]})]}),"tracker"===p.taskSource&&(0,a.jsxs)("div",{className:"mt-4 space-y-3",children:[T&&(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:["Task File ",(0,a.jsx)("span",{className:"ml-0.5 text-red-400",children:"*"})]}),(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>{var e;return null==(e=N.current)?void 0:e.click()},className:"inline-flex items-center gap-2 rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2 text-sm text-gray-300 transition-colors hover:bg-surface-700 hover:text-white",children:[(0,a.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 14.25v-2.625a3.375 3.375 0 0 0-3.375-3.375h-1.5A1.125 1.125 0 0 1 13.5 7.125v-1.5a3.375 3.375 0 0 0-3.375-3.375H8.25m2.25 0H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 0 0-9-9Z"})}),"Browse"]}),p.trackerFileName&&(0,a.jsx)("span",{className:"truncate text-sm text-gray-400",children:p.trackerFileName}),(0,a.jsx)("input",{ref:N,type:"file",accept:"json"===p.trackerName?".json":".md,.txt,.markdown",onChange:_("tracker"),className:"hidden"})]})]}),!T&&S&&S.fields.length>0&&(0,a.jsx)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:S.fields.map(e=>{var t;return(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:[e.label,e.required&&(0,a.jsx)("span",{className:"ml-0.5 text-red-400",children:"*"})]}),(0,a.jsx)("input",{type:e.secret?"password":"text",value:null!=(t=p.trackerConfig[e.key])?t:"",onChange:t=>{var r,a;return r=e.key,a=t.target.value,void(x(e=>({...e,trackerConfig:{...e.trackerConfig,[r]:a}})),h(null))},placeholder:e.placeholder,className:"w-full rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2 text-sm text-white placeholder:text-gray-600 focus:border-primary-500/50 focus:outline-none"})]},e.key)})})]}),(0,a.jsxs)("div",{className:"mt-4 grid grid-cols-1 gap-4 sm:grid-cols-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:"Source Branch"}),(0,a.jsxs)("select",{value:p.sourceBranch,onChange:e=>I("sourceBranch",e.target.value),className:"w-full rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2 text-sm text-white focus:border-primary-500/50 focus:outline-none",children:[(0,a.jsxs)("option",{value:"",children:["Current (",v||"...",")"]}),y.map(e=>(0,a.jsx)("option",{value:e,children:e},e))]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:"Error Strategy"}),(0,a.jsx)("div",{className:"flex gap-1 rounded-lg border border-white/[0.08] bg-surface-800 p-1",children:["retry","skip","abort"].map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>I("errorStrategy",e),className:"rounded-md px-3 py-1 text-xs font-medium transition-colors ".concat(p.errorStrategy===e?"bg-primary-500 text-white":"text-gray-400 hover:text-gray-300"),children:e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:"Auto-Commit"}),(0,a.jsxs)("div",{className:"flex h-[38px] items-center",children:[(0,a.jsx)(c,{checked:p.autoCommit,onChange:e=>I("autoCommit",e)}),(0,a.jsx)("span",{className:"ml-2 text-xs text-gray-500",children:p.autoCommit?"Enabled":"Disabled"})]})]})]}),(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>b(!g),className:"flex items-center gap-1.5 text-xs font-medium text-gray-400 transition-colors hover:text-gray-300",children:[(0,a.jsx)("svg",{className:"h-3.5 w-3.5 transition-transform ".concat(g?"rotate-90":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 4.5l7.5 7.5-7.5 7.5"})}),"Advanced Options"]}),g&&(0,a.jsxs)("div",{className:"mt-3 space-y-4 rounded-lg border border-white/[0.04] bg-surface-800/30 p-4",children:[(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-4 sm:grid-cols-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:"Max Retries"}),(0,a.jsx)("input",{type:"number",min:"0",value:p.maxRetries,onChange:e=>I("maxRetries",parseInt(e.target.value)||0),placeholder:"3",className:"w-full rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2 text-sm text-white placeholder:text-gray-600 focus:border-primary-500/50 focus:outline-none"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:"Max Iterations"}),(0,a.jsx)("input",{type:"number",min:"0",value:p.maxIterations,onChange:e=>I("maxIterations",parseInt(e.target.value)||0),placeholder:"0 = unlimited",className:"w-full rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2 text-sm text-white placeholder:text-gray-600 focus:border-primary-500/50 focus:outline-none"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:"Timeout (ms)"}),(0,a.jsx)("input",{type:"number",min:"0",value:p.timeout,onChange:e=>I("timeout",parseInt(e.target.value)||0),placeholder:"0 = none",className:"w-full rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2 text-sm text-white placeholder:text-gray-600 focus:border-primary-500/50 focus:outline-none"})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:"Iteration Delay (ms)"}),(0,a.jsx)("input",{type:"number",min:"0",value:p.iterationDelayMs,onChange:e=>I("iterationDelayMs",parseInt(e.target.value)||0),placeholder:"0",className:"w-full rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2 text-sm text-white placeholder:text-gray-600 focus:border-primary-500/50 focus:outline-none"})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:"Fallback Agents"}),(0,a.jsx)("p",{className:"mb-2 text-[11px] text-gray-600",children:"Used when the primary agent is rate-limited or unavailable."}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:o.jw.filter(e=>e.value!==p.agentName).map(e=>{let t=p.fallbackAgents.split(",").map(e=>e.trim()).filter(Boolean),r=t.includes(e.value);return(0,a.jsxs)("button",{type:"button",onClick:()=>{I("fallbackAgents",(r?t.filter(t=>t!==e.value):[...t,e.value]).join(", "))},className:"inline-flex items-center gap-1.5 rounded-full border px-3 py-1 text-xs font-medium transition-colors ".concat(r?"border-primary-500/30 bg-primary-500/10 text-primary-400":"border-white/[0.08] bg-surface-800 text-gray-500 hover:border-white/[0.12] hover:text-gray-300"),children:[r&&(0,a.jsx)("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M4.5 12.75l6 6 9-13.5"})}),e.label]},e.value)})})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:"Prompt Template"}),(0,a.jsx)("textarea",{value:p.promptTemplate,onChange:e=>I("promptTemplate",e.target.value),placeholder:"Custom prompt template (optional)",className:"min-h-[80px] w-full resize-y rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2 text-sm text-white placeholder:text-gray-600 focus:border-primary-500/50 focus:outline-none"})]})]})]}),f&&(0,a.jsx)("p",{className:"mt-3 text-xs text-red-400",children:f}),(0,a.jsx)("div",{className:"mt-5",children:(0,a.jsxs)("button",{onClick:()=>{if(!A()){if("prompt"===p.taskSource)h("Prompt is required");else if("prd"===p.taskSource)h("Select a PRD file");else if(T&&!p.trackerFileContent)h("Select a task file");else{let e=null==S?void 0:S.fields.filter(e=>{var t;return e.required&&!(null==(t=p.trackerConfig[e.key])?void 0:t.trim())}).map(e=>e.label);h("Required fields: ".concat(null==e?void 0:e.join(", ")))}return}t(p)},disabled:!A(),className:"inline-flex items-center gap-2 rounded-lg bg-primary-500 px-4 py-2 text-xs font-semibold text-white transition-colors hover:bg-primary-600 disabled:cursor-not-allowed disabled:opacity-50",children:[(0,a.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.347a1.125 1.125 0 0 1 0 1.972l-11.54 6.347a1.125 1.125 0 0 1-1.667-.986V5.653Z"})}),"Start Run"]})})]})}},5323:(e,t,r)=>{r.d(t,{p:()=>S});var a=r(8111),l=r(5271),n=r(4632),s=r(422),o=r(7811),i=r(3446),c=r(6142);let d={probe(e){let t=e.type;return"assistant"===t||"user"===t||"system"===t||"result"===t||"rate_limit_event"===t},parse(e){var t,r;let a=e.type;if("user"===a)return{kind:"text",summary:"",skip:!0};if("rate_limit_event"===a)return{kind:"system",summary:"",skip:!0};if("system"===a){let r=null!=(t=e.subtype)?t:"";return"hook_started"===r||"hook_response"===r?{kind:"system",summary:"",skip:!0}:"init"===r?{kind:"system",summary:"Session initialized",skip:!1}:{kind:"system",summary:"System: ".concat(r),skip:!1}}if("result"===a){let t=e.total_cost_usd?"$".concat(Number(e.total_cost_usd).toFixed(4)):"",r=[e.num_turns?"".concat(e.num_turns," turns"):"","number"==typeof e.duration_ms?(0,c.a)(e.duration_ms):"",t].filter(Boolean).join(", ");return{kind:"result",summary:r?"Done — ".concat(r):"Done",skip:!1}}if("assistant"===a&&e.message){let t=e.message.content;if(Array.isArray(t)){let e="",a=[];for(let l of t){if("text"===l.type&&!e){let t=String(null!=(r=l.text)?r:"").trim();e=t.length>120?t.slice(0,117)+"...":t}"tool_use"===l.type&&a.push(function(e){var t,r,a,l,n,s,o;let i=null!=(t=e.name)?t:"unknown",c=e.input;if(!c)return"Tool: ".concat(i);let d=null!=(o=null!=(s=null!=(n=null!=(l=null!=(a=null!=(r=c.file_path)?r:c.command)?a:c.pattern)?l:c.query)?n:c.prompt)?s:c.url)?o:"",u=d.length>80?d.slice(0,77)+"...":d;return u?"Tool: ".concat(i," ").concat(u):"Tool: ".concat(i)}(l))}let l=[e,...a].filter(Boolean);if(l.length>0)return{kind:a.length>0?"tool_use":"text",summary:l.join(" | "),skip:!1}}return{kind:"text",summary:"Assistant response",skip:!1}}return{kind:"raw",summary:"",skip:!1}}},u={probe(e){let t=e.type;return"item.completed"===t||"item.started"===t||"item.updated"===t||"turn.started"===t||"turn.completed"===t||"turn.failed"===t||"thread.started"===t||"error"===t},parse(e){var t,r,a,l,n,s,o,i,c,d,u,m,p;let x=e.type;if("thread.started"===x)return{kind:"turn",summary:"Session started",skip:!1};if("turn.started"===x)return{kind:"turn",summary:"Agent turn started",skip:!1};if("turn.completed"===x){let a=e.usage;if(a){let e=null!=(t=a.input_tokens)?t:0,l=null!=(r=a.output_tokens)?r:0;return{kind:"result",summary:"Turn done — ".concat(e," in / ").concat(l," out tokens"),skip:!1}}return{kind:"result",summary:"Turn completed",skip:!1}}if("turn.failed"===x){let t=null!=(l=null!=(a=e.error)?a:e.message)?l:"unknown error";return{kind:"error",summary:"Turn failed: ".concat(t),skip:!1}}if("error"===x)return{kind:"error",summary:null!=(s=null!=(n=e.error)?n:e.message)?s:"unknown error",skip:!1};let g=e.item;if(!g)return{kind:"raw",summary:x,skip:!1};let b=g.type,f=g.status;if("reasoning"===b){let e=null!=(o=g.text)?o:"Thinking...";return{kind:"thinking",summary:e.length>120?e.slice(0,117)+"...":e,skip:!1}}if("command_execution"===b){let e="string"==typeof g.command?g.command:"",t=e.match(RegExp("^\\/bin\\/\\w+ -\\w+ ['\"](.*?)['\"]$","s")),r=t?t[1]:e,a=r.length>100?r.slice(0,97)+"...":r,l=g.exit_code;return{kind:"command",summary:"$ ".concat(a).concat("item.completed"===x&&null!=l?" (exit ".concat(l,")"):""),skip:!1}}if("file_change"===b){let e=null!=(i=g.file_path)?i:"",t=e.length>100?"..."+e.slice(-97):e;return{kind:"tool_use",summary:"".concat("item.started"===x?"Writing":"Wrote",": ").concat(t),skip:!1}}if("mcp_tool_call"===b){let e=null!=(c=g.tool_name)?c:"mcp_tool";return{kind:"tool_use",summary:"MCP: ".concat(e),skip:!1}}if("web_search"===b){let e=null!=(u=null!=(d=g.query)?d:g.text)?u:"",t=e.length>80?e.slice(0,77)+"...":e;return{kind:"tool_use",summary:"Search: ".concat(t),skip:!1}}if("plan_update"===b)return{kind:"system",summary:"Plan updated",skip:!1};if("agent_message"===b){let e=null!=(p=null!=(m=g.text)?m:g.content)?p:"";return e?{kind:"text",summary:e.length>120?e.slice(0,117)+"...":e,skip:!1}:{kind:"text",summary:"",skip:"item.updated"===x}}return"item.updated"!==x||b?{kind:"raw",summary:"".concat(null!=b?b:"output").concat(f?" (".concat(f,")"):""),skip:!1}:{kind:"raw",summary:"",skip:!0}}},m={probe:e=>!!(Array.isArray(e.candidates)||"string"==typeof e.model&&e.model.includes("gemini")),parse(e){let t=e.candidates;if(t&&t.length>0){let e=t[0].content;if(e){let t=e.parts;if(t&&t.length>0){var r;let e=null!=(r=t[0].text)?r:"",a=e.length>120?e.slice(0,117)+"...":e;if(a)return{kind:"text",summary:a,skip:!1}}}}return{kind:"raw",summary:"Gemini output",skip:!1}}},p={probe:e=>"string"==typeof e.event&&"object"==typeof e.data,parse(e){var t,r;let a=e.event,l=e.data,n=null!=(r=null!=(t=null==l?void 0:l.text)?t:null==l?void 0:l.content)?r:null==l?void 0:l.message;return"string"==typeof n&&n.trim()?{kind:"text",summary:n.length>120?n.slice(0,117)+"...":n,skip:!1}:{kind:"raw",summary:a,skip:!1}}},x={claude:d,codex:u,gemini:m,opencode:p},g=[d,u,m,p];function b(e,t){let r,a=e.trim();if(!a)return null;try{r=JSON.parse(a)}catch(e){return null}if(t){let e=x[t];if(e&&e.probe(r))return e.parse(r)}for(let e of g)if(e.probe(r))return e.parse(r);let l=Object.keys(r).slice(0,3);return{kind:"raw",summary:l.length>0?"{".concat(l.join(", "),"}"):"{}",skip:!1}}function f(e){return e.replace(/\x1B(?:[@-Z\\-_]|\[[0-?]*[ -/]*[@-~])/g,"")}function h(e){var t,r,a;if(e.task&&"object"==typeof e.task){let a=e.task;return null!=(r=null!=(t=a.title)?t:a.id)?r:""}return null!=(a=e.taskId)?a:""}function y(e){return"agent:output"===e.type||"worker-progress"===e.type&&"agent:output"===e.engineEventType}function k(e){let t=e.data;return"string"==typeof t?t:""}function v(e,t){if(y(e)){let r=k(e).trim();if(!r)return!0;let a=b(r,t);return null!==a&&a.skip}return"worker-progress"===e.type&&"task:selected"===e.engineEventType||!1}function j(e){let t=k(e);if(!t.trim())return"";try{return JSON.parse(t.trim()),null}catch(e){return f(t)}}let w={hook:{dot:"bg-blue-400",text:"text-blue-400",bg:"bg-blue-500/[0.06]"},engine:{dot:"bg-purple-400",text:"text-purple-400",bg:"bg-purple-500/[0.06]"},iteration:{dot:"bg-indigo-400",text:"text-indigo-400",bg:"bg-indigo-500/[0.06]"},task:{dot:"bg-emerald-400",text:"text-emerald-400",bg:"bg-emerald-500/[0.06]"},agent:{dot:"bg-cyan-400",text:"text-cyan-400",bg:"bg-cyan-500/[0.06]"},session:{dot:"bg-amber-400",text:"text-amber-400",bg:"bg-amber-500/[0.06]"},review:{dot:"bg-pink-400",text:"text-pink-400",bg:"bg-pink-500/[0.06]"},worker:{dot:"bg-orange-400",text:"text-orange-400",bg:"bg-orange-500/[0.06]"},merge:{dot:"bg-teal-400",text:"text-teal-400",bg:"bg-teal-500/[0.06]"},group:{dot:"bg-violet-400",text:"text-violet-400",bg:"bg-violet-500/[0.06]"},all:{dot:"bg-emerald-400",text:"text-emerald-400",bg:"bg-emerald-500/[0.06]"},system:{dot:"bg-gray-400",text:"text-gray-400",bg:"bg-gray-500/[0.06]"}},N={text:"text-gray-400",tool_use:"text-cyan-400",thinking:"text-purple-400",command:"text-yellow-400",system:"text-gray-500",result:"text-emerald-400",error:"text-red-400",turn:"text-blue-400",raw:"text-gray-500"},C={connected:{badge:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",label:"Connected"},connecting:{badge:"bg-yellow-500/10 text-yellow-400 border-yellow-500/20",label:"Connecting"},disconnected:{badge:"bg-gray-500/10 text-gray-400 border-gray-500/20",label:"Disconnected"},error:{badge:"bg-red-500/10 text-red-400 border-red-500/20",label:"Error"}};function S(e){var t;let{jobId:r,agentName:d}=e,u=(0,i.yC)(),{events:m,status:p,clear:x,reconnect:g,error:S}=function(e){let{maxEvents:t=1e4,category:r,enabled:a=!0}={},[n,i]=(0,l.useState)([]),[c,d]=(0,l.useState)("disconnected"),[u,m]=(0,l.useState)(null),p=(0,l.useRef)(null),x=(0,l.useRef)(null),g=(0,l.useRef)(1e3),b=(0,l.useRef)(!0),f=(0,l.useRef)(t),h=(0,l.useRef)(r);f.current=t,h.current=r;let y=(0,l.useCallback)(()=>{null!==x.current&&(clearTimeout(x.current),x.current=null)},[]),k=(0,l.useCallback)(()=>{y(),p.current&&(p.current.close(),p.current=null)},[y]),v=(0,l.useCallback)(()=>{if(!b.current)return;k();let e=(0,s.h)(),t=o.env.NEXT_PUBLIC_ULPI_API_SECRET,r=t?"".concat(e,"/api/events/stream?secret=").concat(encodeURIComponent(t)):"".concat(e,"/api/events/stream");d("connecting"),m(null);let a=new EventSource(r);p.current=a,a.onopen=()=>{b.current&&(d("connected"),m(null),g.current=1e3)},a.onmessage=e=>{if(b.current)try{let t,r=JSON.parse(e.data);t="event"in r&&r.event&&"object"==typeof r.event?r.event:r;let a=h.current;if(a&&!t.type.startsWith(a+":"))return;let l=f.current;i(e=>{let r=[t,...e];return r.length>l?r.slice(0,l):r})}catch(e){}},a.onerror=()=>{if(!b.current)return;a.close(),p.current=null,d("error"),m("Connection lost. Reconnecting...");let e=g.current;g.current=Math.min(2*e,3e4),x.current=setTimeout(()=>{b.current&&v()},e)}},[k]),j=(0,l.useCallback)(()=>{i([])},[]),w=(0,l.useCallback)(()=>{g.current=1e3,v()},[v]);return(0,l.useEffect)(()=>(b.current=!0,a?v():(k(),d("disconnected")),()=>{b.current=!1,k()}),[a,v,k]),{events:n,status:c,clear:j,reconnect:w,error:u}}(),T=(0,l.useRef)(null),[I,_]=(0,l.useState)(!0),[A,P]=(0,l.useState)(null),[M,R]=(0,l.useState)([]),[L,E]=(0,l.useState)("all"),F=(0,l.useRef)(null),D=(0,l.useCallback)(async e=>{try{var t,r;let a=await u.get("/api/jobs/".concat(e,"/logs")),l=null!=(t=a.events)?t:[];if(l.length>0){let e=l.filter(e=>e.type&&e.ts).map(e=>e);R(e)}else{let t=(null!=(r=a.logs)?r:[]).map(t=>({type:"job:log",ts:t.timestamp,jobId:e,level:t.level,message:t.message}));R(t)}}catch(e){R([])}},[u]);(0,l.useEffect)(()=>{r&&r!==F.current?(F.current=r,D(r)):r||(F.current=null,R([]))},[r,D]);let B=function(e,t){if(0===e.length)return t;if(0===t.length)return[...e].reverse();let r=new Set;for(let e of t)r.add("".concat(e.ts,"|").concat(e.type));let a=[...t,...e.filter(e=>!r.has("".concat(e.ts,"|").concat(e.type)))];return a.sort((e,t)=>new Date(t.ts).getTime()-new Date(e.ts).getTime()),a}(M.filter(e=>!v(e,d)),m.filter(e=>!v(e,d)).filter(e=>!r||e.jobId===r)),O=(0,l.useMemo)(()=>{let e=new Set;for(let t of B){let r=t.workerId;"string"==typeof r&&e.add(r)}return Array.from(e).sort()},[B]),q=function(e,t){let r=[],a=0;for(;a<e.length;){var l,n;let s=e[a];if(!y(s)){r.push({event:s,mergedCount:1,displayKey:"".concat(s.ts,"-").concat(s.type,"-").concat(a)}),a++;continue}let o=j(s);if(null===o){let e=k(s),l=e?b(e,t):null;r.push({event:s,mergedCount:1,displayKey:"".concat(s.ts,"-").concat(s.type,"-").concat(a),outputKind:null==l?void 0:l.kind}),a++;continue}let i=null!=(l=s.stream)?l:"stdout",c=s.workerId,d=[o],u=a;for(a++;a<e.length&&y(e[a]);){let t=e[a];if((null!=(n=t.stream)?n:"stdout")!==i||c!==t.workerId)break;let r=j(t);if(null===r)break;d.push(r),a++}let m=d.reverse().filter(Boolean).join(" ").replace(/\s+/g," ").trim();m&&r.push({event:s,mergedPayload:m,mergedCount:a-u,displayKey:"coalesced-".concat(u,"-").concat(a)})}return r}("all"===L?B:B.filter(e=>{let t=e.workerId;return t===L||!t}),d);(0,l.useEffect)(()=>{I&&T.current&&(T.current.scrollTop=0)},[B.length,I]);let U=null!=(t=C[p])?t:C.disconnected;return(0,a.jsxs)("div",{className:"flex flex-col h-full min-h-0",children:[(0,a.jsxs)("div",{className:"mb-3 shrink-0 space-y-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("h2",{className:"text-sm font-semibold text-white",children:"Events"}),(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border px-2 py-0.5 text-[11px] font-medium ".concat(U.badge),children:[(0,a.jsx)("span",{className:"h-1.5 w-1.5 rounded-full ".concat("connected"===p?"bg-emerald-400":"connecting"===p?"bg-yellow-400 animate-pulse":"error"===p?"bg-red-400":"bg-gray-400")}),U.label]})]}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{onClick:()=>_(!I),className:"rounded-lg px-2.5 py-1 text-[11px] font-medium transition-colors ".concat(I?"bg-primary-500/10 text-primary-400 border border-primary-500/20":"bg-surface-800/50 text-gray-500 border border-white/[0.04]"),children:"Auto-scroll"}),("error"===p||"disconnected"===p)&&(0,a.jsx)("button",{onClick:g,className:"rounded-lg border border-white/[0.06] bg-surface-800/50 px-2.5 py-1 text-[11px] font-medium text-gray-400 transition-colors hover:bg-surface-800 hover:text-white",children:"Reconnect"}),(0,a.jsx)("button",{onClick:x,disabled:0===B.length,className:"rounded-lg border border-white/[0.06] bg-surface-800/50 px-2.5 py-1 text-[11px] font-medium text-gray-400 transition-colors hover:bg-surface-800 hover:text-white disabled:cursor-not-allowed disabled:opacity-40",children:"Clear"})]})]}),O.length>1&&(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[(0,a.jsx)("button",{onClick:()=>E("all"),className:"rounded-lg px-2 py-0.5 text-[11px] font-medium transition-colors ".concat("all"===L?"bg-primary-500/10 text-primary-400 border border-primary-500/20":"bg-surface-800/50 text-gray-600 border border-white/[0.04] hover:text-gray-400"),children:"All"}),O.map(e=>(0,a.jsx)("button",{onClick:()=>E(e),className:"rounded-lg px-2 py-0.5 text-[11px] font-medium transition-colors ".concat(L===e?"bg-orange-500/10 text-orange-400 border border-orange-500/20":"bg-surface-800/50 text-gray-600 border border-white/[0.04] hover:text-gray-400"),children:e},e))]})]}),S&&(0,a.jsx)("div",{className:"mb-3 shrink-0 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-3 py-2 text-xs text-red-400",children:S}),0===q.length?(0,a.jsx)(n.p,{title:"No events yet",description:"connected"===p?"Events will appear here in real-time.":"Connect to the event stream to see live events.",icon:(0,a.jsx)("svg",{className:"h-8 w-8 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.348 14.652a3.75 3.75 0 0 1 0-5.304m5.304 0a3.75 3.75 0 0 1 0 5.304m-7.425 2.121a6.75 6.75 0 0 1 0-9.546m9.546 0a6.75 6.75 0 0 1 0 9.546M5.106 18.894c-3.808-3.807-3.808-9.98 0-13.788m13.788 0c3.808 3.807 3.808 9.98 0 13.788M12 12h.008v.008H12V12Zm.375 0a.375.375 0 1 1-.75 0 .375.375 0 0 1 .75 0Z"})})}):(0,a.jsx)("div",{ref:T,className:"flex-1 min-h-0 space-y-1 overflow-y-auto rounded-xl border border-white/[0.06] bg-surface-800/30 p-3",onScroll:e=>{e.currentTarget.scrollTop>20&&_(!1)},children:q.map(e=>{var t,r;let{event:l,mergedPayload:n,mergedCount:s,displayKey:o,outputKind:i}=e,u=null!=(r=w[l.type.split(":")[0]])?r:{dot:"bg-gray-400",text:"text-gray-400",bg:"bg-gray-500/[0.06]"},m=y(l),p=A===o,x=null!=n?n:function(e,t){var r,a,l,n,s,o,i;let d=e.type;if("agent:output"===d){let r="stderr"===e.stream?"stderr":"stdout",a="string"==typeof e.data?e.data.trim():"";if(!a)return r;let l=b(a,t);if(l){if(l.skip)return"";if(l.summary)return l.summary}let n=f(a).split("\n")[0],s=n.length>120?n.slice(0,117)+"...":n;return"".concat(r," ").concat(s)}if("agent:switched"===d)return"".concat(e.previousAgent," → ").concat(e.newAgent," (").concat(e.reason,")");if("engine:started"===d)return"".concat(e.totalTasks," task(s)");if("engine:stopped"===d)return"".concat(e.reason," — ").concat(e.tasksCompleted,"/").concat(e.totalIterations," iterations");if("engine:paused"===d)return"at iteration ".concat(e.currentIteration);if("engine:resumed"===d)return"from iteration ".concat(e.fromIteration);if("engine:error"===d)return"string"==typeof e.error?e.error:"";if("iteration:started"===d)return"#".concat(e.iteration," — ").concat(h(e));if("iteration:completed"===d){let t="number"==typeof e.durationMs?(0,c.a)(e.durationMs):"";return"#".concat(e.iteration," — ").concat(h(e)).concat(t?" (".concat(t,")"):"")}if("iteration:failed"===d)return"#".concat(e.iteration," — ").concat(e.error," → ").concat(e.action);if("iteration:retrying"===d)return"#".concat(e.iteration," — attempt ").concat(e.retryAttempt,"/").concat(e.maxRetries);if("iteration:skipped"===d)return"#".concat(e.iteration," — ").concat(e.reason);if("iteration:rate-limited"===d)return"backoff ".concat("number"==typeof e.delayMs?(0,c.a)(e.delayMs):"");if("task:selected"===d||"task:completed"===d)return h(e);if("task:failed"===d)return"".concat(h(e)," — ").concat(e.error);if("task:skipped"===d)return"".concat(h(e)," — ").concat(e.reason);if("task:auto-committed"===d)return"".concat(e.commitSha?String(e.commitSha).slice(0,8):""," ").concat(null!=(r=e.commitMessage)?r:"");if("task:auto-commit-failed"===d)return"string"==typeof e.error?e.error:"";if("all:complete"===d)return"".concat(e.totalCompleted," tasks in ").concat(e.totalIterations," iterations");if("worker-progress"===d){let r=null!=(a=e.workerId)?a:"",s=e.engineEventType;if("agent:output"===s){let a="string"==typeof e.data?e.data.trim():"";if(!a)return"[".concat(r,"] stdout");let l=b(a,t);if(l){if(l.skip)return"";if(l.summary)return"[".concat(r,"] ").concat(l.summary)}let n=f(a).split("\n")[0],s=n.length>100?n.slice(0,97)+"...":n;return"[".concat(r,"] ").concat(s)}let o=null!=(n=null!=(l=e.message)?l:s)?n:"",i=e.iteration?"#".concat(e.iteration):"";return"[".concat(r,"] ").concat(i?i+" ":"").concat(o).trim()}if("worker-started"===d)return"[".concat(e.workerId,"] ").concat(h(e)," started");if("worker-completed"===d)return"[".concat(e.workerId,"] ").concat(e.success?"completed":"failed");if("worker-failed"===d)return"[".concat(e.workerId,"] ").concat(null!=(s=e.error)?s:"failed");if("merge-completed"===d)return"Merged ".concat(e.taskId," (").concat(null!=(o=e.strategy)?o:"merge",")");if("merge-failed"===d)return"Merge failed: ".concat(e.taskId," — ").concat(null!=(i=e.error)?i:"");if("group-completed"===d)return"Group ".concat(e.groupIndex+1,": ").concat(e.tasksCompleted," done, ").concat(e.tasksFailed," failed");if("all-completed"===d)return"".concat(e.totalCompleted," completed, ").concat(e.totalFailed," failed (").concat("number"==typeof e.durationMs?(0,c.a)(e.durationMs):"",")");let u=new Set(["type","ts","sessionId","timestamp"]),m=[];for(let[t,r]of Object.entries(e)){if(u.has(t)||null==r)continue;let e="string"==typeof r?r:JSON.stringify(r),a=e.length>80?e.slice(0,77)+"...":e;if(m.push("".concat(t,": ").concat(a)),m.length>=2)break}return m.join(" \xb7 ")}(l,d),g=i?null!=(t=N[i])?t:N.raw:"text-gray-500",k="error"===i?"border-red-500/30":"command"===i?"border-yellow-500/20":"tool_use"===i?"border-cyan-500/20":"thinking"===i?"border-purple-500/20":"result"===i?"border-emerald-500/20":"worker-progress"===l.type?"border-orange-500/20":"border-cyan-500/20";return(0,a.jsxs)("div",{className:"cursor-pointer ".concat(m?"border-l-2 ".concat(k," bg-transparent px-3 py-1.5"):"rounded-lg border border-white/[0.03] bg-surface-800/30 px-3 py-1.5"),onClick:()=>P(p?null:o),children:[(0,a.jsxs)("div",{className:"flex items-start gap-2.5",children:[!m&&(0,a.jsx)("span",{className:"mt-1.5 h-1.5 w-1.5 shrink-0 rounded-full ".concat(u.dot)}),(0,a.jsx)("div",{className:"min-w-0 flex-1",children:m?(0,a.jsxs)("p",{className:"font-mono text-[11px] ".concat(g," whitespace-pre-wrap break-words"),children:[x,s>1&&(0,a.jsxs)("span",{className:"ml-1.5 text-[9px] text-gray-700",children:["(",s,")"]})]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"font-mono text-[11px] text-gray-600",children:function(e){try{return new Date(e).toLocaleTimeString(void 0,{hour:"2-digit",minute:"2-digit",second:"2-digit"})}catch(t){return e}}(l.ts)}),(0,a.jsx)("span",{className:"text-xs font-medium ".concat(u.text),children:l.type.split(":").slice(1).join(":").replace(/-/g," ").replace(/\b\w/g,e=>e.toUpperCase())})]}),x&&(0,a.jsx)("p",{className:"mt-0.5 truncate text-[11px] text-gray-500",children:x})]})})]}),p&&(0,a.jsx)("pre",{className:"mt-2 max-h-[200px] overflow-auto rounded-lg bg-surface-800 p-2 font-mono text-[10px] text-gray-400",children:JSON.stringify(l,null,2)})]},o)})})]})}},5605:(e,t,r)=>{r.d(t,{W:()=>s});var a=r(8111);let l={pending:"bg-yellow-500/10 text-yellow-400 border-yellow-500/20",queued:"bg-yellow-500/10 text-yellow-400 border-yellow-500/20",active:"bg-blue-500/10 text-blue-400 border-blue-500/20",running:"bg-blue-500/10 text-blue-400 border-blue-500/20",in_progress:"bg-blue-500/10 text-blue-400 border-blue-500/20",completed:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",success:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",approved:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",error:"bg-red-500/10 text-red-400 border-red-500/20",failed:"bg-red-500/10 text-red-400 border-red-500/20",rejected:"bg-red-500/10 text-red-400 border-red-500/20",cancelled:"bg-gray-500/10 text-gray-400 border-gray-500/20",idle:"bg-gray-500/10 text-gray-400 border-gray-500/20"},n={pending:"bg-yellow-400",queued:"bg-yellow-400",active:"bg-blue-400",running:"bg-blue-400",in_progress:"bg-blue-400",completed:"bg-emerald-400",success:"bg-emerald-400",approved:"bg-emerald-400",error:"bg-red-400",failed:"bg-red-400",rejected:"bg-red-400",cancelled:"bg-gray-400",idle:"bg-gray-400"};function s(e){var t,r;let{status:s,label:o,showDot:i=!0,size:c="sm",className:d=""}=e,u=s.toLowerCase().replace(/\s+/g,"_"),m=null!=(t=l[u])?t:"bg-gray-500/10 text-gray-400 border-gray-500/20",p=null!=(r=n[u])?r:"bg-gray-400",x=null!=o?o:s.charAt(0).toUpperCase()+s.slice(1).replace(/_/g," ");return(0,a.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border font-medium ".concat(m," ").concat("sm"===c?"px-2 py-0.5 text-[11px]":"px-2.5 py-1 text-xs"," ").concat(d),children:[i&&(0,a.jsx)("span",{className:"h-1.5 w-1.5 rounded-full ".concat(p)}),x]})}},6142:(e,t,r)=>{r.d(t,{a:()=>n,t:()=>o});var a=r(8111),l=r(5605);function n(e){if(e<1e3)return"".concat(e,"ms");let t=Math.floor(e/1e3);if(t<60)return"".concat(t,"s");let r=Math.floor(t/60);if(r<60)return"".concat(r,"m ").concat(t%60,"s");let a=Math.floor(r/60);return"".concat(a,"h ").concat(r%60,"m")}function s(e){let{label:t,value:r,color:l}=e;return(0,a.jsxs)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/50 p-2.5",children:[(0,a.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600",children:t}),(0,a.jsx)("p",{className:"mt-0.5 text-sm font-semibold ".concat(null!=l?l:"text-white"),children:r})]})}function o(e){var t,r,o,i,c,d;let{status:u,actionRunning:m,onPause:p,onResume:x,onStop:g}=e,b="running"===u.status,f="paused"===u.status,h="pausing"===u.status,y="stopping"===u.status,k=null!=(r=u.completedTasks)?r:0,v=null!=(o=u.failedTasks)?o:0,j=null!=(i=u.skippedTasks)?i:0,w=null!=(c=u.totalTasks)?c:0,N=w>0?Math.round((k+v+j)/w*100):0;return(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3",children:[(0,a.jsx)("h2",{className:"text-base font-semibold text-white",children:"Live Status"}),(0,a.jsx)(l.W,{status:u.status}),u.activeAgent&&(0,a.jsx)("span",{className:"inline-flex items-center rounded-full border border-primary-500/20 bg-primary-500/10 px-2 py-0.5 text-[11px] font-medium text-primary-400",children:u.activeAgent})]}),u.startedAt&&(0,a.jsx)("span",{className:"font-mono text-xs text-gray-500",children:function(e){let t=Date.now()-new Date(e).getTime();return t<0?"0s":n(t)}(u.startedAt)})]}),w>0&&(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsxs)("div",{className:"mb-1 flex items-center justify-between",children:[(0,a.jsxs)("span",{className:"text-xs text-gray-400",children:[k+v+j," / ",w," tasks"]}),(0,a.jsxs)("span",{className:"text-xs text-gray-500",children:[N,"%"]})]}),(0,a.jsx)("div",{className:"h-2 rounded-full bg-surface-800",children:(0,a.jsx)("div",{className:"h-full rounded-full transition-all ".concat(v>0?"bg-red-500":"bg-primary-500"),style:{width:"".concat(N,"%")}})})]}),(0,a.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-2 sm:grid-cols-3 lg:grid-cols-6",children:[(0,a.jsx)(s,{label:"Iteration",value:null!=(d=u.currentIteration)?d:0}),(0,a.jsx)(s,{label:"Completed",value:k,color:"text-emerald-400"}),(0,a.jsx)(s,{label:"Failed",value:v,color:v>0?"text-red-400":void 0}),(0,a.jsx)(s,{label:"Skipped",value:j,color:j>0?"text-yellow-400":void 0}),(0,a.jsx)(s,{label:"Total",value:w}),(0,a.jsx)(s,{label:"Elapsed",value:null!=u.elapsedMs?n(u.elapsedMs):"--"})]}),u.currentTaskId&&(0,a.jsxs)("div",{className:"mt-3 rounded-lg border border-white/[0.04] bg-surface-800/50 px-3 py-2",children:[(0,a.jsx)("span",{className:"text-[11px] font-medium text-gray-500",children:"Current task: "}),(0,a.jsx)("span",{className:"font-mono text-xs text-gray-300",children:u.currentTaskId})]}),(null==(t=u.rateLimitState)?void 0:t.isRateLimited)&&(0,a.jsxs)("div",{className:"mt-3 rounded-lg border border-yellow-500/20 bg-yellow-500/[0.06] px-3 py-2 text-xs text-yellow-400",children:["Rate limited",u.rateLimitState.currentAgent?" (".concat(u.rateLimitState.currentAgent,")"):"",".",u.rateLimitState.backoffMs?" Backing off for ".concat(n(u.rateLimitState.backoffMs),"."):""]}),u.message&&(0,a.jsx)("div",{className:"mt-3 rounded-lg border border-white/[0.04] bg-surface-800/50 px-3 py-2 text-xs text-gray-400",children:u.message}),(0,a.jsxs)("div",{className:"mt-4 flex flex-wrap gap-2",children:[(b||h)&&(0,a.jsxs)("button",{onClick:p,disabled:null!==m||h,className:"inline-flex items-center gap-2 rounded-lg border border-yellow-500/30 bg-yellow-500/10 px-4 py-2 text-xs font-semibold text-yellow-400 transition-colors hover:bg-yellow-500/20 disabled:cursor-not-allowed disabled:opacity-50",children:["pause"===m?(0,a.jsx)("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-yellow-400 border-t-transparent"}):(0,a.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25v13.5m-7.5-13.5v13.5"})}),h?"Pausing...":"Pause"]}),f&&(0,a.jsxs)("button",{onClick:x,disabled:null!==m,className:"inline-flex items-center gap-2 rounded-lg bg-primary-500 px-4 py-2 text-xs font-semibold text-white transition-colors hover:bg-primary-600 disabled:cursor-not-allowed disabled:opacity-50",children:["resume"===m?(0,a.jsx)("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-white border-t-transparent"}):(0,a.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.347a1.125 1.125 0 0 1 0 1.972l-11.54 6.347a1.125 1.125 0 0 1-1.667-.986V5.653Z"})}),"Resume"]}),(b||f||h||y)&&(0,a.jsxs)("button",{onClick:g,disabled:null!==m||y,className:"inline-flex items-center gap-2 rounded-lg border border-red-500/30 bg-red-500/10 px-4 py-2 text-xs font-semibold text-red-400 transition-colors hover:bg-red-500/20 disabled:cursor-not-allowed disabled:opacity-50",children:["stop"===m?(0,a.jsx)("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-red-400 border-t-transparent"}):(0,a.jsx)("svg",{className:"h-3.5 w-3.5",fill:"currentColor",viewBox:"0 0 24 24",children:(0,a.jsx)("rect",{x:"6",y:"6",width:"12",height:"12",rx:"1"})}),y?"Stopping...":"Stop"]})]})]})}},8322:(e,t,r)=>{r.d(t,{F:()=>d,L:()=>i});var a=r(8111),l=r(5605),n=r(6142),s=r(5323);let o={claude:{bg:"bg-orange-500/10 border-orange-500/20",text:"text-orange-400",label:"Claude"},gemini:{bg:"bg-blue-500/10 border-blue-500/20",text:"text-blue-400",label:"Gemini"},codex:{bg:"bg-emerald-500/10 border-emerald-500/20",text:"text-emerald-400",label:"Codex"},opencode:{bg:"bg-violet-500/10 border-violet-500/20",text:"text-violet-400",label:"OpenCode"},kiro:{bg:"bg-pink-500/10 border-pink-500/20",text:"text-pink-400",label:"Kiro"},"factory-droid":{bg:"bg-yellow-500/10 border-yellow-500/20",text:"text-yellow-400",label:"Factory Droid"}};function i(e){var t;let{name:r}=e;if(!r)return null;let l=null!=(t=o[r])?t:{bg:"bg-gray-500/10 border-gray-500/20",text:"text-gray-400",label:r};return(0,a.jsx)("span",{className:"inline-flex items-center gap-1 rounded-full border px-2 py-0.5 text-[10px] font-semibold ".concat(l.bg," ").concat(l.text),children:l.label})}function c(e){let{label:t,value:r,mono:l}=e;return(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("span",{className:"text-[11px] font-medium text-gray-500 w-20 shrink-0",children:t}),(0,a.jsx)("span",{className:"text-xs text-gray-300 ".concat(l?"font-mono":""),children:r})]})}function d(e){let{job:t,status:r,actionRunning:o,onPause:d,onResume:u,onStop:m,onStopJob:p,onRerun:x,onDelete:g,rerunningId:b}=e,f="running"===t.status||"queued"===t.status||"paused"===t.status||"pausing"===t.status,h="completed"===t.status||"failed"===t.status||"cancelled"===t.status,y="";if(t.startedAt&&t.completedAt){let e=new Date(t.completedAt).getTime()-new Date(t.startedAt).getTime();y=(0,n.a)(e)}else if(t.startedAt){let e=Date.now()-new Date(t.startedAt).getTime();y=(0,n.a)(e)}return(0,a.jsxs)("div",{className:"flex flex-col h-full overflow-hidden",children:[(0,a.jsxs)("div",{className:"shrink-0 pb-4 border-b border-white/[0.04]",children:[(0,a.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[(0,a.jsx)(l.W,{status:t.status}),(0,a.jsx)(i,{name:t.agentName}),(0,a.jsx)("span",{className:"font-mono text-xs text-gray-500",children:t.sourceBranch}),y&&(0,a.jsx)("span",{className:"font-mono text-xs text-gray-600",children:y})]}),(0,a.jsxs)("div",{className:"mt-3 space-y-1",children:[(0,a.jsx)(c,{label:"Job ID",value:t.id,mono:!0}),(0,a.jsx)(c,{label:"Created",value:new Date(t.createdAt).toLocaleString()}),t.startedAt&&(0,a.jsx)(c,{label:"Started",value:new Date(t.startedAt).toLocaleString()}),t.completedAt&&(0,a.jsx)(c,{label:"Completed",value:new Date(t.completedAt).toLocaleString()}),t.taskCount>0&&(0,a.jsx)(c,{label:"Tasks",value:"".concat(t.completedTasks,"/").concat(t.taskCount," completed").concat(t.failedTasks>0?", ".concat(t.failedTasks," failed"):"")})]}),t.error&&(0,a.jsx)("div",{className:"mt-3 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-3 py-2 text-xs text-red-400",children:t.error}),(0,a.jsxs)("div",{className:"mt-3 flex items-center gap-2",children:[f&&(0,a.jsx)("button",{onClick:()=>p(t.id),className:"rounded-lg border border-yellow-500/20 bg-yellow-500/[0.06] px-3 py-1.5 text-[11px] font-medium text-yellow-400 transition-colors hover:bg-yellow-500/10",children:"Stop"}),h&&(0,a.jsx)("button",{onClick:()=>x(t.id),disabled:null!==b,className:"rounded-lg border border-primary-500/20 bg-primary-500/[0.06] px-3 py-1.5 text-[11px] font-medium text-primary-400 transition-colors hover:bg-primary-500/10 disabled:cursor-not-allowed disabled:opacity-50",children:b===t.id?"Rerunning...":"Rerun"}),(0,a.jsx)("button",{onClick:()=>g(t.id),className:"rounded-lg border border-red-500/20 bg-red-500/[0.06] px-3 py-1.5 text-[11px] font-medium text-red-400 transition-colors hover:bg-red-500/10",children:"Delete"})]})]}),f&&(null==r?void 0:r.hasEngine)&&(0,a.jsx)("div",{className:"shrink-0 py-4 border-b border-white/[0.04]",children:(0,a.jsx)(n.t,{status:r,actionRunning:o,onPause:d,onResume:u,onStop:m})}),(0,a.jsx)("div",{className:"flex-1 min-h-0 pt-4 overflow-hidden flex flex-col",children:(0,a.jsx)(s.p,{jobId:t.id,agentName:t.agentName})})]})}}}]);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
"use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8744],{422:(e,t,s)=>{s.d(t,{J:()=>n,h:()=>r});var a=s(7811);function r(){return"local"===a.env.NEXT_PUBLIC_ULPI_MODE,"https://ulpi-cloud-api.ngrok.app"}function n(){return"local"===a.env.NEXT_PUBLIC_ULPI_MODE||!0==="https://ulpi-cloud-api.ngrok.app".includes("localhost")}},3025:(e,t,s)=>{s.d(t,{s:()=>n});var a=s(8111),r=s(3446);function n(e){let{children:t,featureName:s="This feature"}=e;return"cloud"===(0,r.Xk)()?(0,a.jsx)("div",{className:"space-y-6",children:(0,a.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-surface-900 p-8 text-center",children:[(0,a.jsx)("svg",{className:"mx-auto h-10 w-10 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 17.25v1.007a3 3 0 0 1-.879 2.122L7.5 21h9l-.621-.621A3 3 0 0 1 15 18.257V17.25m6-12V15a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 15V5.25m18 0A2.25 2.25 0 0 0 18.75 3H5.25A2.25 2.25 0 0 0 3 5.25m18 0V12a2.25 2.25 0 0 1-2.25 2.25H5.25A2.25 2.25 0 0 1 3 12V5.25"})}),(0,a.jsxs)("p",{className:"mt-3 text-sm text-gray-400",children:[s," is available in local mode."]}),(0,a.jsx)("p",{className:"mt-1 text-xs text-gray-600",children:"Connect to a local ULPI API server to use this feature."})]})}):(0,a.jsx)(a.Fragment,{children:t})}},3446:(e,t,s)=>{s.d(t,{Kv:()=>c,HI:()=>m,Xk:()=>d,yC:()=>u});var a=s(8111),r=s(5271),n=s(422),l=s(7811);class i{async request(e,t){let s="".concat(this.baseUrl).concat(e);if(this.repo){let e=s.includes("?")?"&":"?";s="".concat(s).concat(e,"repo=").concat(encodeURIComponent(this.repo))}let a=l.env.NEXT_PUBLIC_ULPI_API_SECRET,r=await fetch(s,{...t,headers:{"Content-Type":"application/json",...a?{"X-Ulpi-Secret":a}:{},...null==t?void 0:t.headers}});if(!r.ok)throw Error((await r.json().catch(()=>({error:r.statusText}))).error||"API error: ".concat(r.status));return r.json()}async get(e){return this.request(e)}async post(e,t){return this.request(e,{method:"POST",body:t?JSON.stringify(t):void 0})}async put(e,t){return this.request(e,{method:"PUT",body:t?JSON.stringify(t):void 0})}async delete(e){return this.request(e,{method:"DELETE"})}constructor(){this.repo=null,this.baseUrl=(0,n.h)()}}let o=(0,r.createContext)({mode:"cloud",localClient:null});function c(e){let{children:t}=e,s=(0,r.useMemo)(()=>{let e=(0,n.J)()?"local":"cloud";return{mode:e,localClient:"local"===e?new i:null}},[]);return(0,a.jsx)(o,{value:s,children:t})}function d(){return(0,r.useContext)(o).mode}function u(){let{localClient:e}=(0,r.useContext)(o);if(!e)throw Error("LocalApiClient not available in cloud mode");return e}function m(){return(0,r.useContext)(o)}},4010:(e,t,s)=>{s.d(t,{Z:()=>c});var a=s(8111),r=s(5271);let n=[{key:"precondition",label:"Precondition"},{key:"postcondition",label:"Postcondition"},{key:"permission",label:"Permission"},{key:"pipeline",label:"Pipeline"}],l=["PreToolUse","PostToolUse","PermissionRequest","Notification","Stop","SubAgentSpawn","TaskStart","TaskComplete"],i=["testsRun","testsPassed","lintRun","lintPassed","buildRun","buildPassed","formatterRun","branchCreated","planApproved"],o="w-full rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2 text-sm text-white placeholder-gray-600 outline-none transition-colors focus:border-primary-500/50";function c(e){var t,s,c,d,u,m,x,p,h,b,g,v,y,f,j,N;let{initialData:k,onSubmit:w,onCancel:C,submitLabel:S="Save Rule"}=e,[P,_]=(0,r.useState)(null!=(t=null==k?void 0:k.type)?t:"precondition"),[E,A]=(0,r.useState)(null!=(s=null==k?void 0:k.trigger)?s:l[0]),[T,q]=(0,r.useState)(null!=(c=null==k?void 0:k.matcher)?c:""),[L,R]=(0,r.useState)(null!=(d=null==k?void 0:k.file_pattern)?d:""),[U,M]=(0,r.useState)(null!=(u=null==k?void 0:k.command_pattern)?u:""),[I,B]=(0,r.useState)(null==k?void 0:k.priority),[O,X]=(0,r.useState)(null==(m=null==k?void 0:k.enabled)||m),[F,V]=(0,r.useState)(null!=(x=null==k?void 0:k.message)?x:""),[W,D]=(0,r.useState)(null!=(p=null==k?void 0:k.requires_read)&&p),[H,J]=(0,r.useState)(null!=(h=null==k?void 0:k.requires)?h:[]),[z,K]=(0,r.useState)(null!=(b=null==k?void 0:k.skill)?b:""),[Z,G]=(0,r.useState)(null!=(g=null==k?void 0:k.decision)?g:"ask_user"),[Q,Y]=(0,r.useState)((null==k?void 0:k.type)==="permission"&&null!=(v=null==k?void 0:k.message)?v:""),[$,ee]=(0,r.useState)(null!=(y=null==k?void 0:k.run)?y:""),[et,es]=(0,r.useState)(null==k?void 0:k.timeout),[ea,er]=(0,r.useState)(null!=(f=null==k?void 0:k.block_on_failure)&&f),[en,el]=(0,r.useState)(null!=(j=null==k?void 0:k.steps)?j:[{name:"",run:""}]),[ei,eo]=(0,r.useState)(null!=(N=null==k?void 0:k.on_failure)?N:"block"),[ec,ed]=(0,r.useState)(!1),[eu,em]=(0,r.useState)(null);function ex(e,t,s){el(a=>a.map((a,r)=>r===e?{...a,[t]:s}:a))}async function ep(){if(!T.trim())return void em("Matcher is required.");ed(!0),em(null);let e={id:null==k?void 0:k.id,type:P,trigger:E,matcher:T,enabled:O,...L&&{file_pattern:L},...U&&{command_pattern:U},...void 0!==I&&{priority:I},...z&&{skill:z}};switch(P){case"precondition":if(!F.trim()){em("Message is required for precondition rules."),ed(!1);return}e.message=F,e.requires_read=W||void 0,e.requires=H.length>0?H:void 0;break;case"postcondition":if(!$.trim()){em("Run command is required for postcondition rules."),ed(!1);return}e.run=$,e.timeout=et,e.block_on_failure=ea||void 0;break;case"permission":e.decision=Z,e.message=Q||void 0;break;case"pipeline":if(0===en.length||!en.some(e=>e.name.trim())){em("At least one named step is required."),ed(!1);return}e.steps=en.filter(e=>e.name.trim()),e.on_failure=ei}try{await w(e)}catch(e){em(e instanceof Error?e.message:"Failed to save rule")}finally{ed(!1)}}let eh=!!(null==k?void 0:k.id);return(0,a.jsxs)("div",{className:"space-y-6",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-2 block text-xs font-medium text-gray-400",children:"Rule Type"}),(0,a.jsx)("div",{className:"inline-flex rounded-lg bg-surface-800/50 p-1",children:n.map(e=>(0,a.jsx)("button",{type:"button",disabled:eh,onClick:()=>_(e.key),className:"rounded-md px-4 py-2 text-sm font-medium transition-colors ".concat(P===e.key?"bg-primary-500/15 text-primary-400":"text-gray-500 hover:text-gray-300"," ").concat(eh?"cursor-not-allowed opacity-50":""),children:e.label},e.key))})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-4 md:grid-cols-2",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:"Trigger"}),(0,a.jsx)("select",{value:E,onChange:e=>A(e.target.value),className:o,children:l.map(e=>(0,a.jsx)("option",{value:e,children:e},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:"Matcher"}),(0,a.jsx)("input",{type:"text",value:T,onChange:e=>q(e.target.value),placeholder:"e.g., Write, Bash, *.test.ts",className:o})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:["File Pattern ",(0,a.jsx)("span",{className:"text-gray-600",children:"(optional)"})]}),(0,a.jsx)("input",{type:"text",value:L,onChange:e=>R(e.target.value),placeholder:"e.g., src/**/*.ts",className:o})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:["Command Pattern ",(0,a.jsx)("span",{className:"text-gray-600",children:"(optional)"})]}),(0,a.jsx)("input",{type:"text",value:U,onChange:e=>M(e.target.value),placeholder:"e.g., pnpm|yarn",className:o})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:["Priority ",(0,a.jsx)("span",{className:"text-gray-600",children:"(optional)"})]}),(0,a.jsx)("input",{type:"number",value:null!=I?I:"",onChange:e=>B(e.target.value?Number(e.target.value):void 0),placeholder:"100",className:o})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:["Skill ",(0,a.jsx)("span",{className:"text-gray-600",children:"(optional)"})]}),(0,a.jsx)("input",{type:"text",value:z,onChange:e=>K(e.target.value),placeholder:"e.g., safe-migrations",className:o})]})]}),(0,a.jsxs)("label",{className:"flex cursor-pointer items-center gap-3",children:[(0,a.jsx)("button",{type:"button",role:"switch","aria-checked":O,onClick:()=>X(!O),className:"relative inline-flex h-5 w-9 shrink-0 rounded-full border-2 border-transparent transition-colors ".concat(O?"bg-primary-500":"bg-surface-700"),children:(0,a.jsx)("span",{className:"pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow-sm transition-transform ".concat(O?"translate-x-4":"translate-x-0")})}),(0,a.jsx)("span",{className:"text-sm text-gray-300",children:"Enabled"})]}),(0,a.jsx)("div",{className:"border-t border-white/[0.06]"}),"precondition"===P&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-white",children:"Precondition Settings"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:"Message"}),(0,a.jsx)("textarea",{value:F,onChange:e=>V(e.target.value),placeholder:"Message shown when precondition is not met...",rows:3,className:"".concat(o," resize-none")})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-2 block text-xs font-medium text-gray-400",children:"Requires (state flags)"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:i.map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>{J(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])},className:"rounded-md border px-3 py-1.5 text-xs font-medium transition-colors ".concat(H.includes(e)?"border-primary-500/30 bg-primary-500/15 text-primary-400":"border-white/[0.08] bg-surface-800 text-gray-500 hover:border-primary-500/20"),children:e},e))})]}),(0,a.jsxs)("label",{className:"flex cursor-pointer items-center gap-3",children:[(0,a.jsx)("button",{type:"button",role:"switch","aria-checked":W,onClick:()=>D(!W),className:"relative inline-flex h-5 w-9 shrink-0 rounded-full border-2 border-transparent transition-colors ".concat(W?"bg-primary-500":"bg-surface-700"),children:(0,a.jsx)("span",{className:"pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow-sm transition-transform ".concat(W?"translate-x-4":"translate-x-0")})}),(0,a.jsx)("span",{className:"text-sm text-gray-300",children:"Requires file read first"})]})]}),"permission"===P&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-white",children:"Permission Settings"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-2 block text-xs font-medium text-gray-400",children:"Decision"}),(0,a.jsx)("div",{className:"flex gap-2",children:["allow","deny","ask_user"].map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>G(e),className:"rounded-lg border px-4 py-2 text-sm font-medium transition-colors ".concat(Z===e?"border-primary-500/30 bg-primary-500/15 text-primary-400":"border-white/[0.08] bg-surface-800 text-gray-500 hover:border-primary-500/20"),children:"ask_user"===e?"Ask User":e.charAt(0).toUpperCase()+e.slice(1)},e))})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:["Message ",(0,a.jsx)("span",{className:"text-gray-600",children:"(optional)"})]}),(0,a.jsx)("textarea",{value:Q,onChange:e=>Y(e.target.value),placeholder:"Custom message for permission prompt...",rows:3,className:"".concat(o," resize-none")})]})]}),"postcondition"===P&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-white",children:"Postcondition Settings"}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:"Run Command"}),(0,a.jsx)("input",{type:"text",value:$,onChange:e=>ee(e.target.value),placeholder:"e.g., npm run lint, npm test",className:"".concat(o," font-mono")})]}),(0,a.jsxs)("div",{children:[(0,a.jsxs)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:["Timeout (ms) ",(0,a.jsx)("span",{className:"text-gray-600",children:"(optional)"})]}),(0,a.jsx)("input",{type:"number",value:null!=et?et:"",onChange:e=>es(e.target.value?Number(e.target.value):void 0),placeholder:"30000",className:o})]}),(0,a.jsxs)("label",{className:"flex cursor-pointer items-center gap-3",children:[(0,a.jsx)("button",{type:"button",role:"switch","aria-checked":ea,onClick:()=>er(!ea),className:"relative inline-flex h-5 w-9 shrink-0 rounded-full border-2 border-transparent transition-colors ".concat(ea?"bg-primary-500":"bg-surface-700"),children:(0,a.jsx)("span",{className:"pointer-events-none inline-block h-4 w-4 rounded-full bg-white shadow-sm transition-transform ".concat(ea?"translate-x-4":"translate-x-0")})}),(0,a.jsx)("span",{className:"text-sm text-gray-300",children:"Block on failure"})]})]}),"pipeline"===P&&(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("h3",{className:"text-sm font-semibold text-white",children:"Pipeline Settings"}),(0,a.jsxs)("div",{className:"space-y-3",children:[en.map((e,t)=>(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)("span",{className:"mt-2.5 flex h-5 w-5 shrink-0 items-center justify-center rounded-full bg-surface-800 text-[10px] font-medium text-gray-500",children:t+1}),(0,a.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,a.jsx)("input",{type:"text",value:e.name,onChange:e=>ex(t,"name",e.target.value),placeholder:"Step name",className:o}),(0,a.jsx)("input",{type:"text",value:e.run,onChange:e=>ex(t,"run",e.target.value),placeholder:"Command to run",className:"".concat(o," font-mono")})]}),en.length>1&&(0,a.jsx)("button",{type:"button",onClick:()=>{el(e=>e.filter((e,s)=>s!==t))},className:"mt-2 rounded p-1 text-gray-600 transition-colors hover:text-red-400",children:(0,a.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"})})})]},t)),(0,a.jsxs)("button",{type:"button",onClick:function(){el(e=>[...e,{name:"",run:""}])},className:"flex items-center gap-1.5 rounded-lg border border-dashed border-white/[0.08] px-3 py-2 text-xs font-medium text-gray-500 transition-colors hover:border-primary-500/30 hover:text-primary-400",children:[(0,a.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,a.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"})}),"Add Step"]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)("label",{className:"mb-1.5 block text-xs font-medium text-gray-400",children:"On Failure"}),(0,a.jsxs)("select",{value:ei,onChange:e=>eo(e.target.value),className:o,children:[(0,a.jsx)("option",{value:"block",children:"Block"}),(0,a.jsx)("option",{value:"warn",children:"Warn"}),(0,a.jsx)("option",{value:"continue",children:"Continue"})]})]})]}),eu&&(0,a.jsx)("div",{className:"rounded-lg border border-red-500/20 bg-red-500/[0.06] px-3 py-2 text-xs text-red-400",children:eu}),(0,a.jsxs)("div",{className:"flex items-center gap-3 pt-2",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>void ep(),disabled:ec,className:"inline-flex items-center gap-2 rounded-lg bg-primary-500 px-5 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-primary-600 disabled:cursor-not-allowed disabled:opacity-50",children:[ec&&(0,a.jsx)("div",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-white border-t-transparent"}),ec?"Saving...":S]}),(0,a.jsx)("button",{type:"button",onClick:C,className:"rounded-lg px-5 py-2.5 text-sm font-medium text-gray-400 transition-colors hover:bg-white/[0.04] hover:text-gray-200",children:"Cancel"})]})]})}},4638:(e,t,s)=>{s.d(t,{f:()=>n});var a=s(5271),r=s(3446);function n(){let e=(0,r.yC)(),[t,s]=(0,a.useState)({rules:[],loading:!0,error:null}),n=(0,a.useCallback)(async()=>{s(e=>({...e,loading:!0,error:null}));try{let t=await e.get("/api/rules"),a=Array.isArray(t)?t:[];s({rules:a,loading:!1,error:null})}catch(e){s(t=>({...t,loading:!1,error:e instanceof Error?e.message:"Failed to fetch rules"}))}},[e]);(0,a.useEffect)(()=>{n()},[n]);let l=(0,a.useCallback)(async t=>{await e.post("/api/rules",t),await n()},[e,n]),i=(0,a.useCallback)(async(t,s)=>{await e.put("/api/rules/".concat(t),s),await n()},[e,n]),o=(0,a.useCallback)(async t=>{await e.delete("/api/rules/".concat(t)),await n()},[e,n]),c=(0,a.useCallback)(async t=>{await e.post("/api/rules/".concat(t,"/toggle")),await n()},[e,n]);return{...t,fetchRules:n,createRule:l,updateRule:i,deleteRule:o,toggleRule:c}}},4736:(e,t,s)=>{var a=s(1504);s.o(a,"useParams")&&s.d(t,{useParams:function(){return a.useParams}}),s.o(a,"usePathname")&&s.d(t,{usePathname:function(){return a.usePathname}}),s.o(a,"useRouter")&&s.d(t,{useRouter:function(){return a.useRouter}}),s.o(a,"useSearchParams")&&s.d(t,{useSearchParams:function(){return a.useSearchParams}})}}]);
|
package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/codemap/page-bf1ece66c1b05822.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5808],{422:(e,t,s)=>{"use strict";s.d(t,{J:()=>n,h:()=>a});var r=s(7811);function a(){return"local"===r.env.NEXT_PUBLIC_ULPI_MODE,"https://ulpi-cloud-api.ngrok.app"}function n(){return"local"===r.env.NEXT_PUBLIC_ULPI_MODE||!0==="https://ulpi-cloud-api.ngrok.app".includes("localhost")}},704:(e,t,s)=>{"use strict";s.d(t,{$:()=>n,Dy:()=>i,Ji:()=>l});var r=s(5271),a=s(3446);function n(){let e=(0,a.yC)(),[t,s]=(0,r.useState)(null),[n,l]=(0,r.useState)(!0),[i,o]=(0,r.useState)(null),d=(0,r.useRef)(null),c=(0,r.useCallback)(async()=>{o(null);try{let t=await e.get("/api/codemap/status");return s(t),t}catch(e){return o(e instanceof Error?e.message:"Failed to fetch codemap status"),null}finally{l(!1)}},[e]);return(0,r.useEffect)(()=>{let e=!1;async function t(){var s;if(e)return;let r=await c();e||(d.current=setTimeout(()=>void t(),null!=(s=null==r?void 0:r.pollIntervalMs)?s:15e3))}return l(!0),t(),()=>{e=!0,d.current&&clearTimeout(d.current)}},[c]),{status:t,loading:n,error:i,refresh:c}}function l(){let e=(0,a.yC)(),[t,s]=(0,r.useState)([]),[n,l]=(0,r.useState)(!1),[i,o]=(0,r.useState)(null);return{results:t,searching:n,search:(0,r.useCallback)(async(t,r)=>{l(!0),o(null);try{var a,n,i;let l=await e.post("/api/codemap/search",{query:t,...r});return s(null!=(a=l.results)?a:[]),o(null!=(n=l.durationMs)?n:null),null!=(i=l.results)?i:[]}catch(e){return s([]),o(null),[]}finally{l(!1)}},[e]),durationMs:i}}function i(){let e=(0,a.yC)(),t=(0,r.useCallback)(async()=>e.get("/api/codemap/config"),[e]);return{getConfig:t,updateConfig:(0,r.useCallback)(async t=>e.put("/api/codemap/config",t),[e]),triggerAction:(0,r.useCallback)(async t=>e.post("/api/codemap/action",{action:t}),[e])}}},867:(e,t,s)=>{Promise.resolve().then(s.bind(s,5282))},3446:(e,t,s)=>{"use strict";s.d(t,{Kv:()=>d,HI:()=>u,Xk:()=>c,yC:()=>x});var r=s(8111),a=s(5271),n=s(422),l=s(7811);class i{async request(e,t){let s="".concat(this.baseUrl).concat(e);if(this.repo){let e=s.includes("?")?"&":"?";s="".concat(s).concat(e,"repo=").concat(encodeURIComponent(this.repo))}let r=l.env.NEXT_PUBLIC_ULPI_API_SECRET,a=await fetch(s,{...t,headers:{"Content-Type":"application/json",...r?{"X-Ulpi-Secret":r}:{},...null==t?void 0:t.headers}});if(!a.ok)throw Error((await a.json().catch(()=>({error:a.statusText}))).error||"API error: ".concat(a.status));return a.json()}async get(e){return this.request(e)}async post(e,t){return this.request(e,{method:"POST",body:t?JSON.stringify(t):void 0})}async put(e,t){return this.request(e,{method:"PUT",body:t?JSON.stringify(t):void 0})}async delete(e){return this.request(e,{method:"DELETE"})}constructor(){this.repo=null,this.baseUrl=(0,n.h)()}}let o=(0,a.createContext)({mode:"cloud",localClient:null});function d(e){let{children:t}=e,s=(0,a.useMemo)(()=>{let e=(0,n.J)()?"local":"cloud";return{mode:e,localClient:"local"===e?new i:null}},[]);return(0,r.jsx)(o,{value:s,children:t})}function c(){return(0,a.useContext)(o).mode}function x(){let{localClient:e}=(0,a.useContext)(o);if(!e)throw Error("LocalApiClient not available in cloud mode");return e}function u(){return(0,a.useContext)(o)}},3951:(e,t,s)=>{"use strict";s.d(t,{G:()=>a});var r=s(8111);function a(e){let{rows:t=3,variant:s="skeleton",className:a=""}=e;return"spinner"===s?(0,r.jsx)("div",{className:"flex items-center justify-center py-16 ".concat(a),children:(0,r.jsxs)("div",{className:"flex flex-col items-center gap-3",children:[(0,r.jsx)("div",{className:"h-7 w-7 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"Loading..."})]})}):(0,r.jsx)("div",{className:"space-y-3 ".concat(a),children:Array.from({length:t}).map((e,t)=>(0,r.jsx)("div",{className:"animate-pulse rounded-xl border border-white/[0.04] bg-surface-800/50 p-4",children:(0,r.jsxs)("div",{className:"flex items-center gap-4",children:[(0,r.jsx)("div",{className:"h-8 w-8 rounded-lg bg-white/[0.06]"}),(0,r.jsxs)("div",{className:"flex-1 space-y-2",children:[(0,r.jsx)("div",{className:"h-3.5 w-1/3 rounded bg-white/[0.06]"}),(0,r.jsx)("div",{className:"h-3 w-2/3 rounded bg-white/[0.04]"})]}),(0,r.jsx)("div",{className:"h-5 w-16 rounded-full bg-white/[0.04]"})]})},t))})}},4632:(e,t,s)=>{"use strict";s.d(t,{p:()=>n});var r=s(8111);function a(){return(0,r.jsx)("svg",{className:"h-10 w-10 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 7.5l-.625 10.632a2.25 2.25 0 0 1-2.247 2.118H6.622a2.25 2.25 0 0 1-2.247-2.118L3.75 7.5m6 4.125 2.25 2.25m0 0 2.25 2.25M12 13.875l2.25-2.25M12 13.875l-2.25 2.25M3.375 7.5h17.25c.621 0 1.125-.504 1.125-1.125v-1.5c0-.621-.504-1.125-1.125-1.125H3.375c-.621 0-1.125.504-1.125 1.125v1.5c0 .621.504 1.125 1.125 1.125Z"})})}function n(e){let{icon:t,title:s,description:n,action:l,className:i=""}=e;return(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center rounded-2xl border border-dashed border-white/[0.06] bg-surface-800/30 px-6 py-16 text-center ".concat(i),children:[(0,r.jsx)("div",{className:"mb-4",children:null!=t?t:(0,r.jsx)(a,{})}),(0,r.jsx)("h3",{className:"text-sm font-medium text-gray-300",children:s}),n&&(0,r.jsx)("p",{className:"mt-1.5 max-w-sm text-xs text-gray-500",children:n}),l&&(0,r.jsx)("button",{onClick:l.onClick,className:"mt-5 rounded-lg bg-primary-500 px-4 py-2 text-xs font-semibold text-white transition-colors hover:bg-primary-600",children:l.label})]})}},5282:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>j});var r=s(8111),a=s(5271),n=s(704),l=s(3446);function i(){let e=(0,l.yC)(),[t,s]=(0,a.useState)(null),[r,n]=(0,a.useState)(!0),[i,o]=(0,a.useState)(null),d=(0,a.useRef)(!1),c=(0,a.useCallback)(async()=>{d.current||n(!0),o(null);try{let t=await e.get("/api/codemap/depgraph/status");s(t)}catch(e){o(e instanceof Error?e.message:"Failed to fetch depgraph status")}finally{d.current=!0,n(!1)}},[e]);return(0,a.useEffect)(()=>{c();let e=setInterval(()=>void c(),6e4);return()=>clearInterval(e)},[c]),{status:t,loading:r,error:i,refresh:c}}function o(e){let{results:t}=e;return 0===t.length?(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(0,r.jsx)("svg",{className:"h-10 w-10 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"})}),(0,r.jsx)("p",{className:"mt-3 text-sm text-gray-400",children:"No results found"}),(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-600",children:"Try a different query or adjust the search limit."})]}):(0,r.jsx)("div",{className:"space-y-3",children:t.map((e,t)=>{var s,a;return(0,r.jsxs)("div",{className:"rounded-xl border border-white/[0.04] bg-surface-800/50 p-4",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,r.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,r.jsxs)("p",{className:"truncate font-mono text-xs text-primary-400",children:[e.filePath,(0,r.jsxs)("span",{className:"text-gray-500",children:[":",e.startLine,"-",e.endLine]})]}),e.symbolName&&(0,r.jsxs)("p",{className:"mt-0.5 text-xs text-gray-500",children:[null!=(s=e.symbolType)?s:"symbol"," \xb7 ",e.symbolName]})]}),(0,r.jsx)("div",{className:"flex shrink-0 items-center gap-1.5",children:(0,r.jsxs)("span",{className:"text-sm font-semibold ".concat((a=e.score)>=.85?"text-emerald-400":a>=.7?"text-blue-400":"text-amber-400"),children:[(100*e.score).toFixed(0),"%"]})})]}),(0,r.jsx)("div",{className:"mt-2 h-1 w-full overflow-hidden rounded-full bg-white/[0.04]",children:(0,r.jsx)("div",{className:"h-full rounded-full bg-primary-500/60 transition-all",style:{width:"".concat(Math.round(100*e.score),"%")}})}),e.snippet&&(0,r.jsx)("pre",{className:"mt-3 overflow-x-auto whitespace-pre-wrap rounded-lg border border-white/[0.04] bg-surface-950 p-3 font-mono text-xs text-gray-400",children:e.snippet})]},"".concat(e.filePath,"-").concat(e.startLine,"-").concat(t))})})}var d=s(3951),c=s(4632),x=s(5605);function u(e){if(!e)return"Never";let t=new Date(e);if(isNaN(t.getTime()))return e;let s=Date.now()-t.getTime();return s<6e4?"just now":s<36e5?"".concat(Math.floor(s/6e4),"m ago"):s<864e5?"".concat(Math.floor(s/36e5),"h ago"):t.toLocaleDateString()}function m(){var e,t,s,l,o,c,m,h,p;let{status:g,loading:b,error:f}=(0,n.$)(),{status:j}=i(),[y,v]=(0,a.useState)(null);if(b)return(0,r.jsx)(d.G,{rows:1});if(f)return(0,r.jsx)("div",{className:"rounded-xl border border-amber-500/20 bg-amber-500/[0.06] p-4",children:(0,r.jsx)("p",{className:"text-sm text-amber-400",children:"Could not connect to CodeMap API. Make sure the ULPI server is running."})});if(!g)return null;let N="indexing"===g.mode?"Indexing":"watching"===g.mode?"Watching":"error"===g.mode?"Error":g.initialized?"Ready":"Not Initialized",w="indexing"===g.mode?"running":"watching"===g.mode?"active":"error"===g.mode?"error":g.initialized?"success":"idle";return(0,r.jsxs)("div",{className:"space-y-3",children:[(0,r.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-surface-900 p-4",children:[(0,r.jsx)("div",{className:"flex items-center justify-between",children:(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)(x.W,{status:w,label:N,size:"md"}),g.initialized&&(0,r.jsxs)("span",{className:"text-xs text-gray-500",children:["Branch: ",(0,r.jsx)("span",{className:"text-gray-400",children:null!=(e=g.branch)?e:"default"}),g.embeddingProvider&&(0,r.jsxs)(r.Fragment,{children:[" ","\xb7 Provider: ",(0,r.jsx)("span",{className:"text-gray-400",children:g.embeddingProvider}),g.embeddingModel&&(0,r.jsxs)(r.Fragment,{children:[" / ",(0,r.jsx)("span",{className:"text-gray-400",children:g.embeddingModel})]})]}),g.dimensions&&(0,r.jsxs)(r.Fragment,{children:[" ","\xb7 ",(0,r.jsxs)("span",{className:"text-gray-400",children:[g.dimensions,"d"]})," embeddings"]}),(null!=(t=g.lastUpdated)?t:g.lastIndexed)&&(0,r.jsxs)(r.Fragment,{children:[" ","\xb7 Updated ",(0,r.jsx)("span",{className:"text-gray-400",children:u(null!=(s=g.lastUpdated)?s:g.lastIndexed)})]})]})]})}),g.configMismatch&&(0,r.jsxs)("div",{className:"mt-3 flex items-center gap-2 rounded-lg border border-amber-500/20 bg-amber-500/[0.06] px-3 py-2",children:[(0,r.jsx)("svg",{className:"h-4 w-4 shrink-0 text-amber-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m-9.303 3.376c-.866 1.5.217 3.374 1.948 3.374h14.71c1.73 0 2.813-1.874 1.948-3.374L13.949 3.378c-.866-1.5-3.032-1.5-3.898 0L2.697 16.126ZM12 15.75h.007v.008H12v-.008Z"})}),(0,r.jsxs)("span",{className:"text-xs text-amber-400",children:["Embedding config mismatch detected. Indexed with ",g.indexedProvider,"/",g.indexedModel," (",g.indexedDimensions,"d) but current config differs. Consider reindexing."]})]})]}),g.lastError&&"indexing"!==g.mode&&g.lastError!==y&&(0,r.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-red-500/20 bg-red-500/[0.06] px-3 py-2 text-xs text-red-400",children:[(0,r.jsxs)("span",{children:["Indexing failed: ",g.lastError]}),(0,r.jsx)("button",{onClick:()=>v(g.lastError),className:"ml-2 shrink-0 text-red-400/60 hover:text-red-400 transition-colors",children:(0,r.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"})})})]}),"indexing"===g.mode&&g.progress&&(0,r.jsxs)("div",{className:"rounded-xl border border-primary-500/20 bg-primary-500/[0.06] p-5",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}),(0,r.jsxs)("h2",{className:"text-sm font-semibold text-white",children:["Indexing — ",g.progress.phase]})]}),(0,r.jsx)("span",{className:"text-xs text-gray-400",children:g.progress.total>0?"".concat(g.progress.current," / ").concat(g.progress.total):"".concat(g.progress.current," processed")})]}),(0,r.jsx)("p",{className:"mt-2 text-xs text-gray-400",children:g.progress.message}),g.progress.total>0&&(0,r.jsx)("div",{className:"mt-3 h-2 w-full overflow-hidden rounded-full bg-surface-800",children:(0,r.jsx)("div",{className:"h-full rounded-full bg-primary-500 transition-all duration-500 ease-out",style:{width:"".concat(Math.min(100,Math.round(g.progress.current/g.progress.total*100)),"%")}})}),(g.progress.totalFiles>0||g.progress.totalChunks>0)&&(0,r.jsxs)("div",{className:"mt-2 flex gap-4 text-xs text-gray-500",children:[g.progress.totalFiles>0&&(0,r.jsxs)("span",{children:[g.progress.totalFiles," files"]}),g.progress.totalChunks>0&&(0,r.jsxs)("span",{children:[g.progress.totalChunks," chunks"]})]})]}),"indexing"===g.mode&&!g.progress&&(0,r.jsx)("div",{className:"rounded-xl border border-primary-500/20 bg-primary-500/[0.06] p-5",children:(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}),(0,r.jsx)("h2",{className:"text-sm font-semibold text-white",children:"Starting indexing pipeline..."})]})}),g.initialized&&(0,r.jsx)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-5",children:[{label:"Files",value:String(null!=(o=null!=(l=g.totalFiles)?l:g.fileCount)?o:0)},{label:"Chunks",value:String(null!=(m=null!=(c=g.totalChunks)?c:g.chunkCount)?m:0)},{label:"Stale",value:String(null!=(h=g.staleFiles)?h:0)},{label:"Disk",value:function(e){if(null==e||0===e)return"0 B";let t=["B","KB","MB","GB"],s=0,r=e;for(;r>=1024&&s<t.length-1;)r/=1024,s++;return 0===s?"".concat(r," B"):"".concat(r.toFixed(1)," ").concat(t[s])}(g.indexSizeBytes)},{label:"Queue",value:String(null!=(p=g.queueDepth)?p:0)}].map(e=>(0,r.jsxs)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/50 p-3",children:[(0,r.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600",children:e.label}),(0,r.jsx)("p",{className:"mt-1 text-lg font-semibold text-white",children:e.value})]},e.label))}),(null==j?void 0:j.available)&&(0,r.jsx)("div",{className:"grid grid-cols-2 gap-2 sm:grid-cols-5",children:[{label:"Nodes",value:String(j.nodeCount)},{label:"Edges",value:String(j.edgeCount)},{label:"Defs",value:String(j.definitionCount)},{label:"Refs",value:String(j.referenceCount)},{label:"Cycles",value:String(j.cycleCount)}].map(e=>(0,r.jsxs)("div",{className:"rounded-lg border border-primary-500/20 bg-primary-500/[0.04] p-3",children:[(0,r.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-primary-400/60",children:e.label}),(0,r.jsx)("p",{className:"mt-1 text-lg font-semibold text-white",children:e.value})]},e.label))})]})}function h(){var e;let{status:t}=(0,n.$)(),{results:s,searching:l,search:i,durationMs:x}=(0,n.Ji)(),[m,h]=(0,a.useState)(""),[p,g]=(0,a.useState)(10),[b,f]=(0,a.useState)(.3),[j,y]=(0,a.useState)(""),[v,N]=(0,a.useState)(!1),[w,k]=(0,a.useState)(!1),[C,S]=(0,a.useState)(!1),L=(0,a.useCallback)(async e=>{null==e||e.preventDefault(),m.trim()&&(S(!0),await i(m.trim(),{limit:p,threshold:b,pathPrefix:j.trim()||void 0,includeTests:v,includeDocs:w}))},[m,p,b,j,v,w,i]);return(0,r.jsxs)("div",{className:"grid grid-cols-1 gap-6 lg:grid-cols-12",children:[(0,r.jsxs)("div",{className:"lg:col-span-8 space-y-5",children:[(0,r.jsx)("div",{className:"rounded-xl border border-white/[0.06] bg-surface-900 p-5",children:(0,r.jsxs)("form",{onSubmit:e=>void L(e),className:"space-y-3",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("label",{className:"block text-xs font-medium text-gray-400",children:"Query"}),(0,r.jsx)("input",{type:"text",value:m,onChange:e=>h(e.target.value),placeholder:"Where is authentication handled?",className:"mt-1 w-full rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2.5 text-sm text-white placeholder-gray-600 outline-none focus:border-primary-500/50 transition-colors"})]}),(0,r.jsxs)("div",{className:"flex gap-3",children:[(0,r.jsxs)("div",{className:"w-24",children:[(0,r.jsx)("label",{className:"block text-xs font-medium text-gray-400",children:"Limit"}),(0,r.jsx)("input",{type:"number",value:p,min:1,max:50,onChange:e=>g(Number(e.target.value)),className:"mt-1 w-full rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2.5 text-sm text-white outline-none focus:border-primary-500/50 transition-colors"})]}),(0,r.jsxs)("div",{className:"w-28",children:[(0,r.jsx)("label",{className:"block text-xs font-medium text-gray-400",children:"Threshold"}),(0,r.jsx)("input",{type:"number",value:b,min:0,max:1,step:.05,onChange:e=>f(Number(e.target.value)),className:"mt-1 w-full rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2.5 text-sm text-white outline-none focus:border-primary-500/50 transition-colors"})]}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("label",{className:"block text-xs font-medium text-gray-400",children:"Path Prefix"}),(0,r.jsx)("input",{type:"text",value:j,onChange:e=>y(e.target.value),placeholder:"packages/guards-engine",className:"mt-1 w-full rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2.5 text-sm text-white placeholder-gray-600 outline-none focus:border-primary-500/50 transition-colors"})]})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-5",children:[(0,r.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,r.jsx)("input",{type:"checkbox",checked:v,onChange:e=>N(e.target.checked),className:"h-3.5 w-3.5 rounded border-white/20 bg-surface-800 text-primary-500 focus:ring-primary-500/30 focus:ring-offset-0"}),(0,r.jsx)("span",{className:"text-xs text-gray-400",children:"Include tests"})]}),(0,r.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,r.jsx)("input",{type:"checkbox",checked:w,onChange:e=>k(e.target.checked),className:"h-3.5 w-3.5 rounded border-white/20 bg-surface-800 text-primary-500 focus:ring-primary-500/30 focus:ring-offset-0"}),(0,r.jsx)("span",{className:"text-xs text-gray-400",children:"Include docs"})]}),null!=x&&(0,r.jsxs)("span",{className:"text-[10px] text-gray-600",children:["Last search in ",x," ms"]})]}),(0,r.jsxs)("button",{type:"submit",disabled:l||!m.trim(),className:"inline-flex items-center gap-2 rounded-lg bg-primary-500 px-4 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-primary-600 disabled:cursor-not-allowed disabled:opacity-50",children:[l?(0,r.jsx)("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-white border-t-transparent"}):(0,r.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"})}),"Search"]})]})]})}),(0,r.jsxs)("div",{children:[C&&s.length>0&&(0,r.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,r.jsx)("h3",{className:"text-sm font-semibold text-white",children:"Results"}),(0,r.jsxs)("span",{className:"text-xs text-gray-500",children:[s.length," results"]})]}),l?(0,r.jsx)(d.G,{rows:3}):C?(0,r.jsx)(o,{results:s}):(0,r.jsx)(c.p,{title:"Search your codebase",description:"Enter a natural language query above to find relevant code using semantic search.",icon:(0,r.jsx)("svg",{className:"h-10 w-10 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m21 21-5.197-5.197m0 0A7.5 7.5 0 1 0 5.196 5.196a7.5 7.5 0 0 0 10.607 10.607Z"})})})]})]}),(0,r.jsxs)("div",{className:"lg:col-span-4 space-y-4",children:[(0,r.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-surface-900 p-4",children:[(0,r.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500",children:"Live Signals"}),(0,r.jsxs)("div",{className:"mt-3 space-y-2.5",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,r.jsx)("span",{className:"text-gray-400",children:"MCP endpoint"}),(0,r.jsx)("span",{className:(null==t?void 0:t.initialized)?"text-emerald-400":"text-amber-400",children:(null==t?void 0:t.initialized)?"online":"pending"})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,r.jsx)("span",{className:"text-gray-400",children:"Watch mode"}),(0,r.jsx)("span",{className:(null==t?void 0:t.mode)==="watching"?"text-emerald-400":"text-gray-600",children:(null==t?void 0:t.mode)==="watching"?"active":"idle"})]}),(0,r.jsxs)("div",{className:"flex items-center justify-between text-xs",children:[(0,r.jsx)("span",{className:"text-gray-400",children:"Initialization"}),(0,r.jsx)("span",{className:(null==t?void 0:t.initialized)?"text-emerald-400":"text-amber-400",children:(null==t?void 0:t.initialized)?"done":"required"})]})]})]}),(null==t||null==(e=t.watcherStats)?void 0:e.recentEvents)&&t.watcherStats.recentEvents.length>0&&(0,r.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-surface-900 p-4",children:[(0,r.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500",children:"Watcher Activity"}),(0,r.jsx)("div",{className:"mt-3 max-h-48 space-y-1.5 overflow-y-auto",children:t.watcherStats.recentEvents.map((e,t)=>{let s="add"===e.type?"text-emerald-400 bg-emerald-500/10":"change"===e.type?"text-blue-400 bg-blue-500/10":"text-red-400 bg-red-500/10";return(0,r.jsxs)("div",{className:"flex items-center gap-2 text-[10px]",children:[(0,r.jsx)("span",{className:"shrink-0 rounded px-1 py-px font-medium ".concat(s),children:e.type}),(0,r.jsx)("span",{className:"truncate font-mono text-gray-400",children:e.filePath}),(0,r.jsx)("span",{className:"ml-auto shrink-0 text-gray-600",children:u(e.ts)})]},"".concat(e.ts,"-").concat(t))})})]}),(0,r.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-surface-900 p-4",children:[(0,r.jsx)("h3",{className:"text-xs font-semibold uppercase tracking-wider text-gray-500",children:"About CodeMap"}),(0,r.jsx)("p",{className:"mt-2 text-xs leading-relaxed text-gray-500",children:"CodeMap uses hybrid vector + BM25 indexing to provide semantic code search across your entire codebase. It chunks source files, generates embeddings, and stores them in a LanceDB vector index for fast retrieval."}),(0,r.jsx)("p",{className:"mt-2 text-xs leading-relaxed text-gray-500",children:"The dependency graph (DepGraph) analyzes import relationships using tree-sitter tag extraction to compute file importance (PageRank), detect circular dependencies, and measure coupling metrics."})]})]})]})}function p(){let[e,t]=(0,a.useState)(20),{ranking:s,loading:n,error:i}=function(e){let t=(0,l.yC)(),[s,r]=(0,a.useState)(null),[n,i]=(0,a.useState)(!0),[o,d]=(0,a.useState)(null),c=(0,a.useRef)(!1),x=(0,a.useRef)(e);x.current!==e&&(x.current=e,c.current=!1);let u=(0,a.useCallback)(async()=>{c.current||i(!0),d(null);try{let s=await t.get("/api/codemap/depgraph/ranking?limit=".concat(encodeURIComponent(e)));r(s)}catch(e){d(e instanceof Error?e.message:"Failed to fetch depgraph ranking")}finally{c.current=!0,i(!1)}},[t,e]);return(0,a.useEffect)(()=>{u()},[u]),{ranking:s,loading:n,error:o,refresh:u}}(e),[o,x]=(0,a.useState)(null);return(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-base font-semibold text-white",children:"PageRank Ranking"}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-xs text-gray-500",children:"Show top"}),(0,r.jsxs)("select",{value:e,onChange:e=>t(Number(e.target.value)),className:"rounded-lg border border-white/[0.08] bg-surface-800 px-2 py-1.5 text-xs text-white outline-none focus:border-primary-500/50 transition-colors",children:[(0,r.jsx)("option",{value:20,children:"20"}),(0,r.jsx)("option",{value:50,children:"50"}),(0,r.jsx)("option",{value:100,children:"100"})]})]})]}),n?(0,r.jsx)(d.G,{rows:5}):i?(0,r.jsx)("div",{className:"rounded-xl border border-red-500/20 bg-red-500/[0.06] p-4",children:(0,r.jsx)("p",{className:"text-sm text-red-400",children:i})}):s&&0!==s.rankings.length?(0,r.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-surface-900 overflow-hidden",children:[(0,r.jsxs)("div",{className:"grid grid-cols-12 gap-2 border-b border-white/[0.06] px-4 py-2.5 text-[10px] font-medium uppercase tracking-wider text-gray-600",children:[(0,r.jsx)("div",{className:"col-span-1",children:"#"}),(0,r.jsx)("div",{className:"col-span-9",children:"File"}),(0,r.jsx)("div",{className:"col-span-2 text-right",children:"Rank Score"})]}),(0,r.jsx)("div",{className:"divide-y divide-white/[0.03]",children:s.rankings.map(e=>(0,r.jsx)(g,{item:e,expanded:o===e.filePath,onToggle:()=>x(o===e.filePath?null:e.filePath)},e.filePath))}),(0,r.jsxs)("div",{className:"border-t border-white/[0.06] px-4 py-2 text-[10px] text-gray-600",children:["Showing ",s.rankings.length," of ",s.totalFiles," total files"]})]}):(0,r.jsx)(c.p,{title:"No ranking data",description:"DepGraph ranking is not available. Make sure the index has been built with dependency analysis.",icon:(0,r.jsx)("svg",{className:"h-10 w-10 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 13.125C3 12.504 3.504 12 4.125 12h2.25c.621 0 1.125.504 1.125 1.125v6.75C7.5 20.496 6.996 21 6.375 21h-2.25A1.125 1.125 0 0 1 3 19.875v-6.75ZM9.75 8.625c0-.621.504-1.125 1.125-1.125h2.25c.621 0 1.125.504 1.125 1.125v11.25c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V8.625ZM16.5 4.125c0-.621.504-1.125 1.125-1.125h2.25C20.496 3 21 3.504 21 4.125v15.75c0 .621-.504 1.125-1.125 1.125h-2.25a1.125 1.125 0 0 1-1.125-1.125V4.125Z"})})})]})}function g(e){let{item:t,expanded:s,onToggle:n}=e,{result:i,loading:o,search:d}=function(){let e=(0,l.yC)(),[t,s]=(0,a.useState)(null),[r,n]=(0,a.useState)(!1);return{result:t,loading:r,search:(0,a.useCallback)(async(t,r)=>{n(!0);try{let a=await e.post("/api/codemap/depgraph/search",{filePath:t,direction:r});return s(a),a}catch(e){return s(null),null}finally{n(!1)}},[e])}}(),c=(0,a.useCallback)(()=>{s||d(t.filePath,"dependents"),n()},[s,t.filePath,d,n]);return(0,r.jsxs)("div",{children:[(0,r.jsxs)("button",{onClick:c,className:"grid w-full grid-cols-12 gap-2 px-4 py-2.5 text-left transition-colors hover:bg-white/[0.02]",children:[(0,r.jsxs)("div",{className:"col-span-1 text-xs text-gray-600",children:["#",t.position]}),(0,r.jsx)("div",{className:"col-span-9 truncate font-mono text-xs text-primary-400",children:t.filePath}),(0,r.jsx)("div",{className:"col-span-2 text-right font-mono text-xs text-gray-400",children:t.rank.toFixed(6)})]}),s&&(0,r.jsx)("div",{className:"border-t border-white/[0.02] bg-surface-950/40 px-6 py-3",children:o?(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs text-gray-500",children:[(0,r.jsx)("span",{className:"h-3 w-3 animate-spin rounded-full border border-primary-500 border-t-transparent"}),"Loading dependents..."]}):i&&i.results.length>0?(0,r.jsxs)("div",{children:[(0,r.jsxs)("p",{className:"mb-2 text-[10px] font-medium uppercase tracking-wider text-gray-600",children:["Dependents (",i.results.length,")"]}),(0,r.jsx)("div",{className:"space-y-1",children:i.results.map(e=>(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,r.jsx)("svg",{className:"h-3 w-3 shrink-0 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 19.5 15-15m0 0H8.25m11.25 0v11.25"})}),(0,r.jsx)("span",{className:"truncate font-mono text-gray-400",children:e.filePath}),e.symbols&&e.symbols.length>0&&(0,r.jsxs)("span",{className:"shrink-0 text-[10px] text-gray-600",children:["(",e.symbols.slice(0,3).join(", "),e.symbols.length>3?" ...":"",")"]})]},e.filePath))})]}):(0,r.jsx)("p",{className:"text-xs text-gray-600",children:"No dependents found for this file."})})]})}function b(){let[e,t]=(0,a.useState)(10),{cycles:s,loading:n,error:i}=function(e){let t=(0,l.yC)(),[s,r]=(0,a.useState)(null),[n,i]=(0,a.useState)(!0),[o,d]=(0,a.useState)(null),c=(0,a.useRef)(!1),x=(0,a.useRef)(e);x.current!==e&&(x.current=e,c.current=!1);let u=(0,a.useCallback)(async()=>{c.current||i(!0),d(null);try{let s=await t.get("/api/codemap/depgraph/cycles?limit=".concat(encodeURIComponent(e)));r(s)}catch(e){d(e instanceof Error?e.message:"Failed to fetch depgraph cycles")}finally{c.current=!0,i(!1)}},[t,e]);return(0,a.useEffect)(()=>{u()},[u]),{cycles:s,loading:n,error:o,refresh:u}}(e);return(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[(0,r.jsx)("h2",{className:"text-base font-semibold text-white",children:"Dependency Cycles"}),s&&s.totalCycles>0&&(0,r.jsxs)("span",{className:"inline-flex items-center rounded-full bg-red-500/10 border border-red-500/20 px-2 py-0.5 text-[11px] font-medium text-red-400",children:[s.totalCycles," total"]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"text-xs text-gray-500",children:"Show top"}),(0,r.jsxs)("select",{value:e,onChange:e=>t(Number(e.target.value)),className:"rounded-lg border border-white/[0.08] bg-surface-800 px-2 py-1.5 text-xs text-white outline-none focus:border-primary-500/50 transition-colors",children:[(0,r.jsx)("option",{value:10,children:"10"}),(0,r.jsx)("option",{value:20,children:"20"}),(0,r.jsx)("option",{value:50,children:"50"})]})]})]}),n?(0,r.jsx)(d.G,{rows:4}):i?(0,r.jsx)("div",{className:"rounded-xl border border-red-500/20 bg-red-500/[0.06] p-4",children:(0,r.jsx)("p",{className:"text-sm text-red-400",children:i})}):s&&0!==s.cycles.length?(0,r.jsx)("div",{className:"space-y-3",children:s.cycles.map((e,t)=>{var s,a;return(0,r.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-surface-900 p-4",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("svg",{className:"h-4 w-4 text-red-400/70",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182M21.015 4.356v4.992"})}),(0,r.jsxs)("span",{className:"text-xs font-medium text-white",children:["Cycle #",t+1]})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsxs)("span",{className:"rounded-full bg-red-500/10 border border-red-500/20 px-2 py-0.5 text-[10px] font-medium text-red-400",children:[e.files.length," files"]}),(0,r.jsxs)("span",{className:"rounded-full bg-surface-800 px-2 py-0.5 text-[10px] font-medium text-gray-500",children:[e.edgeCount," edges"]})]})]}),(0,r.jsxs)("div",{className:"space-y-1",children:[e.files.map((t,s)=>(0,r.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,r.jsxs)("span",{className:"w-5 shrink-0 text-right text-[10px] text-gray-600",children:[s+1,"."]}),(0,r.jsx)("span",{className:"truncate font-mono text-gray-400",children:t}),s<e.files.length-1&&(0,r.jsx)("svg",{className:"h-3 w-3 shrink-0 text-red-400/50",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 13.5 12 21m0 0-7.5-7.5M12 21V3"})})]},s)),(0,r.jsxs)("div",{className:"flex items-center gap-2 text-[10px] text-gray-600 pl-7",children:[(0,r.jsx)("svg",{className:"h-3 w-3 text-red-400/40",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 19.5 15-15m0 0H8.25m11.25 0v11.25"})}),"back to ",null!=(a=null==(s=e.files[0])?void 0:s.split("/").pop())?a:"first file"]})]})]},t)})}):(0,r.jsx)(c.p,{title:"No dependency cycles found",description:"Your codebase has no circular dependencies. Great job keeping a clean dependency graph!",icon:(0,r.jsx)("svg",{className:"h-10 w-10 text-emerald-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75M21 12a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})})]})}function f(){let{metrics:e,loading:t,analyze:s}=function(){let e=(0,l.yC)(),[t,s]=(0,a.useState)(null),[r,n]=(0,a.useState)(!1);return{metrics:t,loading:r,analyze:(0,a.useCallback)(async t=>{n(!0);try{let r=await e.post("/api/codemap/depgraph/metrics",{modulePath:t});return s(r),r}catch(e){return s(null),null}finally{n(!1)}},[e])}}(),[n,i]=(0,a.useState)(""),[o,x]=(0,a.useState)("instability"),[u,m]=(0,a.useState)("desc"),[h,p]=(0,a.useState)(!1),g=(0,a.useCallback)(async e=>{null==e||e.preventDefault(),p(!0),await s(n.trim())},[n,s]),b=(0,a.useCallback)(e=>{x(t=>(t===e?m(e=>"asc"===e?"desc":"asc"):m("desc"),e))},[]),f=(0,a.useMemo)(()=>{if(!(null==e?void 0:e.metrics))return[];let t=[...e.metrics];return t.sort((e,t)=>{let s=e[o],r=t[o];if("string"==typeof s&&"string"==typeof r)return"asc"===u?s.localeCompare(r):r.localeCompare(s);let a=Number(s),n=Number(r);return"asc"===u?a-n:n-a}),t},[e,o,u]),j=e=>{let{label:t,col:s}=e;return(0,r.jsxs)("button",{onClick:()=>b(s),className:"flex items-center gap-1 text-[10px] font-medium uppercase tracking-wider text-gray-600 hover:text-gray-400 transition-colors",children:[t,o===s&&(0,r.jsx)("svg",{className:"h-3 w-3 transition-transform ".concat("asc"===u?"rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M19.5 13.5 12 21m0 0-7.5-7.5M12 21V3"})})]})};return(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("h2",{className:"text-base font-semibold text-white",children:"Coupling Metrics"}),(0,r.jsxs)("form",{onSubmit:e=>void g(e),className:"flex items-end gap-3",children:[(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("label",{className:"block text-xs font-medium text-gray-400",children:"Module Path Prefix"}),(0,r.jsx)("input",{type:"text",value:n,onChange:e=>i(e.target.value),placeholder:"packages/ or apps/api/src",className:"mt-1 w-full rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2.5 text-sm text-white placeholder-gray-600 outline-none focus:border-primary-500/50 transition-colors"})]}),(0,r.jsxs)("button",{type:"submit",disabled:t,className:"inline-flex items-center gap-2 rounded-lg bg-primary-500 px-4 py-2.5 text-sm font-semibold text-white transition-colors hover:bg-primary-600 disabled:cursor-not-allowed disabled:opacity-50",children:[t?(0,r.jsx)("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-white border-t-transparent"}):(0,r.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3v11.25A2.25 2.25 0 0 0 6 16.5h2.25M3.75 3h-1.5m1.5 0h16.5m0 0h1.5m-1.5 0v11.25A2.25 2.25 0 0 1 18 16.5h-2.25m-7.5 0h7.5m-7.5 0-1 3m8.5-3 1 3m0 0 .5 1.5m-.5-1.5h-9.5m0 0-.5 1.5m.75-9 3-3 2.148 2.148A12.061 12.061 0 0 1 16.5 7.605"})}),"Analyze"]})]}),t?(0,r.jsx)(d.G,{rows:5}):h?e&&0!==f.length?(0,r.jsxs)("div",{className:"rounded-xl border border-white/[0.06] bg-surface-900 overflow-hidden",children:[(0,r.jsxs)("div",{className:"grid grid-cols-12 gap-2 border-b border-white/[0.06] px-4 py-2.5",children:[(0,r.jsx)("div",{className:"col-span-6",children:(0,r.jsx)(j,{label:"File",col:"filePath"})}),(0,r.jsx)("div",{className:"col-span-2 text-right",children:(0,r.jsx)(j,{label:"Ca (In)",col:"afferentCoupling"})}),(0,r.jsx)("div",{className:"col-span-2 text-right",children:(0,r.jsx)(j,{label:"Ce (Out)",col:"efferentCoupling"})}),(0,r.jsx)("div",{className:"col-span-2 text-right",children:(0,r.jsx)(j,{label:"Instability",col:"instability"})})]}),(0,r.jsx)("div",{className:"divide-y divide-white/[0.03]",children:f.map(e=>{var t;return(0,r.jsxs)("div",{className:"grid grid-cols-12 gap-2 px-4 py-2.5 transition-colors hover:bg-white/[0.02]",children:[(0,r.jsx)("div",{className:"col-span-6 truncate font-mono text-xs text-gray-400",children:e.filePath}),(0,r.jsx)("div",{className:"col-span-2 text-right font-mono text-xs text-gray-400",children:e.afferentCoupling}),(0,r.jsx)("div",{className:"col-span-2 text-right font-mono text-xs text-gray-400",children:e.efferentCoupling}),(0,r.jsx)("div",{className:"col-span-2 text-right font-mono text-xs font-medium ".concat((t=e.instability)>.8?"text-red-400":t>.5?"text-amber-400":"text-emerald-400"),children:e.instability.toFixed(2)})]},e.filePath)})}),(0,r.jsxs)("div",{className:"border-t border-white/[0.06] px-4 py-2 text-[10px] text-gray-600",children:["Module: ",e.modulePath||"(root)"," \xb7 ",f.length," files"]})]}):(0,r.jsx)(c.p,{title:"No coupling data",description:"No files found for the given module path prefix, or DepGraph data is not available."}):(0,r.jsx)(c.p,{title:"Analyze module coupling",description:"Enter a module path prefix and click Analyze to see coupling metrics for files in that module.",icon:(0,r.jsx)("svg",{className:"h-10 w-10 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 3v11.25A2.25 2.25 0 0 0 6 16.5h2.25M3.75 3h-1.5m1.5 0h16.5m0 0h1.5m-1.5 0v11.25A2.25 2.25 0 0 1 18 16.5h-2.25m-7.5 0h7.5m-7.5 0-1 3m8.5-3 1 3m0 0 .5 1.5m-.5-1.5h-9.5m0 0-.5 1.5m.75-9 3-3 2.148 2.148A12.061 12.061 0 0 1 16.5 7.605"})})})]})}function j(){let{status:e,loading:t,refresh:s}=(0,n.$)(),{triggerAction:l}=(0,n.Dy)(),{status:o}=i(),[d,c]=(0,a.useState)("search"),[x,u]=(0,a.useState)(null),[g,j]=(0,a.useState)(null),v=(0,a.useCallback)(async e=>{u(e),j(null);try{await l(e),s()}catch(e){}finally{u(null)}},[l,s]),N=[{key:"search",label:"Search"},{key:"ranking",label:"Ranking"},{key:"cycles",label:"Cycles",badge:(null==o?void 0:o.cycleCount)&&o.cycleCount>0?o.cycleCount:void 0},{key:"coupling",label:"Coupling"}];return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-xl font-semibold text-white",children:"CodeMap"}),(0,r.jsx)("p",{className:"mt-1 text-sm text-gray-400",children:"Semantic code discovery and dependency analysis."})]}),(0,r.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[!t&&e&&!e.initialized&&"indexing"!==e.mode&&(0,r.jsx)(y,{label:"Init",action:"init",running:"init"===x,disabled:null!==x,onClick:()=>void v("init"),icon:(0,r.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 5.653c0-.856.917-1.398 1.667-.986l11.54 6.347a1.125 1.125 0 0 1 0 1.972l-11.54 6.347a1.125 1.125 0 0 1-1.667-.986V5.653Z"})})}),(null==e?void 0:e.initialized)&&("watching"===e.mode?(0,r.jsxs)("button",{onClick:()=>void v("stop-watch"),disabled:null!==x,className:"inline-flex items-center gap-1.5 rounded-lg border border-emerald-500/30 bg-emerald-500/15 px-3 py-2 text-xs font-medium text-emerald-400 transition-colors hover:bg-emerald-500/25 disabled:cursor-not-allowed disabled:opacity-50",children:["stop-watch"===x?(0,r.jsx)("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-emerald-400 border-t-transparent"}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"h-2 w-2 rounded-full bg-emerald-400 animate-pulse"}),(0,r.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M5.25 7.5A2.25 2.25 0 0 1 7.5 5.25h9a2.25 2.25 0 0 1 2.25 2.25v9a2.25 2.25 0 0 1-2.25 2.25h-9a2.25 2.25 0 0 1-2.25-2.25v-9Z"})})]}),"Stop Watch"]}):(0,r.jsx)(y,{label:"Watch",action:"watch",running:"watch"===x,disabled:null!==x,onClick:()=>void v("watch"),icon:(0,r.jsxs)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.036 12.322a1.012 1.012 0 0 1 0-.639C3.423 7.51 7.36 4.5 12 4.5c4.638 0 8.573 3.007 9.963 7.178.07.207.07.431 0 .639C20.577 16.49 16.64 19.5 12 19.5c-4.638 0-8.573-3.007-9.963-7.178Z"}),(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})]})})),(null==e?void 0:e.initialized)&&(0,r.jsx)(y,{label:"indexing"===e.mode?"Indexing...":"Reindex",action:"reindex",running:"reindex"===x||"indexing"===e.mode,disabled:null!==x||"indexing"===e.mode,onClick:()=>void v("reindex"),icon:(0,r.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.023 9.348h4.992v-.001M2.985 19.644v-4.992m0 0h4.992m-4.993 0 3.181 3.183a8.25 8.25 0 0 0 13.803-3.7M4.031 9.865a8.25 8.25 0 0 1 13.803-3.7l3.181 3.182M21.015 4.356v4.992"})})}),(null==e?void 0:e.initialized)&&(0,r.jsx)(y,{label:"Export",action:"export",running:"export"===x,disabled:null!==x,onClick:()=>void v("export"),icon:(0,r.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5m-13.5-9L12 3m0 0 4.5 4.5M12 3v13.5"})})}),(0,r.jsx)(y,{label:"Import",action:"import",running:"import"===x,disabled:null!==x,onClick:()=>void v("import"),icon:(0,r.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 16.5v2.25A2.25 2.25 0 0 0 5.25 21h13.5A2.25 2.25 0 0 0 21 18.75V16.5M16.5 12 12 16.5m0 0L7.5 12M12 16.5V3"})})})]})]}),(0,r.jsx)(m,{}),(0,r.jsx)("div",{className:"flex gap-1 rounded-lg bg-surface-800/50 p-1",children:N.map(e=>(0,r.jsxs)("button",{onClick:()=>c(e.key),className:"relative rounded-md px-4 py-2 text-xs font-medium transition-colors ".concat(d===e.key?"bg-primary-500/15 text-primary-400":"text-gray-500 hover:text-gray-300"),children:[e.label,null!=e.badge&&e.badge>0&&(0,r.jsx)("span",{className:"ml-1.5 inline-flex items-center rounded-full bg-red-500/15 px-1.5 py-px text-[9px] font-semibold text-red-400",children:e.badge})]},e.key))}),"search"===d&&(0,r.jsx)(h,{}),"ranking"===d&&(0,r.jsx)(p,{}),"cycles"===d&&(0,r.jsx)(b,{}),"coupling"===d&&(0,r.jsx)(f,{})]})}function y(e){let{label:t,action:s,running:a,disabled:n,onClick:l,icon:i}=e;return(0,r.jsxs)("button",{onClick:l,disabled:n,className:"inline-flex items-center gap-1.5 rounded-lg border border-white/[0.08] bg-surface-900 px-3 py-2 text-xs font-medium text-gray-300 transition-colors hover:bg-surface-800 hover:text-white disabled:cursor-not-allowed disabled:opacity-50",children:[a?(0,r.jsx)("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}):i,t]})}},5605:(e,t,s)=>{"use strict";s.d(t,{W:()=>l});var r=s(8111);let a={pending:"bg-yellow-500/10 text-yellow-400 border-yellow-500/20",queued:"bg-yellow-500/10 text-yellow-400 border-yellow-500/20",active:"bg-blue-500/10 text-blue-400 border-blue-500/20",running:"bg-blue-500/10 text-blue-400 border-blue-500/20",in_progress:"bg-blue-500/10 text-blue-400 border-blue-500/20",completed:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",success:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",approved:"bg-emerald-500/10 text-emerald-400 border-emerald-500/20",error:"bg-red-500/10 text-red-400 border-red-500/20",failed:"bg-red-500/10 text-red-400 border-red-500/20",rejected:"bg-red-500/10 text-red-400 border-red-500/20",cancelled:"bg-gray-500/10 text-gray-400 border-gray-500/20",idle:"bg-gray-500/10 text-gray-400 border-gray-500/20"},n={pending:"bg-yellow-400",queued:"bg-yellow-400",active:"bg-blue-400",running:"bg-blue-400",in_progress:"bg-blue-400",completed:"bg-emerald-400",success:"bg-emerald-400",approved:"bg-emerald-400",error:"bg-red-400",failed:"bg-red-400",rejected:"bg-red-400",cancelled:"bg-gray-400",idle:"bg-gray-400"};function l(e){var t,s;let{status:l,label:i,showDot:o=!0,size:d="sm",className:c=""}=e,x=l.toLowerCase().replace(/\s+/g,"_"),u=null!=(t=a[x])?t:"bg-gray-500/10 text-gray-400 border-gray-500/20",m=null!=(s=n[x])?s:"bg-gray-400",h=null!=i?i:l.charAt(0).toUpperCase()+l.slice(1).replace(/_/g," ");return(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full border font-medium ".concat(u," ").concat("sm"===d?"px-2 py-0.5 text-[11px]":"px-2.5 py-1 text-xs"," ").concat(c),children:[o&&(0,r.jsx)("span",{className:"h-1.5 w-1.5 rounded-full ".concat(m)}),h]})}}},e=>{e.O(0,[814,9743,7358],()=>e(e.s=867)),_N_E=e.O()}]);
|