@ulpi/cli 0.1.10 → 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-F32YQRFR.js → chunk-3YFN5ZOR.js} +1 -1
- package/dist/{ci-QBXWR3GW.js → ci-EXYAXQVI.js} +1 -1
- package/dist/{doctor-SRJIZM2T.js → doctor-2EHFGL6W.js} +1 -1
- package/dist/{history-UGYO7Z3U.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 +107 -107
- package/dist/portal/apps/portal/.next/app-path-routes-manifest.json +18 -18
- package/dist/portal/apps/portal/.next/build-manifest.json +2 -2
- package/dist/portal/apps/portal/.next/prerender-manifest.json +109 -109
- 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.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.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.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.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 +18 -18
- package/dist/portal/apps/portal/.next/server/chunks/1522.js +1 -1
- package/dist/portal/apps/portal/.next/server/next-font-manifest.js +1 -1
- package/dist/portal/apps/portal/.next/server/next-font-manifest.json +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/server/pages-manifest.json +1 -1
- package/dist/portal/apps/portal/.next/static/chunks/380-71bdca6a9260da3e.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)/history/{page-264989cf873cd3de.js → page-0275ca43fdd64bf2.js} +1 -1
- 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)/loop/page-c3f658ffb8d7397b.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)/parallel/{page-85690140ff82dd58.js → page-49a26690ced20482.js} +1 -1
- 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/package.json +1 -1
- package/dist/{start-DWZHVBUO.js → start-6SLTMLI4.js} +1 -1
- package/dist/{update-IBPDEBEK.js → update-563P3ZIS.js} +1 -1
- package/dist/{version-checker-XKFQNN3I.js → version-checker-JHHM4OTR.js} +1 -1
- package/package.json +6 -6
- package/dist/portal/apps/portal/.next/static/chunks/380-52bab5fc966d7cf9.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/7525-d6350803a451284c.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)/layout-05fc9732a636a609.js +0 -1
- package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/loop/page-faeaacd95742c754.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-79f977cd348c57ae.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-30db4506366d09f4.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-6b199747e9f587de.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/{02AzZdYDA5HVAwITp37Ql → p-7mo3JdIgTzhlpqhShmK}/_buildManifest.js +0 -0
- /package/dist/portal/apps/portal/.next/static/{02AzZdYDA5HVAwITp37Ql → p-7mo3JdIgTzhlpqhShmK}/_ssgManifest.js +0 -0
package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/codemap/page-e85b24075b2ae8e9.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[5808],{422:(e,t,s)=>{"use strict";function r(){{let e=window.location.hostname;return"localhost"===e||"127.0.0.1"===e}}function a(){return r(),"http://localhost:9800"}s.d(t,{J:()=>r,h:()=>a})},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()}]);
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6337],{422:(e,t,s)=>{"use strict";function r(){{let e=window.location.hostname;return"localhost"===e||"127.0.0.1"===e}}function a(){return r(),"http://localhost:9800"}s.d(t,{J:()=>r,h:()=>a})},1457:(e,t,s)=>{"use strict";s.d(t,{H:()=>r,N:()=>a});let r={free:{maxWorkers:0,maxRepos:0,maxMinutes:0,mcpGatewayEnabled:!1,maxConcurrentMcpBackends:0},starter:{maxWorkers:2,maxRepos:5,maxMinutes:500,mcpGatewayEnabled:!0,maxConcurrentMcpBackends:20},pro:{maxWorkers:5,maxRepos:20,maxMinutes:2e3,mcpGatewayEnabled:!0,maxConcurrentMcpBackends:50},team:{maxWorkers:10,maxRepos:1/0,maxMinutes:5e3,mcpGatewayEnabled:!0,maxConcurrentMcpBackends:100}},a=[{tier:"free",name:"Free Forever",price:0,description:"The complete intelligence layer. No limits.",badge:"FREE",features:["Guard Rules — all 4 types + 28 templates","CodeMap — 11 MCP tools, hybrid search","DepGraph — 35 languages, PageRank, cycles","Memory — 6 MCP tools, 8 memory types","History — shadow branches, transcripts","Plan & Code Review — 8-dimension scoring","Session Tracking — real-time events","Web UI — 20-page local dashboard","Unlimited projects & sessions","Embedding: ULPI Cloud (free tier), Ollama, or OpenAI"],limits:r.free},{tier:"starter",name:"Starter",price:49,betaPrice:29,description:"Cloud CI for small teams getting started.",badge:"BETA",features:["Everything in Free","GitHub App integration","2 concurrent workers","5 repositories","500 CI minutes / month","AI code review on PRs","PR comments with structured results","MCP Gateway — cloud multiplexing proxy"],limits:r.starter},{tier:"pro",name:"Pro",price:149,betaPrice:79,description:"Full cloud CI for growing engineering teams.",badge:"POPULAR",features:["Everything in Starter","5 concurrent workers","20 repositories","2,000 CI minutes / month","Check run status reporting","Priority job queue","Team collaboration"],limits:r.pro,highlighted:!0},{tier:"team",name:"Team",price:349,betaPrice:199,description:"For large teams with heavy CI workloads.",badge:"BETA",features:["Everything in Pro","10 concurrent workers","Unlimited repositories","5,000 CI minutes / month","Dedicated support","SSO (coming soon)"],limits:r.team}]},2248:(e,t,s)=>{Promise.resolve().then(s.bind(s,6188))},3090:(e,t,s)=>{"use strict";s.d(t,{S:()=>n});var r=s(8111);function a(e){let{label:t,current:s,max:a,unit:n=""}=e,l=!isFinite(a),i=l?0:a>0?Math.min(s/a,1):0,o=Math.round(100*i);return(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,r.jsx)("span",{className:"text-xs text-gray-400",children:t}),(0,r.jsxs)("span",{className:"text-xs font-medium ".concat(l?"text-emerald-400":i>.9?"text-red-400":i>.7?"text-yellow-400":"text-emerald-400"),children:[s.toLocaleString(),n," / ",l?"Unlimited":"".concat(a.toLocaleString()).concat(n)]})]}),(0,r.jsx)("div",{className:"h-1.5 overflow-hidden rounded-full bg-surface-700",children:(0,r.jsx)("div",{className:"h-full rounded-full bg-gradient-to-r transition-all duration-500 ".concat(l?"from-emerald-500 to-emerald-400":i>.9?"from-red-500 to-red-400":i>.7?"from-yellow-500 to-orange-400":"from-emerald-500 to-emerald-400"),style:{width:l?"5%":"".concat(o,"%")}})}),(0,r.jsx)("p",{className:"mt-1 text-[10px] text-gray-600",children:l?"Unlimited":"".concat(o,"% used")})]})}function n(e){let{workers:t,repos:s,minutes:n}=e;return(0,r.jsxs)("div",{className:"space-y-4",children:[(0,r.jsx)("h3",{className:"text-xs font-semibold text-gray-400 uppercase tracking-wider mb-3",children:"Usage This Month"}),(0,r.jsx)(a,{label:"Workers",current:t.current,max:t.max}),(0,r.jsx)(a,{label:"Repos",current:s.current,max:s.max}),(0,r.jsx)(a,{label:"CI Minutes",current:n.current,max:n.max,unit:" min"})]})}},3446:(e,t,s)=>{"use strict";s.d(t,{Kv:()=>c,HI:()=>x,Xk:()=>d,yC:()=>u});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 c(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 d(){return(0,a.useContext)(o).mode}function u(){let{localClient:e}=(0,a.useContext)(o);if(!e)throw Error("LocalApiClient not available in cloud mode");return e}function x(){return(0,a.useContext)(o)}},6188:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>v});var r=s(8111),a=s(5271),n=s(8934),l=s(2928),i=s(422),o=s(3446),c=s(1457),d=s(3090),u=s(6971),x=s(5935),m=s.n(x);function h(e){let{label:t,value:s,subtitle:a,icon:n}=e;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-start justify-between",children:[(0,r.jsx)("p",{className:"text-xs font-medium uppercase tracking-wider text-gray-500",children:t}),n&&(0,r.jsx)("span",{className:"text-gray-600",children:n})]}),(0,r.jsx)("p",{className:"mt-2 text-2xl font-semibold text-white",children:s}),a&&(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-300",children:a})]})}function p(e){let{href:t,label:s,icon:a}=e;return(0,r.jsxs)(m(),{href:t,className:"flex items-center gap-2.5 rounded-lg border border-white/[0.06] bg-surface-900 px-4 py-3 text-sm text-gray-400 transition-colors hover:border-white/[0.1] hover:text-white",children:[(0,r.jsx)("span",{className:"text-gray-500",children:a}),s,(0,r.jsx)("svg",{className:"ml-auto h-3.5 w-3.5 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 4.5 21 12m0 0-7.5 7.5M21 12H3"})})]})}function g(){var e,t,s;let{localClient:n}=(0,o.HI)(),[l,i]=(0,a.useState)(null),[c,d]=(0,a.useState)(!0);return((0,a.useEffect)(()=>{n&&e();async function e(){try{var e;let t=null!=(e=(await n.get("/api/rules")).rules)?e:[];i({rulesCount:t.length,enabledCount:t.filter(e=>e.enabled).length,disabledCount:t.filter(e=>!e.enabled).length})}catch(e){}finally{d(!1)}}},[n]),c)?(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Dashboard"}),(0,r.jsx)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:Array.from({length:4}).map((e,t)=>(0,r.jsx)("div",{className:"h-24 animate-pulse rounded-xl border border-white/[0.06] bg-surface-900"},t))})]}):(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Dashboard"}),(0,r.jsx)("p",{className:"mt-1 text-sm text-gray-300",children:"Local mode -- connected to your ULPI API server"})]}),(0,r.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-3",children:[(0,r.jsx)(h,{label:"Total Rules",value:null!=(e=null==l?void 0:l.rulesCount)?e:0,subtitle:"Configured in guards.yml",icon:(0,r.jsx)("svg",{className:"h-4 w-4",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.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z"})})}),(0,r.jsx)(h,{label:"Active Rules",value:null!=(t=null==l?void 0:l.enabledCount)?t:0,subtitle:"Currently enabled",icon:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 12.75 6 6 9-13.5"})})}),(0,r.jsx)(h,{label:"Disabled Rules",value:null!=(s=null==l?void 0:l.disabledCount)?s:0,subtitle:"Inactive",icon:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M18.364 18.364A9 9 0 0 0 5.636 5.636m12.728 12.728A9 9 0 0 1 5.636 5.636m12.728 12.728L5.636 5.636"})})})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"mb-3 text-base font-semibold text-white",children:"Quick Actions"}),(0,r.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-3",children:[(0,r.jsx)(p,{href:"/rules",label:"View Rules",icon:(0,r.jsx)("svg",{className:"h-4 w-4",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.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z"})})}),(0,r.jsx)(p,{href:"/templates",label:"Browse Templates",icon:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.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.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.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"})})}),(0,r.jsx)(p,{href:"/skills",label:"Browse Skills",icon:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 0 0-2.455 2.456Z"})})}),(0,r.jsx)(p,{href:"/repos",label:"Manage Repos",icon:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 0 1 4.5 9.75h15A2.25 2.25 0 0 1 21.75 12v.75m-8.69-6.44-2.12-2.12a1.5 1.5 0 0 0-1.061-.44H4.5A2.25 2.25 0 0 0 2.25 6v12a2.25 2.25 0 0 0 2.25 2.25h15A2.25 2.25 0 0 0 21.75 18V9a2.25 2.25 0 0 0-2.25-2.25h-5.379a1.5 1.5 0 0 1-1.06-.44Z"})})}),(0,r.jsx)(p,{href:"/sessions",label:"View Sessions",icon:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 7.5l3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z"})})}),(0,r.jsx)(p,{href:"/notifications",label:"Notification Settings",icon:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.857 17.082a23.848 23.848 0 0 0 5.454-1.31A8.967 8.967 0 0 1 18 9.75V9A6 6 0 0 0 6 9v.75a8.967 8.967 0 0 1-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 0 1-5.714 0m5.714 0a3 3 0 1 1-5.714 0"})})})]})]})]})}function b(e){let{number:t,title:s,description:a,href:n,linkLabel:l,done:i}=e;return(0,r.jsxs)("div",{className:"flex items-start gap-3",children:[(0,r.jsx)("div",{className:"flex h-7 w-7 shrink-0 items-center justify-center rounded-full text-xs font-bold ".concat(i?"bg-emerald-500/15 text-emerald-400":"border border-primary-500/30 bg-primary-500/10 text-primary-400"),children:i?(0,r.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 12.75 6 6 9-13.5"})}):t}),(0,r.jsxs)("div",{className:"flex-1",children:[(0,r.jsx)("p",{className:"text-sm font-medium text-white",children:s}),(0,r.jsx)("p",{className:"mt-0.5 text-xs text-gray-500",children:a}),!i&&(0,r.jsxs)(m(),{href:n,className:"mt-1.5 inline-flex text-xs font-medium text-primary-400 transition-colors hover:text-primary-300",children:[l," →"]})]})]})}function j(e){let{completed:t,total:s}=e,a=s>0?Math.round(t/s*100):0;return(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("div",{className:"h-1.5 flex-1 overflow-hidden rounded-full bg-surface-800",children:(0,r.jsx)("div",{className:"h-full rounded-full bg-primary-500 transition-all",style:{width:"".concat(a,"%")}})}),(0,r.jsxs)("span",{className:"text-[10px] tabular-nums text-gray-500",children:[t,"/",s]})]})}function f(){var e,t,s,i,o,x,g,f,v;let{org:y}=(0,n.As)(),[w,k]=(0,a.useState)(null),[N,C]=(0,a.useState)([]),[L,M]=(0,a.useState)([]),[A,_]=(0,a.useState)(!0);if((0,a.useEffect)(()=>{y&&e();async function e(){try{let[e,t,s]=await Promise.all([l.uE.getDashboardStats(y.id),l.uE.getRecentJobs(y.id,10),l.uE.listBatchJobs(y.id,{status:"running"}).then(e=>e.batch_jobs).catch(()=>[])]);k(e),C(t),M(s)}catch(e){}finally{_(!1)}}},[y]),A)return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Dashboard"}),(0,r.jsx)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-4",children:Array.from({length:4}).map((e,t)=>(0,r.jsx)("div",{className:"h-24 animate-pulse rounded-xl border border-white/[0.06] bg-surface-900"},t))})]});let P=c.H.free,E=(null!=(e=null==w?void 0:w.total_repos)?e:0)===0;return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Dashboard"}),E&&(0,r.jsxs)("div",{className:"relative overflow-hidden rounded-2xl border border-primary-500/20 bg-gradient-to-br from-primary-500/[0.06] via-surface-900 to-surface-900 p-6",children:[(0,r.jsx)("div",{className:"pointer-events-none absolute -right-20 -top-20 h-40 w-40 rounded-full bg-primary-500/10 blur-3xl"}),(0,r.jsxs)("div",{className:"relative",children:[(0,r.jsx)("h2",{className:"text-lg font-bold text-white",children:"Welcome to ULPI Cloud"}),(0,r.jsx)("p",{className:"mt-1 max-w-lg text-sm text-gray-400",children:"Connect your repositories and start running AI-powered sprints. Follow these steps to get up and running."}),(0,r.jsxs)("div",{className:"mt-5 space-y-4",children:[(0,r.jsx)(b,{number:1,title:"Connect GitHub",description:"Install the ULPI GitHub App on your repositories.",href:"/settings/github",linkLabel:"Install GitHub App"}),(0,r.jsx)(b,{number:2,title:"Add a Repository",description:"Activate a repository from your GitHub installations.",href:"/repos",linkLabel:"Add Repository"}),(0,r.jsx)(b,{number:3,title:"Run Your First Sprint",description:"Create a batch job to execute tasks with AI agents.",href:"/sprints",linkLabel:"Create Sprint"})]})]})]}),(0,r.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2 lg:grid-cols-4",children:[(0,r.jsx)(h,{label:"Active Jobs",value:null!=(t=null==w?void 0:w.active_jobs)?t:0,subtitle:"Currently running"}),(0,r.jsx)(h,{label:"Repositories",value:null!=(s=null==w?void 0:w.total_repos)?s:0,subtitle:"Connected"}),(0,r.jsx)(h,{label:"Jobs Today",value:null!=(i=null==w?void 0:w.jobs_today)?i:0}),(0,r.jsx)(h,{label:"Jobs This Week",value:null!=(o=null==w?void 0:w.jobs_this_week)?o:0})]}),(0,r.jsx)(d.S,{workers:{current:null!=(x=null==w?void 0:w.active_jobs)?x:0,max:P.maxWorkers},repos:{current:null!=(g=null==w?void 0:w.total_repos)?g:0,max:P.maxRepos},minutes:{current:null!=(f=null==w?void 0:w.minutes_used)?f:0,max:null!=(v=null==w?void 0:w.minutes_limit)?v:P.maxMinutes}}),(0,r.jsxs)("div",{children:[(0,r.jsx)("h2",{className:"mb-3 text-base font-semibold text-white",children:"Quick Actions"}),(0,r.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2 lg:grid-cols-4",children:[(0,r.jsx)(p,{href:"/sprints",label:"New Sprint",icon:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 12h16.5m-16.5 3.75h16.5M3.75 19.5h16.5M5.625 4.5h12.75a1.875 1.875 0 0 1 0 3.75H5.625a1.875 1.875 0 0 1 0-3.75Z"})})}),(0,r.jsx)(p,{href:"/mcps/catalog",label:"MCP Catalog",icon:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 0 1-.657.643 48.39 48.39 0 0 1-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 0 1-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 0 0-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 0 1-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 0 0 .657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 0 1-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 0 0 5.427-.63 48.05 48.05 0 0 0 .582-4.717.532.532 0 0 0-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.959.401v0a.656.656 0 0 0 .658-.663 48.422 48.422 0 0 0-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 0 1-.61-.58v0Z"})})}),(0,r.jsx)(p,{href:"/settings/members",label:"Team Members",icon:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 19.128a9.38 9.38 0 0 0 2.625.372 9.337 9.337 0 0 0 4.121-.952 4.125 4.125 0 0 0-7.533-2.493M15 19.128v-.003c0-1.113-.285-2.16-.786-3.07M15 19.128v.106A12.318 12.318 0 0 1 8.624 21c-2.331 0-4.512-.645-6.374-1.766l-.001-.109a6.375 6.375 0 0 1 11.964-3.07M12 6.375a3.375 3.375 0 1 1-6.75 0 3.375 3.375 0 0 1 6.75 0Zm8.25 2.25a2.625 2.625 0 1 1-5.25 0 2.625 2.625 0 0 1 5.25 0Z"})})}),(0,r.jsx)(p,{href:"/settings/keys",label:"API Keys",icon:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 5.25a3 3 0 0 1 3 3m3 0a6 6 0 0 1-7.029 5.912c-.563-.097-1.159.026-1.563.43L10.5 17.25H8.25v2.25H6v2.25H2.25v-2.818c0-.597.237-1.17.659-1.591l6.499-6.499c.404-.404.527-1 .43-1.563A6 6 0 1 1 21.75 8.25Z"})})})]})]}),(0,r.jsxs)("div",{className:"grid gap-6 lg:grid-cols-2",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-base font-semibold text-white",children:"Active Sprints"}),(0,r.jsx)(m(),{href:"/sprints",className:"text-xs text-gray-400 transition-colors hover:text-primary-400",children:"View all →"})]}),(0,r.jsx)("div",{className:"rounded-xl border border-white/[0.06] bg-surface-900",children:0===L.length?(0,r.jsxs)("div",{className:"flex flex-col items-center gap-2 py-10",children:[(0,r.jsx)("svg",{className:"h-7 w-7 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 12h16.5m-16.5 3.75h16.5M3.75 19.5h16.5M5.625 4.5h12.75a1.875 1.875 0 0 1 0 3.75H5.625a1.875 1.875 0 0 1 0-3.75Z"})}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"No active sprints."}),(0,r.jsx)(m(),{href:"/sprints",className:"mt-1 text-xs font-medium text-primary-400 transition-colors hover:text-primary-300",children:"Create a sprint →"})]}):(0,r.jsx)("div",{className:"divide-y divide-white/[0.04]",children:L.map(e=>(0,r.jsxs)(m(),{href:"/sprints/".concat(e.id),className:"block px-4 py-3 transition-colors hover:bg-white/[0.02]",children:[(0,r.jsxs)("div",{className:"flex items-center justify-between",children:[(0,r.jsx)("span",{className:"truncate text-sm font-medium text-gray-200",children:e.repo_id.slice(0,16)}),(0,r.jsx)("span",{className:"ml-2 shrink-0 rounded-full bg-primary-500/10 px-2 py-0.5 text-[10px] font-medium text-primary-400",children:e.status})]}),(0,r.jsx)("div",{className:"mt-2",children:(0,r.jsx)(j,{completed:e.jobs_completed,total:e.jobs_total})}),e.agent_type&&(0,r.jsxs)("p",{className:"mt-1 text-[10px] text-gray-600",children:["Agent: ",e.agent_type]})]},e.id))})})]}),(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"mb-3 flex items-center justify-between",children:[(0,r.jsx)("h2",{className:"text-base font-semibold text-white",children:"Recent Activity"}),(0,r.jsx)(m(),{href:"/jobs",className:"text-xs text-gray-400 transition-colors hover:text-primary-400",children:"View all jobs →"})]}),(0,r.jsx)("div",{className:"rounded-xl border border-white/[0.06] bg-surface-900",children:0===N.length?(0,r.jsxs)("div",{className:"flex flex-col items-center gap-2 py-10",children:[(0,r.jsx)("svg",{className:"h-7 w-7 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 13V6a2 2 0 0 0-2-2H6a2 2 0 0 0-2 2v7m16 0v5a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-5m16 0h-2.586a1 1 0 0 0-.707.293l-2.414 2.414a1 1 0 0 1-.707.293h-3.172a1 1 0 0 1-.707-.293l-2.414-2.414A1 1 0 0 0 6.586 13H4"})}),(0,r.jsx)("p",{className:"text-xs text-gray-500",children:"No jobs yet. Connect a repository to get started."})]}):(0,r.jsx)("div",{className:"divide-y divide-white/[0.04]",children:N.map(e=>(0,r.jsxs)(m(),{href:"/jobs/".concat(e.id),className:"flex items-center gap-3 px-4 py-2.5 transition-colors hover:bg-white/[0.02]",children:[(0,r.jsx)(u.P,{status:e.status}),(0,r.jsx)("span",{className:"flex-1 truncate text-sm font-medium text-gray-200",children:e.repo_id.slice(0,12)}),(0,r.jsx)("span",{className:"rounded-md bg-surface-800 px-1.5 py-0.5 text-[10px] font-medium text-gray-500",children:e.trigger.replace(/_/g," ")}),e.github_pr_number&&(0,r.jsxs)("span",{className:"text-xs text-gray-500",children:["#",e.github_pr_number]}),(0,r.jsx)("span",{className:"text-xs text-gray-600",children:function(e){let t=Math.floor((Date.now()-new Date(e).getTime())/1e3);if(t<60)return"just now";let s=Math.floor(t/60);if(s<60)return"".concat(s,"m ago");let r=Math.floor(s/60);if(r<24)return"".concat(r,"h ago");let a=Math.floor(r/24);return"".concat(a,"d ago")}(e.queued_at)})]},e.id))})})]})]})]})}function v(){return(0,i.J)()?(0,r.jsx)(g,{}):(0,r.jsx)(f,{})}},6971:(e,t,s)=>{"use strict";s.d(t,{P:()=>n});var r=s(8111);let a={queued:{label:"Queued",bg:"bg-yellow-500/10",text:"text-yellow-400",dot:"bg-yellow-400"},running:{label:"Running",bg:"bg-blue-500/10",text:"text-blue-400",dot:"bg-blue-400 animate-pulse"},completed:{label:"Completed",bg:"bg-emerald-500/10",text:"text-emerald-400",dot:"bg-emerald-400"},failed:{label:"Failed",bg:"bg-red-500/10",text:"text-red-400",dot:"bg-red-400"},canceled:{label:"Canceled",bg:"bg-gray-500/10",text:"text-gray-400",dot:"bg-gray-400"}};function n(e){let{status:t,size:s="sm"}=e,n=a[t];return(0,r.jsxs)("span",{className:"inline-flex items-center gap-1.5 rounded-full ".concat(n.bg," ").concat(n.text," ").concat("sm"===s?"px-2 py-0.5 text-xs":"px-2.5 py-1 text-sm"),children:[(0,r.jsx)("span",{className:"inline-block h-1.5 w-1.5 rounded-full ".concat(n.dot)}),n.label]})}}},e=>{e.O(0,[5935,8934,814,9743,7358],()=>e(e.s=2248)),_N_E=e.O()}]);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3845],{452:(e,t,s)=>{Promise.resolve().then(s.bind(s,9896))},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})]})}},4736:(e,t,s)=>{"use strict";var r=s(1504);s.o(r,"useParams")&&s.d(t,{useParams:function(){return r.useParams}}),s.o(r,"usePathname")&&s.d(t,{usePathname:function(){return r.usePathname}}),s.o(r,"useRouter")&&s.d(t,{useRouter:function(){return r.useRouter}}),s.o(r,"useSearchParams")&&s.d(t,{useSearchParams:function(){return r.useSearchParams}})},9896:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>L});var r=s(8111),a=s(5271),n=s(4736),l=s(3446),i=s(4401),c=s(5935),o=s.n(c),d=s(3951),x=s(250);let m={A:"bg-emerald-500/15 text-emerald-400",M:"bg-blue-500/15 text-blue-400",D:"bg-red-500/15 text-red-400",R:"bg-amber-500/15 text-amber-400",C:"bg-violet-500/15 text-violet-400"},h={A:"Added",M:"Modified",D:"Deleted",R:"Renamed",C:"Copied"};function u(e){let{entry:t}=e;return(0,r.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[t.hasSession&&(0,r.jsx)("span",{className:"inline-flex items-center rounded-full bg-cyan-500/15 px-2 py-0.5 text-[10px] font-medium text-cyan-400",children:"Session"}),t.hasEnrichment&&(0,r.jsx)("span",{className:"inline-flex items-center rounded-full bg-violet-500/15 px-2 py-0.5 text-[10px] font-medium text-violet-400",children:"AI"}),t.hasTranscript&&(0,r.jsx)("span",{className:"inline-flex items-center rounded-full bg-emerald-500/15 px-2 py-0.5 text-[10px] font-medium text-emerald-400",children:"Transcript"}),t.hasReviewPlans&&(0,r.jsx)("span",{className:"inline-flex items-center rounded-full bg-amber-500/15 px-2 py-0.5 text-[10px] font-medium text-amber-400",children:"Review"})]})}function p(e){let{turn:t}=e,[s,n]=(0,a.useState)(!1),l="tool_use"===t.type?t.toolInput:t.content,i=null!=l&&l.length>2e3,c=i?l.slice(0,2e3):l;return(0,r.jsxs)("div",{children:[(0,r.jsxs)("button",{onClick:()=>n(!s),className:"inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium text-cyan-400 bg-cyan-500/10 border border-cyan-500/15 transition-colors hover:bg-cyan-500/15",children:[(0,r.jsx)("svg",{className:"h-2.5 w-2.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3"})}),"tool_use"===t.type?t.toolName:"Result",(0,r.jsx)("svg",{className:"h-2.5 w-2.5 text-cyan-500/60 transition-transform ".concat(s?"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 8.25-7.5 7.5-7.5-7.5"})})]}),s&&c&&(0,r.jsxs)("pre",{className:"mt-1 overflow-x-auto whitespace-pre-wrap font-mono text-[10px] text-gray-500 max-h-24 overflow-y-auto rounded border border-white/[0.03] bg-surface-950 p-2",children:[c,i&&"\n... (truncated)"]})]})}function f(e){let{turn:t}=e;if("tool_use"===t.type||"tool_result"===t.type)return(0,r.jsx)(p,{turn:t});let s="human"===t.type;return(0,r.jsxs)("div",{className:"rounded-lg border-l-2 px-3 py-2 ".concat(s?"border-l-primary-500 bg-surface-800/40 border border-l-2 border-white/[0.03]":"border-l-violet-500 bg-surface-900/60 border border-l-2 border-white/[0.04]"),children:[(0,r.jsx)("span",{className:"text-[10px] font-medium ".concat(s?"text-primary-400":"text-violet-400"),children:s?"You":"Assistant"}),(0,r.jsx)("p",{className:"mt-0.5 whitespace-pre-wrap text-[10px] text-gray-400 leading-relaxed max-h-20 overflow-y-auto",children:t.content.length>500?t.content.slice(0,500)+"...":t.content})]})}function g(e){let{sha:t}=e,{transcript:s,loading:n}=(0,i.oI)(t),[l,c]=(0,a.useState)(!1);if(n)return(0,r.jsx)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/50 p-3",children:(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 transcript..."]})});if(!s)return null;let d=(0,x.K9)(s);if(!d||0===d.length)return null;let m=d.filter(e=>"human"===e.type).length,h=d.filter(e=>"assistant"===e.type).length,u=d.filter(e=>"tool_use"===e.type||"tool_result"===e.type).length;return(0,r.jsxs)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/30 overflow-hidden",children:[(0,r.jsxs)("button",{onClick:()=>c(!l),className:"flex w-full items-center justify-between px-4 py-3 text-left transition-colors hover:bg-white/[0.02]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("svg",{className:"h-3.5 w-3.5 text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.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.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.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"})}),(0,r.jsx)("span",{className:"text-xs font-medium text-gray-300",children:"Transcript"}),(0,r.jsxs)("span",{className:"text-[10px] text-gray-600",children:[d.length," turn",1!==d.length?"s":""," ","(",m," user, ",h," assistant, ",u," tool)"]})]}),(0,r.jsx)("svg",{className:"h-3.5 w-3.5 text-gray-600 transition-transform ".concat(l?"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 8.25-7.5 7.5-7.5-7.5"})})]}),l&&(0,r.jsxs)("div",{className:"border-t border-white/[0.04] px-4 py-3 max-h-96 overflow-y-auto space-y-1.5",children:[d.slice(0,50).map((e,t)=>(0,r.jsx)(f,{turn:e},t)),d.length>50&&(0,r.jsxs)("p",{className:"py-2 text-center text-[10px] text-gray-600",children:["Showing 50 of ",d.length," turns."," ",(0,r.jsx)(o(),{href:"/history/".concat(t,"/transcript"),className:"text-primary-400 hover:text-primary-300",children:"View full transcript"})]})]})]})}function j(e){var t;let{plan:s}=e,[n,l]=(0,a.useState)(!1),i=null==(t=s.decision)?void 0:t.behavior,c="approve"===i?"approved":"deny"===i?"denied":null;return(0,r.jsxs)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/30 overflow-hidden",children:[(0,r.jsxs)("button",{onClick:()=>l(!n),className:"flex w-full items-center justify-between px-3 py-2.5 text-left transition-colors hover:bg-white/[0.02]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)("svg",{className:"h-3.5 w-3.5 text-amber-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25Z"})}),(0,r.jsx)("span",{className:"text-xs font-medium text-gray-300 truncate",children:s.title||s.slug||"Review Plan"}),c&&(0,r.jsx)("span",{className:"rounded-full px-1.5 py-px text-[9px] font-medium ".concat("approve"===i?"text-emerald-400 bg-emerald-500/15":"deny"===i?"text-red-400 bg-red-500/15":"text-amber-400 bg-amber-500/15"),children:c})]}),(0,r.jsx)("svg",{className:"h-3 w-3 text-gray-600 transition-transform shrink-0 ".concat(n?"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 8.25-7.5 7.5-7.5-7.5"})})]}),n&&s.plan&&(0,r.jsx)("div",{className:"border-t border-white/[0.04] px-3 py-3 max-h-64 overflow-y-auto",children:(0,r.jsx)("pre",{className:"whitespace-pre-wrap text-[11px] text-gray-400 leading-relaxed font-mono",children:s.plan})})]})}function y(e){let{sha:t}=e,s=(0,l.yC)(),{entry:n,loading:c,refresh:x}=(0,i.O4)(t),{enrichmentStatus:p,refresh:f}=(0,i.hh)(),[y,b]=(0,a.useState)(!1),[v,N]=(0,a.useState)(null),w=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(y)return w.current=setInterval(()=>{f()},2e3),()=>{w.current&&clearInterval(w.current)}},[y,f]),(0,a.useEffect)(()=>{if(y&&p&&("done"===p.status||"error"===p.status||"idle"===p.status)){if(b(!1),"error"===p.status){var e;N(null!=(e=p.error)?e:"Enrichment failed")}x()}},[p,y,x]);let k=(0,a.useCallback)(async()=>{if(!y){b(!0),N(null);try{await (0,i.W7)(s,t),f()}catch(e){N(e instanceof Error?e.message:"Enrichment failed"),b(!1)}}},[s,t,y,f]);if(c)return(0,r.jsx)(d.G,{rows:4});if(!n)return(0,r.jsxs)("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[(0,r.jsx)("svg",{className:"h-10 w-10 text-gray-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z"})}),(0,r.jsx)("p",{className:"mt-3 text-sm text-gray-500",children:"Entry not found"}),(0,r.jsxs)("p",{className:"mt-1 text-xs text-gray-600",children:["Could not load entry for SHA ",t.slice(0,8),"."]})]});let C=n.sha.slice(0,8);return(0,r.jsxs)("div",{className:"flex flex-col h-full min-h-0 overflow-y-auto",children:[(0,r.jsxs)("div",{className:"shrink-0",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"font-mono text-sm font-medium text-amber-400",children:C}),(0,r.jsx)(u,{entry:n})]}),n.subject&&(0,r.jsx)("p",{className:"mt-1.5 text-sm text-gray-200",children:n.subject})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[n.hasTranscript&&(0,r.jsxs)(o(),{href:"/history/".concat(t,"/transcript"),className:"inline-flex items-center gap-1.5 rounded-lg border border-white/[0.08] bg-surface-800 px-2.5 py-1.5 text-[11px] font-medium text-gray-300 transition-colors hover:bg-surface-750 hover:text-white",children:[(0,r.jsx)("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 6H5.25A2.25 2.25 0 0 0 3 8.25v10.5A2.25 2.25 0 0 0 5.25 21h10.5A2.25 2.25 0 0 0 18 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"})}),"Full Transcript"]}),!n.hasEnrichment&&(0,r.jsx)("button",{onClick:()=>void k(),disabled:y,className:"inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-semibold text-white transition-colors disabled:cursor-not-allowed ".concat(y?"bg-primary-500/60":"bg-primary-500 hover:bg-primary-600"),children:y?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"h-3 w-3 animate-spin rounded-full border-2 border-white border-t-transparent"}),(null==p?void 0:p.status)==="enriching"&&p.total>0?"".concat(p.completed,"/").concat(p.total):"Enriching..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 0 0-2.455 2.456ZM16.894 20.567 16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394-1.183.394a2.25 2.25 0 0 0-1.423 1.423Z"})}),"Enrich with AI"]})})]})]}),v&&(0,r.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:v})]}),(0,r.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-x-4 gap-y-1 text-xs shrink-0",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"Date "}),(0,r.jsx)("span",{className:"text-gray-300",children:function(e){let t=new Date(e);return isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}(n.date)})]}),null!=n.filesChanged&&n.filesChanged>0&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"Files "}),(0,r.jsxs)("span",{className:"text-gray-300",children:[n.filesChanged," changed",null!=n.insertions&&(0,r.jsxs)("span",{className:"ml-1.5 text-emerald-400",children:["+",n.insertions]}),null!=n.deletions&&(0,r.jsxs)("span",{className:"ml-1 text-red-400",children:["-",n.deletions]})]})]}),n.duration&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"Duration "}),(0,r.jsx)("span",{className:"text-gray-300",children:n.duration})]}),n.branch&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"Branch "}),(0,r.jsx)("span",{className:"font-mono text-gray-300",children:n.branch})]}),n.authorName&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"Author "}),(0,r.jsx)("span",{className:"text-gray-300",children:n.authorName})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"SHA "}),(0,r.jsx)("span",{className:"font-mono text-gray-400",children:n.sha})]})]}),n.tags&&n.tags.length>0&&(0,r.jsx)("div",{className:"mt-3 flex flex-wrap gap-1 shrink-0",children:n.tags.map(e=>(0,r.jsx)("span",{className:"rounded-full bg-surface-800 px-2 py-0.5 text-[10px] text-gray-500",children:e},e))}),n.enrichment&&(0,r.jsxs)("div",{className:"mt-4 rounded-lg border border-violet-500/10 bg-violet-500/[0.04] p-4 shrink-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,r.jsx)("svg",{className:"h-3.5 w-3.5 text-violet-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09Z"})}),(0,r.jsx)("h4",{className:"text-xs font-semibold text-violet-300",children:"AI Enrichment"}),n.enrichment.complexity&&(0,r.jsx)("span",{className:"rounded-full bg-violet-500/15 px-2 py-0.5 text-[10px] font-medium text-violet-400",children:n.enrichment.complexity})]}),n.enrichment.summary&&(0,r.jsx)("p",{className:"text-xs text-gray-300 leading-relaxed",children:n.enrichment.summary}),(n.enrichment.intent||n.enrichment.outcome)&&(0,r.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-3",children:[n.enrichment.intent&&(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600 mb-1",children:"Intent"}),(0,r.jsx)("p",{className:"text-xs text-gray-400",children:n.enrichment.intent})]}),n.enrichment.outcome&&(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600 mb-1",children:"Outcome"}),(0,r.jsx)("p",{className:"text-xs text-gray-400",children:n.enrichment.outcome})]})]}),n.enrichment.insights&&n.enrichment.insights.length>0&&(0,r.jsxs)("div",{className:"mt-3 space-y-1.5",children:[(0,r.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600",children:"Insights"}),n.enrichment.insights.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-start gap-2 text-xs",children:[(0,r.jsx)("span",{className:"mt-1 h-1 w-1 shrink-0 rounded-full bg-violet-400/50"}),(0,r.jsx)("span",{className:"text-gray-400",children:e})]},t))]}),n.enrichment.challenges&&n.enrichment.challenges.length>0&&(0,r.jsxs)("div",{className:"mt-3 space-y-1.5",children:[(0,r.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600",children:"Challenges"}),n.enrichment.challenges.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-start gap-2 text-xs",children:[(0,r.jsx)("span",{className:"mt-1 h-1 w-1 shrink-0 rounded-full bg-amber-400/50"}),(0,r.jsx)("span",{className:"text-gray-400",children:e})]},t))]}),n.enrichment.recommendations&&n.enrichment.recommendations.length>0&&(0,r.jsxs)("div",{className:"mt-3 space-y-1.5",children:[(0,r.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600",children:"Recommendations"}),n.enrichment.recommendations.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-start gap-2 text-xs",children:[(0,r.jsx)("span",{className:"mt-1 h-1 w-1 shrink-0 rounded-full bg-emerald-400/50"}),(0,r.jsx)("span",{className:"text-gray-400",children:e})]},t))]})]}),!n.enrichment&&n.summary&&(0,r.jsxs)("div",{className:"mt-4 rounded-lg border border-white/[0.04] bg-surface-800/30 p-4 shrink-0",children:[(0,r.jsx)("p",{className:"text-xs font-medium text-gray-500 mb-1.5",children:"Summary"}),(0,r.jsx)("p",{className:"text-xs text-gray-300 leading-relaxed",children:n.summary})]}),n.files&&n.files.length>0&&(0,r.jsxs)("div",{className:"mt-4 shrink-0",children:[(0,r.jsxs)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600 mb-2",children:["Files Changed (",n.files.length,")"]}),(0,r.jsx)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/30 overflow-hidden divide-y divide-white/[0.03]",children:n.files.map(e=>{var t,s,a,n;let l=null!=(t=m[e.status])?t:"bg-gray-500/15 text-gray-400",i="number"==typeof e.additions||"number"==typeof e.deletions,c=null!=(s=e.additions)?s:0,o=null!=(a=e.deletions)?a:0,d=c+o,x=Math.min(d,30),u=d>0?Math.round(c/d*x):0;return(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5",children:[(0,r.jsx)("span",{className:"inline-flex w-5 items-center justify-center rounded px-0.5 py-px text-[9px] font-medium ".concat(l),children:e.status}),(0,r.jsx)("span",{className:"truncate font-mono text-[11px] text-gray-400 flex-1 min-w-0",title:e.oldPath?"".concat(e.oldPath," → ").concat(e.path):e.path,children:e.oldPath?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-gray-600",children:e.oldPath}),(0,r.jsx)("span",{className:"text-gray-600",children:" → "}),e.path]}):e.path}),i&&(0,r.jsxs)("span",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[c>0&&(0,r.jsxs)("span",{className:"text-[10px] font-medium text-emerald-400",children:["+",c]}),o>0&&(0,r.jsxs)("span",{className:"text-[10px] font-medium text-red-400",children:["-",o]}),d>0&&(0,r.jsxs)("span",{className:"inline-flex gap-px",children:[Array.from({length:u},(e,t)=>(0,r.jsx)("span",{className:"inline-block h-2 w-[3px] rounded-[1px] bg-emerald-500/70"},"a".concat(t))),Array.from({length:x-u},(e,t)=>(0,r.jsx)("span",{className:"inline-block h-2 w-[3px] rounded-[1px] bg-red-500/70"},"d".concat(t)))]})]}),!i&&(0,r.jsx)("span",{className:"ml-auto shrink-0 text-[9px] text-gray-600",children:null!=(n=h[e.status])?n:e.status})]},e.path)})})]}),n.reviewPlans&&n.reviewPlans.length>0&&(0,r.jsxs)("div",{className:"mt-4 shrink-0",children:[(0,r.jsxs)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600 mb-2",children:["Review Plans (",n.reviewPlans.length,")"]}),(0,r.jsx)("div",{className:"space-y-2",children:n.reviewPlans.map((e,t)=>(0,r.jsx)(j,{plan:e},e.slug||t))})]}),n.hasTranscript&&(0,r.jsxs)("div",{className:"mt-4 shrink-0",children:[(0,r.jsx)(g,{sha:t}),(0,r.jsx)("div",{className:"mt-2 text-right",children:(0,r.jsx)(o(),{href:"/history/".concat(t,"/transcript"),className:"text-[10px] text-primary-400 hover:text-primary-300 transition-colors",children:"Open full transcript page"})})]})]})}var b=s(4632);function v(e){let{onInitialized:t}=e,s=(0,l.yC)(),[n,c]=(0,a.useState)(!1),[o,d]=(0,a.useState)(!1),[x,m]=(0,a.useState)(null),h=(0,a.useCallback)(async()=>{d(!0),m(null);try{await (0,i.xy)(s,{collectReviewPlans:n}),t()}catch(e){m(e instanceof Error?e.message:"Failed to initialize history")}finally{d(!1)}},[s,n,t]);return(0,r.jsx)("div",{className:"flex h-[calc(100vh-120px)] items-center justify-center",children:(0,r.jsxs)("div",{className:"w-full max-w-md text-center",children:[(0,r.jsx)("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-surface-900 border border-white/[0.06]",children:(0,r.jsx)("svg",{className:"h-8 w-8 text-primary-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),(0,r.jsx)("h2",{className:"mt-5 text-lg font-semibold text-white",children:"Initialize History"}),(0,r.jsx)("p",{className:"mt-2 text-sm text-gray-400 max-w-sm mx-auto",children:"Set up the shadow branch to track your coding session history. This creates a dedicated git branch for structured records of each session."}),(0,r.jsx)("div",{className:"mt-6 flex items-center justify-center gap-2",children:(0,r.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,r.jsx)("input",{type:"checkbox",checked:n,onChange:e=>c(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:"Collect review plans"})]})}),x&&(0,r.jsx)("div",{className:"mt-4 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-4 py-2 text-xs text-red-400",children:x}),(0,r.jsxs)("button",{onClick:()=>void h(),disabled:o,className:"mt-5 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:[o?(0,r.jsx)("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent"}):(0,r.jsx)("svg",{className:"h-4 w-4",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"})}),"Initialize History"]})]})})}function N(e){let{onBackfilled:t}=e,s=(0,l.yC)(),[n,c]=(0,a.useState)(!1),[o,d]=(0,a.useState)(null),[x,m]=(0,a.useState)(null),h=(0,a.useCallback)(async()=>{c(!0),m(null);try{let e=await (0,i.RK)(s,{limit:50});d({captured:e.captured,skipped:e.skipped}),e.captured>0&&t()}catch(e){m(e instanceof Error?e.message:"Backfill failed")}finally{c(!1)}},[s,t]);return(0,r.jsx)("div",{className:"flex h-[calc(100vh-120px)] items-center justify-center",children:(0,r.jsxs)("div",{className:"w-full max-w-md text-center",children:[(0,r.jsx)(b.p,{title:"No history entries yet",description:"History is initialized but empty. Backfill from recent commits to populate your timeline.",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:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),x&&(0,r.jsx)("div",{className:"mt-4 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-4 py-2 text-xs text-red-400",children:x}),o&&(0,r.jsxs)("div",{className:"mt-4 rounded-lg border border-emerald-500/20 bg-emerald-500/[0.06] px-4 py-2 text-xs text-emerald-400",children:["Captured ",o.captured," entries, skipped ",o.skipped,"."]}),(0,r.jsxs)("button",{onClick:()=>void h(),disabled:n,className:"mt-5 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:[n?(0,r.jsx)("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent"}):(0,r.jsx)("svg",{className:"h-4 w-4",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"})}),"Backfill Recent Commits"]})]})})}function w(e){let{entry:t,selected:s,onSelect:a}=e;return(0,r.jsxs)("button",{onClick:a,className:"w-full text-left rounded-lg px-3 py-2.5 transition-colors ".concat(s?"bg-primary-500/10 border border-primary-500/30":"border border-transparent hover:bg-white/[0.03]"),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)("span",{className:"font-mono text-xs text-amber-400 shrink-0",children:t.shortSha||t.sha.slice(0,7)}),(0,r.jsx)("span",{className:"text-[10px] text-gray-600 shrink-0",children:function(e){let t=new Date(e);return isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}(t.date)})]}),t.filesChanged>0&&(0,r.jsxs)("span",{className:"text-[10px] text-gray-600 shrink-0",children:[t.filesChanged,"f"]})]}),(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-300 truncate",children:t.subject||"No subject"}),(0,r.jsxs)("div",{className:"mt-1.5 flex flex-wrap gap-1",children:[t.hasSession&&(0,r.jsx)("span",{className:"rounded-full bg-cyan-500/15 px-1.5 py-px text-[9px] font-medium text-cyan-400",children:"Session"}),t.hasEnrichment&&(0,r.jsx)("span",{className:"rounded-full bg-violet-500/15 px-1.5 py-px text-[9px] font-medium text-violet-400",children:"AI"}),t.hasTranscript&&(0,r.jsx)("span",{className:"rounded-full bg-emerald-500/15 px-1.5 py-px text-[9px] font-medium text-emerald-400",children:"Transcript"}),t.hasReviewPlans&&(0,r.jsx)("span",{className:"rounded-full bg-amber-500/15 px-1.5 py-px text-[9px] font-medium text-amber-400",children:"Review"})]})]})}function k(e){let{refreshKey:t}=e,s=(0,l.yC)(),{enrichmentStatus:n,refresh:c}=(0,i.hh)();if((0,a.useEffect)(()=>{t>0&&c()},[t]),(0,a.useEffect)(()=>{if((null==n?void 0:n.status)!=="enriching")return;let e=setInterval(()=>void c(),3e3);return()=>clearInterval(e)},[null==n?void 0:n.status,c]),!n||"idle"===n.status)return null;let o=async()=>{await (0,i.J)(s),c()};if("enriching"===n.status){let e=n.total>0?Math.round(n.completed/n.total*100):0;return(0,r.jsxs)("div",{className:"rounded-lg border border-primary-500/20 bg-primary-500/[0.06] p-3",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:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}),(0,r.jsx)("span",{className:"text-xs font-medium text-primary-400",children:"Enriching..."})]}),(0,r.jsxs)("span",{className:"text-[10px] text-gray-500",children:[n.completed," / ",n.total," (",e,"%)"]})]}),n.total>0&&(0,r.jsx)("div",{className:"mt-2 h-1.5 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",style:{width:"".concat(e,"%")}})})]})}if("done"===n.status)return(0,r.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-emerald-500/20 bg-emerald-500/[0.06] px-3 py-2",children:[(0,r.jsxs)("span",{className:"text-xs text-emerald-400",children:["Enrichment complete. ",n.completed," enriched",n.failed>0&&", ".concat(n.failed," failed"),"."]}),(0,r.jsx)("button",{onClick:()=>void o(),className:"text-[10px] text-emerald-400/70 hover:text-emerald-400 transition-colors",children:"Dismiss"})]});if("error"===n.status){var d;return(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",children:[(0,r.jsxs)("span",{className:"text-xs text-red-400",children:["Enrichment failed: ",null!=(d=n.error)?d:"Unknown error"]}),(0,r.jsx)("button",{onClick:()=>void o(),className:"text-[10px] text-red-400/70 hover:text-red-400 transition-colors",children:"Dismiss"})]})}return null}function C(){var e,t,s;let c=(0,l.yC)(),o=(0,n.useRouter)(),x=(0,n.useSearchParams)(),m=x?x.get("sha"):null,{stats:h}=(0,i.zg)(),[u,p]=(0,a.useState)(null),{entries:f,loading:g,error:j,refresh:b}=(0,i._q)(null!=u?u:void 0),[v,N]=(0,a.useState)(!1),[C,L]=(0,a.useState)(!1),[S,M]=(0,a.useState)(!1),[E,A]=(0,a.useState)(0),R=f.length,B=(null==h||null==(e=h.dateRange)?void 0:e.from)&&(null==h||null==(t=h.dateRange)?void 0:t.to)?function(e,t){let s=new Date(e),r=new Date(t);if(isNaN(s.getTime())||isNaN(r.getTime()))return"";let a={month:"short",day:"numeric",year:"numeric"};return"".concat(s.toLocaleDateString(void 0,a)," - ").concat(r.toLocaleDateString(void 0,a))}(h.dateRange.from,h.dateRange.to):null,P=h?Math.round(h.enrichmentCoverage):null,W=h?Math.round(10*h.avgFilesChanged)/10:null,H=null!=(s=null==h?void 0:h.tagCounts)?s:{},I=(0,a.useMemo)(()=>Object.entries(H).sort((e,t)=>{let[,s]=e,[,r]=t;return r-s}).map(e=>{let[t]=e;return t}),[H]),[D,T]=(0,a.useState)(!1);(0,a.useEffect)(()=>{m&&T(!0)},[m]);let Z=(0,a.useCallback)(e=>{o.push("/history?sha=".concat(encodeURIComponent(e)),{scroll:!1})},[o]),_=(0,a.useCallback)(async()=>{N(!0);try{await (0,i.RK)(c,{limit:50}),b()}catch(e){}finally{N(!1)}},[c,b]),V=(0,a.useCallback)(async()=>{L(!0);try{let e=await (0,i.bj)(c),t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),s=URL.createObjectURL(t),r=document.createElement("a");r.href=s,r.download="ulpi-history-export.json",r.click(),URL.revokeObjectURL(s)}catch(e){}finally{L(!1)}},[c]),F=(0,a.useCallback)(async()=>{M(!0);try{await (0,i.W7)(c),A(e=>e+1)}catch(e){}finally{M(!1)}},[c]),O=(0,a.useCallback)(()=>{T(!1),o.push("/history",{scroll:!1})},[o]);return(0,r.jsxs)("div",{className:"flex flex-col h-[calc(100vh-32px)]",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-4 shrink-0",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[D&&m&&(0,r.jsx)("button",{onClick:O,className:"lg:hidden rounded-lg p-1.5 text-gray-500 transition-colors hover:bg-white/[0.06] hover:text-gray-300",children:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5 8.25 12l7.5-7.5"})})}),(0,r.jsx)("h1",{className:"text-xl font-semibold text-white",children:"History"}),(0,r.jsxs)("span",{className:"text-xs text-gray-600",children:[R," entr",1===R?"y":"ies"]})]}),B&&(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:B})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,r.jsxs)("button",{onClick:()=>void _(),disabled:v,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:[v?(0,r.jsx)("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}):(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"})}),"Backfill"]}),(0,r.jsxs)("button",{onClick:()=>void V(),disabled:C,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:[C?(0,r.jsx)("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}):(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"})}),"Export"]})]})]}),(0,r.jsx)("div",{className:"mt-3 shrink-0",children:(0,r.jsx)(k,{refreshKey:E})}),(0,r.jsxs)("div",{className:"flex gap-4 flex-1 min-h-0 mt-4",children:[(0,r.jsxs)("div",{className:"w-80 min-w-[280px] max-w-[360px] shrink-0 flex flex-col rounded-xl border border-white/[0.06] bg-surface-900 overflow-hidden ".concat(D&&m?"hidden lg:flex":"flex"),children:[(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-1.5 p-3 shrink-0",children:[(0,r.jsxs)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/50 p-2 text-center",children:[(0,r.jsx)("p",{className:"text-sm font-semibold text-white",children:R}),(0,r.jsx)("p",{className:"text-[9px] text-gray-600",children:"Entries"})]}),(0,r.jsxs)("button",{onClick:()=>void F(),disabled:S,className:"rounded-lg border p-2 text-center transition-colors group ".concat(S?"border-primary-500/20 bg-primary-500/[0.06]":"border-white/[0.04] bg-surface-800/50 hover:bg-surface-800"),title:"Enrich all entries with AI",children:[S?(0,r.jsx)("span",{className:"flex items-center justify-center h-5",children:(0,r.jsx)("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"})}):(0,r.jsx)("p",{className:"text-sm font-semibold text-white",children:null!=P?"".concat(P,"%"):"--"}),(0,r.jsx)("p",{className:"text-[9px] transition-colors ".concat(S?"text-primary-400":"text-gray-600 group-hover:text-violet-400"),children:S?"Enriching...":"AI Enriched"})]}),(0,r.jsxs)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/50 p-2 text-center",children:[(0,r.jsx)("p",{className:"text-sm font-semibold text-white",children:null!=W?W:"--"}),(0,r.jsx)("p",{className:"text-[9px] text-gray-600",children:"Avg Files"})]})]}),I.length>0&&(0,r.jsxs)("div",{className:"flex flex-wrap gap-1 px-3 pb-2 shrink-0",children:[(0,r.jsx)("button",{onClick:()=>p(null),className:"rounded-full px-2 py-0.5 text-[10px] font-medium transition-colors ".concat(null===u?"bg-primary-500/15 text-primary-400":"bg-surface-800 text-gray-500 hover:text-gray-300"),children:"All"}),I.slice(0,10).map(e=>(0,r.jsxs)("button",{onClick:()=>p(u===e?null:e),className:"rounded-full px-2 py-0.5 text-[10px] font-medium transition-colors ".concat(u===e?"bg-primary-500/15 text-primary-400":"bg-surface-800 text-gray-500 hover:text-gray-300"),children:[e," ",(0,r.jsx)("span",{className:"text-gray-600",children:H[e]})]},e))]}),(0,r.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto px-2 pb-2",children:g?(0,r.jsx)(d.G,{rows:6}):j?(0,r.jsx)("div",{className:"p-3",children:(0,r.jsx)("p",{className:"text-xs text-red-400",children:j})}):0===f.length?(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(0,r.jsx)("p",{className:"text-sm text-gray-500",children:"No entries found"}),u&&(0,r.jsx)("button",{onClick:()=>p(null),className:"mt-2 text-xs text-primary-400 hover:text-primary-300",children:"Clear filter"})]}):(0,r.jsx)("div",{className:"space-y-0.5",children:f.map(e=>(0,r.jsx)(w,{entry:e,selected:e.sha===m,onSelect:()=>Z(e.sha)},e.sha))})})]}),(0,r.jsx)("div",{className:"flex-1 min-w-0 rounded-xl border border-white/[0.06] bg-surface-900 p-5 overflow-hidden flex flex-col ".concat(D&&m?"flex":"hidden lg:flex"),children:m?(0,r.jsx)(y,{sha:m}):(0,r.jsxs)("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[(0,r.jsx)("svg",{className:"h-10 w-10 text-gray-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})}),(0,r.jsx)("p",{className:"mt-3 text-sm text-gray-500",children:"Select an entry to view details"}),(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-600",children:"Click an entry on the left to view its full commit details, enrichment data, and transcript."})]})})]})]})}function L(){let{status:e,loading:t,refresh:s}=(0,i.uX)(),[n,l]=(0,a.useState)(null);if(t)return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-xl font-semibold text-white",children:"History"}),(0,r.jsx)("p",{className:"mt-1 text-sm text-gray-400",children:"Shadow branch timeline of coding sessions."})]}),(0,r.jsx)(d.G,{rows:5})]});if(!e)return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-xl font-semibold text-white",children:"History"}),(0,r.jsx)("p",{className:"mt-1 text-sm text-gray-400",children:"Shadow branch timeline of coding sessions."})]}),(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 the History API. Make sure the ULPI server is running."})})]});let c=null!=n?n:e.exists?0===e.totalEntries?"empty":"active":"init";return"init"===c?(0,r.jsx)(v,{onInitialized:()=>{l("empty"),s()}}):"empty"===c?(0,r.jsx)(N,{onBackfilled:()=>{l("active"),s()}}):(0,r.jsx)(C,{})}}},e=>{e.O(0,[5935,380,814,9743,7358],()=>e(e.s=452)),_N_E=e.O()}]);
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3845],{452:(e,t,s)=>{Promise.resolve().then(s.bind(s,9896))},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})]})}},4736:(e,t,s)=>{"use strict";var r=s(1504);s.o(r,"useParams")&&s.d(t,{useParams:function(){return r.useParams}}),s.o(r,"usePathname")&&s.d(t,{usePathname:function(){return r.usePathname}}),s.o(r,"useRouter")&&s.d(t,{useRouter:function(){return r.useRouter}}),s.o(r,"useSearchParams")&&s.d(t,{useSearchParams:function(){return r.useSearchParams}})},9896:(e,t,s)=>{"use strict";s.r(t),s.d(t,{default:()=>L});var r=s(8111),a=s(5271),n=s(4736),l=s(3446),i=s(4401),c=s(5935),o=s.n(c),d=s(3951),x=s(250);let m={A:"bg-emerald-500/15 text-emerald-400",M:"bg-blue-500/15 text-blue-400",D:"bg-red-500/15 text-red-400",R:"bg-amber-500/15 text-amber-400",C:"bg-violet-500/15 text-violet-400"},h={A:"Added",M:"Modified",D:"Deleted",R:"Renamed",C:"Copied"};function u(e){let{entry:t}=e;return(0,r.jsxs)("div",{className:"flex flex-wrap gap-1.5",children:[t.hasSession&&(0,r.jsx)("span",{className:"inline-flex items-center rounded-full bg-cyan-500/15 px-2 py-0.5 text-[10px] font-medium text-cyan-400",children:"Session"}),t.hasEnrichment&&(0,r.jsx)("span",{className:"inline-flex items-center rounded-full bg-violet-500/15 px-2 py-0.5 text-[10px] font-medium text-violet-400",children:"AI"}),t.hasTranscript&&(0,r.jsx)("span",{className:"inline-flex items-center rounded-full bg-emerald-500/15 px-2 py-0.5 text-[10px] font-medium text-emerald-400",children:"Transcript"}),t.hasReviewPlans&&(0,r.jsx)("span",{className:"inline-flex items-center rounded-full bg-amber-500/15 px-2 py-0.5 text-[10px] font-medium text-amber-400",children:"Review"})]})}function p(e){let{turn:t}=e,[s,n]=(0,a.useState)(!1),l="tool_use"===t.type?t.toolInput:t.content,i=null!=l&&l.length>2e3,c=i?l.slice(0,2e3):l;return(0,r.jsxs)("div",{children:[(0,r.jsxs)("button",{onClick:()=>n(!s),className:"inline-flex items-center gap-1 rounded-md px-1.5 py-0.5 text-[10px] font-medium text-cyan-400 bg-cyan-500/10 border border-cyan-500/15 transition-colors hover:bg-cyan-500/15",children:[(0,r.jsx)("svg",{className:"h-2.5 w-2.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m6.75 7.5 3 2.25-3 2.25m4.5 0h3"})}),"tool_use"===t.type?t.toolName:"Result",(0,r.jsx)("svg",{className:"h-2.5 w-2.5 text-cyan-500/60 transition-transform ".concat(s?"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 8.25-7.5 7.5-7.5-7.5"})})]}),s&&c&&(0,r.jsxs)("pre",{className:"mt-1 overflow-x-auto whitespace-pre-wrap font-mono text-[10px] text-gray-500 max-h-24 overflow-y-auto rounded border border-white/[0.03] bg-surface-950 p-2",children:[c,i&&"\n... (truncated)"]})]})}function f(e){let{turn:t}=e;if("tool_use"===t.type||"tool_result"===t.type)return(0,r.jsx)(p,{turn:t});let s="human"===t.type;return(0,r.jsxs)("div",{className:"rounded-lg border-l-2 px-3 py-2 ".concat(s?"border-l-primary-500 bg-surface-800/40 border border-l-2 border-white/[0.03]":"border-l-violet-500 bg-surface-900/60 border border-l-2 border-white/[0.04]"),children:[(0,r.jsx)("span",{className:"text-[10px] font-medium ".concat(s?"text-primary-400":"text-violet-400"),children:s?"You":"Assistant"}),(0,r.jsx)("p",{className:"mt-0.5 whitespace-pre-wrap text-[10px] text-gray-400 leading-relaxed max-h-20 overflow-y-auto",children:t.content.length>500?t.content.slice(0,500)+"...":t.content})]})}function g(e){let{sha:t}=e,{transcript:s,loading:n}=(0,i.oI)(t),[l,c]=(0,a.useState)(!1);if(n)return(0,r.jsx)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/50 p-3",children:(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 transcript..."]})});if(!s)return null;let d=(0,x.K9)(s);if(!d||0===d.length)return null;let m=d.filter(e=>"human"===e.type).length,h=d.filter(e=>"assistant"===e.type).length,u=d.filter(e=>"tool_use"===e.type||"tool_result"===e.type).length;return(0,r.jsxs)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/30 overflow-hidden",children:[(0,r.jsxs)("button",{onClick:()=>c(!l),className:"flex w-full items-center justify-between px-4 py-3 text-left transition-colors hover:bg-white/[0.02]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("svg",{className:"h-3.5 w-3.5 text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.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.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.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"})}),(0,r.jsx)("span",{className:"text-xs font-medium text-gray-300",children:"Transcript"}),(0,r.jsxs)("span",{className:"text-[10px] text-gray-600",children:[d.length," turn",1!==d.length?"s":""," ","(",m," user, ",h," assistant, ",u," tool)"]})]}),(0,r.jsx)("svg",{className:"h-3.5 w-3.5 text-gray-600 transition-transform ".concat(l?"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 8.25-7.5 7.5-7.5-7.5"})})]}),l&&(0,r.jsxs)("div",{className:"border-t border-white/[0.04] px-4 py-3 max-h-96 overflow-y-auto space-y-1.5",children:[d.slice(0,50).map((e,t)=>(0,r.jsx)(f,{turn:e},t)),d.length>50&&(0,r.jsxs)("p",{className:"py-2 text-center text-[10px] text-gray-600",children:["Showing 50 of ",d.length," turns."," ",(0,r.jsx)(o(),{href:"/history/".concat(t,"/transcript"),className:"text-primary-400 hover:text-primary-300",children:"View full transcript"})]})]})]})}function j(e){var t;let{plan:s}=e,[n,l]=(0,a.useState)(!1),i=null==(t=s.decision)?void 0:t.behavior,c="approve"===i?"approved":"deny"===i?"denied":null;return(0,r.jsxs)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/30 overflow-hidden",children:[(0,r.jsxs)("button",{onClick:()=>l(!n),className:"flex w-full items-center justify-between px-3 py-2.5 text-left transition-colors hover:bg-white/[0.02]",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)("svg",{className:"h-3.5 w-3.5 text-amber-400 shrink-0",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15c1.012 0 1.867.668 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25Z"})}),(0,r.jsx)("span",{className:"text-xs font-medium text-gray-300 truncate",children:s.title||s.slug||"Review Plan"}),c&&(0,r.jsx)("span",{className:"rounded-full px-1.5 py-px text-[9px] font-medium ".concat("approve"===i?"text-emerald-400 bg-emerald-500/15":"deny"===i?"text-red-400 bg-red-500/15":"text-amber-400 bg-amber-500/15"),children:c})]}),(0,r.jsx)("svg",{className:"h-3 w-3 text-gray-600 transition-transform shrink-0 ".concat(n?"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 8.25-7.5 7.5-7.5-7.5"})})]}),n&&s.plan&&(0,r.jsx)("div",{className:"border-t border-white/[0.04] px-3 py-3 max-h-64 overflow-y-auto",children:(0,r.jsx)("pre",{className:"whitespace-pre-wrap text-[11px] text-gray-400 leading-relaxed font-mono",children:s.plan})})]})}function y(e){let{sha:t}=e,s=(0,l.yC)(),{entry:n,loading:c,refresh:x}=(0,i.O4)(t),{enrichmentStatus:p,refresh:f}=(0,i.hh)(),[y,b]=(0,a.useState)(!1),[v,N]=(0,a.useState)(null),w=(0,a.useRef)(null);(0,a.useEffect)(()=>{if(y)return w.current=setInterval(()=>{f()},2e3),()=>{w.current&&clearInterval(w.current)}},[y,f]),(0,a.useEffect)(()=>{if(y&&p&&("done"===p.status||"error"===p.status||"idle"===p.status)){if(b(!1),"error"===p.status){var e;N(null!=(e=p.error)?e:"Enrichment failed")}x()}},[p,y,x]);let k=(0,a.useCallback)(async()=>{if(!y){b(!0),N(null);try{await (0,i.W7)(s,t),f()}catch(e){N(e instanceof Error?e.message:"Enrichment failed"),b(!1)}}},[s,t,y,f]);if(c)return(0,r.jsx)(d.G,{rows:4});if(!n)return(0,r.jsxs)("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[(0,r.jsx)("svg",{className:"h-10 w-10 text-gray-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 9v3.75m9-.75a9 9 0 1 1-18 0 9 9 0 0 1 18 0Zm-9 3.75h.008v.008H12v-.008Z"})}),(0,r.jsx)("p",{className:"mt-3 text-sm text-gray-500",children:"Entry not found"}),(0,r.jsxs)("p",{className:"mt-1 text-xs text-gray-600",children:["Could not load entry for SHA ",t.slice(0,8),"."]})]});let C=n.sha.slice(0,8);return(0,r.jsxs)("div",{className:"flex flex-col h-full min-h-0 overflow-y-auto",children:[(0,r.jsxs)("div",{className:"shrink-0",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-3",children:[(0,r.jsxs)("div",{className:"min-w-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2",children:[(0,r.jsx)("span",{className:"font-mono text-sm font-medium text-amber-400",children:C}),(0,r.jsx)(u,{entry:n})]}),n.subject&&(0,r.jsx)("p",{className:"mt-1.5 text-sm text-gray-200",children:n.subject})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[n.hasTranscript&&(0,r.jsxs)(o(),{href:"/history/".concat(t,"/transcript"),className:"inline-flex items-center gap-1.5 rounded-lg border border-white/[0.08] bg-surface-800 px-2.5 py-1.5 text-[11px] font-medium text-gray-300 transition-colors hover:bg-surface-750 hover:text-white",children:[(0,r.jsx)("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M13.5 6H5.25A2.25 2.25 0 0 0 3 8.25v10.5A2.25 2.25 0 0 0 5.25 21h10.5A2.25 2.25 0 0 0 18 18.75V10.5m-10.5 6L21 3m0 0h-5.25M21 3v5.25"})}),"Full Transcript"]}),!n.hasEnrichment&&(0,r.jsx)("button",{onClick:()=>void k(),disabled:y,className:"inline-flex items-center gap-1.5 rounded-lg px-2.5 py-1.5 text-[11px] font-semibold text-white transition-colors disabled:cursor-not-allowed ".concat(y?"bg-primary-500/60":"bg-primary-500 hover:bg-primary-600"),children:y?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"h-3 w-3 animate-spin rounded-full border-2 border-white border-t-transparent"}),(null==p?void 0:p.status)==="enriching"&&p.total>0?"".concat(p.completed,"/").concat(p.total):"Enriching..."]}):(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 0 0-2.455 2.456ZM16.894 20.567 16.5 21.75l-.394-1.183a2.25 2.25 0 0 0-1.423-1.423L13.5 18.75l1.183-.394a2.25 2.25 0 0 0 1.423-1.423l.394-1.183.394 1.183a2.25 2.25 0 0 0 1.423 1.423l1.183.394-1.183.394a2.25 2.25 0 0 0-1.423 1.423Z"})}),"Enrich with AI"]})})]})]}),v&&(0,r.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:v})]}),(0,r.jsxs)("div",{className:"mt-4 grid grid-cols-2 gap-x-4 gap-y-1 text-xs shrink-0",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"Date "}),(0,r.jsx)("span",{className:"text-gray-300",children:function(e){let t=new Date(e);return isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{weekday:"short",month:"short",day:"numeric",year:"numeric",hour:"2-digit",minute:"2-digit"})}(n.date)})]}),null!=n.filesChanged&&n.filesChanged>0&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"Files "}),(0,r.jsxs)("span",{className:"text-gray-300",children:[n.filesChanged," changed",null!=n.insertions&&(0,r.jsxs)("span",{className:"ml-1.5 text-emerald-400",children:["+",n.insertions]}),null!=n.deletions&&(0,r.jsxs)("span",{className:"ml-1 text-red-400",children:["-",n.deletions]})]})]}),n.duration&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"Duration "}),(0,r.jsx)("span",{className:"text-gray-300",children:n.duration})]}),n.branch&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"Branch "}),(0,r.jsx)("span",{className:"font-mono text-gray-300",children:n.branch})]}),n.authorName&&(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"Author "}),(0,r.jsx)("span",{className:"text-gray-300",children:n.authorName})]}),(0,r.jsxs)("div",{children:[(0,r.jsx)("span",{className:"text-gray-600",children:"SHA "}),(0,r.jsx)("span",{className:"font-mono text-gray-400",children:n.sha})]})]}),n.tags&&n.tags.length>0&&(0,r.jsx)("div",{className:"mt-3 flex flex-wrap gap-1 shrink-0",children:n.tags.map(e=>(0,r.jsx)("span",{className:"rounded-full bg-surface-800 px-2 py-0.5 text-[10px] text-gray-500",children:e},e))}),n.enrichment&&(0,r.jsxs)("div",{className:"mt-4 rounded-lg border border-violet-500/10 bg-violet-500/[0.04] p-4 shrink-0",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,r.jsx)("svg",{className:"h-3.5 w-3.5 text-violet-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09Z"})}),(0,r.jsx)("h4",{className:"text-xs font-semibold text-violet-300",children:"AI Enrichment"}),n.enrichment.complexity&&(0,r.jsx)("span",{className:"rounded-full bg-violet-500/15 px-2 py-0.5 text-[10px] font-medium text-violet-400",children:n.enrichment.complexity})]}),n.enrichment.summary&&(0,r.jsx)("p",{className:"text-xs text-gray-300 leading-relaxed",children:n.enrichment.summary}),(n.enrichment.intent||n.enrichment.outcome)&&(0,r.jsxs)("div",{className:"mt-3 grid grid-cols-2 gap-3",children:[n.enrichment.intent&&(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600 mb-1",children:"Intent"}),(0,r.jsx)("p",{className:"text-xs text-gray-400",children:n.enrichment.intent})]}),n.enrichment.outcome&&(0,r.jsxs)("div",{children:[(0,r.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600 mb-1",children:"Outcome"}),(0,r.jsx)("p",{className:"text-xs text-gray-400",children:n.enrichment.outcome})]})]}),n.enrichment.insights&&n.enrichment.insights.length>0&&(0,r.jsxs)("div",{className:"mt-3 space-y-1.5",children:[(0,r.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600",children:"Insights"}),n.enrichment.insights.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-start gap-2 text-xs",children:[(0,r.jsx)("span",{className:"mt-1 h-1 w-1 shrink-0 rounded-full bg-violet-400/50"}),(0,r.jsx)("span",{className:"text-gray-400",children:e})]},t))]}),n.enrichment.challenges&&n.enrichment.challenges.length>0&&(0,r.jsxs)("div",{className:"mt-3 space-y-1.5",children:[(0,r.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600",children:"Challenges"}),n.enrichment.challenges.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-start gap-2 text-xs",children:[(0,r.jsx)("span",{className:"mt-1 h-1 w-1 shrink-0 rounded-full bg-amber-400/50"}),(0,r.jsx)("span",{className:"text-gray-400",children:e})]},t))]}),n.enrichment.recommendations&&n.enrichment.recommendations.length>0&&(0,r.jsxs)("div",{className:"mt-3 space-y-1.5",children:[(0,r.jsx)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600",children:"Recommendations"}),n.enrichment.recommendations.map((e,t)=>(0,r.jsxs)("div",{className:"flex items-start gap-2 text-xs",children:[(0,r.jsx)("span",{className:"mt-1 h-1 w-1 shrink-0 rounded-full bg-emerald-400/50"}),(0,r.jsx)("span",{className:"text-gray-400",children:e})]},t))]})]}),!n.enrichment&&n.summary&&(0,r.jsxs)("div",{className:"mt-4 rounded-lg border border-white/[0.04] bg-surface-800/30 p-4 shrink-0",children:[(0,r.jsx)("p",{className:"text-xs font-medium text-gray-500 mb-1.5",children:"Summary"}),(0,r.jsx)("p",{className:"text-xs text-gray-300 leading-relaxed",children:n.summary})]}),n.files&&n.files.length>0&&(0,r.jsxs)("div",{className:"mt-4 shrink-0",children:[(0,r.jsxs)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600 mb-2",children:["Files Changed (",n.files.length,")"]}),(0,r.jsx)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/30 overflow-hidden divide-y divide-white/[0.03]",children:n.files.map(e=>{var t,s,a,n;let l=null!=(t=m[e.status])?t:"bg-gray-500/15 text-gray-400",i="number"==typeof e.additions||"number"==typeof e.deletions,c=null!=(s=e.additions)?s:0,o=null!=(a=e.deletions)?a:0,d=c+o,x=Math.min(d,30),u=d>0?Math.round(c/d*x):0;return(0,r.jsxs)("div",{className:"flex items-center gap-2 px-3 py-1.5",children:[(0,r.jsx)("span",{className:"inline-flex w-5 items-center justify-center rounded px-0.5 py-px text-[9px] font-medium ".concat(l),children:e.status}),(0,r.jsx)("span",{className:"truncate font-mono text-[11px] text-gray-400 flex-1 min-w-0",title:e.oldPath?"".concat(e.oldPath," → ").concat(e.path):e.path,children:e.oldPath?(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("span",{className:"text-gray-600",children:e.oldPath}),(0,r.jsx)("span",{className:"text-gray-600",children:" → "}),e.path]}):e.path}),i&&(0,r.jsxs)("span",{className:"ml-auto flex items-center gap-1.5 shrink-0",children:[c>0&&(0,r.jsxs)("span",{className:"text-[10px] font-medium text-emerald-400",children:["+",c]}),o>0&&(0,r.jsxs)("span",{className:"text-[10px] font-medium text-red-400",children:["-",o]}),d>0&&(0,r.jsxs)("span",{className:"inline-flex gap-px",children:[Array.from({length:u},(e,t)=>(0,r.jsx)("span",{className:"inline-block h-2 w-[3px] rounded-[1px] bg-emerald-500/70"},"a".concat(t))),Array.from({length:x-u},(e,t)=>(0,r.jsx)("span",{className:"inline-block h-2 w-[3px] rounded-[1px] bg-red-500/70"},"d".concat(t)))]})]}),!i&&(0,r.jsx)("span",{className:"ml-auto shrink-0 text-[9px] text-gray-600",children:null!=(n=h[e.status])?n:e.status})]},e.path)})})]}),n.reviewPlans&&n.reviewPlans.length>0&&(0,r.jsxs)("div",{className:"mt-4 shrink-0",children:[(0,r.jsxs)("p",{className:"text-[10px] font-medium uppercase tracking-wider text-gray-600 mb-2",children:["Review Plans (",n.reviewPlans.length,")"]}),(0,r.jsx)("div",{className:"space-y-2",children:n.reviewPlans.map((e,t)=>(0,r.jsx)(j,{plan:e},e.slug||t))})]}),n.hasTranscript&&(0,r.jsxs)("div",{className:"mt-4 shrink-0",children:[(0,r.jsx)(g,{sha:t}),(0,r.jsx)("div",{className:"mt-2 text-right",children:(0,r.jsx)(o(),{href:"/history/".concat(t,"/transcript"),className:"text-[10px] text-primary-400 hover:text-primary-300 transition-colors",children:"Open full transcript page"})})]})]})}var b=s(4632);function v(e){let{onInitialized:t}=e,s=(0,l.yC)(),[n,c]=(0,a.useState)(!1),[o,d]=(0,a.useState)(!1),[x,m]=(0,a.useState)(null),h=(0,a.useCallback)(async()=>{d(!0),m(null);try{await (0,i.xy)(s,{collectReviewPlans:n}),t()}catch(e){m(e instanceof Error?e.message:"Failed to initialize history")}finally{d(!1)}},[s,n,t]);return(0,r.jsx)("div",{className:"flex h-[calc(100vh-120px)] items-center justify-center",children:(0,r.jsxs)("div",{className:"w-full max-w-md text-center",children:[(0,r.jsx)("div",{className:"mx-auto flex h-16 w-16 items-center justify-center rounded-2xl bg-surface-900 border border-white/[0.06]",children:(0,r.jsx)("svg",{className:"h-8 w-8 text-primary-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),(0,r.jsx)("h2",{className:"mt-5 text-lg font-semibold text-white",children:"Initialize History"}),(0,r.jsx)("p",{className:"mt-2 text-sm text-gray-400 max-w-sm mx-auto",children:"Set up the shadow branch to track your coding session history. This creates a dedicated git branch for structured records of each session."}),(0,r.jsx)("div",{className:"mt-6 flex items-center justify-center gap-2",children:(0,r.jsxs)("label",{className:"flex items-center gap-2 cursor-pointer",children:[(0,r.jsx)("input",{type:"checkbox",checked:n,onChange:e=>c(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:"Collect review plans"})]})}),x&&(0,r.jsx)("div",{className:"mt-4 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-4 py-2 text-xs text-red-400",children:x}),(0,r.jsxs)("button",{onClick:()=>void h(),disabled:o,className:"mt-5 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:[o?(0,r.jsx)("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent"}):(0,r.jsx)("svg",{className:"h-4 w-4",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"})}),"Initialize History"]})]})})}function N(e){let{onBackfilled:t}=e,s=(0,l.yC)(),[n,c]=(0,a.useState)(!1),[o,d]=(0,a.useState)(null),[x,m]=(0,a.useState)(null),h=(0,a.useCallback)(async()=>{c(!0),m(null);try{let e=await (0,i.RK)(s,{limit:50});d({captured:e.captured,skipped:e.skipped}),e.captured>0&&t()}catch(e){m(e instanceof Error?e.message:"Backfill failed")}finally{c(!1)}},[s,t]);return(0,r.jsx)("div",{className:"flex h-[calc(100vh-120px)] items-center justify-center",children:(0,r.jsxs)("div",{className:"w-full max-w-md text-center",children:[(0,r.jsx)(b.p,{title:"No history entries yet",description:"History is initialized but empty. Backfill from recent commits to populate your timeline.",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:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})}),x&&(0,r.jsx)("div",{className:"mt-4 rounded-lg border border-red-500/20 bg-red-500/[0.06] px-4 py-2 text-xs text-red-400",children:x}),o&&(0,r.jsxs)("div",{className:"mt-4 rounded-lg border border-emerald-500/20 bg-emerald-500/[0.06] px-4 py-2 text-xs text-emerald-400",children:["Captured ",o.captured," entries, skipped ",o.skipped,"."]}),(0,r.jsxs)("button",{onClick:()=>void h(),disabled:n,className:"mt-5 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:[n?(0,r.jsx)("span",{className:"h-4 w-4 animate-spin rounded-full border-2 border-white border-t-transparent"}):(0,r.jsx)("svg",{className:"h-4 w-4",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"})}),"Backfill Recent Commits"]})]})})}function w(e){let{entry:t,selected:s,onSelect:a}=e;return(0,r.jsxs)("button",{onClick:a,className:"w-full text-left rounded-lg px-3 py-2.5 transition-colors ".concat(s?"bg-primary-500/10 border border-primary-500/30":"border border-transparent hover:bg-white/[0.03]"),children:[(0,r.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,r.jsxs)("div",{className:"flex items-center gap-2 min-w-0",children:[(0,r.jsx)("span",{className:"font-mono text-xs text-amber-400 shrink-0",children:t.shortSha||t.sha.slice(0,7)}),(0,r.jsx)("span",{className:"text-[10px] text-gray-600 shrink-0",children:function(e){let t=new Date(e);return isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{month:"short",day:"numeric"})}(t.date)})]}),t.filesChanged>0&&(0,r.jsxs)("span",{className:"text-[10px] text-gray-600 shrink-0",children:[t.filesChanged,"f"]})]}),(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-300 truncate",children:t.subject||"No subject"}),(0,r.jsxs)("div",{className:"mt-1.5 flex flex-wrap gap-1",children:[t.hasSession&&(0,r.jsx)("span",{className:"rounded-full bg-cyan-500/15 px-1.5 py-px text-[9px] font-medium text-cyan-400",children:"Session"}),t.hasEnrichment&&(0,r.jsx)("span",{className:"rounded-full bg-violet-500/15 px-1.5 py-px text-[9px] font-medium text-violet-400",children:"AI"}),t.hasTranscript&&(0,r.jsx)("span",{className:"rounded-full bg-emerald-500/15 px-1.5 py-px text-[9px] font-medium text-emerald-400",children:"Transcript"}),t.hasReviewPlans&&(0,r.jsx)("span",{className:"rounded-full bg-amber-500/15 px-1.5 py-px text-[9px] font-medium text-amber-400",children:"Review"})]})]})}function k(e){let{refreshKey:t}=e,s=(0,l.yC)(),{enrichmentStatus:n,refresh:c}=(0,i.hh)();if((0,a.useEffect)(()=>{t>0&&c()},[t]),(0,a.useEffect)(()=>{if((null==n?void 0:n.status)!=="enriching")return;let e=setInterval(()=>void c(),3e3);return()=>clearInterval(e)},[null==n?void 0:n.status,c]),!n||"idle"===n.status)return null;let o=async()=>{await (0,i.J)(s),c()};if("enriching"===n.status){let e=n.total>0?Math.round(n.completed/n.total*100):0;return(0,r.jsxs)("div",{className:"rounded-lg border border-primary-500/20 bg-primary-500/[0.06] p-3",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:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}),(0,r.jsx)("span",{className:"text-xs font-medium text-primary-400",children:"Enriching..."})]}),(0,r.jsxs)("span",{className:"text-[10px] text-gray-500",children:[n.completed," / ",n.total," (",e,"%)"]})]}),n.total>0&&(0,r.jsx)("div",{className:"mt-2 h-1.5 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",style:{width:"".concat(e,"%")}})})]})}if("done"===n.status)return(0,r.jsxs)("div",{className:"flex items-center justify-between rounded-lg border border-emerald-500/20 bg-emerald-500/[0.06] px-3 py-2",children:[(0,r.jsxs)("span",{className:"text-xs text-emerald-400",children:["Enrichment complete. ",n.completed," enriched",n.failed>0&&", ".concat(n.failed," failed"),"."]}),(0,r.jsx)("button",{onClick:()=>void o(),className:"text-[10px] text-emerald-400/70 hover:text-emerald-400 transition-colors",children:"Dismiss"})]});if("error"===n.status){var d;return(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",children:[(0,r.jsxs)("span",{className:"text-xs text-red-400",children:["Enrichment failed: ",null!=(d=n.error)?d:"Unknown error"]}),(0,r.jsx)("button",{onClick:()=>void o(),className:"text-[10px] text-red-400/70 hover:text-red-400 transition-colors",children:"Dismiss"})]})}return null}function C(){var e,t,s;let c=(0,l.yC)(),o=(0,n.useRouter)(),x=(0,n.useSearchParams)(),m=x?x.get("sha"):null,{stats:h}=(0,i.zg)(),[u,p]=(0,a.useState)(null),{entries:f,loading:g,error:j,refresh:b}=(0,i._q)(null!=u?u:void 0),[v,N]=(0,a.useState)(!1),[C,L]=(0,a.useState)(!1),[S,M]=(0,a.useState)(!1),[E,A]=(0,a.useState)(0),R=f.length,B=(null==h||null==(e=h.dateRange)?void 0:e.from)&&(null==h||null==(t=h.dateRange)?void 0:t.to)?function(e,t){let s=new Date(e),r=new Date(t);if(isNaN(s.getTime())||isNaN(r.getTime()))return"";let a={month:"short",day:"numeric",year:"numeric"};return"".concat(s.toLocaleDateString(void 0,a)," - ").concat(r.toLocaleDateString(void 0,a))}(h.dateRange.from,h.dateRange.to):null,P=h?Math.round(h.enrichmentCoverage):null,W=h?Math.round(10*h.avgFilesChanged)/10:null,H=null!=(s=null==h?void 0:h.tagCounts)?s:{},I=(0,a.useMemo)(()=>Object.entries(H).sort((e,t)=>{let[,s]=e,[,r]=t;return r-s}).map(e=>{let[t]=e;return t}),[H]),[D,T]=(0,a.useState)(!1);(0,a.useEffect)(()=>{m&&T(!0)},[m]);let Z=(0,a.useCallback)(e=>{o.push("/history?sha=".concat(encodeURIComponent(e)),{scroll:!1})},[o]),_=(0,a.useCallback)(async()=>{N(!0);try{await (0,i.RK)(c,{limit:50}),b()}catch(e){}finally{N(!1)}},[c,b]),V=(0,a.useCallback)(async()=>{L(!0);try{let e=await (0,i.bj)(c),t=new Blob([JSON.stringify(e,null,2)],{type:"application/json"}),s=URL.createObjectURL(t),r=document.createElement("a");r.href=s,r.download="ulpi-history-export.json",r.click(),URL.revokeObjectURL(s)}catch(e){}finally{L(!1)}},[c]),F=(0,a.useCallback)(async()=>{M(!0);try{await (0,i.W7)(c),A(e=>e+1)}catch(e){}finally{M(!1)}},[c]),O=(0,a.useCallback)(()=>{T(!1),o.push("/history",{scroll:!1})},[o]);return(0,r.jsxs)("div",{className:"flex flex-col h-[calc(100vh-32px)]",children:[(0,r.jsxs)("div",{className:"flex items-start justify-between gap-4 shrink-0",children:[(0,r.jsxs)("div",{children:[(0,r.jsxs)("div",{className:"flex items-center gap-3",children:[D&&m&&(0,r.jsx)("button",{onClick:O,className:"lg:hidden rounded-lg p-1.5 text-gray-500 transition-colors hover:bg-white/[0.06] hover:text-gray-300",children:(0,r.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5 8.25 12l7.5-7.5"})})}),(0,r.jsx)("h1",{className:"text-xl font-semibold text-white",children:"History"}),(0,r.jsxs)("span",{className:"text-xs text-gray-600",children:[R," entr",1===R?"y":"ies"]})]}),B&&(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-500",children:B})]}),(0,r.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[(0,r.jsxs)("button",{onClick:()=>void _(),disabled:v,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:[v?(0,r.jsx)("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}):(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"})}),"Backfill"]}),(0,r.jsxs)("button",{onClick:()=>void V(),disabled:C,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:[C?(0,r.jsx)("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}):(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"})}),"Export"]})]})]}),(0,r.jsx)("div",{className:"mt-3 shrink-0",children:(0,r.jsx)(k,{refreshKey:E})}),(0,r.jsxs)("div",{className:"flex gap-4 flex-1 min-h-0 mt-4",children:[(0,r.jsxs)("div",{className:"w-80 min-w-[280px] max-w-[360px] shrink-0 flex flex-col rounded-xl border border-white/[0.06] bg-surface-900 overflow-hidden ".concat(D&&m?"hidden lg:flex":"flex"),children:[(0,r.jsxs)("div",{className:"grid grid-cols-3 gap-1.5 p-3 shrink-0",children:[(0,r.jsxs)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/50 p-2 text-center",children:[(0,r.jsx)("p",{className:"text-sm font-semibold text-white",children:R}),(0,r.jsx)("p",{className:"text-[9px] text-gray-600",children:"Entries"})]}),(0,r.jsxs)("button",{onClick:()=>void F(),disabled:S,className:"rounded-lg border p-2 text-center transition-colors group ".concat(S?"border-primary-500/20 bg-primary-500/[0.06]":"border-white/[0.04] bg-surface-800/50 hover:bg-surface-800"),title:"Enrich all entries with AI",children:[S?(0,r.jsx)("span",{className:"flex items-center justify-center h-5",children:(0,r.jsx)("span",{className:"h-3.5 w-3.5 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"})}):(0,r.jsx)("p",{className:"text-sm font-semibold text-white",children:null!=P?"".concat(P,"%"):"--"}),(0,r.jsx)("p",{className:"text-[9px] transition-colors ".concat(S?"text-primary-400":"text-gray-600 group-hover:text-violet-400"),children:S?"Enriching...":"AI Enriched"})]}),(0,r.jsxs)("div",{className:"rounded-lg border border-white/[0.04] bg-surface-800/50 p-2 text-center",children:[(0,r.jsx)("p",{className:"text-sm font-semibold text-white",children:null!=W?W:"--"}),(0,r.jsx)("p",{className:"text-[9px] text-gray-600",children:"Avg Files"})]})]}),I.length>0&&(0,r.jsxs)("div",{className:"flex flex-wrap gap-1 px-3 pb-2 shrink-0",children:[(0,r.jsx)("button",{onClick:()=>p(null),className:"rounded-full px-2 py-0.5 text-[10px] font-medium transition-colors ".concat(null===u?"bg-primary-500/15 text-primary-400":"bg-surface-800 text-gray-500 hover:text-gray-300"),children:"All"}),I.slice(0,10).map(e=>(0,r.jsxs)("button",{onClick:()=>p(u===e?null:e),className:"rounded-full px-2 py-0.5 text-[10px] font-medium transition-colors ".concat(u===e?"bg-primary-500/15 text-primary-400":"bg-surface-800 text-gray-500 hover:text-gray-300"),children:[e," ",(0,r.jsx)("span",{className:"text-gray-600",children:H[e]})]},e))]}),(0,r.jsx)("div",{className:"flex-1 min-h-0 overflow-y-auto px-2 pb-2",children:g?(0,r.jsx)(d.G,{rows:6}):j?(0,r.jsx)("div",{className:"p-3",children:(0,r.jsx)("p",{className:"text-xs text-red-400",children:j})}):0===f.length?(0,r.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center",children:[(0,r.jsx)("p",{className:"text-sm text-gray-500",children:"No entries found"}),u&&(0,r.jsx)("button",{onClick:()=>p(null),className:"mt-2 text-xs text-primary-400 hover:text-primary-300",children:"Clear filter"})]}):(0,r.jsx)("div",{className:"space-y-0.5",children:f.map(e=>(0,r.jsx)(w,{entry:e,selected:e.sha===m,onSelect:()=>Z(e.sha)},e.sha))})})]}),(0,r.jsx)("div",{className:"flex-1 min-w-0 rounded-xl border border-white/[0.06] bg-surface-900 p-5 overflow-hidden flex flex-col ".concat(D&&m?"flex":"hidden lg:flex"),children:m?(0,r.jsx)(y,{sha:m}):(0,r.jsxs)("div",{className:"flex h-full flex-col items-center justify-center text-center",children:[(0,r.jsx)("svg",{className:"h-10 w-10 text-gray-700",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,r.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})}),(0,r.jsx)("p",{className:"mt-3 text-sm text-gray-500",children:"Select an entry to view details"}),(0,r.jsx)("p",{className:"mt-1 text-xs text-gray-600",children:"Click an entry on the left to view its full commit details, enrichment data, and transcript."})]})})]})]})}function L(){let{status:e,loading:t,refresh:s}=(0,i.uX)(),[n,l]=(0,a.useState)(null);if(t)return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-xl font-semibold text-white",children:"History"}),(0,r.jsx)("p",{className:"mt-1 text-sm text-gray-400",children:"Shadow branch timeline of coding sessions."})]}),(0,r.jsx)(d.G,{rows:5})]});if(!e)return(0,r.jsxs)("div",{className:"space-y-6",children:[(0,r.jsxs)("div",{children:[(0,r.jsx)("h1",{className:"text-xl font-semibold text-white",children:"History"}),(0,r.jsx)("p",{className:"mt-1 text-sm text-gray-400",children:"Shadow branch timeline of coding sessions."})]}),(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 the History API. Make sure the ULPI server is running."})})]});let c=null!=n?n:e.exists?0===e.totalEntries?"empty":"active":"init";return"init"===c?(0,r.jsx)(v,{onInitialized:()=>{l("empty"),s()}}):"empty"===c?(0,r.jsx)(N,{onBackfilled:()=>{l("active"),s()}}):(0,r.jsx)(a.Suspense,{fallback:(0,r.jsx)(d.G,{rows:5}),children:(0,r.jsx)(C,{})})}}},e=>{e.O(0,[5935,380,814,9743,7358],()=>e(e.s=452)),_N_E=e.O()}]);
|
package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/layout-4232b69653c5fbbf.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9305],{422:(e,t,r)=>{"use strict";function s(){{let e=window.location.hostname;return"localhost"===e||"127.0.0.1"===e}}function n(){return s(),"http://localhost:9800"}r.d(t,{J:()=>s,h:()=>n})},1270:(e,t,r)=>{Promise.resolve().then(r.bind(r,8535))},3446:(e,t,r)=>{"use strict";r.d(t,{Kv:()=>c,HI:()=>u,Xk:()=>d,yC:()=>h});var s=r(8111),n=r(5271),o=r(422),a=r(7811);class l{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 s=a.env.NEXT_PUBLIC_ULPI_API_SECRET,n=await fetch(r,{...t,headers:{"Content-Type":"application/json",...s?{"X-Ulpi-Secret":s}:{},...null==t?void 0:t.headers}});if(!n.ok)throw Error((await n.json().catch(()=>({error:n.statusText}))).error||"API error: ".concat(n.status));return n.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,o.h)()}}let i=(0,n.createContext)({mode:"cloud",localClient:null});function c(e){let{children:t}=e,r=(0,n.useMemo)(()=>{let e=(0,o.J)()?"local":"cloud";return{mode:e,localClient:"local"===e?new l:null}},[]);return(0,s.jsx)(i,{value:r,children:t})}function d(){return(0,n.useContext)(i).mode}function h(){let{localClient:e}=(0,n.useContext)(i);if(!e)throw Error("LocalApiClient not available in cloud mode");return e}function u(){return(0,n.useContext)(i)}},4736:(e,t,r)=>{"use strict";var s=r(1504);r.o(s,"useParams")&&r.d(t,{useParams:function(){return s.useParams}}),r.o(s,"usePathname")&&r.d(t,{usePathname:function(){return s.usePathname}}),r.o(s,"useRouter")&&r.d(t,{useRouter:function(){return s.useRouter}}),r.o(s,"useSearchParams")&&r.d(t,{useSearchParams:function(){return s.useSearchParams}})},8535:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>V});var s=r(8111),n=r(8934),o=r(3446),a=r(5271),l=r(422);let i=(0,a.createContext)({repos:[],selected:null,loading:!0,select:()=>{},refresh:async()=>{}}),c="ulpi_selected_repo";function d(){let e=new URLSearchParams(window.location.search).get("repo");if(e)return e;try{return localStorage.getItem(c)}catch(e){return null}}function h(e){try{localStorage.setItem(c,e)}catch(e){}let t=new URL(window.location.href);t.searchParams.set("repo",e),window.history.replaceState(window.history.state,"",t.toString())}function u(e){var t;let{children:r}=e,{localClient:n}=(0,o.HI)(),[c,u]=(0,a.useState)([]),[x,m]=(0,a.useState)(()=>d()),[p,f]=(0,a.useState)(!0),v=(0,a.useCallback)(async()=>{if(!n||!(0,l.J)())return void f(!1);try{var e,t,r;let s=n.repo;n.repo=null;let o=await n.get("/api/repos");n.repo=s;let a=null!=(e=o.repos)?e:[];if(u(a),x)if(a.find(e=>e.id===x))n.repo=x;else{let e=null!=(r=a.find(e=>e.isDefault))?r:a[0];e&&(m(e.id),n.repo=e.id,h(e.id))}else{let e=d(),r=e?a.find(t=>t.id===e):null,s=null!=(t=null!=r?r:a.find(e=>e.isDefault))?t:a[0];s&&(m(s.id),n.repo=s.id,h(s.id))}}catch(e){}finally{f(!1)}},[n,x]);(0,a.useEffect)(()=>{v()},[v]);let j=(0,a.useCallback)(e=>{m(e),n&&(n.repo=e),h(e)},[n]),g=null!=(t=c.find(e=>e.id===x))?t:null;return(0,s.jsx)(i,{value:{repos:c,selected:g,loading:p,select:j,refresh:v},children:r})}function x(){return(0,a.useContext)(i)}var m=r(2928),p=r(5935),f=r.n(p),v=r(4736);function j(){return(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 9V5.25A2.25 2.25 0 0 0 13.5 3h-6a2.25 2.25 0 0 0-2.25 2.25v13.5A2.25 2.25 0 0 0 7.5 21h6a2.25 2.25 0 0 0 2.25-2.25V15m3 0 3-3m0 0-3-3m3 3H9"})})}function g(){return(0,s.jsx)("svg",{className:"h-3 w-3 text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m19.5 8.25-7.5 7.5-7.5-7.5"})})}function k(){return(0,s.jsx)("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6.75h16.5M3.75 12h16.5m-16.5 5.25h16.5"})})}function w(){return(0,s.jsx)("svg",{className:"h-5 w-5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6 18 18 6M6 6l12 12"})})}function b(){return(0,s.jsx)("span",{className:"ml-auto rounded-full bg-primary-500/15 px-1.5 py-0.5 text-[9px] font-medium text-primary-400",children:"Cloud"})}let y=[{label:"Overview",items:[{label:"Dashboard",href:"/dashboard",icon:(0,s.jsx)(function(){return(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25a2.25 2.25 0 0 1-2.25-2.25v-2.25Z"})})},{}),shortcut:"D"}]},{label:"Execution",items:[{label:"PRD",href:"/prd",icon:(0,s.jsx)(function(){return(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.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.25m3.75 9v6m3-3H9m1.5-12H5.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"})})},{}),shortcut:"Q"},{label:"Loop",href:"/loop",icon:(0,s.jsx)(function(){return(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.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.182"})})},{}),shortcut:"L"},{label:"Parallel",href:"/parallel",icon:(0,s.jsx)(function(){return(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 7.5L7.5 3m0 0L12 7.5M7.5 3v13.5m13.5-6L16.5 15m0 0L12 10.5m4.5 4.5V1.5"})})},{}),shortcut:"A"},{label:"Jobs",href:"/jobs",icon:(0,s.jsx)(function(){return(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.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"})})},{}),shortcut:"J",cloudOnly:!0},{label:"Sprints",href:"/sprints",icon:(0,s.jsx)(function(){return(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 12h16.5m-16.5 3.75h16.5M3.75 19.5h16.5M5.625 4.5h12.75a1.875 1.875 0 0 1 0 3.75H5.625a1.875 1.875 0 0 1 0-3.75Z"})})},{}),shortcut:"X",cloudOnly:!0}]},{label:"Governance",items:[{label:"Rules",href:"/rules",icon:(0,s.jsx)(function(){return(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z"})})},{}),shortcut:"R"},{label:"Templates",href:"/templates",icon:(0,s.jsx)(function(){return(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.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.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.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"})})},{}),shortcut:"T"},{label:"Skills",href:"/skills",icon:(0,s.jsx)(function(){return(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.813 15.904 9 18.75l-.813-2.846a4.5 4.5 0 0 0-3.09-3.09L2.25 12l2.846-.813a4.5 4.5 0 0 0 3.09-3.09L9 5.25l.813 2.846a4.5 4.5 0 0 0 3.09 3.09L15.75 12l-2.846.813a4.5 4.5 0 0 0-3.09 3.09ZM18.259 8.715 18 9.75l-.259-1.035a3.375 3.375 0 0 0-2.455-2.456L14.25 6l1.036-.259a3.375 3.375 0 0 0 2.455-2.456L18 2.25l.259 1.035a3.375 3.375 0 0 0 2.455 2.456L21.75 6l-1.036.259a3.375 3.375 0 0 0-2.455 2.456Z"})})},{}),shortcut:"K"}]},{label:"Intelligence",items:[{label:"CodeMap",href:"/codemap",icon:(0,s.jsx)(function(){return(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.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"})})},{}),shortcut:"C"},{label:"Memory",href:"/memory",icon:(0,s.jsx)(function(){return(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 3v1.5M4.5 8.25H3m18 0h-1.5M4.5 12H3m18 0h-1.5m-15 3.75H3m18 0h-1.5M8.25 19.5V21M12 3v1.5m0 15V21m3.75-18v1.5m0 15V21m-9-1.5h10.5a2.25 2.25 0 0 0 2.25-2.25V6.75a2.25 2.25 0 0 0-2.25-2.25H6.75A2.25 2.25 0 0 0 4.5 6.75v10.5a2.25 2.25 0 0 0 2.25 2.25Z"})})},{}),shortcut:"M"},{label:"MCP Tools",href:"/mcps",icon:(0,s.jsx)(function(){return(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 0 1-.657.643 48.39 48.39 0 0 1-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 0 1-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 0 0-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 0 1-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 0 0 .657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 0 1-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 0 0 5.427-.63 48.05 48.05 0 0 0 .582-4.717.532.532 0 0 0-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.959.401v0a.656.656 0 0 0 .658-.663 48.422 48.422 0 0 0-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 0 1-.61-.58v0Z"})})},{}),shortcut:"I"}]},{label:"Monitoring",items:[{label:"Sessions",href:"/sessions",icon:(0,s.jsx)(function(){return(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 7.5l3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z"})})},{}),shortcut:"E"},{label:"History",href:"/history",icon:(0,s.jsx)(function(){return(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})})},{}),shortcut:"H"}]},{label:"Review",items:[{label:"Review Queue",href:"/review",icon:(0,s.jsx)(function(){return(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15a2.25 2.25 0 0 1 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25ZM6.75 12h.008v.008H6.75V12Zm0 3h.008v.008H6.75V15Zm0 3h.008v.008H6.75V18Z"})})},{}),shortcut:"V"}]},{label:"Repos",items:[{label:"Repos",href:"/repos",icon:(0,s.jsx)(function(){return(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 6.375c0 2.278-3.694 4.125-8.25 4.125S3.75 8.653 3.75 6.375m16.5 0c0-2.278-3.694-4.125-8.25-4.125S3.75 4.097 3.75 6.375m16.5 0v11.25c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125V6.375m16.5 0v3.75m-16.5-3.75v3.75m16.5 0v3.75C20.25 16.153 16.556 18 12 18s-8.25-1.847-8.25-4.125v-3.75m16.5 0c0 2.278-3.694 4.125-8.25 4.125s-8.25-1.847-8.25-4.125"})})},{}),shortcut:"P"}]},{label:"Settings",items:[{label:"Settings",href:"/settings",icon:(0,s.jsx)(function(){return(0,s.jsxs)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z"}),(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})]})},{}),shortcut:"S"},{label:"Notifications",href:"/notifications",icon:(0,s.jsx)(function(){return(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.857 17.082a23.848 23.848 0 0 0 5.454-1.31A8.967 8.967 0 0 1 18 9.75V9A6 6 0 0 0 6 9v.75a8.967 8.967 0 0 1-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 0 1-5.714 0m5.714 0a3 3 0 1 1-5.714 0"})})},{}),shortcut:"N"},{label:"Billing",href:"/billing",icon:(0,s.jsx)(function(){return(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 8.25h19.5M2.25 9h19.5m-16.5 5.25h6m-6 2.25h3m-3.75 3h15a2.25 2.25 0 0 0 2.25-2.25V6.75A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25v10.5A2.25 2.25 0 0 0 4.5 19.5Z"})})},{}),shortcut:"B",cloudOnly:!0}]}],N=["bg-primary-500","bg-blue-500","bg-emerald-500","bg-orange-500","bg-pink-500","bg-cyan-500"];function L(e){let t=0;for(let r=0;r<e.length;r++)t=e.charCodeAt(r)+((t<<5)-t);return N[Math.abs(t)%N.length]}function C(){var e;let t=(0,v.usePathname)(),{org:r,orgs:o,switchOrg:i,user:c,logout:d}=(0,n.As)(),{repos:h,selected:u,select:m}=x(),[p,N]=(0,a.useState)(!1),[C,M]=(0,a.useState)(!1),[A,H]=(0,a.useState)(!1),[B,V]=(0,a.useState)(!1),[W,P]=(0,a.useState)(!1),S=(0,l.J)(),Z=(0,s.jsxs)("div",{className:"flex h-full flex-col",children:[(0,s.jsxs)("div",{className:"relative border-b border-white/[0.06] px-3 py-3",children:[S&&!p&&(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("button",{onClick:()=>V(!B),className:"flex w-full items-center gap-2.5 rounded-lg px-2 py-1.5 transition-colors hover:bg-white/[0.04]",children:[(0,s.jsx)("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded bg-primary-500",children:(0,s.jsx)("span",{className:"text-[10px] font-bold text-white",children:u?u.name.charAt(0).toUpperCase():"U"})}),(0,s.jsx)("span",{className:"flex-1 truncate text-left text-sm font-medium text-gray-200",children:null!=(e=null==u?void 0:u.name)?e:"No repo"}),(0,s.jsx)("span",{className:"rounded-full bg-primary-500/20 px-1.5 py-0.5 text-[9px] font-medium text-primary-400",children:"Local"}),h.length>1&&(0,s.jsx)(g,{})]})}),S&&B&&!p&&h.length>1&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"fixed inset-0 z-10",onClick:()=>V(!1)}),(0,s.jsx)("div",{className:"absolute left-3 right-3 top-full z-20 mt-1 rounded-lg border border-white/[0.08] bg-surface-850 py-1 shadow-xl",children:h.map(e=>(0,s.jsxs)("button",{onClick:()=>{m(e.id),V(!1)},className:"flex w-full items-center gap-2.5 px-3 py-2 text-left text-sm transition-colors hover:bg-white/[0.04] ".concat(e.id===(null==u?void 0:u.id)?"text-white":"text-gray-400"),children:[(0,s.jsx)("div",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded ".concat(L(e.name)),children:(0,s.jsx)("span",{className:"text-[9px] font-bold text-white",children:e.name.charAt(0).toUpperCase()})}),(0,s.jsx)("span",{className:"flex-1 truncate",children:e.name}),(0,s.jsx)("span",{className:"truncate text-[10px] text-gray-600",children:e.path.split("/").pop()}),e.id===(null==u?void 0:u.id)&&(0,s.jsx)("svg",{className:"ml-auto h-3.5 w-3.5 shrink-0 text-primary-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 12.75 6 6 9-13.5"})})]},e.id))})]}),r&&!S&&(0,s.jsxs)("button",{onClick:()=>!p&&H(!A),className:"flex w-full items-center gap-2.5 rounded-lg px-2 py-1.5 transition-colors hover:bg-white/[0.04] ".concat(p?"justify-center":""),children:[(0,s.jsx)("div",{className:"flex h-6 w-6 shrink-0 items-center justify-center rounded ".concat(L(r.name)),children:(0,s.jsx)("span",{className:"text-[10px] font-bold text-white",children:r.name.charAt(0).toUpperCase()})}),!p&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"flex-1 truncate text-left text-sm font-medium text-gray-200",children:r.name}),(0,s.jsx)(g,{})]})]}),A&&!p&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"fixed inset-0 z-10",onClick:()=>H(!1)}),(0,s.jsxs)("div",{className:"absolute left-3 right-3 top-full z-20 mt-1 rounded-lg border border-white/[0.08] bg-surface-850 py-1 shadow-xl",children:[o.map(e=>(0,s.jsxs)("button",{onClick:()=>{i(e.id),H(!1)},className:"flex w-full items-center gap-2.5 px-3 py-2 text-left text-sm transition-colors hover:bg-white/[0.04] ".concat(e.id===(null==r?void 0:r.id)?"text-white":"text-gray-400"),children:[(0,s.jsx)("div",{className:"flex h-5 w-5 shrink-0 items-center justify-center rounded ".concat(L(e.name)),children:(0,s.jsx)("span",{className:"text-[9px] font-bold text-white",children:e.name.charAt(0).toUpperCase()})}),(0,s.jsx)("span",{className:"truncate",children:e.name}),e.id===(null==r?void 0:r.id)&&(0,s.jsx)("svg",{className:"ml-auto h-3.5 w-3.5 text-primary-400",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"m4.5 12.75 6 6 9-13.5"})})]},e.id)),(0,s.jsx)("div",{className:"border-t border-white/[0.06] mt-1 pt-1",children:(0,s.jsxs)("a",{href:"/settings/orgs/new",onClick:()=>H(!1),className:"flex w-full items-center gap-2.5 px-3 py-2 text-left text-sm text-gray-500 transition-colors hover:bg-white/[0.04] hover:text-gray-300",children:[(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"})}),(0,s.jsx)("span",{children:"Create organization"})]})})]})]})]}),(0,s.jsx)("nav",{className:"flex-1 overflow-y-auto px-3 pt-3 pb-2",children:y.map(e=>{let r=e.items.filter(e=>!0);return 0===r.length?null:(0,s.jsxs)("div",{className:"mt-4 first:mt-0",children:[!p&&(0,s.jsx)("p",{className:"mb-1.5 px-2 text-[10px] font-medium uppercase tracking-widest text-gray-600",children:e.label}),(0,s.jsx)("div",{className:"space-y-0.5",children:r.map(e=>{var r,n;let o=S&&e.cloudOnly,a=(r=e.href,!!t&&("/dashboard"===r?"/dashboard"===t:t.startsWith(r)));return o?(0,s.jsxs)("div",{className:"group flex items-center rounded-md text-sm opacity-50 pointer-events-none text-gray-500 ".concat(p?"justify-center px-1 py-2":"gap-2.5 px-2 py-1.5"),children:[(0,s.jsx)("span",{className:"text-gray-600 ".concat(p?"[&>svg]:h-8 [&>svg]:w-8":""),children:e.icon}),!p&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"flex-1",children:e.label}),(0,s.jsx)(b,{})]})]},e.href):(0,s.jsxs)(f(),{href:(n=e.href,S&&(null==u?void 0:u.id)?"".concat(n,"?repo=").concat(u.id):n),onClick:()=>M(!1),className:"group flex items-center rounded-md text-sm transition-colors ".concat(p?"justify-center px-1 py-2":"gap-2.5 px-2 py-1.5"," ").concat(a?p?"bg-white/[0.04] text-white":"border-l-2 border-primary-500 bg-white/[0.04] pl-[6px] text-white":"text-gray-400 hover:bg-white/[0.03] hover:text-gray-200"),children:[(0,s.jsx)("span",{className:"".concat(a?"text-primary-400":"text-gray-500 group-hover:text-gray-400"," ").concat(p?"[&>svg]:h-8 [&>svg]:w-8":""),children:e.icon}),!p&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("span",{className:"flex-1",children:e.label}),e.shortcut&&(0,s.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,s.jsx)("kbd",{className:"inline-flex h-4 min-w-[16px] items-center justify-center rounded border border-white/[0.06] bg-surface-800 px-1 text-[9px] font-medium text-gray-600 group-hover:text-gray-500",children:"⌘"}),(0,s.jsx)("kbd",{className:"inline-flex h-4 min-w-[16px] items-center justify-center rounded border border-white/[0.06] bg-surface-800 px-1 text-[9px] font-medium text-gray-600 group-hover:text-gray-500",children:e.shortcut})]})]})]},e.href)})})]},e.label)})}),c&&!p&&(0,s.jsx)("div",{className:"border-t border-white/[0.06] px-3 py-3",onMouseEnter:()=>P(!0),onMouseLeave:()=>P(!1),children:(0,s.jsxs)("div",{className:"flex items-center gap-2.5 rounded-md px-2 py-1.5",children:[c.avatar_url?(0,s.jsx)("img",{src:c.avatar_url,alt:c.name,className:"h-6 w-6 rounded-full"}):(0,s.jsx)("div",{className:"flex h-6 w-6 items-center justify-center rounded-full bg-surface-700 text-[10px] font-medium text-gray-300",children:c.name.charAt(0).toUpperCase()}),(0,s.jsx)("span",{className:"flex-1 truncate text-sm text-gray-300",children:c.name}),W&&(0,s.jsx)("button",{onClick:()=>void d(),className:"rounded p-1 text-gray-500 transition-colors hover:bg-white/[0.06] hover:text-gray-300",title:"Sign out",children:(0,s.jsx)(j,{})})]})}),(0,s.jsx)("div",{className:"hidden border-t border-white/[0.06] px-3 py-2 lg:block",children:(0,s.jsx)("button",{onClick:()=>N(!p),className:"flex w-full items-center justify-center rounded-md py-1 text-gray-600 transition-colors hover:bg-white/[0.03] hover:text-gray-400",children:(0,s.jsx)("svg",{className:"h-3.5 w-3.5 transition-transform ".concat(p?"rotate-180":""),fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15.75 19.5 8.25 12l7.5-7.5"})})})})]});return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{onClick:()=>M(!0),className:"fixed left-4 top-4 z-40 rounded-lg bg-surface-800 p-2 text-gray-400 shadow-lg lg:hidden",children:(0,s.jsx)(k,{})}),C&&(0,s.jsx)("div",{className:"fixed inset-0 z-40 bg-black/60 backdrop-blur-sm lg:hidden",onClick:()=>M(!1)}),(0,s.jsxs)("aside",{className:"fixed inset-y-0 left-0 z-50 w-60 border-r border-white/[0.06] bg-surface-900 transition-transform lg:hidden ".concat(C?"translate-x-0":"-translate-x-full"),children:[(0,s.jsx)("button",{onClick:()=>M(!1),className:"absolute right-3 top-3 rounded p-1 text-gray-500 hover:text-white",children:(0,s.jsx)(w,{})}),Z]}),(0,s.jsx)("aside",{className:"hidden shrink-0 border-r border-white/[0.06] bg-surface-900 lg:block ".concat(p?"w-12":"w-60"," transition-all duration-200"),children:Z})]})}function M(){return(0,s.jsx)("svg",{className:"h-4 w-4 text-gray-500",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.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"})})}function A(e){let{onClose:t}=e,r=(0,v.useRouter)(),n=(0,v.usePathname)(),[o,i]=(0,a.useState)(""),[c,d]=(0,a.useState)(0),h=(0,a.useRef)(null),u=(0,l.J)(),{selected:m}=x(),p=[{id:"dashboard",label:"Dashboard",category:"Pages",href:"/dashboard",icon:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 6A2.25 2.25 0 0 1 6 3.75h2.25A2.25 2.25 0 0 1 10.5 6v2.25a2.25 2.25 0 0 1-2.25 2.25H6a2.25 2.25 0 0 1-2.25-2.25V6ZM3.75 15.75A2.25 2.25 0 0 1 6 13.5h2.25a2.25 2.25 0 0 1 2.25 2.25V18a2.25 2.25 0 0 1-2.25 2.25H6A2.25 2.25 0 0 1 3.75 18v-2.25ZM13.5 6a2.25 2.25 0 0 1 2.25-2.25H18A2.25 2.25 0 0 1 20.25 6v2.25A2.25 2.25 0 0 1 18 10.5h-2.25a2.25 2.25 0 0 1-2.25-2.25V6ZM13.5 15.75a2.25 2.25 0 0 1 2.25-2.25H18a2.25 2.25 0 0 1 2.25 2.25V18A2.25 2.25 0 0 1 18 20.25h-2.25a2.25 2.25 0 0 1-2.25-2.25v-2.25Z"})}),shortcut:"D"},{id:"prd",label:"PRD",category:"Pages",href:"/prd",icon:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.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.25m3.75 9v6m3-3H9m1.5-12H5.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"})}),shortcut:"Q"},{id:"loop",label:"Loop",category:"Pages",href:"/loop",icon:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.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"})}),shortcut:"L"},{id:"parallel",label:"Parallel",category:"Pages",href:"/parallel",icon:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3 7.5L7.5 3m0 0L12 7.5M7.5 3v13.5m13.5-6L16.5 15m0 0L12 10.5m4.5 4.5V1.5"})}),shortcut:"A"},{id:"jobs",label:"Jobs",category:"Pages",href:"/jobs",icon:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.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"})}),shortcut:"J"},{id:"sprints",label:"Sprints",category:"Pages",href:"/sprints",icon:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 12h16.5m-16.5 3.75h16.5M3.75 19.5h16.5M5.625 4.5h12.75a1.875 1.875 0 0 1 0 3.75H5.625a1.875 1.875 0 0 1 0-3.75Z"})})},{id:"rules",label:"Rules",category:"Pages",href:"/rules",icon:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12.75 11.25 15 15 9.75m-3-7.036A11.959 11.959 0 0 1 3.598 6 11.99 11.99 0 0 0 3 9.749c0 5.592 3.824 10.29 9 11.623 5.176-1.332 9-6.03 9-11.622 0-1.31-.21-2.571-.598-3.751h-.152c-3.196 0-6.1-1.248-8.25-3.285Z"})}),shortcut:"R"},{id:"templates",label:"Templates",category:"Pages",href:"/templates",icon:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.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.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.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"})}),shortcut:"T"},{id:"skills",label:"Skills",category:"Pages",href:"/skills",icon:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M3.75 13.5l10.5-11.25L12 10.5h8.25L9.75 21.75 12 13.5H3.75Z"})}),shortcut:"K"},{id:"codemap",label:"CodeMap",category:"Pages",href:"/codemap",icon:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 6.75V15m6-6v8.25m.503 3.498 4.875-2.437c.381-.19.622-.58.622-1.006V4.82c0-.836-.88-1.38-1.628-.1l-3.869 1.934c-.317.159-.69.159-1.006 0L9.503 3.252a1.125 1.125 0 0 0-1.006 0L3.622 5.689C3.24 5.88 3 6.27 3 6.695V19.18c0 .836.88 1.38 1.628.1l3.869-1.934c.317-.159.69-.159 1.006 0l4.994 2.497c.317.158.69.158 1.006 0Z"})}),shortcut:"C"},{id:"memory",label:"Memory",category:"Pages",href:"/memory",icon:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M8.25 3v1.5M4.5 8.25H3m18 0h-1.5M4.5 12H3m18 0h-1.5m-15 3.75H3m18 0h-1.5M8.25 19.5V21M12 3v1.5m0 15V21m3.75-18v1.5m0 15V21m-9-1.5h10.5a2.25 2.25 0 0 0 2.25-2.25V6.75a2.25 2.25 0 0 0-2.25-2.25H6.75A2.25 2.25 0 0 0 4.5 6.75v10.5a2.25 2.25 0 0 0 2.25 2.25Z"})}),shortcut:"M"},{id:"mcps",label:"MCP Tools",category:"Pages",href:"/mcps",icon:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.25 6.087c0-.355.186-.676.401-.959.221-.29.349-.634.349-1.003 0-1.036-1.007-1.875-2.25-1.875s-2.25.84-2.25 1.875c0 .369.128.713.349 1.003.215.283.401.604.401.959v0a.64.64 0 0 1-.657.643 48.39 48.39 0 0 1-4.163-.3c.186 1.613.293 3.25.315 4.907a.656.656 0 0 1-.658.663v0c-.355 0-.676-.186-.959-.401a1.647 1.647 0 0 0-1.003-.349c-1.036 0-1.875 1.007-1.875 2.25s.84 2.25 1.875 2.25c.369 0 .713-.128 1.003-.349.283-.215.604-.401.959-.401v0c.31 0 .555.26.532.57a48.039 48.039 0 0 1-.642 5.056c1.518.19 3.058.309 4.616.354a.64.64 0 0 0 .657-.643v0c0-.355-.186-.676-.401-.959a1.647 1.647 0 0 1-.349-1.003c0-1.035 1.008-1.875 2.25-1.875 1.243 0 2.25.84 2.25 1.875 0 .369-.128.713-.349 1.003-.215.283-.4.604-.4.959v0c0 .333.277.599.61.58a48.1 48.1 0 0 0 5.427-.63 48.05 48.05 0 0 0 .582-4.717.532.532 0 0 0-.533-.57v0c-.355 0-.676.186-.959.401-.29.221-.634.349-1.003.349-1.035 0-1.875-1.007-1.875-2.25s.84-2.25 1.875-2.25c.37 0 .713.128 1.003.349.283.215.604.401.959.401v0a.656.656 0 0 0 .658-.663 48.422 48.422 0 0 0-.37-5.36c-1.886.342-3.81.574-5.766.689a.578.578 0 0 1-.61-.58v0Z"})}),shortcut:"I"},{id:"secrets",label:"Secrets",category:"Pages",href:"/mcps/secrets",icon:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M16.5 10.5V6.75a4.5 4.5 0 1 0-9 0v3.75m-.75 11.25h10.5a2.25 2.25 0 0 0 2.25-2.25v-6.75a2.25 2.25 0 0 0-2.25-2.25H6.75a2.25 2.25 0 0 0-2.25 2.25v6.75a2.25 2.25 0 0 0 2.25 2.25Z"})})},{id:"sessions",label:"Sessions",category:"Pages",href:"/sessions",icon:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M6.75 7.5l3 2.25-3 2.25m4.5 0h3m-9 8.25h13.5A2.25 2.25 0 0 0 21 18V6a2.25 2.25 0 0 0-2.25-2.25H5.25A2.25 2.25 0 0 0 3 6v12a2.25 2.25 0 0 0 2.25 2.25Z"})}),shortcut:"E"},{id:"history",label:"History",category:"Pages",href:"/history",icon:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6v6h4.5m4.5 0a9 9 0 1 1-18 0 9 9 0 0 1 18 0Z"})}),shortcut:"H"},{id:"review",label:"Review Queue",category:"Pages",href:"/review",icon:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9 12h3.75M9 15h3.75M9 18h3.75m3 .75H18a2.25 2.25 0 0 0 2.25-2.25V6.108c0-1.135-.845-2.098-1.976-2.192a48.424 48.424 0 0 0-1.123-.08m-5.801 0c-.065.21-.1.433-.1.664 0 .414.336.75.75.75h4.5a.75.75 0 0 0 .75-.75 2.25 2.25 0 0 0-.1-.664m-5.8 0A2.251 2.251 0 0 1 13.5 2.25H15a2.25 2.25 0 0 1 2.15 1.586m-5.8 0c-.376.023-.75.05-1.124.08C9.095 4.01 8.25 4.973 8.25 6.108V8.25m0 0H4.875c-.621 0-1.125.504-1.125 1.125v11.25c0 .621.504 1.125 1.125 1.125h9.75c.621 0 1.125-.504 1.125-1.125V9.375c0-.621-.504-1.125-1.125-1.125H8.25ZM6.75 12h.008v.008H6.75V12Zm0 3h.008v.008H6.75V15Zm0 3h.008v.008H6.75V18Z"})}),shortcut:"V"},{id:"repos",label:"Repos",category:"Pages",href:"/repos",icon:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 12.75V12A2.25 2.25 0 0 1 4.5 9.75h15A2.25 2.25 0 0 1 21.75 12v.75m-8.69-6.44-2.12-2.12a1.5 1.5 0 0 0-1.061-.44H4.5A2.25 2.25 0 0 0 2.25 6v12a2.25 2.25 0 0 0 2.25 2.25h15A2.25 2.25 0 0 0 21.75 18V9a2.25 2.25 0 0 0-2.25-2.25h-5.379a1.5 1.5 0 0 1-1.06-.44Z"})}),shortcut:"P"},{id:"settings",label:"Settings",category:"Pages",href:"/settings",icon:(0,s.jsxs)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:[(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M9.594 3.94c.09-.542.56-.94 1.11-.94h2.593c.55 0 1.02.398 1.11.94l.213 1.281c.063.374.313.686.645.87.074.04.147.083.22.127.325.196.72.257 1.075.124l1.217-.456a1.125 1.125 0 0 1 1.37.49l1.296 2.247a1.125 1.125 0 0 1-.26 1.431l-1.003.827c-.293.241-.438.613-.43.992a7.723 7.723 0 0 1 0 .255c-.008.378.137.75.43.991l1.004.827c.424.35.534.955.26 1.43l-1.298 2.247a1.125 1.125 0 0 1-1.369.491l-1.217-.456c-.355-.133-.75-.072-1.076.124a6.47 6.47 0 0 1-.22.128c-.331.183-.581.495-.644.869l-.213 1.281c-.09.543-.56.94-1.11.94h-2.594c-.55 0-1.019-.398-1.11-.94l-.213-1.281c-.062-.374-.312-.686-.644-.87a6.52 6.52 0 0 1-.22-.127c-.325-.196-.72-.257-1.076-.124l-1.217.456a1.125 1.125 0 0 1-1.369-.49l-1.297-2.247a1.125 1.125 0 0 1 .26-1.431l1.004-.827c.292-.24.437-.613.43-.991a6.932 6.932 0 0 1 0-.255c.007-.38-.138-.751-.43-.992l-1.004-.827a1.125 1.125 0 0 1-.26-1.43l1.297-2.247a1.125 1.125 0 0 1 1.37-.491l1.216.456c.356.133.751.072 1.076-.124.072-.044.146-.086.22-.128.332-.183.582-.495.644-.869l.214-1.28Z"}),(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M15 12a3 3 0 1 1-6 0 3 3 0 0 1 6 0Z"})]}),shortcut:"S"},{id:"notifications",label:"Notifications",category:"Pages",href:"/notifications",icon:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M14.857 17.082a23.848 23.848 0 0 0 5.454-1.31A8.967 8.967 0 0 1 18 9.75V9A6 6 0 0 0 6 9v.75a8.967 8.967 0 0 1-2.312 6.022c1.733.64 3.56 1.085 5.455 1.31m5.714 0a24.255 24.255 0 0 1-5.714 0m5.714 0a3 3 0 1 1-5.714 0"})}),shortcut:"N"},{id:"billing",label:"Billing",category:"Pages",href:"/billing",icon:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M2.25 8.25h19.5M2.25 9h19.5m-16.5 5.25h6m-6 2.25h3m-3.75 3h15a2.25 2.25 0 0 0 2.25-2.25V6.75A2.25 2.25 0 0 0 19.5 4.5h-15a2.25 2.25 0 0 0-2.25 2.25v10.5A2.25 2.25 0 0 0 4.5 19.5Z"})}),shortcut:"B"},{id:"docs",label:"View Documentation",category:"Actions",href:"/docs",icon:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1.5,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 6.042A8.967 8.967 0 0 0 6 3.75c-1.052 0-2.062.18-3 .512v14.25A8.987 8.987 0 0 1 6 18c2.305 0 4.408.867 6 2.292m0-14.25a8.966 8.966 0 0 1 6-2.292c1.052 0 2.062.18 3 .512v14.25A8.987 8.987 0 0 0 18 18a8.967 8.967 0 0 0-6 2.292m0-14.25v14.25"})})},{id:"github",label:"Visit GitHub",category:"Actions",action:()=>window.open("https://github.com/ulpi-dev/ulpi","_blank"),icon:(0,s.jsx)("svg",{className:"h-4 w-4",fill:"currentColor",viewBox:"0 0 24 24",children:(0,s.jsx)("path",{d:"M12 0c-6.626 0-12 5.373-12 12 0 5.302 3.438 9.8 8.207 11.387.599.111.793-.261.793-.577v-2.234c-3.338.726-4.033-1.416-4.033-1.416-.546-1.387-1.333-1.756-1.333-1.756-1.089-.745.083-.729.083-.729 1.205.084 1.839 1.237 1.839 1.237 1.07 1.834 2.807 1.304 3.492.997.107-.775.418-1.305.762-1.604-2.665-.305-5.467-1.334-5.467-5.931 0-1.311.469-2.381 1.236-3.221-.124-.303-.535-1.524.117-3.176 0 0 1.008-.322 3.301 1.23.957-.266 1.983-.399 3.003-.404 1.02.005 2.047.138 3.006.404 2.291-1.552 3.297-1.23 3.297-1.23.653 1.653.242 2.874.118 3.176.77.84 1.235 1.911 1.235 3.221 0 4.609-2.807 5.624-5.479 5.921.43.372.823 1.102.823 2.222v3.293c0 .319.192.694.801.576 4.765-1.589 8.199-6.086 8.199-11.386 0-6.627-5.373-12-12-12z"})})}],f=new Set(["billing","jobs","sprints"]),j=u?p.filter(e=>!f.has(e.id)):p,g=o.trim()?j.filter(e=>e.label.toLowerCase().includes(o.toLowerCase())):j,k=[],w=new Set;for(let e of g)w.has(e.category)||(w.add(e.category),k.push({category:e.category,items:g.filter(t=>t.category===e.category)}));let b=(0,a.useCallback)(e=>{if(t(),e.action)e.action();else{var s;e.href&&r.push((s=e.href,u&&(null==m?void 0:m.id)?"".concat(s,"?repo=").concat(m.id):s))}},[t,r]);(0,a.useEffect)(()=>{function e(e){if("Escape"===e.key)return void t();if("ArrowDown"===e.key&&(e.preventDefault(),d(e=>(e+1)%g.length)),"ArrowUp"===e.key&&(e.preventDefault(),d(e=>(e-1+g.length)%g.length)),"Enter"===e.key){e.preventDefault();let t=g[c];t&&b(t)}}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[g,c,b,t]),(0,a.useEffect)(()=>{var e;null==(e=h.current)||e.focus()},[]),(0,a.useEffect)(()=>{d(0)},[o]);let y=-1;return(0,s.jsxs)("div",{className:"fixed inset-0 z-50 flex items-start justify-center pt-[20vh]",children:[(0,s.jsx)("div",{className:"absolute inset-0 bg-black/50 backdrop-blur-sm",onClick:t}),(0,s.jsxs)("div",{className:"relative z-10 w-full max-w-lg animate-in rounded-xl border border-white/[0.08] bg-surface-900/95 shadow-2xl backdrop-blur-xl",children:[(0,s.jsxs)("div",{className:"flex items-center gap-3 border-b border-white/[0.06] px-4 py-3",children:[(0,s.jsx)(M,{}),(0,s.jsx)("input",{ref:h,type:"text",placeholder:"Search pages and actions...",value:o,onChange:e=>i(e.target.value),className:"flex-1 bg-transparent text-sm text-gray-200 placeholder-gray-500 outline-none"}),(0,s.jsx)("kbd",{className:"rounded border border-white/[0.08] bg-surface-800 px-1.5 py-0.5 text-[10px] text-gray-500",children:"ESC"})]}),(0,s.jsxs)("div",{className:"max-h-72 overflow-y-auto py-2",children:[0===g.length&&(0,s.jsx)("div",{className:"px-4 py-8 text-center text-sm text-gray-500",children:"No results found."}),k.map(e=>(0,s.jsxs)("div",{children:[(0,s.jsx)("p",{className:"px-4 pb-1 pt-2 text-[10px] font-medium uppercase tracking-widest text-gray-600",children:e.category}),e.items.map(e=>{let t=++y,r=n===e.href;return(0,s.jsxs)("button",{onClick:()=>b(e),onMouseEnter:()=>d(t),className:"flex w-full items-center gap-3 px-4 py-2 text-left text-sm transition-colors ".concat(t===c?"bg-white/[0.06] text-white":"text-gray-400 hover:bg-white/[0.03]"),children:[(0,s.jsx)("span",{className:t===c?"text-primary-400":"text-gray-500",children:e.icon}),(0,s.jsx)("span",{className:"flex-1",children:e.label}),r&&(0,s.jsx)("span",{className:"text-[10px] text-gray-600",children:"Current"}),e.shortcut&&(0,s.jsxs)("span",{className:"flex items-center gap-0.5",children:[(0,s.jsx)("kbd",{className:"inline-flex h-4 min-w-[16px] items-center justify-center rounded border border-white/[0.06] bg-surface-800 px-1 text-[9px] font-medium text-gray-600",children:"⌘"}),(0,s.jsx)("kbd",{className:"inline-flex h-4 min-w-[16px] items-center justify-center rounded border border-white/[0.06] bg-surface-800 px-1 text-[9px] font-medium text-gray-600",children:e.shortcut})]})]},e.id)})]},e.category))]})]})]})}function H(e){let{onCreated:t}=e,{session:r}=(0,n.As)(),[o,l]=(0,a.useState)(""),[i,c]=(0,a.useState)(""),[d,h]=(0,a.useState)(!1),[u,x]=(0,a.useState)(null);async function p(){if(o.trim()&&i.trim()){h(!0),x(null);try{await m.uE.createOrg({name:o.trim(),slug:i.trim()}),t()}catch(t){var e,r;x(t&&"object"==typeof t&&"body"in t?String(null!=(r=null==(e=t.body)?void 0:e.error)?r:"Failed to create organization"):"Failed to create organization"),h(!1)}}}return(0,s.jsx)("div",{className:"flex h-screen items-center justify-center bg-surface-950 px-6",children:(0,s.jsx)("div",{className:"w-full max-w-md",children:(0,s.jsxs)("div",{className:"rounded-2xl border border-white/[0.06] bg-surface-900 p-8",children:[(0,s.jsx)("div",{className:"flex justify-center",children:(0,s.jsx)("div",{className:"flex h-10 w-10 items-center justify-center rounded-xl bg-primary-500",children:(0,s.jsx)("span",{className:"text-base font-bold text-white",children:"U"})})}),(0,s.jsx)("h1",{className:"mt-5 text-center text-xl font-bold text-white",children:"Create your organization"}),(0,s.jsxs)("p",{className:"mt-2 text-center text-sm text-gray-400",children:["Welcome",(null==r?void 0:r.name)?", ".concat(r.name):"","! Create an organization to get started with ULPI Cloud CI."]}),(0,s.jsxs)("div",{className:"mt-6 space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-400",children:"Organization name"}),(0,s.jsx)("input",{type:"text",value:o,onChange:e=>{var t;l(t=e.target.value),c(t.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,""))},placeholder:"My Team",className:"mt-1 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 focus:border-primary-500/50"})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"block text-xs font-medium text-gray-400",children:"Slug"}),(0,s.jsx)("input",{type:"text",value:i,onChange:e=>c(e.target.value.toLowerCase().replace(/[^a-z0-9-]/g,"")),placeholder:"my-team",className:"mt-1 w-full rounded-lg border border-white/[0.08] bg-surface-800 px-3 py-2 font-mono text-sm text-white placeholder-gray-600 outline-none focus:border-primary-500/50"}),(0,s.jsx)("p",{className:"mt-1 text-[11px] text-gray-600",children:"Lowercase letters, numbers, and hyphens only."})]}),u&&(0,s.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:u}),(0,s.jsx)("button",{onClick:()=>void p(),disabled:d||!o.trim()||!i.trim(),className:"w-full 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:d?"Creating...":"Create Organization"})]})]})})})}function B(e){let{children:t}=e,{session:r,loading:o,org:i,refresh:c}=(0,n.As)(),d=(0,v.useRouter)(),[h,u]=(0,a.useState)(!1),x=(0,l.J)();return((0,a.useEffect)(()=>{!x&&(o||r||d.replace("/login"))},[o,r,d,x]),(0,a.useEffect)(()=>{function e(e){(e.metaKey||e.ctrlKey)&&"k"===e.key&&(e.preventDefault(),u(e=>!e))}return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),x)?(0,s.jsxs)("div",{className:"flex h-screen bg-surface-950",children:[(0,s.jsx)(C,{}),(0,s.jsx)("main",{className:"flex-1 overflow-y-auto",children:(0,s.jsx)("div",{className:"px-4 py-4 lg:px-6",children:t})}),h&&(0,s.jsx)(A,{onClose:()=>u(!1)})]}):o?(0,s.jsx)("div",{className:"flex h-screen items-center justify-center bg-surface-950",children:(0,s.jsxs)("div",{className:"flex flex-col items-center gap-4",children:[(0,s.jsx)("div",{className:"h-8 w-8 animate-spin rounded-full border-2 border-primary-500 border-t-transparent"}),(0,s.jsx)("p",{className:"text-sm text-gray-400",children:"Loading..."})]})}):r?i?(0,s.jsxs)("div",{className:"flex h-screen bg-surface-950",children:[(0,s.jsx)(C,{}),(0,s.jsx)("main",{className:"flex-1 overflow-y-auto",children:(0,s.jsx)("div",{className:"px-4 py-4 lg:px-6",children:t})}),h&&(0,s.jsx)(A,{onClose:()=>u(!1)})]}):(0,s.jsx)(H,{onCreated:()=>void c()}):null}function V(e){let{children:t}=e;return(0,s.jsx)(n.OJ,{children:(0,s.jsx)(o.Kv,{children:(0,s.jsx)(u,{children:(0,s.jsx)(B,{children:t})})})})}}},e=>{e.O(0,[5935,8934,814,9743,7358],()=>e(e.s=1270)),_N_E=e.O()}]);
|
package/dist/portal/apps/portal/.next/static/chunks/app/(dashboard)/loop/page-c3f658ffb8d7397b.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[313],{1452:(e,t,n)=>{"use strict";n.r(t),n.d(t,{default:()=>m});var s=n(8111),l=n(5271),a=n(4736),r=n(3951),o=n(4632),i=n(3025),c=n(2853),d=n(5079),u=n(5605),x=n(8322);function h(e){let{jobs:t,selectedId:n,onSelect:l,onNewRun:a}=e,r=function(e){let t=new Set(["running","queued","paused","pausing"]);return[...e].sort((e,n)=>{let s=+!t.has(e.status),l=+!t.has(n.status);return s!==l?s-l:new Date(n.createdAt).getTime()-new Date(e.createdAt).getTime()})}(t);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-3 shrink-0 border-b border-white/[0.04]",children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("h2",{className:"text-sm font-semibold text-white",children:"Jobs"}),t.length>0&&(0,s.jsx)("span",{className:"inline-flex items-center justify-center rounded-full bg-surface-800 px-1.5 py-0.5 text-[10px] font-medium text-gray-400",children:t.length})]}),(0,s.jsxs)("button",{type:"button",onClick:a,className:"inline-flex items-center gap-1.5 rounded-lg bg-primary-500 px-3 py-1.5 text-[11px] font-semibold text-white transition-colors hover:bg-primary-600",children:[(0,s.jsx)("svg",{className:"h-3 w-3",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"})}),"New Run"]})]}),(0,s.jsx)("div",{className:"flex-1 overflow-y-auto",children:0===r.length?(0,s.jsx)("div",{className:"p-4",children:(0,s.jsx)(o.p,{title:"No jobs yet",description:"Start a new run to create a job.",icon:(0,s.jsx)("svg",{className:"h-8 w-8 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M20.25 14.15v4.25c0 1.094-.787 2.036-1.872 2.18-2.087.277-4.216.42-6.378.42s-4.291-.143-6.378-.42c-1.085-.144-1.872-1.086-1.872-2.18v-4.25m16.5 0a2.18 2.18 0 0 0 .75-1.661V8.706c0-1.081-.768-2.015-1.837-2.175a48.114 48.114 0 0 0-3.413-.387m4.5 8.006c-.194.165-.42.295-.673.38A23.978 23.978 0 0 1 12 15.75c-2.648 0-5.195-.429-7.577-1.22a2.016 2.016 0 0 1-.673-.38m0 0A2.18 2.18 0 0 1 3 12.489V8.706c0-1.081.768-2.015 1.837-2.175a48.111 48.111 0 0 1 3.413-.387m7.5 0V5.25A2.25 2.25 0 0 0 13.5 3h-3a2.25 2.25 0 0 0-2.25 2.25v.894m7.5 0a48.667 48.667 0 0 0-7.5 0"})})})}):r.map(e=>{let t=n===e.id;return(0,s.jsxs)("button",{type:"button",onClick:()=>l(e.id),className:"w-full px-3 py-2.5 text-left transition-colors border-b border-white/[0.02] ".concat(t?"bg-primary-500/10 border-l-2 border-l-primary-500":"hover:bg-white/[0.03]"),children:[(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)(u.W,{status:e.status,size:"sm"}),(0,s.jsx)(x.L,{name:e.agentName})]}),(0,s.jsxs)("div",{className:"mt-1.5 flex items-center gap-2",children:[(0,s.jsx)("span",{className:"font-mono text-[11px] text-gray-500 truncate",children:e.sourceBranch}),e.taskCount>0&&(0,s.jsxs)("span",{className:"text-[11px] text-gray-500 shrink-0",children:[e.completedTasks,"/",e.taskCount,e.failedTasks>0&&(0,s.jsxs)("span",{className:"text-red-400",children:[" (",e.failedTasks,"!)"]})]})]}),(0,s.jsx)("div",{className:"mt-1 text-[10px] text-gray-600",children:function(e){let t=Date.now()-new Date(e).getTime();return t<6e4?"just now":t<36e5?"".concat(Math.floor(t/6e4),"m ago"):t<864e5?"".concat(Math.floor(t/36e5),"h ago"):"".concat(Math.floor(t/864e5),"d ago")}(e.createdAt)})]},e.id)})})]})}function m(){return(0,s.jsx)(i.s,{featureName:"Loop Engine",children:(0,s.jsx)(l.Suspense,{fallback:(0,s.jsx)(r.G,{}),children:(0,s.jsx)(j,{})})})}function j(){var e,t,n,i,u;let m=(0,a.useRouter)(),j=(0,a.useSearchParams)(),p=null!=(e=null==j?void 0:j.get("job"))?e:null,b=null!=(t=null==j?void 0:j.get("prd"))?t:null,f=null!=(n=null==j?void 0:j.get("agent"))?n:null,g=null!=(i=null==j?void 0:j.get("model"))?i:null,[v,w]=(0,l.useState)(p?"job":b?"new-run":null),{jobs:k,refresh:N,deleteJob:y,stopJob:C,rerunJob:S,rerunningId:L}=(0,c.QE)(),R=k.find(e=>"running"===e.status||"queued"===e.status),A=null!=(u=null!=p?p:null==R?void 0:R.id)?u:null,E=null!=v?v:A?"job":null,{status:M,loading:_,hasActiveEngine:P,refresh:T}=(0,c.y_)("job"===E?A:null),{start:B,runAction:D,actionRunning:W,actionMessage:I}=(0,c.nr)(T,N),V=A?k.find(e=>e.id===A):null,F=(0,l.useCallback)(e=>{var t;let n=new URLSearchParams(null!=(t=null==j?void 0:j.toString())?t:"");e?n.set("job",e):n.delete("job");let s=n.toString();m.replace("/loop".concat(s?"?".concat(s):""),{scroll:!1})},[m,j]);(0,l.useEffect)(()=>{p&&w("job")},[p]);let q=(0,l.useCallback)(()=>{w("new-run"),F(null)},[F]),G=(0,l.useCallback)(e=>{w("job"),F(e)},[F]),J=(0,l.useCallback)(async e=>{let t=await B(e);t.jobId?(w("job"),F(t.jobId)):w(null),N()},[B,N,F]),O=(0,l.useCallback)(async e=>{try{await y(e),A===e&&(w(null),F(null))}catch(e){}},[y,A,F]),Q=(0,l.useCallback)(async e=>{try{await C(e),T()}catch(e){}},[C,T]),z=(0,l.useCallback)(async e=>{try{let t=await S(e);t.id&&(w("job"),F(t.id)),T()}catch(e){}},[S,T,F]);return _?(0,s.jsxs)("div",{className:"flex flex-col h-[calc(100vh-32px)]",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Loop Engine"}),(0,s.jsx)("p",{className:"mt-1 text-sm text-gray-400",children:"Autonomous task execution loop. Configure an agent and task tracker, then start a run."})]}),(0,s.jsx)("div",{className:"mt-4",children:(0,s.jsx)(r.G,{rows:1})})]}):(0,s.jsxs)("div",{className:"flex flex-col h-[calc(100vh-32px)]",children:[(0,s.jsxs)("div",{className:"shrink-0",children:[(0,s.jsx)("h1",{className:"text-xl font-semibold text-white",children:"Loop Engine"}),(0,s.jsx)("p",{className:"mt-1 text-sm text-gray-400",children:"Autonomous task execution loop. Configure an agent and task tracker, then start a run."})]}),I&&(0,s.jsx)("div",{className:"mt-3 shrink-0 rounded-lg border border-blue-500/20 bg-blue-500/[0.06] px-3 py-2 text-xs text-blue-400",children:I}),(0,s.jsxs)("div",{className:"flex gap-4 flex-1 min-h-0 mt-4",children:[(0,s.jsx)("div",{className:"w-80 min-w-[280px] max-w-[360px] shrink-0 flex flex-col rounded-xl border border-white/[0.06] bg-surface-900 overflow-hidden",children:(0,s.jsx)(h,{jobs:k,selectedId:"job"===E?A:null,onSelect:G,onNewRun:q})}),(0,s.jsx)("div",{className:"flex-1 min-w-0 rounded-xl border border-white/[0.06] bg-surface-900 p-5 overflow-hidden flex flex-col",children:"new-run"===E?(0,s.jsx)(d.Q,{onStart:e=>void J(e),initialPrdFilename:null!=b?b:void 0,initialAgent:null!=f?f:void 0,initialModel:null!=g?g:void 0}):V?(0,s.jsx)(x.F,{job:V,status:M,actionRunning:W,onPause:()=>void D("pause","Pause",V.id),onResume:()=>void D("resume","Resume",V.id),onStop:()=>void D("stop","Stop",V.id),onStopJob:e=>void Q(e),onRerun:e=>void z(e),onDelete:e=>void O(e),rerunningId:L}):(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center flex-1",children:[(0,s.jsx)(o.p,{title:k.length>0?"Select a job":"No jobs yet",description:k.length>0?"Choose a job from the list or start a new run.":"Click 'New Run' to start your first execution.",icon:(0,s.jsx)("svg",{className:"h-10 w-10 text-gray-600",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:1,children:(0,s.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"})})}),0===k.length&&(0,s.jsxs)("button",{type:"button",onClick:q,className:"mt-4 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",children:[(0,s.jsx)("svg",{className:"h-3.5 w-3.5",fill:"none",viewBox:"0 0 24 24",stroke:"currentColor",strokeWidth:2,children:(0,s.jsx)("path",{strokeLinecap:"round",strokeLinejoin:"round",d:"M12 4.5v15m7.5-7.5h-15"})}),"New Run"]})]})})]})]})}},9486:(e,t,n)=>{Promise.resolve().then(n.bind(n,1452))}},e=>{e.O(0,[7889,814,9743,7358],()=>e(e.s=9486)),_N_E=e.O()}]);
|