tower-studio 0.1.8 → 0.1.10

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 (188) hide show
  1. package/.next/BUILD_ID +1 -1
  2. package/.next/build-manifest.json +3 -3
  3. package/.next/cache/.previewinfo +1 -1
  4. package/.next/cache/.rscinfo +1 -1
  5. package/.next/cache/.tsbuildinfo +1 -1
  6. package/.next/diagnostics/route-bundle-stats.json +47 -47
  7. package/.next/fallback-build-manifest.json +3 -3
  8. package/.next/prerender-manifest.json +3 -3
  9. package/.next/server/app/_global-error.html +1 -1
  10. package/.next/server/app/_global-error.rsc +1 -1
  11. package/.next/server/app/_global-error.segments/__PAGE__.segment.rsc +1 -1
  12. package/.next/server/app/_global-error.segments/_full.segment.rsc +1 -1
  13. package/.next/server/app/_global-error.segments/_head.segment.rsc +1 -1
  14. package/.next/server/app/_global-error.segments/_index.segment.rsc +1 -1
  15. package/.next/server/app/_global-error.segments/_tree.segment.rsc +1 -1
  16. package/.next/server/app/_not-found/page/react-loadable-manifest.json +1 -1
  17. package/.next/server/app/_not-found/page/server-reference-manifest.json +19 -19
  18. package/.next/server/app/_not-found/page.js.nft.json +1 -1
  19. package/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  20. package/.next/server/app/_not-found.html +1 -1
  21. package/.next/server/app/_not-found.rsc +14 -14
  22. package/.next/server/app/_not-found.segments/_full.segment.rsc +14 -14
  23. package/.next/server/app/_not-found.segments/_head.segment.rsc +4 -4
  24. package/.next/server/app/_not-found.segments/_index.segment.rsc +9 -9
  25. package/.next/server/app/_not-found.segments/_not-found/__PAGE__.segment.rsc +2 -2
  26. package/.next/server/app/_not-found.segments/_not-found.segment.rsc +3 -3
  27. package/.next/server/app/_not-found.segments/_tree.segment.rsc +2 -2
  28. package/.next/server/app/api/browse-fs/route.js.nft.json +1 -1
  29. package/.next/server/app/api/files/assets/[projectId]/[filename]/route.js.nft.json +1 -1
  30. package/.next/server/app/api/git/route.js.nft.json +1 -1
  31. package/.next/server/app/api/internal/assets/[projectId]/[filename]/route.js.nft.json +1 -1
  32. package/.next/server/app/api/internal/assets/reveal/route.js.nft.json +1 -1
  33. package/.next/server/app/api/internal/assistant/chat/route.js.nft.json +1 -1
  34. package/.next/server/app/api/internal/assistant/images/route.js.nft.json +1 -1
  35. package/.next/server/app/api/internal/assistant/sessions/route.js.nft.json +1 -1
  36. package/.next/server/app/api/internal/cache/[...segments]/route.js.nft.json +1 -1
  37. package/.next/server/app/api/internal/hooks/upload/route.js.nft.json +1 -1
  38. package/.next/server/app/api/internal/terminal/[taskId]/start/route.js.nft.json +1 -1
  39. package/.next/server/app/api/tasks/[taskId]/merge/route.js.nft.json +1 -1
  40. package/.next/server/app/index.html +1 -1
  41. package/.next/server/app/index.rsc +14 -14
  42. package/.next/server/app/index.segments/__PAGE__.segment.rsc +2 -2
  43. package/.next/server/app/index.segments/_full.segment.rsc +14 -14
  44. package/.next/server/app/index.segments/_head.segment.rsc +4 -4
  45. package/.next/server/app/index.segments/_index.segment.rsc +9 -9
  46. package/.next/server/app/index.segments/_tree.segment.rsc +2 -2
  47. package/.next/server/app/missions/page/react-loadable-manifest.json +1 -1
  48. package/.next/server/app/missions/page/server-reference-manifest.json +49 -49
  49. package/.next/server/app/missions/page.js.nft.json +1 -1
  50. package/.next/server/app/missions/page_client-reference-manifest.js +1 -1
  51. package/.next/server/app/onboarding/page/react-loadable-manifest.json +1 -1
  52. package/.next/server/app/onboarding/page/server-reference-manifest.json +19 -19
  53. package/.next/server/app/onboarding/page.js.nft.json +1 -1
  54. package/.next/server/app/onboarding/page_client-reference-manifest.js +1 -1
  55. package/.next/server/app/onboarding.html +1 -1
  56. package/.next/server/app/onboarding.rsc +16 -16
  57. package/.next/server/app/onboarding.segments/_full.segment.rsc +16 -16
  58. package/.next/server/app/onboarding.segments/_head.segment.rsc +4 -4
  59. package/.next/server/app/onboarding.segments/_index.segment.rsc +9 -9
  60. package/.next/server/app/onboarding.segments/_tree.segment.rsc +2 -2
  61. package/.next/server/app/onboarding.segments/onboarding/__PAGE__.segment.rsc +4 -4
  62. package/.next/server/app/onboarding.segments/onboarding.segment.rsc +3 -3
  63. package/.next/server/app/page/react-loadable-manifest.json +1 -1
  64. package/.next/server/app/page/server-reference-manifest.json +19 -19
  65. package/.next/server/app/page.js.nft.json +1 -1
  66. package/.next/server/app/page_client-reference-manifest.js +1 -1
  67. package/.next/server/app/settings/page/react-loadable-manifest.json +1 -1
  68. package/.next/server/app/settings/page/server-reference-manifest.json +28 -28
  69. package/.next/server/app/settings/page.js.nft.json +1 -1
  70. package/.next/server/app/settings/page_client-reference-manifest.js +1 -1
  71. package/.next/server/app/settings.html +1 -1
  72. package/.next/server/app/settings.rsc +16 -16
  73. package/.next/server/app/settings.segments/_full.segment.rsc +16 -16
  74. package/.next/server/app/settings.segments/_head.segment.rsc +4 -4
  75. package/.next/server/app/settings.segments/_index.segment.rsc +9 -9
  76. package/.next/server/app/settings.segments/_tree.segment.rsc +2 -2
  77. package/.next/server/app/settings.segments/settings/__PAGE__.segment.rsc +4 -4
  78. package/.next/server/app/settings.segments/settings.segment.rsc +3 -3
  79. package/.next/server/app/workspaces/[workspaceId]/archive/page/react-loadable-manifest.json +1 -1
  80. package/.next/server/app/workspaces/[workspaceId]/archive/page/server-reference-manifest.json +73 -73
  81. package/.next/server/app/workspaces/[workspaceId]/archive/page.js.nft.json +1 -1
  82. package/.next/server/app/workspaces/[workspaceId]/archive/page_client-reference-manifest.js +1 -1
  83. package/.next/server/app/workspaces/[workspaceId]/assets/page/react-loadable-manifest.json +1 -1
  84. package/.next/server/app/workspaces/[workspaceId]/assets/page/server-reference-manifest.json +62 -62
  85. package/.next/server/app/workspaces/[workspaceId]/assets/page.js.nft.json +1 -1
  86. package/.next/server/app/workspaces/[workspaceId]/assets/page_client-reference-manifest.js +1 -1
  87. package/.next/server/app/workspaces/[workspaceId]/notes/page/react-loadable-manifest.json +1 -1
  88. package/.next/server/app/workspaces/[workspaceId]/notes/page/server-reference-manifest.json +51 -51
  89. package/.next/server/app/workspaces/[workspaceId]/notes/page.js.nft.json +1 -1
  90. package/.next/server/app/workspaces/[workspaceId]/notes/page_client-reference-manifest.js +1 -1
  91. package/.next/server/app/workspaces/[workspaceId]/page/react-loadable-manifest.json +1 -1
  92. package/.next/server/app/workspaces/[workspaceId]/page/server-reference-manifest.json +47 -47
  93. package/.next/server/app/workspaces/[workspaceId]/page.js.nft.json +1 -1
  94. package/.next/server/app/workspaces/[workspaceId]/page_client-reference-manifest.js +1 -1
  95. package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/react-loadable-manifest.json +1 -1
  96. package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page/server-reference-manifest.json +19 -19
  97. package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page.js.nft.json +1 -1
  98. package/.next/server/app/workspaces/[workspaceId]/projects/[projectId]/page_client-reference-manifest.js +1 -1
  99. package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/react-loadable-manifest.json +1 -1
  100. package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page/server-reference-manifest.json +48 -48
  101. package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page.js.nft.json +1 -1
  102. package/.next/server/app/workspaces/[workspaceId]/tasks/[taskId]/page_client-reference-manifest.js +1 -1
  103. package/.next/server/app/workspaces/page/react-loadable-manifest.json +1 -1
  104. package/.next/server/app/workspaces/page/server-reference-manifest.json +39 -39
  105. package/.next/server/app/workspaces/page.js.nft.json +1 -1
  106. package/.next/server/app/workspaces/page_client-reference-manifest.js +1 -1
  107. package/.next/server/chunks/10ge_next_dist_esm_build_templates_app-route_13~vb_i.js +1 -1
  108. package/.next/server/chunks/[root-of-the-server]__043lk8~._.js +1 -1
  109. package/.next/server/chunks/ssr/0~.g_src_app_workspaces_[workspaceId]_tasks_[taskId]_task-page-client_tsx_0bbseig._.js +1 -1
  110. package/.next/server/chunks/ssr/[root-of-the-server]__0.8y0n9._.js +1 -1
  111. package/.next/server/chunks/ssr/[root-of-the-server]__01ws4-7._.js +1 -1
  112. package/.next/server/chunks/ssr/[root-of-the-server]__02ipahf._.js +1 -1
  113. package/.next/server/chunks/ssr/{[root-of-the-server]__0~jc3l5._.js → [root-of-the-server]__08_0ex9._.js} +2 -2
  114. package/.next/server/chunks/ssr/[root-of-the-server]__0bk3s4l._.js +1 -1
  115. package/.next/server/chunks/ssr/{[root-of-the-server]__0hvz_0c._.js → [root-of-the-server]__0bo1n69._.js} +2 -2
  116. package/.next/server/chunks/ssr/[root-of-the-server]__0ld6_w6._.js +3 -0
  117. package/.next/server/chunks/ssr/[root-of-the-server]__0l~dc3x._.js +1 -1
  118. package/.next/server/chunks/ssr/[root-of-the-server]__0rs7pkn._.js +1 -1
  119. package/.next/server/chunks/ssr/[root-of-the-server]__0sysz2q._.js +3 -3
  120. package/.next/server/chunks/ssr/[root-of-the-server]__0y-lkvf._.js +1 -1
  121. package/.next/server/chunks/ssr/[root-of-the-server]__12f810l._.js +1 -1
  122. package/.next/server/chunks/ssr/{tower_02he7d6._.js → tower_0donrdk._.js} +2 -2
  123. package/.next/server/chunks/ssr/{tower_0gzwyem._.js → tower_0i9k4a6._.js} +2 -2
  124. package/.next/server/chunks/ssr/tower_0kl_bfy._.js +1 -1
  125. package/.next/server/chunks/ssr/tower_0m_uudm._.js +3 -0
  126. package/.next/server/chunks/ssr/{tower_0vo6u9i._.js → tower_0mn8ig7._.js} +2 -2
  127. package/.next/server/chunks/ssr/tower_0mz4ut.._.js +1 -1
  128. package/.next/server/chunks/ssr/tower_0pcqezm._.js +1 -1
  129. package/.next/server/chunks/ssr/{tower_00.hg6u._.js → tower_0pmey24._.js} +2 -2
  130. package/.next/server/chunks/ssr/{tower_09~lpto._.js → tower_0ut7r._._.js} +2 -2
  131. package/.next/server/chunks/ssr/tower_0wvk~r.._.js +1 -1
  132. package/.next/server/chunks/ssr/tower_10p15te._.js +1 -1
  133. package/.next/server/chunks/ssr/tower_117pzh8._.js +1 -1
  134. package/.next/server/chunks/ssr/tower_11q5_.m._.js +1 -1
  135. package/.next/server/chunks/ssr/tower_138qlx5._.js +1 -1
  136. package/.next/server/chunks/ssr/tower_src_077qk8s._.js +3 -0
  137. package/.next/server/chunks/ssr/tower_src_actions_agent-actions_ts_0j.e1tn._.js +1 -1
  138. package/.next/server/chunks/ssr/tower_src_actions_file-actions_ts_0424lna._.js +1 -1
  139. package/.next/server/chunks/ssr/tower_src_app_missions_missions-client_tsx_0a9vjyr._.js +1 -1
  140. package/.next/server/chunks/ssr/tower_src_app_onboarding_page_tsx_0_3krz1._.js +1 -1
  141. package/.next/server/chunks/ssr/tower_src_app_settings_page_tsx_0vo5e-o._.js +1 -1
  142. package/.next/server/chunks/ssr/tower_src_app_workspaces_[workspaceId]_assets_assets-page-client_tsx_0zfgzhi._.js +1 -1
  143. package/.next/server/chunks/ssr/tower_src_app_workspaces_[workspaceId]_board-page-client_tsx_0kjp1u0._.js +1 -1
  144. package/.next/server/chunks/tower_0a-x6m.._.js +1 -1
  145. package/.next/server/chunks/tower_src_0..vg-t._.js +1 -1
  146. package/.next/server/instrumentation.js.nft.json +1 -1
  147. package/.next/server/middleware-build-manifest.js +3 -3
  148. package/.next/server/pages/404.html +1 -1
  149. package/.next/server/pages/500.html +1 -1
  150. package/.next/server/server-reference-manifest.js +1 -1
  151. package/.next/server/server-reference-manifest.json +182 -182
  152. package/.next/static/chunks/{0kubr70r_r2f2.js → 0-z_mj0p3..hy.js} +1 -1
  153. package/.next/static/chunks/{0drgc-oztq6o-.css → 04pjsuj.mivbh.css} +1 -1
  154. package/.next/static/chunks/{0_.pyr2jhdqa2.js → 053~3fys7om-7.js} +2 -2
  155. package/.next/static/chunks/0887ab.hh21q9.js +1 -0
  156. package/.next/static/chunks/0c7oqfzd78s3-.js +1 -0
  157. package/.next/static/chunks/{0z-ecklemrfx-.js → 0g4scpy5b3a_n.js} +1 -1
  158. package/.next/static/chunks/{0kc-95qs2~eid.js → 0ho7y42kl8m7v.js} +1 -1
  159. package/.next/static/chunks/0iudqcn98ftki.js +1 -0
  160. package/.next/static/chunks/{0-64z7pmj57~d.js → 0j~wmjbqds1dv.js} +1 -1
  161. package/.next/static/chunks/0mvu29h4.06~b.js +1 -0
  162. package/.next/static/chunks/{0a2blrvqw8t5y.js → 0rej~f94o9a~6.js} +1 -1
  163. package/.next/static/chunks/{0z61ts2ro9_k3.js → 0xi0wi2z6otp9.js} +1 -1
  164. package/.next/static/chunks/{05j6t69jmpqju.js → 16qoc.u84jlcd.js} +1 -1
  165. package/.next/static/chunks/17tob96chk6i1.js +1 -0
  166. package/.next/static/chunks/17zywpt-0o8gl.js +1 -0
  167. package/.next/static/chunks/{00xbbu.nlx92z.js → 185n7s7fwb2j_.js} +1 -1
  168. package/.next/trace +2 -2
  169. package/.next/trace-build +1 -1
  170. package/bin/tower.mjs +36 -8
  171. package/package.json +10 -4
  172. package/scripts/generate-prisma-client.js +43 -0
  173. package/scripts/link-prisma.js +144 -0
  174. package/scripts/post-tool-hook.js +188 -0
  175. package/scripts/session-start-hook.js +79 -0
  176. package/scripts/stop-hook.js +78 -0
  177. package/.next/server/chunks/ssr/[root-of-the-server]__0mab0km._.js +0 -3
  178. package/.next/server/chunks/ssr/tower_12sld1c._.js +0 -3
  179. package/.next/server/chunks/ssr/tower_src_08t.wy-._.js +0 -3
  180. package/.next/static/chunks/049.9ha2n6os5.js +0 -1
  181. package/.next/static/chunks/07a_xadb-3w1a.js +0 -1
  182. package/.next/static/chunks/0_c8duf92i~xg.js +0 -1
  183. package/.next/static/chunks/0kojsk~4uroqj.js +0 -1
  184. package/.next/static/chunks/0kt2vohpgb7h6.js +0 -1
  185. package/.next/static/chunks/0ttrpz.l-v-yv.js +0 -1
  186. /package/.next/static/{6AW1vTU7iJEkEhqIH0txT → KX5Si-44bPnjdFNmiHDRY}/_buildManifest.js +0 -0
  187. /package/.next/static/{6AW1vTU7iJEkEhqIH0txT → KX5Si-44bPnjdFNmiHDRY}/_clientMiddlewareManifest.js +0 -0
  188. /package/.next/static/{6AW1vTU7iJEkEhqIH0txT → KX5Si-44bPnjdFNmiHDRY}/_ssgManifest.js +0 -0
@@ -80,4 +80,4 @@ out vec4 outColor;
80
80
 
81
81
  void main() {
82
82
  outColor = v_color;
83
- }`,o0=8*Float32Array.BYTES_PER_ELEMENT,o1=class{constructor(){this.attributes=new Float32Array(160),this.count=0}},o5=0,o2=0,o3=0,o4=0,o6=0,o8=0,o7=0,o9=class extends np{constructor(e,i,s,r){super(),this._terminal=e,this._gl=i,this._dimensions=s,this._themeService=r,this._vertices=new o1,this._verticesCursor=new o1;let n=this._gl;this._program=n$(oz(n,oJ,oQ)),this._register(nf(()=>n.deleteProgram(this._program))),this._projectionLocation=n$(n.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=n.createVertexArray(),n.bindVertexArray(this._vertexArrayObject);let o=new Float32Array([0,0,1,0,0,1,1,1]),a=n.createBuffer();this._register(nf(()=>n.deleteBuffer(a))),n.bindBuffer(n.ARRAY_BUFFER,a),n.bufferData(n.ARRAY_BUFFER,o,n.STATIC_DRAW),n.enableVertexAttribArray(3),n.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let h=new Uint8Array([0,1,2,3]),l=n.createBuffer();this._register(nf(()=>n.deleteBuffer(l))),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,l),n.bufferData(n.ELEMENT_ARRAY_BUFFER,h,n.STATIC_DRAW),this._attributesBuffer=n$(n.createBuffer()),this._register(nf(()=>n.deleteBuffer(this._attributesBuffer))),n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.enableVertexAttribArray(0),n.vertexAttribPointer(0,2,n.FLOAT,!1,o0,0),n.vertexAttribDivisor(0,1),n.enableVertexAttribArray(1),n.vertexAttribPointer(1,2,n.FLOAT,!1,o0,2*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(1,1),n.enableVertexAttribArray(2),n.vertexAttribPointer(2,4,n.FLOAT,!1,o0,4*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let i=this._gl;i.useProgram(this._program),i.bindVertexArray(this._vertexArrayObject),i.uniformMatrix4fv(this._projectionLocation,!1,oF),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.bufferData(i.ARRAY_BUFFER,e.attributes,i.DYNAMIC_DRAW),i.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,i.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let i=this._terminal,s=this._vertices,r=1,n,o,a,h,l,c,d,_,u,f,g;for(n=0;n<i.rows;n++){for(a=-1,h=0,l=0,c=!1,o=0;o<i.cols;o++)d=(n*i.cols+o)*4,_=e.cells[d+1],f=!!(0x4000000&(u=e.cells[d+2])),(_!==h||u!==l&&(c||f))&&((0!==h||c&&0!==l)&&(g=8*r++,this._updateRectangle(s,g,l,h,a,o,n)),a=o,h=_,l=u,c=f);(0!==h||c&&0!==l)&&(g=8*r++,this._updateRectangle(s,g,l,h,a,i.cols,n))}s.count=r}updateCursor(e){let i=this._verticesCursor,s=e.cursor;if(!s||"block"===s.style){i.count=0;return}let r,n=0;("bar"===s.style||"outline"===s.style)&&(r=8*n++,this._addRectangleFloat(i.attributes,r,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,"bar"===s.style?s.dpr*s.cursorWidth:s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),("underline"===s.style||"outline"===s.style)&&(r=8*n++,this._addRectangleFloat(i.attributes,r,s.x*this._dimensions.device.cell.width,(s.y+1)*this._dimensions.device.cell.height-s.dpr,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat)),"outline"===s.style&&(r=8*n++,this._addRectangleFloat(i.attributes,r,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat),r=8*n++,this._addRectangleFloat(i.attributes,r,(s.x+s.width)*this._dimensions.device.cell.width-s.dpr,s.y*this._dimensions.device.cell.height,s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),i.count=n}_updateRectangle(e,i,s,r,n,o,a){if(0x4000000&s)switch(0x3000000&s){case 0x1000000:case 0x2000000:o5=this._themeService.colors.ansi[255&s].rgba;break;case 0x3000000:o5=(0xffffff&s)<<8;break;default:o5=this._themeService.colors.foreground.rgba}else switch(0x3000000&r){case 0x1000000:case 0x2000000:o5=this._themeService.colors.ansi[255&r].rgba;break;case 0x3000000:o5=(0xffffff&r)<<8;break;default:o5=this._themeService.colors.background.rgba}e.attributes.length<i+4&&(e.attributes=function(e,i){let s=new Float32Array(Math.min(2*e.length,i));for(let i=0;i<e.length;i++)s[i]=e[i];return s}(e.attributes,this._terminal.rows*this._terminal.cols*8)),o2=n*this._dimensions.device.cell.width,o3=a*this._dimensions.device.cell.height,o4=(o5>>24&255)/255,o6=(o5>>16&255)/255,o8=(o5>>8&255)/255,o7=1,this._addRectangle(e.attributes,i,o2,o3,(o-n)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,o4,o6,o8,o7)}_addRectangle(e,i,s,r,n,o,a,h,l,c){e[i]=s/this._dimensions.device.canvas.width,e[i+1]=r/this._dimensions.device.canvas.height,e[i+2]=n/this._dimensions.device.canvas.width,e[i+3]=o/this._dimensions.device.canvas.height,e[i+4]=a,e[i+5]=h,e[i+6]=l,e[i+7]=c}_addRectangleFloat(e,i,s,r,n,o,a){e[i]=s/this._dimensions.device.canvas.width,e[i+1]=r/this._dimensions.device.canvas.height,e[i+2]=n/this._dimensions.device.canvas.width,e[i+3]=o/this._dimensions.device.canvas.height,e[i+4]=a[0],e[i+5]=a[1],e[i+6]=a[2],e[i+7]=a[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(255&e.rgba)/255])}},ae=class extends np{constructor(e,i,s,r,n,o,a,h){super(),this._container=i,this._alpha=n,this._coreBrowserService=o,this._optionsService=a,this._themeService=h,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${s}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(i=>{this._refreshCharAtlas(e,i),this.reset(e)})),this._register(nf(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=n$(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,i,s){}handleSelectionChanged(e,i,s,r=!1){}_setTransparency(e,i){if(i===this._alpha)return;let s=this._canvas;this._alpha=i,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,s),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,i){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=oP(e,this._optionsService.rawOptions,i,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,i){this._deviceCellWidth=i.device.cell.width,this._deviceCellHeight=i.device.cell.height,this._deviceCharWidth=i.device.char.width,this._deviceCharHeight=i.device.char.height,this._deviceCharLeft=i.device.char.left,this._deviceCharTop=i.device.char.top,this._canvas.width=i.device.canvas.width,this._canvas.height=i.device.canvas.height,this._canvas.style.width=`${i.css.canvas.width}px`,this._canvas.style.height=`${i.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,i,s=1){this._ctx.fillRect(e*this._deviceCellWidth,(i+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,s*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,i,s,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,i*this._deviceCellHeight,s*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,i*this._deviceCellHeight,s*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,i,s,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=n4,this._clipCell(s,r,i.getWidth()),this._ctx.fillText(i.getChars(),s*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,i,s){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,i*this._deviceCellHeight,s*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,i,s){let r=i?e.options.fontWeightBold:e.options.fontWeight;return`${s?"italic":""} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},at=class extends ae{constructor(e,i,s,r,n,o,a){super(s,e,"link",i,!0,n,o,a),this._register(r.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(r.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(e,i){super.resize(e,i),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){var i;if(257===e.fg?this._ctx.fillStyle=this._themeService.colors.background.css:void 0!==e.fg&&((0x3000000&(i=e.fg))==0x1000000||(0x3000000&i)==0x2000000)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let i=e.y1+1;i<e.y2;i++)this._fillBottomLineAtCells(0,i,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},ai="object"==typeof window?window:globalThis,as=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ok,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ok,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,e),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,e),this._onDidChangeFullscreen.fire(s)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};as.INSTANCE=new as,as.INSTANCE.onDidChangeZoomLevel,as.INSTANCE.onDidChangeFullscreen;var ar="object"==typeof navigator?navigator.userAgent:"";ar.indexOf("Firefox"),ar.indexOf("AppleWebKit"),ar.indexOf("Chrome")>=0||ar.indexOf("Safari"),ar.indexOf("Electron/"),ar.indexOf("Android");var an=!1;if("function"==typeof ai.matchMedia){let e=ai.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),i=ai.matchMedia("(display-mode: fullscreen)");an=e.matches,ao=e,"string"==typeof ao&&(ao=ai.matchMedia(ao)),ao.addEventListener("change",({matches:e})=>{an&&i.matches||(an=e)})}var ao,aa,ah,al=!1,ac=!1,ad="en",a_=globalThis;"u">typeof a_.vscode&&"u">typeof a_.vscode.process?ah=a_.vscode.process:"u">typeof x.default&&"string"==typeof x.default?.versions?.node&&(ah=x.default);var au="string"==typeof ah?.versions?.electron&&ah?.type==="renderer";if("object"==typeof ah){ah.platform,ah.platform,"linux"===ah.platform&&ah.env.SNAP&&ah.env.SNAP_REVISION,ah.env.CI||ah.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ad="en";let e=ah.env.VSCODE_NLS_CONFIG;if(e)try{let i=JSON.parse(e);i.userLocale,i.osLocale,ad=i.resolvedLanguage||"en",i.languagePack?.translationsConfigFile}catch{}al=!0}else"object"!=typeof navigator||au?console.error("Unable to resolve platform."):((aa=navigator.userAgent).indexOf("Windows"),aa.indexOf("Macintosh"),(aa.indexOf("Macintosh")>=0||aa.indexOf("iPad")>=0||aa.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,aa.indexOf("Linux"),aa?.indexOf("Mobi"),ac=!0,ad=globalThis._VSCODE_NLS_LANGUAGE||"en",navigator.language.toLowerCase());var af=al;ac&&"function"==typeof a_.importScripts&&a_.origin;var ag,ap=aa,av=ad;(aL=ag||={}).value=function(){return av},aL.isDefaultVariant=function(){return 2===av.length?"en"===av:av.length>=3&&"e"===av[0]&&"n"===av[1]&&"-"===av[2]},aL.isDefault=function(){return"en"===av};var am="function"==typeof a_.postMessage&&!a_.importScripts,aS=(()=>{if(am){let e=[];a_.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.id===i.data.vscodeScheduleAsyncWork){e.splice(s,1),r.callback();return}}});let i=0;return s=>{let r=++i;e.push({id:r,callback:s}),a_.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})(),aw=!!(ap&&ap.indexOf("Chrome")>=0);ap&&ap.indexOf("Firefox"),!aw&&ap&&ap.indexOf("Safari"),ap&&ap.indexOf("Edg/"),ap&&ap.indexOf("Android");var ab="object"==typeof navigator?navigator:{};af||document.queryCommandSupported&&document.queryCommandSupported("copy")||ab&&ab.clipboard&&ab.clipboard.writeText,af||ab&&ab.clipboard&&ab.clipboard.readText,af||an||ab.keyboard,"ontouchstart"in ai||ab.maxTouchPoints,ai.PointerEvent&&("ontouchstart"in ai||navigator.maxTouchPoints);var aC=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,i){this._keyCodeToStr[e]=i,this._strToKeyCode[i.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},ay=new aC,ax=new aC,ak=new aC;(aM=aE||={}).toString=function(e){return ay.keyCodeToStr(e)},aM.fromString=function(e){return ay.strToKeyCode(e)},aM.toUserSettingsUS=function(e){return ax.keyCodeToStr(e)},aM.toUserSettingsGeneral=function(e){return ak.keyCodeToStr(e)},aM.fromUserSettings=function(e){return ax.strToKeyCode(e)||ak.strToKeyCode(e)},aM.toElectronAccelerator=function(e){if(e>=98&&e<=113)return null;switch(e){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return ay.keyCodeToStr(e)};var aL,aM,aE,aR,aB=Object.freeze(function(e,i){let s=setTimeout(e.bind(i),0);return{dispose(){clearTimeout(s)}}});(S=aR||={}).isCancellationToken=function(e){return e===S.None||e===S.Cancelled||e instanceof aD||!!e&&"object"==typeof e&&"boolean"==typeof e.isCancellationRequested&&"function"==typeof e.onCancellationRequested},S.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ov.None}),S.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:aB});var aD=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?aB:(this._emitter||(this._emitter=new ok),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};Symbol("MicrotaskDelay"),(w=b||={}).settled=async function(e){let i,s=await Promise.all(e.map(e=>e.then(e=>e,e=>{i||(i=e)})));if("u">typeof i)throw i;return s},w.withAsyncBody=function(e){return new Promise(async(i,s)=>{try{await e(i,s)}catch(e){s(e)}})};var aT=class e{static fromArray(i){return new e(e=>{e.emitMany(i)})}static fromPromise(i){return new e(async e=>{e.emitMany(await i)})}static fromPromises(i){return new e(async e=>{await Promise.all(i.map(async i=>e.emitOne(await i)))})}static merge(i){return new e(async e=>{await Promise.all(i.map(async i=>{for await(let s of i)e.emitOne(s)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new ok,queueMicrotask(async()=>{let i={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(i)),this.resolve()}catch(e){this.reject(e)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{for(;;){if(2===this._state)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(1===this._state)return{done:!0,value:void 0};await ov.toPromise(this._onStateChanged.event)}},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(i,s){return new e(async e=>{for await(let r of i)e.emitOne(s(r))})}map(i){return e.map(this,i)}static filter(i,s){return new e(async e=>{for await(let r of i)s(r)&&e.emitOne(r)})}filter(i){return e.filter(this,i)}static coalesce(i){return e.filter(i,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let i=[];for await(let s of e)i.push(s);return i}toPromise(){return e.toPromise(this)}emitOne(e){0===this._state&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){0===this._state&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){0===this._state&&(this._state=1,this._onStateChanged.fire())}reject(e){0===this._state&&(this._state=2,this._error=e,this._onStateChanged.fire())}};aT.EMPTY=aT.fromArray([]);function aA(e,i){return(i<<5)-i+e|0}function aP(e,i){i=aA(149417,i);for(let s=0,r=e.length;s<r;s++)i=aA(e.charCodeAt(s),i);return i}new DataView(new ArrayBuffer(320));var{registerWindow:aO,getWindow:aI,getDocument:aW,getWindows:aN,getWindowsCount:aF,getWindowId:az,getWindowById:aH,hasWindow:a$,onDidRegisterWindow:aU,onWillUnregisterWindow:aK,onDidUnregisterWindow:aq}=(f=new Map,g={window:ai,disposables:new ng},f.set(ai.vscodeWindowId,g),p=new ok,v=new ok,m=new ok,{onDidRegisterWindow:p.event,onWillUnregisterWindow:m.event,onDidUnregisterWindow:v.event,registerWindow(e){var i,s;if(f.has(e.vscodeWindowId))return np.None;let r=new ng,n={window:e,disposables:r.add(new ng)};return f.set(e.vscodeWindowId,n),r.add(nf(()=>{f.delete(e.vscodeWindowId),v.fire(e)})),r.add((i=e,s=aG.BEFORE_UNLOAD,new aV(i,s,()=>{m.fire(e)},void 0))),p.fire(n),r},getWindows:()=>f.values(),getWindowsCount:()=>f.size,getWindowId:e=>e.vscodeWindowId,hasWindow:e=>f.has(e),getWindowById:function(e,i){return("number"==typeof e?f.get(e):void 0)??(i?g:void 0)},getWindow:e=>e?.ownerDocument?.defaultView?e.ownerDocument.defaultView.window:e?.view?e.view.window:ai,getDocument:e=>aI(e).document}),aV=class{constructor(e,i,s,r){this._node=e,this._type=i,this._handler=s,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}},aY=class e{constructor(e,i){this.width=e,this.height=i}with(i=this.width,s=this.height){return i!==this.width||s!==this.height?new e(i,s):this}static is(e){return"object"==typeof e&&"number"==typeof e.height&&"number"==typeof e.width}static lift(i){return i instanceof e?i:new e(i.width,i.height)}static equals(e,i){return e===i||!!e&&!!i&&e.width===i.width&&e.height===i.height}};aY.None=new aY(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,i,s){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let n=function e(i,s){switch(typeof i){case"object":var r,n,o,a;return null===i?aA(349,s):Array.isArray(i)?(r=i,n=aA(104579,n=s),r.reduce((i,s)=>e(s,i),n)):(o=i,a=aA(181387,a=s),Object.keys(o).sort().reduce((i,s)=>(i=aP(s,i),e(o[s],i)),a));case"string":return aP(i,s);case"boolean":return aA(i?433:863,s);case"number":return aA(i,s);case"undefined":return aA(937,s);default:return aA(617,s)}}(s,0),o=r.get(n);if(o)o.users+=1;else{let a=new ok,h=new MutationObserver(e=>a.fire(e));h.observe(e,s);let l=o={users:1,observer:h,onDidMutate:a.event};i.add(nf(()=>{l.users-=1,0===l.users&&(a.dispose(),h.disconnect(),r?.delete(n),r?.size===0&&this.mutationObservers.delete(e))})),r.set(n,o)}return o.onDidMutate}};var aG={BEFORE_UNLOAD:"beforeunload"},aj=class extends np{constructor(e,i,s,r,n,o,a,h,l){if(super(),this._terminal=e,this._characterJoinerService=i,this._charSizeService=s,this._coreBrowserService=r,this._coreService=n,this._decorationService=o,this._optionsService=a,this._themeService=h,this._cursorBlinkStateManager=new nv,this._charAtlasDisposable=this._register(new nv),this._observerDisposable=this._register(new nv),this._model=new oZ,this._workCell=new oN,this._workCell2=new oN,this._rectangleRenderer=this._register(new nv),this._glyphRenderer=this._register(new nv),this._onChangeTextureAtlas=this._register(new ok),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ok),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ok),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new ok),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new ok),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._gl=this._canvas.getContext("webgl2",{antialias:!1,depth:!1,preserveDrawingBuffer:l}),!this._gl)throw Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new n3(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new at(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,a,this._themeService)],this.dimensions={css:{canvas:nq(),cell:nq()},device:{canvas:nq(),cell:nq(),char:{width:0,height:0,left:0,top:0}}},this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(a.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(function(e,i,s){return new aV(e,i,s,void 0)}(this._canvas,"webglcontextlost",e=>{console.log("webglcontextlost event received"),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(e)},3e3)})),this._register(function(e,i,s){return new aV(e,i,s,void 0)}(this._canvas,"webglcontextrestored",e=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,oO(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=oW(this._canvas,this._coreBrowserService.window,(e,i)=>this._setCanvasDevicePixelDimensions(e,i)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=oW(this._canvas,e,(e,i)=>this._setCanvasDevicePixelDimensions(e,i))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(nf(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),oO(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,i){for(let e of(this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows),this._renderLayers))e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,i,s){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,i,s);this._model.selection.update(this._core,e,i,s),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new o9(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new oj(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=oP(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=nu(ov.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),ov.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){for(let e of(this._clearModel(!0),this._renderLayers))e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,i){if(!this._isAttached)if(!this._core.screenElement?.isConnected||!this._charSizeService.width||!this._charSizeService.height)return;else this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;for(let s of this._renderLayers)s.handleGridChanged(this._terminal,e,i);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,i),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new oI(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,i){let s=this._core,r=this._workCell,n,o,a,h,l,c,d=0,_=!0,u,f,g,p,v,m,S,w,b;e=aZ(e,s.rows-1,0),i=aZ(i,s.rows-1,0);let C=this._coreService.decPrivateModes.cursorStyle??s.options.cursorStyle??"block",y=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,x=y-s.buffer.ydisp,k=Math.min(this._terminal.buffer.active.cursorX,s.cols-1),L=-1,M=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let E=!1;for(o=e;o<=i;o++)for(a=o+s.buffer.ydisp,h=s.buffer.lines.get(a),this._model.lineLengths[o]=0,g=y===a,d=0,l=this._characterJoinerService.getJoinedCharacters(a),w=0;w<s.cols;w++){if(n=this._cellColorResolver.result.bg,h.loadCell(w,r),0===w&&(n=this._cellColorResolver.result.bg),c=!1,_=w>=d,u=w,l.length>0&&w===l[0][0]&&_){f=l.shift();let e=this._model.selection.isCellSelected(this._terminal,f[0],a);for(S=f[0]+1;S<f[1];S++)_&&=e===this._model.selection.isCellSelected(this._terminal,S,a);(_&&=!g||k<f[0]||k>=f[1])?(c=!0,r=new aX(r,h.translateToString(!0,f[0],f[1]),f[1]-f[0]),u=f[1]-1):d=f[1]}if(p=r.getChars(),v=r.getCode(),S=(o*s.cols+w)*4,this._cellColorResolver.resolve(r,w,a,this.dimensions.device.cell.width),M&&a===y&&(w===k&&(this._model.cursor={x:k,y:x,width:r.getWidth(),style:this._coreBrowserService.isFocused?C:s.options.cursorInactiveStyle,cursorWidth:s.options.cursorWidth,dpr:this._devicePixelRatio},L=k+r.getWidth()-1),w>=k&&w<=L&&(this._coreBrowserService.isFocused&&"block"===C||!1===this._coreBrowserService.isFocused&&"block"===s.options.cursorInactiveStyle)&&(this._cellColorResolver.result.fg=0x3000000|this._themeService.colors.cursorAccent.rgba>>8&0xffffff,this._cellColorResolver.result.bg=0x3000000|this._themeService.colors.cursor.rgba>>8&0xffffff)),0!==v&&(this._model.lineLengths[o]=w+1),(this._model.cells[S]!==v||this._model.cells[S+1]!==this._cellColorResolver.result.bg||this._model.cells[S+2]!==this._cellColorResolver.result.fg||this._model.cells[S+3]!==this._cellColorResolver.result.ext)&&(E=!0,p.length>1&&(v|=0x80000000),this._model.cells[S]=v,this._model.cells[S+1]=this._cellColorResolver.result.bg,this._model.cells[S+2]=this._cellColorResolver.result.fg,this._model.cells[S+3]=this._cellColorResolver.result.ext,m=r.getWidth(),this._glyphRenderer.value.updateCell(w,o,v,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,p,m,n),c)){for(r=this._workCell,w++;w<=u;w++)b=(o*s.cols+w)*4,this._glyphRenderer.value.updateCell(w,o,0,0,0,0,"",0,0),this._model.cells[b]=0,this._model.cells[b+1]=this._cellColorResolver.result.bg,this._model.cells[b+2]=this._cellColorResolver.result.fg,this._model.cells[b+3]=this._cellColorResolver.result.ext;w--}}E&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=1===this._optionsService.rawOptions.lineHeight?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,i){this._canvas.width===e&&this._canvas.height===i||(this._canvas.width=e,this._canvas.height=i,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},aX=class extends oc{constructor(e,i,s){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=i,this._width=s}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function aZ(e,i,s=0){return Math.max(Math.min(e,i),s)}var aJ="di$target",aQ="di$dependencies",a0=new Map;function a1(e){if(a0.has(e))return a0.get(e);let i=function(e,s,r){var n,o,a;if(3!=arguments.length)throw Error("@IServiceName-decorator can only be used to decorate a parameter");n=i,o=e,a=r,o[aJ]===o?o[aQ].push({id:n,index:a}):(o[aQ]=[{id:n,index:a}],o[aJ]=o)};return i._id=e,a0.set(e,i),i}a1("BufferService"),a1("CoreMouseService"),a1("CoreService"),a1("CharsetService"),a1("InstantiationService"),a1("LogService");var a5=a1("OptionsService");a1("OscLinkService"),a1("UnicodeService"),a1("DecorationService");var a2={trace:0,debug:1,info:2,warn:3,error:4,off:5},a3=class extends np{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=a2[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)"function"==typeof e[i]&&(e[i]=e[i]())}_log(e,i,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+i,...s)}trace(e,...i){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,i)}debug(e,...i){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,i)}info(e,...i){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,i)}warn(e,...i){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,i)}error(e,...i){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,i)}};a3=((e,i,s,r)=>{for(var n,o=r>1?void 0:r?ns(i,s):i,a=e.length-1;a>=0;a--)(n=e[a])&&(o=(r?n(i,s,o):n(o))||o);return r&&o&&ni(i,s,o),o})([(e,i)=>a5(e,i,0)],a3);var a4=class extends np{constructor(e){if(ny&&16>function(){if(!ny)return 0;let e=nS.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1])}()&&!document.createElement("canvas").getContext("webgl2",{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error("Webgl2 is only supported on Safari 16 and above");super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new ok),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ok),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ok),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new ok),this.onContextLoss=this._onContextLoss.event}activate(e){let i=e._core;if(!e.element)return void this._register(i.onWillOpen(()=>this.activate(e)));this._terminal=e;let s=i.coreService,r=i.optionsService,n=i._renderService,o=i._characterJoinerService,a=i._charSizeService,h=i._coreBrowserService,l=i._decorationService,c=i._logService,d=i._themeService;this._renderer=this._register(new aj(e,o,a,h,s,l,r,d,this._preserveDrawingBuffer)),this._register(ov.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(ov.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(ov.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(ov.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this._register(nf(()=>{if(this._terminal._core._store._isDisposed)return;let i=this._terminal._core._renderService;i.setRenderer(this._terminal._core._createRenderer()),i.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}},a6=class{constructor(e,i,s,r={}){this._terminal=e,this._regex=i,this._handler=s,this._options=r}provideLinks(e,i){let s=a8.computeLink(e,this._regex,this._terminal,this._handler);i(this._addCallbacks(s))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(i,s)=>{if(this._options.hover){let{range:r}=e;this._options.hover(i,s,r)}},e))}},a8=class e{static computeLink(i,s,r,n){let o=RegExp(s.source,(s.flags||"")+"g"),[a,h]=e._getWindowedLineStrings(i-1,r),l=a.join(""),c,d=[];for(;c=o.exec(l);){let i=c[0];if(!function(e){try{let i=new URL(e),s=i.password&&i.username?`${i.protocol}//${i.username}:${i.password}@${i.host}`:i.username?`${i.protocol}//${i.username}@${i.host}`:`${i.protocol}//${i.host}`;return e.toLocaleLowerCase().startsWith(s.toLocaleLowerCase())}catch{return!1}}(i))continue;let[s,o]=e._mapStrIdx(r,h,0,c.index),[a,l]=e._mapStrIdx(r,s,o,i.length);if(-1===s||-1===o||-1===a||-1===l)continue;let _={start:{x:o+1,y:s+1},end:{x:l,y:a+1}};d.push({range:_,text:i,activate:n})}return d}static _getWindowedLineStrings(e,i){let s,r=e,n=e,o=0,a="",h=[];if(s=i.buffer.active.getLine(e)){let e=s.translateToString(!0);if(s.isWrapped&&" "!==e[0]){for(o=0;(s=i.buffer.active.getLine(--r))&&o<2048&&(o+=(a=s.translateToString(!0)).length,h.push(a),!(!s.isWrapped||-1!==a.indexOf(" "))););h.reverse()}for(h.push(e),o=0;(s=i.buffer.active.getLine(++n))&&s.isWrapped&&o<2048&&(o+=(a=s.translateToString(!0)).length,h.push(a),-1===a.indexOf(" ")););}return[h,r]}static _mapStrIdx(e,i,s,r){let n=e.buffer.active,o=n.getNullCell(),a=s;for(;r;){let e=n.getLine(i);if(!e)return[-1,-1];for(let s=a;s<e.length;++s){e.getCell(s,o);let a=o.getChars();if(o.getWidth()&&(r-=a.length||1,s===e.length-1&&""===a)){let e=n.getLine(i+1);e&&e.isWrapped&&(e.getCell(0,o),2===o.getWidth()&&(r+=1))}if(r<0)return[i,s]}i++,a=0}return[i,a]}},a7=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function a9(e,i){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}var he=class{constructor(e=a9,i={}){this._handler=e,this._options=i}activate(e){this._terminal=e;let i=this._options,s=i.urlRegex||a7;this._linkProvider=this._terminal.registerLinkProvider(new a6(this._terminal,s,this._handler,i))}dispose(){this._linkProvider?.dispose()}},ht=e.i(387104);let hi=/(?:\.\.?\/|[a-zA-Z0-9_@][a-zA-Z0-9_\-.]*\/)[a-zA-Z0-9_\-.\/@]+\.\w+/g,hs=/^(?::(\d+)(?::(\d+))?|\((\d+)(?:,\s*(\d+))?\)|\[(\d+)(?:,\s*(\d+))?\])/;class hr{terminal;worktreePath;onFileOpen;constructor(e,i,s){this.terminal=e,this.worktreePath=i,this.onFileOpen=s}provideLinks(e,i){let s=this.terminal.buffer.active.getLine(e);if(!s)return i(void 0);let r=s.translateToString(),n=function(e){let i,s=[];for(hi.lastIndex=0;null!==(i=hi.exec(e));){let r,n,o=i[0],a=i.index,h=e.slice(a+o.length).match(hs),l=o.length;if(h&&0===h.index){l+=h[0].length;let e=h[1]??h[3]??h[5],i=h[2]??h[4]??h[6];r=e?parseInt(e,10):void 0,n=i?parseInt(i,10):void 0}s.push({path:o,startIndex:a,totalLength:l,line:r,col:n})}return s}(r);if(0===n.length)return i(void 0);i(n.map(i=>({range:{start:{x:i.startIndex+1,y:e},end:{x:i.startIndex+i.totalLength+1,y:e}},text:r.slice(i.startIndex,i.startIndex+i.totalLength),activate:()=>{this.onFileOpen(`${this.worktreePath}/${i.path}`,i.line,i.col)}})))}}var hn=e.i(349369),ho=e.i(661074);e.s(["TaskTerminal",0,function({taskId:e,worktreePath:i,onSessionEnd:s,onFileOpen:r,useCanvasRenderer:n=!1}){let{t:o}=(0,hn.useI18n)(),{resolvedTheme:a}=(0,ht.useTheme)(),h=(0,y.useRef)(null),l=(0,y.useRef)(null),c=(0,y.useRef)(null),d=(0,y.useRef)(null),_=(0,y.useRef)(s);_.current=s;let u=(0,y.useRef)(r);u.current=r;let[f,g]=(0,y.useState)("connecting"),[p,v]=(0,y.useState)(!1);if((0,y.useEffect)(()=>{if(!i||!h.current)return;let s=new ne({fontFamily:"Menlo, Monaco, 'Courier New', monospace",fontSize:13,scrollback:5e3,cursorBlink:!0,allowTransparency:!1,theme:"light"!==a?{background:"#0a0a0a",foreground:"#e5e5e5"}:{background:"#fafafa",foreground:"#171717"}}),r=new nt;s.loadAddon(r),s.open(h.current);let o=null;if(!n)try{(o=new a4).onContextLoss(()=>{o?.dispose(),o=null}),s.loadAddon(o)}catch{}let f=new he((e,i)=>{window.open(i,"_blank")});s.loadAddon(f),i&&s.registerLinkProvider(new hr(s,i,(e,i,s)=>{u.current?.(e,i,s)})),r.fit(),s.focus();let p=null,m=null,S=!1,w=null,b=!1;return(0,ho.getActualWsPort)().then(i=>{S||function i(r){if(S||b)return;g("connecting");let n=new WebSocket(`ws://localhost:${r}/terminal?taskId=${encodeURIComponent(e)}`);p=n,n.addEventListener("open",()=>{n.send(JSON.stringify({type:"resize",cols:s.cols,rows:s.rows})),s.focus(),g("connected"),v(!0),setTimeout(()=>v(!1),2e3)}),n.addEventListener("message",e=>{let i=e.data;"string"==typeof i?s.write(i):i instanceof Blob?i.text().then(e=>s.write(e)):i instanceof ArrayBuffer&&s.write(new Uint8Array(i))}),m?.dispose(),m=s.onData(e=>{n.readyState===WebSocket.OPEN&&n.send(e)}),n.addEventListener("close",e=>{if(e.code>=4e3){b=!0,g("disconnected"),_.current?.(e.code-4e3);return}g("disconnected"),S||b||(w=setTimeout(()=>i(r),3e3))}),n.addEventListener("error",()=>{}),c.current=n}(i)}),l.current=s,d.current=r,()=>{S=!0,w&&clearTimeout(w),m?.dispose(),f.dispose(),o?.dispose(),r.dispose(),s.dispose(),p?.close(),l.current=null,c.current=null,d.current=null}},[e,i]),(0,y.useEffect)(()=>{if(!i||!h.current)return;let e=d.current,s=c.current,r=l.current;e&&r&&requestAnimationFrame(()=>{e.fit(),s?.readyState===WebSocket.OPEN&&s.send(JSON.stringify({type:"resize",cols:r.cols,rows:r.rows}))});let n=null,o=h.current,a=new ResizeObserver(()=>{n&&clearTimeout(n),n=setTimeout(()=>{let e=d.current,i=c.current,s=l.current;e&&s&&(e.fit(),i?.readyState===WebSocket.OPEN&&i.send(JSON.stringify({type:"resize",cols:s.cols,rows:s.rows})))},100)});return a.observe(o),()=>{n&&clearTimeout(n),a.disconnect()}},[e,i]),(0,y.useEffect)(()=>{let e=l.current;if(!e)return;let i="light"!==a;e.options.theme=i?{background:"#0a0a0a",foreground:"#e5e5e5"}:{background:"#fafafa",foreground:"#171717"}},[a]),!i)return(0,C.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center bg-[#0a0a0a] text-center",children:[(0,C.jsx)("p",{className:"text-sm text-neutral-400",children:o("terminal.noWorktree")}),(0,C.jsx)("p",{className:"text-xs text-neutral-600 mt-1",children:o("terminal.noWorktreeDesc")})]});let m=o("connected"===f?"terminal.connected":"connecting"===f?"terminal.connecting":"terminal.disconnected");return(0,C.jsxs)("div",{className:"relative h-full w-full bg-[#0a0a0a]",children:[(0,C.jsxs)("div",{className:["absolute right-3 top-3 z-10 flex items-center gap-1.5 rounded px-2 py-0.5 text-xs transition-opacity duration-500","connected"===f&&!p?"opacity-0 pointer-events-none":"opacity-100","bg-black/40 backdrop-blur-sm"].join(" "),title:m,children:[(0,C.jsx)("span",{className:`h-2 w-2 rounded-full ${"connected"===f?"bg-green-500":"connecting"===f?"bg-yellow-500":"bg-red-500"}`}),(0,C.jsx)("span",{className:"text-neutral-300",children:m})]}),(0,C.jsx)("div",{ref:h,className:"h-full w-full overflow-hidden"})]})}],599506)},7468,e=>{e.n(e.i(599506))}]);
83
+ }`,o0=8*Float32Array.BYTES_PER_ELEMENT,o1=class{constructor(){this.attributes=new Float32Array(160),this.count=0}},o5=0,o2=0,o3=0,o4=0,o6=0,o8=0,o7=0,o9=class extends np{constructor(e,i,s,r){super(),this._terminal=e,this._gl=i,this._dimensions=s,this._themeService=r,this._vertices=new o1,this._verticesCursor=new o1;let n=this._gl;this._program=n$(oz(n,oJ,oQ)),this._register(nf(()=>n.deleteProgram(this._program))),this._projectionLocation=n$(n.getUniformLocation(this._program,"u_projection")),this._vertexArrayObject=n.createVertexArray(),n.bindVertexArray(this._vertexArrayObject);let o=new Float32Array([0,0,1,0,0,1,1,1]),a=n.createBuffer();this._register(nf(()=>n.deleteBuffer(a))),n.bindBuffer(n.ARRAY_BUFFER,a),n.bufferData(n.ARRAY_BUFFER,o,n.STATIC_DRAW),n.enableVertexAttribArray(3),n.vertexAttribPointer(3,2,this._gl.FLOAT,!1,0,0);let h=new Uint8Array([0,1,2,3]),l=n.createBuffer();this._register(nf(()=>n.deleteBuffer(l))),n.bindBuffer(n.ELEMENT_ARRAY_BUFFER,l),n.bufferData(n.ELEMENT_ARRAY_BUFFER,h,n.STATIC_DRAW),this._attributesBuffer=n$(n.createBuffer()),this._register(nf(()=>n.deleteBuffer(this._attributesBuffer))),n.bindBuffer(n.ARRAY_BUFFER,this._attributesBuffer),n.enableVertexAttribArray(0),n.vertexAttribPointer(0,2,n.FLOAT,!1,o0,0),n.vertexAttribDivisor(0,1),n.enableVertexAttribArray(1),n.vertexAttribPointer(1,2,n.FLOAT,!1,o0,2*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(1,1),n.enableVertexAttribArray(2),n.vertexAttribPointer(2,4,n.FLOAT,!1,o0,4*Float32Array.BYTES_PER_ELEMENT),n.vertexAttribDivisor(2,1),this._updateCachedColors(r.colors),this._register(this._themeService.onChangeColors(e=>{this._updateCachedColors(e),this._updateViewportRectangle()}))}renderBackgrounds(){this._renderVertices(this._vertices)}renderCursor(){this._renderVertices(this._verticesCursor)}_renderVertices(e){let i=this._gl;i.useProgram(this._program),i.bindVertexArray(this._vertexArrayObject),i.uniformMatrix4fv(this._projectionLocation,!1,oF),i.bindBuffer(i.ARRAY_BUFFER,this._attributesBuffer),i.bufferData(i.ARRAY_BUFFER,e.attributes,i.DYNAMIC_DRAW),i.drawElementsInstanced(this._gl.TRIANGLE_STRIP,4,i.UNSIGNED_BYTE,0,e.count)}handleResize(){this._updateViewportRectangle()}setDimensions(e){this._dimensions=e}_updateCachedColors(e){this._bgFloat=this._colorToFloat32Array(e.background),this._cursorFloat=this._colorToFloat32Array(e.cursor)}_updateViewportRectangle(){this._addRectangleFloat(this._vertices.attributes,0,0,0,this._terminal.cols*this._dimensions.device.cell.width,this._terminal.rows*this._dimensions.device.cell.height,this._bgFloat)}updateBackgrounds(e){let i=this._terminal,s=this._vertices,r=1,n,o,a,h,l,c,d,_,u,f,g;for(n=0;n<i.rows;n++){for(a=-1,h=0,l=0,c=!1,o=0;o<i.cols;o++)d=(n*i.cols+o)*4,_=e.cells[d+1],f=!!(0x4000000&(u=e.cells[d+2])),(_!==h||u!==l&&(c||f))&&((0!==h||c&&0!==l)&&(g=8*r++,this._updateRectangle(s,g,l,h,a,o,n)),a=o,h=_,l=u,c=f);(0!==h||c&&0!==l)&&(g=8*r++,this._updateRectangle(s,g,l,h,a,i.cols,n))}s.count=r}updateCursor(e){let i=this._verticesCursor,s=e.cursor;if(!s||"block"===s.style){i.count=0;return}let r,n=0;("bar"===s.style||"outline"===s.style)&&(r=8*n++,this._addRectangleFloat(i.attributes,r,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,"bar"===s.style?s.dpr*s.cursorWidth:s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),("underline"===s.style||"outline"===s.style)&&(r=8*n++,this._addRectangleFloat(i.attributes,r,s.x*this._dimensions.device.cell.width,(s.y+1)*this._dimensions.device.cell.height-s.dpr,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat)),"outline"===s.style&&(r=8*n++,this._addRectangleFloat(i.attributes,r,s.x*this._dimensions.device.cell.width,s.y*this._dimensions.device.cell.height,s.width*this._dimensions.device.cell.width,s.dpr,this._cursorFloat),r=8*n++,this._addRectangleFloat(i.attributes,r,(s.x+s.width)*this._dimensions.device.cell.width-s.dpr,s.y*this._dimensions.device.cell.height,s.dpr,this._dimensions.device.cell.height,this._cursorFloat)),i.count=n}_updateRectangle(e,i,s,r,n,o,a){if(0x4000000&s)switch(0x3000000&s){case 0x1000000:case 0x2000000:o5=this._themeService.colors.ansi[255&s].rgba;break;case 0x3000000:o5=(0xffffff&s)<<8;break;default:o5=this._themeService.colors.foreground.rgba}else switch(0x3000000&r){case 0x1000000:case 0x2000000:o5=this._themeService.colors.ansi[255&r].rgba;break;case 0x3000000:o5=(0xffffff&r)<<8;break;default:o5=this._themeService.colors.background.rgba}e.attributes.length<i+4&&(e.attributes=function(e,i){let s=new Float32Array(Math.min(2*e.length,i));for(let i=0;i<e.length;i++)s[i]=e[i];return s}(e.attributes,this._terminal.rows*this._terminal.cols*8)),o2=n*this._dimensions.device.cell.width,o3=a*this._dimensions.device.cell.height,o4=(o5>>24&255)/255,o6=(o5>>16&255)/255,o8=(o5>>8&255)/255,o7=1,this._addRectangle(e.attributes,i,o2,o3,(o-n)*this._dimensions.device.cell.width,this._dimensions.device.cell.height,o4,o6,o8,o7)}_addRectangle(e,i,s,r,n,o,a,h,l,c){e[i]=s/this._dimensions.device.canvas.width,e[i+1]=r/this._dimensions.device.canvas.height,e[i+2]=n/this._dimensions.device.canvas.width,e[i+3]=o/this._dimensions.device.canvas.height,e[i+4]=a,e[i+5]=h,e[i+6]=l,e[i+7]=c}_addRectangleFloat(e,i,s,r,n,o,a){e[i]=s/this._dimensions.device.canvas.width,e[i+1]=r/this._dimensions.device.canvas.height,e[i+2]=n/this._dimensions.device.canvas.width,e[i+3]=o/this._dimensions.device.canvas.height,e[i+4]=a[0],e[i+5]=a[1],e[i+6]=a[2],e[i+7]=a[3]}_colorToFloat32Array(e){return new Float32Array([(e.rgba>>24&255)/255,(e.rgba>>16&255)/255,(e.rgba>>8&255)/255,(255&e.rgba)/255])}},ae=class extends np{constructor(e,i,s,r,n,o,a,h){super(),this._container=i,this._alpha=n,this._coreBrowserService=o,this._optionsService=a,this._themeService=h,this._deviceCharWidth=0,this._deviceCharHeight=0,this._deviceCellWidth=0,this._deviceCellHeight=0,this._deviceCharLeft=0,this._deviceCharTop=0,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._canvas.classList.add(`xterm-${s}-layer`),this._canvas.style.zIndex=r.toString(),this._initCanvas(),this._container.appendChild(this._canvas),this._register(this._themeService.onChangeColors(i=>{this._refreshCharAtlas(e,i),this.reset(e)})),this._register(nf(()=>{this._canvas.remove()}))}_initCanvas(){this._ctx=n$(this._canvas.getContext("2d",{alpha:this._alpha})),this._alpha||this._clearAll()}handleBlur(e){}handleFocus(e){}handleCursorMove(e){}handleGridChanged(e,i,s){}handleSelectionChanged(e,i,s,r=!1){}_setTransparency(e,i){if(i===this._alpha)return;let s=this._canvas;this._alpha=i,this._canvas=this._canvas.cloneNode(),this._initCanvas(),this._container.replaceChild(this._canvas,s),this._refreshCharAtlas(e,this._themeService.colors),this.handleGridChanged(e,0,e.rows-1)}_refreshCharAtlas(e,i){this._deviceCharWidth<=0&&this._deviceCharHeight<=0||(this._charAtlas=oP(e,this._optionsService.rawOptions,i,this._deviceCellWidth,this._deviceCellHeight,this._deviceCharWidth,this._deviceCharHeight,this._coreBrowserService.dpr,2048),this._charAtlas.warmUp())}resize(e,i){this._deviceCellWidth=i.device.cell.width,this._deviceCellHeight=i.device.cell.height,this._deviceCharWidth=i.device.char.width,this._deviceCharHeight=i.device.char.height,this._deviceCharLeft=i.device.char.left,this._deviceCharTop=i.device.char.top,this._canvas.width=i.device.canvas.width,this._canvas.height=i.device.canvas.height,this._canvas.style.width=`${i.css.canvas.width}px`,this._canvas.style.height=`${i.css.canvas.height}px`,this._alpha||this._clearAll(),this._refreshCharAtlas(e,this._themeService.colors)}_fillBottomLineAtCells(e,i,s=1){this._ctx.fillRect(e*this._deviceCellWidth,(i+1)*this._deviceCellHeight-this._coreBrowserService.dpr-1,s*this._deviceCellWidth,this._coreBrowserService.dpr)}_clearAll(){this._alpha?this._ctx.clearRect(0,0,this._canvas.width,this._canvas.height):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(0,0,this._canvas.width,this._canvas.height))}_clearCells(e,i,s,r){this._alpha?this._ctx.clearRect(e*this._deviceCellWidth,i*this._deviceCellHeight,s*this._deviceCellWidth,r*this._deviceCellHeight):(this._ctx.fillStyle=this._themeService.colors.background.css,this._ctx.fillRect(e*this._deviceCellWidth,i*this._deviceCellHeight,s*this._deviceCellWidth,r*this._deviceCellHeight))}_fillCharTrueColor(e,i,s,r){this._ctx.font=this._getFont(e,!1,!1),this._ctx.textBaseline=n4,this._clipCell(s,r,i.getWidth()),this._ctx.fillText(i.getChars(),s*this._deviceCellWidth+this._deviceCharLeft,r*this._deviceCellHeight+this._deviceCharTop+this._deviceCharHeight)}_clipCell(e,i,s){this._ctx.beginPath(),this._ctx.rect(e*this._deviceCellWidth,i*this._deviceCellHeight,s*this._deviceCellWidth,this._deviceCellHeight),this._ctx.clip()}_getFont(e,i,s){let r=i?e.options.fontWeightBold:e.options.fontWeight;return`${s?"italic":""} ${r} ${e.options.fontSize*this._coreBrowserService.dpr}px ${e.options.fontFamily}`}},at=class extends ae{constructor(e,i,s,r,n,o,a){super(s,e,"link",i,!0,n,o,a),this._register(r.onShowLinkUnderline(e=>this._handleShowLinkUnderline(e))),this._register(r.onHideLinkUnderline(e=>this._handleHideLinkUnderline(e)))}resize(e,i){super.resize(e,i),this._state=void 0}reset(e){this._clearCurrentLink()}_clearCurrentLink(){if(this._state){this._clearCells(this._state.x1,this._state.y1,this._state.cols-this._state.x1,1);let e=this._state.y2-this._state.y1-1;e>0&&this._clearCells(0,this._state.y1+1,this._state.cols,e),this._clearCells(0,this._state.y2,this._state.x2,1),this._state=void 0}}_handleShowLinkUnderline(e){var i;if(257===e.fg?this._ctx.fillStyle=this._themeService.colors.background.css:void 0!==e.fg&&((0x3000000&(i=e.fg))==0x1000000||(0x3000000&i)==0x2000000)?this._ctx.fillStyle=this._themeService.colors.ansi[e.fg].css:this._ctx.fillStyle=this._themeService.colors.foreground.css,e.y1===e.y2)this._fillBottomLineAtCells(e.x1,e.y1,e.x2-e.x1);else{this._fillBottomLineAtCells(e.x1,e.y1,e.cols-e.x1);for(let i=e.y1+1;i<e.y2;i++)this._fillBottomLineAtCells(0,i,e.cols);this._fillBottomLineAtCells(0,e.y2,e.x2)}this._state=e}_handleHideLinkUnderline(e){this._clearCurrentLink()}},ai="object"==typeof window?window:globalThis,as=class{constructor(){this.mapWindowIdToZoomLevel=new Map,this._onDidChangeZoomLevel=new ok,this.onDidChangeZoomLevel=this._onDidChangeZoomLevel.event,this.mapWindowIdToZoomFactor=new Map,this._onDidChangeFullscreen=new ok,this.onDidChangeFullscreen=this._onDidChangeFullscreen.event,this.mapWindowIdToFullScreen=new Map}getZoomLevel(e){return this.mapWindowIdToZoomLevel.get(this.getWindowId(e))??0}setZoomLevel(e,i){if(this.getZoomLevel(i)===e)return;let s=this.getWindowId(i);this.mapWindowIdToZoomLevel.set(s,e),this._onDidChangeZoomLevel.fire(s)}getZoomFactor(e){return this.mapWindowIdToZoomFactor.get(this.getWindowId(e))??1}setZoomFactor(e,i){this.mapWindowIdToZoomFactor.set(this.getWindowId(i),e)}setFullscreen(e,i){if(this.isFullscreen(i)===e)return;let s=this.getWindowId(i);this.mapWindowIdToFullScreen.set(s,e),this._onDidChangeFullscreen.fire(s)}isFullscreen(e){return!!this.mapWindowIdToFullScreen.get(this.getWindowId(e))}getWindowId(e){return e.vscodeWindowId}};as.INSTANCE=new as,as.INSTANCE.onDidChangeZoomLevel,as.INSTANCE.onDidChangeFullscreen;var ar="object"==typeof navigator?navigator.userAgent:"";ar.indexOf("Firefox"),ar.indexOf("AppleWebKit"),ar.indexOf("Chrome")>=0||ar.indexOf("Safari"),ar.indexOf("Electron/"),ar.indexOf("Android");var an=!1;if("function"==typeof ai.matchMedia){let e=ai.matchMedia("(display-mode: standalone) or (display-mode: window-controls-overlay)"),i=ai.matchMedia("(display-mode: fullscreen)");an=e.matches,ao=e,"string"==typeof ao&&(ao=ai.matchMedia(ao)),ao.addEventListener("change",({matches:e})=>{an&&i.matches||(an=e)})}var ao,aa,ah,al=!1,ac=!1,ad="en",a_=globalThis;"u">typeof a_.vscode&&"u">typeof a_.vscode.process?ah=a_.vscode.process:"u">typeof x.default&&"string"==typeof x.default?.versions?.node&&(ah=x.default);var au="string"==typeof ah?.versions?.electron&&ah?.type==="renderer";if("object"==typeof ah){ah.platform,ah.platform,"linux"===ah.platform&&ah.env.SNAP&&ah.env.SNAP_REVISION,ah.env.CI||ah.env.BUILD_ARTIFACTSTAGINGDIRECTORY,ad="en";let e=ah.env.VSCODE_NLS_CONFIG;if(e)try{let i=JSON.parse(e);i.userLocale,i.osLocale,ad=i.resolvedLanguage||"en",i.languagePack?.translationsConfigFile}catch{}al=!0}else"object"!=typeof navigator||au?console.error("Unable to resolve platform."):((aa=navigator.userAgent).indexOf("Windows"),aa.indexOf("Macintosh"),(aa.indexOf("Macintosh")>=0||aa.indexOf("iPad")>=0||aa.indexOf("iPhone")>=0)&&navigator.maxTouchPoints&&navigator.maxTouchPoints,aa.indexOf("Linux"),aa?.indexOf("Mobi"),ac=!0,ad=globalThis._VSCODE_NLS_LANGUAGE||"en",navigator.language.toLowerCase());var af=al;ac&&"function"==typeof a_.importScripts&&a_.origin;var ag,ap=aa,av=ad;(aL=ag||={}).value=function(){return av},aL.isDefaultVariant=function(){return 2===av.length?"en"===av:av.length>=3&&"e"===av[0]&&"n"===av[1]&&"-"===av[2]},aL.isDefault=function(){return"en"===av};var am="function"==typeof a_.postMessage&&!a_.importScripts,aS=(()=>{if(am){let e=[];a_.addEventListener("message",i=>{if(i.data&&i.data.vscodeScheduleAsyncWork)for(let s=0,r=e.length;s<r;s++){let r=e[s];if(r.id===i.data.vscodeScheduleAsyncWork){e.splice(s,1),r.callback();return}}});let i=0;return s=>{let r=++i;e.push({id:r,callback:s}),a_.postMessage({vscodeScheduleAsyncWork:r},"*")}}return e=>setTimeout(e)})(),aw=!!(ap&&ap.indexOf("Chrome")>=0);ap&&ap.indexOf("Firefox"),!aw&&ap&&ap.indexOf("Safari"),ap&&ap.indexOf("Edg/"),ap&&ap.indexOf("Android");var ab="object"==typeof navigator?navigator:{};af||document.queryCommandSupported&&document.queryCommandSupported("copy")||ab&&ab.clipboard&&ab.clipboard.writeText,af||ab&&ab.clipboard&&ab.clipboard.readText,af||an||ab.keyboard,"ontouchstart"in ai||ab.maxTouchPoints,ai.PointerEvent&&("ontouchstart"in ai||navigator.maxTouchPoints);var aC=class{constructor(){this._keyCodeToStr=[],this._strToKeyCode=Object.create(null)}define(e,i){this._keyCodeToStr[e]=i,this._strToKeyCode[i.toLowerCase()]=e}keyCodeToStr(e){return this._keyCodeToStr[e]}strToKeyCode(e){return this._strToKeyCode[e.toLowerCase()]||0}},ay=new aC,ax=new aC,ak=new aC;(aM=aE||={}).toString=function(e){return ay.keyCodeToStr(e)},aM.fromString=function(e){return ay.strToKeyCode(e)},aM.toUserSettingsUS=function(e){return ax.keyCodeToStr(e)},aM.toUserSettingsGeneral=function(e){return ak.keyCodeToStr(e)},aM.fromUserSettings=function(e){return ax.strToKeyCode(e)||ak.strToKeyCode(e)},aM.toElectronAccelerator=function(e){if(e>=98&&e<=113)return null;switch(e){case 16:return"Up";case 18:return"Down";case 15:return"Left";case 17:return"Right"}return ay.keyCodeToStr(e)};var aL,aM,aE,aR,aB=Object.freeze(function(e,i){let s=setTimeout(e.bind(i),0);return{dispose(){clearTimeout(s)}}});(S=aR||={}).isCancellationToken=function(e){return e===S.None||e===S.Cancelled||e instanceof aD||!!e&&"object"==typeof e&&"boolean"==typeof e.isCancellationRequested&&"function"==typeof e.onCancellationRequested},S.None=Object.freeze({isCancellationRequested:!1,onCancellationRequested:ov.None}),S.Cancelled=Object.freeze({isCancellationRequested:!0,onCancellationRequested:aB});var aD=class{constructor(){this._isCancelled=!1,this._emitter=null}cancel(){this._isCancelled||(this._isCancelled=!0,this._emitter&&(this._emitter.fire(void 0),this.dispose()))}get isCancellationRequested(){return this._isCancelled}get onCancellationRequested(){return this._isCancelled?aB:(this._emitter||(this._emitter=new ok),this._emitter.event)}dispose(){this._emitter&&(this._emitter.dispose(),this._emitter=null)}};Symbol("MicrotaskDelay"),(w=b||={}).settled=async function(e){let i,s=await Promise.all(e.map(e=>e.then(e=>e,e=>{i||(i=e)})));if("u">typeof i)throw i;return s},w.withAsyncBody=function(e){return new Promise(async(i,s)=>{try{await e(i,s)}catch(e){s(e)}})};var aT=class e{static fromArray(i){return new e(e=>{e.emitMany(i)})}static fromPromise(i){return new e(async e=>{e.emitMany(await i)})}static fromPromises(i){return new e(async e=>{await Promise.all(i.map(async i=>e.emitOne(await i)))})}static merge(i){return new e(async e=>{await Promise.all(i.map(async i=>{for await(let s of i)e.emitOne(s)}))})}constructor(e,i){this._state=0,this._results=[],this._error=null,this._onReturn=i,this._onStateChanged=new ok,queueMicrotask(async()=>{let i={emitOne:e=>this.emitOne(e),emitMany:e=>this.emitMany(e),reject:e=>this.reject(e)};try{await Promise.resolve(e(i)),this.resolve()}catch(e){this.reject(e)}finally{i.emitOne=void 0,i.emitMany=void 0,i.reject=void 0}})}[Symbol.asyncIterator](){let e=0;return{next:async()=>{for(;;){if(2===this._state)throw this._error;if(e<this._results.length)return{done:!1,value:this._results[e++]};if(1===this._state)return{done:!0,value:void 0};await ov.toPromise(this._onStateChanged.event)}},return:async()=>(this._onReturn?.(),{done:!0,value:void 0})}}static map(i,s){return new e(async e=>{for await(let r of i)e.emitOne(s(r))})}map(i){return e.map(this,i)}static filter(i,s){return new e(async e=>{for await(let r of i)s(r)&&e.emitOne(r)})}filter(i){return e.filter(this,i)}static coalesce(i){return e.filter(i,e=>!!e)}coalesce(){return e.coalesce(this)}static async toPromise(e){let i=[];for await(let s of e)i.push(s);return i}toPromise(){return e.toPromise(this)}emitOne(e){0===this._state&&(this._results.push(e),this._onStateChanged.fire())}emitMany(e){0===this._state&&(this._results=this._results.concat(e),this._onStateChanged.fire())}resolve(){0===this._state&&(this._state=1,this._onStateChanged.fire())}reject(e){0===this._state&&(this._state=2,this._error=e,this._onStateChanged.fire())}};aT.EMPTY=aT.fromArray([]);function aA(e,i){return(i<<5)-i+e|0}function aP(e,i){i=aA(149417,i);for(let s=0,r=e.length;s<r;s++)i=aA(e.charCodeAt(s),i);return i}new DataView(new ArrayBuffer(320));var{registerWindow:aO,getWindow:aI,getDocument:aW,getWindows:aN,getWindowsCount:aF,getWindowId:az,getWindowById:aH,hasWindow:a$,onDidRegisterWindow:aU,onWillUnregisterWindow:aK,onDidUnregisterWindow:aq}=(f=new Map,g={window:ai,disposables:new ng},f.set(ai.vscodeWindowId,g),p=new ok,v=new ok,m=new ok,{onDidRegisterWindow:p.event,onWillUnregisterWindow:m.event,onDidUnregisterWindow:v.event,registerWindow(e){var i,s;if(f.has(e.vscodeWindowId))return np.None;let r=new ng,n={window:e,disposables:r.add(new ng)};return f.set(e.vscodeWindowId,n),r.add(nf(()=>{f.delete(e.vscodeWindowId),v.fire(e)})),r.add((i=e,s=aG.BEFORE_UNLOAD,new aV(i,s,()=>{m.fire(e)},void 0))),p.fire(n),r},getWindows:()=>f.values(),getWindowsCount:()=>f.size,getWindowId:e=>e.vscodeWindowId,hasWindow:e=>f.has(e),getWindowById:function(e,i){return("number"==typeof e?f.get(e):void 0)??(i?g:void 0)},getWindow:e=>e?.ownerDocument?.defaultView?e.ownerDocument.defaultView.window:e?.view?e.view.window:ai,getDocument:e=>aI(e).document}),aV=class{constructor(e,i,s,r){this._node=e,this._type=i,this._handler=s,this._options=r||!1,this._node.addEventListener(this._type,this._handler,this._options)}dispose(){this._handler&&(this._node.removeEventListener(this._type,this._handler,this._options),this._node=null,this._handler=null)}},aY=class e{constructor(e,i){this.width=e,this.height=i}with(i=this.width,s=this.height){return i!==this.width||s!==this.height?new e(i,s):this}static is(e){return"object"==typeof e&&"number"==typeof e.height&&"number"==typeof e.width}static lift(i){return i instanceof e?i:new e(i.width,i.height)}static equals(e,i){return e===i||!!e&&!!i&&e.width===i.width&&e.height===i.height}};aY.None=new aY(0,0),new class{constructor(){this.mutationObservers=new Map}observe(e,i,s){let r=this.mutationObservers.get(e);r||(r=new Map,this.mutationObservers.set(e,r));let n=function e(i,s){switch(typeof i){case"object":var r,n,o,a;return null===i?aA(349,s):Array.isArray(i)?(r=i,n=aA(104579,n=s),r.reduce((i,s)=>e(s,i),n)):(o=i,a=aA(181387,a=s),Object.keys(o).sort().reduce((i,s)=>(i=aP(s,i),e(o[s],i)),a));case"string":return aP(i,s);case"boolean":return aA(i?433:863,s);case"number":return aA(i,s);case"undefined":return aA(937,s);default:return aA(617,s)}}(s,0),o=r.get(n);if(o)o.users+=1;else{let a=new ok,h=new MutationObserver(e=>a.fire(e));h.observe(e,s);let l=o={users:1,observer:h,onDidMutate:a.event};i.add(nf(()=>{l.users-=1,0===l.users&&(a.dispose(),h.disconnect(),r?.delete(n),r?.size===0&&this.mutationObservers.delete(e))})),r.set(n,o)}return o.onDidMutate}};var aG={BEFORE_UNLOAD:"beforeunload"},aj=class extends np{constructor(e,i,s,r,n,o,a,h,l){if(super(),this._terminal=e,this._characterJoinerService=i,this._charSizeService=s,this._coreBrowserService=r,this._coreService=n,this._decorationService=o,this._optionsService=a,this._themeService=h,this._cursorBlinkStateManager=new nv,this._charAtlasDisposable=this._register(new nv),this._observerDisposable=this._register(new nv),this._model=new oZ,this._workCell=new oN,this._workCell2=new oN,this._rectangleRenderer=this._register(new nv),this._glyphRenderer=this._register(new nv),this._onChangeTextureAtlas=this._register(new ok),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ok),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ok),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onRequestRedraw=this._register(new ok),this.onRequestRedraw=this._onRequestRedraw.event,this._onContextLoss=this._register(new ok),this.onContextLoss=this._onContextLoss.event,this._canvas=this._coreBrowserService.mainDocument.createElement("canvas"),this._gl=this._canvas.getContext("webgl2",{antialias:!1,depth:!1,preserveDrawingBuffer:l}),!this._gl)throw Error("WebGL2 not supported "+this._gl);this._register(this._themeService.onChangeColors(()=>this._handleColorChange())),this._cellColorResolver=new n3(this._terminal,this._optionsService,this._model.selection,this._decorationService,this._coreBrowserService,this._themeService),this._core=this._terminal._core,this._renderLayers=[new at(this._core.screenElement,2,this._terminal,this._core.linkifier,this._coreBrowserService,a,this._themeService)],this.dimensions={css:{canvas:nq(),cell:nq()},device:{canvas:nq(),cell:nq(),char:{width:0,height:0,left:0,top:0}}},this._devicePixelRatio=this._coreBrowserService.dpr,this._updateDimensions(),this._updateCursorBlink(),this._register(a.onOptionChange(()=>this._handleOptionsChanged())),this._deviceMaxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._register(function(e,i,s){return new aV(e,i,s,void 0)}(this._canvas,"webglcontextlost",e=>{console.log("webglcontextlost event received"),e.preventDefault(),this._contextRestorationTimeout=setTimeout(()=>{this._contextRestorationTimeout=void 0,console.warn("webgl context not restored; firing onContextLoss"),this._onContextLoss.fire(e)},3e3)})),this._register(function(e,i,s){return new aV(e,i,s,void 0)}(this._canvas,"webglcontextrestored",e=>{console.warn("webglcontextrestored event received"),clearTimeout(this._contextRestorationTimeout),this._contextRestorationTimeout=void 0,oO(this._terminal),this._initializeWebGLState(),this._requestRedrawViewport()})),this._observerDisposable.value=oW(this._canvas,this._coreBrowserService.window,(e,i)=>this._setCanvasDevicePixelDimensions(e,i)),this._register(this._coreBrowserService.onWindowChange(e=>{this._observerDisposable.value=oW(this._canvas,e,(e,i)=>this._setCanvasDevicePixelDimensions(e,i))})),this._core.screenElement.appendChild(this._canvas),[this._rectangleRenderer.value,this._glyphRenderer.value]=this._initializeWebGLState(),this._isAttached=this._core.screenElement.isConnected,this._register(nf(()=>{for(let e of this._renderLayers)e.dispose();this._canvas.parentElement?.removeChild(this._canvas),oO(this._terminal)}))}get textureAtlas(){return this._charAtlas?.pages[0].canvas}_handleColorChange(){this._refreshCharAtlas(),this._clearModel(!0)}handleDevicePixelRatioChange(){this._devicePixelRatio!==this._coreBrowserService.dpr&&(this._devicePixelRatio=this._coreBrowserService.dpr,this.handleResize(this._terminal.cols,this._terminal.rows))}handleResize(e,i){for(let e of(this._updateDimensions(),this._model.resize(this._terminal.cols,this._terminal.rows),this._renderLayers))e.resize(this._terminal,this.dimensions);this._canvas.width=this.dimensions.device.canvas.width,this._canvas.height=this.dimensions.device.canvas.height,this._canvas.style.width=`${this.dimensions.css.canvas.width}px`,this._canvas.style.height=`${this.dimensions.css.canvas.height}px`,this._core.screenElement.style.width=`${this.dimensions.css.canvas.width}px`,this._core.screenElement.style.height=`${this.dimensions.css.canvas.height}px`,this._rectangleRenderer.value?.setDimensions(this.dimensions),this._rectangleRenderer.value?.handleResize(),this._glyphRenderer.value?.setDimensions(this.dimensions),this._glyphRenderer.value?.handleResize(),this._refreshCharAtlas(),this._clearModel(!1)}handleCharSizeChanged(){this.handleResize(this._terminal.cols,this._terminal.rows)}handleBlur(){for(let e of this._renderLayers)e.handleBlur(this._terminal);this._cursorBlinkStateManager.value?.pause(),this._requestRedrawViewport()}handleFocus(){for(let e of this._renderLayers)e.handleFocus(this._terminal);this._cursorBlinkStateManager.value?.resume(),this._requestRedrawViewport()}handleSelectionChanged(e,i,s){for(let r of this._renderLayers)r.handleSelectionChanged(this._terminal,e,i,s);this._model.selection.update(this._core,e,i,s),this._requestRedrawViewport()}handleCursorMove(){for(let e of this._renderLayers)e.handleCursorMove(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation()}_handleOptionsChanged(){this._updateDimensions(),this._refreshCharAtlas(),this._updateCursorBlink()}_initializeWebGLState(){return this._rectangleRenderer.value=new o9(this._terminal,this._gl,this.dimensions,this._themeService),this._glyphRenderer.value=new oj(this._terminal,this._gl,this.dimensions,this._optionsService),this.handleCharSizeChanged(),[this._rectangleRenderer.value,this._glyphRenderer.value]}_refreshCharAtlas(){if(this.dimensions.device.char.width<=0&&this.dimensions.device.char.height<=0){this._isAttached=!1;return}let e=oP(this._terminal,this._optionsService.rawOptions,this._themeService.colors,this.dimensions.device.cell.width,this.dimensions.device.cell.height,this.dimensions.device.char.width,this.dimensions.device.char.height,this._coreBrowserService.dpr,this._deviceMaxTextureSize);this._charAtlas!==e&&(this._onChangeTextureAtlas.fire(e.pages[0].canvas),this._charAtlasDisposable.value=nu(ov.forward(e.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas),ov.forward(e.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas))),this._charAtlas=e,this._charAtlas.warmUp(),this._glyphRenderer.value?.setAtlas(this._charAtlas)}_clearModel(e){this._model.clear(),e&&this._glyphRenderer.value?.clear()}clearTextureAtlas(){this._charAtlas?.clearTexture(),this._clearModel(!0),this._requestRedrawViewport()}clear(){for(let e of(this._clearModel(!0),this._renderLayers))e.reset(this._terminal);this._cursorBlinkStateManager.value?.restartBlinkAnimation(),this._updateCursorBlink()}renderRows(e,i){if(!this._isAttached)if(!this._core.screenElement?.isConnected||!this._charSizeService.width||!this._charSizeService.height)return;else this._updateDimensions(),this._refreshCharAtlas(),this._isAttached=!0;for(let s of this._renderLayers)s.handleGridChanged(this._terminal,e,i);this._glyphRenderer.value&&this._rectangleRenderer.value&&(this._glyphRenderer.value.beginFrame()?(this._clearModel(!0),this._updateModel(0,this._terminal.rows-1)):this._updateModel(e,i),this._rectangleRenderer.value.renderBackgrounds(),this._glyphRenderer.value.render(this._model),(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible)&&this._rectangleRenderer.value.renderCursor())}_updateCursorBlink(){this._coreService.decPrivateModes.cursorBlink??this._terminal.options.cursorBlink?this._cursorBlinkStateManager.value=new oI(()=>{this._requestRedrawCursor()},this._coreBrowserService):this._cursorBlinkStateManager.clear(),this._requestRedrawCursor()}_updateModel(e,i){let s=this._core,r=this._workCell,n,o,a,h,l,c,d=0,_=!0,u,f,g,p,v,m,S,w,b;e=aZ(e,s.rows-1,0),i=aZ(i,s.rows-1,0);let C=this._coreService.decPrivateModes.cursorStyle??s.options.cursorStyle??"block",y=this._terminal.buffer.active.baseY+this._terminal.buffer.active.cursorY,x=y-s.buffer.ydisp,k=Math.min(this._terminal.buffer.active.cursorX,s.cols-1),L=-1,M=this._coreService.isCursorInitialized&&!this._coreService.isCursorHidden&&(!this._cursorBlinkStateManager.value||this._cursorBlinkStateManager.value.isCursorVisible);this._model.cursor=void 0;let E=!1;for(o=e;o<=i;o++)for(a=o+s.buffer.ydisp,h=s.buffer.lines.get(a),this._model.lineLengths[o]=0,g=y===a,d=0,l=this._characterJoinerService.getJoinedCharacters(a),w=0;w<s.cols;w++){if(n=this._cellColorResolver.result.bg,h.loadCell(w,r),0===w&&(n=this._cellColorResolver.result.bg),c=!1,_=w>=d,u=w,l.length>0&&w===l[0][0]&&_){f=l.shift();let e=this._model.selection.isCellSelected(this._terminal,f[0],a);for(S=f[0]+1;S<f[1];S++)_&&=e===this._model.selection.isCellSelected(this._terminal,S,a);(_&&=!g||k<f[0]||k>=f[1])?(c=!0,r=new aX(r,h.translateToString(!0,f[0],f[1]),f[1]-f[0]),u=f[1]-1):d=f[1]}if(p=r.getChars(),v=r.getCode(),S=(o*s.cols+w)*4,this._cellColorResolver.resolve(r,w,a,this.dimensions.device.cell.width),M&&a===y&&(w===k&&(this._model.cursor={x:k,y:x,width:r.getWidth(),style:this._coreBrowserService.isFocused?C:s.options.cursorInactiveStyle,cursorWidth:s.options.cursorWidth,dpr:this._devicePixelRatio},L=k+r.getWidth()-1),w>=k&&w<=L&&(this._coreBrowserService.isFocused&&"block"===C||!1===this._coreBrowserService.isFocused&&"block"===s.options.cursorInactiveStyle)&&(this._cellColorResolver.result.fg=0x3000000|this._themeService.colors.cursorAccent.rgba>>8&0xffffff,this._cellColorResolver.result.bg=0x3000000|this._themeService.colors.cursor.rgba>>8&0xffffff)),0!==v&&(this._model.lineLengths[o]=w+1),(this._model.cells[S]!==v||this._model.cells[S+1]!==this._cellColorResolver.result.bg||this._model.cells[S+2]!==this._cellColorResolver.result.fg||this._model.cells[S+3]!==this._cellColorResolver.result.ext)&&(E=!0,p.length>1&&(v|=0x80000000),this._model.cells[S]=v,this._model.cells[S+1]=this._cellColorResolver.result.bg,this._model.cells[S+2]=this._cellColorResolver.result.fg,this._model.cells[S+3]=this._cellColorResolver.result.ext,m=r.getWidth(),this._glyphRenderer.value.updateCell(w,o,v,this._cellColorResolver.result.bg,this._cellColorResolver.result.fg,this._cellColorResolver.result.ext,p,m,n),c)){for(r=this._workCell,w++;w<=u;w++)b=(o*s.cols+w)*4,this._glyphRenderer.value.updateCell(w,o,0,0,0,0,"",0,0),this._model.cells[b]=0,this._model.cells[b+1]=this._cellColorResolver.result.bg,this._model.cells[b+2]=this._cellColorResolver.result.fg,this._model.cells[b+3]=this._cellColorResolver.result.ext;w--}}E&&this._rectangleRenderer.value.updateBackgrounds(this._model),this._rectangleRenderer.value.updateCursor(this._model)}_updateDimensions(){this._charSizeService.width&&this._charSizeService.height&&(this.dimensions.device.char.width=Math.floor(this._charSizeService.width*this._devicePixelRatio),this.dimensions.device.char.height=Math.ceil(this._charSizeService.height*this._devicePixelRatio),this.dimensions.device.cell.height=Math.floor(this.dimensions.device.char.height*this._optionsService.rawOptions.lineHeight),this.dimensions.device.char.top=1===this._optionsService.rawOptions.lineHeight?0:Math.round((this.dimensions.device.cell.height-this.dimensions.device.char.height)/2),this.dimensions.device.cell.width=this.dimensions.device.char.width+Math.round(this._optionsService.rawOptions.letterSpacing),this.dimensions.device.char.left=Math.floor(this._optionsService.rawOptions.letterSpacing/2),this.dimensions.device.canvas.height=this._terminal.rows*this.dimensions.device.cell.height,this.dimensions.device.canvas.width=this._terminal.cols*this.dimensions.device.cell.width,this.dimensions.css.canvas.height=Math.round(this.dimensions.device.canvas.height/this._devicePixelRatio),this.dimensions.css.canvas.width=Math.round(this.dimensions.device.canvas.width/this._devicePixelRatio),this.dimensions.css.cell.height=this.dimensions.device.cell.height/this._devicePixelRatio,this.dimensions.css.cell.width=this.dimensions.device.cell.width/this._devicePixelRatio)}_setCanvasDevicePixelDimensions(e,i){this._canvas.width===e&&this._canvas.height===i||(this._canvas.width=e,this._canvas.height=i,this._requestRedrawViewport())}_requestRedrawViewport(){this._onRequestRedraw.fire({start:0,end:this._terminal.rows-1})}_requestRedrawCursor(){let e=this._terminal.buffer.active.cursorY;this._onRequestRedraw.fire({start:e,end:e})}},aX=class extends oc{constructor(e,i,s){super(),this.content=0,this.combinedData="",this.fg=e.fg,this.bg=e.bg,this.combinedData=i,this._width=s}isCombined(){return 2097152}getWidth(){return this._width}getChars(){return this.combinedData}getCode(){return 2097151}setFromCharData(e){throw Error("not implemented")}getAsCharData(){return[this.fg,this.getChars(),this.getWidth(),this.getCode()]}};function aZ(e,i,s=0){return Math.max(Math.min(e,i),s)}var aJ="di$target",aQ="di$dependencies",a0=new Map;function a1(e){if(a0.has(e))return a0.get(e);let i=function(e,s,r){var n,o,a;if(3!=arguments.length)throw Error("@IServiceName-decorator can only be used to decorate a parameter");n=i,o=e,a=r,o[aJ]===o?o[aQ].push({id:n,index:a}):(o[aQ]=[{id:n,index:a}],o[aJ]=o)};return i._id=e,a0.set(e,i),i}a1("BufferService"),a1("CoreMouseService"),a1("CoreService"),a1("CharsetService"),a1("InstantiationService"),a1("LogService");var a5=a1("OptionsService");a1("OscLinkService"),a1("UnicodeService"),a1("DecorationService");var a2={trace:0,debug:1,info:2,warn:3,error:4,off:5},a3=class extends np{constructor(e){super(),this._optionsService=e,this._logLevel=5,this._updateLogLevel(),this._register(this._optionsService.onSpecificOptionChange("logLevel",()=>this._updateLogLevel()))}get logLevel(){return this._logLevel}_updateLogLevel(){this._logLevel=a2[this._optionsService.rawOptions.logLevel]}_evalLazyOptionalParams(e){for(let i=0;i<e.length;i++)"function"==typeof e[i]&&(e[i]=e[i]())}_log(e,i,s){this._evalLazyOptionalParams(s),e.call(console,(this._optionsService.options.logger?"":"xterm.js: ")+i,...s)}trace(e,...i){this._logLevel<=0&&this._log(this._optionsService.options.logger?.trace.bind(this._optionsService.options.logger)??console.log,e,i)}debug(e,...i){this._logLevel<=1&&this._log(this._optionsService.options.logger?.debug.bind(this._optionsService.options.logger)??console.log,e,i)}info(e,...i){this._logLevel<=2&&this._log(this._optionsService.options.logger?.info.bind(this._optionsService.options.logger)??console.info,e,i)}warn(e,...i){this._logLevel<=3&&this._log(this._optionsService.options.logger?.warn.bind(this._optionsService.options.logger)??console.warn,e,i)}error(e,...i){this._logLevel<=4&&this._log(this._optionsService.options.logger?.error.bind(this._optionsService.options.logger)??console.error,e,i)}};a3=((e,i,s,r)=>{for(var n,o=r>1?void 0:r?ns(i,s):i,a=e.length-1;a>=0;a--)(n=e[a])&&(o=(r?n(i,s,o):n(o))||o);return r&&o&&ni(i,s,o),o})([(e,i)=>a5(e,i,0)],a3);var a4=class extends np{constructor(e){if(ny&&16>function(){if(!ny)return 0;let e=nS.match(/Version\/(\d+)/);return null===e||e.length<2?0:parseInt(e[1])}()&&!document.createElement("canvas").getContext("webgl2",{antialias:!1,depth:!1,preserveDrawingBuffer:!0}))throw Error("Webgl2 is only supported on Safari 16 and above");super(),this._preserveDrawingBuffer=e,this._onChangeTextureAtlas=this._register(new ok),this.onChangeTextureAtlas=this._onChangeTextureAtlas.event,this._onAddTextureAtlasCanvas=this._register(new ok),this.onAddTextureAtlasCanvas=this._onAddTextureAtlasCanvas.event,this._onRemoveTextureAtlasCanvas=this._register(new ok),this.onRemoveTextureAtlasCanvas=this._onRemoveTextureAtlasCanvas.event,this._onContextLoss=this._register(new ok),this.onContextLoss=this._onContextLoss.event}activate(e){let i=e._core;if(!e.element)return void this._register(i.onWillOpen(()=>this.activate(e)));this._terminal=e;let s=i.coreService,r=i.optionsService,n=i._renderService,o=i._characterJoinerService,a=i._charSizeService,h=i._coreBrowserService,l=i._decorationService,c=i._logService,d=i._themeService;this._renderer=this._register(new aj(e,o,a,h,s,l,r,d,this._preserveDrawingBuffer)),this._register(ov.forward(this._renderer.onContextLoss,this._onContextLoss)),this._register(ov.forward(this._renderer.onChangeTextureAtlas,this._onChangeTextureAtlas)),this._register(ov.forward(this._renderer.onAddTextureAtlasCanvas,this._onAddTextureAtlasCanvas)),this._register(ov.forward(this._renderer.onRemoveTextureAtlasCanvas,this._onRemoveTextureAtlasCanvas)),n.setRenderer(this._renderer),this._register(nf(()=>{if(this._terminal._core._store._isDisposed)return;let i=this._terminal._core._renderService;i.setRenderer(this._terminal._core._createRenderer()),i.handleResize(e.cols,e.rows)}))}get textureAtlas(){return this._renderer?.textureAtlas}clearTextureAtlas(){this._renderer?.clearTextureAtlas()}},a6=class{constructor(e,i,s,r={}){this._terminal=e,this._regex=i,this._handler=s,this._options=r}provideLinks(e,i){let s=a8.computeLink(e,this._regex,this._terminal,this._handler);i(this._addCallbacks(s))}_addCallbacks(e){return e.map(e=>(e.leave=this._options.leave,e.hover=(i,s)=>{if(this._options.hover){let{range:r}=e;this._options.hover(i,s,r)}},e))}},a8=class e{static computeLink(i,s,r,n){let o=RegExp(s.source,(s.flags||"")+"g"),[a,h]=e._getWindowedLineStrings(i-1,r),l=a.join(""),c,d=[];for(;c=o.exec(l);){let i=c[0];if(!function(e){try{let i=new URL(e),s=i.password&&i.username?`${i.protocol}//${i.username}:${i.password}@${i.host}`:i.username?`${i.protocol}//${i.username}@${i.host}`:`${i.protocol}//${i.host}`;return e.toLocaleLowerCase().startsWith(s.toLocaleLowerCase())}catch{return!1}}(i))continue;let[s,o]=e._mapStrIdx(r,h,0,c.index),[a,l]=e._mapStrIdx(r,s,o,i.length);if(-1===s||-1===o||-1===a||-1===l)continue;let _={start:{x:o+1,y:s+1},end:{x:l,y:a+1}};d.push({range:_,text:i,activate:n})}return d}static _getWindowedLineStrings(e,i){let s,r=e,n=e,o=0,a="",h=[];if(s=i.buffer.active.getLine(e)){let e=s.translateToString(!0);if(s.isWrapped&&" "!==e[0]){for(o=0;(s=i.buffer.active.getLine(--r))&&o<2048&&(o+=(a=s.translateToString(!0)).length,h.push(a),!(!s.isWrapped||-1!==a.indexOf(" "))););h.reverse()}for(h.push(e),o=0;(s=i.buffer.active.getLine(++n))&&s.isWrapped&&o<2048&&(o+=(a=s.translateToString(!0)).length,h.push(a),-1===a.indexOf(" ")););}return[h,r]}static _mapStrIdx(e,i,s,r){let n=e.buffer.active,o=n.getNullCell(),a=s;for(;r;){let e=n.getLine(i);if(!e)return[-1,-1];for(let s=a;s<e.length;++s){e.getCell(s,o);let a=o.getChars();if(o.getWidth()&&(r-=a.length||1,s===e.length-1&&""===a)){let e=n.getLine(i+1);e&&e.isWrapped&&(e.getCell(0,o),2===o.getWidth()&&(r+=1))}if(r<0)return[i,s]}i++,a=0}return[i,a]}},a7=/(https?|HTTPS?):[/]{2}[^\s"'!*(){}|\\\^<>`]*[^\s"':,.!?{}|\\\^~\[\]`()<>]/;function a9(e,i){let s=window.open();if(s){try{s.opener=null}catch{}s.location.href=i}else console.warn("Opening link blocked as opener could not be cleared")}var he=class{constructor(e=a9,i={}){this._handler=e,this._options=i}activate(e){this._terminal=e;let i=this._options,s=i.urlRegex||a7;this._linkProvider=this._terminal.registerLinkProvider(new a6(this._terminal,s,this._handler,i))}dispose(){this._linkProvider?.dispose()}},ht=e.i(387104);let hi=/(?:\.\.?\/|[a-zA-Z0-9_@][a-zA-Z0-9_\-.]*\/)[a-zA-Z0-9_\-.\/@]+\.\w+/g,hs=/^(?::(\d+)(?::(\d+))?|\((\d+)(?:,\s*(\d+))?\)|\[(\d+)(?:,\s*(\d+))?\])/;class hr{terminal;worktreePath;onFileOpen;constructor(e,i,s){this.terminal=e,this.worktreePath=i,this.onFileOpen=s}provideLinks(e,i){let s=this.terminal.buffer.active.getLine(e);if(!s)return i(void 0);let r=s.translateToString(),n=function(e){let i,s=[];for(hi.lastIndex=0;null!==(i=hi.exec(e));){let r,n,o=i[0],a=i.index,h=e.slice(a+o.length).match(hs),l=o.length;if(h&&0===h.index){l+=h[0].length;let e=h[1]??h[3]??h[5],i=h[2]??h[4]??h[6];r=e?parseInt(e,10):void 0,n=i?parseInt(i,10):void 0}s.push({path:o,startIndex:a,totalLength:l,line:r,col:n})}return s}(r);if(0===n.length)return i(void 0);i(n.map(i=>({range:{start:{x:i.startIndex+1,y:e},end:{x:i.startIndex+i.totalLength+1,y:e}},text:r.slice(i.startIndex,i.startIndex+i.totalLength),activate:()=>{this.onFileOpen(`${this.worktreePath}/${i.path}`,i.line,i.col)}})))}}var hn=e.i(349369),ho=e.i(995010);e.s(["TaskTerminal",0,function({taskId:e,worktreePath:i,onSessionEnd:s,onFileOpen:r,useCanvasRenderer:n=!1}){let{t:o}=(0,hn.useI18n)(),{resolvedTheme:a}=(0,ht.useTheme)(),h=(0,y.useRef)(null),l=(0,y.useRef)(null),c=(0,y.useRef)(null),d=(0,y.useRef)(null),_=(0,y.useRef)(s);_.current=s;let u=(0,y.useRef)(r);u.current=r;let[f,g]=(0,y.useState)("connecting"),[p,v]=(0,y.useState)(!1);if((0,y.useEffect)(()=>{if(!i||!h.current)return;let s=new ne({fontFamily:"Menlo, Monaco, 'Courier New', monospace",fontSize:13,scrollback:5e3,cursorBlink:!0,allowTransparency:!1,theme:"light"!==a?{background:"#0a0a0a",foreground:"#e5e5e5"}:{background:"#fafafa",foreground:"#171717"}}),r=new nt;s.loadAddon(r),s.open(h.current);let o=null;if(!n)try{(o=new a4).onContextLoss(()=>{o?.dispose(),o=null}),s.loadAddon(o)}catch{}let f=new he((e,i)=>{window.open(i,"_blank")});s.loadAddon(f),i&&s.registerLinkProvider(new hr(s,i,(e,i,s)=>{u.current?.(e,i,s)})),r.fit(),s.focus();let p=null,m=null,S=!1,w=null,b=!1;return(0,ho.getActualWsPort)().then(i=>{S||function i(r){if(S||b)return;g("connecting");let n=new WebSocket(`ws://localhost:${r}/terminal?taskId=${encodeURIComponent(e)}`);p=n,n.addEventListener("open",()=>{n.send(JSON.stringify({type:"resize",cols:s.cols,rows:s.rows})),s.focus(),g("connected"),v(!0),setTimeout(()=>v(!1),2e3)}),n.addEventListener("message",e=>{let i=e.data;"string"==typeof i?s.write(i):i instanceof Blob?i.text().then(e=>s.write(e)):i instanceof ArrayBuffer&&s.write(new Uint8Array(i))}),m?.dispose(),m=s.onData(e=>{n.readyState===WebSocket.OPEN&&n.send(e)}),n.addEventListener("close",e=>{if(e.code>=4e3){b=!0,g("disconnected"),_.current?.(e.code-4e3);return}g("disconnected"),S||b||(w=setTimeout(()=>i(r),3e3))}),n.addEventListener("error",()=>{}),c.current=n}(i)}),l.current=s,d.current=r,()=>{S=!0,w&&clearTimeout(w),m?.dispose(),f.dispose(),o?.dispose(),r.dispose(),s.dispose(),p?.close(),l.current=null,c.current=null,d.current=null}},[e,i]),(0,y.useEffect)(()=>{if(!i||!h.current)return;let e=d.current,s=c.current,r=l.current;e&&r&&requestAnimationFrame(()=>{e.fit(),s?.readyState===WebSocket.OPEN&&s.send(JSON.stringify({type:"resize",cols:r.cols,rows:r.rows}))});let n=null,o=h.current,a=new ResizeObserver(()=>{n&&clearTimeout(n),n=setTimeout(()=>{let e=d.current,i=c.current,s=l.current;e&&s&&(e.fit(),i?.readyState===WebSocket.OPEN&&i.send(JSON.stringify({type:"resize",cols:s.cols,rows:s.rows})))},100)});return a.observe(o),()=>{n&&clearTimeout(n),a.disconnect()}},[e,i]),(0,y.useEffect)(()=>{let e=l.current;if(!e)return;let i="light"!==a;e.options.theme=i?{background:"#0a0a0a",foreground:"#e5e5e5"}:{background:"#fafafa",foreground:"#171717"}},[a]),!i)return(0,C.jsxs)("div",{className:"flex h-full w-full flex-col items-center justify-center bg-[#0a0a0a] text-center",children:[(0,C.jsx)("p",{className:"text-sm text-neutral-400",children:o("terminal.noWorktree")}),(0,C.jsx)("p",{className:"text-xs text-neutral-600 mt-1",children:o("terminal.noWorktreeDesc")})]});let m=o("connected"===f?"terminal.connected":"connecting"===f?"terminal.connecting":"terminal.disconnected");return(0,C.jsxs)("div",{className:"relative h-full w-full bg-[#0a0a0a]",children:[(0,C.jsxs)("div",{className:["absolute right-3 top-3 z-10 flex items-center gap-1.5 rounded px-2 py-0.5 text-xs transition-opacity duration-500","connected"===f&&!p?"opacity-0 pointer-events-none":"opacity-100","bg-black/40 backdrop-blur-sm"].join(" "),title:m,children:[(0,C.jsx)("span",{className:`h-2 w-2 rounded-full ${"connected"===f?"bg-green-500":"connecting"===f?"bg-yellow-500":"bg-red-500"}`}),(0,C.jsx)("span",{className:"text-neutral-300",children:m})]}),(0,C.jsx)("div",{ref:h,className:"h-full w-full overflow-hidden"})]})}],599506)},7468,e=>{e.n(e.i(599506))}]);
@@ -1 +1 @@
1
- (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,755167,e=>{"use strict";var t=e.i(430989),r=e.i(226549),a=e.i(347880),s=e.i(583315),l=e.i(652459),n=e.i(819614),i=e.i(306308),c=e.i(349369);let o=[{key:"notes",icon:l.FileText},{key:"assets",icon:n.FolderOpen},{key:"archive",icon:i.Archive}];e.s(["SubPageNav",0,function({workspaceId:e}){let{t:l}=(0,c.useI18n)(),n=(0,a.usePathname)(),i=o.find(e=>n.includes(`/${e.key}`))?.key;return(0,t.jsxs)("div",{className:"header-sm flex items-center gap-1 px-4 py-2",children:[(0,t.jsxs)(r.default,{href:`/workspaces/${e}`,className:"mr-2 flex items-center gap-1.5 rounded-md px-2 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:[(0,t.jsx)(s.ArrowLeft,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:l("archive.backToBoard")})]}),(0,t.jsx)("span",{className:"mr-2 h-4 w-px bg-border"}),o.map(a=>{let s=a.icon,n=i===a.key;return(0,t.jsxs)(r.default,{href:`/workspaces/${e}/${a.key}`,className:`flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors ${n?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"}`,children:[(0,t.jsx)(s,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:l(`sidebar.${a.key}`)})]},a.key)})]})}])},583315,e=>{"use strict";let t=(0,e.i(258114).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",0,t],583315)},113205,e=>{"use strict";var t=e.i(430989),r=e.i(47816);e.s(["EmptyState",0,function({icon:e,title:a,description:s,action:l,className:n}){return(0,t.jsxs)("div",{className:(0,r.cn)("flex h-48 flex-col items-center justify-center gap-2 text-center",n),children:[e&&(0,t.jsx)(e,{className:"h-10 w-10 text-muted-foreground/40"}),(0,t.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:a}),s&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground/60",children:s}),l&&(0,t.jsx)("div",{className:"mt-2",children:l})]})}])},107414,e=>{"use strict";e.s(["BOARD_COLUMNS",0,[{id:"TODO",label:"To Do",color:"bg-slate-400"},{id:"IN_PROGRESS",label:"In Progress",color:"bg-amber-400"},{id:"IN_REVIEW",label:"In Review",color:"bg-sky-400"},{id:"DONE",label:"Done",color:"bg-emerald-400"},{id:"CANCELLED",label:"Cancelled",color:"bg-rose-400"}],"NOTE_CATEGORIES_PRESET",0,["账号","环境","需求","备忘"],"PRIORITY_CONFIG",0,{LOW:{label:"低",color:"bg-slate-500/20 text-slate-300 border border-slate-500/30"},MEDIUM:{label:"中",color:"bg-amber-500/20 text-amber-300 border border-amber-500/30"},HIGH:{label:"高",color:"bg-orange-500/20 text-orange-300 border border-orange-500/30"},CRITICAL:{label:"紧急",color:"bg-rose-500/20 text-rose-300 border border-rose-500/30"}},"TOWER_LABEL_NAME",0,"Tower"])},972154,267896,e=>{"use strict";var t=e.i(755683);let r=(0,t.createServerReference)("40816f1089cc11e1deaf5ddc8dfa56a6b84258f832",t.callServer,void 0,t.findSourceMapURL,"createNote");e.s(["createNote",0,r],972154);let a=(0,t.createServerReference)("407726b8e8dc1e51adc33a8da5b63aa8bd5c374fc6",t.callServer,void 0,t.findSourceMapURL,"deleteNote");e.s(["deleteNote",0,a],267896)},311604,e=>{"use strict";var t=e.i(430989),r=e.i(641338),a=e.i(304275),s=e.i(924609),l=e.i(755167),n=e.i(349369),i=e.i(107414),c=e.i(972154),o=e.i(755683);let d=(0,o.createServerReference)("60b2576353e03901c0da05b99c127e374650fbd03a",o.callServer,void 0,o.findSourceMapURL,"updateNote");var x=e.i(267896);let m=(0,o.createServerReference)("604452c0f9ae25b58bc58c071deedc7e246f9780d8",o.callServer,void 0,o.findSourceMapURL,"getProjectNotes");var u=e.i(47816);function p({active:e,onSelect:r}){let{t:a}=(0,n.useI18n)();return(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,t.jsx)("button",{onClick:()=>r("all"),className:(0,u.cn)("rounded-lg px-3 py-1 text-xs font-medium transition-colors","all"===e?"bg-primary/15 text-primary ring-1 ring-primary/20":"text-muted-foreground hover:bg-accent"),children:a("notes.allCategories")}),i.NOTE_CATEGORIES_PRESET.map(a=>(0,t.jsx)("button",{onClick:()=>r(a),className:(0,u.cn)("rounded-lg px-3 py-1 text-xs font-medium transition-colors",e===a?"bg-primary/15 text-primary ring-1 ring-primary/20":"text-muted-foreground hover:bg-accent"),children:a},a))]})}var h=e.i(744838),g=e.i(702431),f=e.i(652459),j=e.i(113205),b=e.i(894362),v=e.i(584451),N=e.i(201853),y=e.i(680538);function S({note:e,onEdit:r,onDelete:a}){let{t:s}=(0,n.useI18n)(),l=e.content.slice(0,300);return(0,t.jsxs)("div",{className:"group relative rounded-lg border border-border bg-card p-4 transition-colors hover:border-border/80 hover:bg-accent/20",children:[(0,t.jsxs)("div",{className:"absolute right-3 top-3 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-sm",onClick:()=>r(e),className:"text-muted-foreground","aria-label":s("notes.edit"),children:(0,t.jsx)(b.Pencil,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-sm",onClick:()=>a(e.id),className:"text-muted-foreground hover:text-rose-400","aria-label":s("notes.delete"),children:(0,t.jsx)(v.Trash2,{className:"h-3.5 w-3.5"})})]}),(0,t.jsx)("div",{className:"mb-2 pr-16",children:(0,t.jsx)("h3",{className:"truncate text-sm font-semibold text-foreground",children:e.title})}),(0,t.jsx)("span",{className:"mb-3 inline-block rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:e.category}),(0,t.jsx)("div",{className:"prose prose-sm dark:prose-invert max-h-24 overflow-hidden text-muted-foreground",children:(0,t.jsx)(N.default,{remarkPlugins:[y.default],children:l})})]})}function w({notes:e,onEdit:r,onDelete:a}){let{t:s}=(0,n.useI18n)();return 0===e.length?(0,t.jsx)(j.EmptyState,{icon:f.FileText,title:s("notes.empty"),description:s("notes.emptyHint")}):(0,t.jsx)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:e.map(e=>(0,t.jsx)(S,{note:e,onEdit:r,onDelete:a},e.id))})}var E=e.i(779574);function C({value:e,onChange:r}){return(0,t.jsxs)("div",{className:"relative grid grid-cols-2 gap-4 flex-1 min-h-64",children:[(0,t.jsx)(E.Textarea,{value:e,onChange:e=>r(e.target.value),className:"absolute inset-0 w-1/2 pr-2 resize-none font-mono text-sm border rounded-md p-3 bg-background text-foreground border-border focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Write Markdown here..."}),(0,t.jsx)("div",{className:"absolute inset-0 left-1/2 pl-2",children:(0,t.jsx)("div",{className:"h-full overflow-y-auto border rounded-md p-3 border-border prose prose-sm dark:prose-invert max-w-none",children:(0,t.jsx)(N.default,{remarkPlugins:[y.default],children:e})})})]})}e.s(["NotesPageClient",0,function({allWorkspaces:e,initialWorkspaceId:o,initialProjectId:u,initialNotes:f}){let j,b,{t:v}=(0,n.useI18n)(),[N,y]=(0,r.useTransition)(),[S,E]=(0,r.useState)(o),[T,k]=(0,r.useState)(u),[I,R]=(0,r.useState)(f),[O,P]=(0,r.useState)("all"),[A,_]=(0,r.useState)(null),[L,$]=(0,r.useState)(!1),[D,B]=(0,r.useState)(""),[M,G]=(0,r.useState)(""),[U,z]=(0,r.useState)(i.NOTE_CATEGORIES_PRESET[3]),[V,H]=(0,r.useState)(o),[F,W]=(0,r.useState)(u),K=e.find(e=>e.id===S),Y=K?.projects??[],q=e.find(e=>e.id===V),J=q?.projects??[],Q=(0,r.useCallback)(e=>{e?y(async()=>{R(await m(e))}):R([])},[y]),X=async()=>{F&&D.trim()&&(await (0,c.createNote)({title:D.trim(),content:M,category:U,projectId:F}),$(!1),F===T&&Q(T))},Z=async()=>{A&&D.trim()&&(await d(A.id,{title:D.trim(),content:M,category:U}),_(null),Q(T))},ee=async e=>{let t=I.find(t=>t.id===e);!t||confirm(v("notes.deleteConfirm",{title:t.title}))&&(await (0,x.deleteNote)(e),Q(T))},et="all"===O?I.map(e=>({...e,updatedAt:new Date(e.updatedAt)})):I.filter(e=>e.category===O).map(e=>({...e,updatedAt:new Date(e.updatedAt)})),er=L||null!==A;return(0,t.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,t.jsx)(l.SubPageNav,{workspaceId:S}),(0,t.jsxs)("div",{className:"header-sm flex items-center gap-3 px-6 py-2",children:[(0,t.jsxs)(g.Select,{value:S,onValueChange:t=>t&&(t=>{if(t===S)return;E(t);let r=e.find(e=>e.id===t),a=r?.projects[0]??null;k(a?.id??null),P("all"),Q(a?.id??null)})(t),children:[(0,t.jsx)(g.SelectTrigger,{className:"h-8 w-auto min-w-[120px]",children:(0,t.jsx)("span",{className:"truncate",children:e.find(e=>e.id===S)?.name??S})}),(0,t.jsx)(g.SelectContent,{children:e.map(e=>(0,t.jsx)(g.SelectItem,{value:e.id,children:e.name},e.id))})]}),Y.length>0&&(0,t.jsxs)(g.Select,{value:T??"",onValueChange:e=>e&&void(e!==T&&(k(e),P("all"),Q(e))),children:[(0,t.jsx)(g.SelectTrigger,{className:"h-8 w-auto min-w-[140px]",children:(0,t.jsx)("span",{className:"truncate",children:(j=Y.find(e=>e.id===T))?j.alias?`${j.name} (${j.alias})`:j.name:""})}),(0,t.jsx)(g.SelectContent,{children:Y.map(e=>(0,t.jsxs)(g.SelectItem,{value:e.id,children:[e.name,e.alias?` (${e.alias})`:""]},e.id))})]}),!er&&(0,t.jsxs)(h.Button,{onClick:()=>{B(""),G(""),z(i.NOTE_CATEGORIES_PRESET[3]),H(S),W(T),_(null),$(!0)},className:"ml-auto bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[(0,t.jsx)(a.Plus,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:v("notes.newNote")})]})]}),(0,t.jsx)("div",{className:"flex-1 overflow-hidden px-6 py-4 flex flex-col",children:er?(0,t.jsxs)("div",{className:"flex flex-col gap-4 flex-1 min-h-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[!A&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground whitespace-nowrap",children:v("notes.workspace")}),(0,t.jsxs)(g.Select,{value:V,onValueChange:t=>t&&(t=>{if(t===V)return;H(t);let r=e.find(e=>e.id===t),a=r?.projects[0]??null;W(a?.id??null)})(t),children:[(0,t.jsx)(g.SelectTrigger,{className:"min-w-[140px] text-xs",children:(0,t.jsx)("span",{className:"truncate",children:e.find(e=>e.id===V)?.name??V})}),(0,t.jsx)(g.SelectContent,{children:e.map(e=>(0,t.jsx)(g.SelectItem,{value:e.id,children:e.name},e.id))})]})]}),!A&&J.length>0&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground whitespace-nowrap",children:v("notes.project")}),(0,t.jsxs)(g.Select,{value:F??"",onValueChange:e=>e&&W(e),children:[(0,t.jsx)(g.SelectTrigger,{className:"min-w-[160px] text-xs",children:(0,t.jsx)("span",{className:"truncate",children:(b=J.find(e=>e.id===F))?b.alias?`${b.name} (${b.alias})`:b.name:""})}),(0,t.jsx)(g.SelectContent,{children:J.map(e=>(0,t.jsxs)(g.SelectItem,{value:e.id,children:[e.name,e.alias?` (${e.alias})`:""]},e.id))})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground whitespace-nowrap",children:v("notes.categoryLabel")}),(0,t.jsxs)(g.Select,{value:U,onValueChange:e=>e&&z(e),children:[(0,t.jsx)(g.SelectTrigger,{className:"min-w-[120px] text-xs",children:(0,t.jsx)("span",{className:"truncate",children:U})}),(0,t.jsx)(g.SelectContent,{children:i.NOTE_CATEGORIES_PRESET.map(e=>(0,t.jsx)(g.SelectItem,{value:e,children:e},e))})]})]})]}),(0,t.jsx)("input",{type:"text",value:D,onChange:e=>B(e.target.value),placeholder:v("notes.titlePlaceholder"),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),(0,t.jsx)(C,{value:M,onChange:G}),(0,t.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,t.jsx)(h.Button,{variant:"outline",onClick:()=>{$(!1),_(null)},children:v("notes.cancel")}),(0,t.jsx)(h.Button,{onClick:A?Z:X,disabled:!D.trim()||!A&&!F,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:v("notes.save")})]})]}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(p,{active:O,onSelect:P}),(0,t.jsxs)("div",{className:`relative ${N?"opacity-40 pointer-events-none":""} transition-opacity`,children:[N&&(0,t.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:(0,t.jsx)(s.Loader2,{className:"size-5 animate-spin text-muted-foreground"})}),0===Y.length?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-16 text-center",children:[(0,t.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:v("notes.noProject")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground/60",children:v("notes.noProjectHint")})]}):(0,t.jsx)(w,{notes:et,onEdit:e=>{B(e.title),G(e.content),z(e.category),_(e),$(!1)},onDelete:ee})]})]})})]})}],311604)}]);
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,755167,e=>{"use strict";var t=e.i(430989),r=e.i(226549),s=e.i(347880),a=e.i(583315),l=e.i(652459),n=e.i(819614),i=e.i(306308),c=e.i(349369);let o=[{key:"notes",icon:l.FileText},{key:"assets",icon:n.FolderOpen},{key:"archive",icon:i.Archive}];e.s(["SubPageNav",0,function({workspaceId:e}){let{t:l}=(0,c.useI18n)(),n=(0,s.usePathname)(),i=o.find(e=>n.includes(`/${e.key}`))?.key;return(0,t.jsxs)("div",{className:"header-sm flex items-center gap-1 px-4 py-2",children:[(0,t.jsxs)(r.default,{href:`/workspaces/${e}`,className:"mr-2 flex items-center gap-1.5 rounded-md px-2 py-1.5 text-xs text-muted-foreground transition-colors hover:bg-accent hover:text-foreground",children:[(0,t.jsx)(a.ArrowLeft,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:l("archive.backToBoard")})]}),(0,t.jsx)("span",{className:"mr-2 h-4 w-px bg-border"}),o.map(s=>{let a=s.icon,n=i===s.key;return(0,t.jsxs)(r.default,{href:`/workspaces/${e}/${s.key}`,className:`flex items-center gap-1.5 rounded-md px-3 py-1.5 text-xs font-medium transition-colors ${n?"bg-accent text-foreground":"text-muted-foreground hover:bg-accent/50 hover:text-foreground"}`,children:[(0,t.jsx)(a,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:l(`sidebar.${s.key}`)})]},s.key)})]})}])},583315,e=>{"use strict";let t=(0,e.i(258114).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",0,t],583315)},113205,e=>{"use strict";var t=e.i(430989),r=e.i(47816);e.s(["EmptyState",0,function({icon:e,title:s,description:a,action:l,className:n}){return(0,t.jsxs)("div",{className:(0,r.cn)("flex h-48 flex-col items-center justify-center gap-2 text-center",n),children:[e&&(0,t.jsx)(e,{className:"h-10 w-10 text-muted-foreground/40"}),(0,t.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:s}),a&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground/60",children:a}),l&&(0,t.jsx)("div",{className:"mt-2",children:l})]})}])},107414,e=>{"use strict";e.s(["BOARD_COLUMNS",0,[{id:"TODO",label:"To Do",color:"bg-slate-400"},{id:"IN_PROGRESS",label:"In Progress",color:"bg-amber-400"},{id:"IN_REVIEW",label:"In Review",color:"bg-sky-400"},{id:"DONE",label:"Done",color:"bg-emerald-400"},{id:"CANCELLED",label:"Cancelled",color:"bg-rose-400"}],"NOTE_CATEGORIES_PRESET",0,["账号","环境","需求","备忘"],"PRIORITY_CONFIG",0,{LOW:{label:"低",color:"bg-slate-500/20 text-slate-300 border border-slate-500/30"},MEDIUM:{label:"中",color:"bg-amber-500/20 text-amber-300 border border-amber-500/30"},HIGH:{label:"高",color:"bg-orange-500/20 text-orange-300 border border-orange-500/30"},CRITICAL:{label:"紧急",color:"bg-rose-500/20 text-rose-300 border border-rose-500/30"}},"TOWER_LABEL_NAME",0,"Tower"])},685096,804116,e=>{"use strict";var t=e.i(755683);let r=(0,t.createServerReference)("403fad9ebe8b9e1dc7f1d84ba9f267d69f1e3f20c4",t.callServer,void 0,t.findSourceMapURL,"createNote");e.s(["createNote",0,r],685096);let s=(0,t.createServerReference)("40ac13c2e48d6ff0756d0719dc52cfb65d8122e8fb",t.callServer,void 0,t.findSourceMapURL,"deleteNote");e.s(["deleteNote",0,s],804116)},311604,e=>{"use strict";var t=e.i(430989),r=e.i(641338),s=e.i(304275),a=e.i(924609),l=e.i(755167),n=e.i(349369),i=e.i(107414),c=e.i(685096),o=e.i(755683);let d=(0,o.createServerReference)("60b021782424769ccf051331f15e8143a514563074",o.callServer,void 0,o.findSourceMapURL,"updateNote");var x=e.i(804116);let m=(0,o.createServerReference)("60472b00827db9471649abde9c128bb3ddf48c5c90",o.callServer,void 0,o.findSourceMapURL,"getProjectNotes");var u=e.i(47816);function p({active:e,onSelect:r}){let{t:s}=(0,n.useI18n)();return(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-1.5",children:[(0,t.jsx)("button",{onClick:()=>r("all"),className:(0,u.cn)("rounded-lg px-3 py-1 text-xs font-medium transition-colors","all"===e?"bg-primary/15 text-primary ring-1 ring-primary/20":"text-muted-foreground hover:bg-accent"),children:s("notes.allCategories")}),i.NOTE_CATEGORIES_PRESET.map(s=>(0,t.jsx)("button",{onClick:()=>r(s),className:(0,u.cn)("rounded-lg px-3 py-1 text-xs font-medium transition-colors",e===s?"bg-primary/15 text-primary ring-1 ring-primary/20":"text-muted-foreground hover:bg-accent"),children:s},s))]})}var h=e.i(744838),g=e.i(702431),f=e.i(652459),j=e.i(113205),b=e.i(894362),v=e.i(584451),N=e.i(201853),y=e.i(680538);function S({note:e,onEdit:r,onDelete:s}){let{t:a}=(0,n.useI18n)(),l=e.content.slice(0,300);return(0,t.jsxs)("div",{className:"group relative rounded-lg border border-border bg-card p-4 transition-colors hover:border-border/80 hover:bg-accent/20",children:[(0,t.jsxs)("div",{className:"absolute right-3 top-3 flex items-center gap-1 opacity-0 transition-opacity group-hover:opacity-100",children:[(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-sm",onClick:()=>r(e),className:"text-muted-foreground","aria-label":a("notes.edit"),children:(0,t.jsx)(b.Pencil,{className:"h-3.5 w-3.5"})}),(0,t.jsx)(h.Button,{variant:"ghost",size:"icon-sm",onClick:()=>s(e.id),className:"text-muted-foreground hover:text-rose-400","aria-label":a("notes.delete"),children:(0,t.jsx)(v.Trash2,{className:"h-3.5 w-3.5"})})]}),(0,t.jsx)("div",{className:"mb-2 pr-16",children:(0,t.jsx)("h3",{className:"truncate text-sm font-semibold text-foreground",children:e.title})}),(0,t.jsx)("span",{className:"mb-3 inline-block rounded-full bg-muted px-2 py-0.5 text-[10px] font-medium text-muted-foreground",children:e.category}),(0,t.jsx)("div",{className:"prose prose-sm dark:prose-invert max-h-24 overflow-hidden text-muted-foreground",children:(0,t.jsx)(N.default,{remarkPlugins:[y.default],children:l})})]})}function w({notes:e,onEdit:r,onDelete:s}){let{t:a}=(0,n.useI18n)();return 0===e.length?(0,t.jsx)(j.EmptyState,{icon:f.FileText,title:a("notes.empty"),description:a("notes.emptyHint")}):(0,t.jsx)("div",{className:"grid gap-4 sm:grid-cols-2 lg:grid-cols-3",children:e.map(e=>(0,t.jsx)(S,{note:e,onEdit:r,onDelete:s},e.id))})}var E=e.i(779574);function C({value:e,onChange:r}){return(0,t.jsxs)("div",{className:"relative grid grid-cols-2 gap-4 flex-1 min-h-64",children:[(0,t.jsx)(E.Textarea,{value:e,onChange:e=>r(e.target.value),className:"absolute inset-0 w-1/2 pr-2 resize-none font-mono text-sm border rounded-md p-3 bg-background text-foreground border-border focus:outline-none focus:ring-1 focus:ring-ring",placeholder:"Write Markdown here..."}),(0,t.jsx)("div",{className:"absolute inset-0 left-1/2 pl-2",children:(0,t.jsx)("div",{className:"h-full overflow-y-auto border rounded-md p-3 border-border prose prose-sm dark:prose-invert max-w-none",children:(0,t.jsx)(N.default,{remarkPlugins:[y.default],children:e})})})]})}e.s(["NotesPageClient",0,function({allWorkspaces:e,initialWorkspaceId:o,initialProjectId:u,initialNotes:f}){let j,b,{t:v}=(0,n.useI18n)(),[N,y]=(0,r.useTransition)(),[S,E]=(0,r.useState)(o),[T,k]=(0,r.useState)(u),[I,R]=(0,r.useState)(f),[O,P]=(0,r.useState)("all"),[A,_]=(0,r.useState)(null),[L,$]=(0,r.useState)(!1),[D,B]=(0,r.useState)(""),[M,G]=(0,r.useState)(""),[U,z]=(0,r.useState)(i.NOTE_CATEGORIES_PRESET[3]),[V,H]=(0,r.useState)(o),[F,W]=(0,r.useState)(u),K=e.find(e=>e.id===S),Y=K?.projects??[],q=e.find(e=>e.id===V),J=q?.projects??[],Q=(0,r.useCallback)(e=>{e?y(async()=>{R(await m(e))}):R([])},[y]),X=async()=>{F&&D.trim()&&(await (0,c.createNote)({title:D.trim(),content:M,category:U,projectId:F}),$(!1),F===T&&Q(T))},Z=async()=>{A&&D.trim()&&(await d(A.id,{title:D.trim(),content:M,category:U}),_(null),Q(T))},ee=async e=>{let t=I.find(t=>t.id===e);!t||confirm(v("notes.deleteConfirm",{title:t.title}))&&(await (0,x.deleteNote)(e),Q(T))},et="all"===O?I.map(e=>({...e,updatedAt:new Date(e.updatedAt)})):I.filter(e=>e.category===O).map(e=>({...e,updatedAt:new Date(e.updatedAt)})),er=L||null!==A;return(0,t.jsxs)("div",{className:"flex h-full flex-col overflow-hidden",children:[(0,t.jsx)(l.SubPageNav,{workspaceId:S}),(0,t.jsxs)("div",{className:"header-sm flex items-center gap-3 px-6 py-2",children:[(0,t.jsxs)(g.Select,{value:S,onValueChange:t=>t&&(t=>{if(t===S)return;E(t);let r=e.find(e=>e.id===t),s=r?.projects[0]??null;k(s?.id??null),P("all"),Q(s?.id??null)})(t),children:[(0,t.jsx)(g.SelectTrigger,{className:"h-8 w-auto min-w-[120px]",children:(0,t.jsx)("span",{className:"truncate",children:e.find(e=>e.id===S)?.name??S})}),(0,t.jsx)(g.SelectContent,{children:e.map(e=>(0,t.jsx)(g.SelectItem,{value:e.id,children:e.name},e.id))})]}),Y.length>0&&(0,t.jsxs)(g.Select,{value:T??"",onValueChange:e=>e&&void(e!==T&&(k(e),P("all"),Q(e))),children:[(0,t.jsx)(g.SelectTrigger,{className:"h-8 w-auto min-w-[140px]",children:(0,t.jsx)("span",{className:"truncate",children:(j=Y.find(e=>e.id===T))?j.alias?`${j.name} (${j.alias})`:j.name:""})}),(0,t.jsx)(g.SelectContent,{children:Y.map(e=>(0,t.jsxs)(g.SelectItem,{value:e.id,children:[e.name,e.alias?` (${e.alias})`:""]},e.id))})]}),!er&&(0,t.jsxs)(h.Button,{onClick:()=>{B(""),G(""),z(i.NOTE_CATEGORIES_PRESET[3]),H(S),W(T),_(null),$(!0)},className:"ml-auto bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[(0,t.jsx)(s.Plus,{className:"h-3.5 w-3.5"}),(0,t.jsx)("span",{children:v("notes.newNote")})]})]}),(0,t.jsx)("div",{className:"flex-1 overflow-hidden px-6 py-4 flex flex-col",children:er?(0,t.jsxs)("div",{className:"flex flex-col gap-4 flex-1 min-h-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 flex-wrap",children:[!A&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground whitespace-nowrap",children:v("notes.workspace")}),(0,t.jsxs)(g.Select,{value:V,onValueChange:t=>t&&(t=>{if(t===V)return;H(t);let r=e.find(e=>e.id===t),s=r?.projects[0]??null;W(s?.id??null)})(t),children:[(0,t.jsx)(g.SelectTrigger,{className:"min-w-[140px] text-xs",children:(0,t.jsx)("span",{className:"truncate",children:e.find(e=>e.id===V)?.name??V})}),(0,t.jsx)(g.SelectContent,{children:e.map(e=>(0,t.jsx)(g.SelectItem,{value:e.id,children:e.name},e.id))})]})]}),!A&&J.length>0&&(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground whitespace-nowrap",children:v("notes.project")}),(0,t.jsxs)(g.Select,{value:F??"",onValueChange:e=>e&&W(e),children:[(0,t.jsx)(g.SelectTrigger,{className:"min-w-[160px] text-xs",children:(0,t.jsx)("span",{className:"truncate",children:(b=J.find(e=>e.id===F))?b.alias?`${b.name} (${b.alias})`:b.name:""})}),(0,t.jsx)(g.SelectContent,{children:J.map(e=>(0,t.jsxs)(g.SelectItem,{value:e.id,children:[e.name,e.alias?` (${e.alias})`:""]},e.id))})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground whitespace-nowrap",children:v("notes.categoryLabel")}),(0,t.jsxs)(g.Select,{value:U,onValueChange:e=>e&&z(e),children:[(0,t.jsx)(g.SelectTrigger,{className:"min-w-[120px] text-xs",children:(0,t.jsx)("span",{className:"truncate",children:U})}),(0,t.jsx)(g.SelectContent,{children:i.NOTE_CATEGORIES_PRESET.map(e=>(0,t.jsx)(g.SelectItem,{value:e,children:e},e))})]})]})]}),(0,t.jsx)("input",{type:"text",value:D,onChange:e=>B(e.target.value),placeholder:v("notes.titlePlaceholder"),className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder:text-muted-foreground focus:outline-none focus:ring-1 focus:ring-ring"}),(0,t.jsx)(C,{value:M,onChange:G}),(0,t.jsxs)("div",{className:"flex items-center gap-2 justify-end",children:[(0,t.jsx)(h.Button,{variant:"outline",onClick:()=>{$(!1),_(null)},children:v("notes.cancel")}),(0,t.jsx)(h.Button,{onClick:A?Z:X,disabled:!D.trim()||!A&&!F,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:v("notes.save")})]})]}):(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)(p,{active:O,onSelect:P}),(0,t.jsxs)("div",{className:`relative ${N?"opacity-40 pointer-events-none":""} transition-opacity`,children:[N&&(0,t.jsx)("div",{className:"absolute inset-0 z-10 flex items-center justify-center",children:(0,t.jsx)(a.Loader2,{className:"size-5 animate-spin text-muted-foreground"})}),0===Y.length?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center gap-2 py-16 text-center",children:[(0,t.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:v("notes.noProject")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground/60",children:v("notes.noProjectHint")})]}):(0,t.jsx)(w,{notes:et,onEdit:e=>{B(e.title),G(e.content),z(e.category),_(e),$(!1)},onDelete:ee})]})]})})]})}],311604)}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,353055,e=>{"use strict";var t=e.i(430989),s=e.i(641338),a=e.i(347880),i=e.i(387104),n=e.i(349369),r=e.i(744838),l=e.i(745943),o=e.i(779574),c=e.i(993623),d=e.i(174145),m=e.i(108523),u=e.i(331548),g=e.i(47816),x=e.i(277547),h=e.i(258114);let p=(0,h.default)("cpu",[["path",{d:"M12 20v2",key:"1lh1kg"}],["path",{d:"M12 2v2",key:"tus03m"}],["path",{d:"M17 20v2",key:"1rnc9c"}],["path",{d:"M17 2v2",key:"11trls"}],["path",{d:"M2 12h2",key:"1t8f8n"}],["path",{d:"M2 17h2",key:"7oei6x"}],["path",{d:"M2 7h2",key:"asdhe0"}],["path",{d:"M20 12h2",key:"1q8mjw"}],["path",{d:"M20 17h2",key:"1fpfkl"}],["path",{d:"M20 7h2",key:"1o8tra"}],["path",{d:"M7 20v2",key:"4gnj0m"}],["path",{d:"M7 2v2",key:"1i4yhu"}],["rect",{x:"4",y:"4",width:"16",height:"16",rx:"2",key:"1vbyd7"}],["rect",{x:"8",y:"8",width:"8",height:"8",rx:"1",key:"z9xiuo"}]]);var f=e.i(652459);let b=(0,h.default)("sliders-horizontal",[["path",{d:"M10 5H3",key:"1qgfaw"}],["path",{d:"M12 19H3",key:"yhmn1j"}],["path",{d:"M14 3v4",key:"1sua03"}],["path",{d:"M16 17v4",key:"1q0r14"}],["path",{d:"M21 12h-9",key:"1o4lsq"}],["path",{d:"M21 19h-5",key:"1rlt1p"}],["path",{d:"M21 5h-7",key:"1oszz2"}],["path",{d:"M8 10v4",key:"tgpxqk"}],["path",{d:"M8 12H3",key:"a7s4jb"}]]);var j=e.i(678978),v=e.i(315883),N=e.i(621994),y=e.i(304275);let w=(0,h.default)("star",[["path",{d:"M11.525 2.295a.53.53 0 0 1 .95 0l2.31 4.679a2.123 2.123 0 0 0 1.595 1.16l5.166.756a.53.53 0 0 1 .294.904l-3.736 3.638a2.123 2.123 0 0 0-.611 1.878l.882 5.14a.53.53 0 0 1-.771.56l-4.618-2.428a2.122 2.122 0 0 0-1.973 0L6.396 21.01a.53.53 0 0 1-.77-.56l.881-5.139a2.122 2.122 0 0 0-.611-1.879L2.16 9.795a.53.53 0 0 1 .294-.906l5.165-.755a2.122 2.122 0 0 0 1.597-1.16z",key:"r04s7s"}]]);var C=e.i(584451);let k=(0,h.default)("square-pen",[["path",{d:"M12 3H5a2 2 0 0 0-2 2v14a2 2 0 0 0 2 2h14a2 2 0 0 0 2-2v-7",key:"1m0v6g"}],["path",{d:"M18.375 2.625a1 1 0 0 1 3 3l-9.013 9.014a2 2 0 0 1-.853.505l-2.873.84a.5.5 0 0 1-.62-.62l.84-2.873a2 2 0 0 1 .506-.852z",key:"ohrbg2"}]]),M=(0,h.default)("save",[["path",{d:"M15.2 3a2 2 0 0 1 1.4.6l3.8 3.8a2 2 0 0 1 .6 1.4V19a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2z",key:"1c8476"}],["path",{d:"M17 21v-7a1 1 0 0 0-1-1H8a1 1 0 0 0-1 1v7",key:"1ydtos"}],["path",{d:"M7 3v4a1 1 0 0 0 1 1h7",key:"t51u73"}]]);var S=e.i(924609),P=e.i(698300),T=e.i(170528),B=e.i(581511),R=e.i(329371),D=e.i(15308),L=e.i(690943),V=e.i(755683);let z=(0,V.createServerReference)("0064dade2d6202e2aa6a7485fe8656aa24e5136bd0",V.callServer,void 0,V.findSourceMapURL,"getAvailableTerminalApps");var I=e.i(43723);let H=(0,V.createServerReference)("403ace48c62cdd56db88b85c44d847d5b1a2a2315e",V.callServer,void 0,V.findSourceMapURL,"createPrompt"),U=(0,V.createServerReference)("6026ab430111b7c84e36d6ae7c6a83bc294fbe8f63",V.callServer,void 0,V.findSourceMapURL,"updatePrompt"),E=(0,V.createServerReference)("405c413b51a86b2b3628e8ffab27155fc36ae88d80",V.callServer,void 0,V.findSourceMapURL,"deletePrompt"),K=(0,V.createServerReference)("604232d1e702ec23d3a6daf49011a9274a496eeaf9",V.callServer,void 0,V.findSourceMapURL,"setDefaultPrompt"),$=(0,V.createServerReference)("003416e104937d51de626e7f4ac0cf9f23e2a3057d",V.callServer,void 0,V.findSourceMapURL,"getDefaultCliProfile"),O=(0,V.createServerReference)("60f3fbdd453b7f7f8ef2aa6b42ad947e4fa3d7de7f",V.callServer,void 0,V.findSourceMapURL,"updateCliProfile");function A({options:e,value:s,onChange:a}){return(0,t.jsx)("div",{className:"inline-flex rounded-lg border border-border/50 bg-muted/30 p-1 gap-0.5",children:e.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>a(e.value),className:(0,g.cn)("rounded-md px-3.5 py-1.5 text-sm font-medium transition-all duration-200 cursor-pointer",s===e.value?"bg-background text-foreground shadow-sm":"text-muted-foreground hover:text-foreground"),children:e.label},e.value))})}function F({label:e,description:s,children:a,className:i}){return(0,t.jsxs)("div",{className:(0,g.cn)("flex items-center justify-between py-4 border-b border-border/50 last:border-0",i),children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1 pr-4",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:e}),s&&(0,t.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:s})]}),(0,t.jsx)("div",{className:"shrink-0",children:a})]})}let q=[{id:"general",labelKey:"settings.general",descKey:"settings.generalDesc",icon:x.Settings,accent:"blue"},{id:"ai-tools",labelKey:"settings.aiTools.title",descKey:"settings.aiTools.cliVerificationDesc",icon:p,accent:"emerald"},{id:"prompts",labelKey:"settings.prompts",descKey:"settings.promptsDesc",icon:f.FileText,accent:"violet"},{id:"config",labelKey:"settings.config",descKey:"settings.configDesc",icon:b,accent:"amber"},{id:"cli-profile",labelKey:"settings.cliProfile.title",descKey:"settings.cliProfile.navDesc",icon:j.Terminal,accent:"cyan"},{id:"notifications",labelKey:"settings.notifications.title",descKey:"settings.notifications.navDesc",icon:v.Bell,accent:"rose"}],J={blue:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},emerald:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},violet:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},amber:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},cyan:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"},rose:{bg:"bg-accent",text:"text-foreground",ring:"ring-border",indicator:"bg-foreground"}},G="ai-manager:default-cli-adapter",X=[{type:"claude_local",label:"Claude Code",source:"builtin"}],_={host:"",ownerMatch:"*",localPathTemplate:"",priority:0};function Y(){let e=(0,a.useRouter)(),{t:x}=(0,n.useI18n)(),{theme:h,setTheme:p}=(0,i.useTheme)(),{locale:f,setLocale:b}=(0,n.useI18n)(),[j,v]=(0,s.useState)("general"),V=(0,s.useRef)(null),[Y,Q]=(0,s.useState)({left:0,width:0}),[W,Z]=(0,s.useState)(!1),[ee,et]=(0,s.useState)("Terminal"),[es,ea]=(0,s.useState)([]),[ei,en]=(0,s.useState)(180),[er,el]=(0,s.useState)("claude_local"),[eo,ec]=(0,s.useState)(null),[ed,em]=(0,s.useState)({}),[eu,eg]=(0,s.useState)([]),[ex,eh]=(0,s.useState)(!1),[ep,ef]=(0,s.useState)(null),[eb,ej]=(0,s.useState)(null),[ev,eN]=(0,s.useState)(""),[ey,ew]=(0,s.useState)(""),[eC,ek]=(0,s.useState)(""),[eM,eS]=(0,s.useState)([]),[eP,eT]=(0,s.useState)(null),[eB,eR]=(0,s.useState)({..._}),[eD,eL]=(0,s.useState)(!1),[eV,ez]=(0,s.useState)({..._}),[eI,eH]=(0,s.useState)(!1),[eU,eE]=(0,s.useState)(0),[eK,e$]=(0,s.useState)(null),[eO,eA]=(0,s.useState)({maxUploadMb:50,maxConcurrent:3}),[eF,eq]=(0,s.useState)({timeoutSec:30}),[eJ,eG]=(0,s.useState)({resultLimit:20,allModeCap:5,debounceMs:250,snippetLength:80}),[eX,e_]=(0,s.useState)({minCols:1,maxCols:5,minRows:1,maxRows:5}),[eY,eQ]=(0,s.useState)(null),[eW,eZ]=(0,s.useState)(!1),[e0,e1]=(0,s.useState)(""),[e2,e5]=(0,s.useState)(null),[e3,e4]=(0,s.useState)(""),[e8,e6]=(0,s.useState)(""),[e7,e9]=(0,s.useState)(""),[te,tt]=(0,s.useState)(""),[ts,ta]=(0,s.useState)(!0),[ti,tn]=(0,s.useState)(!0);(0,s.useEffect)(()=>Z(!0),[]),(0,s.useEffect)(()=>{(0,R.getConfigValue)("terminal.app","Terminal").then(et),(0,R.getConfigValue)("terminal.idleTimeoutSec",180).then(en),z().then(ea)},[]),(0,s.useEffect)(()=>{let e=localStorage.getItem(G);e&&el(e)},[]),(0,s.useEffect)(()=>{(0,I.getPrompts)().then(eg)},[]);let tr=async()=>{try{let e=await fetch("/api/internal/hooks/install");if(e.ok){let t=await e.json();eQ(t)}}catch{}};async function tl(){await (0,D.setConfigValue)("terminal.app",ee)}async function to(){let e=Math.max(180,ei);en(e),await (0,D.setConfigValue)("terminal.idleTimeoutSec",e)}async function tc(e){if(!eo){ec(e),em(t=>{let s={...t};return delete s[e],s});try{let t=await fetch("/api/adapters/test",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({adapterType:e})}),s=await t.json();em(t=>({...t,[e]:s}))}catch{em(t=>({...t,[e]:{ok:!1,checks:[{name:"network_error",passed:!1,message:"Network request failed"}]}}))}finally{ec(null)}}}(0,s.useEffect)(()=>{(0,R.getConfigValue)("git.pathMappingRules",[]).then(eS),(0,R.getConfigValue)("hooks.autoUploadTypes",["png","jpg","jpeg","gif","webp","svg","pdf","md","txt","json"]).then(e=>{e1(e.join(", "))}),tr(),(0,L.getConfigValues)(["system.maxUploadBytes","system.maxConcurrentExecutions","git.timeoutSec","search.resultLimit","search.allModeCap","search.debounceMs","search.snippetLength","missions.grid.minCols","missions.grid.maxCols","missions.grid.minRows","missions.grid.maxRows"]).then(e=>{eA({maxUploadMb:Math.round((e["system.maxUploadBytes"]??0x3200000)/1024/1024),maxConcurrent:e["system.maxConcurrentExecutions"]??3}),eq({timeoutSec:e["git.timeoutSec"]??30}),eG({resultLimit:e["search.resultLimit"]??20,allModeCap:e["search.allModeCap"]??5,debounceMs:e["search.debounceMs"]??250,snippetLength:e["search.snippetLength"]??80}),e_({minCols:e["missions.grid.minCols"]??1,maxCols:e["missions.grid.maxCols"]??5,minRows:e["missions.grid.minRows"]??1,maxRows:e["missions.grid.maxRows"]??5})})},[]),(0,s.useEffect)(()=>{$().then(e=>{e&&(e5(e),e4(e.command),e6(function(e){try{let t=JSON.parse(e);return Array.isArray(t)?t.join("\n"):""}catch{return""}}(e.baseArgs)),e9(function(e){try{let t=JSON.parse(e);if("object"!=typeof t||Array.isArray(t)||null===t)return"";return Object.entries(t).map(([e,t])=>`${e}=${t}`).join("\n")}catch{return""}}(e.envVars))),ta(!1)})},[]),(0,s.useEffect)(()=>{(0,R.getConfigValue)("notification.enabled",!0).then(tn)},[]);let td=(0,s.useCallback)(()=>{ef(null),eN(""),ew(""),ek(""),eh(!0)},[]),tm=(0,s.useCallback)(e=>{ef(e),eN(e.name),ew(e.description??""),ek(e.content),eh(!0)},[]),tu=(0,s.useCallback)(async()=>{ev.trim()&&eC.trim()&&(ep?await U(ep.id,{name:ev.trim(),description:ey.trim()||void 0,content:eC.trim()}):await H({name:ev.trim(),description:ey.trim()||void 0,content:eC.trim()}),eh(!1),eg(await (0,I.getPrompts)()),e.refresh())},[ev,ey,eC,ep,e]),tg=(0,s.useCallback)(async()=>{eb&&(await E(eb),ej(null),eg(await (0,I.getPrompts)()),e.refresh())},[eb,e]),tx=(0,s.useCallback)(async t=>{await K(t),eg(await (0,I.getPrompts)()),e.refresh()},[e]),th=async()=>{await (0,D.setConfigValue)("system.maxUploadBytes",1024*eO.maxUploadMb*1024),await (0,D.setConfigValue)("system.maxConcurrentExecutions",eO.maxConcurrent)},tp=async()=>{await (0,D.setConfigValue)("git.timeoutSec",eF.timeoutSec)},tf=async()=>{await (0,D.setConfigValue)("search.resultLimit",eJ.resultLimit),await (0,D.setConfigValue)("search.allModeCap",eJ.allModeCap),await (0,D.setConfigValue)("search.debounceMs",eJ.debounceMs),await (0,D.setConfigValue)("search.snippetLength",eJ.snippetLength)},tb=async()=>{let e=Math.min(eX.minCols,eX.maxCols),t=Math.max(eX.minCols,eX.maxCols),s=Math.min(eX.minRows,eX.maxRows),a=Math.max(eX.minRows,eX.maxRows);e_({minCols:e,maxCols:t,minRows:s,maxRows:a}),await (0,D.setConfigValue)("missions.grid.minCols",e),await (0,D.setConfigValue)("missions.grid.maxCols",t),await (0,D.setConfigValue)("missions.grid.minRows",s),await (0,D.setConfigValue)("missions.grid.maxRows",a)},tj=async()=>{let e=e0.split(",").map(e=>e.trim()).filter(Boolean);await (0,D.setConfigValue)("hooks.autoUploadTypes",e)},tv=async()=>{if(eY){eZ(!0);try{let e=eY.installed?"DELETE":"POST";await fetch("/api/internal/hooks/install",{method:e}),await tr()}finally{eZ(!1)}}},tN=async()=>{if(!eV.host.trim()||!eV.localPathTemplate.trim())return;let e=eV.localPathTemplate.trim().replace(/\/+$/,""),t=eI?`${e}/{path}`:e,s=[...eM,{id:crypto.randomUUID(),host:eV.host.trim(),ownerMatch:eV.ownerMatch.trim()||"*",localPathTemplate:t,priority:eV.priority}];await (0,D.setConfigValue)("git.pathMappingRules",s),eS(s),ez({..._}),eH(!1),eL(!1)},ty=async e=>{if(!eB.host.trim()||!eB.localPathTemplate.trim())return;let t=eM.map(t=>t.id===e?{...t,host:eB.host.trim(),ownerMatch:eB.ownerMatch.trim()||"*",localPathTemplate:eB.localPathTemplate.trim(),priority:eB.priority}:t);await (0,D.setConfigValue)("git.pathMappingRules",t),eS(t),eT(null)},tw=async e=>{let t=eM.filter(t=>t.id!==e);await (0,D.setConfigValue)("git.pathMappingRules",t),eS(t),e$(null)},tC=(0,s.useCallback)(async()=>{if(e2){try{let e=JSON.stringify(e8.split("\n").map(e=>e.trim()).filter(Boolean)),t={};e7.split("\n").map(e=>e.trim()).filter(Boolean).forEach(e=>{let s=e.indexOf("=");if(s>0){let a=e.slice(0,s).trim(),i=e.slice(s+1).trim();t[a]=i}});let s=JSON.stringify(t);await O(e2.id,{command:e3,baseArgs:e,envVars:s}),tt("saved")}catch{tt("error")}setTimeout(()=>tt(""),2e3)}},[e2,e3,e8,e7]);async function tk(){let e=!ti;tn(e),await (0,D.setConfigValue)("notification.enabled",e)}let tM=(0,s.useCallback)(()=>{e.back()},[e]);(0,s.useEffect)(()=>{let e=V.current;if(!e)return;let t=e.querySelector(`[data-section="${j}"]`);if(!t)return;let s=e.getBoundingClientRect(),a=t.getBoundingClientRect();Q({left:a.left-s.left,width:a.width})},[j]);let tS=q.find(e=>e.id===j),tP=tS?J[tS.accent]:J.blue;return(0,t.jsxs)("div",{className:"flex h-full flex-col bg-background",children:[(0,t.jsx)("div",{className:"flex-shrink-0 border-b bg-card/50 backdrop-blur-sm",children:(0,t.jsxs)("div",{className:"mx-auto max-w-5xl px-6",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between pb-3 pt-5",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h1",{className:"text-2xl font-bold tracking-tight",children:x("settings.title")}),(0,t.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:x("settings.configDesc")})]}),(0,t.jsxs)(r.Button,{variant:"outline",onClick:tM,className:"gap-1.5 bg-card shadow-sm cursor-pointer",children:[(0,t.jsx)(N.X,{className:"h-3.5 w-3.5"}),"ESC"]})]}),(0,t.jsxs)("div",{ref:V,className:"relative flex gap-1 overflow-x-auto",children:[q.map(e=>{let s=e.icon,a=j===e.id,i=J[e.accent];return(0,t.jsxs)("button",{"data-section":e.id,onClick:()=>v(e.id),className:(0,g.cn)("relative flex items-center gap-2 rounded-t-lg px-4 py-2.5","text-sm font-medium whitespace-nowrap cursor-pointer","transition-colors duration-200","focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-2",a?`${i.text} bg-background`:"text-muted-foreground hover:text-foreground hover:bg-muted/50"),children:[(0,t.jsx)("span",{className:(0,g.cn)("flex h-6 w-6 items-center justify-center rounded-md","transition-colors duration-200",a?i.bg:"bg-transparent"),children:(0,t.jsx)(s,{className:"h-3.5 w-3.5"})}),(0,t.jsx)("span",{children:x(e.labelKey)})]},e.id)}),(0,t.jsx)("div",{className:(0,g.cn)("absolute bottom-0 h-0.5 rounded-full","transition-all duration-250 ease-out",tP.indicator),style:{left:Y.left,width:Y.width}})]})]})}),(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:(0,t.jsxs)("div",{className:"mx-auto max-w-4xl px-6 py-8",children:[tS&&(0,t.jsxs)("div",{className:"mb-6 flex items-start gap-4",children:[(0,t.jsx)("div",{className:(0,g.cn)("flex h-10 w-10 flex-shrink-0 items-center justify-center rounded-xl","ring-1",tP.bg,tP.text,tP.ring),children:(0,t.jsx)(tS.icon,{className:"h-5 w-5"})}),(0,t.jsxs)("div",{className:"min-w-0",children:[(0,t.jsx)("h2",{className:"text-lg font-semibold leading-tight",children:x(tS.labelKey)}),(0,t.jsx)("p",{className:"mt-0.5 text-sm text-muted-foreground",children:x(tS.descKey)})]})]}),(0,t.jsx)("div",{className:"mb-6 border-t"}),function(){switch(j){case"general":let e;return e=[{value:"light",label:x("settings.themeLight")},{value:"dark",label:x("settings.themeDark")},{value:"system",label:x("settings.themeSystem")}],(0,t.jsxs)("div",{className:"divide-y divide-border/50",children:[(0,t.jsx)(F,{label:x("settings.theme"),description:x("settings.themeDesc"),children:W?(0,t.jsx)(A,{options:e,value:h??"system",onChange:e=>p(e)}):(0,t.jsx)("div",{className:"inline-flex h-9 rounded-lg border border-border/50 bg-muted/30 p-1 w-[200px]"})}),(0,t.jsx)(F,{label:x("settings.language"),description:x("settings.languageDesc"),children:(0,t.jsx)(A,{options:[{value:"zh",label:"中文"},{value:"en",label:"English"}],value:f,onChange:e=>b(e)})}),(0,t.jsxs)("div",{className:"py-4 border-b border-border/50",children:[(0,t.jsx)("div",{className:"flex items-center justify-between",children:(0,t.jsxs)("div",{className:"min-w-0 flex-1 pr-4",children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:x("settings.terminal.label")}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:x("settings.terminal.desc")})]})}),(0,t.jsxs)("div",{className:"mt-3 flex flex-col gap-2",children:[es.length>0&&(0,t.jsx)("div",{className:"flex flex-wrap gap-2",children:es.map(e=>(0,t.jsx)("button",{type:"button",onClick:()=>{et(e.value),(0,D.setConfigValue)("terminal.app",e.value)},className:(0,g.cn)("rounded-lg border px-3.5 py-1.5 text-xs font-medium transition-all duration-200 cursor-pointer",ee===e.value?"border-foreground bg-accent text-foreground font-medium":"border-border text-muted-foreground hover:bg-accent/50 hover:text-foreground"),children:e.name},e.value))}),(0,t.jsx)("input",{type:"text",value:ee,onChange:e=>et(e.target.value),onBlur:tl,placeholder:x("settings.terminal.placeholder"),className:"h-9 w-64 rounded-lg border border-border/50 bg-muted/30 px-3 text-sm focus:outline-none focus:ring-2 focus:ring-blue-500/30"})]})]}),(0,t.jsx)(F,{label:x("settings.terminal.idleTimeout"),description:x("settings.terminal.idleTimeoutDesc"),children:(0,t.jsx)("input",{type:"number",value:ei,onChange:e=>en(Number(e.target.value)),onBlur:to,min:180,className:"h-9 w-28 rounded-lg border border-border/50 bg-muted/30 px-3 text-sm text-right focus:outline-none focus:ring-2 focus:ring-blue-500/30"})})]});case"ai-tools":return(0,t.jsx)("ul",{className:"divide-y rounded-xl border border-border bg-card",children:X.map(e=>{let s=er===e.type,a=eo===e.type,i=ed[e.type];return(0,t.jsx)("li",{children:(0,t.jsxs)("div",{className:"px-5 py-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex flex-wrap items-center gap-2",children:[(0,t.jsx)("span",{className:"font-medium",children:e.label}),(0,t.jsx)(d.Badge,{variant:"outline",children:x("label.builtin")}),s&&(0,t.jsxs)(d.Badge,{variant:"secondary",className:"shrink-0",children:[(0,t.jsx)(w,{className:"h-3 w-3 mr-1 fill-yellow-400 text-yellow-400"}),x("settings.prompts.default")]}),i&&(0,t.jsx)(d.Badge,{variant:i.ok?"secondary":"destructive",className:(0,g.cn)("shrink-0",i.ok&&"bg-green-600 text-white hover:bg-green-700"),children:i.ok?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(T.CheckCircle2,{className:"h-3 w-3 mr-1"}),x("settings.aiTools.testPassed")]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(B.XCircle,{className:"h-3 w-3 mr-1"}),x("settings.aiTools.testFailed")]})})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mt-0.5",children:e.type})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2 shrink-0",children:[!s&&(0,t.jsxs)(r.Button,{variant:"outline",size:"sm",onClick:()=>{var t;el(t=e.type),localStorage.setItem(G,t)},children:[(0,t.jsx)(w,{className:"h-3.5 w-3.5 mr-1.5 text-muted-foreground"}),x("settings.prompts.setDefault")]}),(0,t.jsx)(r.Button,{variant:"outline",size:"sm",onClick:()=>tc(e.type),disabled:a,children:a?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(S.Loader2,{className:"h-3.5 w-3.5 animate-spin mr-1.5"}),x("settings.aiTools.testing")]}):x("settings.aiTools.testConnection")}),"external"===e.source&&(0,t.jsx)(r.Button,{variant:"outline",size:"icon-sm",className:"h-8 w-8 text-destructive hover:text-destructive",title:x("common.delete"),children:(0,t.jsx)(C.Trash2,{className:"h-4 w-4"})})]})]}),i&&(0,t.jsx)("div",{className:"mt-3 rounded-md border border-border bg-muted/30 px-4 py-3",children:(0,t.jsx)("div",{className:"space-y-1.5",children:i.checks.map(s=>(0,t.jsxs)("div",{className:"flex items-center gap-2 text-sm",children:[(0,t.jsx)("span",{className:(0,g.cn)("w-1.5 h-1.5 rounded-full shrink-0",s.passed?"bg-green-500":"bg-red-500")}),(0,t.jsx)("span",{className:(0,g.cn)(s.passed?"text-foreground":"text-red-700 dark:text-red-300"),children:s.message})]},`${e.type}-${s.name}`))})})]})},e.type)})});case"prompts":return W?(0,t.jsxs)("div",{className:"space-y-4",children:[(0,t.jsx)("div",{className:"flex justify-end",children:(0,t.jsxs)(r.Button,{onClick:td,variant:"default",children:[(0,t.jsx)(y.Plus,{className:"h-4 w-4 mr-2"}),x("settings.prompts.newPrompt")]})}),0===eu.length?(0,t.jsxs)("div",{className:"flex flex-col items-center justify-center py-12 text-center rounded-lg border border-dashed border-border/50",children:[(0,t.jsx)("p",{className:"text-muted-foreground",children:x("settings.prompts.empty")}),(0,t.jsx)("p",{className:"mt-1 text-sm text-muted-foreground",children:x("settings.prompts.emptyHint")})]}):(0,t.jsx)("div",{className:"rounded-xl border border-border/50 divide-y divide-border/50",children:eu.map(e=>(0,t.jsxs)("div",{className:"flex items-center justify-between px-4 py-3.5 hover:bg-muted/30 transition-colors",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("h4",{className:"text-sm font-medium truncate",children:e.name}),e.isDefault&&(0,t.jsxs)(d.Badge,{variant:"secondary",className:"shrink-0 rounded-full text-xs",children:[(0,t.jsx)(w,{className:"h-3 w-3 mr-1 fill-yellow-400 text-yellow-400"}),x("settings.prompts.default")]})]}),e.description&&(0,t.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground truncate",children:e.description})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0 ml-4",children:[(0,t.jsx)(r.Button,{variant:"ghost",size:"icon-sm",onClick:()=>tx(e.id),title:x("settings.prompts.setDefault"),children:(0,t.jsx)(w,{className:(0,g.cn)("h-4 w-4",e.isDefault?"fill-yellow-400 text-yellow-400":"text-muted-foreground")})}),(0,t.jsx)(r.Button,{variant:"ghost",size:"icon-sm",onClick:()=>tm(e),title:x("settings.prompts.editPrompt"),children:(0,t.jsx)(k,{className:"h-4 w-4"})}),(0,t.jsx)(r.Button,{variant:"ghost",size:"icon-sm",onClick:()=>ej(e.id),className:"text-destructive",title:x("settings.prompts.delete"),children:(0,t.jsx)(C.Trash2,{className:"h-4 w-4"})})]})]},e.id))}),(0,t.jsx)(u.Dialog,{open:ex,onOpenChange:eh,children:(0,t.jsxs)(u.DialogContent,{children:[(0,t.jsxs)(u.DialogHeader,{children:[(0,t.jsx)(u.DialogTitle,{children:ep?x("settings.prompts.editPrompt"):x("settings.prompts.newPrompt")}),(0,t.jsx)(u.DialogDescription,{children:ep?x("settings.prompts.editPrompt"):x("settings.prompts.newPrompt")})]}),(0,t.jsxs)("div",{className:"space-y-4 py-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)(c.Label,{htmlFor:"prompt-name",children:x("settings.prompts.promptName")}),(0,t.jsx)(l.Input,{id:"prompt-name",value:ev,onChange:e=>eN(e.target.value),placeholder:x("settings.prompts.promptNamePlaceholder"),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.Label,{htmlFor:"prompt-description",children:x("settings.prompts.promptDescription")}),(0,t.jsx)(l.Input,{id:"prompt-description",value:ey,onChange:e=>ew(e.target.value),placeholder:x("settings.prompts.promptDescriptionPlaceholder"),className:"mt-1.5"})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)(c.Label,{htmlFor:"prompt-content",children:x("settings.prompts.promptContent")}),(0,t.jsx)(o.Textarea,{id:"prompt-content",value:eC,onChange:e=>ek(e.target.value),placeholder:x("settings.prompts.promptContentPlaceholder"),rows:8,className:"mt-1.5 font-mono text-sm"})]})]}),(0,t.jsxs)(u.DialogFooter,{children:[(0,t.jsx)(r.Button,{variant:"outline",onClick:()=>eh(!1),children:x("settings.prompts.cancel")}),(0,t.jsx)(r.Button,{onClick:tu,disabled:!ev.trim()||!eC.trim(),children:x("settings.prompts.save")})]})]})}),(0,t.jsx)(u.Dialog,{open:!!eb,onOpenChange:e=>!e&&ej(null),children:(0,t.jsxs)(u.DialogContent,{children:[(0,t.jsxs)(u.DialogHeader,{children:[(0,t.jsx)(u.DialogTitle,{children:x("settings.prompts.deleteConfirmTitle")}),(0,t.jsx)(u.DialogDescription,{children:x("settings.prompts.deleteConfirmMessage")})]}),(0,t.jsxs)(u.DialogFooter,{children:[(0,t.jsx)(r.Button,{variant:"outline",onClick:()=>ej(null),children:x("settings.prompts.cancel")}),(0,t.jsx)(r.Button,{variant:"destructive",onClick:tg,children:x("settings.prompts.delete")})]})]})})]}):(0,t.jsx)("div",{className:"h-32 rounded-lg bg-muted animate-pulse"});case"config":let s,a,i;return(0,t.jsxs)("div",{className:"space-y-8",children:[(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center justify-between mb-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-sm font-semibold",children:x("settings.config.git.title")}),(0,t.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:x("settings.config.git.desc")})]}),(0,t.jsxs)(r.Button,{onClick:()=>{ez({..._}),eL(!0)},children:[(0,t.jsx)(y.Plus,{className:"mr-2 h-4 w-4"}),x("settings.config.git.addRule")]})]}),(0,t.jsxs)("div",{className:"space-y-3",children:[0!==eM.length||eD?(0,t.jsx)("ul",{className:"divide-y rounded-xl border border-border bg-card",children:eM.map(e=>eP===e.id?(0,t.jsxs)("li",{className:"px-5 py-4 bg-muted/20",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-3",children:[(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:x("settings.config.git.host")}),(0,t.jsx)(l.Input,{value:eB.host,onChange:e=>eR(t=>({...t,host:e.target.value})),placeholder:x("settings.config.git.hostPlaceholder"),className:"text-sm"})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:x("settings.config.git.ownerMatch")}),(0,t.jsx)(l.Input,{value:eB.ownerMatch,onChange:e=>eR(t=>({...t,ownerMatch:e.target.value})),placeholder:x("settings.config.git.ownerMatchPlaceholder"),className:"text-sm"})]}),(0,t.jsxs)("div",{className:"space-y-1 col-span-2",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:x("settings.config.git.localPathTemplate")}),(0,t.jsx)(l.Input,{value:eB.localPathTemplate,onChange:e=>eR(t=>({...t,localPathTemplate:e.target.value})),placeholder:x("settings.config.git.localPathTemplatePlaceholder"),className:"text-sm font-mono"})]}),(0,t.jsxs)("div",{className:"space-y-1",children:[(0,t.jsx)("label",{className:"text-xs text-muted-foreground",children:x("settings.config.git.priority")}),(0,t.jsx)(l.Input,{type:"number",value:eB.priority,onChange:e=>eR(t=>({...t,priority:Number(e.target.value)})),className:"text-sm w-24"})]})]}),(0,t.jsxs)("div",{className:"flex justify-end gap-2 mt-3",children:[(0,t.jsx)(r.Button,{variant:"ghost",size:"sm",onClick:()=>eT(null),children:x("settings.config.git.cancel")}),(0,t.jsx)(r.Button,{size:"sm",onClick:()=>ty(e.id),children:x("settings.config.git.save")})]})]},e.id):(0,t.jsx)("li",{className:"group px-5 py-4 hover:bg-muted/20 transition-colors",children:(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"font-medium text-sm",children:e.host}),"*"!==e.ownerMatch&&(0,t.jsxs)("span",{className:"text-xs text-muted-foreground",children:["/ ",e.ownerMatch]}),(0,t.jsxs)(d.Badge,{variant:"outline",className:"text-[10px] px-1.5 py-0",children:[x("settings.config.git.priority")," ",e.priority]})]}),(0,t.jsx)("p",{className:"mt-0.5 font-mono text-xs text-muted-foreground truncate",children:e.localPathTemplate})]}),(0,t.jsxs)("div",{className:"flex items-center gap-1 shrink-0 opacity-0 group-hover:opacity-100 transition-opacity",children:[(0,t.jsx)(r.Button,{variant:"ghost",size:"icon-sm",onClick:()=>{eT(e.id),eR({host:e.host,ownerMatch:e.ownerMatch,localPathTemplate:e.localPathTemplate,priority:e.priority})},title:x("settings.config.git.edit"),children:(0,t.jsx)(k,{className:"h-4 w-4"})}),(0,t.jsx)(r.Button,{variant:"ghost",size:"icon-sm",onClick:()=>e$(e.id),className:"text-destructive",title:x("settings.config.git.delete"),children:(0,t.jsx)(C.Trash2,{className:"h-4 w-4"})})]})]})},e.id))}):(0,t.jsx)("div",{className:"rounded-xl border border-dashed border-border p-8 text-center",children:(0,t.jsx)("p",{className:"text-sm text-muted-foreground",children:x("settings.config.git.noRules")})}),eD&&(0,t.jsxs)("div",{className:"rounded-xl border border-border bg-muted/20 p-5 space-y-4",children:[(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium",children:x("settings.config.git.host")}),(0,t.jsx)(l.Input,{value:eV.host,onChange:e=>ez(t=>({...t,host:e.target.value})),placeholder:x("settings.config.git.hostPlaceholder"),className:"text-sm",autoFocus:!0})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium",children:x("settings.config.git.ownerMatch")}),(0,t.jsx)(l.Input,{value:eV.ownerMatch,onChange:e=>ez(t=>({...t,ownerMatch:e.target.value})),placeholder:x("settings.config.git.ownerMatchPlaceholder"),className:"text-sm"})]})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium",children:x("settings.config.git.localPathTemplate")}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(l.Input,{value:eV.localPathTemplate,onChange:e=>ez(t=>({...t,localPathTemplate:e.target.value})),placeholder:x("settings.config.git.localPathTemplatePlaceholder"),className:"text-sm font-mono flex-1"}),(0,t.jsx)("button",{type:"button",onClick:()=>eH(e=>!e),className:(0,g.cn)("shrink-0 rounded-full px-2.5 py-1 text-[11px] font-mono font-medium transition-colors cursor-pointer",eI?"bg-foreground text-background":"bg-muted text-muted-foreground hover:text-foreground"),children:"{path}"})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:eI?x("onboarding.step3.pathHintFull"):x("onboarding.step3.pathHintRepo")})]}),(0,t.jsxs)("div",{className:"space-y-1.5",children:[(0,t.jsx)("label",{className:"text-xs font-medium",children:x("settings.config.git.priority")}),(0,t.jsx)(l.Input,{type:"number",value:eV.priority,onChange:e=>ez(t=>({...t,priority:Number(e.target.value)})),className:"text-sm w-24"})]}),eV.localPathTemplate&&(s=eV.localPathTemplate.trim().replace(/\/+$/,""),a=eI?`${s}/{path}`:s,i=[{label:"GitHub SSH",url:"git@github.com:user/my-app.git"},{label:"GitHub HTTPS",url:"https://github.com/user/my-app.git"},{label:"GitLab Subgroup",url:"https://gitlab.com/org/team/sub/my-api.git"}],(0,t.jsxs)("div",{className:"rounded-lg bg-muted/40 border border-border px-4 py-3 space-y-2",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)("span",{className:"text-xs font-medium text-muted-foreground",children:x("onboarding.step3.previewLabel")}),(0,t.jsx)("div",{className:"flex gap-1",children:i.map((e,s)=>(0,t.jsx)("button",{type:"button",onClick:()=>eE(s),className:(0,g.cn)("rounded-md px-2 py-0.5 text-[11px] font-medium transition-colors cursor-pointer",eU===s?"bg-foreground text-background":"bg-muted text-muted-foreground hover:text-foreground"),children:e.label},s))})]}),(0,t.jsxs)("div",{className:"space-y-0.5",children:[(0,t.jsx)("p",{className:"font-mono text-[11px] text-muted-foreground truncate",children:i[eU].url}),(0,t.jsxs)("p",{className:"font-mono text-sm",children:[(0,t.jsx)("span",{className:"text-muted-foreground",children:"→ "}),(0,t.jsx)("span",{className:"text-foreground font-medium",children:function(e,t){if(!e||!t)return"";let s=t.trim(),a=[],i=s.match(/^git@[^:]+:(.+)$/);if(i)a=i[1].replace(/\.git\/?$/,"").split("/").filter(Boolean);else try{let e=new URL(s);a=decodeURIComponent(e.pathname).replace(/\.git\/?$/,"").split("/").filter(Boolean)}catch{return""}if(!a.length)return"";let n=a[0],r=a[a.length-1],l=a.join("/");if(e.includes("{path}"))return e.replace("{path}",l).replace("{owner}",n).replace("{repo}",r).replace(/\/+$/,"");let o=e.replace("{owner}",n).replace("{repo}","").replace(/\/+$/,"");return`${o}/${r}`}(a,i[eU].url)})]})]})]})),(0,t.jsxs)("div",{className:"flex justify-end gap-2",children:[(0,t.jsx)(r.Button,{variant:"ghost",size:"sm",onClick:()=>eL(!1),children:x("settings.config.git.cancel")}),(0,t.jsxs)(r.Button,{size:"sm",onClick:tN,disabled:!eV.host.trim()||!eV.localPathTemplate.trim(),children:[(0,t.jsx)(M,{className:"h-3.5 w-3.5 mr-1.5"}),x("settings.config.git.save")]})]})]})]})]}),(0,t.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-sm font-semibold",children:x("settings.config.system.title")}),(0,t.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:x("settings.config.system.desc")})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:x("settings.config.system.maxUpload")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:x("settings.config.system.maxUploadHint")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(l.Input,{type:"number",min:1,max:500,value:eO.maxUploadMb,onChange:e=>eA(t=>({...t,maxUploadMb:Number(e.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"}),(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:"MB"})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:x("settings.config.system.maxConcurrent")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:x("settings.config.system.maxConcurrentHint")})]}),(0,t.jsx)(l.Input,{type:"number",min:1,max:10,value:eO.maxConcurrent,onChange:e=>eA(t=>({...t,maxConcurrent:Number(e.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]})]}),(0,t.jsx)(r.Button,{onClick:th,className:"rounded-lg",children:x("common.save")})]}),(0,t.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-sm font-semibold",children:x("settings.config.gitParams.title")}),(0,t.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:x("settings.config.gitParams.desc")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:x("settings.config.gitParams.timeout")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:x("settings.config.gitParams.timeoutHint")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(l.Input,{type:"number",min:5,max:300,value:eF.timeoutSec,onChange:e=>eq(t=>({...t,timeoutSec:Number(e.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"}),(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:"s"})]})]}),(0,t.jsx)(r.Button,{onClick:tp,className:"rounded-lg",children:x("common.save")})]}),(0,t.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-sm font-semibold",children:x("settings.config.search.title")}),(0,t.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:x("settings.config.search.desc")})]}),(0,t.jsxs)("div",{className:"grid grid-cols-1 sm:grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:x("settings.config.search.resultLimit")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:x("settings.config.search.resultLimitHint")})]}),(0,t.jsx)(l.Input,{type:"number",min:5,max:100,value:eJ.resultLimit,onChange:e=>eG(t=>({...t,resultLimit:Number(e.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:x("settings.config.search.allModeCap")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:x("settings.config.search.allModeCapHint")})]}),(0,t.jsx)(l.Input,{type:"number",min:1,max:20,value:eJ.allModeCap,onChange:e=>eG(t=>({...t,allModeCap:Number(e.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:x("settings.config.search.debounceMs")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:x("settings.config.search.debounceMsHint")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(l.Input,{type:"number",min:50,max:1e3,value:eJ.debounceMs,onChange:e=>eG(t=>({...t,debounceMs:Number(e.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"}),(0,t.jsx)("span",{className:"text-sm text-muted-foreground",children:"ms"})]})]}),(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:x("settings.config.search.snippetLength")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:x("settings.config.search.snippetLengthHint")})]}),(0,t.jsx)(l.Input,{type:"number",min:20,max:500,value:eJ.snippetLength,onChange:e=>eG(t=>({...t,snippetLength:Number(e.target.value)})),className:"w-24 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]})]}),(0,t.jsx)(r.Button,{onClick:tf,className:"rounded-lg",children:x("common.save")})]}),(0,t.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-sm font-semibold",children:x("settings.config.missions.title")}),(0,t.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:x("settings.config.missions.desc")})]}),(0,t.jsxs)("div",{className:"grid grid-cols-2 gap-4",children:[(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)("label",{className:"text-sm font-medium flex-1",children:x("settings.config.missions.minCols")}),(0,t.jsx)(l.Input,{type:"number",min:1,max:10,value:eX.minCols,onChange:e=>e_(t=>({...t,minCols:Number(e.target.value)})),className:"w-20 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)("label",{className:"text-sm font-medium flex-1",children:x("settings.config.missions.maxCols")}),(0,t.jsx)(l.Input,{type:"number",min:1,max:10,value:eX.maxCols,onChange:e=>e_(t=>({...t,maxCols:Number(e.target.value)})),className:"w-20 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)("label",{className:"text-sm font-medium flex-1",children:x("settings.config.missions.minRows")}),(0,t.jsx)(l.Input,{type:"number",min:1,max:10,value:eX.minRows,onChange:e=>e_(t=>({...t,minRows:Number(e.target.value)})),className:"w-20 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsx)("label",{className:"text-sm font-medium flex-1",children:x("settings.config.missions.maxRows")}),(0,t.jsx)(l.Input,{type:"number",min:1,max:10,value:eX.maxRows,onChange:e=>e_(t=>({...t,maxRows:Number(e.target.value)})),className:"w-20 text-right rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]})]}),(0,t.jsx)(r.Button,{onClick:tb,className:"rounded-lg",children:x("common.save")})]}),(0,t.jsxs)("div",{className:"rounded-xl border border-border bg-muted/50 p-5 space-y-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("h3",{className:"text-sm font-semibold",children:x("settings.config.hooks.title")}),(0,t.jsx)("p",{className:"mt-0.5 text-xs text-muted-foreground",children:x("settings.config.hooks.desc")})]}),(0,t.jsxs)("div",{className:"flex items-center gap-4",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:x("settings.config.hooks.autoUploadTypes")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:x("settings.config.hooks.autoUploadTypesHint")})]}),(0,t.jsx)(l.Input,{value:e0,onChange:e=>e1(e.target.value),placeholder:"png, jpg, jpeg, gif, webp, svg, pdf",className:"w-80 rounded-lg border-border/50 bg-muted/30 focus:ring-2 focus:ring-amber-500/30"})]}),(0,t.jsx)(r.Button,{onClick:tj,className:"rounded-lg",children:x("common.save")}),(0,t.jsxs)("div",{className:"flex items-center gap-4 pt-4 border-t border-border/50",children:[(0,t.jsxs)("div",{className:"flex-1",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:eY?.installed?x("settings.config.hooks.installed"):x("settings.config.hooks.notInstalled")}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground",children:x("settings.config.hooks.installHint")})]}),(0,t.jsx)(r.Button,{variant:eY?.installed?"destructive":"default",onClick:tv,disabled:eW||!eY,className:"rounded-lg",children:eY?.installed?x("settings.config.hooks.uninstall"):x("settings.config.hooks.install")})]})]}),(0,t.jsx)(u.Dialog,{open:!!eK,onOpenChange:e=>!e&&e$(null),children:(0,t.jsxs)(u.DialogContent,{children:[(0,t.jsxs)(u.DialogHeader,{children:[(0,t.jsx)(u.DialogTitle,{children:x("settings.config.git.deleteConfirm")}),(0,t.jsx)(u.DialogDescription,{children:x("settings.config.git.deleteConfirmMessage")})]}),(0,t.jsxs)(u.DialogFooter,{children:[(0,t.jsx)(r.Button,{variant:"outline",onClick:()=>e$(null),children:x("settings.config.git.cancel")}),(0,t.jsx)(r.Button,{variant:"destructive",onClick:()=>eK&&tw(eK),children:x("settings.config.git.delete")})]})]})})]});case"cli-profile":return ts?(0,t.jsx)("div",{className:"flex items-center justify-center py-12",children:(0,t.jsx)(S.Loader2,{className:"h-5 w-5 animate-spin text-muted-foreground"})}):e2?(0,t.jsxs)("div",{className:"space-y-6",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"flex items-center gap-2 mb-2",children:(0,t.jsx)("label",{className:"text-sm font-medium",children:x("settings.cliProfile.command")})}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:x("settings.cliProfile.commandHint")}),(0,t.jsx)(l.Input,{type:"text",value:e3,onChange:e=>e4(e.target.value),placeholder:x("settings.cliProfile.commandPlaceholder"),className:"w-full rounded-lg border-border/50 bg-zinc-900 dark:bg-zinc-950 text-cyan-400 font-mono text-sm px-4 py-2.5 focus:ring-2 focus:ring-cyan-500/30 placeholder:text-zinc-600"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:x("settings.cliProfile.baseArgs")}),(0,t.jsx)(d.Badge,{variant:"secondary",className:"text-xs rounded-full px-2 py-0",children:"one per line"})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:x("settings.cliProfile.baseArgsHint")}),(0,t.jsx)(o.Textarea,{value:e8,onChange:e=>e6(e.target.value),placeholder:x("settings.cliProfile.baseArgsPlaceholder"),rows:4,className:"w-full rounded-lg border-border/50 bg-zinc-900 dark:bg-zinc-950 text-cyan-400 font-mono text-sm px-4 py-3 leading-relaxed focus:ring-2 focus:ring-cyan-500/30 placeholder:text-zinc-600 resize-none"})]}),(0,t.jsxs)("div",{children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 mb-2",children:[(0,t.jsx)("label",{className:"text-sm font-medium",children:x("settings.cliProfile.envVars")}),(0,t.jsx)(d.Badge,{variant:"secondary",className:"text-xs rounded-full px-2 py-0",children:"KEY=VALUE per line"})]}),(0,t.jsx)("p",{className:"text-xs text-muted-foreground mb-2",children:x("settings.cliProfile.envVarsHint")}),(0,t.jsx)(o.Textarea,{value:e7,onChange:e=>e9(e.target.value),placeholder:x("settings.cliProfile.envVarsPlaceholder"),rows:4,className:"w-full rounded-lg border-border/50 bg-zinc-900 dark:bg-zinc-950 text-cyan-400 font-mono text-sm px-4 py-3 leading-relaxed focus:ring-2 focus:ring-cyan-500/30 placeholder:text-zinc-600 resize-none"})]}),(0,t.jsxs)("div",{className:"flex items-center gap-3",children:[(0,t.jsxs)(r.Button,{onClick:tC,className:"rounded-lg",children:[(0,t.jsx)(M,{className:"h-4 w-4 mr-2"}),x("common.save")]}),"saved"===te&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 text-sm text-emerald-600 dark:text-emerald-400 animate-in fade-in duration-300",children:[(0,t.jsx)(P.Check,{className:"h-4 w-4"}),x("settings.cliProfile.saved")]}),"error"===te&&(0,t.jsxs)("span",{className:"inline-flex items-center gap-1 text-sm text-red-600 dark:text-red-400 animate-in fade-in duration-300",children:[(0,t.jsx)(B.XCircle,{className:"h-4 w-4"}),x("settings.cliProfile.saveError")]})]})]}):(0,t.jsx)("div",{className:"text-sm text-muted-foreground",children:x("settings.cliProfile.noProfile")});case"notifications":return(0,t.jsx)("div",{className:"divide-y divide-border/50",children:(0,t.jsxs)("div",{className:"flex items-center justify-between py-4",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("div",{className:"text-sm font-medium",children:x("settings.notifications.enable")}),(0,t.jsx)("div",{className:"text-xs text-muted-foreground mt-0.5",children:x("settings.notifications.enableDesc")})]}),(0,t.jsx)(m.Switch,{checked:ti,onCheckedChange:tk})]})})}}()]})})]})}e.s(["default",0,function(){return(0,t.jsx)(Y,{})}],353055)}]);
@@ -0,0 +1 @@
1
+ (globalThis.TURBOPACK||(globalThis.TURBOPACK=[])).push(["object"==typeof document?document.currentScript:void 0,494094,e=>{"use strict";let t=(0,e.i(258114).default)("chevron-left",[["path",{d:"m15 18-6-6 6-6",key:"1wnfg3"}]]);e.s(["ChevronLeft",0,t],494094)},597736,e=>{"use strict";var t=e.i(794097);e.s(["ChevronRight",()=>t.default])},986633,e=>{"use strict";let t=(0,e.i(258114).default)("square",[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}]]);e.s(["Square",0,t],986633)},86630,622622,e=>{"use strict";var t=e.i(258114);let r=(0,t.default)("clipboard-list",[["rect",{width:"8",height:"4",x:"8",y:"2",rx:"1",ry:"1",key:"tgr4d6"}],["path",{d:"M16 4h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2",key:"116196"}],["path",{d:"M12 11h4",key:"1jrz19"}],["path",{d:"M12 16h4",key:"n85exb"}],["path",{d:"M8 11h.01",key:"1dfujw"}],["path",{d:"M8 16h.01",key:"18s6g9"}]]);e.s(["ClipboardList",0,r],86630);let s=(0,t.default)("copy",[["rect",{width:"14",height:"14",x:"8",y:"8",rx:"2",ry:"2",key:"17jyea"}],["path",{d:"M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2",key:"zix9uf"}]]);e.s(["Copy",0,s],622622)},107414,e=>{"use strict";e.s(["BOARD_COLUMNS",0,[{id:"TODO",label:"To Do",color:"bg-slate-400"},{id:"IN_PROGRESS",label:"In Progress",color:"bg-amber-400"},{id:"IN_REVIEW",label:"In Review",color:"bg-sky-400"},{id:"DONE",label:"Done",color:"bg-emerald-400"},{id:"CANCELLED",label:"Cancelled",color:"bg-rose-400"}],"NOTE_CATEGORIES_PRESET",0,["账号","环境","需求","备忘"],"PRIORITY_CONFIG",0,{LOW:{label:"低",color:"bg-slate-500/20 text-slate-300 border border-slate-500/30"},MEDIUM:{label:"中",color:"bg-amber-500/20 text-amber-300 border border-amber-500/30"},HIGH:{label:"高",color:"bg-orange-500/20 text-orange-300 border border-orange-500/30"},CRITICAL:{label:"紧急",color:"bg-rose-500/20 text-rose-300 border border-rose-500/30"}},"TOWER_LABEL_NAME",0,"Tower"])},685096,804116,e=>{"use strict";var t=e.i(755683);let r=(0,t.createServerReference)("403fad9ebe8b9e1dc7f1d84ba9f267d69f1e3f20c4",t.callServer,void 0,t.findSourceMapURL,"createNote");e.s(["createNote",0,r],685096);let s=(0,t.createServerReference)("40ac13c2e48d6ff0756d0719dc52cfb65d8122e8fb",t.callServer,void 0,t.findSourceMapURL,"deleteNote");e.s(["deleteNote",0,s],804116)},583315,e=>{"use strict";let t=(0,e.i(258114).default)("arrow-left",[["path",{d:"m12 19-7-7 7-7",key:"1l729n"}],["path",{d:"M19 12H5",key:"x3x0zl"}]]);e.s(["ArrowLeft",0,t],583315)},113205,e=>{"use strict";var t=e.i(430989),r=e.i(47816);e.s(["EmptyState",0,function({icon:e,title:s,description:a,action:i,className:n}){return(0,t.jsxs)("div",{className:(0,r.cn)("flex h-48 flex-col items-center justify-center gap-2 text-center",n),children:[e&&(0,t.jsx)(e,{className:"h-10 w-10 text-muted-foreground/40"}),(0,t.jsx)("p",{className:"text-sm font-medium text-muted-foreground",children:s}),a&&(0,t.jsx)("p",{className:"text-xs text-muted-foreground/60",children:a}),i&&(0,t.jsx)("div",{className:"mt-2",children:i})]})}])},2139,e=>{"use strict";let t=(0,e.i(258114).default)("circle-play",[["path",{d:"M9 9.003a1 1 0 0 1 1.517-.859l4.997 2.997a1 1 0 0 1 0 1.718l-4.997 2.997A1 1 0 0 1 9 14.996z",key:"kmsa83"}],["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}]]);e.s(["PlayCircle",0,t],2139)},512839,662154,e=>{"use strict";let t=(0,e.i(258114).default)("upload",[["path",{d:"M12 3v12",key:"1x0j5s"}],["path",{d:"m17 8-5-5-5 5",key:"7q97r8"}],["path",{d:"M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4",key:"ih7n3h"}]]);e.s(["Upload",0,t],512839);var r=e.i(755683);let s=(0,r.createServerReference)("40c362b37281f9c39d1d8a379212895d5c2432e77d",r.callServer,void 0,r.findSourceMapURL,"uploadAsset");e.s(["uploadAsset",0,s],662154)},67544,e=>{"use strict";var t=e.i(755683);let r=(0,t.createServerReference)("40cc4cd0ee7a00f9b6941c3dc3f6d13b961eb28d7a",t.callServer,void 0,t.findSourceMapURL,"deleteAsset");e.s(["deleteAsset",0,r])},174145,e=>{"use strict";var t=e.i(228202),r=e.i(703995),s=e.i(555138),a=e.i(47816);let i=(0,s.cva)("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!",{variants:{variant:{default:"bg-primary text-primary-foreground [a]:hover:bg-primary/80",secondary:"bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",destructive:"bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",outline:"border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",ghost:"hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",link:"text-primary underline-offset-4 hover:underline"}},defaultVariants:{variant:"default"}});e.s(["Badge",0,function({className:e,variant:s="default",render:n,...l}){var c;return c={defaultTagName:"span",props:(0,t.mergeProps)({className:(0,a.cn)(i({variant:s}),e)},l),render:n,state:{slot:"badge",variant:s}},(0,r.useRenderElement)(c.defaultTagName??"div",c,c)}],174145)},170528,581511,e=>{"use strict";var t=e.i(93850);e.s(["CheckCircle2",()=>t.default],170528);let r=(0,e.i(258114).default)("circle-x",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"m15 9-6 6",key:"1uzhvr"}],["path",{d:"m9 9 6 6",key:"z0biqf"}]]);e.s(["XCircle",0,r],581511)},678978,e=>{"use strict";let t=(0,e.i(258114).default)("terminal",[["path",{d:"M12 19h8",key:"baeox8"}],["path",{d:"m4 17 6-6-6-6",key:"1yngyt"}]]);e.s(["Terminal",0,t],678978)},43723,e=>{"use strict";var t=e.i(755683);let r=(0,t.createServerReference)("40b16fc79d05bc036b0b898cc5c16d7ecd20566252",t.callServer,void 0,t.findSourceMapURL,"getPrompts");e.s(["getPrompts",0,r])},993623,e=>{"use strict";var t=e.i(430989),r=e.i(47816);e.s(["Label",0,function({className:e,...s}){return(0,t.jsx)("label",{"data-slot":"label",className:(0,r.cn)("flex items-center gap-2 text-sm leading-none font-medium select-none group-data-[disabled=true]:pointer-events-none group-data-[disabled=true]:opacity-50 peer-disabled:cursor-not-allowed peer-disabled:opacity-50",e),...s})}])},553708,e=>{"use strict";var t=e.i(755683);let r=(0,t.createServerReference)("780fbf51c8301f404b2c4273b548d05ab19803b5ac",t.callServer,void 0,t.findSourceMapURL,"startPtyExecution");e.s(["startPtyExecution",0,r])},664676,e=>{"use strict";var t=e.i(755683);let r=(0,t.createServerReference)("40277c58c7db736b9f772aa25c27e2efec4c1ec24c",t.callServer,void 0,t.findSourceMapURL,"stopPtyExecution");e.s(["stopPtyExecution",0,r])},878262,545315,e=>{"use strict";var t=e.i(755683);let r=(0,t.createServerReference)("608a1e69db59b3af747f4194ccb8b2db70f034437c",t.callServer,void 0,t.findSourceMapURL,"resumePtyExecution");e.s(["resumePtyExecution",0,r],878262);let s=(0,e.i(258114).default)("rotate-ccw",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}]]);e.s(["RotateCcw",0,s],545315)},586211,e=>{"use strict";let t=(0,e.i(258114).default)("lightbulb",[["path",{d:"M15 14c.2-1 .7-1.7 1.5-2.5 1-.9 1.5-2.2 1.5-3.5A6 6 0 0 0 6 8c0 1 .2 2.2 1.5 3.5.7.7 1.3 1.5 1.5 2.5",key:"1gvzjb"}],["path",{d:"M9 18h6",key:"x1upvd"}],["path",{d:"M10 22h4",key:"ceow96"}]]);e.s(["Lightbulb",0,t],586211)},142273,e=>{"use strict";var t=e.i(755683);let r=(0,t.createServerReference)("60481a02b04a77768d3e97a34f8ec6a44e1e7d3635",t.callServer,void 0,t.findSourceMapURL,"updateProject");e.s(["updateProject",0,r])},775899,e=>{"use strict";var t=e.i(430989),r=e.i(641338),s=e.i(259104),a=e.i(260949),i=e.i(811163),n=e.i(698300),l=e.i(924609),c=e.i(331548),o=e.i(744838),d=e.i(745943),u=e.i(779574),x=e.i(349369);e.s(["CreateBranchDialog",0,function({open:e,onOpenChange:m,branches:h,currentBranch:f,localPath:g,onCreated:p,onError:b}){let{t:v}=(0,x.useI18n)(),[y,j]=(0,r.useState)(""),[N,w]=(0,r.useState)(f),[k,C]=(0,r.useState)(""),[S,M]=(0,r.useState)(!1),[L,R]=(0,r.useState)(""),[D,E]=(0,r.useState)(!1);(0,r.useEffect)(()=>{e&&(j(""),w(f),C(""),R(""))},[e,f]);let T=[...new Set(h)].filter(e=>e.toLowerCase().includes(L.toLowerCase())),P=async()=>{if(y.trim()){M(!0);try{let e=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:"create-branch",path:g,branch:y.trim(),baseBranch:N})});if(e.ok)m(!1),p();else{let t=await e.json();b(t.error||"Unknown error")}}catch{b("Network error")}finally{M(!1)}}};return(0,t.jsx)(c.Dialog,{open:e,onOpenChange:m,children:(0,t.jsxs)(c.DialogContent,{className:"sm:max-w-sm",children:[(0,t.jsx)(c.DialogHeader,{children:(0,t.jsx)(c.DialogTitle,{children:v("git.createBranch")})}),(0,t.jsxs)("div",{className:"space-y-3 py-2",children:[(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:v("git.branchName")}),(0,t.jsx)(d.Input,{value:y,onChange:e=>j(e.target.value),placeholder:v("git.branchNamePlaceholder"),className:"mt-1.5 font-mono text-xs",onKeyDown:e=>"Enter"===e.key&&P()})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:v("git.baseBranch")}),(0,t.jsxs)("div",{className:"relative mt-1.5",children:[(0,t.jsxs)("button",{onClick:()=>E(!D),className:"flex w-full items-center justify-between rounded-lg border border-border bg-muted/50 px-3 py-2 text-left transition-colors hover:bg-accent",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2",children:[(0,t.jsx)(s.GitBranch,{className:"h-3 w-3 text-emerald-400"}),(0,t.jsx)("span",{className:"font-mono text-xs text-foreground",children:N})]}),(0,t.jsx)(a.ChevronDown,{className:`h-3 w-3 text-muted-foreground transition-transform ${D?"rotate-180":""}`})]}),D&&(0,t.jsxs)("div",{className:"absolute left-0 right-0 top-full z-20 mt-1 rounded-lg border border-border bg-popover shadow-xl",children:[(0,t.jsx)("div",{className:"border-b border-border p-1.5",children:(0,t.jsxs)("div",{className:"relative",children:[(0,t.jsx)(i.Search,{className:"absolute left-2 top-1/2 -translate-y-1/2 h-3 w-3 text-muted-foreground"}),(0,t.jsx)("input",{value:L,onChange:e=>R(e.target.value),placeholder:"Filter...",autoFocus:!0,className:"h-7 w-full rounded-md bg-muted/50 pl-7 pr-2 text-xs text-foreground placeholder-muted-foreground outline-none focus:ring-1 focus:ring-ring"})]})}),(0,t.jsx)("div",{className:"max-h-40 overflow-auto py-1",children:T.map(e=>(0,t.jsxs)("button",{onClick:()=>{w(e),E(!1)},className:`flex w-full items-center gap-2 px-3 py-1.5 text-left transition-colors ${e===N?"bg-emerald-500/10 text-emerald-400":"text-secondary-foreground hover:bg-accent"}`,children:[(0,t.jsx)(s.GitBranch,{className:"h-3 w-3 shrink-0"}),(0,t.jsx)("span",{className:"truncate font-mono text-xs",children:e}),e===N&&(0,t.jsx)(n.Check,{className:"h-3 w-3 ml-auto shrink-0"})]},e))})]})]})]}),(0,t.jsxs)("div",{children:[(0,t.jsx)("label",{className:"text-xs font-medium text-muted-foreground",children:v("git.branchDesc")}),(0,t.jsx)(u.Textarea,{value:k,onChange:e=>C(e.target.value),placeholder:v("git.branchDescPlaceholder"),rows:2,className:"mt-1.5 w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none transition-colors focus:border-ring focus:ring-1 focus:ring-ring resize-none"})]})]}),(0,t.jsxs)(c.DialogFooter,{children:[(0,t.jsx)(o.Button,{variant:"outline",onClick:()=>m(!1),children:v("common.cancel")}),(0,t.jsxs)(o.Button,{onClick:P,disabled:!y.trim()||S,className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[S?(0,t.jsx)(l.Loader2,{className:"h-3 w-3 animate-spin mr-1"}):null,v("common.create")]})]})]})})}])},121505,e=>{"use strict";let t=(0,e.i(258114).default)("arrow-up-from-line",[["path",{d:"m18 9-6-6-6 6",key:"kcunyi"}],["path",{d:"M12 3v14",key:"7cf3v8"}],["path",{d:"M5 21h14",key:"11awu3"}]]);e.s(["ArrowUpFromLine",0,t],121505)},426175,e=>{"use strict";async function t(e,r,s={}){let a=await fetch("/api/git",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({action:r,path:e,...s})});if(!a.ok)throw Error((await a.json()).error||`${r} failed`);return a.json()}e.s(["gitAction",0,t])},421051,e=>{"use strict";var t=e.i(860875);e.s(["AlertTriangle",()=>t.default])},928951,e=>{"use strict";let t=(0,e.i(258114).default)("git-compare",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M13 6h3a2 2 0 0 1 2 2v7",key:"1yeb86"}],["path",{d:"M11 18H8a2 2 0 0 1-2-2V9",key:"19pyzm"}]]);e.s(["GitCompare",0,t],928951)},246762,960732,e=>{"use strict";var t=e.i(430989),r=e.i(641338),s=e.i(597736),a=e.i(260949),i=e.i(421051),n=e.i(928951),l=e.i(258114);let c=(0,l.default)("git-commit-horizontal",[["circle",{cx:"12",cy:"12",r:"3",key:"1v7zrd"}],["line",{x1:"3",x2:"9",y1:"12",y2:"12",key:"1dyftd"}],["line",{x1:"15",x2:"21",y1:"12",y2:"12",key:"oup4p8"}]]);var o=e.i(744838),d=e.i(113205),u=e.i(174145),x=e.i(331548),m=e.i(779574),h=e.i(349369);e.s(["TaskDiffView",0,function({files:e,totalAdded:l,totalRemoved:f,hasConflicts:g,conflictFiles:p,onCommit:b,hasUncommitted:v}){let{t:y}=(0,h.useI18n)(),[j,N]=(0,r.useState)(new Set),[w,k]=(0,r.useState)(!1),[C,S]=(0,r.useState)(""),[M,L]=(0,r.useState)(!1);return(0,t.jsxs)("div",{className:"flex flex-col h-full",children:[(0,t.jsxs)("div",{className:"flex items-center justify-between border-b border-border px-4 py-3 flex-shrink-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-3 text-sm text-muted-foreground",children:[(0,t.jsxs)("span",{className:"font-medium text-foreground",children:[e.length," files changed"]}),(0,t.jsxs)("span",{className:"text-green-400 font-mono text-xs",children:["+",l]}),(0,t.jsxs)("span",{className:"text-red-400 font-mono text-xs",children:["-",f]})]}),(0,t.jsx)("div",{className:"flex items-center gap-2",children:v&&b&&(0,t.jsxs)(o.Button,{variant:"outline",onClick:()=>k(!0),className:"gap-2",children:[(0,t.jsx)(c,{className:"h-4 w-4"}),y("diff.commit")]})})]}),g&&(0,t.jsxs)("div",{className:"flex flex-col gap-2 border-b border-border bg-amber-500/5 px-4 py-3 flex-shrink-0",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-amber-400",children:[(0,t.jsx)(i.AlertTriangle,{className:"h-4 w-4 flex-shrink-0"}),(0,t.jsxs)("span",{className:"text-sm font-medium",children:["Merge blocked: ",p.length," conflicting file",1!==p.length?"s":""]})]}),(0,t.jsx)("ul",{className:"ml-6 space-y-1",children:p.map(e=>(0,t.jsx)("li",{className:"text-xs font-mono text-amber-300/80",children:e},e))})]}),(0,t.jsx)("div",{className:"flex-1 overflow-auto",children:0===e.length?(0,t.jsx)(d.EmptyState,{icon:n.GitCompare,title:y("diff.noChanges"),className:"h-full"}):(0,t.jsx)("div",{className:"divide-y divide-border",children:e.map(e=>{let r=j.has(e.filename);return(0,t.jsxs)("div",{children:[(0,t.jsxs)(o.Button,{variant:"ghost",type:"button",onClick:()=>{var t;return t=e.filename,void N(e=>{let r=new Set(e);return r.has(t)?r.delete(t):r.add(t),r})},className:"flex w-full items-center gap-2 px-4 py-2.5 text-left hover:bg-accent/50 transition-colors rounded-none h-auto",children:[r?(0,t.jsx)(a.ChevronDown,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}):(0,t.jsx)(s.ChevronRight,{className:"h-3.5 w-3.5 flex-shrink-0 text-muted-foreground"}),(0,t.jsx)("span",{className:"flex-1 truncate text-sm font-mono text-foreground",children:e.filename}),e.isBinary?(0,t.jsx)(u.Badge,{variant:"secondary",className:"text-[10px] bg-muted text-muted-foreground border border-border",children:"Binary"}):(0,t.jsxs)("div",{className:"flex items-center gap-1.5",children:[(0,t.jsxs)("span",{className:"text-xs font-mono text-green-400",children:["+",e.added]}),(0,t.jsxs)("span",{className:"text-xs font-mono text-red-400",children:["-",e.removed]})]})]}),r&&e.patch&&(0,t.jsx)("div",{className:"border-t border-border bg-background",children:(0,t.jsx)("pre",{className:"overflow-x-auto p-0 text-xs font-mono leading-5",children:e.patch.split("\n").map((e,r)=>{let s=e.startsWith("+")&&!e.startsWith("+++")?"px-4 block bg-green-500/10 text-green-400":e.startsWith("-")&&!e.startsWith("---")?"px-4 block bg-red-500/10 text-red-400":e.startsWith("@@")?"px-4 block bg-blue-500/10 text-blue-300":"px-4 block text-muted-foreground";return(0,t.jsx)("span",{className:s,children:e||" "},r)})})})]},e.filename)})})}),(0,t.jsx)(x.Dialog,{open:w,onOpenChange:k,children:(0,t.jsxs)(x.DialogContent,{className:"max-w-md",children:[(0,t.jsx)(x.DialogHeader,{children:(0,t.jsx)(x.DialogTitle,{children:y("diff.commitChanges")})}),(0,t.jsx)("div",{className:"flex flex-col gap-3",children:(0,t.jsx)(m.Textarea,{value:C,onChange:e=>S(e.target.value),placeholder:y("diff.commitMessagePlaceholder"),rows:5,className:"w-full rounded-md border border-border bg-background px-3 py-2 text-sm text-foreground placeholder-muted-foreground outline-none resize-y min-h-[80px]"})}),(0,t.jsxs)(x.DialogFooter,{children:[(0,t.jsx)(o.Button,{variant:"ghost",onClick:()=>k(!1),children:y("common.cancel")}),(0,t.jsx)(o.Button,{onClick:async()=>{if(C.trim()&&b){L(!0);try{await b(C.trim()),S(""),k(!1)}finally{L(!1)}}},disabled:!C.trim()||M,children:M?"...":y("diff.commit")})]})]})})]})}],246762);var f=e.i(347880);let g=(0,l.default)("git-merge",[["circle",{cx:"18",cy:"18",r:"3",key:"1xkwt0"}],["circle",{cx:"6",cy:"6",r:"3",key:"1lh9wr"}],["path",{d:"M6 21V9a9 9 0 0 0 9 9",key:"7kw0sc"}]]);var p=e.i(924609);e.s(["TaskMergeConfirmDialog",0,function({open:e,onOpenChange:s,taskId:a,taskTitle:i,baseBranch:n,fileCount:l,commitCount:c,commitLog:d=[],onMergeComplete:u}){let m=(0,f.useRouter)(),[h,b]=(0,r.useState)(!1),[v,y]=(0,r.useState)(null),j=async()=>{b(!0),y(null);try{let e=await fetch(`/api/tasks/${a}/merge`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({})});if(e.ok){s(!1),u(),m.refresh();return}let t=await e.json().catch(()=>({error:"Merge failed"}));409===e.status?y(`Merge conflicts detected: ${Array.isArray(t.conflictFiles)?t.conflictFiles.join(", "):"unknown files"}`):y(t.error??"Merge failed")}catch{y("Network error — merge failed")}finally{b(!1)}};return(0,t.jsx)(x.Dialog,{open:e,onOpenChange:s,children:(0,t.jsxs)(x.DialogContent,{showCloseButton:!0,className:"sm:max-w-md",children:[(0,t.jsx)(x.DialogHeader,{children:(0,t.jsxs)(x.DialogTitle,{className:"flex items-center gap-2",children:[(0,t.jsx)(g,{className:"h-4 w-4 text-emerald-400"}),"Confirm Merge"]})}),(0,t.jsxs)("div",{className:"space-y-3 py-2",children:[(0,t.jsxs)("div",{className:"rounded-lg border border-border bg-muted/30 p-3 space-y-2.5",children:[(0,t.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Target branch"}),(0,t.jsx)("code",{className:"text-xs font-mono bg-muted px-2 py-0.5 rounded text-foreground",children:n})]}),(0,t.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Changed files"}),(0,t.jsx)("span",{className:"text-xs font-medium text-foreground",children:l})]}),(0,t.jsxs)("div",{className:"flex items-start justify-between gap-4",children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground whitespace-nowrap",children:"Commits"}),(0,t.jsx)("span",{className:"text-xs font-medium text-foreground",children:c})]})]}),d.length>0&&(0,t.jsxs)("div",{children:[(0,t.jsx)("span",{className:"text-xs text-muted-foreground mb-1 block",children:"Commits"}),(0,t.jsx)("div",{className:"rounded-md border border-border bg-muted/30 p-2 space-y-1 max-h-32 overflow-y-auto",children:d.map((e,r)=>(0,t.jsx)("div",{className:"text-xs font-mono text-foreground/80",children:e},r))})]}),v&&(0,t.jsx)("div",{className:"rounded-lg border border-red-500/20 bg-red-500/10 px-3 py-2",children:(0,t.jsx)("p",{className:"text-xs text-red-400",children:v})})]}),(0,t.jsxs)(x.DialogFooter,{children:[(0,t.jsx)(o.Button,{variant:"outline",onClick:()=>s(!1),disabled:h,children:"Cancel"}),(0,t.jsx)(o.Button,{onClick:j,disabled:h,className:"gap-2",children:h?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(p.Loader2,{className:"h-4 w-4 animate-spin"}),"Merging..."]}):(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)(g,{className:"h-4 w-4"}),"Confirm Merge"]})})]})]})})}],960732)},848487,e=>{"use strict";var t=e.i(755683);let r=(0,t.createServerReference)("40ed6873e031184384c0ecf15f815a13de5820bfa1",t.callServer,void 0,t.findSourceMapURL,"getTaskExecutions");e.s(["getTaskExecutions",0,r])},520309,e=>{"use strict";var t=e.i(755683);let r=(0,t.createServerReference)("409dfba5eaab2515ac1954906b83d50b3c628f1d1b",t.callServer,void 0,t.findSourceMapURL,"continueLatestPtyExecution");e.s(["continueLatestPtyExecution",0,r])},364617,994316,858981,43108,e=>{"use strict";var t=e.i(755683);let r=(0,t.createServerReference)("6012ff7cefee13232d9d622da5dc83381e0d715935",t.callServer,void 0,t.findSourceMapURL,"updateTaskStatus");e.s(["updateTaskStatus",0,r],364617);let s=(0,t.createServerReference)("40b2455cb970ebc4515f5b889c41bc7ce2ac6fc880",t.callServer,void 0,t.findSourceMapURL,"checkWorktreeClean");e.s(["checkWorktreeClean",0,s],994316);let a=(0,t.createServerReference)("60cf9fe71b8c158269b3ac0046840a51cc51e8b2e8",t.callServer,void 0,t.findSourceMapURL,"commitWorktreeChanges");e.s(["commitWorktreeChanges",0,a],858981);let i=(0,e.i(258114).default)("clock",[["circle",{cx:"12",cy:"12",r:"10",key:"1mglay"}],["path",{d:"M12 6v6l4 2",key:"mmk7yg"}]]);e.s(["Clock",0,i],43108)},711958,e=>{"use strict";var t=e.i(430989),r=e.i(641338),s=e.i(260949),a=e.i(569021),i=e.i(170528),n=e.i(581511),l=e.i(924609),c=e.i(43108),o=e.i(2139),d=e.i(545315),u=e.i(586211);let x=(0,e.i(258114).default)("history",[["path",{d:"M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8",key:"1357e3"}],["path",{d:"M3 3v5h5",key:"1xhq8a"}],["path",{d:"M12 7v5l4 2",key:"1fdv2h"}]]);var m=e.i(744838),h=e.i(113205),f=e.i(349369);function g({status:e}){switch(e){case"COMPLETED":return(0,t.jsx)(i.CheckCircle2,{className:"h-4 w-4 text-emerald-400"});case"FAILED":return(0,t.jsx)(n.XCircle,{className:"h-4 w-4 text-red-400"});case"RUNNING":return(0,t.jsx)(l.Loader2,{className:"h-4 w-4 text-blue-400 animate-spin"});default:return(0,t.jsx)(c.Clock,{className:"h-4 w-4 text-neutral-500"})}}e.s(["ExecutionTimeline",0,function({executions:e,onResume:i,onContinueLatest:n}){let{t:l,locale:c}=(0,f.useI18n)(),[p,b]=(0,r.useState)(null),[v,y]=(0,r.useState)(null);return 0===e.length?(0,t.jsx)(h.EmptyState,{icon:x,title:l("execution.noHistory")}):(0,t.jsxs)("div",{className:"space-y-2 p-3",children:[(0,t.jsx)("p",{className:"px-1 text-[11px] font-semibold uppercase tracking-wider text-muted-foreground",children:l("execution.history")}),e.map(r=>{let x=function(e){if(!e)return null;try{return JSON.parse(e)}catch{return null}}(r.gitStats??null),h=function(e,t){if(!e||!t)return"";let r=new Date(t).getTime()-new Date(e).getTime();if(r<0)return"";let s=Math.floor(r/1e3);if(s<60)return`${s}s`;let a=Math.floor(s/60);if(a<60)return`${a}m ${s%60}s`;let i=Math.floor(a/60);return`${i}h ${a%60}m`}(r.startedAt??null,r.endedAt??null),f=p===r.id;return(0,t.jsxs)("div",{className:"rounded-lg border border-border bg-background/50 overflow-hidden",children:[(0,t.jsxs)("div",{className:"p-3",children:[(0,t.jsxs)("div",{className:"flex items-center gap-2 text-xs",children:[(0,t.jsx)(g,{status:r.status}),(0,t.jsx)("span",{className:`font-medium ${function(e){switch(e){case"COMPLETED":return"text-emerald-400";case"FAILED":return"text-red-400";case"RUNNING":return"text-blue-400";default:return"text-neutral-400"}}(r.status)}`,children:function(e,t){switch(e){case"COMPLETED":return t("execution.success");case"FAILED":return t("execution.failed");case"RUNNING":return t("execution.running");default:return e}}(r.status,l)}),(0,t.jsx)("span",{className:"text-muted-foreground",children:function(e,t="zh"){if(!e)return"";let r=new Date(e),s=Math.floor((new Date().getTime()-r.getTime())/864e5),a="zh"===t?"zh-CN":"en-US",i=r.toLocaleTimeString(a,{hour:"2-digit",minute:"2-digit"});return 0===s?i:1===s?"zh"===t?`昨天 ${i}`:`Yesterday ${i}`:s<7?"zh"===t?`${s}天前 ${i}`:`${s}d ago ${i}`:r.toLocaleDateString(a,{month:"2-digit",day:"2-digit"})+" "+i}(r.startedAt??null,c)}),h&&(0,t.jsxs)("span",{className:"text-muted-foreground/60",children:["(",h,")"]})]}),(0,t.jsx)("p",{className:"mt-1.5 text-sm text-foreground/80 line-clamp-2",children:r.summary||l("execution.noSummary")}),x&&(x.commits||x.filesChanged)&&(0,t.jsxs)("div",{className:"mt-1.5 flex items-center gap-2 text-[11px] text-muted-foreground font-mono",children:[x.commits?(0,t.jsxs)("span",{children:[x.commits," ",l("execution.commits")]}):null,x.filesChanged?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{children:"·"}),(0,t.jsxs)("span",{children:[x.filesChanged," ",l("execution.files")]})]}):null,x.insertions||x.deletions?(0,t.jsxs)(t.Fragment,{children:[(0,t.jsx)("span",{children:"·"}),x.insertions?(0,t.jsxs)("span",{className:"text-emerald-500",children:["+",x.insertions]}):null,x.deletions?(0,t.jsxs)("span",{className:"text-red-400",children:["-",x.deletions]}):null]}):null]}),r.insightNote&&(0,t.jsxs)("div",{className:"mt-2",children:[(0,t.jsxs)("button",{onClick:()=>y(v===r.id?null:r.id),className:"flex items-center gap-1.5 text-xs text-primary/90 hover:text-primary transition-colors",children:[(0,t.jsx)(u.Lightbulb,{className:"h-3.5 w-3.5"}),(0,t.jsxs)("span",{className:"font-medium",children:[l("execution.insight"),":"]}),(0,t.jsx)("span",{className:"text-foreground/70 truncate max-w-[200px]",children:r.insightNote.title}),v===r.id?(0,t.jsx)(a.ChevronUp,{className:"h-3 w-3"}):(0,t.jsx)(s.ChevronDown,{className:"h-3 w-3"})]}),v===r.id&&(0,t.jsx)("div",{className:"mt-2 rounded-md bg-primary/[0.06] border border-primary/10 p-3 text-xs text-foreground/80 whitespace-pre-wrap",children:r.insightNote.content})]}),(0,t.jsxs)("div",{className:"mt-2.5 flex items-center gap-2",children:[r.sessionId&&i?(0,t.jsxs)(m.Button,{size:"sm",onClick:()=>i(r.sessionId),className:"bg-primary/10 text-primary ring-1 ring-primary/20 hover:bg-primary/15",children:[(0,t.jsx)(o.PlayCircle,{className:"h-3.5 w-3.5"}),l("execution.resume")]}):!r.sessionId&&"FAILED"===r.status&&r.id===e[0]?.id&&n?(0,t.jsxs)(m.Button,{size:"sm",onClick:n,className:"bg-blue-500/15 text-blue-300 ring-1 ring-blue-500/20 hover:bg-blue-500/25",children:[(0,t.jsx)(d.RotateCcw,{className:"h-3.5 w-3.5"}),l("execution.tryRecover")]}):null,(0,t.jsxs)(m.Button,{variant:"ghost",size:"sm",onClick:()=>b(f?null:r.id),className:"bg-muted text-muted-foreground",children:[f?(0,t.jsx)(a.ChevronUp,{className:"h-3.5 w-3.5"}):(0,t.jsx)(s.ChevronDown,{className:"h-3.5 w-3.5"}),f?l("execution.collapse"):l("execution.details")]})]})]}),f&&(0,t.jsxs)("div",{className:"border-t border-border px-3 pb-3 space-y-3",children:[r.gitLog&&(0,t.jsxs)("div",{className:"mt-3",children:[(0,t.jsx)("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5",children:l("execution.gitLog")}),(0,t.jsx)("pre",{className:"rounded-md bg-muted/50 p-2.5 text-xs font-mono text-foreground/70 overflow-x-auto whitespace-pre-wrap",children:r.gitLog.split("\n").slice(0,3).join("\n")})]}),r.terminalLog&&(0,t.jsxs)("div",{children:[(0,t.jsx)("p",{className:"text-[11px] font-semibold uppercase tracking-wider text-muted-foreground mb-1.5",children:l("execution.terminalOutput")}),(0,t.jsx)("pre",{className:"rounded-md bg-[#0f1419] p-2.5 text-xs font-mono text-neutral-300 overflow-x-auto max-h-48 overflow-y-auto whitespace-pre-wrap",children:r.terminalLog})]}),"FAILED"===r.status&&null!=r.exitCode&&(0,t.jsxs)("p",{className:"text-xs text-red-400/70",children:["Exit code: ",r.exitCode]})]})]},r.id)})]})}],711958)}]);