@goldenlustre/agent-studio 1.0.3 → 1.0.5

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 (172) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/app-path-routes-manifest.json +10 -10
  3. package/.next/build-manifest.json +2 -2
  4. package/.next/prerender-manifest.json +3 -3
  5. package/.next/required-server-files.js +5 -5
  6. package/.next/required-server-files.json +5 -5
  7. package/.next/server/app/_global-error/page_client-reference-manifest.js +1 -1
  8. package/.next/server/app/_global-error.html +1 -1
  9. package/.next/server/app/_global-error.rsc +1 -1
  10. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/_global-error/__PAGE__.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  13. package/.next/server/app/_not-found/page.js +1 -1
  14. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  15. package/.next/server/app/_not-found.html +1 -1
  16. package/.next/server/app/_not-found.rsc +2 -2
  17. package/.next/server/app/_not-found.segments/_full.segment.rsc +2 -2
  18. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  19. package/.next/server/app/_not-found.segments/_tree.segment.rsc +1 -1
  20. package/.next/server/app/api/agent/[id]/bash-output/route.js +1 -1
  21. package/.next/server/app/api/agent/[id]/bash-output/route_client-reference-manifest.js +1 -1
  22. package/.next/server/app/api/agent/[id]/events/route.js +1 -1
  23. package/.next/server/app/api/agent/[id]/events/route_client-reference-manifest.js +1 -1
  24. package/.next/server/app/api/agent/[id]/lease/route.js +1 -1
  25. package/.next/server/app/api/agent/[id]/lease/route_client-reference-manifest.js +1 -1
  26. package/.next/server/app/api/agent/[id]/route.js +1 -1
  27. package/.next/server/app/api/agent/[id]/route_client-reference-manifest.js +1 -1
  28. package/.next/server/app/api/agent/new/route.js +1 -1
  29. package/.next/server/app/api/agent/new/route_client-reference-manifest.js +1 -1
  30. package/.next/server/app/api/agent/running/route.js +1 -1
  31. package/.next/server/app/api/agent/running/route_client-reference-manifest.js +1 -1
  32. package/.next/server/app/api/app-update/route.js +1 -1
  33. package/.next/server/app/api/app-update/route_client-reference-manifest.js +1 -1
  34. package/.next/server/app/api/auth/api-key/[provider]/route.js +1 -1
  35. package/.next/server/app/api/auth/api-key/[provider]/route_client-reference-manifest.js +1 -1
  36. package/.next/server/app/api/auth/login/[provider]/route.js +1 -1
  37. package/.next/server/app/api/auth/login/[provider]/route_client-reference-manifest.js +1 -1
  38. package/.next/server/app/api/auth/logout/[provider]/route.js +1 -1
  39. package/.next/server/app/api/auth/logout/[provider]/route_client-reference-manifest.js +1 -1
  40. package/.next/server/app/api/auth/providers/route.js +1 -1
  41. package/.next/server/app/api/auth/providers/route_client-reference-manifest.js +1 -1
  42. package/.next/server/app/api/cwd/browse/route.js +1 -1
  43. package/.next/server/app/api/cwd/browse/route_client-reference-manifest.js +1 -1
  44. package/.next/server/app/api/cwd/mkdir/route.js +1 -1
  45. package/.next/server/app/api/cwd/mkdir/route_client-reference-manifest.js +1 -1
  46. package/.next/server/app/api/cwd/validate/route.js +1 -1
  47. package/.next/server/app/api/cwd/validate/route_client-reference-manifest.js +1 -1
  48. package/.next/server/app/api/default-cwd/route.js +1 -1
  49. package/.next/server/app/api/default-cwd/route_client-reference-manifest.js +1 -1
  50. package/.next/server/app/api/file-index/route.js +1 -1
  51. package/.next/server/app/api/file-index/route_client-reference-manifest.js +1 -1
  52. package/.next/server/app/api/files/[...path]/route.js +1 -1
  53. package/.next/server/app/api/files/[...path]/route_client-reference-manifest.js +1 -1
  54. package/.next/server/app/api/git/diff/route.js +1 -1
  55. package/.next/server/app/api/git/diff/route_client-reference-manifest.js +1 -1
  56. package/.next/server/app/api/git/status/route.js +1 -1
  57. package/.next/server/app/api/git/status/route_client-reference-manifest.js +1 -1
  58. package/.next/server/app/api/home/route.js +1 -1
  59. package/.next/server/app/api/home/route_client-reference-manifest.js +1 -1
  60. package/.next/server/app/api/models/route.js +1 -1
  61. package/.next/server/app/api/models/route_client-reference-manifest.js +1 -1
  62. package/.next/server/app/api/models-config/catalog/route.js +1 -1
  63. package/.next/server/app/api/models-config/catalog/route_client-reference-manifest.js +1 -1
  64. package/.next/server/app/api/models-config/discover/route.js +1 -1
  65. package/.next/server/app/api/models-config/discover/route_client-reference-manifest.js +1 -1
  66. package/.next/server/app/api/models-config/route.js +1 -1
  67. package/.next/server/app/api/models-config/route_client-reference-manifest.js +1 -1
  68. package/.next/server/app/api/models-config/test/route.js +1 -1
  69. package/.next/server/app/api/models-config/test/route_client-reference-manifest.js +1 -1
  70. package/.next/server/app/api/plugins/check/route.js +1 -1
  71. package/.next/server/app/api/plugins/check/route_client-reference-manifest.js +1 -1
  72. package/.next/server/app/api/plugins/route.js +1 -1
  73. package/.next/server/app/api/plugins/route_client-reference-manifest.js +1 -1
  74. package/.next/server/app/api/project-trust/route.js +1 -1
  75. package/.next/server/app/api/project-trust/route_client-reference-manifest.js +1 -1
  76. package/.next/server/app/api/provider-usage/query/route.js +1 -1
  77. package/.next/server/app/api/provider-usage/query/route_client-reference-manifest.js +1 -1
  78. package/.next/server/app/api/push/config/route.js +1 -1
  79. package/.next/server/app/api/push/config/route_client-reference-manifest.js +1 -1
  80. package/.next/server/app/api/push/subscribe/route.js +1 -1
  81. package/.next/server/app/api/push/subscribe/route_client-reference-manifest.js +1 -1
  82. package/.next/server/app/api/sessions/[id]/auto-name/route.js +1 -1
  83. package/.next/server/app/api/sessions/[id]/auto-name/route_client-reference-manifest.js +1 -1
  84. package/.next/server/app/api/sessions/[id]/context/route.js +1 -1
  85. package/.next/server/app/api/sessions/[id]/context/route_client-reference-manifest.js +1 -1
  86. package/.next/server/app/api/sessions/[id]/entries/[entryId]/thinking/route.js +1 -1
  87. package/.next/server/app/api/sessions/[id]/entries/[entryId]/thinking/route_client-reference-manifest.js +1 -1
  88. package/.next/server/app/api/sessions/[id]/entries/[entryId]/tool-result-image/route.js +1 -1
  89. package/.next/server/app/api/sessions/[id]/entries/[entryId]/tool-result-image/route_client-reference-manifest.js +1 -1
  90. package/.next/server/app/api/sessions/[id]/export/route.js +1 -1
  91. package/.next/server/app/api/sessions/[id]/export/route_client-reference-manifest.js +1 -1
  92. package/.next/server/app/api/sessions/[id]/route.js +1 -1
  93. package/.next/server/app/api/sessions/[id]/route_client-reference-manifest.js +1 -1
  94. package/.next/server/app/api/sessions/[id]/state/route.js +1 -1
  95. package/.next/server/app/api/sessions/[id]/state/route_client-reference-manifest.js +1 -1
  96. package/.next/server/app/api/sessions/route.js +1 -1
  97. package/.next/server/app/api/sessions/route_client-reference-manifest.js +1 -1
  98. package/.next/server/app/api/sessions/search/route.js +1 -1
  99. package/.next/server/app/api/sessions/search/route_client-reference-manifest.js +1 -1
  100. package/.next/server/app/api/skills/check/route.js +1 -1
  101. package/.next/server/app/api/skills/check/route_client-reference-manifest.js +1 -1
  102. package/.next/server/app/api/skills/install/route.js +1 -1
  103. package/.next/server/app/api/skills/install/route_client-reference-manifest.js +1 -1
  104. package/.next/server/app/api/skills/route.js +1 -1
  105. package/.next/server/app/api/skills/route_client-reference-manifest.js +1 -1
  106. package/.next/server/app/api/skills/search/route.js +1 -1
  107. package/.next/server/app/api/skills/search/route_client-reference-manifest.js +1 -1
  108. package/.next/server/app/api/skills/update/route.js +1 -1
  109. package/.next/server/app/api/skills/update/route_client-reference-manifest.js +1 -1
  110. package/.next/server/app/api/subagents/[id]/route.js +1 -1
  111. package/.next/server/app/api/subagents/[id]/route_client-reference-manifest.js +1 -1
  112. package/.next/server/app/api/subagents/profiles/route.js +1 -1
  113. package/.next/server/app/api/subagents/profiles/route_client-reference-manifest.js +1 -1
  114. package/.next/server/app/api/subagents/settings/route.js +1 -1
  115. package/.next/server/app/api/subagents/settings/route_client-reference-manifest.js +1 -1
  116. package/.next/server/app/api/terminal/[id]/events/route.js +1 -1
  117. package/.next/server/app/api/terminal/[id]/events/route_client-reference-manifest.js +1 -1
  118. package/.next/server/app/api/terminal/[id]/route.js +1 -1
  119. package/.next/server/app/api/terminal/[id]/route_client-reference-manifest.js +1 -1
  120. package/.next/server/app/api/terminal/route.js +1 -1
  121. package/.next/server/app/api/terminal/route_client-reference-manifest.js +1 -1
  122. package/.next/server/app/api/tools/settings/route.js +1 -1
  123. package/.next/server/app/api/tools/settings/route_client-reference-manifest.js +1 -1
  124. package/.next/server/app/api/web-auth/route.js +1 -1
  125. package/.next/server/app/api/web-auth/route_client-reference-manifest.js +1 -1
  126. package/.next/server/app/api/worktrees/route.js +1 -1
  127. package/.next/server/app/api/worktrees/route_client-reference-manifest.js +1 -1
  128. package/.next/server/app/dashboard/page.js +1 -1
  129. package/.next/server/app/dashboard/page_client-reference-manifest.js +1 -1
  130. package/.next/server/app/dashboard.html +1 -1
  131. package/.next/server/app/dashboard.rsc +3 -3
  132. package/.next/server/app/dashboard.segments/_full.segment.rsc +3 -3
  133. package/.next/server/app/dashboard.segments/_tree.segment.rsc +1 -1
  134. package/.next/server/app/dashboard.segments/dashboard/__PAGE__.segment.rsc +3 -3
  135. package/.next/server/app/index.html +1 -1
  136. package/.next/server/app/index.rsc +4 -4
  137. package/.next/server/app/index.segments/__PAGE__.segment.rsc +4 -4
  138. package/.next/server/app/index.segments/_full.segment.rsc +4 -4
  139. package/.next/server/app/index.segments/_tree.segment.rsc +1 -1
  140. package/.next/server/app/login/page.js +1 -1
  141. package/.next/server/app/login/page_client-reference-manifest.js +1 -1
  142. package/.next/server/app/login.html +1 -1
  143. package/.next/server/app/login.rsc +2 -2
  144. package/.next/server/app/login.segments/_full.segment.rsc +2 -2
  145. package/.next/server/app/login.segments/_tree.segment.rsc +1 -1
  146. package/.next/server/app/login.segments/login/__PAGE__.segment.rsc +2 -2
  147. package/.next/server/app/manifest.webmanifest/route_client-reference-manifest.js +1 -1
  148. package/.next/server/app/page.js +3 -3
  149. package/.next/server/app/page_client-reference-manifest.js +1 -1
  150. package/.next/server/app-paths-manifest.json +10 -10
  151. package/.next/server/chunks/2430.js +4 -4
  152. package/.next/server/chunks/3157.js +1 -1
  153. package/.next/server/chunks/6763.js +1 -1
  154. package/.next/server/middleware-build-manifest.js +1 -1
  155. package/.next/server/next-font-manifest.js +1 -1
  156. package/.next/server/next-font-manifest.json +1 -1
  157. package/.next/server/pages/404.html +1 -1
  158. package/.next/server/pages/500.html +1 -1
  159. package/.next/server/server-reference-manifest.json +1 -1
  160. package/.next/static/chunks/6210-4d494d62310603d6.js +1 -0
  161. package/.next/static/chunks/{5957-b660df0f813517f8.js → 9445-fde6feabcb39142c.js} +2 -2
  162. package/.next/static/chunks/9756-2c5a24f4eb035213.js +1 -0
  163. package/.next/static/chunks/app/dashboard/{page-3fe3dc57705a63ce.js → page-85f8e08332a1f141.js} +1 -1
  164. package/.next/static/chunks/app/{layout-5faf0c882dfcc520.js → layout-f49cc2ba36663b02.js} +1 -1
  165. package/.next/static/chunks/app/{page-4b63784cf5fe163a.js → page-969593a89c9ee01f.js} +5 -5
  166. package/.next/trace +39 -41
  167. package/.next/trace-build +1 -1
  168. package/package.json +3 -2
  169. package/.next/static/chunks/3220-18bc83f919a12624.js +0 -1
  170. package/.next/static/chunks/6210-3e8922fee87bfe1f.js +0 -1
  171. /package/.next/static/{EmuU1f7la3J3ZtEmFSuCi → KSO1GhDgU3GuF7sgfz1tN}/_buildManifest.js +0 -0
  172. /package/.next/static/{EmuU1f7la3J3ZtEmFSuCi → KSO1GhDgU3GuF7sgfz1tN}/_ssgManifest.js +0 -0
package/.next/trace-build CHANGED
@@ -1 +1 @@
1
- [{"name":"run-webpack","duration":65016209,"timestamp":182105331054,"id":14,"parentId":1,"tags":{},"startTime":1789539584180,"traceId":"3661bcd01aa46390"},{"name":"run-typescript","duration":30633648,"timestamp":182170355789,"id":8511,"parentId":1,"tags":{},"startTime":1789539649205,"traceId":"3661bcd01aa46390"},{"name":"static-check","duration":4942791,"timestamp":182201012246,"id":8514,"parentId":1,"tags":{},"startTime":1789539679861,"traceId":"3661bcd01aa46390"},{"name":"static-generation","duration":11458955,"timestamp":182206518699,"id":8642,"parentId":1,"tags":{},"startTime":1789539685368,"traceId":"3661bcd01aa46390"},{"name":"collect-build-traces","duration":119405580,"timestamp":182205960739,"id":8639,"parentId":1,"tags":{},"startTime":1789539684810,"traceId":"3661bcd01aa46390"},{"name":"telemetry-flush","duration":95,"timestamp":182325374494,"id":8651,"parentId":1,"tags":{},"startTime":1789539804223,"traceId":"3661bcd01aa46390"},{"name":"next-build","duration":220235666,"timestamp":182105138936,"id":1,"tags":{"buildMode":"default","version":"16.3.1","bundler":"webpack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1789539583988,"traceId":"3661bcd01aa46390"}]
1
+ [{"name":"run-webpack","duration":65089888,"timestamp":190223941897,"id":14,"parentId":1,"tags":{},"startTime":1789547702791,"traceId":"32dfe4e4005e962a"},{"name":"run-typescript","duration":30360690,"timestamp":190289039773,"id":8510,"parentId":1,"tags":{},"startTime":1789547767889,"traceId":"32dfe4e4005e962a"},{"name":"static-check","duration":4866452,"timestamp":190319422034,"id":8513,"parentId":1,"tags":{},"startTime":1789547798271,"traceId":"32dfe4e4005e962a"},{"name":"static-generation","duration":11859811,"timestamp":190324850162,"id":8641,"parentId":1,"tags":{},"startTime":1789547803699,"traceId":"32dfe4e4005e962a"},{"name":"collect-build-traces","duration":120922537,"timestamp":190324294134,"id":8638,"parentId":1,"tags":{},"startTime":1789547803143,"traceId":"32dfe4e4005e962a"},{"name":"telemetry-flush","duration":86,"timestamp":190445225395,"id":8650,"parentId":1,"tags":{},"startTime":1789547924074,"traceId":"32dfe4e4005e962a"},{"name":"next-build","duration":221474982,"timestamp":190223750518,"id":1,"tags":{"buildMode":"default","version":"16.3.1","bundler":"webpack","has-custom-webpack-config":"false","use-build-worker":"true"},"startTime":1789547702599,"traceId":"32dfe4e4005e962a"}]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@goldenlustre/agent-studio",
3
- "version": "1.0.3",
3
+ "version": "1.0.5",
4
4
  "description": "AgentStudio - AI Agent Development Environment",
5
5
  "homepage": "https://github.com/agegr/agent-studio#readme",
6
6
  "repository": {
@@ -39,7 +39,8 @@
39
39
  "test:terminal": "node e2e/terminal.mjs",
40
40
  "test:e2e": "node e2e/run.mjs",
41
41
  "test": "node --experimental-strip-types --test \"app/**/*.test.mjs\" \"components/**/*.test.mjs\" \"hooks/**/*.test.mjs\" \"lib/**/*.test.mjs\" \"public/**/*.test.mjs\"",
42
- "release": "npm version patch --no-git-tag-version && npm run build && npm publish --access public"
42
+ "release": "npm version patch --no-git-tag-version && npm run build && npm publish --access public",
43
+ "postbuild": "node scripts/postbuild-fix-paths.js"
43
44
  },
44
45
  "dependencies": {
45
46
  "@earendil-works/pi-agent-core": "0.85.1",
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[3220],{10857:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={DecodeError:function(){return y},MiddlewareNotFoundError:function(){return C},MissingStaticPage:function(){return b},NormalizeError:function(){return v},PageNotFoundError:function(){return m},SP:function(){return p},ST:function(){return g},WEB_VITALS:function(){return o},execOnce:function(){return u},getDisplayName:function(){return s},getLocationOrigin:function(){return l},getURL:function(){return c},isAbsoluteUrl:function(){return a},isResSent:function(){return f},loadGetInitialProps:function(){return d},normalizeRepeatedSlashes:function(){return h},stringifyError:function(){return P}};for(var n in r)Object.defineProperty(t,n,{enumerable:!0,get:r[n]});let o=["CLS","FCP","FID","INP","LCP","TTFB"];function u(e){let t,r=!1;return(...n)=>(r||(r=!0,t=e(...n)),t)}let i=/^[a-zA-Z][a-zA-Z\d+\-.]*?:/,a=e=>{let t=e.charCodeAt(0);return!!(t>=65&&t<=90||t>=97&&t<=122)&&i.test(e)};function l(){let{protocol:e,hostname:t,port:r}=window.location;return`${e}//${t}${r?":"+r:""}`}function c(){let{href:e}=window.location,t=l();return e.substring(t.length)}function s(e){return"string"==typeof e?e:e.displayName||e.name||"Unknown"}function f(e){return e.finished||e.headersSent}function h(e){let t=e.split("?");return t[0].replace(/\\/g,"/").replace(/\/\/+/g,"/")+(t[1]?`?${t.slice(1).join("?")}`:"")}async function d(e,t){let r=t.res||t.ctx&&t.ctx.res;if(!e.getInitialProps)return t.ctx&&t.Component?{pageProps:await d(t.Component,t.ctx)}:{};let n=await e.getInitialProps(t);if(r&&f(r))return n;if(!n)throw Object.defineProperty(Error(`"${s(e)}.getInitialProps()" should resolve to an object. But found "${n}" instead.`),"__NEXT_ERROR_CODE",{value:"E1025",enumerable:!1,configurable:!0});return n}let p="u">typeof performance,g=p&&["mark","measure","getEntriesByName"].every(e=>"function"==typeof performance[e]);class y extends Error{}class v extends Error{}class m extends Error{constructor(e){super(),this.code="ENOENT",this.name="PageNotFoundError",this.message=`Cannot find module for page: ${e}`}}class b extends Error{constructor(e,t){super(),this.message=`Failed to load static file for page: ${e} ${t}`}}class C extends Error{constructor(){super(),this.code="ENOENT",this.message="Cannot find the middleware module"}}function P(e){return JSON.stringify({message:e.message,stack:e.stack})}},20091:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={formatUrl:function(){return a},formatWithValidation:function(){return c},urlObjectKeys:function(){return l}};for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:n[o]});let u=r(66388)._(r(31393)),i=/https?|ftp|gopher|file/;function a(e){let{auth:t,hostname:r}=e,n=e.protocol||"",o=e.pathname||"",a=e.hash||"",l=e.query||"",c=!1;t=t?encodeURIComponent(t).replace(/%3A/i,":")+"@":"",e.host?c=t+e.host:r&&(c=t+(~r.indexOf(":")?`[${r}]`:r),e.port&&(c+=":"+e.port)),l&&"object"==typeof l&&(l=String(u.urlQueryToSearchParams(l)));let s=e.search||l&&`?${l}`||"";return n&&!n.endsWith(":")&&(n+=":"),e.slashes||(!n||i.test(n))&&!1!==c?(c="//"+(c||""),o&&"/"!==o[0]&&(o="/"+o)):c||(c=""),a&&"#"!==a[0]&&(a="#"+a),s&&"?"!==s[0]&&(s="?"+s),o=o.replace(/[?#]/g,encodeURIComponent),s=s.replace("#","%23"),`${n}${c}${o}${s}${a}`}let l=["auth","hash","host","hostname","href","path","pathname","port","protocol","query","search","slashes"];function c(e){return a(e)}},21172:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"useMergedRef",{enumerable:!0,get:function(){return o}});let n=r(12115);function o(e,t){let r=(0,n.useRef)(null),o=(0,n.useRef)(null);return(0,n.useCallback)(n=>{if(null===n){let e=r.current;e&&(r.current=null,e());let t=o.current;t&&(o.current=null,t())}else e&&(r.current=u(e,n)),t&&(o.current=u(t,n))},[e,t])}function u(e,t){if("function"!=typeof e)return e.current=t,()=>{e.current=null};{let r=e(t);return"function"==typeof r?r:()=>e(null)}}("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)},31393:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var r={assign:function(){return a},searchParamsToUrlQuery:function(){return o},urlQueryToSearchParams:function(){return i}};for(var n in r)Object.defineProperty(t,n,{enumerable:!0,get:r[n]});function o(e){let t={};for(let[r,n]of e.entries()){let e=t[r];void 0===e?t[r]=n:Array.isArray(e)?e.push(n):t[r]=[e,n]}return t}function u(e){return"string"==typeof e?e:("number"!=typeof e||isNaN(e))&&"boolean"!=typeof e?"":String(e)}function i(e){let t=new URLSearchParams;for(let[r,n]of Object.entries(e))if(Array.isArray(n))for(let e of n)t.append(r,u(e));else t.set(r,u(n));return t}function a(e,...t){for(let r of t){for(let t of r.keys())e.delete(t);for(let[t,n]of r.entries())e.append(t,n)}return e}},69470:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"isLocalURL",{enumerable:!0,get:function(){return u}});let n=r(10857),o=r(48512);function u(e){if(!(0,n.isAbsoluteUrl)(e))return!0;try{let t=(0,n.getLocationOrigin)(),r=new URL(e,t);return r.origin===t&&(0,o.hasBasePath)(r.pathname)}catch(e){return!1}}},73321:(e,t,r)=>{"use strict";var n=r(74645);r.o(n,"useRouter")&&r.d(t,{useRouter:function(){return n.useRouter}}),r.o(n,"useSearchParams")&&r.d(t,{useSearchParams:function(){return n.useSearchParams}})},79617:e=>{!function(){"use strict";var t={431:function(e){function t(e){if("string"!=typeof e)throw TypeError("Path must be a string. Received "+JSON.stringify(e))}function r(e,t){for(var r,n="",o=0,u=-1,i=0,a=0;a<=e.length;++a){if(a<e.length)r=e.charCodeAt(a);else if(47===r)break;else r=47;if(47===r){if(u===a-1||1===i);else if(u!==a-1&&2===i){if(n.length<2||2!==o||46!==n.charCodeAt(n.length-1)||46!==n.charCodeAt(n.length-2)){if(n.length>2){var l=n.lastIndexOf("/");if(l!==n.length-1){-1===l?(n="",o=0):o=(n=n.slice(0,l)).length-1-n.lastIndexOf("/"),u=a,i=0;continue}}else if(2===n.length||1===n.length){n="",o=0,u=a,i=0;continue}}t&&(n.length>0?n+="/..":n="..",o=2)}else n.length>0?n+="/"+e.slice(u+1,a):n=e.slice(u+1,a),o=a-u-1;u=a,i=0}else 46===r&&-1!==i?++i:i=-1}return n}var n={resolve:function(){for(var e,n,o="",u=!1,i=arguments.length-1;i>=-1&&!u;i--)i>=0?n=arguments[i]:(void 0===e&&(e=""),n=e),t(n),0!==n.length&&(o=n+"/"+o,u=47===n.charCodeAt(0));if(o=r(o,!u),u)if(o.length>0)return"/"+o;else return"/";return o.length>0?o:"."},normalize:function(e){if(t(e),0===e.length)return".";var n=47===e.charCodeAt(0),o=47===e.charCodeAt(e.length-1);return(0!==(e=r(e,!n)).length||n||(e="."),e.length>0&&o&&(e+="/"),n)?"/"+e:e},isAbsolute:function(e){return t(e),e.length>0&&47===e.charCodeAt(0)},join:function(){if(0==arguments.length)return".";for(var e,r=0;r<arguments.length;++r){var o=arguments[r];t(o),o.length>0&&(void 0===e?e=o:e+="/"+o)}return void 0===e?".":n.normalize(e)},relative:function(e,r){if(t(e),t(r),e===r||(e=n.resolve(e))===(r=n.resolve(r)))return"";for(var o=1;o<e.length&&47===e.charCodeAt(o);++o);for(var u=e.length,i=u-o,a=1;a<r.length&&47===r.charCodeAt(a);++a);for(var l=r.length-a,c=i<l?i:l,s=-1,f=0;f<=c;++f){if(f===c){if(l>c){if(47===r.charCodeAt(a+f))return r.slice(a+f+1);else if(0===f)return r.slice(a+f)}else i>c&&(47===e.charCodeAt(o+f)?s=f:0===f&&(s=0));break}var h=e.charCodeAt(o+f);if(h!==r.charCodeAt(a+f))break;47===h&&(s=f)}var d="";for(f=o+s+1;f<=u;++f)(f===u||47===e.charCodeAt(f))&&(0===d.length?d+="..":d+="/..");return d.length>0?d+r.slice(a+s):(a+=s,47===r.charCodeAt(a)&&++a,r.slice(a))},_makeLong:function(e){return e},dirname:function(e){if(t(e),0===e.length)return".";for(var r=e.charCodeAt(0),n=47===r,o=-1,u=!0,i=e.length-1;i>=1;--i)if(47===(r=e.charCodeAt(i))){if(!u){o=i;break}}else u=!1;return -1===o?n?"/":".":n&&1===o?"//":e.slice(0,o)},basename:function(e,r){if(void 0!==r&&"string"!=typeof r)throw TypeError('"ext" argument must be a string');t(e);var n,o=0,u=-1,i=!0;if(void 0!==r&&r.length>0&&r.length<=e.length){if(r.length===e.length&&r===e)return"";var a=r.length-1,l=-1;for(n=e.length-1;n>=0;--n){var c=e.charCodeAt(n);if(47===c){if(!i){o=n+1;break}}else -1===l&&(i=!1,l=n+1),a>=0&&(c===r.charCodeAt(a)?-1==--a&&(u=n):(a=-1,u=l))}return o===u?u=l:-1===u&&(u=e.length),e.slice(o,u)}for(n=e.length-1;n>=0;--n)if(47===e.charCodeAt(n)){if(!i){o=n+1;break}}else -1===u&&(i=!1,u=n+1);return -1===u?"":e.slice(o,u)},extname:function(e){t(e);for(var r=-1,n=0,o=-1,u=!0,i=0,a=e.length-1;a>=0;--a){var l=e.charCodeAt(a);if(47===l){if(!u){n=a+1;break}continue}-1===o&&(u=!1,o=a+1),46===l?-1===r?r=a:1!==i&&(i=1):-1!==r&&(i=-1)}return -1===r||-1===o||0===i||1===i&&r===o-1&&r===n+1?"":e.slice(r,o)},format:function(e){var t,r;if(null===e||"object"!=typeof e)throw TypeError('The "pathObject" argument must be of type Object. Received type '+typeof e);return t=e.dir||e.root,r=e.base||(e.name||"")+(e.ext||""),t?t===e.root?t+r:t+"/"+r:r},parse:function(e){t(e);var r,n={root:"",dir:"",base:"",ext:"",name:""};if(0===e.length)return n;var o=e.charCodeAt(0),u=47===o;u?(n.root="/",r=1):r=0;for(var i=-1,a=0,l=-1,c=!0,s=e.length-1,f=0;s>=r;--s){if(47===(o=e.charCodeAt(s))){if(!c){a=s+1;break}continue}-1===l&&(c=!1,l=s+1),46===o?-1===i?i=s:1!==f&&(f=1):-1!==i&&(f=-1)}return -1===i||-1===l||0===f||1===f&&i===l-1&&i===a+1?-1!==l&&(0===a&&u?n.base=n.name=e.slice(1,l):n.base=n.name=e.slice(a,l)):(0===a&&u?(n.name=e.slice(1,i),n.base=e.slice(1,l)):(n.name=e.slice(a,i),n.base=e.slice(a,l)),n.ext=e.slice(i,l)),a>0?n.dir=e.slice(0,a-1):u&&(n.dir="/"),n},sep:"/",delimiter:":",win32:null,posix:null};n.posix=n,e.exports=n}},r={};function n(e){var o=r[e];if(void 0!==o)return o.exports;var u=r[e]={exports:{}},i=!0;try{t[e](u,u.exports,n),i=!1}finally{i&&delete r[e]}return u.exports}n.ab="//",e.exports=n(431)}()},98500:(e,t,r)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0});var n={default:function(){return v},useLinkStatus:function(){return b}};for(var o in n)Object.defineProperty(t,o,{enumerable:!0,get:n[o]});let u=r(66388),i=r(95155),a=u._(r(12115)),l=r(20091),c=r(22909),s=r(21172),f=r(10857),h=r(70127),d=r(74616),p=r(24972),g=r(69470),y=r(77565);function v(e){var t;let n,o,u,[v,b]=(0,a.useOptimistic)(p.IDLE_LINK_STATUS),C=(0,a.useRef)(null),{href:P,as:A,children:E,prefetch:_=null,passHref:O,replace:S,shallow:x,scroll:j,onClick:T,onMouseEnter:k,onTouchStart:R,legacyBehavior:N=!1,onNavigate:w,transitionTypes:L,ref:I,unstable_dynamicOnHover:M,...$}=e;n=E,N&&("string"==typeof n||"number"==typeof n)&&(n=(0,i.jsx)("a",{children:n}));let U=a.default.useContext(c.AppRouterContext),F=!1!==_,D=!1===_?"none":!0===_?"full":"auto",B="none"!==D?"auto"===D?y.FetchStrategy.PPR:y.FetchStrategy.Full:y.FetchStrategy.PPR,z="string"==typeof(t=A||P)?t:(0,l.formatUrl)(t);if(N){if(n?.$$typeof===Symbol.for("react.lazy"))throw Object.defineProperty(Error("`<Link legacyBehavior>` received a direct child that is either a Server Component, or JSX that was loaded with React.lazy(). This is not supported. Either remove legacyBehavior, or make the direct child a Client Component that renders the Link's `<a>` tag."),"__NEXT_ERROR_CODE",{value:"E863",enumerable:!1,configurable:!0});o=a.default.Children.only(n)}let K=N?o&&"object"==typeof o&&o.ref:I,J,Q=a.default.useCallback(e=>(null!==U&&(C.current=(0,p.mountLinkInstance)(e,z,U,B,F,b,J)),()=>{C.current&&((0,p.unmountLinkForCurrentNavigation)(C.current),C.current=null),(0,p.unmountPrefetchableInstance)(e)}),[F,z,U,B,b,J]),W={ref:(0,s.useMergedRef)(Q,K),onClick(e){N||"function"!=typeof T||T(e),N&&o.props&&"function"==typeof o.props.onClick&&o.props.onClick(e),!U||e.defaultPrevented||function(e,t,n,o,u,i,l,c="none"){{let s,{nodeName:f}=e.currentTarget;if("A"===f.toUpperCase()&&((s=e.currentTarget.getAttribute("target"))&&"_self"!==s||e.metaKey||e.ctrlKey||e.shiftKey||e.altKey||e.nativeEvent&&2===e.nativeEvent.which)||e.currentTarget.hasAttribute("download"))return;if(!(0,g.isLocalURL)(t)){o&&(e.preventDefault(),location.replace(t));return}if(e.preventDefault(),i){let e=!1;if(i({preventDefault:()=>{e=!0}}),e)return}let{dispatchNavigateAction:h}=r(70156);a.default.startTransition(()=>{h(t,o?"replace":"push",!1===u?d.ScrollBehavior.NoScroll:d.ScrollBehavior.Default,n.current,l,c)})}}(e,z,C,S,j,w,L,D)},onMouseEnter(e){N||"function"!=typeof k||k(e),N&&o.props&&"function"==typeof o.props.onMouseEnter&&o.props.onMouseEnter(e),U&&F&&(0,p.onNavigationIntent)(e.currentTarget,!0===M)},onTouchStart:function(e){N||"function"!=typeof R||R(e),N&&o.props&&"function"==typeof o.props.onTouchStart&&o.props.onTouchStart(e),U&&F&&(0,p.onNavigationIntent)(e.currentTarget,!0===M)}};return(0,f.isAbsoluteUrl)(z)?W.href=z:N&&!O&&("a"!==o.type||"href"in o.props)||(W.href=(0,h.addBasePath)(z)),u=N?a.default.cloneElement(o,W):(0,i.jsx)("a",{...$,...W,children:n}),(0,i.jsx)(m.Provider,{value:v,children:u})}let m=(0,a.createContext)(p.IDLE_LINK_STATUS),b=()=>(0,a.useContext)(m);("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)}}]);
@@ -1 +0,0 @@
1
- "use strict";(self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[6210],{17709:(e,t,r)=>{r.d(t,{OW:()=>i,QZ:()=>a,TU:()=>s,wy:()=>n});var o=r(65215);function n(e,t=new Set,r=new Set){let i=new Map;for(let n of e){let e=(0,o._A)(n);if(!e)continue;let a=n.projectRoot??n.cwd;if(!a)continue;let s=i.get(e);s||(s={id:e,name:function(e){let t=e.replace(/[\\/]+$/,""),r=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return(r>=0?t.slice(r+1):t)||t||e}(a),path:a,createdAt:n.created,lastAccessed:n.modified,sessionCount:0,runningCount:0,unreadCount:0,status:"idle",gitBranch:n.branch,isFavorite:!1,messageTotal:0,worktreeCount:0,worktrees:[],subagentCount:0,earliestCreated:n.created,lastTitleAt:"",lastTitleIsSubagent:!1},i.set(e,s));let l=n.relation?.kind==="subagent";s.sessionCount+=1,s.messageTotal+=Number.isFinite(n.messageCount)?n.messageCount:0,n.modified>s.lastAccessed&&(s.lastAccessed=n.modified),n.created<s.earliestCreated&&(s.earliestCreated=n.created),l&&(s.subagentCount+=1),t.has(n.id)&&(s.runningCount+=1),r.has(n.id)&&(s.unreadCount+=1),!s.gitBranch&&n.branch&&(s.gitBranch=n.branch),n.cwd&&!s.worktrees.includes(n.cwd)&&s.worktrees.push(n.cwd);let d=function(e){let t=e.name?.trim();if(t)return t;let r=e.firstMessage?.trim().replace(/\s+/g," ");if(r)return r.length>80?`${r.slice(0,80)}…`:r}(n);d&&(!s.lastSessionTitle||s.lastTitleIsSubagent&&!l||s.lastTitleIsSubagent===l&&n.modified>s.lastTitleAt)&&(s.lastSessionTitle=d,s.lastTitleAt=n.modified,s.lastTitleIsSubagent=l)}return[...i.values()].map(e=>{let t=e.worktrees.filter(t=>t!==e.path).sort(),r={id:e.id,name:e.name,path:e.path,createdAt:e.earliestCreated,lastAccessed:e.lastAccessed,sessionCount:e.sessionCount,runningCount:e.runningCount,unreadCount:e.unreadCount,status:e.runningCount>0?"active":"idle",isFavorite:e.isFavorite,messageTotal:e.messageTotal,worktreeCount:t.length+1,worktrees:t,subagentCount:e.subagentCount};return e.gitBranch&&(r.gitBranch=e.gitBranch),e.lastSessionTitle&&(r.lastSessionTitle=e.lastSessionTitle),r}).sort((e,t)=>t.lastAccessed.localeCompare(e.lastAccessed))}function i(e,t){switch(t){case"active":return e.filter(e=>e.runningCount>0);case"unread":return e.filter(e=>e.unreadCount>0);default:return[...e]}}function a(e,t){let r=t.trim().toLowerCase();return r?e.filter(e=>e.name.toLowerCase().includes(r)||(e.alias?.toLowerCase().includes(r)??!1)||(e.note?.toLowerCase().includes(r)??!1)||e.path.toLowerCase().includes(r)||(e.lastSessionTitle?.toLowerCase().includes(r)??!1)):[...e]}function s(e,t,r){let o=[...e];return o.sort((e,o)=>{let n;switch(t){case"name":n=l(e).localeCompare(l(o));break;case"sessionCount":n=e.sessionCount-o.sessionCount;break;case"runningCount":n=e.runningCount-o.runningCount;break;case"messageTotal":n=e.messageTotal-o.messageTotal;break;default:n=e.lastAccessed.localeCompare(o.lastAccessed)}return"desc"===r?-n:n}),o}function l(e){return(e.alias?.trim()||e.name).toLowerCase()}},19190:(e,t,r)=>{r.d(t,{HL:()=>g,Jn:()=>d,QJ:()=>v,as:()=>p,b2:()=>b,eG:()=>h,m5:()=>c,qs:()=>f,wx:()=>x});var o=r(79617),n=r.n(o),i=r(41463);let a=/^(con|prn|aux|nul|com[1-9]|lpt[1-9])(\..*)?$/i,s=/[<>:"|?*]/,l=/[\u0000-\u001f\u007f]/;function d(e){let t=e.trim();return!!t&&(t.startsWith("/")||t.startsWith("~")||t.startsWith("./")||t.startsWith("../")||t.includes("/")||t.includes("\\")||/^[a-zA-Z]:/.test(t))}function c(e){let t=e.replace(/[\\/]+$/,""),r=Math.max(t.lastIndexOf("/"),t.lastIndexOf("\\"));return(r>=0?t.slice(r+1):t)||e}function u(e){return/^[a-zA-Z]:[\\/]/.test(e)||e.startsWith("\\\\")}function p(e,t){return(u(e)?n().win32:n().posix).join(e,t)}function h(e,t=i.platform){let r=e.trim();if(!r)return{ok:!1,error:"empty"};if(r.includes("/")||r.includes("\\"))return{ok:!1,error:"separator"};if("."===r||".."===r)return{ok:!1,error:"relative"};if(l.test(r))return{ok:!1,error:"control"};if(r.length>255)return{ok:!1,error:"tooLong"};if("win32"===t){if(s.test(r))return{ok:!1,error:"windowsChars"};if(a.test(r))return{ok:!1,error:"windowsReserved"};if(/[. ]$/.test(r))return{ok:!1,error:"windowsChars"}}return{ok:!0,name:r}}function x(e,t,r=8){let o=new Set(t),n=new Map;for(let t of e){let e=t.modified??"";for(let r of[t.projectRoot??void 0,t.cwd]){if(!r||o.has(r))continue;let t=n.get(r);t?(t.count+=1,e>t.modified&&(t.modified=e)):n.set(r,{modified:e,count:1})}}return[...n.entries()].sort((e,t)=>t[1].modified.localeCompare(e[1].modified)).slice(0,r).map(([e,t])=>({path:e,label:c(e),hint:String(t.count),kind:"recent"}))}function g(e,t=3){let r=new Set,o=[];for(let i of e){if(!i)continue;let e=u(i)?n().win32.dirname(i):n().posix.dirname(i);if(e&&e!==i&&"."!==e&&"/"!==e&&!r.has(e)&&(r.add(e),o.push(e),o.length>=t))break}return o}function b(e){return!!(!e||e.startsWith("."))||"node_modules"===e||"__pycache__"===e||"dist"===e||"build"===e}function f(e,t){let r=t.trim().toLowerCase();return r?e.filter(e=>e.label.toLowerCase().includes(r)||e.path.toLowerCase().includes(r)):[...e]}function v(e,t=[]){let r=new Set(t),o=new Set,n=[];for(let t of e)!t.path||r.has(t.path)||o.has(t.path)||(o.add(t.path),n.push(t));return n}},65215:(e,t,r)=>{r.d(t,{O$:()=>l,Vi:()=>a,_A:()=>d,tu:()=>s});let o="pi-web:last-open-by-workspace";function n(){try{return window.localStorage}catch{return null}}function i(e){let t=e.getItem(o);if(!t)return{};try{let e=JSON.parse(t);return null===e||"object"!=typeof e||Array.isArray(e)?{}:e}catch{return{}}}function a(e,t=n()){if(!t)return null;try{let r=i(t)[e];return"string"==typeof r&&r.length>0?r:null}catch{return null}}function s(e,t,r=n()){if(r)try{let n=i(r);n[e]=t,r.setItem(o,JSON.stringify(n))}catch{}}function l(e,t=n()){if(t)try{let r=i(t);if(!(e in r))return;delete r[e],0===Object.keys(r).length?t.removeItem(o):t.setItem(o,JSON.stringify(r))}catch{}}function d(e){return e.projectKey??e.projectRoot??e.cwd}},96210:(e,t,r)=>{r.d(t,{wo:()=>R,JE:()=>O,wy:()=>T.wy});var o=r(95155),n=r(12115);let i="agent-studio:project-meta",a="agent-studio:project-favorites";function s(e){return"object"==typeof e&&null!==e&&!Array.isArray(e)}function l(e){return"string"==typeof e&&e.trim().length>0?e:void 0}function d(e,t,r){let o={...e},n={...o[t]};for(let e of["alias","note","color"]){if(!(e in r))continue;let t=l(r[e]);void 0===t?delete n[e]:n[e]=t}return"favorite"in r&&(r.favorite?n.favorite=!0:delete n.favorite),0===Object.keys(n).length?delete o[t]:o[t]=n,o}function c(e){return e.alias?.trim()||e.name}function u(){try{return window.localStorage}catch{return null}}function p(e){let t=u();if(t)try{t.setItem(i,JSON.stringify(e)),t.removeItem(a)}catch{}}var h=r(21278),x=r(2730);let g={display:"flex",alignItems:"center",justifyContent:"center",width:22,height:22,padding:0,background:"none",border:"none",borderRadius:5,cursor:"pointer"};function b({label:e,value:t}){return(0,o.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:3,whiteSpace:"nowrap"},children:[(0,o.jsx)("span",{style:{color:"var(--text-dim)"},children:e}),(0,o.jsx)("span",{style:{color:"var(--text-muted)",fontVariantNumeric:"tabular-nums"},children:t})]})}function f({projects:e,selectedProjects:t,onSelectProject:r,onToggleFavorite:i,onSelectionChange:a,onEditProject:s,onContextMenu:l}){let{locale:d,t:u}=(0,h.s)(),[p,v]=(0,n.useState)(null),[j,m]=(0,n.useState)(null);return(0,o.jsx)("div",{"data-testid":"project-grid",style:{display:"grid",gridTemplateColumns:"repeat(auto-fill, minmax(230px, 1fr))",gap:10},children:e.map(e=>{let n=t.includes(e.id),h=p===e.id,f=c(e),y=e.note||e.lastSessionTitle;return(0,o.jsxs)("div",{"data-testid":"project-card","data-project-id":e.id,role:"button",tabIndex:0,"aria-label":u("projectDashboard.ctxOpen")+": "+f,onMouseEnter:()=>v(e.id),onMouseLeave:()=>v(null),onClick:()=>r(e),onKeyDown:t=>{"Enter"!==t.key&&" "!==t.key||t.target===t.currentTarget&&(t.preventDefault(),r(e))},onContextMenu:t=>l(e,t),style:{position:"relative",padding:11,background:"var(--bg-panel)",border:`1px solid ${n?"var(--accent)":"var(--border)"}`,borderRadius:9,cursor:"pointer",transition:"transform 0.15s, box-shadow 0.15s",transform:h?"translateY(-1px)":"none",boxShadow:h?"0 6px 16px rgba(0,0,0,0.14)":"none"},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:8},children:[(0,o.jsx)("input",{type:"checkbox",checked:n,title:u("projectDashboard.selectProject"),"aria-label":u("projectDashboard.selectProject"),onClick:e=>e.stopPropagation(),onChange:r=>{a(r.target.checked?[...t,e.id]:t.filter(t=>t!==e.id))},style:{width:14,height:14,marginTop:9,flexShrink:0,cursor:"pointer",opacity:h||n?1:.45}}),(0,o.jsx)("div",{style:{width:32,height:32,borderRadius:7,flexShrink:0,background:e.color||(e.runningCount>0?"var(--accent)":"var(--bg-subtle)"),color:e.color||e.runningCount>0?"white":"var(--text-muted)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:14,fontWeight:600},children:f.charAt(0).toUpperCase()}),(0,o.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,o.jsx)("h3",{title:f,style:{margin:0,fontSize:13,fontWeight:600,color:"var(--text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",minWidth:0},children:f}),e.alias&&(0,o.jsxs)("span",{style:{fontSize:10,color:"var(--text-dim)",flexShrink:0},children:["(",e.name,")"]})]}),(0,o.jsx)("p",{title:e.path,style:{margin:"1px 0 0",fontSize:10.5,color:"var(--text-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.path})]}),(0,o.jsxs)("div",{style:{display:"flex",gap:1,flexShrink:0},children:[(0,o.jsx)("button",{onClick:t=>{t.stopPropagation(),s(e)},"data-testid":"project-edit",title:u("projectDashboard.editProject"),"aria-label":u("projectDashboard.editProject"),style:{...g,color:"var(--text-muted)",opacity:+!!h},children:(0,o.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,o.jsx)("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})}),(0,o.jsx)("button",{onClick:t=>{t.stopPropagation(),i(e.id)},title:e.isFavorite?u("projectDashboard.removeFavorite"):u("projectDashboard.addFavorite"),"aria-label":e.isFavorite?u("projectDashboard.removeFavorite"):u("projectDashboard.addFavorite"),style:{...g,color:e.isFavorite?"#F59E0B":"var(--text-muted)",fontSize:14,lineHeight:1,opacity:e.isFavorite||h?1:0},children:e.isFavorite?"★":"☆"})]})]}),(y||e.gitBranch)&&(0,o.jsxs)("div",{style:{marginTop:8,display:"flex",flexDirection:"column",gap:4},children:[y&&(0,o.jsx)("p",{title:y,style:{margin:0,fontSize:11.5,color:"var(--text-muted)",lineHeight:1.35,display:"-webkit-box",WebkitLineClamp:2,WebkitBoxOrient:"vertical",overflow:"hidden"},children:e.note?y:`${u("projectDashboard.lastSession")}: ${y}`}),e.gitBranch&&(0,o.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:3,fontSize:10.5,color:"var(--text-dim)",minWidth:0},children:[(0,o.jsxs)("svg",{width:"9",height:"9",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2.4",strokeLinecap:"round",strokeLinejoin:"round",style:{flexShrink:0},children:[(0,o.jsx)("line",{x1:"6",y1:"3",x2:"6",y2:"15"}),(0,o.jsx)("circle",{cx:"18",cy:"6",r:"3"}),(0,o.jsx)("circle",{cx:"6",cy:"18",r:"3"}),(0,o.jsx)("path",{d:"M18 9a9 9 0 0 1-9 9"})]}),(0,o.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.gitBranch})]})]}),(0,o.jsxs)("div",{style:{marginTop:8,display:"flex",alignItems:"center",gap:5,flexWrap:"wrap"},children:[(0,o.jsxs)("span",{style:{display:"inline-flex",alignItems:"center",gap:4,padding:"1px 7px",borderRadius:999,fontSize:10.5,fontWeight:500,background:e.runningCount>0?"rgba(16,185,129,0.14)":"var(--bg-subtle)",color:e.runningCount>0?"#10B981":"var(--text-muted)"},children:[(0,o.jsx)("span",{style:{width:5,height:5,borderRadius:"50%",background:e.runningCount>0?"#10B981":"#6B7280"}}),e.runningCount>0?`${e.runningCount} ${u("projectDashboard.running")}`:u("projectDashboard.status.idle")]}),e.unreadCount>0&&(0,o.jsxs)("span",{style:{padding:"1px 7px",borderRadius:999,fontSize:10.5,fontWeight:500,background:"var(--bg-selected)",color:"var(--accent)"},children:[e.unreadCount," ",u("projectDashboard.unread")]})]}),(0,o.jsxs)("div",{style:{marginTop:8,paddingTop:8,borderTop:"1px solid var(--border)",display:"flex",alignItems:"center",justifyContent:"space-between",gap:6,fontSize:10.5,flexWrap:"wrap"},children:[(0,o.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap"},children:[(0,o.jsx)(b,{label:u("projectDashboard.statSessions"),value:e.sessionCount}),(0,o.jsx)(b,{label:u("projectDashboard.statMessages"),value:e.messageTotal}),e.worktreeCount>1&&(0,o.jsxs)("button",{onClick:t=>{t.stopPropagation(),m(j===e.id?null:e.id)},style:{display:"inline-flex",alignItems:"center",gap:3,background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--accent)",fontSize:10.5},children:[(0,o.jsx)(b,{label:u("projectDashboard.statWorktrees"),value:e.worktreeCount}),(0,o.jsx)("span",{style:{color:"var(--text-dim)"},children:j===e.id?"▾":"▸"})]}),e.subagentCount>0&&(0,o.jsx)(b,{label:u("projectDashboard.statSubagents"),value:e.subagentCount})]}),(0,o.jsx)("span",{title:e.lastAccessed,style:{color:"var(--text-dim)",whiteSpace:"nowrap"},children:(0,x.fw)(e.lastAccessed,d)})]}),j===e.id&&e.worktrees.length>0&&(0,o.jsx)("div",{style:{marginTop:6,display:"flex",flexDirection:"column",gap:2},children:e.worktrees.map(e=>(0,o.jsx)("div",{title:e,style:{fontSize:10.5,color:"var(--text-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap",paddingLeft:8,borderLeft:"2px solid var(--border)"},children:e},e))})]},e.id)})})}function v({projects:e,selectedProjects:t,onSelectProject:r,onToggleFavorite:i,onSelectionChange:a,onEditProject:s,onContextMenu:l}){let{locale:d,t:u}=(0,h.s)(),{ref:p,width:g}=function(){let e=(0,n.useRef)(null),[t,r]=(0,n.useState)(0);return(0,n.useEffect)(()=>{let t=e.current;if(!t||(r(t.getBoundingClientRect().width),"u"<typeof ResizeObserver))return;let o=new ResizeObserver(e=>{let t=e[0];t&&r(t.contentRect.width)});return o.observe(t),()=>o.disconnect()},[]),{ref:e,width:t}}(),[b,f]=(0,n.useState)(null),[j,m]=(0,n.useState)(null),y=0===g||g>=460,w=y?"28px minmax(0,1.4fr) minmax(0,1fr) 84px 48px 54px 44px 74px 30px":"28px minmax(0,1fr) 84px 44px 30px",k=e.map(e=>e.id),C=k.length>0&&k.every(e=>t.includes(e)),S={fontSize:10.5,fontWeight:600,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:.4,overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"};return(0,o.jsxs)("div",{ref:p,"data-testid":"project-list",style:{background:"var(--bg-panel)",borderRadius:9,border:"1px solid var(--border)",overflow:"hidden"},children:[(0,o.jsxs)("div",{style:{display:"grid",gridTemplateColumns:w,gap:8,padding:"8px 12px",background:"var(--bg-subtle)",borderBottom:"1px solid var(--border)",alignItems:"center"},children:[(0,o.jsx)("div",{children:(0,o.jsx)("input",{type:"checkbox",checked:C,"aria-label":u("projectDashboard.selectAll"),onChange:t=>a(t.target.checked?e.map(e=>e.id):[]),style:{width:14,height:14,cursor:"pointer"}})}),(0,o.jsx)("div",{style:S,children:u("projectDashboard.project")}),y&&(0,o.jsx)("div",{style:S,children:u("projectDashboard.lastSession")}),(0,o.jsx)("div",{style:S,children:u("projectDashboard.statusLabel")}),(0,o.jsx)("div",{style:S,children:u("projectDashboard.statSessions")}),y&&(0,o.jsx)("div",{style:S,children:u("projectDashboard.statMessages")}),y&&(0,o.jsx)("div",{style:S,children:u("projectDashboard.statWorktrees")}),y&&(0,o.jsx)("div",{style:S,children:u("projectDashboard.lastAccessed")}),(0,o.jsx)("div",{})]}),e.map((n,p)=>{let h=t.includes(n.id),g=c(n),v=n.note||n.lastSessionTitle;return(0,o.jsxs)("div",{children:[(0,o.jsxs)("div",{"data-testid":"project-card","data-project-id":n.id,role:"button",tabIndex:0,"aria-label":u("projectDashboard.ctxOpen")+": "+g,onMouseEnter:()=>f(n.id),onMouseLeave:()=>f(null),onClick:()=>r(n),onKeyDown:e=>{"Enter"!==e.key&&" "!==e.key||e.target===e.currentTarget&&(e.preventDefault(),r(n))},onContextMenu:e=>l(n,e),style:{display:"grid",gridTemplateColumns:w,gap:8,padding:"8px 12px",alignItems:"center",borderBottom:p<e.length-1||j===n.id?"1px solid var(--border)":"none",background:h?"var(--bg-selected)":b===n.id?"var(--bg-hover)":"transparent",cursor:"pointer",transition:"background 0.12s"},children:[(0,o.jsx)("div",{children:(0,o.jsx)("input",{type:"checkbox",checked:h,onClick:e=>e.stopPropagation(),onChange:e=>{a(e.target.checked?[...t,n.id]:t.filter(e=>e!==n.id))},style:{width:14,height:14,cursor:"pointer"}})}),(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:8,minWidth:0},children:[(0,o.jsx)("div",{style:{width:24,height:24,borderRadius:6,flexShrink:0,background:n.color||(n.runningCount>0?"var(--accent)":"var(--bg-subtle)"),color:n.color||n.runningCount>0?"white":"var(--text-muted)",display:"flex",alignItems:"center",justifyContent:"center",fontSize:11,fontWeight:600},children:g.charAt(0).toUpperCase()}),(0,o.jsxs)("div",{style:{minWidth:0,flex:1},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4},children:[(0,o.jsx)("span",{style:{fontSize:12.5,fontWeight:500,color:"var(--text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:g}),(0,o.jsx)("button",{onClick:e=>{e.stopPropagation(),s(n)},title:u("projectDashboard.editProject"),"aria-label":u("projectDashboard.editProject"),style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--text-dim)",display:"flex",flexShrink:0,opacity:+(b===n.id)},children:(0,o.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,o.jsx)("path",{d:"M17 3a2.828 2.828 0 1 1 4 4L7.5 20.5 2 22l1.5-5.5L17 3z"})})})]}),(0,o.jsx)("div",{title:n.path,style:{fontSize:10.5,color:"var(--text-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.path}),!y&&v&&(0,o.jsx)("div",{title:v,style:{fontSize:10.5,color:"var(--text-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.note?v:`${u("projectDashboard.lastSession")}: ${v}`})]})]}),y&&(0,o.jsx)("div",{title:v,style:{fontSize:11.5,color:"var(--text-muted)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:v||"—"}),(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",gap:4,fontSize:11,color:n.runningCount>0?"#10B981":"var(--text-muted)",minWidth:0},children:[(0,o.jsx)("span",{style:{width:5,height:5,borderRadius:"50%",background:n.runningCount>0?"#10B981":"#6B7280",flexShrink:0}}),(0,o.jsx)("span",{style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:n.runningCount>0?`${n.runningCount} ${u("projectDashboard.running")}`:u("projectDashboard.status.idle")}),n.unreadCount>0&&(0,o.jsx)("span",{style:{color:"var(--accent)"},title:`${n.unreadCount} ${u("projectDashboard.unread")}`,children:"•"})]}),(0,o.jsx)("div",{style:{fontSize:11.5,color:"var(--text)",fontVariantNumeric:"tabular-nums"},children:n.sessionCount}),y&&(0,o.jsx)("div",{style:{fontSize:11.5,color:"var(--text)",fontVariantNumeric:"tabular-nums"},children:n.messageTotal}),y&&(0,o.jsxs)("div",{style:{fontSize:11.5,color:"var(--text-muted)",fontVariantNumeric:"tabular-nums",display:"flex",alignItems:"center",gap:3},children:[n.worktreeCount,n.worktreeCount>1&&(0,o.jsx)("button",{onClick:e=>{e.stopPropagation(),m(j===n.id?null:n.id)},"aria-label":u("projectDashboard.toggleWorktrees"),style:{background:"none",border:"none",padding:0,cursor:"pointer",color:"var(--accent)",fontSize:10},children:j===n.id?"▾":"▸"})]}),y&&(0,o.jsx)("div",{title:n.lastAccessed,style:{fontSize:10.5,color:"var(--text-muted)",whiteSpace:"nowrap",overflow:"hidden",textOverflow:"ellipsis"},children:(0,x.fw)(n.lastAccessed,d)}),(0,o.jsx)("div",{children:(0,o.jsx)("button",{onClick:e=>{e.stopPropagation(),i(n.id)},title:n.isFavorite?u("projectDashboard.removeFavorite"):u("projectDashboard.addFavorite"),"aria-label":n.isFavorite?u("projectDashboard.removeFavorite"):u("projectDashboard.addFavorite"),style:{background:"none",border:"none",cursor:"pointer",padding:0,color:n.isFavorite?"#F59E0B":"var(--text-muted)",fontSize:13,lineHeight:1},children:n.isFavorite?"★":"☆"})})]}),j===n.id&&n.worktrees.length>0&&(0,o.jsx)("div",{style:{padding:"6px 12px 8px 48px",background:"var(--bg-subtle)",display:"flex",flexDirection:"column",gap:2},children:n.worktrees.map(e=>(0,o.jsx)("div",{title:e,style:{fontSize:10.5,color:"var(--text-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e},e))})]},n.id)})]})}function j({stats:e,quickFilter:t,sortBy:r,sortOrder:n,onQuickFilterChange:i,onSortToggle:a}){let{t:s}=(0,h.s)(),l=e=>r===e?"desc"===n?"↓":"↑":void 0,d=[{key:"all",label:s("projectDashboard.chipProjects"),count:e.totalProjects,title:s("projectDashboard.chipProjectsHint"),active:"all"===t,onClick:()=>i("all")},{key:"active",label:s("projectDashboard.chipActive"),count:e.activeProjects,title:s("projectDashboard.chipActiveHint"),active:"active"===t,onClick:()=>i("active"===t?"all":"active")},{key:"unread",label:s("projectDashboard.chipUnread"),count:e.totalUnread,title:s("projectDashboard.chipUnreadHint"),active:"unread"===t,onClick:()=>i("unread"===t?"all":"unread")},{key:"sessions",label:s("projectDashboard.chipSessions"),count:e.totalSessions,title:s("projectDashboard.chipSessionsHint"),active:"all"===t&&"sessionCount"===r,onClick:()=>a("sessionCount"),sortIndicator:l("sessionCount")},{key:"messages",label:s("projectDashboard.chipMessages"),count:e.totalMessages,title:s("projectDashboard.chipMessagesHint"),active:"all"===t&&"messageTotal"===r,onClick:()=>a("messageTotal"),sortIndicator:l("messageTotal")}];return(0,o.jsx)("div",{style:{display:"flex",alignItems:"center",gap:6,padding:"8px 16px",borderBottom:"1px solid var(--border)",overflowX:"auto",overflowY:"hidden",flexShrink:0,scrollbarWidth:"thin"},children:d.map(e=>(0,o.jsxs)("button",{onClick:e.onClick,"data-testid":`dashboard-chip-${e.key}`,title:e.title,"aria-pressed":e.active,style:{display:"inline-flex",alignItems:"center",gap:4,flexShrink:0,padding:"3px 9px",borderRadius:999,border:`1px solid ${e.active?"var(--accent)":"var(--border)"}`,background:e.active?"var(--bg-selected)":"var(--bg-panel)",color:e.active?"var(--accent)":"var(--text-muted)",fontSize:11,fontWeight:600,cursor:"pointer",whiteSpace:"nowrap",transition:"background 0.12s, color 0.12s, border-color 0.12s"},children:[(0,o.jsx)("span",{children:e.label}),(0,o.jsx)("span",{style:{fontVariantNumeric:"tabular-nums"},children:e.count}),e.sortIndicator&&(0,o.jsx)("span",{"aria-hidden":!0,children:e.sortIndicator})]},e.key))})}function m({viewMode:e,sortBy:t,sortOrder:r,searchQuery:n,onViewModeChange:i,onSortChange:a,onSearchChange:s}){let{t:l}=(0,h.s)();return(0,o.jsxs)("div",{style:{display:"flex",gap:8,alignItems:"center",padding:"8px 16px",borderBottom:"1px solid var(--border)",flexShrink:0,overflowX:"auto",overflowY:"hidden",scrollbarWidth:"thin"},children:[(0,o.jsxs)("div",{style:{position:"relative",width:148,flexShrink:0},children:[(0,o.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{position:"absolute",left:10,top:"50%",transform:"translateY(-50%)",color:"var(--text-muted)",pointerEvents:"none"},children:[(0,o.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,o.jsx)("path",{d:"M21 21l-4.35-4.35"})]}),(0,o.jsx)("input",{type:"text",placeholder:l("projectDashboard.searchPlaceholder"),value:n,onChange:e=>s(e.target.value),style:{width:"100%",padding:"7px 10px 7px 32px",background:"var(--bg-panel)",border:"1px solid var(--border)",borderRadius:7,fontSize:13,color:"var(--text)",outline:"none"}})]}),(0,o.jsxs)("select",{value:t,onChange:e=>a(e.target.value,r),title:l("projectDashboard.sortBy"),style:{padding:"7px 8px",background:"var(--bg-panel)",border:"1px solid var(--border)",borderRadius:7,fontSize:13,color:"var(--text)",cursor:"pointer",outline:"none",flexShrink:0},children:[(0,o.jsx)("option",{value:"lastAccessed",children:l("projectDashboard.sortLastAccessed")}),(0,o.jsx)("option",{value:"name",children:l("projectDashboard.sortName")}),(0,o.jsx)("option",{value:"sessionCount",children:l("projectDashboard.sortSessions")}),(0,o.jsx)("option",{value:"runningCount",children:l("projectDashboard.sortRunning")}),(0,o.jsx)("option",{value:"messageTotal",children:l("projectDashboard.sortMessages")})]}),(0,o.jsx)("button",{onClick:()=>a(t,"asc"===r?"desc":"asc"),title:l("asc"===r?"projectDashboard.ascending":"projectDashboard.descending"),style:{padding:7,background:"var(--bg-panel)",border:"1px solid var(--border)",borderRadius:7,cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",color:"var(--text-muted)",flexShrink:0},children:(0,o.jsx)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",style:{transform:"asc"===r?"rotate(180deg)":"none",transition:"transform 0.2s"},children:(0,o.jsx)("path",{d:"M12 5v14M19 12l-7 7-7-7"})})}),(0,o.jsxs)("div",{style:{display:"flex",background:"var(--bg-panel)",border:"1px solid var(--border)",borderRadius:7,overflow:"hidden",flexShrink:0},children:[(0,o.jsx)("button",{onClick:()=>i("grid"),"data-testid":"view-mode-grid",title:l("projectDashboard.gridView"),style:{padding:"7px 9px",background:"grid"===e?"var(--accent)":"transparent",border:"none",cursor:"pointer",display:"flex",alignItems:"center",color:"grid"===e?"white":"var(--text-muted)"},children:(0,o.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,o.jsx)("rect",{x:"3",y:"3",width:"7",height:"7"}),(0,o.jsx)("rect",{x:"14",y:"3",width:"7",height:"7"}),(0,o.jsx)("rect",{x:"14",y:"14",width:"7",height:"7"}),(0,o.jsx)("rect",{x:"3",y:"14",width:"7",height:"7"})]})}),(0,o.jsx)("button",{onClick:()=>i("list"),"data-testid":"view-mode-list",title:l("projectDashboard.listView"),style:{padding:"7px 9px",background:"list"===e?"var(--accent)":"transparent",border:"none",borderLeft:"1px solid var(--border)",cursor:"pointer",display:"flex",alignItems:"center",color:"list"===e?"white":"var(--text-muted)"},children:(0,o.jsxs)("svg",{width:"15",height:"15",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:[(0,o.jsx)("line",{x1:"8",y1:"6",x2:"21",y2:"6"}),(0,o.jsx)("line",{x1:"8",y1:"12",x2:"21",y2:"12"}),(0,o.jsx)("line",{x1:"8",y1:"18",x2:"21",y2:"18"}),(0,o.jsx)("line",{x1:"3",y1:"6",x2:"3.01",y2:"6"}),(0,o.jsx)("line",{x1:"3",y1:"12",x2:"3.01",y2:"12"}),(0,o.jsx)("line",{x1:"3",y1:"18",x2:"3.01",y2:"18"})]})})]})]})}function y({x:e,y:t,items:r,onClose:i}){let a=(0,n.useRef)(null),[s,l]=(0,n.useState)({left:e,top:t});return(0,n.useLayoutEffect)(()=>{let r=a.current;if(!r)return;let o=r.getBoundingClientRect();l({left:Math.max(8,Math.min(e,Math.max(8,window.innerWidth-o.width-8))),top:Math.max(8,Math.min(t,Math.max(8,window.innerHeight-o.height-8)))})},[e,t]),(0,n.useEffect)(()=>{let e=()=>i(),t=e=>{"Escape"===e.key&&i()},r=e=>{a.current?.contains(e.target)||i()};return document.addEventListener("keydown",t),document.addEventListener("pointerdown",r,!0),window.addEventListener("scroll",e,!0),window.addEventListener("resize",e),window.addEventListener("blur",e),()=>{document.removeEventListener("keydown",t),document.removeEventListener("pointerdown",r,!0),window.removeEventListener("scroll",e,!0),window.removeEventListener("resize",e),window.removeEventListener("blur",e)}},[i]),(0,o.jsx)("div",{ref:a,"data-testid":"project-context-menu",role:"menu",style:{position:"fixed",left:s.left,top:s.top,zIndex:3200,minWidth:168,padding:4,background:"var(--bg-panel)",border:"1px solid var(--border)",borderRadius:8,boxShadow:"0 12px 32px rgba(0,0,0,0.32)",display:"flex",flexDirection:"column",gap:1},children:r.map(e=>(0,o.jsx)("button",{role:"menuitem",disabled:e.disabled,onClick:()=>{e.disabled||(e.onSelect(),i())},style:{display:"flex",alignItems:"center",gap:8,padding:"7px 10px",background:"none",border:"none",borderRadius:6,textAlign:"left",fontSize:13,color:e.disabled?"var(--text-dim)":e.danger?"#ef4444":"var(--text)",cursor:e.disabled?"default":"pointer",width:"100%"},onMouseEnter:t=>{e.disabled||(t.currentTarget.style.background=e.danger?"rgba(239,68,68,0.1)":"var(--bg-hover)")},onMouseLeave:e=>{e.currentTarget.style.background="none"},children:e.label},e.key))})}let w=["#3B82F6","#10B981","#F59E0B","#8B5CF6","#EC4899","#EF4444","#14B8A6","#6B7280"],k=globalThis;function C({title:e,onClose:t,children:r,wide:i,testId:a}){let[s]=(0,n.useState)(()=>Symbol("modal"));return(0,n.useEffect)(()=>{let e=(k.__agentStudioModalStack??=[],k.__agentStudioModalStack);e.push(s);let r=r=>{"Escape"!==r.key||e[e.length-1]===s&&t()};return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r);let t=e.indexOf(s);t>=0&&e.splice(t,1)}},[s,t]),(0,o.jsx)("div",{onClick:t,style:{position:"fixed",inset:0,background:"rgba(0,0,0,0.5)",display:"flex",alignItems:"center",justifyContent:"center",zIndex:3e3,padding:16},children:(0,o.jsxs)("div",{onClick:e=>e.stopPropagation(),"data-testid":a,role:"dialog","aria-modal":"true","aria-label":e,style:{background:"var(--bg-panel)",border:"1px solid var(--border)",borderRadius:12,width:"100%",maxWidth:i?560:420,maxHeight:"85vh",display:"flex",flexDirection:"column",overflow:"hidden",boxShadow:"0 18px 48px rgba(0,0,0,0.35)"},children:[(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 16px",borderBottom:"1px solid var(--border)",flexShrink:0},children:[(0,o.jsx)("h2",{style:{margin:0,fontSize:15,fontWeight:600,color:"var(--text)"},children:e}),(0,o.jsx)("button",{onClick:t,"aria-label":"Close",style:{background:"none",border:"none",cursor:"pointer",color:"var(--text-muted)",fontSize:20,lineHeight:1,padding:4},children:"\xd7"})]}),(0,o.jsx)("div",{style:{padding:16,overflowY:"auto"},children:r})]})})}let S={width:"100%",padding:"8px 10px",background:"var(--bg)",border:"1px solid var(--border)",borderRadius:7,fontSize:13,color:"var(--text)",outline:"none",fontFamily:"inherit"},D={display:"block",fontSize:12,fontWeight:500,color:"var(--text-muted)",marginBottom:6};function z({project:e,meta:t,onSave:r,onClose:i}){let{t:a}=(0,h.s)(),[s,l]=(0,n.useState)(t.alias??""),[d,c]=(0,n.useState)(t.note??""),[u,p]=(0,n.useState)(t.color??"");return(0,o.jsxs)(C,{title:a("projectDashboard.editProject"),onClose:i,testId:"project-note-editor",children:[(0,o.jsx)("div",{style:{fontSize:12,color:"var(--text-muted)",marginBottom:14,wordBreak:"break-all"},children:e.path}),(0,o.jsxs)("div",{style:{marginBottom:14},children:[(0,o.jsx)("label",{style:D,htmlFor:"project-alias",children:a("projectDashboard.alias")}),(0,o.jsx)("input",{id:"project-alias","data-testid":"project-alias-input",value:s,onChange:e=>l(e.target.value),placeholder:e.name,style:S,autoFocus:!0}),(0,o.jsx)("div",{style:{fontSize:11,color:"var(--text-dim)",marginTop:4},children:a("projectDashboard.aliasHint")})]}),(0,o.jsxs)("div",{style:{marginBottom:14},children:[(0,o.jsx)("label",{style:D,htmlFor:"project-note",children:a("projectDashboard.note")}),(0,o.jsx)("textarea",{id:"project-note","data-testid":"project-note-input",value:d,onChange:e=>c(e.target.value),placeholder:a("projectDashboard.notePlaceholder"),rows:4,style:{...S,resize:"vertical",minHeight:80}})]}),(0,o.jsxs)("div",{style:{marginBottom:18},children:[(0,o.jsx)("span",{style:D,children:a("projectDashboard.color")}),(0,o.jsxs)("div",{style:{display:"flex",gap:8,flexWrap:"wrap",alignItems:"center"},children:[(0,o.jsx)("button",{onClick:()=>p(""),title:a("projectDashboard.colorDefault"),style:{width:26,height:26,borderRadius:6,cursor:"pointer",background:"var(--bg-subtle)",border:""===u?"2px solid var(--accent)":"1px solid var(--border)"}}),w.map(e=>(0,o.jsx)("button",{onClick:()=>p(e),title:e,style:{width:26,height:26,borderRadius:6,cursor:"pointer",background:e,border:u===e?"2px solid var(--text)":"1px solid var(--border)"}},e))]})]}),(0,o.jsxs)("div",{style:{display:"flex",justifyContent:"space-between",gap:8},children:[(0,o.jsx)("button",{onClick:()=>{r({alias:void 0,note:void 0,color:void 0}),i()},style:{padding:"7px 12px",background:"none",border:"1px solid var(--border)",borderRadius:7,color:"var(--text-muted)",fontSize:13,cursor:"pointer"},children:a("projectDashboard.clearMeta")}),(0,o.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,o.jsx)("button",{onClick:i,style:{padding:"7px 14px",background:"var(--bg-hover)",border:"1px solid var(--border)",borderRadius:7,color:"var(--text)",fontSize:13,cursor:"pointer"},children:a("projectDashboard.cancel")}),(0,o.jsx)("button",{onClick:()=>{r({alias:s.trim()||void 0,note:d.trim()||void 0,color:u||void 0}),i()},"data-testid":"project-save",style:{padding:"7px 14px",background:"var(--accent)",border:"none",borderRadius:7,color:"white",fontSize:13,fontWeight:500,cursor:"pointer"},children:a("projectDashboard.save")})]})]})]})}function I({projects:e,metaMap:t,onSave:r,onClose:i}){let{t:a}=(0,h.s)(),[s,l]=(0,n.useState)(null),d=e.filter(e=>t[e.id]?.note||t[e.id]?.alias||t[e.id]?.color).length;return(0,o.jsxs)(C,{title:a("projectDashboard.manageTitle"),onClose:i,wide:!0,testId:"project-settings-panel",children:[(0,o.jsx)("p",{style:{margin:"0 0 14px",fontSize:12,color:"var(--text-muted)"},children:a("projectDashboard.manageHint",{total:e.length,annotated:d})}),0===e.length?(0,o.jsx)("div",{style:{padding:"24px 0",textAlign:"center",color:"var(--text-muted)",fontSize:13},children:a("projectDashboard.noProjectsFound")}):(0,o.jsx)("div",{style:{display:"flex",flexDirection:"column",gap:8},children:e.map(e=>{let r=t[e.id]??{};return(0,o.jsxs)("div",{style:{display:"flex",alignItems:"flex-start",gap:10,padding:10,border:"1px solid var(--border)",borderRadius:8,background:"var(--bg)"},children:[(0,o.jsx)("span",{style:{width:10,height:10,borderRadius:3,marginTop:4,flexShrink:0,background:r.color||"var(--accent)"}}),(0,o.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,o.jsx)("div",{style:{fontSize:13,fontWeight:500,color:"var(--text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:c({...e,...r})}),(0,o.jsx)("div",{style:{fontSize:11,color:"var(--text-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},title:e.path,children:e.path}),r.note&&(0,o.jsx)("div",{style:{fontSize:12,color:"var(--text-muted)",marginTop:4,whiteSpace:"pre-wrap"},children:r.note})]}),(0,o.jsx)("button",{onClick:()=>l(e),style:{flexShrink:0,padding:"4px 10px",background:"var(--bg-hover)",border:"1px solid var(--border)",borderRadius:6,color:"var(--text)",fontSize:12,cursor:"pointer"},children:a("projectDashboard.edit")})]},e.id)})}),s&&(0,o.jsx)(z,{project:s,meta:t[s.id]??{},onSave:e=>r(s.id,e),onClose:()=>l(null)})]})}var T=r(17709);function M(e,t){try{window.localStorage.setItem(e,String(t))}catch{}}function R({projects:e,onSelectProject:t,onNewSessionInProject:r,onRequestCreateProject:c}){let{t:x}=(0,h.s)(),[g,b]=(0,n.useState)("grid"),[w,k]=(0,n.useState)("lastAccessed"),[C,S]=(0,n.useState)("desc"),[D,B]=(0,n.useState)(""),[W,A]=(0,n.useState)("all"),[L,E]=(0,n.useState)([]),[P,O]=(0,n.useState)(null),[F,H]=(0,n.useState)({});(0,n.useEffect)(()=>{H(function(){let e=u();if(!e)return{};let t=function(e){let t;if(!e)return{};try{t=JSON.parse(e)}catch{return{}}if(!s(t))return{};let r={};for(let[e,o]of Object.entries(t)){if(!s(o))continue;let t={},n=l(o.alias),i=l(o.note),a=l(o.color);void 0!==n&&(t.alias=n),void 0!==i&&(t.note=i),void 0!==a&&(t.color=a),"boolean"==typeof o.favorite&&(t.favorite=o.favorite),Object.keys(t).length>0&&(r[e]=t)}return r}(e.getItem(i)),r=function(e,t){let r;if(!t)return e;try{r=JSON.parse(t)}catch{return e}if(!Array.isArray(r))return e;let o=e;for(let e of r)"string"==typeof e&&0!==e.length&&(o[e]?.favorite||(o=d(o,e,{favorite:!0})));return o}(t,e.getItem(a));return r!==t&&p(r),r}())},[]);let N=(0,n.useRef)(null);(0,n.useEffect)(()=>()=>{null!==N.current&&window.clearTimeout(N.current)},[]);let[$,q]=(0,n.useState)(null),[_,J]=(0,n.useState)(!1),[U,Y]=(0,n.useState)(null),V=function({storageKey:e,defaultHeight:t,minTop:r,minBottom:o,maxTop:i,keyboardStep:a=16}){let s=(0,n.useRef)(null),l=(0,n.useRef)(null),d=(0,n.useRef)(t),c=(0,n.useRef)(!1),[u,p]=(0,n.useState)(t),[h,x]=(0,n.useState)(!1),g=(0,n.useCallback)(()=>{let e=s.current;return e?e.getBoundingClientRect().height:0},[]),b=(0,n.useCallback)(e=>(function(e,t){let{containerHeight:r,minTop:o,minBottom:n,maxTop:i}=t,a=Number.isFinite(e)?Math.round(e):o;if(!Number.isFinite(r)||r<=0)return Math.max(o,a);let s=Math.min(i??1/0,Math.max(o,r-n));return Math.round(Math.max(o,Math.min(s,a)))})(e,{containerHeight:g(),minTop:r,minBottom:o,maxTop:i}),[i,g,o,r]),f=(0,n.useCallback)((t,r=!0)=>{let o=b(t);return d.current=o,p(o),r&&M(e,o),o},[b,e]),v=(0,n.useCallback)(()=>{f(t)},[f,t]),j=(0,n.useCallback)(e=>{document.body.style.cursor=e.previousCursor,document.body.style.userSelect=e.previousUserSelect},[]),m=(0,n.useCallback)(t=>{let r=l.current;if(r&&r.pointerId===t){l.current=null,j(r),x(!1),M(e,d.current);try{r.target.hasPointerCapture(t)&&r.target.releasePointerCapture(t)}catch{}}},[j,e]),y=(0,n.useCallback)(e=>{if("mouse"===e.pointerType&&0!==e.button)return;e.preventDefault();let t=l.current;t&&m(t.pointerId);let r=e.currentTarget;r.focus({preventScroll:!0}),r.setPointerCapture(e.pointerId),l.current={pointerId:e.pointerId,startY:e.clientY,startHeight:d.current,target:r,previousCursor:document.body.style.cursor,previousUserSelect:document.body.style.userSelect},document.body.style.cursor="row-resize",document.body.style.userSelect="none",x(!0)},[m]),w=(0,n.useCallback)(e=>{let t=l.current;if(!t||t.pointerId!==e.pointerId)return;if("mouse"===e.pointerType&&0===e.buttons)return void m(e.pointerId);e.preventDefault();let r=b(t.startHeight+(e.clientY-t.startY));d.current=r,p(r),e.currentTarget.setAttribute("aria-valuenow",String(r)),e.currentTarget.setAttribute("aria-valuetext",`${r} px`)},[b,m]),k=(0,n.useCallback)(e=>{m(e.pointerId)},[m]),C=(0,n.useCallback)(e=>{let t=e.shiftKey?2*a:a;"ArrowDown"===e.key?(e.preventDefault(),f(d.current+t)):"ArrowUp"===e.key?(e.preventDefault(),f(d.current-t)):"Home"===e.key?(e.preventDefault(),f(r)):"End"===e.key?(e.preventDefault(),f(i??1/0)):"Enter"===e.key&&(e.preventDefault(),v())},[f,a,i,r,v]);(0,n.useEffect)(()=>{c.current||(c.current=!0,f(function(e){try{let t=window.localStorage.getItem(e);if(null===t)return null;let r=Number.parseInt(t,10);return Number.isFinite(r)?r:null}catch{return null}}(e)??t))},[f,t,e]),(0,n.useEffect)(()=>{let e=s.current;if(!e||"u"<typeof ResizeObserver)return;let t=new ResizeObserver(()=>{let e=b(d.current);e!==d.current&&(d.current=e,p(e))});return t.observe(e),()=>t.disconnect()},[b]),(0,n.useEffect)(()=>{if(!h)return;let e=()=>{let e=l.current;e&&m(e.pointerId)},t=()=>{"visible"!==document.visibilityState&&e()};return window.addEventListener("blur",e),document.addEventListener("visibilitychange",t),()=>{window.removeEventListener("blur",e),document.removeEventListener("visibilitychange",t)}},[m,h]),(0,n.useEffect)(()=>()=>{let e=l.current;e&&(l.current=null,j(e))},[j]);let S=Math.max(r,g()-o);return{containerRef:s,height:u,isResizing:h,setHeight:e=>{f(e)},resetHeight:v,separatorProps:{role:"separator",tabIndex:0,"aria-label":"Resize project details","aria-orientation":"horizontal","aria-valuemin":r,"aria-valuemax":S,"aria-valuenow":u,"aria-valuetext":`${u} px`,onDoubleClick:v,onKeyDown:C,onLostPointerCapture:k,onPointerCancel:k,onPointerDown:y,onPointerMove:w,onPointerUp:k}}}({storageKey:"agent-studio:project-dashboard-split",defaultHeight:132,minTop:40,minBottom:180}),K=V.height<=42,Q=(0,n.useCallback)((e,t)=>{let r=d(F,e,t);H(r),p(r)},[F]),X=(0,n.useCallback)(e=>{Q(e,{favorite:!F[e]?.favorite})},[Q,F]),Z=(0,n.useMemo)(()=>e.map(e=>{let t=F[e.id],r={...e,isFavorite:!!t?.favorite};return t?.alias&&(r.alias=t.alias),t?.note&&(r.note=t.note),t?.color&&(r.color=t.color),r}),[e,F]),G=(0,n.useMemo)(()=>{let e=Z.reduce((e,t)=>e+t.sessionCount,0),t=Z.reduce((e,t)=>e+t.messageTotal,0);return{totalProjects:Z.length,activeProjects:Z.filter(e=>e.runningCount>0).length,totalSessions:e,totalRunning:Z.reduce((e,t)=>e+t.runningCount,0),totalUnread:Z.reduce((e,t)=>e+t.unreadCount,0),totalMessages:t,averageSessionsPerProject:Z.length>0?e/Z.length:0,mostActiveProject:[...Z].sort((e,t)=>t.sessionCount-e.sessionCount)[0]}},[Z]),ee=(0,n.useMemo)(()=>(0,T.TU)((0,T.QZ)((0,T.OW)(Z,W),D),w,C),[Z,W,D,w,C]),et=(0,n.useMemo)(()=>new Map(Z.map(e=>[e.id,e])),[Z]),er=(0,n.useCallback)(e=>{A("all"),w===e?S(e=>"desc"===e?"asc":"desc"):(k(e),S("desc"))},[w]),eo=(0,n.useCallback)(e=>{O(e),null!==N.current&&window.clearTimeout(N.current),N.current=window.setTimeout(()=>{N.current=null,O(null)},1600)},[]),en=(0,n.useCallback)(async e=>{try{if(navigator.clipboard?.writeText){await navigator.clipboard.writeText(e),eo(x("projectDashboard.copied"));return}let t=document.createElement("textarea");t.value=e,t.setAttribute("readonly",""),t.style.position="fixed",t.style.opacity="0",document.body.appendChild(t),t.select();let r=document.execCommand("copy");document.body.removeChild(t),eo(x(r?"projectDashboard.copied":"projectDashboard.copyFailed"))}catch{eo(x("projectDashboard.copyFailed"))}},[eo,x]),ei=U?et.get(U.projectId):void 0,ea=ei?[{key:"open",label:x("projectDashboard.ctxOpen"),onSelect:()=>t(ei)},{key:"new",label:x("projectDashboard.ctxNewSession"),disabled:!r,onSelect:()=>r?.(ei)},{key:"copy",label:x("projectDashboard.ctxCopyPath"),onSelect:()=>void en(ei.path)},{key:"edit",label:x("projectDashboard.ctxEdit"),onSelect:()=>q(ei.id)},{key:"fav",label:ei.isFavorite?x("projectDashboard.removeFavorite"):x("projectDashboard.addFavorite"),onSelect:()=>X(ei.id)}]:[],es=(0,n.useCallback)((e,t)=>{t.preventDefault(),t.stopPropagation(),Y({projectId:e.id,x:t.clientX,y:t.clientY})},[]),el=$?et.get($):void 0;return(0,o.jsxs)("div",{ref:V.containerRef,"data-testid":"project-dashboard",style:{display:"flex",flexDirection:"column",height:"100%",minHeight:0,overflow:"hidden"},children:[(0,o.jsxs)("div",{"data-testid":"dashboard-top-pane",style:{height:V.height,flexShrink:0,minHeight:0,overflowY:"auto",overflowX:"hidden",display:"flex",flexDirection:"column"},children:[(0,o.jsxs)("div",{style:{padding:"12px 16px 10px",display:"flex",justifyContent:"space-between",alignItems:"flex-start",gap:8},children:[(0,o.jsxs)("div",{style:{minWidth:0},children:[(0,o.jsx)("h2",{style:{margin:0,fontSize:15,fontWeight:600,color:"var(--text)"},children:x("projectDashboard.title")}),(0,o.jsx)("p",{style:{margin:"2px 0 0",fontSize:12,color:"var(--text-muted)"},children:x("projectDashboard.subtitle")})]}),(0,o.jsxs)("div",{style:{display:"flex",gap:6,flexShrink:0},children:[(0,o.jsxs)("button",{onClick:c,"data-testid":"new-project-button",title:x("projectDashboard.newProject"),style:{display:"flex",alignItems:"center",gap:4,padding:"5px 9px",background:"var(--accent)",color:"white",border:"none",borderRadius:6,fontSize:12,fontWeight:500,cursor:"pointer"},children:[(0,o.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:(0,o.jsx)("path",{d:"M12 5v14M5 12h14"})}),x("projectDashboard.newProject")]}),(0,o.jsx)("button",{onClick:()=>J(!0),"data-testid":"project-settings-open",title:x("projectDashboard.manage"),"aria-label":x("projectDashboard.manage"),style:{display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,padding:0,background:"var(--bg-hover)",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:6,cursor:"pointer"},children:(0,o.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,o.jsx)("circle",{cx:"12",cy:"12",r:"3"}),(0,o.jsx)("path",{d:"M19.4 15a1.65 1.65 0 0 0 .33 1.82l.06.06a2 2 0 1 1-2.83 2.83l-.06-.06a1.65 1.65 0 0 0-1.82-.33 1.65 1.65 0 0 0-1 1.51V21a2 2 0 0 1-4 0v-.09A1.65 1.65 0 0 0 9 19.4a1.65 1.65 0 0 0-1.82.33l-.06.06a2 2 0 1 1-2.83-2.83l.06-.06a1.65 1.65 0 0 0 .33-1.82 1.65 1.65 0 0 0-1.51-1H3a2 2 0 0 1 0-4h.09A1.65 1.65 0 0 0 4.6 9a1.65 1.65 0 0 0-.33-1.82l-.06-.06a2 2 0 1 1 2.83-2.83l.06.06A1.65 1.65 0 0 0 9 4.6h.09A1.65 1.65 0 0 0 10.6 3.09V3a2 2 0 0 1 4 0v.09A1.65 1.65 0 0 0 16.11 4.6h.09a1.65 1.65 0 0 0 1.51-1.51l.06-.06a2 2 0 1 1 2.83 2.83l-.06.06A1.65 1.65 0 0 0 20.4 9v.09a1.65 1.65 0 0 0 1.51 1H21a2 2 0 0 1 0 4h-.09a1.65 1.65 0 0 0-1.51 1Z"})]})}),(0,o.jsx)("button",{onClick:()=>V.setHeight(K?132:40),"data-testid":"dashboard-toggle-details",title:K?x("projectDashboard.expandDetails"):x("projectDashboard.collapseDetails"),"aria-label":K?x("projectDashboard.expandDetails"):x("projectDashboard.collapseDetails"),style:{display:"flex",alignItems:"center",justifyContent:"center",width:28,height:28,padding:0,background:"var(--bg-hover)",color:"var(--text-muted)",border:"1px solid var(--border)",borderRadius:6,cursor:"pointer"},children:(0,o.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:K?"rotate(180deg)":"none",transition:"transform 0.15s"},children:(0,o.jsx)("path",{d:"m6 15 6-6 6 6"})})})]})]}),(0,o.jsx)(j,{stats:G,quickFilter:W,sortBy:w,sortOrder:C,onQuickFilterChange:A,onSortToggle:er}),(0,o.jsx)(m,{viewMode:g,sortBy:w,sortOrder:C,searchQuery:D,onViewModeChange:b,onSortChange:(e,t)=>{k(e),S(t)},onSearchChange:B})]}),(0,o.jsx)("div",{...V.separatorProps,"data-testid":"dashboard-split-handle",title:x("projectDashboard.splitHint"),style:{height:10,flexShrink:0,cursor:"row-resize",display:"flex",alignItems:"center",justifyContent:"center",background:V.isResizing?"var(--bg-selected)":"transparent",borderTop:"1px solid var(--border)",borderBottom:"1px solid var(--border)",outline:"none",touchAction:"none"},children:(0,o.jsx)("div",{style:{width:44,height:3,borderRadius:2,background:V.isResizing?"var(--accent)":"var(--text-dim)",opacity:V.isResizing?1:.5,transition:"background 0.12s, opacity 0.12s"}})}),(0,o.jsxs)("div",{"data-testid":"dashboard-bottom-pane",style:{flex:1,minHeight:0,overflowY:"auto",padding:"12px 16px"},children:[(0,o.jsxs)("button",{type:"button","data-testid":"add-project-row",onClick:c,style:{display:"flex",alignItems:"center",justifyContent:"center",gap:6,width:"100%",padding:"8px 10px",marginBottom:10,background:"none",border:"1px dashed var(--border)",borderRadius:8,color:"var(--text-muted)",fontSize:12.5,fontWeight:500,cursor:"pointer"},children:[(0,o.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:(0,o.jsx)("path",{d:"M12 5v14M5 12h14"})}),x("projectDashboard.addProjectRow")]}),"grid"===g?(0,o.jsx)(f,{projects:ee,selectedProjects:L,onSelectProject:t,onToggleFavorite:X,onSelectionChange:E,onEditProject:e=>q(e.id),onContextMenu:es}):(0,o.jsx)(v,{projects:ee,selectedProjects:L,onSelectProject:t,onToggleFavorite:X,onSelectionChange:E,onEditProject:e=>q(e.id),onContextMenu:es}),0===ee.length&&(0,o.jsxs)("div",{style:{textAlign:"center",padding:"32px 16px",color:"var(--text-muted)"},children:[(0,o.jsx)("svg",{width:"40",height:"40",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"1.5",style:{marginBottom:10,opacity:.5},children:(0,o.jsx)("path",{d:"M22 19a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h5l2 3h9a2 2 0 0 1 2 2z"})}),(0,o.jsx)("h3",{style:{margin:"0 0 6px",fontSize:14,fontWeight:500},children:x("projectDashboard.noProjectsFound")}),(0,o.jsx)("p",{style:{margin:0,fontSize:12},children:x("projectDashboard.noProjectsHint")})]})]}),el&&(0,o.jsx)(z,{project:el,meta:F[el.id]??{},onSave:e=>Q(el.id,e),onClose:()=>q(null)}),_&&(0,o.jsx)(I,{projects:Z,metaMap:F,onSave:Q,onClose:()=>J(!1)}),ei&&(0,o.jsx)(y,{x:U?.x??0,y:U?.y??0,items:ea,onClose:()=>Y(null)}),P&&(0,o.jsx)("div",{role:"status",style:{position:"fixed",bottom:18,left:"50%",transform:"translateX(-50%)",padding:"7px 14px",background:"var(--bg-panel)",border:"1px solid var(--border)",borderRadius:999,fontSize:12,color:"var(--text)",boxShadow:"0 8px 24px rgba(0,0,0,0.28)",zIndex:3400,pointerEvents:"none"},children:P})]})}var B=r(19190);let W={padding:"7px 14px",background:"var(--accent)",border:"none",borderRadius:7,color:"white",fontSize:13,fontWeight:500,cursor:"pointer"},A={display:"inline-flex",alignItems:"center",gap:6,padding:"6px 10px",background:"var(--bg)",border:"1px solid var(--border)",borderRadius:7,color:"var(--text)",fontSize:12.5,cursor:"pointer"},L={width:"100%",padding:"7px 10px",background:"var(--bg)",border:"1px solid var(--border)",borderRadius:7,fontSize:13,color:"var(--text)",outline:"none",fontFamily:"inherit"},E={fontSize:10.5,fontWeight:600,color:"var(--text-muted)",textTransform:"uppercase",letterSpacing:.5,padding:"6px 9px 4px"},P={display:"flex",alignItems:"center",gap:8,width:"100%",padding:"7px 9px",background:"none",border:"1px solid transparent",borderRadius:7,cursor:"pointer",textAlign:"left"};function O({open:e,onClose:t,onSubmit:r,onBrowse:i,existingPaths:a,recentDirectories:s,startDirectory:l}){let{t:d}=(0,h.s)(),[c,u]=(0,n.useState)(""),[p,x]=(0,n.useState)([]),[g,b]=(0,n.useState)(!1),[f,v]=(0,n.useState)(0),[j,m]=(0,n.useState)(!1),[y,w]=(0,n.useState)(null),[k,S]=(0,n.useState)(null),[D,z]=(0,n.useState)(!1),[I,T]=(0,n.useState)(l),[M,R]=(0,n.useState)(""),F=(0,n.useRef)(null),H=(0,n.useMemo)(()=>(0,B.HL)([...a,...s.map(e=>e.path)],3),[a,s]),N=H.join("\0"),$=(0,n.useRef)(l);$.current=l;let q=(0,n.useRef)(!1);(0,n.useEffect)(()=>{if(e&&!q.current){u(""),v(0),w(null),S(null),z(!1),R(""),x([]),b(!1),T($.current);let e=window.setTimeout(()=>F.current?.focus(),30);return q.current=!0,()=>window.clearTimeout(e)}q.current=e},[e]);let _=(0,n.useRef)(a);_.current=a,(0,n.useEffect)(()=>{if(!e||0===N.length){x([]),b(!1);return}let t=!1;b(!0);let r=N.split("\0");return(async()=>{let e=new Set(_.current),o=[];await Promise.all(r.map(async t=>{try{let r=await fetch(`/api/cwd/browse?path=${encodeURIComponent(t)}`);if(!r.ok)return;for(let t of(await r.json()).directories??[])!e.has(t.path)&&((0,B.b2)(t.name)||o.push({path:t.path,label:t.name,kind:"sibling"}))}catch{}})),t||(o.sort((e,t)=>e.label.localeCompare(t.label)),x(o),b(!1))})(),()=>{t=!0}},[e,N]);let J=(0,n.useMemo)(()=>(0,B.QJ)([{path:l,label:(0,B.m5)(l),kind:"recent"},...s,...H.map(e=>({path:e,label:(0,B.m5)(e),kind:"sibling"}))]),[l,s,H]),U=I||J[0]?.path||"",Y=(0,n.useMemo)(()=>(0,B.qs)((0,B.QJ)([...s,...p],a),c),[s,p,a,c]),V=Y.filter(e=>"recent"===e.kind),K=Y.filter(e=>"sibling"===e.kind),Q=(0,B.Jn)(c)?c.trim():"",X=!!Q&&0===Y.length,Z=(0,n.useCallback)(async e=>{if(!j){m(!0),w(null);try{let o=await fetch("/api/cwd/validate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({cwd:e})}),n=await o.json().catch(()=>({}));if(o.ok&&n.cwd){r(n.cwd),t();return}let i=e.replace(/[\\/]+$/,""),a=Math.max(i.lastIndexOf("/"),i.lastIndexOf("\\"));if(a>0){let t=i.slice(0,a),r=i.slice(a+1);if((0,B.eG)(r).ok)return void S({parent:t,name:r,path:e})}w(n.error??d("projectDashboard.pathInvalid"))}catch(e){w(e instanceof Error?e.message:String(e))}finally{m(!1)}}},[j,t,r,d]),G=(0,n.useCallback)(async(e,o)=>{let n=(0,B.eG)(o);if(!n.ok)return void w(d(function(e){switch(e){case"empty":return"projectDashboard.folderNameEmpty";case"separator":case"relative":return"projectDashboard.folderNameSeparator";default:return"projectDashboard.folderNameInvalid"}}(n.error)));m(!0),w(null);try{let o=await fetch("/api/cwd/mkdir",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({parent:e,name:n.name})}),i=await o.json().catch(()=>({}));if(!o.ok||!i.cwd)return void w(i.error??d("projectDashboard.folderCreateFailed"));r(i.cwd),t()}catch(e){w(e instanceof Error?e.message:String(e))}finally{m(!1)}},[t,r,d]),ee=(0,n.useCallback)(e=>{let t=Y[e];t&&Z(t.path)},[Y,Z]),et=(0,n.useCallback)(e=>{if("ArrowDown"===e.key)e.preventDefault(),v(e=>Math.min(e+1,Math.max(Y.length-1,0)));else if("ArrowUp"===e.key)e.preventDefault(),v(e=>Math.max(e-1,0));else if("Enter"===e.key){if(e.preventDefault(),j)return;k?G(k.parent,k.name):Y.length>0?ee(Math.min(f,Y.length-1)):Q?Z(Q):D&&M.trim()&&G(U,M)}},[ee,f,j,G,U,Y,D,M,Q,k,Z]);if(!e)return null;let er=(e,t)=>{let r=t===f;return(0,o.jsxs)("button",{type:"button","data-testid":"quick-create-candidate","data-candidate-path":e.path,onMouseEnter:()=>v(t),onClick:()=>ee(t),style:{...P,background:r?"var(--bg-selected)":"none",borderColor:r?"var(--accent)":"transparent"},children:[(0,o.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",style:{flexShrink:0,color:"var(--text-muted)"},children:(0,o.jsx)("path",{d:"M1.5 3h4l1.5 2h7.5v7.5h-13z"})}),(0,o.jsxs)("span",{style:{flex:1,minWidth:0},children:[(0,o.jsx)("span",{style:{display:"block",fontSize:13,color:"var(--text)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.label}),(0,o.jsx)("span",{style:{display:"block",fontSize:10.5,color:"var(--text-dim)",overflow:"hidden",textOverflow:"ellipsis",whiteSpace:"nowrap"},children:e.path})]}),e.hint&&(0,o.jsxs)("span",{style:{flexShrink:0,fontSize:10.5,color:"var(--text-dim)"},children:[e.hint," ",d("projectDashboard.sessions")]})]},e.path)};return(0,o.jsxs)(C,{title:d("projectDashboard.newProjectTitle"),onClose:t,wide:!0,testId:"quick-create-panel",children:[(0,o.jsx)("input",{ref:F,"data-testid":"quick-create-input",value:c,onChange:e=>{u(e.target.value),v(0),S(null)},onKeyDown:et,placeholder:d("projectDashboard.searchOrPath"),style:{...L,marginBottom:10}}),k&&(0,o.jsxs)("div",{"data-testid":"quick-create-confirm",style:{display:"flex",alignItems:"center",gap:8,padding:10,marginBottom:10,background:"var(--bg-subtle)",border:"1px solid var(--border)",borderRadius:8},children:[(0,o.jsxs)("div",{style:{flex:1,minWidth:0},children:[(0,o.jsx)("div",{style:{fontSize:12.5,color:"var(--text)"},children:d("projectDashboard.pathNotFound")}),(0,o.jsx)("div",{style:{fontSize:11,color:"var(--text-dim)",wordBreak:"break-all"},children:k.path})]}),(0,o.jsx)("button",{type:"button","data-testid":"quick-create-confirm-create",disabled:j,onClick:()=>void G(k.parent,k.name),style:{...W,opacity:j?.6:1},children:d("projectDashboard.createThisFolder")}),(0,o.jsx)("button",{type:"button",onClick:()=>S(null),style:A,children:d("projectDashboard.cancel")})]}),X&&!k&&(0,o.jsxs)("button",{type:"button","data-testid":"quick-create-use-path",onClick:()=>void Z(Q),disabled:j,style:{...P,background:"var(--bg-selected)",borderColor:"var(--accent)",marginBottom:10},children:[(0,o.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",style:{flexShrink:0},children:(0,o.jsx)("path",{d:"M1.5 3h4l1.5 2h7.5v7.5h-13z"})}),(0,o.jsxs)("span",{style:{flex:1,minWidth:0},children:[(0,o.jsx)("span",{style:{display:"block",fontSize:12,color:"var(--text-muted)"},children:d("projectDashboard.useThisPath")}),(0,o.jsx)("span",{style:{display:"block",fontSize:12.5,color:"var(--text)",wordBreak:"break-all"},children:Q})]}),(0,o.jsx)("span",{style:{flexShrink:0,fontSize:11,color:"var(--text-dim)"},children:"⏎"})]}),(0,o.jsxs)("div",{style:{maxHeight:300,overflowY:"auto"},children:[V.length>0&&(0,o.jsxs)("div",{style:{marginBottom:8},children:[(0,o.jsx)("div",{style:E,children:d("projectDashboard.recentUsed")}),V.map(e=>er(e,Y.indexOf(e)))]}),(K.length>0||g)&&(0,o.jsxs)("div",{children:[(0,o.jsx)("div",{style:E,children:d("projectDashboard.siblingDirs")}),g&&0===K.length&&(0,o.jsx)("div",{style:{padding:"6px 9px",fontSize:12,color:"var(--text-dim)"},children:d("projectDashboard.scanning")}),K.map(e=>er(e,Y.indexOf(e)))]}),0===Y.length&&!X&&!k&&(0,o.jsx)("div",{style:{padding:"18px 8px",textAlign:"center",fontSize:12.5,color:"var(--text-muted)"},children:d("projectDashboard.noMatches")})]}),D&&(0,o.jsxs)("div",{"data-testid":"quick-create-folder-form",style:{marginTop:10,padding:10,background:"var(--bg-subtle)",border:"1px solid var(--border)",borderRadius:8,display:"flex",flexDirection:"column",gap:8},children:[(0,o.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,o.jsx)("select",{value:U,onChange:e=>T(e.target.value),"aria-label":d("projectDashboard.parentDir"),style:{...L,flex:1,cursor:"pointer"},children:J.map(e=>(0,o.jsx)("option",{value:e.path,children:e.path},e.path))}),(0,o.jsx)("input",{"data-testid":"quick-create-folder-name",value:M,onChange:e=>R(e.target.value),onKeyDown:et,placeholder:d("projectDashboard.folderName"),style:{...L,flex:1}})]}),(0,o.jsxs)("div",{style:{display:"flex",justifyContent:"flex-end",gap:8},children:[(0,o.jsx)("button",{type:"button",onClick:()=>z(!1),style:A,children:d("projectDashboard.cancel")}),(0,o.jsx)("button",{type:"button","data-testid":"quick-create-folder-submit",disabled:j||!M.trim()||!U,onClick:()=>void G(U,M),style:{...W,opacity:j||!M.trim()?.6:1},children:d("projectDashboard.create")})]}),(0,o.jsx)("div",{style:{fontSize:11,color:"var(--text-dim)"},children:(0,B.as)(U,M.trim()||"…")})]}),y&&(0,o.jsx)("div",{"data-testid":"quick-create-error",style:{marginTop:10,fontSize:12,color:"#ef4444"},children:y}),(0,o.jsxs)("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,marginTop:12},children:[(0,o.jsxs)("div",{style:{display:"flex",gap:8},children:[(0,o.jsxs)("button",{type:"button","data-testid":"quick-create-browse",onClick:i,style:A,children:[(0,o.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 16 16",fill:"none",stroke:"currentColor",strokeWidth:"1.3",children:(0,o.jsx)("path",{d:"M1.5 3h4l1.5 2h7.5v7.5h-13z"})}),d("projectDashboard.browse")]}),(0,o.jsxs)("button",{type:"button","data-testid":"quick-create-new-folder",onClick:()=>z(e=>!e),style:A,children:[(0,o.jsx)("svg",{width:"13",height:"13",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",children:(0,o.jsx)("path",{d:"M12 5v14M5 12h14"})}),d("projectDashboard.newFolder")]})]}),(0,o.jsx)("span",{style:{fontSize:11,color:"var(--text-dim)",whiteSpace:"nowrap"},children:d("projectDashboard.keyboardHint")})]})]})}}}]);