conductor-oss 0.30.2 → 0.30.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/package.json +5 -5
  2. package/web/.next/standalone/packages/web/.next/BUILD_ID +1 -1
  3. package/web/.next/standalone/packages/web/.next/app-path-routes-manifest.json +6 -6
  4. package/web/.next/standalone/packages/web/.next/build-manifest.json +3 -3
  5. package/web/.next/standalone/packages/web/.next/prerender-manifest.json +3 -3
  6. package/web/.next/standalone/packages/web/.next/react-loadable-manifest.json +5 -5
  7. package/web/.next/standalone/packages/web/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/web/.next/standalone/packages/web/.next/server/app/_global-error.html +1 -1
  9. package/web/.next/standalone/packages/web/.next/server/app/_global-error.rsc +1 -1
  10. package/web/.next/standalone/packages/web/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/web/.next/standalone/packages/web/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  12. package/web/.next/standalone/packages/web/.next/server/app/_global-error.segments/_global-error.segment.rsc +1 -1
  13. package/web/.next/standalone/packages/web/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  14. package/web/.next/standalone/packages/web/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  15. package/web/.next/standalone/packages/web/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  16. package/web/.next/standalone/packages/web/.next/server/app/_not-found/page.js +1 -1
  17. package/web/.next/standalone/packages/web/.next/server/app/_not-found/page.js.nft.json +1 -1
  18. package/web/.next/standalone/packages/web/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  19. package/web/.next/standalone/packages/web/.next/server/app/api/bridge/bridges/[bridgeId]/route.js +1 -1
  20. package/web/.next/standalone/packages/web/.next/server/app/api/bridge/bridges/route.js +1 -1
  21. package/web/.next/standalone/packages/web/.next/server/app/api/bridge/devices/[deviceId]/route.js +1 -1
  22. package/web/.next/standalone/packages/web/.next/server/app/api/bridge/devices/claims/complete/route.js +1 -1
  23. package/web/.next/standalone/packages/web/.next/server/app/api/bridge/devices/code/route.js +1 -1
  24. package/web/.next/standalone/packages/web/.next/server/app/api/bridge/devices/route.js +1 -1
  25. package/web/.next/standalone/packages/web/.next/server/app/bridge/connect/page.js +1 -1
  26. package/web/.next/standalone/packages/web/.next/server/app/bridge/connect/page.js.nft.json +1 -1
  27. package/web/.next/standalone/packages/web/.next/server/app/bridge/connect/page_client-reference-manifest.js +1 -1
  28. package/web/.next/standalone/packages/web/.next/server/app/page.js +2 -2
  29. package/web/.next/standalone/packages/web/.next/server/app/page.js.nft.json +1 -1
  30. package/web/.next/standalone/packages/web/.next/server/app/page_client-reference-manifest.js +1 -1
  31. package/web/.next/standalone/packages/web/.next/server/app/sessions/[id]/page.js +2 -2
  32. package/web/.next/standalone/packages/web/.next/server/app/sessions/[id]/page.js.nft.json +1 -1
  33. package/web/.next/standalone/packages/web/.next/server/app/sessions/[id]/page_client-reference-manifest.js +1 -1
  34. package/web/.next/standalone/packages/web/.next/server/app/settings/bridge/page.js +1 -1
  35. package/web/.next/standalone/packages/web/.next/server/app/settings/bridge/page.js.nft.json +1 -1
  36. package/web/.next/standalone/packages/web/.next/server/app/settings/bridge/page_client-reference-manifest.js +1 -1
  37. package/web/.next/standalone/packages/web/.next/server/app/sign-in/[[...sign-in]]/page.js +1 -1
  38. package/web/.next/standalone/packages/web/.next/server/app/sign-in/[[...sign-in]]/page.js.nft.json +1 -1
  39. package/web/.next/standalone/packages/web/.next/server/app/sign-in/[[...sign-in]]/page_client-reference-manifest.js +1 -1
  40. package/web/.next/standalone/packages/web/.next/server/app/sign-in/hosted/page.js +1 -1
  41. package/web/.next/standalone/packages/web/.next/server/app/sign-in/hosted/page.js.nft.json +1 -1
  42. package/web/.next/standalone/packages/web/.next/server/app/sign-in/hosted/page_client-reference-manifest.js +1 -1
  43. package/web/.next/standalone/packages/web/.next/server/app/sign-in/sso-callback/page.js +1 -1
  44. package/web/.next/standalone/packages/web/.next/server/app/sign-in/sso-callback/page.js.nft.json +1 -1
  45. package/web/.next/standalone/packages/web/.next/server/app/sign-in/sso-callback/page_client-reference-manifest.js +1 -1
  46. package/web/.next/standalone/packages/web/.next/server/app/unlock/page.js +1 -1
  47. package/web/.next/standalone/packages/web/.next/server/app/unlock/page.js.nft.json +1 -1
  48. package/web/.next/standalone/packages/web/.next/server/app/unlock/page_client-reference-manifest.js +1 -1
  49. package/web/.next/standalone/packages/web/.next/server/app-paths-manifest.json +6 -6
  50. package/web/.next/standalone/packages/web/.next/server/chunks/1121.js +1 -1
  51. package/web/.next/standalone/packages/web/.next/server/chunks/4888.js +1 -1
  52. package/web/.next/standalone/packages/web/.next/server/chunks/5025.js +1 -0
  53. package/web/.next/standalone/packages/web/.next/server/chunks/5164.js +3 -3
  54. package/web/.next/standalone/packages/web/.next/server/chunks/5694.js +1 -1
  55. package/web/.next/standalone/packages/web/.next/server/chunks/6054.js +1 -1
  56. package/web/.next/standalone/packages/web/.next/server/chunks/6489.js +1 -1
  57. package/web/.next/standalone/packages/web/.next/server/chunks/7547.js +1 -0
  58. package/web/.next/standalone/packages/web/.next/server/chunks/9455.js +1 -1
  59. package/web/.next/standalone/packages/web/.next/server/middleware-build-manifest.js +1 -1
  60. package/web/.next/standalone/packages/web/.next/server/middleware-react-loadable-manifest.js +1 -1
  61. package/web/.next/standalone/packages/web/.next/server/pages/500.html +1 -1
  62. package/web/.next/standalone/packages/web/.next/server/server-reference-manifest.js +1 -1
  63. package/web/.next/standalone/packages/web/.next/server/server-reference-manifest.json +1 -1
  64. package/web/.next/standalone/packages/web/.next/static/chunks/1265.1c9b072945904c07.js +1 -0
  65. package/web/.next/standalone/packages/web/.next/static/chunks/4443.4751072018eda510.js +1 -0
  66. package/web/.next/standalone/packages/web/.next/static/chunks/474.1a853ae261c6f831.js +1 -0
  67. package/web/.next/standalone/packages/web/.next/static/chunks/4929.a3162cca47aff839.js +1 -0
  68. package/web/.next/standalone/packages/web/.next/static/chunks/{7220-6f03daec280b1310.js → 7220-759bf5f5ee3a953f.js} +1 -1
  69. package/web/.next/standalone/packages/web/.next/static/chunks/7720-f8fad1acac794e8d.js +2 -0
  70. package/web/.next/standalone/packages/web/.next/static/chunks/9756-2afe5fa19201a51a.js +1 -0
  71. package/web/.next/standalone/packages/web/.next/static/chunks/app/layout-4ff8eb6917b7e063.js +1 -0
  72. package/web/.next/standalone/packages/web/.next/static/chunks/app/page-536f088e4ecf886b.js +1 -0
  73. package/web/.next/standalone/packages/web/.next/static/chunks/app/sessions/[id]/page-f3756bd7b55447a9.js +1 -0
  74. package/web/.next/standalone/packages/web/.next/static/chunks/{webpack-65247d8c6649582a.js → webpack-e988047f31110b5c.js} +1 -1
  75. package/web/.next/static/chunks/1265.1c9b072945904c07.js +1 -0
  76. package/web/.next/static/chunks/4443.4751072018eda510.js +1 -0
  77. package/web/.next/static/chunks/474.1a853ae261c6f831.js +1 -0
  78. package/web/.next/static/chunks/4929.a3162cca47aff839.js +1 -0
  79. package/web/.next/static/chunks/{7220-6f03daec280b1310.js → 7220-759bf5f5ee3a953f.js} +1 -1
  80. package/web/.next/static/chunks/7720-f8fad1acac794e8d.js +2 -0
  81. package/web/.next/static/chunks/9756-2afe5fa19201a51a.js +1 -0
  82. package/web/.next/static/chunks/app/layout-4ff8eb6917b7e063.js +1 -0
  83. package/web/.next/static/chunks/app/page-536f088e4ecf886b.js +1 -0
  84. package/web/.next/static/chunks/app/sessions/[id]/page-f3756bd7b55447a9.js +1 -0
  85. package/web/.next/static/chunks/{webpack-65247d8c6649582a.js → webpack-e988047f31110b5c.js} +1 -1
  86. package/web/.next/standalone/packages/web/.next/server/chunks/6229.js +0 -1
  87. package/web/.next/standalone/packages/web/.next/server/chunks/6312.js +0 -1
  88. package/web/.next/standalone/packages/web/.next/static/chunks/1265.eb0836b68e2c5068.js +0 -1
  89. package/web/.next/standalone/packages/web/.next/static/chunks/4443.a7231192bcabcb39.js +0 -1
  90. package/web/.next/standalone/packages/web/.next/static/chunks/474.e2261e8fe56e5d2b.js +0 -1
  91. package/web/.next/standalone/packages/web/.next/static/chunks/7720-26b9379cbba41cf1.js +0 -2
  92. package/web/.next/standalone/packages/web/.next/static/chunks/8659.44db5b2c3161acd3.js +0 -1
  93. package/web/.next/standalone/packages/web/.next/static/chunks/9756-c69416a974795433.js +0 -1
  94. package/web/.next/standalone/packages/web/.next/static/chunks/app/layout-cce84419ee9eeeca.js +0 -1
  95. package/web/.next/standalone/packages/web/.next/static/chunks/app/page-2e773d9773c7b8d8.js +0 -1
  96. package/web/.next/standalone/packages/web/.next/static/chunks/app/sessions/[id]/page-057af93ee9059ddb.js +0 -1
  97. package/web/.next/static/chunks/1265.eb0836b68e2c5068.js +0 -1
  98. package/web/.next/static/chunks/4443.a7231192bcabcb39.js +0 -1
  99. package/web/.next/static/chunks/474.e2261e8fe56e5d2b.js +0 -1
  100. package/web/.next/static/chunks/7720-26b9379cbba41cf1.js +0 -2
  101. package/web/.next/static/chunks/8659.44db5b2c3161acd3.js +0 -1
  102. package/web/.next/static/chunks/9756-c69416a974795433.js +0 -1
  103. package/web/.next/static/chunks/app/layout-cce84419ee9eeeca.js +0 -1
  104. package/web/.next/static/chunks/app/page-2e773d9773c7b8d8.js +0 -1
  105. package/web/.next/static/chunks/app/sessions/[id]/page-057af93ee9059ddb.js +0 -1
  106. /package/web/.next/standalone/packages/web/.next/static/{see4G2ERXsOIVmNhC0xYH → PI7swHEBX1p5mEZCM1Irt}/_buildManifest.js +0 -0
  107. /package/web/.next/standalone/packages/web/.next/static/{see4G2ERXsOIVmNhC0xYH → PI7swHEBX1p5mEZCM1Irt}/_ssgManifest.js +0 -0
  108. /package/web/.next/static/{see4G2ERXsOIVmNhC0xYH → PI7swHEBX1p5mEZCM1Irt}/_buildManifest.js +0 -0
  109. /package/web/.next/static/{see4G2ERXsOIVmNhC0xYH → PI7swHEBX1p5mEZCM1Irt}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1265],{2939:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(13454).A)("file-text",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["path",{d:"M10 9H8",key:"b1mrlr"}],["path",{d:"M16 13H8",key:"t4e002"}],["path",{d:"M16 17H8",key:"z1uh3a"}]])},18510:(e,t,r)=>{r.d(t,{J:()=>s,s:()=>n});var a=r(10926);function s(e){let t=(0,a.C0)(e);if(!t)return"/";let r=new URLSearchParams;return r.set("bridge",t),`/?${r.toString()}`}function n(e,t={}){let r,s=e.trim(),l=(0,a.DW)(s)?s:(r=(0,a.C0)(t.bridgeId))?(0,a.Bp)(r,s):s,i=new URLSearchParams,o=t.tab?.trim();o&&i.set("tab",o);let d=i.toString(),c=`/sessions/${encodeURIComponent(l)}`;return d.length>0?`${c}?${d}`:c}},23555:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(13454).A)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]])},26083:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(13454).A)("external-link",[["path",{d:"M15 3h6v6",key:"1q9fwt"}],["path",{d:"M10 14 21 3",key:"gplh6r"}],["path",{d:"M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6",key:"a6xqqp"}]])},26463:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(13454).A)("folder",[["path",{d:"M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z",key:"1kt360"}]])},59207:(e,t,r)=>{r.d(t,{g:()=>l});var a=r(7620),s=r(31404);function n(e){return!e||"object"!=typeof e||Array.isArray(e)?{}:{...e}}function l(e,t){let r=t?.enabled??!0,[l,i]=(0,a.useState)(null),[o,d]=(0,a.useState)(r),[c,x]=(0,a.useState)(null),m=(0,a.useCallback)(async()=>{if(!r){i(null),x(null),d(!1);return}try{var t;let r,a,l,o=await fetch((0,s.S)("/api/preferences",e)),d=await o.json().catch(()=>null);if(!o.ok)throw Error(d?.error??d?.reason??`Failed to load preferences: ${o.status}`);i((t=d?.preferences,r=n(t),l=(a=n(r.notifications)).soundFile,{onboardingAcknowledged:!0===r.onboardingAcknowledged,codingAgent:"string"==typeof r.codingAgent&&r.codingAgent.trim().length>0?r.codingAgent.trim():"claude-code",ide:"string"==typeof r.ide&&r.ide.trim().length>0?r.ide.trim():"vscode",markdownEditor:"string"==typeof r.markdownEditor&&r.markdownEditor.trim().length>0?r.markdownEditor.trim():"obsidian",markdownEditorPath:"string"==typeof r.markdownEditorPath?r.markdownEditorPath.trim():"",notifications:{soundEnabled:!1!==a.soundEnabled,soundFile:null===l?null:"string"==typeof l&&l.trim().length>0?l.trim():"abstract-sound-4"}})),x(null)}catch(e){i(null),x(e instanceof Error?e.message:"Failed to load preferences")}finally{d(!1)}},[e,r]);return(0,a.useEffect)(()=>{r&&m()},[r,m]),{preferences:r?l:null,loading:!!r&&o,error:r?c:null,refresh:m}}},67447:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(13454).A)("plus",[["path",{d:"M5 12h14",key:"1ays0h"}],["path",{d:"M12 5v14",key:"s699le"}]])},71265:(e,t,r)=>{r.r(t),r.d(t,{WorkspaceKanban:()=>ee});var a=r(54568),s=r(40448),n=r(7620),l=r(79748),i=r(58299),o=r(26083),d=r(34041),c=r(76265),x=r(45894),m=r(26463),p=r(13454);let u=(0,p.A)("file-image",[["path",{d:"M6 22a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h8a2.4 2.4 0 0 1 1.704.706l3.588 3.588A2.4 2.4 0 0 1 20 8v12a2 2 0 0 1-2 2z",key:"1oefj6"}],["path",{d:"M14 2v5a1 1 0 0 0 1 1h5",key:"wfsgrz"}],["circle",{cx:"10",cy:"12",r:"2",key:"737tya"}],["path",{d:"m20 17-1.296-1.296a2.41 2.41 0 0 0-3.408 0L9 22",key:"wt3hpn"}]]);var v=r(2939),h=r(34309),b=r(23555),g=r(67447),f=r(60527);let k=(0,p.A)("pencil",[["path",{d:"M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z",key:"1a8usu"}],["path",{d:"m15 5 4 4",key:"1mk7zo"}]]),j=(0,p.A)("message-square",[["path",{d:"M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z",key:"18887p"}]]);var N=r(90124),y=r(59207),w=r(31404),C=r(46916),S=r(18510);let A={intake:"#3c83f6",ready:"#f59f0a",dispatching:"#fb923c",inProgress:"#f59f0a",needsInput:"#eab308",blocked:"#d53946",errored:"#ef4444",review:"#895af6",merge:"#06b6d4",done:"#21c45d",cancelled:"#6b7280"},P={intake:"To do",ready:"Ready",dispatching:"Dispatching",inProgress:"In progress",needsInput:"Needs input",blocked:"Blocked",errored:"Errored",review:"In review",merge:"Merge",done:"Done",cancelled:"Cancelled"},$={obsidian:"Obsidian",vscode:"VS Code",notion:"Notion",typora:"Typora",logseq:"Logseq",custom:"your editor"},I=[{value:"feature",label:"Feature"},{value:"fix",label:"Fix"},{value:"review",label:"Review"},{value:"chore",label:"Chore"},{value:"docs",label:"Docs"}],R=[{value:"high",label:"High"},{value:"medium",label:"Medium"},{value:"low",label:"Low"}];function E(e){return["intake","ready","dispatching","inProgress","needsInput","blocked","errored","review","merge","done","cancelled"].includes(e)?e:"intake"}function M(e){let[t,...r]=e.split(" - ");return{title:(t??e).trim(),description:r.join(" - ").trim()}}function T(e){return e.split(/[-_\s]+/g).filter(Boolean).map(e=>e[0]?.toUpperCase()+e.slice(1)).join(" ")}function _(e){return e.split("/").map(e=>e.trim()).filter(Boolean)}function F(e,t){return e.kind!==t.kind?"folder"===e.kind?-1:1:e.name.localeCompare(t.name,void 0,{sensitivity:"base",numeric:!0})}function O(e){let t=e.displayPath?.trim();return t&&t.length>0?t:e.path}function L({attachment:e,onOpen:t,opening:r=!1}){return(0,a.jsxs)("button",{type:"button",onClick:t,disabled:r,className:"inline-flex max-w-full items-center gap-1 rounded-[3px] bg-[color:#292929] px-2 py-1 text-[11px] text-[var(--vk-text-muted)] hover:bg-[var(--vk-bg-hover)] hover:text-[var(--vk-text-normal)] disabled:opacity-60",title:e,"aria-label":`Open ${e}`,children:[r?(0,a.jsx)(i.A,{className:"h-3 w-3 shrink-0 animate-spin"}):(0,a.jsx)(o.A,{className:"h-3 w-3 shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:e})]})}function D({node:e,depth:t,expandedFolders:r,selectedPaths:s,openingContextPath:n,contextOpenLabel:l,onToggleFolder:p,onTogglePath:h,onOpenPath:b}){var g;let f=10+16*t;if("folder"===e.kind){let i=r.has(e.path);return(0,a.jsxs)("li",{children:[(0,a.jsxs)("button",{type:"button",onClick:()=>p(e.path),className:"flex w-full items-center gap-1.5 py-1 text-left text-[12px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)]",style:{paddingLeft:`${f}px`,paddingRight:"10px"},"aria-expanded":i,children:[i?(0,a.jsx)(d.A,{className:"h-3.5 w-3.5 shrink-0 text-[var(--vk-text-muted)]"}):(0,a.jsx)(c.A,{className:"h-3.5 w-3.5 shrink-0 text-[var(--vk-text-muted)]"}),i?(0,a.jsx)(x.A,{className:"h-3.5 w-3.5 shrink-0 text-[var(--vk-orange)]"}):(0,a.jsx)(m.A,{className:"h-3.5 w-3.5 shrink-0 text-[var(--vk-orange)]"}),(0,a.jsx)("span",{className:"truncate",children:e.name})]}),i?(0,a.jsx)("ul",{children:e.children.map(e=>(0,a.jsx)(D,{node:e,depth:t+1,expandedFolders:r,selectedPaths:s,openingContextPath:n,contextOpenLabel:l,onToggleFolder:p,onTogglePath:h,onOpenPath:b},e.path))}):null]})}let k=s.includes(e.path);return(0,a.jsx)("li",{className:"border-t border-[var(--vk-border)] first:border-t-0",children:(0,a.jsxs)("div",{className:"flex items-start gap-2 py-1.5",style:{paddingLeft:`${f+22}px`,paddingRight:"10px"},children:[(0,a.jsxs)("label",{className:"flex min-w-0 flex-1 cursor-pointer items-start gap-2 text-[12px] text-[var(--vk-text-normal)]",children:[(0,a.jsx)("input",{type:"checkbox",checked:k,onChange:()=>h(e.path),className:"mt-0.5 h-3.5 w-3.5 rounded border-[var(--vk-border)] bg-transparent"}),"image"===e.file.kind?(0,a.jsx)(u,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--vk-text-muted)]"}):(0,a.jsx)(v.A,{className:"mt-0.5 h-3.5 w-3.5 shrink-0 text-[var(--vk-text-muted)]"}),(0,a.jsxs)("span",{className:"min-w-0",children:[(0,a.jsx)("span",{className:"block truncate",children:e.name}),(0,a.jsx)("span",{className:"block truncate text-[11px] text-[var(--vk-text-muted)]",children:O(e.file)}),(0,a.jsxs)("span",{className:"block text-[11px] text-[var(--vk-text-muted)]",children:[e.file.kind,e.file.source?` \xb7 ${e.file.source}`:"",e.file.sizeBytes?` \xb7 ${!(g=e.file.sizeBytes)||g<=0?"":g<1024?`${g} B`:g<1048576?`${(g/1024).toFixed(1)} KB`:`${(g/1048576).toFixed(1)} MB`}`:""]})]})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>b(e.path),disabled:n===e.path,className:"inline-flex h-7 shrink-0 items-center gap-1 rounded-[3px] border border-[var(--vk-border)] px-2 text-[11px] text-[var(--vk-text-muted)] hover:bg-[var(--vk-bg-hover)] hover:text-[var(--vk-text-normal)] disabled:opacity-60",title:`${l}: ${e.path}`,"aria-label":`${l}: ${e.path}`,children:[n===e.path?(0,a.jsx)(i.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(o.A,{className:"h-3 w-3"}),(0,a.jsx)("span",{className:"hidden sm:inline",children:l})]})]})})}function H({value:e,options:t,disabled:r=!1,onChange:n,ariaLabel:l}){return(0,a.jsxs)(s.bL,{children:[(0,a.jsx)(s.l9,{asChild:!0,children:(0,a.jsxs)("button",{type:"button",disabled:r,"aria-label":l,className:"inline-flex h-10 w-full items-center justify-between rounded-[6px] border border-[var(--vk-border)] bg-[rgba(0,0,0,0.14)] px-3 text-left text-[14px] text-[var(--vk-text-normal)] outline-none transition-colors hover:bg-[var(--vk-bg-hover)] data-[state=open]:bg-[var(--vk-bg-hover)] disabled:cursor-not-allowed disabled:opacity-60",children:[(0,a.jsxs)("span",{className:"flex min-w-0 items-center gap-2",children:[(0,a.jsx)(N.N,{seed:{label:e},className:"h-5 w-5 border-none bg-transparent"}),(0,a.jsx)("span",{className:"truncate",children:T(e)})]}),(0,a.jsx)(d.A,{className:"h-4 w-4 shrink-0 text-[var(--vk-text-muted)]"})]})}),(0,a.jsx)(s.ZL,{children:(0,a.jsxs)(s.UC,{align:"start",sideOffset:6,className:"z-[120] rounded-[6px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] p-2 shadow-[0_18px_50px_rgba(0,0,0,0.35)] min-w-[220px] max-w-[calc(100vw-2rem)] max-h-[min(360px,50vh)] overflow-y-auto sm:min-w-[280px]",children:[(0,a.jsx)("p",{className:"px-3 pb-1 text-[12px] font-semibold uppercase tracking-[0.08em] text-[var(--vk-text-muted)]",children:"Agents"}),t.map(t=>{let r=t===e;return(0,a.jsxs)(s.q7,{onSelect:()=>n(t),className:"flex min-h-[40px] cursor-default items-center gap-2 rounded-[4px] px-3 py-2 text-[14px] leading-[21px] text-[var(--vk-text-normal)] outline-none hover:bg-[var(--vk-bg-hover)] focus:bg-[var(--vk-bg-hover)]",children:[(0,a.jsx)(N.N,{seed:{label:t},className:"h-5 w-5 border-none bg-transparent"}),(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate",children:T(t)}),(0,a.jsx)("span",{className:"ml-auto inline-flex h-4 w-4 items-center justify-center text-[var(--vk-text-strong)]",children:r?(0,a.jsx)(h.A,{className:"h-4 w-4 text-[var(--vk-orange)]"}):null})]},t)})]})})]})}function U(e,t){if(!e||e.projectId!==t.projectId||e.repository!==t.repository||e.boardPath!==t.boardPath||e.workspacePath!==t.workspacePath||e.primaryRoles.length!==t.primaryRoles.length||e.columns.length!==t.columns.length)return!1;for(let r=0;r<e.primaryRoles.length;r+=1)if(e.primaryRoles[r]!==t.primaryRoles[r])return!1;for(let r=0;r<e.columns.length;r+=1){let a=e.columns[r],s=t.columns[r];if(a.role!==s.role||a.heading!==s.heading||a.tasks.length!==s.tasks.length)return!1;for(let e=0;e<a.tasks.length;e+=1){let t=a.tasks[e],r=s.tasks[e];if(t.id!==r.id||t.text!==r.text||t.checked!==r.checked||t.agent!==r.agent||t.project!==r.project||t.type!==r.type||t.priority!==r.priority||t.taskRef!==r.taskRef||t.attemptRef!==r.attemptRef||t.issueId!==r.issueId||t.githubItemId!==r.githubItemId||t.notes!==r.notes||t.briefPath!==r.briefPath||t.vaultBriefPath!==r.vaultBriefPath||t.commentCount!==r.commentCount||t.comments.length!==r.comments.length||t.attachments.length!==r.attachments.length)return!1;for(let e=0;e<t.attachments.length;e+=1)if(t.attachments[e]!==r.attachments[e])return!1;for(let e=0;e<t.comments.length;e+=1)if(JSON.stringify(t.comments[e])!==JSON.stringify(r.comments[e]))return!1}}let r=e.githubProject??null,a=t.githubProject??null;if(JSON.stringify(r)!==JSON.stringify(a))return!1;let s=e.recentActions??[],n=t.recentActions??[];if(s.length!==n.length)return!1;for(let e=0;e<s.length;e+=1)if(JSON.stringify(s[e])!==JSON.stringify(n[e]))return!1;let l=e.recentWebhookDeliveries??[],i=t.recentWebhookDeliveries??[];if(l.length!==i.length)return!1;for(let e=0;e<l.length;e+=1)if(JSON.stringify(l[e])!==JSON.stringify(i[e]))return!1;return!0}function B(e){return{...e,repository:e.repository??null,githubProject:e.githubProject??null,recentActions:Array.isArray(e.recentActions)?e.recentActions:[],recentWebhookDeliveries:Array.isArray(e.recentWebhookDeliveries)?e.recentWebhookDeliveries:[],columns:Array.isArray(e.columns)?e.columns.map(e=>({...e,tasks:Array.isArray(e.tasks)?e.tasks.map(e=>({...e,issueId:e.issueId??null,githubItemId:e.githubItemId??null,attachments:Array.isArray(e.attachments)?e.attachments:[],notes:e.notes??null,briefPath:e.briefPath??null,vaultBriefPath:e.vaultBriefPath??null,commentCount:"number"==typeof e.commentCount?e.commentCount:Array.isArray(e.comments)?e.comments.length:0,comments:Array.isArray(e.comments)?e.comments:[]})):[]})):[]}}function z(e){return e.branch?.trim()||e.summary?.trim()||e.id.slice(0,8)}function J(e){return e.issueId?.trim()||e.taskRef?.trim()||e.id}function G(e){let t=e.metadata?.agent;return"string"==typeof t&&t.trim().length>0?t.trim():null}function W(e){let t=e.trim().toLowerCase();return"working"===t||"running"===t?"Running":"done"===t?"Done":"killed"===t?"Interrupted":"errored"===t?"Errored":"archived"===t?"Archived":e.split(/[-_\s]+/g).filter(Boolean).map(e=>e[0]?.toUpperCase()+e.slice(1)).join(" ")}function q(e){let t=e.trim().toLowerCase();return"working"===t||"running"===t?"border-[rgba(60,131,246,0.35)] bg-[rgba(60,131,246,0.12)] text-[#8db8ff]":"done"===t?"border-[rgba(84,176,79,0.35)] bg-[rgba(84,176,79,0.12)] text-[var(--vk-green)]":"killed"===t||"archived"===t?"border-[rgba(143,143,143,0.35)] bg-[rgba(143,143,143,0.10)] text-[var(--vk-text-muted)]":"errored"===t?"border-[rgba(210,81,81,0.35)] bg-[rgba(210,81,81,0.12)] text-[var(--vk-red)]":"border-[var(--vk-border)] bg-[rgba(255,255,255,0.03)] text-[var(--vk-text-muted)]"}function V(e){if(!e?.id)return"No GitHub Project linked";let t="number"==typeof e.number?`#${e.number}`:"Project";return`${t} ${e.title?.trim()||"Untitled"}`.trim()}function K(e){let t=Date.parse(e);return Number.isNaN(t)?e:new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",hour:"numeric",minute:"2-digit",timeZone:"UTC"}).format(new Date(t))}function Z(e,t){if(!e)return null;for(let r of e.columns){let e=r.tasks.find(e=>e.id===t);if(e)return{task:e,role:r.role}}return null}function Y(e,t){return e?.columns.find(e=>e.role===t)??null}function Q(e,t,r){let a=Y(e,r);if(!a)return 0;let s=a.tasks.length;return t?.role===r&&a.tasks.findIndex(e=>e.id===t.taskId)>=0&&(s-=1),Math.max(s,0)}function X(e,t,r){if(r){if(e.id===r&&t.id!==r)return -1;if(t.id===r&&e.id!==r)return 1}let a=e.lastActivityAt?Date.parse(e.lastActivityAt):0;return(t.lastActivityAt?Date.parse(t.lastActivityAt):0)-a}function ee({projectId:e,bridgeId:t,defaultAgent:r,agentOptions:s,projectSessions:d}){var c;let x=(0,l.useRouter)(),{preferences:m}=(0,y.g)(t),[p,u]=(0,n.useState)(null),[v,h]=(0,n.useState)(!1),[et,er]=(0,n.useState)(null),[ea,es]=(0,n.useState)(""),[en,el]=(0,n.useState)("active"),[ei,eo]=(0,n.useState)(!1),[ed,ec]=(0,n.useState)("intake"),[ex,em]=(0,n.useState)(""),[ep,eu]=(0,n.useState)(""),[ev,eh]=(0,n.useState)(r),[eb,eg]=(0,n.useState)("feature"),[ef,ek]=(0,n.useState)("medium"),[ej,eN]=(0,n.useState)(""),[ey,ew]=(0,n.useState)([]),[eC,eS]=(0,n.useState)([]),[eA,eP]=(0,n.useState)(""),[e$,eI]=(0,n.useState)([]),[eR,eE]=(0,n.useState)(!1),[eM,eT]=(0,n.useState)(null),[e_,eF]=(0,n.useState)(null),[eO,eL]=(0,n.useState)([]),[eD,eH]=(0,n.useState)(!1),[eU,eB]=(0,n.useState)(null),[ez,eJ]=(0,n.useState)(null),[eG,eW]=(0,n.useState)("intake"),[eq,eV]=(0,n.useState)(""),[eK,eZ]=(0,n.useState)(""),[eY,eQ]=(0,n.useState)(r),[eX,e0]=(0,n.useState)("feature"),[e1,e2]=(0,n.useState)("medium"),[e5,e3]=(0,n.useState)(""),[e4,e6]=(0,n.useState)(""),[e8,e9]=(0,n.useState)(""),[e7,te]=(0,n.useState)(!1),[tt,tr]=(0,n.useState)(null),[ta,ts]=(0,n.useState)(""),[tn,tl]=(0,n.useState)(!1),[ti,to]=(0,n.useState)(null),[td,tc]=(0,n.useState)(null),[tx,tm]=(0,n.useState)(null),[tp,tu]=(0,n.useState)(!1),[tv,th]=(0,n.useState)(!1),[tb,tg]=(0,n.useState)(!1),[tf,tk]=(0,n.useState)(null),[tj,tN]=(0,n.useState)(null),[ty,tw]=(0,n.useState)(""),tC=(0,n.useRef)(!1),tS=(0,n.useRef)(!1),tA=(0,n.useRef)(null),tP=(0,n.useRef)(null),t$=(0,n.useRef)(Promise.resolve(null)),tI=(0,n.useRef)(0),tR="obsidian"===(c=m?.markdownEditor?.trim()||"obsidian")||"vscode"===c||"typora"===c||"logseq"===c?`Open in ${$[c]??"your editor"}`:"Open file",[tE,tM]=(0,n.useState)(!0),tT=(0,n.useMemo)(()=>{let e=[...new Set(s.filter(Boolean))];return e.includes(r)||e.unshift(r),e},[s,r]);(0,n.useEffect)(()=>{tP.current=p},[p]),(0,n.useEffect)(()=>{tT.includes(ev)||eh(tT[0]??r)},[ev,r,tT]),(0,n.useEffect)(()=>{tT.includes(eY)||eQ(tT[0]??r)},[r,eY,tT]),(0,n.useEffect)(()=>{if(!ei&&!ez||!e)return;let r=!1;return(async()=>{eE(!0),eT(null);try{let a=await fetch((0,w.S)(`/api/context-files?projectId=${encodeURIComponent(e)}`,t)),s=await a.json().catch(()=>null);if(!a.ok)throw Error(s?.error??`Failed to load context files: ${a.status}`);if(r)return;let n=Array.isArray(s?.files)?s.files:[];eI(n)}catch(e){if(r)return;eI([]),eT(e instanceof Error?e.message:"Failed to load context files")}finally{r||eE(!1)}})(),()=>{r=!0}},[t,ei,ez,e]),(0,n.useEffect)(()=>{tC.current=!1,tu(!1),tk(null),tN(null),tw("")},[t,e]);let t_=(0,n.useCallback)(async r=>{if(!e){u(null),er(null),h(!1),tC.current=!1;return}if(!tS.current&&(!r?.silent||!(tI.current>0))){tS.current=!0,r?.silent||h(!0);try{let r=await fetch((0,w.S)(`/api/boards?projectId=${encodeURIComponent(e)}`,t)),a=await r.json().catch(()=>null);if(!r.ok)throw Error(a?.error??`Failed to load board: ${r.status}`);let s=B(a);tC.current=!0,u(e=>U(e,s)?e:s),er(null)}catch(e){r?.silent&&tC.current||(u(null),er(e instanceof Error?e.message:"Failed to load board"))}finally{r?.silent||h(!1),tS.current=!1}}},[t,e]),tF=(0,n.useCallback)(t=>{e&&(null!==tA.current&&(window.clearTimeout(tA.current),tA.current=null),tA.current=window.setTimeout(()=>{tA.current=null,t_(t)},1200))},[t_,e]);(0,n.useEffect)(()=>{t_({silent:!1})},[t_]);let tO=(0,n.useCallback)(async()=>{if(!e){tN(null),tk(null);return}th(!0),tk(null);try{let r=await fetch((0,w.S)(`/api/github/projects?projectId=${encodeURIComponent(e)}`,t)),a=await r.json().catch(()=>null);if(!r.ok)throw Error(a?.error??`Failed to load GitHub Projects (${r.status})`);let s={...a,projects:Array.isArray(a.projects)?a.projects:[]};tN(s),tw(s.linkedProject?.id?.trim()||s.projects[0]?.id?.trim()||"")}catch(e){tk(e instanceof Error?e.message:"Failed to load GitHub Projects"),tN(null),tw("")}finally{th(!1)}},[t,e]);(0,n.useEffect)(()=>{if(!e)return;let t=()=>{tE&&t_({silent:!0})},r=null,a=()=>{let e=tE?2e4:6e4;r=window.setTimeout(()=>{t(),a()},e)};a(),window.addEventListener("focus",t);let s=()=>{let e="visible"===document.visibilityState;tM(e),e&&t()};return document.addEventListener("visibilitychange",s),()=>{null!=r&&window.clearTimeout(r),window.removeEventListener("focus",t),document.removeEventListener("visibilitychange",s)}},[t_,tE,e]),(0,n.useEffect)(()=>{e&&tC.current&&tF({silent:!0})},[e,d,tF]),(0,n.useEffect)(()=>()=>{null!==tA.current&&(window.clearTimeout(tA.current),tA.current=null)},[t_,e]),(0,n.useEffect)(()=>{tp&&e&&tO()},[tO,e,tp]);let tL=p?.columns??[],tD=(0,n.useMemo)(()=>{let e=ea.trim().toLowerCase(),t="all"===en?null:new Set("backlog"===en?["intake","ready"]:"cancelled"===en?["cancelled"]:["intake","ready","dispatching","inProgress","needsInput","blocked","errored","review","merge"]);return tL.filter(e=>!t||t.has(e.role)).map(t=>e?{...t,tasks:t.tasks.filter(t=>{let r=t.comments.map(e=>`${e.author} ${e.body}`).join(" ");return`${t.text} ${t.agent??""} ${t.type??""} ${t.priority??""} ${t.issueId??""} ${t.notes??""} ${t.briefPath??""} ${t.attachments.join(" ")} ${r}`.toLowerCase().includes(e)})}:t)},[tL,ea,en]),tH=0===ea.trim().length,tU=(0,n.useMemo)(()=>{let e=eA.trim().toLowerCase(),t=e?e$.filter(t=>`${t.path} ${O(t)} ${t.name} ${t.source??""}`.toLowerCase().includes(e)):e$,r=new Map;for(let e of t)r.has(e.path)||r.set(e.path,e);return[...r.values()]},[e$,eA]),tB=(0,n.useMemo)(()=>(function(e){let t=new Map;t.set("",new Map);let r=(e,r)=>(t.has(e)||t.set(e,new Map),{kind:"folder",name:r,path:e,children:[]});for(let a of e){let e=O(a),s=_(e);if(0===s.length)continue;let n="";for(let e=0;e<s.length-1;e+=1){let a=s[e],l=n?`${n}/${a}`:a,i=t.get(n)??new Map;t.set(n,i),i.has(l)||i.set(l,r(l,a)),t.has(l)||t.set(l,new Map),n=l}let l=t.get(n)??new Map;l.set(a.path,{kind:"file",name:a.name,path:a.path,file:{...a,displayPath:e}}),t.set(n,l)}let a=e=>[...t.get(e)?.values()??[]].map(e=>"folder"===e.kind?{...e,children:a(e.path)}:e).sort(F);return a("")})(tU),[tU]),tz=(0,n.useMemo)(()=>new Map(e$.map(e=>[e.path,e])),[e$]),tJ=(0,n.useMemo)(()=>ey.map(e=>tz.get(e)).filter(e=>!!e),[tz,ey]),tG=(0,n.useMemo)(()=>new Set(tB.filter(e=>"folder"===e.kind).map(e=>e.path)),[tB]),tW=(0,n.useMemo)(()=>eA.trim().length>0?function e(t,r=new Set){for(let a of t)"folder"===a.kind&&(r.add(a.path),e(a.children,r));return r}(tB):function(e){let t=new Set;for(let r of e){let e=_(r),a="";for(let r=0;r<e.length-1;r+=1)a=a?`${a}/${e[r]}`:e[r],t.add(a)}return t}(ey.map(e=>{let t=tz.get(e);return t?O(t):e})),[tz,eA,tB,ey]),tq=(0,n.useMemo)(()=>{let e=new Set(tG);for(let t of eC)e.add(t);for(let t of tW)e.add(t);return e},[tW,tG,eC]),tV=(0,n.useMemo)(()=>{let e=tL.find(e=>e.role===ed);return e?.heading||P[ed]},[tL,ed]),tK=(0,n.useMemo)(()=>{if(!ez)return d;let e=Z(p,ez.task.id)??ez,t=J(e.task);return[...d].sort((r,a)=>{let s=r.id===e.task.attemptRef||r.issueId?.trim()===t;return s!==(a.id===e.task.attemptRef||a.issueId?.trim()===t)?s?-1:1:X(r,a,e.task.attemptRef)})},[p,ez,d]),tZ=(0,n.useMemo)(()=>ez?Z(p,ez.task.id)??ez:null,[p,ez]);function tY(e){ec(e),eo(!0),em(""),eu(""),eh(tT[0]??r),eg("feature"),ek("medium"),eB(null),eN(""),eP(""),ew([]),eS([]),eL([])}let tQ=(0,n.useCallback)(async t=>{if(e){eF(t),ez?tr(null):ei?eB(null):er(null);try{let r=await fetch("/api/context-files/open",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:e,path:t})}),a=await r.json().catch(()=>null);if(!r.ok)throw Error(a?.error??`Failed to open context file: ${r.status}`)}catch(e){var r;r=e instanceof Error?e.message:"Failed to open context file",ez?tr(r):ei?eB(r):er(r)}finally{eF(e=>e===t?null:e)}}},[ei,ez,e]);function tX(e){ew(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}function t0(e){eS(t=>t.includes(e)?t.filter(t=>t!==e):[...t,e])}async function t1(){if(e&&ex.trim()){eH(!0),eB(null);try{let r=await fetch((0,w.S)("/api/boards",t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:e,title:ex.trim(),description:ep.trim()||void 0,contextNotes:ej.trim()||void 0,attachments:ey.length>0?ey:void 0,agent:ev,role:ed,type:eb.trim()||void 0,priority:ef.trim()||void 0})}),a=await r.json().catch(()=>null);if(!r.ok||!a||!("columns"in a))throw Error(a?.error??`Failed to create task: ${r.status}`);let s=B(a),n=s.columns.flatMap(e=>e.tasks).find(e=>e.id===a.createdTaskId);if(eO.length>0&&n){let r=new FormData;for(let t of(r.append("projectId",e),r.append("taskRef",n.taskRef?.trim()||n.id),eO))r.append("files",t);let a=await fetch((0,w.S)("/api/attachments",t),{method:"POST",body:r}),l=await a.json().catch(()=>null);if(!a.ok)throw Error(l?.error??`Upload failed: ${a.status}`);let i=(l?.files??[]).map(e=>e.path?.trim()).filter(e=>!!e);if(i.length>0){let r=await fetch((0,w.S)("/api/boards",t),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:e,taskId:n.id,attachments:[...new Set([...n.attachments,...i])]})}),a=await r.json().catch(()=>null);if(!r.ok||!a||!("columns"in a))throw Error(a?.error??`Failed to attach uploads: ${r.status}`);s=B(a)}}u(e=>({...e??s,...s})),em(""),eu(""),eg("feature"),ek("medium"),eN(""),ew([]),eP(""),eL([]),eo(!1)}catch(e){eB(e instanceof Error?e.message:"Failed to create task")}finally{eH(!1)}}}async function t2(r,a){if(!e)return null;let s=tP.current;if(s&&a?.optimisticUpdate){let e=a.optimisticUpdate(s);e&&(tP.current=e,u(t=>U(t,e)?t:e))}tI.current+=1;let n=t$.current.catch(()=>null).then(async()=>{let a=await fetch((0,w.S)("/api/boards",t),{method:"PATCH",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:e,...r})}),s=await a.json().catch(()=>null);if(!a.ok)throw Error(s?.error??`Failed to update board: ${a.status}`);let n=B(s);return tP.current=n,u(e=>U(e,n)?e:n),er(null),n});t$.current=n.then(()=>null,()=>null);try{return await n}catch(e){throw a?.optimisticUpdate&&s&&(tP.current=s,u(e=>U(e,s)?e:s)),e}finally{tI.current=Math.max(0,tI.current-1)}}async function t5(r){if(e&&!tb){tg(!0),tk(null);try{let a=await fetch((0,w.S)("/api/github/projects",t),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:e,link:r?.id?r:null})}),s=await a.json().catch(()=>null);if(!a.ok)throw Error(s?.error??`Failed to update GitHub Project link (${a.status})`);u(e=>e?{...e,githubProject:s?.githubProject??null}:e),await tO()}catch(e){tk(e instanceof Error?e.message:"Failed to update GitHub Project link")}finally{tg(!1)}}}async function t3(r){if(e&&!tb){tg(!0),tk(null);try{let a=await fetch((0,w.S)("/api/github/projects/sync",t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:e,direction:r})}),s=await a.json().catch(()=>null);if(!a.ok)throw Error(s?.error??`Failed to ${r} GitHub Project (${a.status})`);if(s?.board){let e=B(s.board);u(t=>U(t,e)?t:e)}else await t_({silent:!0});await tO()}catch(e){tk(e instanceof Error?e.message:`Failed to ${r} GitHub Project`)}finally{tg(!1)}}}function t4(){e7||tn||(eJ(null),tr(null),ts(""),to(null))}async function t6(){if(tZ&&eq.trim()){te(!0),tr(null);try{await t2({taskId:tZ.task.id,role:eG,title:eq.trim(),description:eK,contextNotes:e4.trim()||"",issueId:e5.trim()||"",agent:eY,type:eX,priority:e1,attemptRef:e8,taskRef:e8?tZ.task.taskRef??tZ.task.id:tZ.task.taskRef??""}),eJ(null)}catch(e){tr(e instanceof Error?e.message:"Failed to update task")}finally{te(!1)}}}async function t8(){if(e&&tZ&&ta.trim()){tl(!0),to(null);try{let r=await fetch((0,w.S)("/api/boards/comments",t),{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({projectId:e,taskId:tZ.task.id,body:ta.trim()})}),a=await r.json().catch(()=>null);if(!r.ok)throw Error(a?.error??`Failed to add comment: ${r.status}`);let s=B(a);u(e=>U(e,s)?e:s),ts("")}catch(e){to(e instanceof Error?e.message:"Failed to add comment")}finally{tl(!1)}}}async function t9(e){if(!td)return;let t=Y(tP.current,td.role),r=t?.tasks.findIndex(e=>e.id===td.taskId)??-1,a=Q(tP.current,td,e),s=tx?.role===e?tx.index:a,n=td.role!==e||s!==r;try{n&&await t2({taskId:td.taskId,role:e,targetIndex:s},{optimisticUpdate:t=>(function(e,t,r,a){if(!e)return e;let s=e.columns.map(e=>({...e,tasks:[...e.tasks]})),n=-1,l=-1,i=null;for(let e=0;e<s.length;e+=1){let r=s[e]?.tasks.findIndex(e=>e.id===t)??-1;if(r>=0){n=e,l=r,i=s[e].tasks.splice(r,1)[0]??null;break}}if(!i||n<0)return e;let o=s.findIndex(e=>e.role===r);o<0&&(s.push({role:r,heading:P[r],tasks:[]}),o=s.length-1);let d=s[o].tasks,c=Math.max(0,Math.min(a,d.length));return(d.splice(c,0,i),n===o&&l===c)?e:{...e,columns:s}})(t,td.taskId,e,s)})}catch(e){er(e instanceof Error?e.message:"Failed to move task")}finally{tc(null),tm(null)}}return e?(0,a.jsxs)("section",{className:"flex min-h-0 flex-1 flex-col overflow-hidden sm:overflow-hidden",children:[(0,a.jsxs)("header",{className:"border-b border-[var(--vk-border)] px-4 py-3",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("div",{className:"inline-flex rounded-[3px] border border-[var(--vk-border)] p-px",children:[["active","Active"],["all","All"],["backlog","Backlog"],["cancelled","Cancelled"]].map(([e,t])=>(0,a.jsx)("button",{type:"button",onClick:()=>el(e),className:(0,C.cn)("px-3 py-1 text-[13px]",en===e?"rounded-[2px] bg-[var(--vk-bg-active)] text-[var(--vk-text-strong)]":"text-[var(--vk-text-muted)] hover:bg-[var(--vk-bg-hover)]"),children:t},e))}),(0,a.jsxs)("div",{className:"ml-auto flex w-full min-w-0 flex-wrap items-center gap-2 sm:w-auto sm:min-w-[220px] sm:flex-nowrap sm:flex-none",children:[(0,a.jsxs)("label",{className:"flex h-[38px] min-w-0 flex-1 items-center rounded-[3px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 sm:h-[31px] sm:min-w-[200px] sm:w-[240px] sm:flex-none",children:[(0,a.jsx)(b.A,{className:"h-3.5 w-3.5 text-[var(--vk-text-muted)]"}),(0,a.jsx)("input",{value:ea,onChange:e=>es(e.target.value),placeholder:"Search tasks...",className:"ml-2 w-full bg-transparent text-[14px] text-[var(--vk-text-normal)] outline-none placeholder:text-[var(--vk-text-muted)]"})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>tY("intake"),className:"inline-flex h-[38px] w-full items-center justify-center gap-1 rounded-[3px] bg-[var(--vk-bg-active)] px-3 text-[14px] text-[var(--vk-text-strong)] hover:bg-[var(--vk-bg-hover)] sm:h-[31px] sm:w-auto",children:[(0,a.jsx)("span",{children:"New Issue"}),(0,a.jsx)(g.A,{className:"h-3.5 w-3.5"})]})]})]}),(0,a.jsxs)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>tu(e=>!e),className:"inline-flex h-[38px] items-center gap-2 rounded-[3px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-3 text-[13px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)] sm:h-[31px]",children:[(0,a.jsx)("span",{className:"hidden sm:inline",children:"GitHub Project"}),(0,a.jsx)("span",{className:"sm:hidden",children:"GitHub"}),(0,a.jsx)("span",{className:"text-[var(--vk-text-muted)]",children:p?.githubProject?.id?V(p.githubProject):"Connect"})]}),p?.githubProject?.url?(0,a.jsxs)("a",{href:p.githubProject.url,target:"_blank",rel:"noreferrer",className:"inline-flex h-[38px] items-center gap-1 rounded-[3px] border border-[var(--vk-border)] px-3 text-[13px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)] sm:h-[31px]",children:[(0,a.jsx)("span",{children:"Open Project"}),(0,a.jsx)(o.A,{className:"h-3.5 w-3.5"})]}):null]}),!tH&&(0,a.jsx)("p",{className:"pt-2 text-[12px] text-[var(--vk-text-muted)]",children:"Clear search to reorder cards."}),tp&&(0,a.jsxs)("div",{className:"mt-3 rounded-[6px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] p-3",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsxs)("label",{className:"min-w-0 flex-1",children:[(0,a.jsx)("span",{className:"mb-1 block text-[11px] uppercase tracking-[0.08em] text-[var(--vk-text-muted)]",children:"Linked project"}),(0,a.jsxs)("select",{value:ty,onChange:e=>tw(e.target.value),disabled:tv||tb,className:"h-9 w-full rounded-[3px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 text-[14px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]",children:[(0,a.jsx)("option",{value:"",children:tv?"Loading GitHub Projects...":"Select a GitHub Project"}),(tj?.projects??[]).map(e=>(0,a.jsx)("option",{value:e.id??"",children:V(e)},e.id??"unknown"))]})]}),(0,a.jsx)("button",{type:"button",disabled:!ty||tv||tb,onClick:()=>{t5(tj?.projects.find(e=>e.id===ty)??null)},className:"inline-flex h-9 items-center rounded-[3px] border border-[var(--vk-border)] px-3 text-[13px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-50",children:tb?(0,a.jsx)(i.A,{className:"h-4 w-4 animate-spin"}):"Connect"}),(0,a.jsx)("button",{type:"button",disabled:!p?.githubProject?.id||tb,onClick:()=>void t5(null),className:"inline-flex h-9 items-center rounded-[3px] border border-[var(--vk-border)] px-3 text-[13px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-50",children:"Disconnect"}),(0,a.jsxs)("button",{type:"button",disabled:!p?.githubProject?.id||tb,onClick:()=>void t3("pull"),className:"inline-flex h-9 items-center gap-2 rounded-[3px] border border-[var(--vk-border)] px-3 text-[13px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-50",children:[tb?(0,a.jsx)(i.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(f.A,{className:"h-4 w-4"}),"Pull"]}),(0,a.jsx)("button",{type:"button",disabled:!p?.githubProject?.id||tb,onClick:()=>void t3("push"),className:"inline-flex h-9 items-center rounded-[3px] bg-[var(--vk-bg-active)] px-3 text-[13px] text-[var(--vk-text-strong)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-50",children:"Push"})]}),(0,a.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-3 text-[12px] text-[var(--vk-text-muted)]",children:[(0,a.jsxs)("span",{children:["Repository:"," ",p?.repository?.trim()||tj?.repository?.trim()||"Not configured"]}),tj?.ownerLogin?(0,a.jsxs)("span",{children:["Owner: ",tj.ownerLogin]}):null]}),tf&&(0,a.jsx)("p",{className:"mt-2 text-[12px] text-[var(--vk-red)]",children:tf}),(p?.recentWebhookDeliveries?.length??0)>0&&(0,a.jsxs)("div",{className:"mt-3 rounded-[6px] border border-[var(--vk-border)] bg-[rgba(255,255,255,0.02)] p-3",children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-2",children:[(0,a.jsx)("h3",{className:"text-[12px] uppercase tracking-[0.08em] text-[var(--vk-text-muted)]",children:"Webhook diagnostics"}),(0,a.jsx)("span",{className:"text-[11px] text-[var(--vk-text-muted)]",children:(p?.recentWebhookDeliveries??[]).length})]}),(0,a.jsx)("div",{className:"space-y-2",children:(p?.recentWebhookDeliveries??[]).slice(0,6).map(e=>{var t;let r,s;return(0,a.jsxs)("div",{className:"rounded-[4px] border border-[var(--vk-border)] bg-[rgba(255,255,255,0.02)] p-2",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:`inline-flex h-5 items-center rounded-[3px] border px-2 text-[10px] ${"synced"===(r=e.status.trim().toLowerCase())?"border-[rgba(84,176,79,0.35)] bg-[rgba(84,176,79,0.12)] text-[var(--vk-green)]":"failed"===r?"border-[rgba(210,81,81,0.35)] bg-[rgba(210,81,81,0.12)] text-[var(--vk-red)]":"border-[var(--vk-border)] bg-[rgba(255,255,255,0.03)] text-[var(--vk-text-muted)]"}`,children:"synced"===(s=(t=e.status).trim().toLowerCase())?"Synced":"failed"===s?"Failed":"skipped"===s?"Skipped":t}),(0,a.jsxs)("span",{className:"text-[12px] text-[var(--vk-text-normal)]",children:[e.event,e.action?` / ${e.action}`:""]}),(0,a.jsx)("span",{className:"ml-auto text-[11px] text-[var(--vk-text-muted)]",children:K(e.timestamp)})]}),(0,a.jsx)("p",{className:"mt-1 text-[12px] text-[var(--vk-text-muted)]",children:e.detail}),e.repository?(0,a.jsxs)("p",{className:"mt-1 text-[11px] text-[var(--vk-text-muted)]",children:["Repo: ",e.repository]}):null]},e.id)})})]})]}),(p?.recentActions?.length??0)>0&&(0,a.jsxs)("div",{className:"mt-3 rounded-[6px] border border-[var(--vk-border)] bg-[rgba(255,255,255,0.02)] p-3",children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-2",children:[(0,a.jsx)("h3",{className:"text-[12px] uppercase tracking-[0.08em] text-[var(--vk-text-muted)]",children:"Recent activity"}),(0,a.jsx)("span",{className:"text-[11px] text-[var(--vk-text-muted)]",children:(p?.recentActions??[]).length})]}),(0,a.jsx)("div",{className:"space-y-2",children:(p?.recentActions??[]).slice(0,6).map(e=>(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-x-2 gap-y-1 text-[12px]",children:[(0,a.jsx)("span",{className:"rounded-[3px] bg-[color:#292929] px-2 py-0.5 text-[11px] text-[var(--vk-text-muted)]",children:e.source}),(0,a.jsx)("span",{className:"text-[var(--vk-text-normal)]",children:e.action}),(0,a.jsx)("span",{className:"min-w-0 flex-1 truncate text-[var(--vk-text-muted)]",title:e.detail,children:e.detail}),(0,a.jsx)("span",{className:"text-[11px] text-[var(--vk-text-muted)]",children:K(e.timestamp)})]},e.id))})]})]}),(0,a.jsx)("div",{className:"min-h-0 flex-1 flex-shrink-0 overflow-y-auto overscroll-contain p-4 touch-auto",children:v?(0,a.jsxs)("div",{className:"flex h-full items-center justify-center text-[var(--vk-text-muted)]",children:[(0,a.jsx)(i.A,{className:"h-4 w-4 animate-spin"}),(0,a.jsx)("span",{className:"ml-2 text-[14px]",children:"Loading board..."})]}):et?(0,a.jsx)("div",{className:"rounded-[4px] border border-[color:color-mix(in_srgb,var(--vk-red)_55%,transparent)] bg-[color:color-mix(in_srgb,var(--vk-red)_12%,transparent)] px-3 py-2 text-[13px] text-[var(--vk-red)]",children:et}):(0,a.jsx)("div",{className:"flex min-w-0 flex-col gap-3 pb-3 sm:h-full sm:flex-row sm:items-stretch sm:overflow-x-auto sm:pb-3",children:tD.map(e=>{let s=tL.find(t=>t.role===e.role),n=tH&&td?.role===e.role?s?.tasks.findIndex(e=>e.id===td.taskId)??-1:-1,l=Math.max((s?.tasks.length??e.tasks.length)-(n>=0),0);return(0,a.jsxs)("article",{className:(0,C.cn)("flex min-h-0 w-full shrink-0 flex-col rounded-[14px] border border-[var(--vk-border)] bg-[linear-gradient(180deg,rgba(255,255,255,0.05),rgba(255,255,255,0.02))] shadow-[0_18px_40px_rgba(0,0,0,0.24)] sm:h-full sm:min-h-[560px] sm:w-[320px]",td&&"snap-start"),children:[(0,a.jsxs)("header",{className:"flex items-center gap-2 border-b border-[var(--vk-border)] px-3 py-3",children:[(0,a.jsx)("span",{className:"h-2.5 w-2.5 rounded-full",style:{backgroundColor:A[e.role]}}),(0,a.jsx)("div",{className:"min-w-0 flex-1",children:(0,a.jsx)("p",{className:"truncate text-[14px] font-medium text-[var(--vk-text-normal)]",children:e.heading||P[e.role]})}),(0,a.jsx)("span",{className:"inline-flex h-6 min-w-[28px] items-center justify-center rounded-full border border-[rgba(255,255,255,0.08)] bg-[rgba(0,0,0,0.18)] px-2 text-[11px] text-[var(--vk-text-muted)]",children:e.tasks.length}),(0,a.jsx)("button",{type:"button",onClick:()=>tY(e.role),className:"inline-flex h-9 w-9 items-center justify-center rounded-[7px] text-[var(--vk-text-muted)] hover:bg-[var(--vk-bg-hover)] sm:h-7 sm:w-7","aria-label":`Add task to ${e.heading}`,children:(0,a.jsx)(g.A,{className:"h-3.5 w-3.5"})})]}),(0,a.jsxs)("div",{className:(0,C.cn)("flex-1 min-h-0 px-3 pb-3 pt-2 sm:overflow-y-auto sm:overscroll-contain",td?.role===e.role&&"bg-[rgba(255,255,255,0.02)]"),onDragOver:t=>tH?function(e,t){if(!td||(e.preventDefault(),e.target!==e.currentTarget))return;let r=Q(tP.current,td,t);tm(e=>e?.role===t&&e.index===r?e:{role:t,index:r})}(t,e.role):void 0,onDrop:t=>{t.preventDefault(),tH&&t9(e.role)},children:[tH&&tx?.role===e.role&&0===tx.index?(0,a.jsx)("div",{className:"mb-2 h-[3px] rounded-full bg-[var(--vk-orange)] shadow-[0_0_0_1px_rgba(0,0,0,0.2)]"}):null,0===e.tasks.length&&(0,a.jsx)("div",{className:"rounded-[10px] border border-dashed border-[var(--vk-border)] px-3 py-4 text-[13px] text-[var(--vk-text-muted)]",children:"Drop a card here or create a new one."}),(0,a.jsx)("div",{className:"space-y-2",children:e.tasks.map(l=>{let{title:i,description:c}=M(l.text),m=s?.tasks.findIndex(e=>e.id===l.id)??0,u=n>=0?l.id===td?.taskId?null:m>n?m-1:m:m;J(l);let v=function(e,t){let r=t?.trim();if(!e||!r||!/^\d+$/.test(r))return null;let[a,s]=e.trim().replace(/^https?:\/\/github\.com\//,"").replace(/^git@github\.com:/,"").replace(/^ssh:\/\/git@github\.com\//,"").replace(/\.git$/,"").replace(/\/+$/,"").split("/");return a&&s?`https://github.com/${a}/${s}/issues/${r}`:null}(p?.repository,l.issueId),h=d.filter(e=>!!(e.id===l.attemptRef||e.metadata?.taskId===l.id||l.taskRef?.trim()&&e.metadata?.taskRef?.trim()===l.taskRef.trim())||e.issueId?.trim()===J(l)).sort((e,t)=>X(e,t,l.attemptRef??null)),b=l.attemptRef?h.find(e=>e.id===l.attemptRef)??null:h[0]??null,g=l.attemptRef&&!h.some(e=>e.id===l.attemptRef)?l.attemptRef:null;return(0,a.jsxs)("div",{children:[tH&&tx?.role===e.role&&null!==u&&tx.index===u?(0,a.jsx)("div",{className:"mb-2 h-[3px] rounded-full bg-[var(--vk-orange)] shadow-[0_0_0_1px_rgba(0,0,0,0.2)]"}):null,(0,a.jsxs)("div",{draggable:tH,onDragStart:()=>{var t,r;let a;return tH?(tc({taskId:t=l.id,role:r=e.role}),a=Q(tP.current,{taskId:t,role:r},r),void tm({role:r,index:a})):void 0},onDragOver:t=>tH?function(e,t,r){if(!td)return;e.preventDefault();let a=function(e,t,r,a,s,n){let l=Y(e,r);if(!l)return 0;let i=l.tasks.findIndex(e=>e.id===a);if(i<0)return Q(e,t,r);let o=n.getBoundingClientRect(),d=i+ +("after"==(s<o.top+o.height/2?"before":"after"));if(t?.role===r){let e=l.tasks.findIndex(e=>e.id===t.taskId);e>=0&&e<d&&(d-=1)}return d}(tP.current,td,t,r,e.clientY,e.currentTarget);tm(e=>e?.role===t&&e.index===a?e:{role:t,index:a})}(t,e.role,l.id):void 0,onDragEnd:()=>{tc(null),tm(null)},className:(0,C.cn)("rounded-[10px] border border-[rgba(255,255,255,0.08)] bg-[rgba(23,25,30,0.96)] p-3 shadow-[0_10px_24px_rgba(0,0,0,0.24)] [content-visibility:auto] [contain-intrinsic-size:240px]",td?.taskId===l.id&&"opacity-60"),children:[(0,a.jsxs)("div",{className:"flex items-start gap-2",children:[(0,a.jsx)("p",{className:"min-w-0 flex-1 font-mono text-[12px] text-[var(--vk-text-muted)]",children:l.taskRef?.trim()||(l.id.length>12?`TASK-${l.id.split("-")[0]?.toUpperCase()??l.id.toUpperCase()}`:l.id)}),(0,a.jsx)("button",{type:"button",onClick:()=>(function(e,t){let{title:a,description:s}=M(e.text);eJ({task:e,role:t}),eW(t),eV(a),eZ(s),eQ(e.agent??tT[0]??r),e0(e.type??"feature"),e2(e.priority??"medium"),e3(e.issueId??""),e6(e.notes??""),e9(e.attemptRef??""),tr(null),ts(""),to(null)})(l,e.role),className:"inline-flex h-9 w-9 items-center justify-center rounded-[3px] text-[var(--vk-text-muted)] hover:bg-[var(--vk-bg-hover)] hover:text-[var(--vk-text-normal)] sm:h-6 sm:w-6","aria-label":"Edit task",title:"Edit task",children:(0,a.jsx)(k,{className:"h-3.5 w-3.5"})})]}),(0,a.jsx)("p",{className:"pt-1 text-[15px] leading-[22px] text-[var(--vk-text-normal)]",children:i}),c&&(0,a.jsx)("p",{className:"pt-1 text-[13px] leading-[20px] text-[var(--vk-text-muted)]",children:c}),l.notes&&(0,a.jsx)("p",{className:"pt-2 text-[12px] leading-[18px] text-[var(--vk-text-muted)]",children:l.notes}),l.commentCount>0&&(0,a.jsxs)("div",{className:"mt-2 flex items-center gap-1 text-[11px] text-[var(--vk-text-muted)]",children:[(0,a.jsx)(j,{className:"h-3.5 w-3.5"}),(0,a.jsxs)("span",{children:[l.commentCount," comment",1===l.commentCount?"":"s"]})]}),(l.issueId||l.briefPath||l.attachments.length>0)&&(0,a.jsxs)("div",{className:"mt-2 flex flex-wrap items-center gap-1.5",children:[l.issueId?v?(0,a.jsxs)("a",{href:v,target:"_blank",rel:"noreferrer",className:"inline-flex h-5 items-center gap-1 rounded-[3px] border border-[var(--vk-border)] px-2 text-[11px] text-[var(--vk-text-muted)] hover:bg-[var(--vk-bg-hover)]",children:[(0,a.jsxs)("span",{children:["Issue #",l.issueId]}),(0,a.jsx)(o.A,{className:"h-3 w-3"})]}):(0,a.jsxs)("span",{className:"inline-flex h-5 items-center rounded-[3px] border border-[var(--vk-border)] px-2 text-[11px] text-[var(--vk-text-muted)]",children:["Issue ",l.issueId]}):null,l.briefPath?(0,a.jsx)(L,{attachment:l.briefPath,opening:e_===l.briefPath,onOpen:()=>void tQ(l.briefPath)}):null,l.attachments.map(e=>(0,a.jsx)(L,{attachment:e,opening:e_===e,onOpen:()=>void tQ(e)},`${l.id}-${e}`))]}),(h.length>0||g)&&(0,a.jsxs)("div",{className:"mt-3 rounded-[4px] border border-[var(--vk-border)] bg-[rgba(255,255,255,0.02)] p-2",children:[(0,a.jsxs)("div",{className:"flex items-center justify-between gap-2",children:[(0,a.jsx)("span",{className:"text-[11px] uppercase tracking-[0.08em] text-[var(--vk-text-muted)]",children:"Runs"}),(0,a.jsx)("span",{className:"text-[11px] text-[var(--vk-text-muted)]",children:h.length+ +!!g})]}),(0,a.jsxs)("div",{className:"mt-2 space-y-1.5",children:[b?(0,a.jsxs)("button",{type:"button",onClick:()=>x.push((0,S.s)(b.id,{bridgeId:t,tab:"terminal"})),className:"flex w-full items-center justify-between gap-2 rounded-[3px] border border-[rgba(255,255,255,0.05)] bg-[rgba(255,255,255,0.03)] px-2 py-1.5 text-left hover:bg-[var(--vk-bg-hover)]",title:b.id,children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[G(b)?(0,a.jsx)(N.N,{seed:{label:G(b)},className:"h-5 w-5"}):null,(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("div",{className:"truncate text-[12px] text-[var(--vk-text-normal)]",children:z(b)}),(0,a.jsx)("div",{className:"truncate text-[11px] text-[var(--vk-text-muted)]",children:"Primary run"})]})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,a.jsx)("span",{className:`inline-flex h-5 items-center rounded-[3px] border px-2 text-[10px] ${q(b.status)}`,children:W(b.status)}),(0,a.jsx)(o.A,{className:"h-3 w-3 text-[var(--vk-text-muted)]"})]})]}):null,h.filter(e=>e.id!==b?.id).map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>x.push((0,S.s)(e.id,{bridgeId:t,tab:"terminal"})),className:"flex w-full items-center justify-between gap-2 rounded-[3px] px-2 py-1.5 text-left hover:bg-[var(--vk-bg-hover)]",title:e.id,children:[(0,a.jsxs)("div",{className:"flex min-w-0 items-center gap-2",children:[G(e)?(0,a.jsx)(N.N,{seed:{label:G(e)},className:"h-5 w-5"}):null,(0,a.jsx)("span",{className:"truncate text-[12px] text-[var(--vk-text-normal)]",children:z(e)})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-2",children:[(0,a.jsx)("span",{className:`inline-flex h-5 items-center rounded-[3px] border px-2 text-[10px] ${q(e.status)}`,children:W(e.status)}),(0,a.jsx)(o.A,{className:"h-3 w-3 text-[var(--vk-text-muted)]"})]})]},e.id)),g?(0,a.jsxs)("button",{type:"button",onClick:()=>x.push((0,S.s)(g,{bridgeId:t,tab:"terminal"})),className:"flex w-full items-center justify-between gap-2 rounded-[3px] px-2 py-1.5 text-left hover:bg-[var(--vk-bg-hover)]",title:g,children:[(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("div",{className:"truncate text-[12px] text-[var(--vk-text-normal)]",children:g}),(0,a.jsx)("div",{className:"truncate text-[11px] text-[var(--vk-text-muted)]",children:"Primary run"})]}),(0,a.jsx)(o.A,{className:"h-3 w-3 shrink-0 text-[var(--vk-text-muted)]"})]}):null]})]}),(0,a.jsxs)("div",{className:"mt-2 flex items-center justify-between gap-2",children:[(0,a.jsx)("div",{className:"flex min-w-0 items-center gap-1.5",children:l.agent?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(N.N,{seed:{label:l.agent},className:"h-6 w-6"}),(0,a.jsx)("span",{className:"truncate text-[12px] text-[var(--vk-text-muted)]",children:T(l.agent)})]}):(0,a.jsx)("span",{className:"text-[12px] text-[var(--vk-text-muted)]",children:"No agent"})}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-1",children:[l.type&&(0,a.jsx)("span",{className:"inline-flex h-5 items-center rounded-[3px] bg-[color:#292929] px-2 text-[11px] text-[var(--vk-text-muted)]",children:l.type}),l.priority&&(0,a.jsx)("span",{className:"inline-flex h-5 items-center rounded-[3px] bg-[color:#292929] px-2 text-[11px] text-[var(--vk-text-muted)]",children:l.priority})]})]})]})]},`${e.role}-${l.id}`)})}),tH&&tx?.role===e.role&&tx.index===l?(0,a.jsx)("div",{className:"mt-2 h-[3px] rounded-full bg-[var(--vk-orange)] shadow-[0_0_0_1px_rgba(0,0,0,0.2)]"}):null]})]},e.role)})})}),tZ&&(0,a.jsx)("div",{className:"fixed inset-0 z-[75] flex items-start justify-center overflow-y-auto bg-black/60 px-3 py-3 sm:items-center sm:py-0",onClick:t4,children:(0,a.jsxs)("div",{className:"flex max-h-[100dvh] w-full flex-col overflow-hidden border-[var(--vk-border)] bg-[var(--vk-bg-panel)] sm:max-h-[calc(100dvh-1.5rem)] sm:max-w-[560px] sm:rounded-[6px] sm:border",onClick:e=>e.stopPropagation(),role:"dialog","aria-modal":"true",children:[(0,a.jsxs)("header",{className:"border-b border-[var(--vk-border)] px-4 py-3",children:[(0,a.jsx)("h2",{className:"text-[18px] text-[var(--vk-text-strong)]",children:"Edit Board Task"}),(0,a.jsx)("p",{className:"pt-1 text-[12px] text-[var(--vk-text-muted)]",children:"Move the card, update the task, and link the latest session run."})]}),(0,a.jsxs)("div",{className:"min-h-0 flex-1 space-y-3 overflow-y-auto px-4 py-4",children:[(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1 block text-[12px] text-[var(--vk-text-muted)]",children:"Title"}),(0,a.jsx)("input",{value:eq,onChange:e=>eV(e.target.value),className:"h-9 w-full rounded-[3px] border border-[var(--vk-border)] bg-transparent px-2 text-[14px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1 block text-[12px] text-[var(--vk-text-muted)]",children:"Description"}),(0,a.jsx)("textarea",{value:eK,onChange:e=>eZ(e.target.value),rows:3,className:"w-full rounded-[3px] border border-[var(--vk-border)] bg-transparent px-2 py-2 text-[14px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1 block text-[12px] text-[var(--vk-text-muted)]",children:"Column"}),(0,a.jsx)("select",{value:eG,onChange:e=>eW(E(e.target.value)),className:"h-9 w-full rounded-[3px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 text-[14px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]",children:p?.columns.map(e=>(0,a.jsx)("option",{value:e.role,className:"bg-[var(--vk-bg-panel)] text-[var(--vk-text-normal)]",children:e.heading||P[e.role]},e.role))})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1 block text-[12px] text-[var(--vk-text-muted)]",children:"Agent"}),(0,a.jsx)(H,{value:eY,options:tT,disabled:e7,onChange:eQ,ariaLabel:"Select agent for task"})]})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2",children:[(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1 block text-[12px] text-[var(--vk-text-muted)]",children:"Type"}),(0,a.jsx)("input",{value:eX,onChange:e=>e0(e.target.value),className:"h-9 w-full rounded-[3px] border border-[var(--vk-border)] bg-transparent px-2 text-[14px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1 block text-[12px] text-[var(--vk-text-muted)]",children:"Priority"}),(0,a.jsx)("input",{value:e1,onChange:e=>e2(e.target.value),className:"h-9 w-full rounded-[3px] border border-[var(--vk-border)] bg-transparent px-2 text-[14px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"})]})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1 block text-[12px] text-[var(--vk-text-muted)]",children:"GitHub issue id (optional)"}),(0,a.jsx)("input",{value:e5,onChange:e=>e3(e.target.value),placeholder:"123",className:"h-9 w-full rounded-[3px] border border-[var(--vk-border)] bg-transparent px-2 text-[14px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1 block text-[12px] text-[var(--vk-text-muted)]",children:"Notes"}),(0,a.jsx)("textarea",{value:e4,onChange:e=>e6(e.target.value),rows:3,className:"w-full rounded-[3px] border border-[var(--vk-border)] bg-transparent px-2 py-2 text-[14px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"})]}),tZ.task.attachments.length>0&&(0,a.jsxs)("div",{children:[(0,a.jsx)("span",{className:"mb-1 block text-[12px] text-[var(--vk-text-muted)]",children:"Attachments"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:tZ.task.attachments.map(e=>(0,a.jsx)(L,{attachment:e,opening:e_===e,onOpen:()=>void tQ(e)},e))})]}),(0,a.jsxs)("div",{className:"rounded-[4px] border border-[var(--vk-border)] bg-[rgba(255,255,255,0.02)] p-3",children:[(0,a.jsxs)("div",{className:"mb-2 flex items-center justify-between gap-2",children:[(0,a.jsx)("span",{className:"text-[12px] uppercase tracking-[0.08em] text-[var(--vk-text-muted)]",children:"Comments"}),(0,a.jsx)("span",{className:"text-[11px] text-[var(--vk-text-muted)]",children:tZ.task.commentCount})]}),(0,a.jsx)("div",{className:"space-y-2",children:tZ.task.comments.length>0?tZ.task.comments.map(e=>(0,a.jsxs)("div",{className:"rounded-[4px] border border-[var(--vk-border)] bg-[rgba(255,255,255,0.02)] px-3 py-2",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:"text-[12px] text-[var(--vk-text-normal)]",children:e.author}),(0,a.jsx)("span",{className:"text-[11px] text-[var(--vk-text-muted)]",children:K(e.timestamp)})]}),(0,a.jsx)("p",{className:"pt-1 whitespace-pre-wrap text-[13px] leading-[20px] text-[var(--vk-text-muted)]",children:e.body})]},e.id)):(0,a.jsx)("p",{className:"text-[12px] text-[var(--vk-text-muted)]",children:"No comments yet."})}),(0,a.jsxs)("label",{className:"mt-3 block",children:[(0,a.jsx)("span",{className:"mb-1 block text-[12px] text-[var(--vk-text-muted)]",children:"Add comment"}),(0,a.jsx)("textarea",{value:ta,onChange:e=>ts(e.target.value),rows:3,placeholder:"Share status, request input, or leave implementation notes.",className:"w-full rounded-[3px] border border-[var(--vk-border)] bg-transparent px-2 py-2 text-[14px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"})]}),ti&&(0,a.jsx)("p",{className:"mt-2 text-[12px] text-[var(--vk-red)]",children:ti}),(0,a.jsx)("div",{className:"mt-3 flex justify-end",children:(0,a.jsxs)("button",{type:"button",onClick:()=>void t8(),disabled:!ta.trim()||tn,className:"inline-flex h-9 items-center gap-2 rounded-[3px] border border-[var(--vk-border)] px-3 text-[13px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-50",children:[tn?(0,a.jsx)(i.A,{className:"h-4 w-4 animate-spin"}):(0,a.jsx)(j,{className:"h-4 w-4"}),"Post comment"]})})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1 block text-[12px] text-[var(--vk-text-muted)]",children:"Primary linked run"}),(0,a.jsxs)("select",{value:e8,onChange:e=>e9(e.target.value),className:"h-9 w-full rounded-[3px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 text-[14px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]",children:[(0,a.jsx)("option",{value:"",className:"bg-[var(--vk-bg-panel)] text-[var(--vk-text-normal)]",children:"No linked session"}),tK.map(e=>(0,a.jsxs)("option",{value:e.id,className:"bg-[var(--vk-bg-panel)] text-[var(--vk-text-normal)]",children:[z(e)," \xb7 ",e.status]},e.id))]})]}),tt&&(0,a.jsx)("p",{className:"text-[12px] text-[var(--vk-red)]",children:tt})]}),(0,a.jsxs)("footer",{className:"flex flex-wrap items-center justify-end gap-2 border-t border-[var(--vk-border)] px-4 py-3",children:[(0,a.jsx)("button",{type:"button",onClick:t4,disabled:e7||tn,className:"inline-flex h-9 items-center rounded-[3px] border border-[var(--vk-border)] px-3 text-[13px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-50",children:"Cancel"}),(0,a.jsx)("button",{type:"button",onClick:()=>void t6(),disabled:!eq.trim()||e7,className:"inline-flex h-9 items-center rounded-[3px] bg-[var(--vk-bg-active)] px-3 text-[13px] text-[var(--vk-text-strong)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-50",children:e7?(0,a.jsx)(i.A,{className:"h-4 w-4 animate-spin"}):"Save Task"})]})]})}),ei&&(0,a.jsx)("div",{className:"fixed inset-0 z-[75] flex items-start justify-center overflow-y-auto bg-black/60 px-3 py-3 sm:items-center sm:py-0",onClick:()=>!eD&&eo(!1),children:(0,a.jsxs)("div",{className:"flex max-h-[100dvh] w-full flex-col overflow-hidden border-[var(--vk-border)] bg-[var(--vk-bg-panel)] shadow-[0_28px_80px_rgba(0,0,0,0.45)] sm:max-h-[calc(100dvh-1.5rem)] sm:max-w-[980px] sm:rounded-[10px] sm:border",onClick:e=>e.stopPropagation(),role:"dialog","aria-modal":"true",children:[(0,a.jsx)("header",{className:"border-b border-[var(--vk-border)] px-4 py-4 sm:px-5",children:(0,a.jsxs)("div",{className:"flex flex-col gap-3 lg:flex-row lg:items-start lg:justify-between",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h2",{className:"text-[20px] font-medium text-[var(--vk-text-strong)]",children:"Create Board Task"}),(0,a.jsx)("p",{className:"pt-1 text-[13px] leading-5 text-[var(--vk-text-muted)]",children:"Capture the task, route it to the right board column, and attach the notes or files the agent should treat as source of truth."})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 text-[11px]",children:[(0,a.jsxs)("span",{className:"rounded-full border border-[var(--vk-border)] bg-[rgba(255,255,255,0.03)] px-2.5 py-1 text-[var(--vk-text-normal)]",children:["Column \xb7 ",tV]}),(0,a.jsxs)("span",{className:"rounded-full border border-[var(--vk-border)] bg-[rgba(255,255,255,0.03)] px-2.5 py-1 text-[var(--vk-text-normal)]",children:["Agent \xb7 ",T(ev)]}),(0,a.jsxs)("span",{className:"rounded-full border border-[var(--vk-border)] bg-[rgba(255,255,255,0.03)] px-2.5 py-1 text-[var(--vk-text-normal)]",children:[ey.length+eO.length," ","attachment",ey.length+eO.length===1?"":"s"]})]})]})}),(0,a.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 py-4 sm:px-5",children:(0,a.jsxs)("div",{className:"grid gap-4 lg:grid-cols-[minmax(0,1.45fr)_minmax(290px,0.95fr)]",children:[(0,a.jsx)("div",{className:"space-y-4",children:(0,a.jsxs)("section",{className:"rounded-[8px] border border-[var(--vk-border)] bg-[rgba(255,255,255,0.02)] p-4",children:[(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsx)("h3",{className:"text-[15px] font-medium text-[var(--vk-text-strong)]",children:"Task brief"}),(0,a.jsx)("p",{className:"pt-1 text-[12px] leading-5 text-[var(--vk-text-muted)]",children:"Write the task the way you want it to appear on the board and in the agent prompt."})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Title"}),(0,a.jsx)("input",{value:ex,onChange:e=>em(e.target.value),placeholder:"Review payment flow regression",className:"h-11 w-full rounded-[6px] border border-[var(--vk-border)] bg-[rgba(0,0,0,0.14)] px-3 text-[15px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"}),(0,a.jsx)("p",{className:"mt-1.5 text-[11px] text-[var(--vk-text-muted)]",children:"Keep it short and outcome-focused so the card stays scannable."})]}),(0,a.jsxs)("label",{className:"mt-4 block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Description"}),(0,a.jsx)("textarea",{value:ep,onChange:e=>eu(e.target.value),rows:5,placeholder:"Investigate failing specs, confirm the root cause, and propose a safe fix.",className:"w-full rounded-[6px] border border-[var(--vk-border)] bg-[rgba(0,0,0,0.14)] px-3 py-2.5 text-[14px] leading-6 text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"})]}),(0,a.jsxs)("label",{className:"mt-4 block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Context notes"}),(0,a.jsx)("textarea",{value:ej,onChange:e=>eN(e.target.value),rows:4,placeholder:"Add constraints, pitfalls, or review expectations the agent should keep in mind.",className:"w-full rounded-[6px] border border-[var(--vk-border)] bg-[rgba(0,0,0,0.14)] px-3 py-2.5 text-[14px] leading-6 text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"})]})]})}),(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("section",{className:"rounded-[8px] border border-[var(--vk-border)] bg-[rgba(255,255,255,0.02)] p-4",children:[(0,a.jsxs)("div",{className:"mb-3",children:[(0,a.jsx)("h3",{className:"text-[15px] font-medium text-[var(--vk-text-strong)]",children:"Routing"}),(0,a.jsx)("p",{className:"pt-1 text-[12px] leading-5 text-[var(--vk-text-muted)]",children:"Choose where the card lands and how it should be tagged."})]}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-3 sm:grid-cols-2 lg:grid-cols-1 xl:grid-cols-2",children:[(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Column"}),(0,a.jsx)("select",{value:ed,onChange:e=>ec(E(e.target.value)),className:"h-10 w-full rounded-[6px] border border-[var(--vk-border)] bg-[rgba(0,0,0,0.14)] px-3 text-[14px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]",children:tL.map(e=>(0,a.jsx)("option",{value:e.role,className:"bg-[var(--vk-bg-panel)] text-[var(--vk-text-normal)]",children:e.heading||P[e.role]},e.role))})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Agent"}),(0,a.jsx)(H,{value:ev,options:tT,disabled:eD,onChange:eh,ariaLabel:"Select agent for new task"})]})]}),(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Task type"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:I.map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>eg(e.value),className:(0,C.cn)("inline-flex h-8 items-center rounded-full border px-3 text-[12px] transition-colors",eb===e.value?"border-[var(--vk-orange)] bg-[var(--vk-orange)]/10 text-[var(--vk-text-strong)]":"border-[var(--vk-border)] text-[var(--vk-text-muted)] hover:bg-[var(--vk-bg-hover)] hover:text-[var(--vk-text-normal)]"),children:e.label},e.value))})]}),(0,a.jsxs)("div",{className:"mt-4",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Priority"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-2",children:R.map(e=>(0,a.jsx)("button",{type:"button",onClick:()=>ek(e.value),className:(0,C.cn)("inline-flex h-8 items-center rounded-full border px-3 text-[12px] transition-colors",ef===e.value?"high"===e.value?"border-[var(--vk-red)] bg-[var(--vk-red)]/10 text-[var(--vk-text-strong)]":"medium"===e.value?"border-[var(--vk-orange)] bg-[var(--vk-orange)]/10 text-[var(--vk-text-strong)]":"border-[var(--vk-border)] bg-[rgba(255,255,255,0.05)] text-[var(--vk-text-strong)]":"border-[var(--vk-border)] text-[var(--vk-text-muted)] hover:bg-[var(--vk-bg-hover)] hover:text-[var(--vk-text-normal)]"),children:e.label},e.value))})]})]}),(0,a.jsxs)("section",{className:"rounded-[8px] border border-[var(--vk-border)] bg-[rgba(255,255,255,0.02)] p-4",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-start justify-between gap-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-[15px] font-medium text-[var(--vk-text-strong)]",children:"Context"}),(0,a.jsx)("p",{className:"pt-1 text-[12px] leading-5 text-[var(--vk-text-muted)]",children:"Attach notes, screenshots, or files the agent should inspect before making changes."})]}),(0,a.jsxs)("label",{className:"inline-flex h-9 cursor-pointer items-center rounded-[6px] border border-[var(--vk-border)] px-3 text-[12px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)]",children:[(0,a.jsx)("input",{type:"file",multiple:!0,className:"hidden",onChange:e=>{let t=Array.from(e.target.files??[]);0!==t.length&&(eL(e=>{let r=[...e];for(let e of t)r.some(t=>t.name===e.name&&t.size===e.size&&t.lastModified===e.lastModified)||r.push(e);return r}),e.currentTarget.value="")}}),"Upload files/images"]})]}),(0,a.jsxs)("div",{className:"mt-3 rounded-[6px] border border-[var(--vk-border)] bg-[rgba(0,0,0,0.12)] px-3 py-2 text-[12px] text-[var(--vk-text-muted)]",children:[ey.length," existing file",1===ey.length?"":"s"," selected",eO.length>0?` \xb7 ${eO.length} upload${1===eO.length?"":"s"} ready`:""]}),tJ.length>0&&(0,a.jsxs)("div",{className:"mt-3",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[11px] uppercase tracking-[0.08em] text-[var(--vk-text-muted)]",children:"Selected files"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:tJ.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>tX(e.path),className:"inline-flex max-w-full items-center gap-1 rounded-[999px] border border-[var(--vk-border)] bg-[var(--vk-bg-hover)] px-2.5 py-1 text-[11px] text-[var(--vk-text-normal)]",title:`Remove ${O(e)}`,children:[(0,a.jsx)("span",{className:"truncate max-w-[220px]",children:e.name}),(0,a.jsx)("span",{className:"text-[var(--vk-text-muted)]",children:"\xd7"})]},e.path))})]}),eO.length>0&&(0,a.jsxs)("div",{className:"mt-3",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[11px] uppercase tracking-[0.08em] text-[var(--vk-text-muted)]",children:"Pending uploads"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:eO.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>{eL(t=>t.filter(t=>t.name!==e.name||t.size!==e.size||t.lastModified!==e.lastModified))},className:"inline-flex max-w-full items-center gap-1 rounded-[999px] border border-[var(--vk-border)] bg-[var(--vk-bg-hover)] px-2.5 py-1 text-[11px] text-[var(--vk-text-normal)]",title:"Remove upload",children:[(0,a.jsx)("span",{className:"truncate max-w-[220px]",children:e.name}),(0,a.jsx)("span",{className:"text-[var(--vk-text-muted)]",children:"\xd7"})]},`${e.name}-${e.size}-${e.lastModified}`))})]}),(0,a.jsxs)("label",{className:"mt-4 block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Browse existing context"}),(0,a.jsxs)("div",{className:"flex h-9 items-center rounded-[6px] border border-[var(--vk-border)] bg-[rgba(0,0,0,0.14)] px-3",children:[(0,a.jsx)(b.A,{className:"h-3.5 w-3.5 text-[var(--vk-text-muted)]"}),(0,a.jsx)("input",{value:eA,onChange:e=>eP(e.target.value),placeholder:"Search context files...",className:"ml-2 w-full bg-transparent text-[13px] text-[var(--vk-text-normal)] outline-none placeholder:text-[var(--vk-text-muted)]"})]})]}),(0,a.jsx)("div",{className:"mt-3 max-h-[320px] overflow-auto rounded-[6px] border border-[var(--vk-border)] bg-[rgba(0,0,0,0.08)]",children:eR?(0,a.jsxs)("div",{className:"flex items-center gap-2 px-3 py-3 text-[12px] text-[var(--vk-text-muted)]",children:[(0,a.jsx)(i.A,{className:"h-3.5 w-3.5 animate-spin"}),(0,a.jsx)("span",{children:"Loading context files..."})]}):eM?(0,a.jsx)("p",{className:"px-3 py-3 text-[12px] text-[var(--vk-red)]",children:eM}):0===tU.length?(0,a.jsx)("p",{className:"px-3 py-3 text-[12px] text-[var(--vk-text-muted)]",children:"No context files found."}):(0,a.jsx)("ul",{className:"py-1",children:tB.map(e=>(0,a.jsx)(D,{node:e,depth:0,expandedFolders:tq,selectedPaths:ey,openingContextPath:e_,contextOpenLabel:tR,onToggleFolder:t0,onTogglePath:tX,onOpenPath:e=>void tQ(e)},e.path))})})]})]})]})}),eU&&(0,a.jsx)("div",{className:"border-t border-[var(--vk-border)] px-4 py-3 sm:px-5",children:(0,a.jsx)("p",{className:"text-[12px] text-[var(--vk-red)]",children:eU})}),(0,a.jsxs)("footer",{className:"flex flex-wrap items-center justify-between gap-3 border-t border-[var(--vk-border)] px-4 py-3 sm:px-5",children:[(0,a.jsx)("div",{className:"text-[12px] text-[var(--vk-text-muted)]",children:ex.trim()?"Task is ready to add to the board.":"Add a clear title to enable task creation."}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-end gap-2",children:[(0,a.jsx)("button",{type:"button",onClick:()=>eo(!1),disabled:eD,className:"inline-flex h-9 items-center rounded-[3px] border border-[var(--vk-border)] px-3 text-[13px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-50",children:"Cancel"}),(0,a.jsx)("button",{type:"button",onClick:()=>void t1(),disabled:!ex.trim()||eD,className:"inline-flex h-9 items-center rounded-[3px] bg-[var(--vk-bg-active)] px-3 text-[13px] text-[var(--vk-text-strong)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-50",children:eD?(0,a.jsx)(i.A,{className:"h-4 w-4 animate-spin"}):"Create Task"})]})]})]})})]}):(0,a.jsx)("div",{className:"flex h-full items-center justify-center text-[14px] text-[var(--vk-text-muted)]",children:"Select a workspace to view its Kanban board."})}},76265:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(13454).A)("chevron-right",[["path",{d:"m9 18 6-6-6-6",key:"mthhwq"}]])}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4443],{13908:(e,l,a)=>{a.d(l,{a:()=>n});var s=a(5974);let n=(0,s.createServerReference)("00b2a16dd4c0264458f0525ace488f40b4d4cfea57",s.callServer,void 0,s.findSourceMapURL,"createOrReadKeylessAction")},34443:(e,l,a)=>{a.r(l),a.d(l,{KeylessCreatorOrReader:()=>r});var s=a(79748),n=a(7620),t=a(13908);let r=e=>{var l;let{children:a}=e,r=(null==(l=(0,s.useSelectedLayoutSegments)()[0])?void 0:l.startsWith("/_not-found"))||!1,[i,c]=n.useActionState(t.a,null);return((0,n.useEffect)(()=>{r||n.startTransition(()=>{c()})},[r]),n.isValidElement(a))?n.cloneElement(a,{key:null==i?void 0:i.publishableKey,publishableKey:null==i?void 0:i.publishableKey,__internal_keyless_claimKeylessApplicationUrl:null==i?void 0:i.claimUrl,__internal_keyless_copyInstanceKeysUrl:null==i?void 0:i.apiKeysUrl,__internal_bypassMissingPublishableKey:!0}):a}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[474],{23555:(e,t,r)=>{r.d(t,{A:()=>a});let a=(0,r(13454).A)("search",[["path",{d:"m21 21-4.34-4.34",key:"14j7rj"}],["circle",{cx:"11",cy:"11",r:"8",key:"4ej97u"}]])},90474:(e,t,r)=>{r.r(t),r.d(t,{NewWorkspaceDialog:()=>en,SettingsDialog:()=>ed});var a=r(54568),s=r(71708),l=r(76196),n=r(7620),o=r(52353),i=r(20487),d=r(13454);let c=(0,d.A)("circle-user",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["circle",{cx:"12",cy:"10",r:"3",key:"ilqhr7"}],["path",{d:"M7 20.662V19a2 2 0 0 1 2-2h6a2 2 0 0 1 2 2v1.662",key:"154egf"}]]);var x=r(50549),p=r(57917),v=r(21048),m=r(55341),u=r(30824),h=r(34737),b=r(20670);let g=(0,d.A)("book-text",[["path",{d:"M4 19.5v-15A2.5 2.5 0 0 1 6.5 2H19a1 1 0 0 1 1 1v18a1 1 0 0 1-1 1H6.5a1 1 0 0 1 0-5H20",key:"k3hazp"}],["path",{d:"M8 11h8",key:"vwpz6n"}],["path",{d:"M8 7h6",key:"1f0q6e"}]]);var k=r(34309),f=r(36645),j=r(45894),N=r(58299),y=r(62868),w=r(34041),S=r(23555),C=r(59706);let A=(0,d.A)("volume-2",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["path",{d:"M16 9a5 5 0 0 1 0 6",key:"1q6k2b"}],["path",{d:"M19.364 18.364a9 9 0 0 0 0-12.728",key:"ijwkga"}]]),H=(0,d.A)("volume-x",[["path",{d:"M11 4.702a.705.705 0 0 0-1.203-.498L6.413 7.587A1.4 1.4 0 0 1 5.416 8H3a1 1 0 0 0-1 1v6a1 1 0 0 0 1 1h2.416a1.4 1.4 0 0 1 .997.413l3.383 3.384A.705.705 0 0 0 11 19.298z",key:"uqj9uw"}],["line",{x1:"22",x2:"16",y1:"9",y2:"15",key:"1ewh16"}],["line",{x1:"16",x2:"22",y1:"9",y2:"15",key:"5ykzw1"}]]);var E=r(5739),P=r(33866),R=r(90124),U=r(31404),$=r(85626);r(51164);var M=r(30524);let D=(0,d.A)("log-out",[["path",{d:"m16 17 5-5-5-5",key:"1bji2h"}],["path",{d:"M21 12H9",key:"dn1m92"}],["path",{d:"M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4",key:"1uf3rs"}]]);function L(e){switch(e){case"clerk":return"Clerk";case"cloudflare-access":return"Cloudflare Access";case"trusted-header":return"Verified Header";case"local":return"Local";default:return"Unknown"}}function F(e){return e?e.split("-").map(e=>e[0]?.toUpperCase()+e.slice(1)).join(" "):"No access"}function B({label:e,value:t,href:r}){return(0,a.jsxs)("div",{className:"rounded-[6px] border border-[var(--vk-border)] px-4 py-3",children:[(0,a.jsx)("span",{className:"text-[11px] uppercase tracking-[0.12em] text-[var(--vk-text-muted)]",children:e}),r?(0,a.jsx)("a",{href:r,target:"_blank",rel:"noreferrer",className:"mt-2 block break-all text-[14px] text-[var(--vk-orange)] hover:underline",children:t}):(0,a.jsx)("p",{className:"mt-2 break-all text-[14px] text-[var(--vk-text-normal)]",children:t})]})}function _({profile:e}){let t=(e?.displayName??e?.email??"User").split(/[\s@._-]+/g).filter(Boolean).slice(0,2).map(e=>e[0]?.toUpperCase()??"").join("").slice(0,2);return e?.avatarUrl?(0,a.jsx)("img",{src:e.avatarUrl,alt:e.displayName??e.email??"Profile avatar",className:"h-20 w-20 rounded-full border border-[var(--vk-border)] object-cover shadow-[0_10px_30px_rgba(0,0,0,0.28)]"}):(0,a.jsx)("div",{className:"flex h-20 w-20 items-center justify-center rounded-full border border-[var(--vk-border)] bg-[rgba(234,122,42,0.12)] text-[26px] font-semibold text-[var(--vk-orange)]",children:t||"U"})}function T({profile:e,loading:t,error:r,onRefresh:l}){if(t)return(0,a.jsxs)("section",{className:"flex items-center gap-2 rounded-[6px] border border-[var(--vk-border)] px-4 py-4 text-[13px] text-[var(--vk-text-muted)]",children:[(0,a.jsx)(N.A,{className:"h-4 w-4 animate-spin"}),"Loading profile details..."]});if(r&&!e)return(0,a.jsxs)("section",{className:"space-y-3 rounded-[6px] border border-[var(--vk-border)] px-4 py-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h4",{className:"text-[18px] leading-[20px] text-[var(--vk-text-strong)]",children:"Profile Unavailable"}),(0,a.jsx)("p",{className:"mt-1 text-[12px] text-[var(--vk-text-muted)]",children:"Conductor could not load the active user profile for this session."})]}),(0,a.jsxs)("button",{type:"button",onClick:l,className:"inline-flex h-9 items-center gap-2 rounded-[4px] border border-[var(--vk-border)] px-3 text-[13px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)]",children:[(0,a.jsx)(y.A,{className:"h-3.5 w-3.5"}),"Retry"]})]});let n=e?.displayName??"Unknown user",o=e?.email??"Not available",i=e?.githubUsername?`@${e.githubUsername}`:"Not linked";return(0,a.jsxs)("div",{className:"space-y-5",children:[(0,a.jsx)("section",{className:"rounded-[6px] border border-[var(--vk-border)] px-5 py-5",children:(0,a.jsxs)("div",{className:"flex flex-col gap-4 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsxs)("div",{className:"flex items-center gap-4",children:[(0,a.jsx)(_,{profile:e}),(0,a.jsxs)("div",{className:"min-w-0",children:[(0,a.jsx)("h4",{className:"truncate text-[24px] leading-[26px] text-[var(--vk-text-strong)]",children:n}),(0,a.jsx)("p",{className:"mt-1 truncate text-[14px] text-[var(--vk-text-muted)]",children:o}),(0,a.jsxs)("div",{className:"mt-3 flex flex-wrap gap-2 text-[11px]",children:[(0,a.jsx)("span",{className:"rounded-[999px] border border-[var(--vk-border)] px-2 py-1 text-[var(--vk-text-normal)]",children:F(e?.role??null)}),(0,a.jsx)("span",{className:"rounded-[999px] border border-[var(--vk-border)] px-2 py-1 text-[var(--vk-text-normal)]",children:L(e?.provider??null)}),(0,a.jsx)("span",{className:"rounded-[999px] border border-[var(--vk-border)] px-2 py-1 text-[var(--vk-text-normal)]",children:e?"local"===e.provider?"Local admin session":e.authenticated?"Authenticated":"Anonymous":"Unknown"})]})]})]}),(0,a.jsxs)("button",{type:"button",onClick:l,className:"inline-flex h-9 items-center gap-2 self-start rounded-[4px] border border-[var(--vk-border)] px-3 text-[13px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)]",children:[(0,a.jsx)(y.A,{className:"h-3.5 w-3.5"}),"Refresh"]})]})}),(0,a.jsxs)("section",{className:"grid gap-3 lg:grid-cols-2",children:[(0,a.jsx)(B,{label:"Display Name",value:n}),(0,a.jsx)(B,{label:"Email",value:o}),(0,a.jsx)(B,{label:"GitHub",value:i,href:e?.githubProfileUrl??null}),(0,a.jsx)(B,{label:"Username",value:e?.username??"Not available"}),(0,a.jsx)(B,{label:"Auth Provider",value:L(e?.provider??null)}),(0,a.jsx)(B,{label:"Access Role",value:F(e?.role??null)})]}),(0,a.jsxs)("section",{className:"space-y-3 rounded-[6px] border border-[var(--vk-border)] px-4 py-4",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("h5",{className:"text-[18px] leading-[20px] text-[var(--vk-text-strong)]",children:"Session Actions"}),(0,a.jsx)("p",{className:"text-[12px] text-[var(--vk-text-muted)]",children:"Review how this browser session is authenticated and sign out when Conductor owns the session lifecycle."})]}),e?.canLogout&&"clerk"===e.logoutMode?(0,a.jsx)(M.ct,{redirectUrl:"/sign-in",children:(0,a.jsxs)("button",{type:"button",className:"inline-flex h-9 items-center gap-2 rounded-[4px] bg-[var(--vk-bg-active)] px-3 text-[13px] text-[var(--vk-text-strong)] hover:bg-[var(--vk-bg-hover)]",children:[(0,a.jsx)(D,{className:"h-3.5 w-3.5"}),"Log Out"]})}):(0,a.jsx)("div",{className:"rounded-[6px] border border-[var(--vk-border)] bg-[rgba(80,80,80,0.18)] px-3 py-3 text-[12px] leading-5 text-[var(--vk-text-muted)]",children:e?.provider==="local"?"This is a local recovery session on the current machine, so there is nothing to sign out of.":`This session is managed by ${L(e?.provider??null)}. Sign out from that provider if you need to end access.`}),e?.githubProfileUrl&&(0,a.jsxs)("a",{href:e.githubProfileUrl,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-2 text-[13px] text-[var(--vk-orange)] hover:underline",children:[(0,a.jsx)(s.uj0,{size:14}),"Open GitHub Profile"]})]})]})}var q=r(88272);let O="claude-code";function z(e){let t=(0,P.h7)(e);return t?.label?t.label:e.split(/[-_\s]+/g).filter(Boolean).map(e=>e[0]?.toUpperCase()+e.slice(1)).join(" ")}function I(e){return e.trim().toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-+|-+$/g,"").slice(0,64)}function G(e){let t=e.trim();return t?t.split(/[\\/]+/).filter(Boolean).at(-1)??null:null}function W(e){if(!e)return null;let t=Date.parse(e);return Number.isNaN(t)?null:`Updated ${new Intl.DateTimeFormat("en-US",{month:"short",day:"numeric",timeZone:"UTC"}).format(new Date(t))}`}let Z=[{id:"profile",label:"Profile",icon:c,implemented:!0},{id:"general",label:"General",icon:x.A,implemented:!0},{id:"repositories",label:"Repositories",icon:p.A,implemented:!0},{id:"organization",label:"Organization Settings",icon:v.A,implemented:!0},{id:"projects",label:"Projects",icon:m.A,implemented:!1},{id:"agents",label:"Agents",icon:u.A,implemented:!0},{id:"mcp",label:"MCP Servers",icon:h.A,implemented:!1},{id:"preferences",label:"Preferences",icon:b.A,implemented:!1}],V=[{id:"preferences",label:"Preferences",icon:b.A,implemented:!0},{id:"repositories",label:"Repository",icon:p.A,implemented:!0}],Y=[{id:"obsidian",label:"Obsidian"},{id:"vscode",label:"VS Code"},{id:"notion",label:"Notion"},{id:"typora",label:"Typora"},{id:"logseq",label:"Logseq"},{id:"custom",label:"Custom"}],J=[{id:"abstract-sound-1",label:"Abstract Sound 1"},{id:"abstract-sound-2",label:"Abstract Sound 2"},{id:"abstract-sound-3",label:"Abstract Sound 3"},{id:"abstract-sound-4",label:"Abstract Sound 4"},{id:"cow-mooing",label:"Cow Mooing"},{id:"phone-vibration",label:"Phone Vibration"},{id:"rooster",label:"Rooster"}];function X(e){return!e||"object"!=typeof e||Array.isArray(e)?{}:{...e}}function K(e){return Array.isArray(e)?e.filter(e=>"string"==typeof e).map(e=>e.trim()).filter(Boolean).join("\n"):"string"!=typeof e?"":e.split(/[\n,]+/g).map(e=>e.trim()).filter(Boolean).join("\n")}function Q(e,t){let r=X(e),a=X(r.trustedHeaders),s=X(r.roles),l=X(t),n=r.defaultRole,o=l.role;return{requireAuth:!0===r.requireAuth||!0===a.enabled,defaultRole:"viewer"===n||"admin"===n||"operator"===n?n:"operator",trustedHeaders:{enabled:!0===a.enabled,provider:"cloudflare-access",emailHeader:"string"==typeof a.emailHeader&&a.emailHeader.trim().length>0?a.emailHeader.trim():"Cf-Access-Authenticated-User-Email",jwtHeader:"string"==typeof a.jwtHeader&&a.jwtHeader.trim().length>0?a.jwtHeader.trim():"Cf-Access-Jwt-Assertion",teamDomain:"string"==typeof a.teamDomain&&a.teamDomain.trim().length>0?a.teamDomain.trim():"",audience:"string"==typeof a.audience&&a.audience.trim().length>0?a.audience.trim():""},roles:{viewers:K(s.viewers),operators:K(s.operators),admins:K(s.admins),viewerDomains:K(s.viewerDomains),operatorDomains:K(s.operatorDomains),adminDomains:K(s.adminDomains)},current:{authenticated:!0===l.authenticated,role:"viewer"===o||"operator"===o||"admin"===o?o:null,email:"string"==typeof l.email&&l.email.trim().length>0?l.email.trim():null,provider:"string"==typeof l.provider&&l.provider.trim().length>0?l.provider.trim():null}}}function ee(e,t){let r=(0,l.yM)(e);if(!r||r.accessOptions.length<=1)return null;let a=(0,l.Tk)(e,t);return a?r.accessOptions.find(e=>e.id===a)?.label??null:null}let et="block h-4 w-4 shrink-0";function er(e){return JSON.stringify(e)}let ea={obsidian:{kind:"icon",icon:o.mWn,className:`${et} text-[#8b5cf6]`},vscode:{kind:"icon",icon:i.$$9,className:`${et} text-[#22a3f5]`},notion:{kind:"icon",icon:o.i4$,className:`${et} text-white`},logseq:{kind:"image",imageSrc:"/icons/editors/logseq.svg",className:`${et} object-contain`},typora:{kind:"image",imageSrc:"/icons/editors/typora-32.png",className:`${et} rounded-[3px] bg-white/90 p-[1px] object-contain`},custom:{kind:"icon",icon:x.A,className:`${et} text-[var(--vk-text-muted)]`}};function es({editorId:e}){let t=ea[e];if(!t)return(0,a.jsx)(g,{className:`${et} text-[var(--vk-text-muted)]`});if("image"===t.kind)return(0,a.jsx)("img",{src:t.imageSrc,alt:"",className:t.className});let r=t.icon;return(0,a.jsx)(r,{className:t.className})}function el({agent:e,modelAccess:t,runtimeModelCatalogs:r,selection:s,onChange:n,compact:o=!1}){if(!(0,l.Zz)(e))return null;let i=(0,l.yM)(e),d=(0,q.Ik)(e,t,r),c=(0,q.xb)(s)??s.catalogModel,x=(0,q.iL)(e,t,r,c),p=ee(e,t);return i?(0,a.jsxs)("div",{className:o?"grid gap-3 md:grid-cols-3":"space-y-3",children:[(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] text-[var(--vk-text-muted)]",children:"Model"}),(0,a.jsxs)("select",{value:s.catalogModel,disabled:0===d.length,onChange:a=>{let l=a.target.value,o=(0,q.iL)(e,t,r,l);n({...s,catalogModel:l,reasoningEffort:o.some(e=>e.id===s.reasoningEffort)?s.reasoningEffort:(0,q.YS)(e,t,r,l)})},className:"h-9 w-full rounded-[4px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 text-[14px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)] disabled:opacity-60",children:[0===d.length&&(0,a.jsx)("option",{value:"",children:"No runtime models detected"}),d.map(e=>(0,a.jsx)("option",{value:e.id,children:e.label},e.id))]}),(0,a.jsxs)("p",{className:"mt-1 text-[11px] text-[var(--vk-text-muted)]",children:[p?`Filtered for ${p}.`:"Filtered for your current access preference."," Leave custom override blank to use this selection."]})]}),x.length>0&&(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] text-[var(--vk-text-muted)]",children:"Reasoning Effort"}),(0,a.jsx)("select",{value:s.reasoningEffort,onChange:e=>{n({...s,reasoningEffort:e.target.value})},className:"h-9 w-full rounded-[4px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 text-[14px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]",children:x.map(e=>(0,a.jsx)("option",{value:e.id,children:e.label},e.id))}),(0,a.jsx)("p",{className:"mt-1 text-[11px] text-[var(--vk-text-muted)]",children:"Choose how much deliberate reasoning the CLI should use before it acts."})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] text-[var(--vk-text-muted)]",children:"Custom Model Override"}),(0,a.jsx)("input",{value:s.customModel,onChange:a=>{let l=a.target.value,o=l.trim()||s.catalogModel,i=(0,q.iL)(e,t,r,o);n({...s,customModel:l,reasoningEffort:i.some(e=>e.id===s.reasoningEffort)?s.reasoningEffort:(0,q.YS)(e,t,r,o)})},placeholder:(0,q.ZA)(e,r),className:"h-9 w-full rounded-[4px] border border-[var(--vk-border)] bg-transparent px-2 text-[14px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"}),(0,a.jsx)("p",{className:"mt-1 text-[11px] text-[var(--vk-text-muted)]",children:"Optional. Use this to force an exact model id from the installed CLI when you want to override the detected list."})]})]}):null}function en({open:e,onClose:t,onCreate:r,creating:o,error:i,defaultAgent:d,agentOptions:c,modelAccess:x,runtimeModelCatalogs:p,bridgeId:v}){let[m,u]=(0,n.useState)("git"),[h,b]=(0,n.useState)("source"),[g,S]=(0,n.useState)(""),[C,A]=(0,n.useState)(!1),[H,R]=(0,n.useState)(""),[$,M]=(0,n.useState)(""),[D,L]=(0,n.useState)(""),[F,B]=(0,n.useState)("main"),[_,T]=(0,n.useState)(d),[Z,V]=(0,n.useState)((0,q.Z3)()),[Y,J]=(0,n.useState)(!1),[X,K]=(0,n.useState)(!0),[Q,ee]=(0,n.useState)([]),[et,er]=(0,n.useState)(!1),[ea,es]=(0,n.useState)(!1),[ei,ed]=(0,n.useState)(null),[ec,ex]=(0,n.useState)(""),[ep,ev]=(0,n.useState)(""),[em,eu]=(0,n.useState)(!1),[eh,eb]=(0,n.useState)("local"),[eg,ek]=(0,n.useState)([]),[ef,ej]=(0,n.useState)(!1),[eN,ey]=(0,n.useState)(null);(0,n.useEffect)(()=>{e&&(u("git"),b("source"),S(""),A(!1),R(""),M(""),L(""),B("main"),K(!0),J(!1),T(d),V((0,q.Z3)()),ee([]),es(!1),ed(null),ex(""),ev(""),ek([]),ey(null),ej(!1),eu(!1),eb("local"))},[d,e]),(0,n.useEffect)(()=>{e&&V(e=>{let t=(0,q.c0)(_,x,p,(0,q.xb)(e)??null,(0,q.aB)(e)??null);return e.catalogModel===t.catalogModel&&e.customModel===t.customModel&&e.reasoningEffort===t.reasoningEffort?e:t})},[_,x,e,p]),(0,n.useEffect)(()=>{if(!e)return;let t="git"===m?H.trim().length>0:$.trim().length>0;"details"!==h||t||b("source")},[H,$,m,e,h]);let ew=(0,n.useMemo)(()=>{let e;return 0===(e=ec.trim().toLowerCase()).length?Q:Q.filter(t=>t.fullName.toLowerCase().includes(e)||t.name.toLowerCase().includes(e)||(t.ownerLogin??"").toLowerCase().includes(e)||(t.description??"").toLowerCase().includes(e)||t.defaultBranch.toLowerCase().includes(e))},[ec,Q]),eS=(0,n.useMemo)(()=>{let e=Q.find(e=>e.httpsUrl===ep);return e||(H.trim()?Q.find(e=>e.httpsUrl===H.trim())??null:null)},[H,Q,ep]),eC=(0,n.useMemo)(()=>(function(e){let t=e.trim();if(!t)return null;let r=t.match(/^https?:\/\/github\.com\/([^/\s]+)\/([^/\s?#]+?)(?:\.git)?\/?$/i);if(r)return`https://github.com/${r[1]}/${r[2]}.git`;let a=t.match(/^git@github\.com:([^/\s]+)\/([^/\s]+?)(?:\.git)?$/i);return a?`https://github.com/${a[1]}/${a[2]}.git`:null})(ec),[ec]),eA=(0,n.useMemo)(()=>{let e;return(e=ec.trim())&&/^(https?:\/\/|git@)/i.test(e)?e:null},[ec]),eH=(0,n.useMemo)(()=>W(eS?.updatedAt),[eS]),eE=(0,n.useMemo)(()=>{let e=eC??eA;return!!e&&e.toLowerCase()!==H.trim().toLowerCase()},[H,eC,eA]),eP="git"===m?H.trim().length>0:$.trim().length>0,eR=(0,n.useMemo)(()=>"git"===m?eS?.fullName??H.trim():G($)??$.trim(),[H,$,m,eS]),eU=(0,n.useMemo)(()=>"git"===m?eS?.description?.trim()||H.trim():$.trim(),[H,$,m,eS]),e$=(0,n.useMemo)(()=>{let e=[...new Set(c)];0===e.length&&e.push(d||O);let t=new Map(P.BO.map((e,t)=>[e,t]));return e.sort((e,r)=>{let a=t.get((0,E.q)(e))??Number.MAX_SAFE_INTEGER,s=t.get((0,E.q)(r))??Number.MAX_SAFE_INTEGER;return a!==s?a-s:z(e).localeCompare(z(r))})},[c,d]);(0,n.useEffect)(()=>{e$.includes(_)||T(e$[0]??O)},[_,e$]);let eM=async(e=!1)=>{er(!0),ed(null);try{let t=await fetch((0,U.S)(`/api/github/repos${e?"?refresh=true":""}`,v)),r=await t.json().catch(()=>null);if(!t.ok)throw Error(r?.error??`Failed to load GitHub repositories (${t.status})`);ee(Array.isArray(r?.repos)?r.repos:[])}catch(e){ee([]),ed(e instanceof Error?e.message:"Failed to load GitHub repositories")}finally{es(!0),er(!1)}};(0,n.useEffect)(()=>{!e||"git"!==m||et||ea||eM()},[ea,et,m,e]);let eD=async e=>{let t=e?.gitUrl??("git"===m?H.trim():""),r=e?.path??("local"===m?$.trim():"");if(0===t.length&&0===r.length)return void ey("git"===m?"Choose or paste a repository first.":"Select a local repository path first.");ej(!0),ey(null);try{let e=new URLSearchParams;t.length>0&&e.set("gitUrl",t),r.length>0&&e.set("path",r);let a=await fetch((0,U.S)(`/api/workspaces/branches?${e.toString()}`,v)),s=await a.json().catch(()=>null);if(!a.ok)throw Error(s?.error??`Failed to load branches (${a.status})`);let l=Array.isArray(s?.branches)?s.branches.filter(e=>"string"==typeof e&&e.trim().length>0):[];ek(l);let n="string"==typeof s?.defaultBranch&&s.defaultBranch.trim().length>0?s.defaultBranch.trim():l[0]??null;n&&(0===F.trim().length||!l.includes(F))&&B(n)}catch(e){ek([]),ey(e instanceof Error?e.message:"Failed to load branches")}finally{ej(!1)}},eL=async e=>{ev(e);let t=Q.find(t=>t.httpsUrl===e);t&&(R(t.httpsUrl),ex(t.fullName),B(t.defaultBranch||"main"),C||S(I(t.name)||g),await eD({gitUrl:t.httpsUrl}),b("details"))},eF=async()=>{let e=eC??eA;if(!e)return;let t=Q.find(t=>t.httpsUrl.toLowerCase()===e.toLowerCase())??null;if(t)return void await eL(t.httpsUrl);if(ev(""),R(e),B("main"),ek([]),ey(null),!C){let t=function(e){let t=e.trim();if(!t)return null;let r=t.match(/^git@[^:]+:([^/]+)\/([^/\s]+?)(?:\.git)?$/i);if(r)return r[2]??null;try{let e=new URL(t).pathname.split("/").filter(Boolean).at(-1);return e?e.replace(/\.git$/i,""):null}catch{return null}}(e);t&&S(I(t))}await eD({gitUrl:e}),b("details")},eB=e=>{eb(e),eu(!0)},e_=e=>{u(e),b("source"),ek([]),ey(null)};if(!e)return null;let eT=eP&&F.trim().length>0;async function eq(e){if(e.preventDefault(),"details"!==h||!eT||o)return;let t="git"===m?{mode:m,projectId:g.trim()||void 0,agent:_,agentModel:(0,q.xb)(Z)??"",agentReasoningEffort:(0,q.aB)(Z)??"",defaultBranch:F.trim(),useWorktree:Y,gitUrl:H.trim(),path:D.trim()||void 0}:{mode:m,projectId:g.trim()||void 0,agent:_,agentModel:(0,q.xb)(Z)??"",agentReasoningEffort:(0,q.aB)(Z)??"",defaultBranch:F.trim(),useWorktree:Y,path:$.trim(),initializeGit:X};await r(t)}return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"fixed inset-0 z-[80] flex items-end justify-center overflow-y-auto bg-black/65 px-0 py-0 sm:items-center sm:px-3 sm:py-3",onClick:()=>{o||em||t()},role:"presentation",children:(0,a.jsxs)("form",{onSubmit:eq,onClick:e=>e.stopPropagation(),className:"flex h-dvh w-full max-w-none flex-col overflow-hidden rounded-none border-x-0 border-b-0 border-t border-[var(--vk-border)] bg-[var(--vk-bg-panel)] shadow-[0_24px_80px_rgba(0,0,0,0.55)] sm:h-auto sm:max-h-[calc(100dvh-3rem)] sm:max-w-[860px] sm:rounded-[10px] sm:border",children:[(0,a.jsxs)("header",{className:"border-b border-[var(--vk-border)] bg-[color:color-mix(in_srgb,var(--vk-bg-panel)_92%,transparent)] px-4 py-3 backdrop-blur",children:[(0,a.jsx)("div",{className:"mb-3 flex justify-center sm:hidden",children:(0,a.jsx)("span",{className:"h-1 w-10 rounded-full bg-[color:color-mix(in_srgb,var(--vk-text-muted)_36%,transparent)]"})}),(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("h2",{className:"text-[18px] leading-[22px] text-[var(--vk-text-strong)]",children:"Add Workspace"}),(0,a.jsx)("span",{className:"inline-flex rounded-full border border-[var(--vk-border)] px-2 py-0.5 text-[11px] text-[var(--vk-text-muted)]",children:"source"===h?"Step 1 of 2":"Step 2 of 2"})]}),(0,a.jsx)("p",{className:"pt-1 text-[12px] text-[var(--vk-text-muted)]",children:"source"===h?"Start with the repository or folder you want Conductor to manage.":"Confirm the defaults Conductor should use when this workspace is created."}),(0,a.jsx)("div",{className:"mt-3 flex flex-wrap items-center gap-2",children:[{id:"source",label:"git"===m?"Repository":"Folder"},{id:"details",label:"Defaults"}].map(e=>{let t=h===e.id,r="source"===e.id&&"details"===h&&eP;return(0,a.jsxs)("div",{className:`inline-flex items-center gap-2 rounded-full border px-3 py-1 text-[11px] ${t?"border-[var(--vk-orange)] bg-[color:color-mix(in_srgb,var(--vk-orange)_12%,transparent)] text-[var(--vk-text-strong)]":"border-[var(--vk-border)] text-[var(--vk-text-muted)]"}`,children:[(0,a.jsx)("span",{className:`inline-flex h-4 w-4 items-center justify-center rounded-full border text-[10px] ${r?"border-[var(--vk-orange)] bg-[var(--vk-orange)] text-black":t?"border-[var(--vk-orange)] text-[var(--vk-text-strong)]":"border-[var(--vk-border)]"}`,children:r?(0,a.jsx)(k.A,{className:"h-3 w-3"}):"source"===e.id?"1":"2"}),(0,a.jsx)("span",{children:e.label})]},e.id)})})]}),(0,a.jsx)("button",{type:"button",onClick:t,disabled:o,"aria-label":"Close dialog",className:"inline-flex h-8 w-8 items-center justify-center rounded-[4px] text-[var(--vk-text-muted)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-50",children:(0,a.jsx)(f.A,{className:"h-4 w-4"})})]})]}),(0,a.jsx)("div",{className:"min-h-0 flex-1 overflow-y-auto px-4 py-4 sm:px-5 sm:py-5",children:"source"===h?(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2",children:[(0,a.jsxs)("button",{type:"button",onClick:()=>e_("git"),className:`rounded-[10px] border px-4 py-4 text-left transition ${"git"===m?"border-[var(--vk-orange)] bg-[color:color-mix(in_srgb,var(--vk-orange)_12%,transparent)]":"border-[var(--vk-border)] bg-[var(--vk-bg-main)] hover:bg-[var(--vk-bg-hover)]"}`,children:[(0,a.jsx)("span",{className:"inline-flex h-10 w-10 items-center justify-center rounded-[8px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] text-[var(--vk-text-strong)]",children:(0,a.jsx)(s.uj0,{className:"h-[18px] w-[18px]"})}),(0,a.jsx)("p",{className:"mt-3 text-[14px] font-medium text-[var(--vk-text-strong)]",children:"GitHub repository"}),(0,a.jsx)("p",{className:"mt-1 text-[12px] leading-5 text-[var(--vk-text-muted)]",children:"Search repos you already have access to, or paste a GitHub URL directly."})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>e_("local"),className:`rounded-[10px] border px-4 py-4 text-left transition ${"local"===m?"border-[var(--vk-orange)] bg-[color:color-mix(in_srgb,var(--vk-orange)_12%,transparent)]":"border-[var(--vk-border)] bg-[var(--vk-bg-main)] hover:bg-[var(--vk-bg-hover)]"}`,children:[(0,a.jsx)("span",{className:"inline-flex h-10 w-10 items-center justify-center rounded-[8px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] text-[var(--vk-text-strong)]",children:(0,a.jsx)(j.A,{className:"h-5 w-5"})}),(0,a.jsx)("p",{className:"mt-3 text-[14px] font-medium text-[var(--vk-text-strong)]",children:"Local folder"}),(0,a.jsx)("p",{className:"mt-1 text-[12px] leading-5 text-[var(--vk-text-muted)]",children:"Point Conductor at a repository already on this machine."})]})]}),"git"===m?(0,a.jsxs)("div",{className:"space-y-3 rounded-[10px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)] p-3 sm:p-4",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"inline-flex h-10 w-10 items-center justify-center rounded-[8px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] text-[var(--vk-text-strong)]",children:(0,a.jsx)(s.SYR,{className:"h-4 w-4"})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("p",{className:"text-[14px] font-medium text-[var(--vk-text-strong)]",children:"Choose repository"}),(0,a.jsx)("p",{className:"pt-0.5 text-[12px] leading-5 text-[var(--vk-text-muted)]",children:"Select a repo first. Branch, workspace name, and runtime defaults come next."})]}),(0,a.jsx)("button",{type:"button",onClick:()=>{es(!1),eM(!0)},disabled:et,className:"inline-flex h-9 items-center rounded-[6px] border border-[var(--vk-border)] px-3 text-[12px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-50",children:et?(0,a.jsx)(N.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(y.A,{className:"mr-1.5 h-3.5 w-3.5"}),"Refresh"]})})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(s.uj0,{className:"pointer-events-none absolute left-3 top-1/2 h-[16px] w-[16px] -translate-y-1/2 text-[var(--vk-text-muted)]"}),(0,a.jsx)("input",{value:ec,onChange:e=>ex(e.target.value),onKeyDown:e=>{"Enter"===e.key&&eE&&(e.preventDefault(),eF())},placeholder:"Search GitHub repos or paste a repository URL",className:"h-11 w-full rounded-[8px] border border-[var(--vk-border)] bg-transparent pl-10 pr-3 text-[14px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"})]}),eE?(0,a.jsxs)("button",{type:"button",onClick:()=>{eF()},className:"inline-flex w-full items-center justify-center gap-2 rounded-[8px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-3 py-2.5 text-[13px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)]",children:[(0,a.jsx)(s.SYR,{className:"h-4 w-4 text-[var(--vk-text-strong)]"}),(0,a.jsxs)("span",{className:"truncate",children:["Use ",eC?"this GitHub repository":"pasted repository URL"]})]}):null,et&&0===Q.length?(0,a.jsx)("div",{className:"rounded-[8px] border border-[var(--vk-border)] px-3 py-3 text-[12px] text-[var(--vk-text-muted)]",children:"Loading accessible GitHub repositories..."}):null,ei?(0,a.jsxs)("div",{className:"rounded-[8px] border border-[var(--vk-red)]/40 bg-[var(--vk-bg-panel)] px-3 py-3 text-[12px] text-[var(--vk-red)]",children:[(0,a.jsx)("p",{children:ei}),(0,a.jsx)("button",{type:"button",onClick:()=>{es(!1),eM(!0)},className:"mt-2 inline-flex items-center rounded-[6px] border border-[var(--vk-border)] px-2 py-1 text-[12px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)]",children:"Retry"})]}):null,!ei&&ew.length>0?(0,a.jsx)("div",{className:"max-h-[min(42dvh,340px)] space-y-2 overflow-y-auto pr-1",children:ew.map(e=>{let t=W(e.updatedAt),r=eS?.httpsUrl===e.httpsUrl;return(0,a.jsxs)("button",{type:"button",onClick:()=>{eL(e.httpsUrl)},className:`flex w-full items-start gap-3 rounded-[8px] border px-3 py-3 text-left transition ${r?"border-[var(--vk-orange)] bg-[color:color-mix(in_srgb,var(--vk-orange)_10%,transparent)]":"border-[var(--vk-border)] bg-[var(--vk-bg-panel)] hover:bg-[var(--vk-bg-hover)]"}`,children:[(0,a.jsx)("span",{className:"mt-0.5 inline-flex h-9 w-9 shrink-0 items-center justify-center rounded-[8px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)] text-[var(--vk-text-strong)]",children:(0,a.jsx)(s.SYR,{className:"h-4 w-4"})}),(0,a.jsxs)("span",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("span",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:"truncate text-[13px] font-medium text-[var(--vk-text-strong)]",children:e.fullName}),(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full border border-[var(--vk-border)] px-2 py-0.5 text-[11px] text-[var(--vk-text-muted)]",children:[e.private?(0,a.jsx)(s.XAi,{className:"h-3 w-3"}):(0,a.jsx)(s.uj0,{className:"h-3 w-3"}),e.private?"Private":"Public"]}),(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full border border-[var(--vk-border)] px-2 py-0.5 text-[11px] text-[var(--vk-text-muted)]",children:[(0,a.jsx)(s.C3c,{className:"h-3 w-3"}),e.defaultBranch]})]}),e.description?(0,a.jsx)("span",{className:"mt-1 block line-clamp-2 text-[12px] leading-[17px] text-[var(--vk-text-muted)]",children:e.description}):null,(0,a.jsxs)("span",{className:"mt-1 flex flex-wrap gap-x-3 gap-y-1 text-[11px] text-[var(--vk-text-muted)]",children:[e.ownerLogin?(0,a.jsx)("span",{children:e.ownerLogin}):null,t?(0,a.jsx)("span",{children:t}):null,e.permission?(0,a.jsx)("span",{children:e.permission.toLowerCase()}):null]})]}),(0,a.jsx)("span",{className:"ml-auto inline-flex h-4 w-4 shrink-0 items-center justify-center text-[var(--vk-text-strong)]",children:r?(0,a.jsx)(k.A,{className:"h-4 w-4"}):null})]},e.httpsUrl)})}):null,et||ei||0!==ew.length?null:(0,a.jsx)("p",{className:"text-[12px] text-[var(--vk-text-muted)]",children:ec.trim().length>0?"No matching repositories. Try another search or paste a repository URL.":"No accessible GitHub repositories were found for this machine yet."})]}):(0,a.jsxs)("div",{className:"space-y-3 rounded-[10px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)] p-3 sm:p-4",children:[(0,a.jsxs)("div",{className:"flex items-start gap-3",children:[(0,a.jsx)("span",{className:"inline-flex h-10 w-10 items-center justify-center rounded-[8px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] text-[var(--vk-text-strong)]",children:(0,a.jsx)(j.A,{className:"h-5 w-5"})}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("p",{className:"text-[14px] font-medium text-[var(--vk-text-strong)]",children:"Choose folder"}),(0,a.jsx)("p",{className:"pt-0.5 text-[12px] leading-5 text-[var(--vk-text-muted)]",children:"Pick the repository folder already on disk. You can adjust branch and runtime defaults next."})]})]}),(0,a.jsxs)("button",{type:"button",onClick:()=>eB("local"),className:"inline-flex h-11 w-full items-center justify-center gap-2 rounded-[8px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-3 text-[13px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)]",children:[(0,a.jsx)(j.A,{className:"h-4 w-4"}),$.trim().length>0?"Choose another folder":"Choose folder"]}),$.trim().length>0?(0,a.jsxs)("div",{className:"rounded-[8px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-3 py-3",children:[(0,a.jsx)("p",{className:"text-[12px] font-medium text-[var(--vk-text-strong)]",children:"Selected folder"}),(0,a.jsx)("p",{className:"mt-1 break-all text-[12px] leading-5 text-[var(--vk-text-muted)]",children:$})]}):(0,a.jsx)("p",{className:"text-[12px] text-[var(--vk-text-muted)]",children:"The folder picker stays separate so you do not lose your place in this setup flow on mobile."})]}),i?(0,a.jsx)("p",{className:"text-[12px] text-[var(--vk-red)]",children:i}):null]}):(0,a.jsxs)("div",{className:"space-y-4",children:[(0,a.jsx)("div",{className:"rounded-[10px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)] p-3 sm:p-4",children:(0,a.jsxs)("div",{className:"flex flex-col gap-3 sm:flex-row sm:items-start sm:justify-between",children:[(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsx)("p",{className:"text-[12px] uppercase tracking-[0.08em] text-[var(--vk-text-muted)]",children:"git"===m?"Selected repository":"Selected folder"}),(0,a.jsx)("p",{className:"mt-1 break-words text-[15px] font-medium text-[var(--vk-text-strong)]",children:eR}),(0,a.jsx)("p",{className:"mt-1 break-all text-[12px] leading-5 text-[var(--vk-text-muted)]",children:eU}),(0,a.jsx)("div",{className:"mt-2 flex flex-wrap gap-2",children:"git"===m?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full border border-[var(--vk-border)] px-2 py-0.5 text-[11px] text-[var(--vk-text-muted)]",children:[eS?.private?(0,a.jsx)(s.XAi,{className:"h-3 w-3"}):(0,a.jsx)(s.uj0,{className:"h-3 w-3"}),eS?eS.private?"Private":"Public":"Manual URL"]}),(0,a.jsxs)("span",{className:"inline-flex items-center gap-1 rounded-full border border-[var(--vk-border)] px-2 py-0.5 text-[11px] text-[var(--vk-text-muted)]",children:[(0,a.jsx)(s.C3c,{className:"h-3 w-3"}),F||"main"]}),eS?.ownerLogin?(0,a.jsx)("span",{className:"inline-flex rounded-full border border-[var(--vk-border)] px-2 py-0.5 text-[11px] text-[var(--vk-text-muted)]",children:eS.ownerLogin}):null,eH?(0,a.jsx)("span",{className:"inline-flex rounded-full border border-[var(--vk-border)] px-2 py-0.5 text-[11px] text-[var(--vk-text-muted)]",children:eH}):null]}):(0,a.jsx)("span",{className:"inline-flex rounded-full border border-[var(--vk-border)] px-2 py-0.5 text-[11px] text-[var(--vk-text-muted)]",children:"Local repository"})})]}),(0,a.jsx)("button",{type:"button",onClick:()=>b("source"),className:"inline-flex h-9 items-center justify-center rounded-[6px] border border-[var(--vk-border)] px-3 text-[12px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)]",children:"Change"})]})}),(0,a.jsxs)("div",{className:"grid grid-cols-1 gap-3 lg:grid-cols-2",children:[(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] text-[var(--vk-text-muted)]",children:"Workspace Name (optional)"}),(0,a.jsx)("input",{value:g,onChange:e=>{S(e.target.value),A(!0)},placeholder:"auto-derived from the selected repository or folder",className:"h-10 w-full rounded-[8px] border border-[var(--vk-border)] bg-transparent px-3 text-[14px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] text-[var(--vk-text-muted)]",children:"Branch"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{value:F,onChange:e=>B(e.target.value),placeholder:"Uses the repository default branch",className:"h-10 w-full rounded-[8px] border border-[var(--vk-border)] bg-transparent px-3 text-[14px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"}),(0,a.jsx)("button",{type:"button",onClick:()=>{eD()},disabled:ef,className:"inline-flex h-10 items-center rounded-[8px] border border-[var(--vk-border)] px-3 text-[12px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-50",title:"Detect branches",children:ef?(0,a.jsx)(N.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,a.jsx)(y.A,{className:"h-3.5 w-3.5"})})]}),eg.length>0?(0,a.jsx)("select",{value:F,onChange:e=>B(e.target.value),className:"mt-2 h-9 w-full rounded-[8px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-3 text-[12px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]",children:eg.map(e=>(0,a.jsx)("option",{value:e,children:e},e))}):null,eN?(0,a.jsx)("p",{className:"mt-1 text-[11px] text-[var(--vk-red)]",children:eN}):null]})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 text-[11px] text-[var(--vk-text-muted)]",children:[(0,a.jsxs)("span",{className:"inline-flex rounded-full border border-[var(--vk-border)] px-2 py-0.5",children:["Agent: ",z(_)]}),(0,a.jsx)("span",{className:"inline-flex rounded-full border border-[var(--vk-border)] px-2 py-0.5",children:Y?"Worktree isolation on":"Runs on selected branch"}),"local"===m?(0,a.jsx)("span",{className:"inline-flex rounded-full border border-[var(--vk-border)] px-2 py-0.5",children:X?"Auto-init git if needed":"Do not init git"}):null]}),(0,l.Zz)(_)?(0,a.jsxs)("div",{className:"rounded-[10px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)] p-3 sm:p-4",children:[(0,a.jsx)("div",{className:"flex flex-col gap-1 sm:flex-row sm:items-end sm:justify-between",children:(0,a.jsxs)("div",{children:[(0,a.jsx)("p",{className:"text-[13px] font-medium text-[var(--vk-text-strong)]",children:"Agent defaults"}),(0,a.jsx)("p",{className:"mt-0.5 text-[11px] leading-5 text-[var(--vk-text-muted)]",children:"Choose the model and reasoning this workspace should inherit when sessions launch."})]})}),(0,a.jsx)("div",{className:"mt-3",children:(0,a.jsx)(el,{compact:!0,agent:_,modelAccess:x,runtimeModelCatalogs:p,selection:Z,onChange:V})})]}):null,(0,a.jsxs)("details",{className:"rounded-[10px] border border-[var(--vk-border)] bg-[var(--vk-bg-main)]",children:[(0,a.jsx)("summary",{className:"cursor-pointer list-none px-3 py-3 text-[13px] text-[var(--vk-text-normal)] marker:hidden",children:(0,a.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,a.jsx)(w.A,{className:"h-3.5 w-3.5 text-[var(--vk-text-muted)]"}),"Runtime and repository options"]})}),(0,a.jsxs)("div",{className:"space-y-3 border-t border-[var(--vk-border)] px-3 py-3",children:[(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] text-[var(--vk-text-muted)]",children:"Agent"}),(0,a.jsx)("select",{value:_,onChange:e=>T(e.target.value),className:"h-10 w-full rounded-[8px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-3 text-[14px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]",children:e$.map(e=>(0,a.jsx)("option",{value:e,className:"bg-[var(--vk-bg-panel)] text-[var(--vk-text-normal)]",children:z(e)},e))})]}),(0,a.jsx)("div",{className:"rounded-[10px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-3 py-3",children:(0,a.jsxs)("label",{className:"flex items-start gap-3 text-[13px] text-[var(--vk-text-normal)]",children:[(0,a.jsx)("input",{type:"checkbox",checked:Y,onChange:e=>J(e.target.checked),className:"mt-0.5 h-4 w-4 rounded border border-[var(--vk-border)] bg-transparent accent-[var(--vk-orange)]"}),(0,a.jsxs)("span",{children:["Keep work isolated in a new worktree",(0,a.jsx)("span",{className:"mt-1 block text-[11px] leading-5 text-[var(--vk-text-muted)]",children:"Recommended. Turn this off only if sessions should run directly on the selected branch."})]})]})}),"local"===m?(0,a.jsx)("div",{className:"rounded-[10px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-3 py-3",children:(0,a.jsxs)("label",{className:"flex items-start gap-3 text-[13px] text-[var(--vk-text-normal)]",children:[(0,a.jsx)("input",{type:"checkbox",checked:X,onChange:e=>K(e.target.checked),className:"mt-0.5 h-4 w-4 rounded border border-[var(--vk-border)] bg-transparent accent-[var(--vk-orange)]"}),(0,a.jsxs)("span",{children:["Initialize git if this folder is not already a repository",(0,a.jsx)("span",{className:"mt-1 block text-[11px] leading-5 text-[var(--vk-text-muted)]",children:"Leave this on unless you know the folder should stay non-git."})]})]})}):(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] text-[var(--vk-text-muted)]",children:"Clone into a specific folder"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{value:D,readOnly:!0,onClick:()=>eB("clone"),placeholder:"Leave empty to use Conductor's default workspace location",className:"h-10 w-full cursor-pointer rounded-[8px] border border-[var(--vk-border)] bg-transparent px-3 text-[14px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"}),(0,a.jsx)("button",{type:"button",onClick:()=>eB("clone"),className:"inline-flex h-10 items-center rounded-[8px] border border-[var(--vk-border)] px-3 text-[12px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)]",title:"Browse folders",children:(0,a.jsx)(j.A,{className:"h-4 w-4"})})]})]})]})]}),i?(0,a.jsx)("p",{className:"text-[12px] text-[var(--vk-red)]",children:i}):null]})}),(0,a.jsx)("footer",{className:"border-t border-[var(--vk-border)] bg-[color:color-mix(in_srgb,var(--vk-bg-panel)_92%,transparent)] px-4 py-3 pb-[calc(0.75rem+env(safe-area-inset-bottom))] backdrop-blur",children:"source"===h?(0,a.jsxs)("div",{className:"flex flex-col-reverse gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("button",{type:"button",onClick:t,disabled:o,className:"inline-flex h-10 items-center justify-center rounded-[8px] border border-[var(--vk-border)] px-4 text-[13px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-50",children:"Cancel"}),(0,a.jsx)("button",{type:"button",onClick:()=>{"local"!==m||eP?eP&&!o&&b("details"):eB("local")},disabled:"git"===m&&!eP||o,className:"inline-flex h-10 items-center justify-center rounded-[8px] bg-[var(--vk-bg-active)] px-4 text-[13px] text-[var(--vk-text-strong)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-50",children:"local"!==m||eP?"Continue":"Choose folder"})]}):(0,a.jsxs)("div",{className:"flex flex-col-reverse gap-2 sm:flex-row sm:items-center sm:justify-between",children:[(0,a.jsx)("button",{type:"button",onClick:()=>b("source"),disabled:o,className:"inline-flex h-10 items-center justify-center rounded-[8px] border border-[var(--vk-border)] px-4 text-[13px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-50",children:"Back"}),(0,a.jsx)("button",{type:"submit",disabled:!eT||o,className:"inline-flex h-10 items-center justify-center rounded-[8px] bg-[var(--vk-bg-active)] px-4 text-[13px] text-[var(--vk-text-strong)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-50",children:o?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(N.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Adding..."]}):"Add Workspace"})]})})]})}),(0,a.jsx)(eo,{open:em,bridgeId:v,initialPath:"clone"===eh?D:$,title:"local"===eh?"Select Local Repository":"Select Clone Target Folder",description:"local"===eh?"Choose the local repository folder.":"Choose where the git repository should be cloned.",onClose:()=>eu(!1),onSelect:e=>{if(eu(!1),e){if("clone"===eh)return void L(e);if(M(e),!C){let t=G(e);t&&S(I(t))}eD({path:e}),b("details")}}})]})}function eo({open:e,bridgeId:t,initialPath:r,title:s,description:l,onClose:o,onSelect:i}){let[d,c]=(0,n.useState)(""),[x,p]=(0,n.useState)(r??""),[v,m]=(0,n.useState)([]),[u,h]=(0,n.useState)(""),[b,g]=(0,n.useState)(!1),[k,f]=(0,n.useState)(null),[y,w]=(0,n.useState)(!1);(0,n.useEffect)(()=>{if(!e)return;h(""),p(r??"");let a=r&&r.trim().length>0?r.trim():void 0,s=a?`?path=${encodeURIComponent(a)}`:"";g(!0),f(null),fetch((0,U.S)(`/api/filesystem/directory${s}`,t)).then(async e=>{let t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error??`Failed to load directory (${e.status})`);c("string"==typeof t?.currentPath?t.currentPath:""),m(Array.isArray(t?.entries)?t.entries:[])}).catch(e=>{f(e instanceof Error?e.message:"Failed to load directory"),m([])}).finally(()=>{g(!1)})},[r,e]);let C=(0,n.useMemo)(()=>{if(0===u.trim().length)return v;let e=u.trim().toLowerCase();return v.filter(t=>t.name.toLowerCase().includes(e))},[v,u]),A=async e=>{g(!0),f(null);try{let r=e&&e.trim().length>0?`?path=${encodeURIComponent(e.trim())}`:"",a=await fetch((0,U.S)(`/api/filesystem/directory${r}`,t)),s=await a.json().catch(()=>null);if(!a.ok)throw Error(s?.error??`Failed to load directory (${a.status})`);let l="string"==typeof s?.currentPath?s.currentPath:"";c(l),m(Array.isArray(s?.entries)?s.entries:[]),p(l)}catch(e){f(e instanceof Error?e.message:"Failed to load directory"),m([])}finally{g(!1)}},H=async()=>{w(!0);try{let e=await fetch((0,U.S)("/api/filesystem/pick-directory",t),{method:"POST"}),r=await e.json().catch(()=>null);if(!r||r.cancelled||!r.path)return;p(r.path),A(r.path)}catch{}finally{w(!1)}};return e?(0,a.jsx)("div",{className:"fixed inset-0 z-[95] flex items-start justify-center overflow-y-auto bg-black/70 px-3 py-3 sm:items-center sm:py-0",onClick:()=>{o(),i(null)},role:"presentation",children:(0,a.jsxs)("div",{className:"flex max-h-[calc(100dvh-1.5rem)] w-full max-w-[760px] flex-col overflow-hidden rounded-[6px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] shadow-[0_24px_80px_rgba(0,0,0,0.55)]",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("header",{className:"border-b border-[var(--vk-border)] px-4 py-3",children:[(0,a.jsx)("h3",{className:"text-[16px] text-[var(--vk-text-strong)]",children:s}),(0,a.jsx)("p",{className:"pt-1 text-[12px] text-[var(--vk-text-muted)]",children:l})]}),(0,a.jsxs)("div",{className:"flex min-h-0 flex-1 flex-col gap-3 px-4 py-3",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("input",{value:x,onChange:e=>p(e.target.value),placeholder:"/path/to/repository",className:"h-9 w-full rounded-[4px] border border-[var(--vk-border)] bg-transparent px-2 text-[13px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"}),(0,a.jsx)("button",{type:"button",onClick:()=>{A(x)},className:"inline-flex h-9 items-center rounded-[4px] border border-[var(--vk-border)] px-2 text-[12px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)]",children:"Open"})]}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("button",{type:"button",onClick:()=>{A()},className:"inline-flex h-8 items-center rounded-[4px] border border-[var(--vk-border)] px-2 text-[12px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)]",children:"Home"}),(0,a.jsx)("button",{type:"button",onClick:()=>{if(!d)return;let e=d.replace(/\\/g,"/");if(/^[A-Za-z]:\/?$/.test(d)||"/"===e)return;let t=e.split("/").filter(Boolean),r=d.match(/^([A-Za-z]):[/\\]/);A(r?t.length>1?`${r[1]}:/${t.slice(1,-1).join("/")}`:`${r[1]}:/`:t.length>1?`/${t.slice(0,-1).join("/")}`:"/")},className:"inline-flex h-8 items-center rounded-[4px] border border-[var(--vk-border)] px-2 text-[12px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)]",children:"Up"}),(0,a.jsxs)("button",{type:"button",disabled:y,onClick:()=>{H()},className:"inline-flex h-8 items-center gap-1 rounded-[4px] border border-[var(--vk-border)] px-2 text-[12px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-50",children:[y?(0,a.jsx)(N.A,{className:"h-3 w-3 animate-spin"}):(0,a.jsx)(j.A,{className:"h-3 w-3"}),y?"Opening...":"Browse"]}),(0,a.jsx)("div",{className:"truncate text-[12px] text-[var(--vk-text-muted)]",children:d||"Home"})]}),(0,a.jsxs)("div",{className:"relative",children:[(0,a.jsx)(S.A,{className:"pointer-events-none absolute left-2 top-1/2 h-3.5 w-3.5 -translate-y-1/2 text-[var(--vk-text-muted)]"}),(0,a.jsx)("input",{value:u,onChange:e=>h(e.target.value),placeholder:"Filter folders",className:"h-8 w-full rounded-[4px] border border-[var(--vk-border)] bg-transparent pl-7 pr-2 text-[12px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"})]}),(0,a.jsx)("div",{className:"min-h-0 flex-1 overflow-auto rounded-[4px] border border-[var(--vk-border)]",children:b?(0,a.jsx)("div",{className:"px-3 py-3 text-[12px] text-[var(--vk-text-muted)]",children:"Loading..."}):k?(0,a.jsx)("div",{className:"px-3 py-3 text-[12px] text-[var(--vk-red)]",children:k}):0===C.length?(0,a.jsx)("div",{className:"px-3 py-3 text-[12px] text-[var(--vk-text-muted)]",children:"No folders found."}):(0,a.jsx)("div",{className:"p-1",children:C.map(e=>(0,a.jsxs)("button",{type:"button",onClick:()=>{e.isDirectory&&A(e.path)},className:`mb-1 flex w-full items-center gap-2 rounded-[4px] px-2 py-2 text-left text-[12px] ${e.isDirectory?"text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)]":"cursor-default text-[var(--vk-text-muted)]"}`,children:[(0,a.jsx)(j.A,{className:"h-4 w-4 shrink-0"}),(0,a.jsx)("span",{className:"truncate",children:e.name}),e.isGitRepo&&(0,a.jsx)("span",{className:"ml-auto rounded-[999px] border border-[var(--vk-border)] px-1.5 py-0.5 text-[10px]",children:"git"})]},e.path))})})]}),(0,a.jsxs)("footer",{className:"flex items-center justify-end gap-2 border-t border-[var(--vk-border)] px-4 py-3",children:[(0,a.jsx)("button",{type:"button",onClick:()=>{o(),i(null)},className:"inline-flex h-9 items-center rounded-[4px] border border-[var(--vk-border)] px-3 text-[13px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)]",children:"Cancel"}),(0,a.jsx)("button",{type:"button",onClick:()=>{let e=x.trim().length>0?x.trim():d;o(),i(e||null)},className:"inline-flex h-9 items-center rounded-[4px] bg-[var(--vk-bg-active)] px-3 text-[13px] text-[var(--vk-text-strong)] hover:bg-[var(--vk-bg-hover)]",children:"Use this folder"})]})]})}):null}function ei({value:e,idleLabel:t="Copy",copiedLabel:r="Copied"}){let[s,l]=(0,n.useState)(!1);async function o(){await navigator.clipboard.writeText(e),l(!0),window.setTimeout(()=>l(!1),1400)}return(0,a.jsxs)("button",{type:"button",onClick:()=>void o(),className:"inline-flex h-8 items-center gap-1.5 rounded-[4px] border border-[var(--vk-border)] px-2 text-[12px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)]",children:[s?(0,a.jsx)(k.A,{className:"h-3.5 w-3.5 text-[var(--vk-orange)]"}):(0,a.jsx)(C.A,{className:"h-3.5 w-3.5"}),(0,a.jsx)("span",{children:s?r:t})]})}function ed({open:e,mode:t,creating:r,error:s,current:o,projectCount:i,agentOptions:d,agentStates:c,runtimeModelCatalogs:x,onRepositoriesChanged:p,onOnboardingComplete:v,onOpenAgentSetup:m,onClose:u,onSave:h,bridgeId:b}){var g,w;let S,[C,M]=(0,n.useState)("preferences"),[D,L]=(0,n.useState)(o.codingAgent),[F,B]=(0,n.useState)(o.ide),[_,I]=(0,n.useState)(o.markdownEditor),[G,W]=(0,n.useState)(o.markdownEditorPath??""),[X,K]=(0,n.useState)(o.modelAccess),[et,ea]=(0,n.useState)(o.notifications.soundEnabled),[en,ec]=(0,n.useState)(o.notifications.soundFile),[ex,ep]=(0,n.useState)([]),[ev,em]=(0,n.useState)(!1),[eu,eh]=(0,n.useState)(!1),[eb,eg]=(0,n.useState)(null),[ek,ef]=(0,n.useState)(""),[ej,eN]=(0,n.useState)(null),[ey,ew]=(0,n.useState)((0,q.Z3)()),[eS,eC]=(0,n.useState)([]),[eA,eH]=(0,n.useState)(!1),[eE,eP]=(0,n.useState)(null),[eR,eU]=(0,n.useState)(!1),[e$,eM]=(0,n.useState)(!1),[eD,eL]=(0,n.useState)(()=>Q(null)),[eF,eB]=(0,n.useState)(!1),[e_,eT]=(0,n.useState)(!1),[eq,eO]=(0,n.useState)(null),[ez,eI]=(0,n.useState)(null),[eG,eW]=(0,n.useState)(!1),[eZ,eV]=(0,n.useState)(null),eY=r||eu||e_;function eJ(e){return{...e,agentPermissions:"default"===e.agentPermissions?"default":"skip",devServerScript:e.devServerScript??"",devServerCwd:e.devServerCwd??"",devServerUrl:e.devServerUrl??"",devServerPort:e.devServerPort??"",devServerHost:e.devServerHost??"",devServerPath:e.devServerPath??"",devServerHttps:!0===e.devServerHttps,pathHealth:{exists:e.pathHealth.exists,isGitRepository:e.pathHealth.isGitRepository,suggestedPath:e.pathHealth.suggestedPath}}}function eX(e){return e.split(/\n+/g).map(e=>e.trim()).filter(Boolean)}async function eK(e){em(!0),eg(null);try{let t=await fetch((0,U.S)("/api/repositories",b)),r=await t.json().catch(()=>null);if(!t.ok)throw Error(r?.error??`Failed to load repositories (${t.status})`);let a=Array.isArray(r?.repositories)?r.repositories:[];ep(a);let s=a[0]?.id??"",l=e&&a.some(t=>t.id===e)?e:ek&&a.some(e=>e.id===ek)?ek:s;ef(l)}catch(e){ep([]),ef(""),eN(null),ew((0,q.Z3)()),eg(e instanceof Error?e.message:"Failed to load repositories")}finally{em(!1)}}async function eQ(e,t){let r=(e??ej?.path??"").trim();if(0===r.length){eP("Select a repository path first."),eC([]);return}eH(!0),eP(null);try{let e=new URLSearchParams({path:r}),a=await fetch((0,U.S)(`/api/workspaces/branches?${e.toString()}`,b)),s=await a.json().catch(()=>null);if(!a.ok)throw Error(s?.error??`Failed to detect branches (${a.status})`);let l=Array.isArray(s?.branches)?s.branches.filter(e=>"string"==typeof e&&e.trim().length>0):[];eC(l);let n=t?.trim()||("string"==typeof s?.defaultBranch&&s.defaultBranch.trim().length>0?s.defaultBranch.trim():l[0]??"");if(!n)return;eN(e=>!e||e.defaultBranch.trim().length>0&&l.includes(e.defaultBranch)?e:{...e,defaultBranch:n})}catch(e){eC([]),eP(e instanceof Error?e.message:"Failed to detect branches")}finally{eH(!1)}}async function e0(){if(!ej||eu||0===ej.repo.trim().length||0===ej.path.trim().length)return!1;eh(!0),eg(null);try{let e=await fetch((0,U.S)("/api/repositories",b),{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({id:ej.id,displayName:ej.displayName,repo:ej.repo,path:ej.path,agent:ej.agent,agentPermissions:ej.agentPermissions,agentModel:(0,q.xb)(ey)??"",agentReasoningEffort:(0,q.aB)(ey)??"",defaultWorkingDirectory:ej.defaultWorkingDirectory,defaultBranch:ej.defaultBranch,devServerScript:ej.devServerScript,devServerCwd:ej.devServerCwd,devServerUrl:ej.devServerUrl,devServerPort:ej.devServerPort,devServerHost:ej.devServerHost,devServerPath:ej.devServerPath,devServerHttps:ej.devServerHttps,setupScript:ej.setupScript,runSetupInParallel:ej.runSetupInParallel,cleanupScript:ej.cleanupScript,archiveScript:ej.archiveScript,copyFiles:ej.copyFiles})}),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error??`Failed to save repository settings (${e.status})`);let r=t?.repository;if(!r)throw Error("Repository saved but response is missing repository data");return ep(e=>e.map(e=>e.id===r.id?r:e)),eN(eJ(r)),ef(r.id),eP(null),await eQ(r.path,r.defaultBranch),p&&await p(),!0}catch(e){return eg(e instanceof Error?e.message:"Failed to save repository settings"),!1}finally{eh(!1)}}async function e1(){eB(!0),eO(null);try{let e=await fetch("/api/access"),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error??`Failed to load organization settings (${e.status})`);eL(Q(t?.access,t?.current))}catch(e){eL(Q(null)),eO(e instanceof Error?e.message:"Failed to load organization settings")}finally{eB(!1)}}async function e2(){eW(!0),eV(null);try{let e=await fetch("/api/auth/profile",{cache:"no-store"}),t=await e.json().catch(()=>null);if(!e.ok){let r=t&&"object"==typeof t&&"error"in t&&"string"==typeof t.error?t.error:`Failed to load profile (${e.status})`;throw Error(r)}eI(t)}catch(e){eI(null),eV(e instanceof Error?e.message:"Failed to load profile")}finally{eW(!1)}}async function e3(){if(e_)return!1;eT(!0),eO(null);try{let e=await fetch("/api/access",{method:"PUT",headers:{"Content-Type":"application/json"},body:JSON.stringify({requireAuth:eD.requireAuth||eD.trustedHeaders.enabled,defaultRole:eD.defaultRole,trustedHeaders:{enabled:eD.trustedHeaders.enabled,provider:"cloudflare-access",emailHeader:eD.trustedHeaders.emailHeader,jwtHeader:eD.trustedHeaders.jwtHeader,teamDomain:eD.trustedHeaders.teamDomain,audience:eD.trustedHeaders.audience},roles:{viewers:eX(eD.roles.viewers),operators:eX(eD.roles.operators),admins:eX(eD.roles.admins),viewerDomains:eX(eD.roles.viewerDomains),operatorDomains:eX(eD.roles.operatorDomains),adminDomains:eX(eD.roles.adminDomains)}})}),t=await e.json().catch(()=>null);if(!e.ok)throw Error(t?.error??`Failed to save organization settings (${e.status})`);return eL(Q(t?.access,t?.current)),!0}catch(e){return eO(e instanceof Error?e.message:"Failed to save organization settings"),!1}finally{eT(!1)}}(0,n.useEffect)(()=>{e&&(M("onboarding"===t?"preferences":"general"),L(o.codingAgent),B(o.ide),I(o.markdownEditor),W(o.markdownEditorPath??""),K(o.modelAccess),ea(o.notifications.soundEnabled),ec(o.notifications.soundFile),eC([]),eP(null),eg(null),ew((0,q.Z3)()),eO(null),eI(null),eV(null))},[t,e]),(0,n.useEffect)(()=>{e&&("settings"===t||"repositories"===C)&&eK()},[C,t,e]),(0,n.useEffect)(()=>{e&&"onboarding"!==t&&e1()},[t,e]),(0,n.useEffect)(()=>{e&&"onboarding"!==t&&"profile"===C&&e2()},[C,t,e]),(0,n.useEffect)(()=>{if(!e)return;if(!ek){eN(null),ew((0,q.Z3)());return}let t=ex.find(e=>e.id===ek);t&&(eN(eJ(t)),ew((0,q.c0)(t.agent,X,x,t.agentModel,t.agentReasoningEffort)),eC([]),eP(null),t.path.trim().length>0&&eQ(t.path,t.defaultBranch))},[X,e,ex,x,ek]);let e4="onboarding"===t&&i>0,e5=(0,n.useMemo)(()=>"onboarding"===t?e4?V:V.filter(e=>"preferences"===e.id):Z.filter(e=>e.implemented),[t,e4]),e9=e5.find(e=>e.id===C)??e5[0]??Z[0],e8="onboarding"===t,e6="preferences"===e9.id,e7="profile"===e9.id,te="general"===e9.id,tt="agents"===e9.id,tr=e6||te||tt,ta="repositories"===e9.id,ts="organization"===e9.id,tl=e5.findIndex(e=>e.id===e9.id)+1,tn=e5.some(e=>"repositories"===e.id),to="admin"===eD.current.role,ti=(0,n.useMemo)(()=>{let e=new Set(d);D.trim().length>0&&e.add(D),0===e.size&&e.add(O);let t=new Map(P.BO.map((e,t)=>[e,t]));return[...e].sort((e,r)=>{let a=t.get((0,E.q)(e))??Number.MAX_SAFE_INTEGER,s=t.get((0,E.q)(r))??Number.MAX_SAFE_INTEGER;return a!==s?a-s:z(e).localeCompare(z(r))})},[d,D]),td=c[(0,E.q)(D)]??null;if(!e)return null;let tc=D.trim().length>0&&F.trim().length>0&&_.trim().length>0,tx=!!ej&&ej.displayName.trim().length>0&&ej.repo.trim().length>0&&ej.path.trim().length>0&&ej.defaultBranch.trim().length>0,tp=to&&!eF&&(!eD.trustedHeaders.enabled||eD.trustedHeaders.teamDomain.trim().length>0&&eD.trustedHeaders.audience.trim().length>0),tv=ta?eb:ts?eq:e7?eZ:s,tm=ej?(g={...ej,agentModel:(0,q.xb)(ey)??"",agentReasoningEffort:(0,q.aB)(ey)??""},w={ide:F,markdownEditor:_},S=["npx conductor-oss@latest setup","--yes",`--path ${er(g.path)}`,`--project-id ${er(g.id)}`,`--display-name ${er(g.displayName)}`,`--agent ${er(g.agent||"claude-code")}`,`--ide ${er(w.ide)}`,`--markdown-editor ${er(w.markdownEditor)}`],g.repo.trim().length>0&&S.push(`--repo ${er(g.repo.trim())}`),g.defaultBranch.trim().length>0&&S.push(`--default-branch ${er(g.defaultBranch.trim())}`),g.agentModel.trim().length>0&&S.push(`--model ${er(g.agentModel.trim())}`),g.agentReasoningEffort.trim().length>0&&S.push(`--reasoning-effort ${er(g.agentReasoningEffort.trim())}`),g.defaultWorkingDirectory.trim().length>0&&S.push(`--default-working-directory ${er(g.defaultWorkingDirectory.trim())}`),S.join(" ")):"";async function tu(e,t){let a;if(!tc||r)return!1;let s=await h((a=et?en??J[0]?.id??"abstract-sound-4":null,{onboardingAcknowledged:!!e||o.onboardingAcknowledged,codingAgent:D.trim(),ide:F.trim(),markdownEditor:_.trim(),markdownEditorPath:(G??"").trim(),modelAccess:X,notifications:{soundEnabled:et,soundFile:a}}),t);return s&&td&&!td.ready&&m(D),s}async function th(){if(!ev){if(!tn){if(!await tu(!0,{closeDialog:!0}))return;v?.({needsProject:0===i});return}await tu(!1,{closeDialog:!1})&&M("repositories")}}async function tb(){(!ta||await e0())&&await tu(!0,{closeDialog:!0})&&v?.({needsProject:!1})}return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("div",{className:"fixed inset-0 z-[90] flex items-start justify-center overflow-y-auto bg-black/70 px-3 py-3 sm:items-center",onClick:()=>{eY||"onboarding"===t||eR||e$||u()},role:"presentation",children:(0,a.jsxs)("div",{className:"flex h-[100dvh] w-full flex-col overflow-hidden border-[var(--vk-border)] bg-[var(--vk-bg-panel)] shadow-[0_24px_80px_rgba(0,0,0,0.55)] sm:h-[min(92vh,760px)] sm:max-h-[calc(100dvh-1.5rem)] sm:max-w-[1120px] sm:rounded-[6px] sm:border sm:flex-row",onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("aside",{className:"flex w-full shrink-0 flex-col border-b border-[var(--vk-border)] bg-[rgba(28,28,28,0.8)] sm:w-[224px] sm:border-b-0 sm:border-r",children:[(0,a.jsx)("header",{className:"border-b border-[var(--vk-border)] px-4 py-3 sm:py-4",children:(0,a.jsx)("h2",{className:"text-[22px] leading-[24px] text-[var(--vk-text-strong)] sm:text-[27px] sm:leading-[27px]",children:e8?"Setup":"Settings"})}),(0,a.jsx)("nav",{className:"-mx-0.5 flex gap-1 overflow-x-auto px-2 py-2 sm:mx-0 sm:block sm:space-y-1 sm:overflow-auto sm:px-2",children:e5.map(e=>{let t=e.icon,r=e9.id===e.id;return(0,a.jsxs)("button",{type:"button",onClick:()=>M(e.id),disabled:eY,className:`flex min-h-[44px] shrink-0 items-center gap-3 rounded-[3px] px-3 py-2 text-left text-[14px] leading-[21px] transition-colors sm:min-h-0 sm:w-full ${r?"bg-[rgba(234,122,42,0.1)] text-[var(--vk-orange)]":"text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)]"} disabled:opacity-50`,children:[(0,a.jsx)(t,{className:"h-4 w-4 shrink-0"}),(0,a.jsx)("span",{children:e.label})]},e.id)})})]}),(0,a.jsxs)("div",{className:"flex min-h-0 min-w-0 flex-1 flex-col",children:[(0,a.jsxs)("header",{className:"flex items-center justify-between border-b border-[var(--vk-border)] px-4 py-3 sm:py-4",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)("h3",{className:"text-[20px] leading-[24px] text-[var(--vk-text-strong)] sm:text-[27px] sm:leading-[27px]",children:e8?e6?"Choose your preferences":"Review repository defaults":e9.label}),e8&&(0,a.jsxs)("p",{className:"mt-1 text-[12px] text-[var(--vk-text-muted)]",children:["Step ",tl," of ",e5.length]})]}),(0,a.jsx)("button",{type:"button",onClick:u,disabled:eY||"onboarding"===t,"aria-label":"Close settings",className:"inline-flex h-7 w-7 items-center justify-center rounded-[4px] text-[var(--vk-text-muted)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-40",children:(0,a.jsx)(f.A,{className:"h-4 w-4"})})]}),(0,a.jsx)("div",{className:"min-h-0 flex-1 overflow-auto px-4 py-3 sm:px-6 sm:py-4",children:tr?(0,a.jsxs)("div",{className:"space-y-5",children:[e8&&(0,a.jsx)("section",{className:"rounded-[6px] border border-[var(--vk-border)] bg-[rgba(234,122,42,0.08)] px-4 py-3",children:(0,a.jsx)("p",{className:"text-[13px] leading-5 text-[var(--vk-text-normal)]",children:"Conductor is already running locally. Finish setup here in the dashboard, then you can start using chat and boards immediately."})}),(e6||tt)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("section",{className:"space-y-2",children:[(0,a.jsx)("h4",{className:"text-[15px] font-medium text-[var(--vk-text-strong)]",children:"Choose Your Coding Agent"}),(0,a.jsx)("p",{className:"text-[12px] text-[var(--vk-text-muted)]",children:"Select the default coding agent, review its setup state, and confirm which models Conductor can offer for it."}),(0,a.jsx)("div",{className:"grid gap-3",children:ti.map(e=>{let t=D===e,r=c[(0,E.q)(e)]??null,s=ee(e,X),n=(0,q.Ik)(e,X,x),o=n.slice(0,3),i=n.length-o.length,d=r?.installed?r.ready?"Ready":"Setup required":"Not installed";return(0,a.jsxs)("div",{className:`flex flex-col gap-3 rounded-[4px] border px-3 py-3 text-left sm:flex-row sm:items-start ${t?"border-[var(--vk-orange)] bg-[var(--vk-bg-hover)]":"border-[var(--vk-border)] hover:bg-[var(--vk-bg-hover)]"}`,children:[(0,a.jsxs)("div",{className:"flex min-w-0 flex-1 items-start gap-3",children:[(0,a.jsx)(R.N,{seed:{label:e},className:"mt-0.5 h-5 w-5 border-none bg-transparent"}),(0,a.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,a.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,a.jsx)("span",{className:"text-[13px] font-medium text-[var(--vk-text-normal)]",children:z(e)}),(0,a.jsx)("span",{className:"inline-flex rounded-full border border-[var(--vk-border)] px-2 py-0.5 text-[11px] text-[var(--vk-text-muted)]",children:d}),s?(0,a.jsx)("span",{className:"inline-flex rounded-full border border-[var(--vk-border)] px-2 py-0.5 text-[11px] text-[var(--vk-text-muted)]",children:s}):null]}),(0,a.jsx)("p",{className:"mt-1 text-[12px] leading-5 text-[var(--vk-text-muted)]",children:r?.description??(0,P.h7)(e)?.description??"Agent metadata not available."}),(0,a.jsxs)("div",{className:"mt-2 flex flex-wrap gap-1.5",children:[o.map(t=>(0,a.jsx)("span",{className:"inline-flex rounded-full border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 py-0.5 text-[11px] text-[var(--vk-text-normal)]",children:t.label},`${e}-${t.id}`)),i>0?(0,a.jsxs)("span",{className:"inline-flex rounded-full border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 py-0.5 text-[11px] text-[var(--vk-text-muted)]",children:["+",i," more"]}):null,0===o.length?(0,a.jsx)("span",{className:"inline-flex rounded-full border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 py-0.5 text-[11px] text-[var(--vk-text-muted)]",children:(0,l.Zz)(e)?"Models appear after setup":"Uses the agent default model"}):null]}),!r?.installed&&r?.installHint?(0,a.jsxs)("p",{className:"mt-2 text-[11px] text-[var(--vk-text-muted)]",children:["Install hint: ",(0,a.jsx)("code",{className:"rounded bg-[var(--vk-bg-main)] px-1.5 py-0.5 text-[11px] text-[var(--vk-text-normal)]",children:r.installHint})]}):null]})]}),(0,a.jsxs)("div",{className:"flex shrink-0 items-center gap-2 self-start sm:ml-auto",children:[r?.ready?null:(0,a.jsx)("button",{type:"button",onClick:()=>{L(e),m(e)},className:"inline-flex h-8 items-center rounded-[4px] border border-[var(--vk-border)] px-3 text-[12px] text-[var(--vk-orange)] hover:bg-[var(--vk-bg-panel)]",children:r?.installed?"Authenticate":"Install"}),(0,a.jsx)("button",{type:"button",onClick:()=>L(e),className:`inline-flex h-8 items-center rounded-[4px] border px-3 text-[12px] ${t?"border-[var(--vk-orange)] bg-[var(--vk-orange)]/12 text-[var(--vk-orange)]":"border-[var(--vk-border)] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-panel)]"}`,children:t?"Selected":"Use this agent"}),t&&(0,a.jsx)(k.A,{className:"h-3.5 w-3.5 text-[var(--vk-orange)]"})]})]},e)})})]}),(0,a.jsxs)("section",{className:"space-y-3",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("h4",{className:"text-[15px] font-medium text-[var(--vk-text-strong)]",children:"Model Access"}),(0,a.jsx)("p",{className:"text-[12px] text-[var(--vk-text-muted)]",children:"Tell Conductor which account mode each agent is using so the model dropdown only shows options that make sense for that login path."})]}),(0,a.jsx)("div",{className:"grid gap-3",children:ti.filter(e=>{let t=(0,l.yM)(e);return(0,l.Zz)(e)&&(t?.accessOptions.length??0)>1}).map(e=>{let t=(0,l.yM)(e);if(!t)return null;let r=(0,l.Tk)(e,X)??t.defaultAccess;return(0,a.jsxs)("label",{className:"block rounded-[4px] border border-[var(--vk-border)] px-3 py-3",children:[(0,a.jsx)("span",{className:"mb-1 block text-[13px] font-medium text-[var(--vk-text-normal)]",children:t.label}),(0,a.jsx)("select",{value:r,onChange:t=>{var r;let a;return r=t.target.value,void((a=(0,l.yM)(e))&&K(e=>({...e,[a.accessKey]:r})))},className:"h-9 w-full rounded-[4px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 text-[13px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]",children:t.accessOptions.map(e=>(0,a.jsx)("option",{value:e.id,children:e.label},e.id))}),(0,a.jsx)("p",{className:"mt-1.5 text-[11px] text-[var(--vk-text-muted)]",children:t.accessOptions.find(e=>e.id===r)?.description})]},e)})})]})]}),(e6||te)&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("section",{className:"space-y-2",children:[(0,a.jsx)("h4",{className:"text-[15px] font-medium text-[var(--vk-text-strong)]",children:"Markdown Editor"}),(0,a.jsx)("p",{className:"text-[12px] text-[var(--vk-text-muted)]",children:"Used as your second-brain markdown source when feeding context into tasks."}),(0,a.jsx)("div",{className:"grid gap-2 sm:grid-cols-2",children:Y.map(e=>{let t=_===e.id;return(0,a.jsxs)("button",{type:"button",onClick:()=>I(e.id),className:`flex items-center gap-2 rounded-[4px] border px-3 py-2 text-left ${t?"border-[var(--vk-orange)] bg-[var(--vk-bg-hover)]":"border-[var(--vk-border)] hover:bg-[var(--vk-bg-hover)]"}`,children:[(0,a.jsx)(es,{editorId:e.id}),(0,a.jsx)("span",{className:"flex-1 text-[13px] text-[var(--vk-text-normal)]",children:e.label}),t&&(0,a.jsx)(k.A,{className:"h-3.5 w-3.5 text-[var(--vk-orange)]"})]},e.id)})}),"notion"!==_&&(0,a.jsx)("div",{className:"rounded-[4px] border border-[var(--vk-border)] px-3 py-3",children:(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Notes Root"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{value:G??"",readOnly:!0,onClick:()=>eM(!0),placeholder:"Select your Obsidian vault, Logseq graph, or notes folder",className:"h-9 w-full cursor-pointer rounded-[4px] border border-[var(--vk-border)] bg-transparent px-2 text-[13px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"}),(0,a.jsx)("button",{type:"button",onClick:()=>eM(!0),disabled:eY,className:"inline-flex h-9 items-center rounded-[4px] border border-[var(--vk-border)] px-2 text-[12px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-60",title:"Browse folders",children:(0,a.jsx)(j.A,{className:"h-4 w-4"})}),(G??"").trim().length>0&&(0,a.jsx)("button",{type:"button",onClick:()=>W(""),disabled:eY,className:"inline-flex h-9 items-center rounded-[4px] border border-[var(--vk-border)] px-2 text-[12px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-60",children:"Clear"})]}),(0,a.jsx)("p",{className:"mt-1 text-[12px] text-[var(--vk-text-muted)]",children:"Context attachments are discovered from this folder first. Leave it blank to fall back to the current workspace."})]})})]}),(0,a.jsxs)("section",{className:"space-y-2",children:[(0,a.jsx)("h4",{className:"text-[15px] font-medium text-[var(--vk-text-strong)]",children:"Notification Sound"}),(0,a.jsx)("p",{className:"text-[12px] text-[var(--vk-text-muted)]",children:"Pick a sound for notifications, or disable sound."}),(0,a.jsxs)("div",{className:"grid gap-2 sm:grid-cols-2",children:[J.map(e=>{let t=et&&en===e.id;return(0,a.jsxs)("button",{type:"button",onClick:()=>{ea(!0),ec(e.id),(0,$.$E)(e.id)},className:`flex items-center gap-2 rounded-[4px] border px-3 py-2 text-left ${t?"border-[var(--vk-orange)] bg-[var(--vk-bg-hover)]":"border-[var(--vk-border)] hover:bg-[var(--vk-bg-hover)]"}`,children:[(0,a.jsx)(A,{className:"h-4 w-4 text-[var(--vk-text-muted)]"}),(0,a.jsx)("span",{className:"flex-1 text-[13px] text-[var(--vk-text-normal)]",children:e.label}),t&&(0,a.jsx)(k.A,{className:"h-3.5 w-3.5 text-[var(--vk-orange)]"})]},e.id)}),(0,a.jsxs)("button",{type:"button",onClick:()=>ea(!1),className:`flex items-center gap-2 rounded-[4px] border px-3 py-2 text-left ${!et?"border-[var(--vk-orange)] bg-[var(--vk-bg-hover)]":"border-[var(--vk-border)] hover:bg-[var(--vk-bg-hover)]"}`,children:[(0,a.jsx)(H,{className:"h-4 w-4 text-[var(--vk-text-muted)]"}),(0,a.jsx)("span",{className:"flex-1 text-[13px] text-[var(--vk-text-normal)]",children:"No sound"}),!et&&(0,a.jsx)(k.A,{className:"h-3.5 w-3.5 text-[var(--vk-orange)]"})]})]})]})]})]}):e7?(0,a.jsx)(T,{profile:ez,loading:eG,error:eZ,onRefresh:()=>{e2()}}):ta?(0,a.jsxs)("div",{className:"space-y-5",children:[(0,a.jsxs)("section",{className:"space-y-1",children:[(0,a.jsx)("h4",{className:"text-[24px] leading-[24px] text-[var(--vk-text-strong)]",children:e8?"Repository Defaults":"Repository Configuration"}),(0,a.jsx)("p",{className:"text-[14px] text-[var(--vk-text-muted)]",children:e8?"Review the repository Conductor will use for this workspace. You can edit advanced scripts later from Settings.":"Configure scripts and defaults used whenever this repository is selected for workspaces."})]}),("settings"===t||ex.length>1)&&(0,a.jsxs)("section",{className:"space-y-2",children:[(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Select Repository"}),(0,a.jsxs)("select",{value:ek,onChange:e=>ef(e.target.value),disabled:ev||0===ex.length||eY,className:"h-9 w-full rounded-[4px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 text-[13px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)] disabled:opacity-60",children:[0===ex.length&&(0,a.jsx)("option",{value:"",children:"No repositories configured"}),ex.map(e=>(0,a.jsx)("option",{value:e.id,children:e.displayName},e.id))]})]}),(0,a.jsx)("p",{className:"text-[12px] text-[var(--vk-text-muted)]",children:"Select a repository to view and edit its configuration."}),ev&&(0,a.jsx)("p",{className:"text-[12px] text-[var(--vk-text-muted)]",children:"Loading repositories..."})]}),e8&&1===ex.length&&ej&&(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Detected Repository"}),(0,a.jsxs)("div",{className:"rounded-[4px] border border-[var(--vk-border)] bg-[rgba(15,15,15,0.52)] px-3 py-3 text-[13px] text-[var(--vk-text-normal)]",children:[ej.displayName,(0,a.jsx)("span",{className:"ml-2 text-[var(--vk-text-muted)]",children:ej.path})]})]}),ej&&(0,a.jsxs)(a.Fragment,{children:["settings"===t&&(0,a.jsxs)("section",{className:"space-y-3 border-t border-[var(--vk-border)] pt-4",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("h5",{className:"text-[22px] leading-[22px] text-[var(--vk-text-strong)]",children:"Repo-Preseed Bootstrap"}),(0,a.jsx)("p",{className:"text-[13px] text-[var(--vk-text-muted)]",children:"Use this when you already know the target repository and want one command to prefill it. The default first-run path is still `npx conductor-oss@latest`, which opens the dashboard and lets the user choose preferences before adding a project."})]}),(0,a.jsxs)("div",{className:"flex flex-wrap gap-2 text-[11px] text-[var(--vk-text-muted)]",children:[(0,a.jsxs)("span",{className:"rounded-[999px] border border-[var(--vk-border)] px-2 py-1",children:["Workspace: ",ej.workspaceMode]}),(0,a.jsxs)("span",{className:"rounded-[999px] border border-[var(--vk-border)] px-2 py-1",children:["Runtime: ",ej.runtimeMode]}),(0,a.jsxs)("span",{className:"rounded-[999px] border border-[var(--vk-border)] px-2 py-1",children:["SCM: ",ej.scmMode]})]}),(0,a.jsx)("div",{className:"rounded-[4px] border border-[var(--vk-border)] bg-[rgba(15,15,15,0.72)] p-3",children:(0,a.jsx)("pre",{className:"overflow-x-auto whitespace-pre-wrap break-all text-[12px] leading-5 text-[var(--vk-text-normal)]",children:tm})}),(0,a.jsxs)("div",{className:"flex flex-wrap items-center justify-between gap-2",children:[(0,a.jsx)("p",{className:"text-[12px] text-[var(--vk-text-muted)]",children:"This command uses your selected agent, editor, and notes app. Best on macOS with Homebrew. GitHub sign-in still opens a browser so the user can approve access."}),(0,a.jsx)(ei,{value:tm,idleLabel:"Copy Setup Command"})]})]}),(0,a.jsxs)("section",{className:"space-y-3 border-t border-[var(--vk-border)] pt-4",children:[(0,a.jsx)("h5",{className:"text-[22px] leading-[22px] text-[var(--vk-text-strong)]",children:"General Settings"}),(0,a.jsx)("p",{className:"text-[13px] text-[var(--vk-text-muted)]",children:"Configure basic repository information."}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Display Name"}),(0,a.jsx)("input",{value:ej.displayName,onChange:e=>eN(t=>t?{...t,displayName:e.target.value}:t),className:"h-9 w-full rounded-[4px] border border-[var(--vk-border)] bg-transparent px-2 text-[14px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"}),(0,a.jsx)("p",{className:"mt-1 text-[12px] text-[var(--vk-text-muted)]",children:"A friendly name for this repository."})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Repository Slug"}),(0,a.jsx)("input",{value:ej.repo,onChange:e=>eN(t=>t?{...t,repo:e.target.value}:t),placeholder:"e.g., your-org/your-repo",className:"h-9 w-full rounded-[4px] border border-[var(--vk-border)] bg-transparent px-2 text-[14px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"}),(0,a.jsx)("p",{className:"mt-1 text-[12px] text-[var(--vk-text-muted)]",children:"Used for PR tracking, GitHub links, and onboarding defaults."})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Default Agent"}),(0,a.jsx)("select",{value:ej.agent,onChange:e=>{let t=e.target.value;eN(e=>e?{...e,agent:t}:e),ew((0,q.c0)(t,X,x,null))},className:"h-9 w-full rounded-[4px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 text-[13px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]",children:ti.map(e=>(0,a.jsx)("option",{value:e,children:z(e)},e))}),(0,a.jsx)("p",{className:"mt-1 text-[12px] text-[var(--vk-text-muted)]",children:"Used by the one-line bootstrap and as the project default when tasks dispatch."})]}),(0,l.Zz)(ej.agent)&&(0,a.jsx)("div",{className:"rounded-[4px] border border-[var(--vk-border)] px-3 py-3",children:(0,a.jsx)(el,{agent:ej.agent,modelAccess:X,runtimeModelCatalogs:x,selection:ey,onChange:ew})}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Agent Permission Default"}),(0,a.jsxs)("select",{value:ej.agentPermissions,onChange:e=>eN(t=>t?{...t,agentPermissions:"default"===e.target.value?"default":"skip"}:t),className:"h-9 w-full rounded-[4px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 text-[13px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]",children:[(0,a.jsx)("option",{value:"skip",children:"Auto approve and allow local dev servers"}),(0,a.jsx)("option",{value:"default",children:"Sandboxed default mode"})]}),(0,a.jsx)("p",{className:"mt-1 text-[12px] text-[var(--vk-text-muted)]",children:"Applies to new sessions for this repository across all agents unless you override the launch mode."})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Repository Path"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{value:ej.path,readOnly:!0,onClick:()=>eU(!0),placeholder:"Use Browse to select a repository folder",className:"h-9 w-full cursor-pointer rounded-[4px] border border-[var(--vk-border)] bg-transparent px-2 text-[13px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"}),(0,a.jsx)("button",{type:"button",onClick:()=>eU(!0),disabled:eY,className:"inline-flex h-9 items-center rounded-[4px] border border-[var(--vk-border)] px-2 text-[12px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-60",children:(0,a.jsx)(j.A,{className:"h-4 w-4"})})]}),!ej.pathHealth.exists&&(0,a.jsx)("p",{className:"mt-1 text-[12px] text-[var(--vk-red)]",children:"Configured path does not exist on disk."}),ej.pathHealth.exists&&!ej.pathHealth.isGitRepository&&(0,a.jsx)("p",{className:"mt-1 text-[12px] text-[var(--vk-red)]",children:"Configured path exists but is not a git repository."}),ej.pathHealth.suggestedPath&&(0,a.jsx)("button",{type:"button",onClick:()=>{let e=ej.pathHealth.suggestedPath??"";e&&(eN(t=>t?{...t,path:e,pathHealth:{...t.pathHealth,exists:!0,isGitRepository:!0,suggestedPath:null}}:t),eQ(e))},className:"mt-1 inline-flex h-7 items-center rounded-[4px] border border-[var(--vk-border)] px-2 text-[11px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)]",children:"Use detected git repo path"})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Default Working Directory"}),(0,a.jsx)("input",{value:ej.defaultWorkingDirectory,onChange:e=>eN(t=>t?{...t,defaultWorkingDirectory:e.target.value}:t),placeholder:"e.g., packages/frontend",className:"h-9 w-full rounded-[4px] border border-[var(--vk-border)] bg-transparent px-2 text-[14px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"}),(0,a.jsx)("p",{className:"mt-1 text-[12px] text-[var(--vk-text-muted)]",children:"Subdirectory relative to the repository root where the coding agent starts."})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Default Target Branch"}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("input",{value:ej.defaultBranch,onChange:e=>eN(t=>t?{...t,defaultBranch:e.target.value}:t),placeholder:"Select a branch",className:"h-9 w-full rounded-[4px] border border-[var(--vk-border)] bg-transparent px-2 text-[14px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"}),(0,a.jsx)("button",{type:"button",onClick:()=>{eQ()},disabled:eA,className:"inline-flex h-9 items-center rounded-[4px] border border-[var(--vk-border)] px-2 text-[12px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-60",title:"Detect branches",children:eA?(0,a.jsx)(N.A,{className:"h-3.5 w-3.5 animate-spin"}):(0,a.jsx)(y.A,{className:"h-3.5 w-3.5"})})]}),eS.length>0&&(0,a.jsx)("select",{value:ej.defaultBranch,onChange:e=>eN(t=>t?{...t,defaultBranch:e.target.value}:t),className:"mt-2 h-8 w-full rounded-[4px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 text-[12px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]",children:eS.map(e=>(0,a.jsx)("option",{value:e,children:e},e))}),eE&&(0,a.jsx)("p",{className:"mt-1 text-[12px] text-[var(--vk-red)]",children:eE})]})]}),"settings"===t&&(0,a.jsxs)("section",{className:"space-y-3 border-t border-[var(--vk-border)] pt-4",children:[(0,a.jsx)("h5",{className:"text-[22px] leading-[22px] text-[var(--vk-text-strong)]",children:"Scripts & Configuration"}),(0,a.jsx)("p",{className:"text-[13px] text-[var(--vk-text-muted)]",children:"Configure dev server, setup, cleanup, archive, and file-copy behavior for this repository."}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Dev Server Script"}),(0,a.jsx)("textarea",{rows:3,value:ej.devServerScript,onChange:e=>eN(t=>t?{...t,devServerScript:e.target.value}:t),placeholder:"npm run dev",className:"w-full rounded-[4px] border border-[var(--vk-border)] bg-transparent px-2 py-2 text-[13px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"}),(0,a.jsx)("p",{className:"mt-1 text-[12px] text-[var(--vk-text-muted)]",children:"Optional. Leave this blank if you run the local app yourself and only want Conductor to auto-connect the preview."})]}),(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-2",children:[(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Dev Server CWD"}),(0,a.jsx)("input",{value:ej.devServerCwd,onChange:e=>eN(t=>t?{...t,devServerCwd:e.target.value}:t),placeholder:"e.g., apps/web",className:"h-9 w-full rounded-[4px] border border-[var(--vk-border)] bg-transparent px-2 text-[13px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"}),(0,a.jsx)("p",{className:"mt-1 text-[12px] text-[var(--vk-text-muted)]",children:"Runs the dev server from this subdirectory when set."})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Preview URL Override"}),(0,a.jsx)("input",{value:ej.devServerUrl,onChange:e=>eN(t=>t?{...t,devServerUrl:e.target.value}:t),placeholder:"e.g., https://preview.example.com",className:"h-9 w-full rounded-[4px] border border-[var(--vk-border)] bg-transparent px-2 text-[13px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"}),(0,a.jsx)("p",{className:"mt-1 text-[12px] text-[var(--vk-text-muted)]",children:"If set, preview connects here first instead of inferring from logs."})]})]}),(0,a.jsxs)("div",{className:"grid gap-3 sm:grid-cols-4",children:[(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Preview Port"}),(0,a.jsx)("input",{value:ej.devServerPort,onChange:e=>eN(t=>t?{...t,devServerPort:e.target.value}:t),inputMode:"numeric",placeholder:"3000",className:"h-9 w-full rounded-[4px] border border-[var(--vk-border)] bg-transparent px-2 text-[13px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Preview Host"}),(0,a.jsx)("input",{value:ej.devServerHost,onChange:e=>eN(t=>t?{...t,devServerHost:e.target.value}:t),placeholder:"127.0.0.1",className:"h-9 w-full rounded-[4px] border border-[var(--vk-border)] bg-transparent px-2 text-[13px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Preview Path"}),(0,a.jsx)("input",{value:ej.devServerPath,onChange:e=>eN(t=>t?{...t,devServerPath:e.target.value}:t),placeholder:"/",className:"h-9 w-full rounded-[4px] border border-[var(--vk-border)] bg-transparent px-2 text-[13px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"})]}),(0,a.jsxs)("label",{className:"flex items-center gap-2 rounded-[4px] border border-[var(--vk-border)] px-3 py-2 text-[13px] text-[var(--vk-text-normal)]",children:[(0,a.jsx)("input",{type:"checkbox",checked:ej.devServerHttps,onChange:e=>eN(t=>t?{...t,devServerHttps:e.target.checked}:t),className:"h-4 w-4 rounded border border-[var(--vk-border)] bg-transparent accent-[var(--vk-orange)]"}),(0,a.jsx)("span",{children:"Use HTTPS"})]})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Setup Script"}),(0,a.jsx)("textarea",{rows:4,value:ej.setupScript,onChange:e=>eN(t=>t?{...t,setupScript:e.target.value}:t),placeholder:"npm install",className:"w-full rounded-[4px] border border-[var(--vk-border)] bg-transparent px-2 py-2 text-[13px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"}),(0,a.jsx)("p",{className:"mt-1 text-[12px] text-[var(--vk-text-muted)]",children:"Runs in the worktree after creation and before/with coding-agent startup."})]}),(0,a.jsxs)("label",{className:"flex items-start gap-2 rounded-[4px] border border-[var(--vk-border)] px-3 py-2 text-[13px] text-[var(--vk-text-normal)]",children:[(0,a.jsx)("input",{type:"checkbox",checked:ej.runSetupInParallel,onChange:e=>eN(t=>t?{...t,runSetupInParallel:e.target.checked}:t),className:"mt-0.5 h-4 w-4 rounded border border-[var(--vk-border)] bg-transparent accent-[var(--vk-orange)]"}),(0,a.jsx)("span",{children:"Run setup script in parallel with coding agent"})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Cleanup Script"}),(0,a.jsx)("textarea",{rows:4,value:ej.cleanupScript,onChange:e=>eN(t=>t?{...t,cleanupScript:e.target.value}:t),placeholder:"Runs when the workspace is archived and changes exist",className:"w-full rounded-[4px] border border-[var(--vk-border)] bg-transparent px-2 py-2 text-[13px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Archive Script"}),(0,a.jsx)("textarea",{rows:4,value:ej.archiveScript,onChange:e=>eN(t=>t?{...t,archiveScript:e.target.value}:t),placeholder:"Runs when the workspace/session is archived",className:"w-full rounded-[4px] border border-[var(--vk-border)] bg-transparent px-2 py-2 text-[13px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Copy Files"}),(0,a.jsx)("input",{value:ej.copyFiles,onChange:e=>eN(t=>t?{...t,copyFiles:e.target.value}:t),placeholder:".env, config/*.json",className:"h-9 w-full rounded-[4px] border border-[var(--vk-border)] bg-transparent px-2 text-[13px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)]"}),(0,a.jsx)("p",{className:"mt-1 text-[12px] text-[var(--vk-text-muted)]",children:"Comma-separated relative file paths or glob patterns copied from the repo to each worktree."})]})]})]})]}):ts?(0,a.jsxs)("div",{className:"space-y-5",children:[(0,a.jsxs)("section",{className:"rounded-[6px] border border-[var(--vk-border)] bg-[rgba(234,122,42,0.06)] px-4 py-3",children:[(0,a.jsx)("h4",{className:"text-[15px] font-medium text-[var(--vk-text-strong)]",children:"Access Control"}),(0,a.jsx)("p",{className:"mt-1 text-[12px] leading-5 text-[var(--vk-text-muted)]",children:"The dashboard stays bound to localhost by default. If you need access beyond the local machine, put a verified identity layer like Cloudflare Access or Clerk in front of it, then map authenticated users into viewer, operator, or admin roles here."})]}),eF?(0,a.jsxs)("section",{className:"flex items-center gap-2 rounded-[6px] border border-[var(--vk-border)] px-4 py-4 text-[13px] text-[var(--vk-text-muted)]",children:[(0,a.jsx)(N.A,{className:"h-4 w-4 animate-spin"}),"Loading organization access settings..."]}):(0,a.jsxs)(a.Fragment,{children:[(0,a.jsxs)("section",{className:"grid gap-3 lg:grid-cols-3",children:[(0,a.jsxs)("div",{className:"rounded-[6px] border border-[var(--vk-border)] px-4 py-3",children:[(0,a.jsx)("span",{className:"text-[11px] uppercase tracking-[0.12em] text-[var(--vk-text-muted)]",children:"Current Identity"}),(0,a.jsx)("p",{className:"mt-2 text-[14px] text-[var(--vk-text-normal)]",children:eD.current.email??"Anonymous local session"})]}),(0,a.jsxs)("div",{className:"rounded-[6px] border border-[var(--vk-border)] px-4 py-3",children:[(0,a.jsx)("span",{className:"text-[11px] uppercase tracking-[0.12em] text-[var(--vk-text-muted)]",children:"Effective Role"}),(0,a.jsx)("p",{className:"mt-2 text-[14px] text-[var(--vk-text-normal)]",children:eD.current.role??"No access"})]}),(0,a.jsxs)("div",{className:"rounded-[6px] border border-[var(--vk-border)] px-4 py-3",children:[(0,a.jsx)("span",{className:"text-[11px] uppercase tracking-[0.12em] text-[var(--vk-text-muted)]",children:"Auth Provider"}),(0,a.jsx)("p",{className:"mt-2 text-[14px] text-[var(--vk-text-normal)]",children:eD.current.provider??"Local only"})]})]}),!to&&(0,a.jsx)("section",{className:"rounded-[6px] border border-[var(--vk-border)] bg-[rgba(80,80,80,0.18)] px-4 py-3",children:(0,a.jsx)("p",{className:"text-[12px] leading-5 text-[var(--vk-text-muted)]",children:"You can review organization security here, but only an admin session can save changes. Use a local admin session or an admin identity from your edge auth provider to modify access rules."})}),(0,a.jsxs)("section",{className:"space-y-3 rounded-[6px] border border-[var(--vk-border)] px-4 py-4",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("h5",{className:"text-[18px] leading-[20px] text-[var(--vk-text-strong)]",children:"Baseline Access Rules"}),(0,a.jsx)("p",{className:"text-[12px] text-[var(--vk-text-muted)]",children:"Require authentication for remote dashboard requests and decide what authenticated users get by default before explicit role bindings are applied. Localhost on this machine stays in a local admin recovery mode so setup and break-glass access keep working."})]}),(0,a.jsxs)("label",{className:"flex items-start gap-2 rounded-[4px] border border-[var(--vk-border)] px-3 py-2 text-[13px] text-[var(--vk-text-normal)]",children:[(0,a.jsx)("input",{type:"checkbox",checked:eD.requireAuth,onChange:e=>eL(t=>({...t,requireAuth:e.target.checked})),disabled:!to||e_||eD.trustedHeaders.enabled,className:"mt-0.5 h-4 w-4 rounded border border-[var(--vk-border)] bg-transparent accent-[var(--vk-orange)]"}),(0,a.jsx)("span",{children:"Require authentication for remote dashboard requests"})]}),(0,a.jsx)("p",{className:"rounded-[4px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-3 py-2 text-[12px] leading-5 text-[var(--vk-text-muted)]",children:"Unauthenticated public dashboard access is not supported. Use a verified identity provider such as Cloudflare Access or Clerk before exposing the dashboard beyond localhost."}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Default Role"}),(0,a.jsxs)("select",{value:eD.defaultRole,onChange:e=>eL(t=>({...t,defaultRole:e.target.value})),disabled:!to||e_,className:"h-9 w-full rounded-[4px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 text-[13px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)] disabled:opacity-60",children:[(0,a.jsx)("option",{value:"viewer",children:"Viewer"}),(0,a.jsx)("option",{value:"operator",children:"Operator"}),(0,a.jsx)("option",{value:"admin",children:"Admin"})]}),(0,a.jsx)("p",{className:"mt-1 text-[12px] text-[var(--vk-text-muted)]",children:"This applies after identity verification when no explicit email or domain binding matches. Cloudflare Access enterprise mode forces full authentication automatically."})]})]}),(0,a.jsxs)("section",{className:"space-y-3 rounded-[6px] border border-[var(--vk-border)] px-4 py-4",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("h5",{className:"text-[18px] leading-[20px] text-[var(--vk-text-strong)]",children:"Verified Edge Auth"}),(0,a.jsx)("p",{className:"text-[12px] text-[var(--vk-text-muted)]",children:"Recommended for secure public phone access and free team collaboration. Conductor verifies the Cloudflare Access JWT instead of trusting a raw email header."})]}),(0,a.jsxs)("label",{className:"flex items-start gap-2 rounded-[4px] border border-[var(--vk-border)] px-3 py-2 text-[13px] text-[var(--vk-text-normal)]",children:[(0,a.jsx)("input",{type:"checkbox",checked:eD.trustedHeaders.enabled,onChange:e=>eL(t=>({...t,requireAuth:!!e.target.checked||t.requireAuth,trustedHeaders:{...t.trustedHeaders,enabled:e.target.checked}})),disabled:!to||e_,className:"mt-0.5 h-4 w-4 rounded border border-[var(--vk-border)] bg-transparent accent-[var(--vk-orange)]"}),(0,a.jsx)("span",{children:"Enable verified Cloudflare Access authentication"})]}),(0,a.jsxs)("div",{className:"grid gap-3 lg:grid-cols-2",children:[(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Provider"}),(0,a.jsx)("div",{className:"flex h-9 items-center rounded-[4px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-2 text-[13px] text-[var(--vk-text-normal)]",children:"Cloudflare Access (verified JWT)"})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Identity Email Header"}),(0,a.jsx)("input",{value:eD.trustedHeaders.emailHeader,onChange:e=>eL(t=>({...t,trustedHeaders:{...t.trustedHeaders,emailHeader:e.target.value}})),disabled:!to||e_,className:"h-9 w-full rounded-[4px] border border-[var(--vk-border)] bg-transparent px-2 text-[13px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)] disabled:opacity-60"})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"JWT Assertion Header"}),(0,a.jsx)("input",{value:eD.trustedHeaders.jwtHeader,onChange:e=>eL(t=>({...t,trustedHeaders:{...t.trustedHeaders,jwtHeader:e.target.value}})),disabled:!to||e_,className:"h-9 w-full rounded-[4px] border border-[var(--vk-border)] bg-transparent px-2 text-[13px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)] disabled:opacity-60"})]}),(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Cloudflare Team Domain"}),(0,a.jsx)("input",{value:eD.trustedHeaders.teamDomain,onChange:e=>eL(t=>({...t,trustedHeaders:{...t.trustedHeaders,teamDomain:e.target.value}})),disabled:!to||e_,placeholder:"your-team.cloudflareaccess.com",className:"h-9 w-full rounded-[4px] border border-[var(--vk-border)] bg-transparent px-2 text-[13px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)] disabled:opacity-60"})]}),(0,a.jsxs)("label",{className:"block lg:col-span-2",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:"Cloudflare Access Audience"}),(0,a.jsx)("input",{value:eD.trustedHeaders.audience,onChange:e=>eL(t=>({...t,trustedHeaders:{...t.trustedHeaders,audience:e.target.value}})),disabled:!to||e_,placeholder:"Copy the AUD value from your Cloudflare Access application",className:"h-9 w-full rounded-[4px] border border-[var(--vk-border)] bg-transparent px-2 text-[13px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)] disabled:opacity-60"})]})]}),(0,a.jsx)("p",{className:"rounded-[4px] border border-[var(--vk-border)] bg-[var(--vk-bg-panel)] px-3 py-2 text-[12px] leading-5 text-[var(--vk-text-muted)]",children:"Verified public dashboard access requires a Cloudflare Access application that injects a signed JWT and identity email header. Conductor will not trust a public request path when that verification layer is missing."})]}),(0,a.jsxs)("section",{className:"space-y-3 rounded-[6px] border border-[var(--vk-border)] px-4 py-4",children:[(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)("h5",{className:"text-[18px] leading-[20px] text-[var(--vk-text-strong)]",children:"Role Bindings"}),(0,a.jsx)("p",{className:"text-[12px] text-[var(--vk-text-muted)]",children:"Map verified team identities into least-privilege roles. `viewer` can inspect work, `operator` can control agents, and `admin` can change global settings."})]}),(0,a.jsx)("div",{className:"grid gap-3 lg:grid-cols-2",children:[{label:"Viewer Emails",key:"viewers",placeholder:"alice@example.com"},{label:"Operator Emails",key:"operators",placeholder:"builder@example.com"},{label:"Admin Emails",key:"admins",placeholder:"owner@example.com"},{label:"Viewer Domains",key:"viewerDomains",placeholder:"guests.example.com"},{label:"Operator Domains",key:"operatorDomains",placeholder:"eng.example.com"},{label:"Admin Domains",key:"adminDomains",placeholder:"admins.example.com"}].map(({label:e,key:t,placeholder:r})=>(0,a.jsxs)("label",{className:"block",children:[(0,a.jsx)("span",{className:"mb-1.5 block text-[12px] font-medium text-[var(--vk-text-normal)]",children:e}),(0,a.jsx)("textarea",{rows:4,value:eD.roles[t],onChange:e=>eL(r=>({...r,roles:{...r.roles,[t]:e.target.value}})),disabled:!to||e_,placeholder:r,className:"w-full rounded-[4px] border border-[var(--vk-border)] bg-transparent px-2 py-2 text-[13px] text-[var(--vk-text-normal)] outline-none focus:border-[var(--vk-orange)] disabled:opacity-60"}),(0,a.jsx)("p",{className:"mt-1 text-[11px] text-[var(--vk-text-muted)]",children:"One entry per line."})]},t))})]})]})]}):(0,a.jsxs)("section",{className:"space-y-3",children:[(0,a.jsx)("h4",{className:"text-[16px] font-medium text-[var(--vk-text-strong)]",children:e9.label}),(0,a.jsx)("p",{className:"text-[14px] text-[var(--vk-text-muted)]",children:"This section is queued for implementation. General, Agents, and repository settings are available now."}),(0,a.jsx)("button",{type:"button",onClick:()=>M("general"),className:"inline-flex h-9 items-center rounded-[4px] border border-[var(--vk-border)] px-3 text-[13px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)]",children:"Open General"})]})}),(0,a.jsxs)("footer",{className:"flex flex-col gap-3 border-t border-[var(--vk-border)] px-4 py-3 sm:flex-row sm:items-center sm:justify-between sm:gap-2",children:[(0,a.jsxs)("div",{className:"min-w-0",children:[tv&&(0,a.jsx)("p",{className:"truncate rounded-[4px] border border-[var(--vk-red)]/35 bg-[var(--vk-red)]/10 px-2 py-1 text-[12px] text-[var(--vk-red)]",children:tv}),!tv&&tr&&(0,a.jsx)("p",{className:"text-[11px] text-[var(--vk-text-muted)]",children:e8?"Finish setup once here. You can change these preferences any time from Settings.":"Preferences are saved to your conductor config and applied immediately."}),!tv&&ta&&(0,a.jsx)("p",{className:"text-[11px] text-[var(--vk-text-muted)]",children:e8?"These defaults will be used the first time workspaces and tasks are created for this repo.":"Repository settings are saved to your conductor config and used for future workspaces."}),!tv&&ts&&(0,a.jsx)("p",{className:"text-[11px] text-[var(--vk-text-muted)]",children:"Organization access settings are written into `conductor.yaml`. Use admin role bindings for full control, operator bindings for day-to-day agent usage, and viewer bindings for read-only access."}),!tv&&e7&&(0,a.jsx)("p",{className:"text-[11px] text-[var(--vk-text-muted)]",children:"Profile details reflect the current dashboard identity. GitHub avatar and logout controls appear when this session is authenticated through Clerk."})]}),(0,a.jsxs)("div",{className:"flex w-full flex-wrap items-center justify-end gap-2 sm:w-auto",children:[!e8&&(0,a.jsx)("button",{type:"button",onClick:u,disabled:eY,className:"inline-flex h-9 items-center rounded-[4px] border border-[var(--vk-border)] px-3 text-[13px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-50",children:"Close"}),e8&&ta&&(0,a.jsx)("button",{type:"button",onClick:()=>M("preferences"),disabled:eY,className:"inline-flex h-9 items-center rounded-[4px] border border-[var(--vk-border)] px-3 text-[13px] text-[var(--vk-text-normal)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-50",children:"Back"}),tr&&!e8&&(0,a.jsx)("button",{type:"button",onClick:()=>{tu(o.onboardingAcknowledged,{closeDialog:!0})},disabled:!tc||r,className:"inline-flex h-9 items-center rounded-[4px] bg-[var(--vk-bg-active)] px-3 text-[13px] text-[var(--vk-text-strong)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-50",children:r?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(N.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Saving..."]}):"Save"}),ta&&!e8&&(0,a.jsx)("button",{type:"button",onClick:()=>{e0()},disabled:!tx||eu||ev,className:"inline-flex h-9 items-center rounded-[4px] bg-[var(--vk-bg-active)] px-3 text-[13px] text-[var(--vk-text-strong)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-50",children:eu?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(N.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Saving..."]}):"Save Repository"}),ts&&!e8&&(0,a.jsx)("button",{type:"button",onClick:()=>{e3()},disabled:!tp||e_,className:"inline-flex h-9 items-center rounded-[4px] bg-[var(--vk-bg-active)] px-3 text-[13px] text-[var(--vk-text-strong)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-50",children:e_?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(N.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),"Saving..."]}):"Save Access"}),e8&&(0,a.jsx)("button",{type:"button",onClick:()=>{e6?th():tb()},disabled:e6?!tc||r||ev:!tx||eY,className:"inline-flex h-9 items-center rounded-[4px] bg-[var(--vk-bg-active)] px-3 text-[13px] text-[var(--vk-text-strong)] hover:bg-[var(--vk-bg-hover)] disabled:opacity-50",children:eY||e6&&ev?(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(N.A,{className:"mr-1.5 h-3.5 w-3.5 animate-spin"}),e6&&ev?"Loading...":"Saving..."]}):e6&&tn?"Continue":"Finish Setup"})]})]})]})]})}),(0,a.jsx)(eo,{open:eR,bridgeId:b,initialPath:ej?.path,title:"Select Repository Path",description:"Choose the local git repository folder.",onClose:()=>eU(!1),onSelect:e=>{eU(!1),e&&(eN(t=>t?{...t,path:e,pathHealth:{...t.pathHealth,exists:!0,isGitRepository:!0,suggestedPath:null}}:t),eQ(e))}}),(0,a.jsx)(eo,{open:e$,bridgeId:b,initialPath:G??"",title:"Select Notes Root",description:"Choose the local Obsidian vault, Logseq graph, or markdown notes folder used for context attachments.",onClose:()=>eM(!1),onSelect:e=>{eM(!1),null!==e&&W(e)}})]})}}}]);
@@ -0,0 +1 @@
1
+ "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[4929],{13908:(e,c,r)=>{r.d(c,{a:()=>s});var a=r(5974);let s=(0,a.createServerReference)("00b2a16dd4c0264458f0525ace488f40b4d4cfea57",a.callServer,void 0,a.findSourceMapURL,"createOrReadKeylessAction")},54929:(e,c,r)=>{r.r(c),r.d(c,{createOrReadKeylessAction:()=>s.a,deleteKeylessAction:()=>n,detectKeylessEnvDriftAction:()=>a.A,syncKeylessConfigAction:()=>l});var a=r(8599),s=r(13908),t=r(5974);let n=(0,t.createServerReference)("00eeb58e38e129175cdcab00e32631aa51ac0232b6",t.callServer,void 0,t.findSourceMapURL,"deleteKeylessAction"),l=(0,t.createServerReference)("40efe28592e1f30702bbf7011c6430b0279197c8c7",t.callServer,void 0,t.findSourceMapURL,"syncKeylessConfigAction")}}]);
@@ -1,4 +1,4 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7220],{2609:(e,t,r)=>{"use strict";r.d(t,{T5:()=>s.T5,hP:()=>n.hP,nO:()=>s.nO,yC:()=>o}),r(16744);var n=r(70590),s=r(87835);function o(e,t,r){let s=t.path||(null==r?void 0:r.path);return"path"===(t.routing||(null==r?void 0:r.routing)||"path")?s?{...r,...t,routing:"path"}:n.sb.throw((0,n.kd)(e)):t.path?n.sb.throw((0,n.s7)(e)):{...r,...t,path:void 0}}},2896:(e,t,r)=>{"use strict";function n({moduleIds:e}){return null}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadChunks",{enumerable:!0,get:function(){return n}}),r(54568),r(97509),r(85999),r(12918),r(32106)},5974:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={callServer:function(){return o.callServer},createServerReference:function(){return i.createServerReference},findSourceMapURL:function(){return a.findSourceMapURL}};for(var s in n)Object.defineProperty(t,s,{enumerable:!0,get:n[s]});let o=r(34273),a=r(16409),i=r(97102)},6035:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorageInstance",{enumerable:!0,get:function(){return n}});let n=(0,r(59113).createAsyncLocalStorage)()},6974:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"RouterContext",{enumerable:!0,get:function(){return n}});let n=r(74468)._(r(7620)).default.createContext(null)},10594:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={default:function(){return h},handleClientScriptLoad:function(){return y},initScriptLoader:function(){return v}};for(var s in n)Object.defineProperty(t,s,{enumerable:!0,get:n[s]});let o=r(74468),a=r(99649),i=r(54568),l=o._(r(97509)),c=a._(r(7620)),u=r(2737),d=r(66161),p=r(71341),f=new Map,b=new Set,m=e=>{let{src:t,id:r,onLoad:n=()=>{},onReady:s=null,dangerouslySetInnerHTML:o,children:a="",strategy:i="afterInteractive",onError:c,stylesheets:u}=e,p=r||t;if(p&&b.has(p))return;if(f.has(t)){b.add(p),f.get(t).then(n,c);return}let m=()=>{s&&s(),b.add(p)},y=document.createElement("script"),v=new Promise((e,t)=>{y.addEventListener("load",function(t){e(),n&&n.call(this,t),m()}),y.addEventListener("error",function(e){t(e)})}).catch(function(e){c&&c(e)});o?(y.innerHTML=o.__html||"",m()):a?(y.textContent="string"==typeof a?a:Array.isArray(a)?a.join(""):"",m()):t&&(y.src=t,f.set(t,v)),(0,d.setAttributesFromProps)(y,e),"worker"===i&&y.setAttribute("type","text/partytown"),y.setAttribute("data-nscript",i),u&&(e=>{if(l.default.preinit)return e.forEach(e=>{l.default.preinit(e,{as:"style"})});{let t=document.head;e.forEach(e=>{let r=document.createElement("link");r.type="text/css",r.rel="stylesheet",r.href=e,t.appendChild(r)})}})(u),document.body.appendChild(y)};function y(e){let{strategy:t="afterInteractive"}=e;"lazyOnload"===t?window.addEventListener("load",()=>{(0,p.requestIdleCallback)(()=>m(e))}):m(e)}function v(e){e.forEach(y),[...document.querySelectorAll('[data-nscript="beforeInteractive"]'),...document.querySelectorAll('[data-nscript="beforePageRender"]')].forEach(e=>{let t=e.id||e.getAttribute("src");b.add(t)})}function _(e){let{id:t,src:r="",onLoad:n=()=>{},onReady:s=null,strategy:o="afterInteractive",onError:a,stylesheets:d,...f}=e,{updateScripts:y,scripts:v,getIsSsr:_,appDir:h,nonce:g}=(0,c.useContext)(u.HeadManagerContext);g=f.nonce||g;let w=(0,c.useRef)(!1);(0,c.useEffect)(()=>{let e=t||r;w.current||(s&&e&&b.has(e)&&s(),w.current=!0)},[s,t,r]);let E=(0,c.useRef)(!1);if((0,c.useEffect)(()=>{if(!E.current){if("afterInteractive"===o)m(e);else"lazyOnload"===o&&("complete"===document.readyState?(0,p.requestIdleCallback)(()=>m(e)):window.addEventListener("load",()=>{(0,p.requestIdleCallback)(()=>m(e))}));E.current=!0}},[e,o]),("beforeInteractive"===o||"worker"===o)&&(y?(v[o]=(v[o]||[]).concat([{id:t,src:r,onLoad:n,onReady:s,onError:a,...f,nonce:g}]),y(v)):_&&_()?b.add(t||r):_&&!_()&&m({...e,nonce:g})),h){if(d&&d.forEach(e=>{l.default.preinit(e,{as:"style"})}),"beforeInteractive"===o)if(!r)return f.dangerouslySetInnerHTML&&(f.children=f.dangerouslySetInnerHTML.__html,delete f.dangerouslySetInnerHTML),(0,i.jsx)("script",{nonce:g,dangerouslySetInnerHTML:{__html:`(self.__next_s=self.__next_s||[]).push(${JSON.stringify([0,{...f,id:t}])})`}});else return l.default.preload(r,f.integrity?{as:"script",integrity:f.integrity,nonce:g,crossOrigin:f.crossOrigin}:{as:"script",nonce:g,crossOrigin:f.crossOrigin}),(0,i.jsx)("script",{nonce:g,dangerouslySetInnerHTML:{__html:`(self.__next_s=self.__next_s||[]).push(${JSON.stringify([r,{...f,id:t}])})`}});"afterInteractive"===o&&r&&l.default.preload(r,f.integrity?{as:"script",integrity:f.integrity,nonce:g,crossOrigin:f.crossOrigin}:{as:"script",nonce:g,crossOrigin:f.crossOrigin})}return null}Object.defineProperty(_,"__nextScript",{value:!0});let h=_;("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},23597:(e,t,r)=>{"use strict";function n({reason:e,children:t}){return t}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return n}}),r(61841)},30679:(e,t,r)=>{"use strict";r.d(t,{PromisifiedAuthProvider:()=>l,d:()=>c});var n=r(30524),s=r(2609),o=r(45836),a=r(7620);let i=a.createContext(null);function l({authPromise:e,children:t}){return a.createElement(i.Provider,{value:e},t)}function c(e={}){let t=(0,o.useRouter)(),r=a.useContext(i),l=r;return(r&&"then"in r&&(l=a.use(r)),"u"<typeof window)?t?(0,n.As)(e):(0,s.hP)({...l,...e}):(0,n.As)({...l,...e})}},31008:e=>{e.exports={style:{fontFamily:"'JetBrains Mono', 'JetBrains Mono Fallback'",fontStyle:"normal"},className:"__className_6d24ac",variable:"__variable_6d24ac"}},36727:(e,t,r)=>{"use strict";r.r(t),r.d(t,{KeylessCookieSync:()=>a});var n=r(79748),s=r(7620),o=r(38036);function a(e){var t;let a=(null==(t=(0,n.useSelectedLayoutSegments)()[0])?void 0:t.startsWith("/_not-found"))||!1;return(0,s.useEffect)(()=>{o.I&&!a&&r.e(8659).then(r.bind(r,58659)).then(t=>t.syncKeylessConfigAction({...e,returnUrl:window.location.href}))},[a]),e.children}},37204:(e,t,r)=>{"use strict";r.r(t),r.d(t,{ClientClerkProvider:()=>O});var n=r(30524),s=r(20602);let o=new Set;var a=r(42925),i=r(79748),l=r(99321),c=r(7620);let u="u">typeof window?c.useLayoutEffect:c.useEffect,d=c.createContext(void 0);d.displayName="ClerkNextOptionsCtx";let p=()=>{let e=c.useContext(d);return null==e?void 0:e.value},f=e=>{let{children:t,options:r}=e;return c.createElement(d.Provider,{value:{value:r}},t)};var b=r(2609),m=r(10594),y=r.n(m);function v(e){let{publishableKey:t,clerkJSUrl:r,clerkJSVersion:s,clerkJSVariant:o,nonce:a}=p(),{domain:i,proxyUrl:l}=(0,n.ho)();if(!t)return null;let u={domain:i,proxyUrl:l,publishableKey:t,clerkJSUrl:r,clerkJSVersion:s,clerkJSVariant:o,nonce:a},d=(0,b.nO)(u),f="app"===e.router?"script":y();return c.createElement(f,{src:d,"data-clerk-js-script":!0,async:!0,defer:"pages"!==e.router&&void 0,crossOrigin:"anonymous",strategy:"pages"===e.router?"beforeInteractive":void 0,...(0,b.T5)(u)})}var _=r(38036),h=r(76975),g=r(67160),w=r(63680);let E=e=>{var t;return{...e,publishableKey:e.publishableKey||w.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY||"",clerkJSUrl:e.clerkJSUrl||w.env.NEXT_PUBLIC_CLERK_JS_URL,clerkJSVersion:e.clerkJSVersion||w.env.NEXT_PUBLIC_CLERK_JS_VERSION,proxyUrl:e.proxyUrl||w.env.NEXT_PUBLIC_CLERK_PROXY_URL||"",domain:e.domain||w.env.NEXT_PUBLIC_CLERK_DOMAIN||"",isSatellite:e.isSatellite||(0,h.zz)(w.env.NEXT_PUBLIC_CLERK_IS_SATELLITE),signInUrl:e.signInUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_IN_URL||"",signUpUrl:e.signUpUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_UP_URL||"",signInForceRedirectUrl:e.signInForceRedirectUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_IN_FORCE_REDIRECT_URL||"",signUpForceRedirectUrl:e.signUpForceRedirectUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_UP_FORCE_REDIRECT_URL||"",signInFallbackRedirectUrl:e.signInFallbackRedirectUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URL||"",signUpFallbackRedirectUrl:e.signUpFallbackRedirectUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URL||"",afterSignInUrl:e.afterSignInUrl||w.env.NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL||"",afterSignUpUrl:e.afterSignUpUrl||w.env.NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL||"",newSubscriptionRedirectUrl:e.newSubscriptionRedirectUrl||w.env.NEXT_PUBLIC_CLERK_CHECKOUT_CONTINUE_URL||"",telemetry:null!=(t=e.telemetry)?t:{disabled:(0,h.zz)(w.env.NEXT_PUBLIC_CLERK_TELEMETRY_DISABLED),debug:(0,h.zz)(w.env.NEXT_PUBLIC_CLERK_TELEMETRY_DEBUG)},sdkMetadata:g.tm}};var x=r(3102),C=r(57042);let k=()=>{var e,t;let r=(0,n.ho)(),{pagesRouter:s}=(0,C.r)();return null==(t=r.telemetry)||t.record((0,x.YF)({router:s?"pages":"app",...(null==(e=null==globalThis?void 0:globalThis.next)?void 0:e.version)?{nextjsVersion:globalThis.next.version}:{}})),null};var L=r(43458),R=r(22538),T=r(53684);let j=e=>{var t;return null!=window.__clerk_internal_navigations||(window.__clerk_internal_navigations={}),null!=(t=window.__clerk_internal_navigations)[e]||(t[e]={}),window.__clerk_internal_navigations[e]},I=e=>{let{windowNav:t,routerNav:r,name:n}=e,s=(0,i.usePathname)(),[o,a]=(0,c.useTransition)();t&&(j(n).fun=(e,s)=>new Promise(o=>{var i,l;null!=(i=j(n)).promisesBuffer||(i.promisesBuffer=[]),null==(l=j(n).promisesBuffer)||l.push(o),a(()=>{var n,o,a;if((null==(n=null==s?void 0:s.__internal_metadata)?void 0:n.navigationType)==="internal")t((null!=(a=null==(o=window.next)?void 0:o.version)?a:"")<"14.1.0"?history.state:null,"",e);else r(e)})}));let l=()=>{var e;null==(e=j(n).promisesBuffer)||e.forEach(e=>e()),j(n).promisesBuffer=[]};return(0,c.useEffect)(()=>(l(),l),[]),(0,c.useEffect)(()=>{o||l()},[s,o]),(0,c.useCallback)((e,t)=>j(n).fun(e,t),[])},P=(0,a.default)(()=>r.e(4443).then(r.bind(r,34443)).then(e=>e.KeylessCreatorOrReader),{loadableGenerated:{webpack:()=>[34443]}}),S=e=>{let t,r;if(L.M0){var a,d;let e=`Clerk:
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7220],{2609:(e,t,r)=>{"use strict";r.d(t,{T5:()=>s.T5,hP:()=>n.hP,nO:()=>s.nO,yC:()=>o}),r(16744);var n=r(70590),s=r(87835);function o(e,t,r){let s=t.path||(null==r?void 0:r.path);return"path"===(t.routing||(null==r?void 0:r.routing)||"path")?s?{...r,...t,routing:"path"}:n.sb.throw((0,n.kd)(e)):t.path?n.sb.throw((0,n.s7)(e)):{...r,...t,path:void 0}}},2896:(e,t,r)=>{"use strict";function n({moduleIds:e}){return null}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"PreloadChunks",{enumerable:!0,get:function(){return n}}),r(54568),r(97509),r(85999),r(12918),r(32106)},5974:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={callServer:function(){return o.callServer},createServerReference:function(){return i.createServerReference},findSourceMapURL:function(){return a.findSourceMapURL}};for(var s in n)Object.defineProperty(t,s,{enumerable:!0,get:n[s]});let o=r(34273),a=r(16409),i=r(97102)},6035:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"workAsyncStorageInstance",{enumerable:!0,get:function(){return n}});let n=(0,r(59113).createAsyncLocalStorage)()},6974:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"RouterContext",{enumerable:!0,get:function(){return n}});let n=r(74468)._(r(7620)).default.createContext(null)},10594:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={default:function(){return h},handleClientScriptLoad:function(){return y},initScriptLoader:function(){return v}};for(var s in n)Object.defineProperty(t,s,{enumerable:!0,get:n[s]});let o=r(74468),a=r(99649),i=r(54568),l=o._(r(97509)),c=a._(r(7620)),u=r(2737),d=r(66161),p=r(71341),f=new Map,b=new Set,m=e=>{let{src:t,id:r,onLoad:n=()=>{},onReady:s=null,dangerouslySetInnerHTML:o,children:a="",strategy:i="afterInteractive",onError:c,stylesheets:u}=e,p=r||t;if(p&&b.has(p))return;if(f.has(t)){b.add(p),f.get(t).then(n,c);return}let m=()=>{s&&s(),b.add(p)},y=document.createElement("script"),v=new Promise((e,t)=>{y.addEventListener("load",function(t){e(),n&&n.call(this,t),m()}),y.addEventListener("error",function(e){t(e)})}).catch(function(e){c&&c(e)});o?(y.innerHTML=o.__html||"",m()):a?(y.textContent="string"==typeof a?a:Array.isArray(a)?a.join(""):"",m()):t&&(y.src=t,f.set(t,v)),(0,d.setAttributesFromProps)(y,e),"worker"===i&&y.setAttribute("type","text/partytown"),y.setAttribute("data-nscript",i),u&&(e=>{if(l.default.preinit)return e.forEach(e=>{l.default.preinit(e,{as:"style"})});{let t=document.head;e.forEach(e=>{let r=document.createElement("link");r.type="text/css",r.rel="stylesheet",r.href=e,t.appendChild(r)})}})(u),document.body.appendChild(y)};function y(e){let{strategy:t="afterInteractive"}=e;"lazyOnload"===t?window.addEventListener("load",()=>{(0,p.requestIdleCallback)(()=>m(e))}):m(e)}function v(e){e.forEach(y),[...document.querySelectorAll('[data-nscript="beforeInteractive"]'),...document.querySelectorAll('[data-nscript="beforePageRender"]')].forEach(e=>{let t=e.id||e.getAttribute("src");b.add(t)})}function _(e){let{id:t,src:r="",onLoad:n=()=>{},onReady:s=null,strategy:o="afterInteractive",onError:a,stylesheets:d,...f}=e,{updateScripts:y,scripts:v,getIsSsr:_,appDir:h,nonce:g}=(0,c.useContext)(u.HeadManagerContext);g=f.nonce||g;let w=(0,c.useRef)(!1);(0,c.useEffect)(()=>{let e=t||r;w.current||(s&&e&&b.has(e)&&s(),w.current=!0)},[s,t,r]);let E=(0,c.useRef)(!1);if((0,c.useEffect)(()=>{if(!E.current){if("afterInteractive"===o)m(e);else"lazyOnload"===o&&("complete"===document.readyState?(0,p.requestIdleCallback)(()=>m(e)):window.addEventListener("load",()=>{(0,p.requestIdleCallback)(()=>m(e))}));E.current=!0}},[e,o]),("beforeInteractive"===o||"worker"===o)&&(y?(v[o]=(v[o]||[]).concat([{id:t,src:r,onLoad:n,onReady:s,onError:a,...f,nonce:g}]),y(v)):_&&_()?b.add(t||r):_&&!_()&&m({...e,nonce:g})),h){if(d&&d.forEach(e=>{l.default.preinit(e,{as:"style"})}),"beforeInteractive"===o)if(!r)return f.dangerouslySetInnerHTML&&(f.children=f.dangerouslySetInnerHTML.__html,delete f.dangerouslySetInnerHTML),(0,i.jsx)("script",{nonce:g,dangerouslySetInnerHTML:{__html:`(self.__next_s=self.__next_s||[]).push(${JSON.stringify([0,{...f,id:t}])})`}});else return l.default.preload(r,f.integrity?{as:"script",integrity:f.integrity,nonce:g,crossOrigin:f.crossOrigin}:{as:"script",nonce:g,crossOrigin:f.crossOrigin}),(0,i.jsx)("script",{nonce:g,dangerouslySetInnerHTML:{__html:`(self.__next_s=self.__next_s||[]).push(${JSON.stringify([r,{...f,id:t}])})`}});"afterInteractive"===o&&r&&l.default.preload(r,f.integrity?{as:"script",integrity:f.integrity,nonce:g,crossOrigin:f.crossOrigin}:{as:"script",nonce:g,crossOrigin:f.crossOrigin})}return null}Object.defineProperty(_,"__nextScript",{value:!0});let h=_;("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},23597:(e,t,r)=>{"use strict";function n({reason:e,children:t}){return t}Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"BailoutToCSR",{enumerable:!0,get:function(){return n}}),r(61841)},30679:(e,t,r)=>{"use strict";r.d(t,{PromisifiedAuthProvider:()=>l,d:()=>c});var n=r(30524),s=r(2609),o=r(45836),a=r(7620);let i=a.createContext(null);function l({authPromise:e,children:t}){return a.createElement(i.Provider,{value:e},t)}function c(e={}){let t=(0,o.useRouter)(),r=a.useContext(i),l=r;return(r&&"then"in r&&(l=a.use(r)),"u"<typeof window)?t?(0,n.As)(e):(0,s.hP)({...l,...e}):(0,n.As)({...l,...e})}},31008:e=>{e.exports={style:{fontFamily:"'JetBrains Mono', 'JetBrains Mono Fallback'",fontStyle:"normal"},className:"__className_6d24ac",variable:"__variable_6d24ac"}},36727:(e,t,r)=>{"use strict";r.r(t),r.d(t,{KeylessCookieSync:()=>a});var n=r(79748),s=r(7620),o=r(38036);function a(e){var t;let a=(null==(t=(0,n.useSelectedLayoutSegments)()[0])?void 0:t.startsWith("/_not-found"))||!1;return(0,s.useEffect)(()=>{o.I&&!a&&r.e(4929).then(r.bind(r,54929)).then(t=>t.syncKeylessConfigAction({...e,returnUrl:window.location.href}))},[a]),e.children}},37204:(e,t,r)=>{"use strict";r.r(t),r.d(t,{ClientClerkProvider:()=>O});var n=r(30524),s=r(20602);let o=new Set;var a=r(42925),i=r(79748),l=r(99321),c=r(7620);let u="u">typeof window?c.useLayoutEffect:c.useEffect,d=c.createContext(void 0);d.displayName="ClerkNextOptionsCtx";let p=()=>{let e=c.useContext(d);return null==e?void 0:e.value},f=e=>{let{children:t,options:r}=e;return c.createElement(d.Provider,{value:{value:r}},t)};var b=r(2609),m=r(10594),y=r.n(m);function v(e){let{publishableKey:t,clerkJSUrl:r,clerkJSVersion:s,clerkJSVariant:o,nonce:a}=p(),{domain:i,proxyUrl:l}=(0,n.ho)();if(!t)return null;let u={domain:i,proxyUrl:l,publishableKey:t,clerkJSUrl:r,clerkJSVersion:s,clerkJSVariant:o,nonce:a},d=(0,b.nO)(u),f="app"===e.router?"script":y();return c.createElement(f,{src:d,"data-clerk-js-script":!0,async:!0,defer:"pages"!==e.router&&void 0,crossOrigin:"anonymous",strategy:"pages"===e.router?"beforeInteractive":void 0,...(0,b.T5)(u)})}var _=r(38036),h=r(76975),g=r(67160),w=r(63680);let E=e=>{var t;return{...e,publishableKey:e.publishableKey||w.env.NEXT_PUBLIC_CLERK_PUBLISHABLE_KEY||"",clerkJSUrl:e.clerkJSUrl||w.env.NEXT_PUBLIC_CLERK_JS_URL,clerkJSVersion:e.clerkJSVersion||w.env.NEXT_PUBLIC_CLERK_JS_VERSION,proxyUrl:e.proxyUrl||w.env.NEXT_PUBLIC_CLERK_PROXY_URL||"",domain:e.domain||w.env.NEXT_PUBLIC_CLERK_DOMAIN||"",isSatellite:e.isSatellite||(0,h.zz)(w.env.NEXT_PUBLIC_CLERK_IS_SATELLITE),signInUrl:e.signInUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_IN_URL||"",signUpUrl:e.signUpUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_UP_URL||"",signInForceRedirectUrl:e.signInForceRedirectUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_IN_FORCE_REDIRECT_URL||"",signUpForceRedirectUrl:e.signUpForceRedirectUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_UP_FORCE_REDIRECT_URL||"",signInFallbackRedirectUrl:e.signInFallbackRedirectUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_IN_FALLBACK_REDIRECT_URL||"",signUpFallbackRedirectUrl:e.signUpFallbackRedirectUrl||w.env.NEXT_PUBLIC_CLERK_SIGN_UP_FALLBACK_REDIRECT_URL||"",afterSignInUrl:e.afterSignInUrl||w.env.NEXT_PUBLIC_CLERK_AFTER_SIGN_IN_URL||"",afterSignUpUrl:e.afterSignUpUrl||w.env.NEXT_PUBLIC_CLERK_AFTER_SIGN_UP_URL||"",newSubscriptionRedirectUrl:e.newSubscriptionRedirectUrl||w.env.NEXT_PUBLIC_CLERK_CHECKOUT_CONTINUE_URL||"",telemetry:null!=(t=e.telemetry)?t:{disabled:(0,h.zz)(w.env.NEXT_PUBLIC_CLERK_TELEMETRY_DISABLED),debug:(0,h.zz)(w.env.NEXT_PUBLIC_CLERK_TELEMETRY_DEBUG)},sdkMetadata:g.tm}};var x=r(3102),C=r(57042);let k=()=>{var e,t;let r=(0,n.ho)(),{pagesRouter:s}=(0,C.r)();return null==(t=r.telemetry)||t.record((0,x.YF)({router:s?"pages":"app",...(null==(e=null==globalThis?void 0:globalThis.next)?void 0:e.version)?{nextjsVersion:globalThis.next.version}:{}})),null};var L=r(43458),R=r(8599),T=r(90857);let j=e=>{var t;return null!=window.__clerk_internal_navigations||(window.__clerk_internal_navigations={}),null!=(t=window.__clerk_internal_navigations)[e]||(t[e]={}),window.__clerk_internal_navigations[e]},I=e=>{let{windowNav:t,routerNav:r,name:n}=e,s=(0,i.usePathname)(),[o,a]=(0,c.useTransition)();t&&(j(n).fun=(e,s)=>new Promise(o=>{var i,l;null!=(i=j(n)).promisesBuffer||(i.promisesBuffer=[]),null==(l=j(n).promisesBuffer)||l.push(o),a(()=>{var n,o,a;if((null==(n=null==s?void 0:s.__internal_metadata)?void 0:n.navigationType)==="internal")t((null!=(a=null==(o=window.next)?void 0:o.version)?a:"")<"14.1.0"?history.state:null,"",e);else r(e)})}));let l=()=>{var e;null==(e=j(n).promisesBuffer)||e.forEach(e=>e()),j(n).promisesBuffer=[]};return(0,c.useEffect)(()=>(l(),l),[]),(0,c.useEffect)(()=>{o||l()},[s,o]),(0,c.useCallback)((e,t)=>j(n).fun(e,t),[])},P=(0,a.default)(()=>r.e(4443).then(r.bind(r,34443)).then(e=>e.KeylessCreatorOrReader),{loadableGenerated:{webpack:()=>[34443]}}),S=e=>{let t,r;if(L.M0){var a,d;let e=`Clerk:
2
2
  Your current Next.js version (${l.version}) will be deprecated in the next major release of "@clerk/nextjs". Please upgrade to next@14.1.0 or later.`;(0,s.M)()?(a=e,o.has(a)||(o.add(a),console.warn(a))):(d=`
3
3
  \x1b[43m----------
4
4
  ${e}