test-lah 1.0.8 → 1.0.9

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 (140) hide show
  1. package/.next/standalone/.next/BUILD_ID +1 -1
  2. package/.next/standalone/.next/app-build-manifest.json +46 -36
  3. package/.next/standalone/.next/app-path-routes-manifest.json +6 -5
  4. package/.next/standalone/.next/build-manifest.json +2 -2
  5. package/.next/standalone/.next/prerender-manifest.json +24 -24
  6. package/.next/standalone/.next/server/app/(dashboard)/integrations/page_client-reference-manifest.js +1 -1
  7. package/.next/standalone/.next/server/app/(dashboard)/projects/[projectId]/page.js +17 -70
  8. package/.next/standalone/.next/server/app/(dashboard)/projects/[projectId]/page.js.nft.json +1 -1
  9. package/.next/standalone/.next/server/app/(dashboard)/projects/[projectId]/page_client-reference-manifest.js +1 -1
  10. package/.next/standalone/.next/server/app/(dashboard)/projects/[projectId]/summary/page.js +2 -22
  11. package/.next/standalone/.next/server/app/(dashboard)/projects/[projectId]/summary/page.js.nft.json +1 -1
  12. package/.next/standalone/.next/server/app/(dashboard)/projects/[projectId]/summary/page_client-reference-manifest.js +1 -1
  13. package/.next/standalone/.next/server/app/(dashboard)/projects/page.js +34 -2
  14. package/.next/standalone/.next/server/app/(dashboard)/projects/page.js.nft.json +1 -1
  15. package/.next/standalone/.next/server/app/(dashboard)/projects/page_client-reference-manifest.js +1 -1
  16. package/.next/standalone/.next/server/app/_not-found/page.js +1 -1
  17. package/.next/standalone/.next/server/app/_not-found/page_client-reference-manifest.js +1 -1
  18. package/.next/standalone/.next/server/app/_not-found.html +1 -1
  19. package/.next/standalone/.next/server/app/_not-found.rsc +2 -2
  20. package/.next/standalone/.next/server/app/api/e2e/route.js +13 -2
  21. package/.next/standalone/.next/server/app/api/e2e/route_client-reference-manifest.js +1 -1
  22. package/.next/standalone/.next/server/app/api/generate/route.js +13 -2
  23. package/.next/standalone/.next/server/app/api/generate/route_client-reference-manifest.js +1 -1
  24. package/.next/standalone/.next/server/app/api/llm/encrypt/route_client-reference-manifest.js +1 -1
  25. package/.next/standalone/.next/server/app/api/llm/test/route.js +13 -2
  26. package/.next/standalone/.next/server/app/api/llm/test/route_client-reference-manifest.js +1 -1
  27. package/.next/standalone/.next/server/app/api/refine-notes/route.js +29 -0
  28. package/.next/standalone/.next/server/app/api/refine-notes/route.js.nft.json +1 -0
  29. package/.next/standalone/.next/server/app/api/refine-notes/route_client-reference-manifest.js +1 -0
  30. package/.next/standalone/.next/server/app/api/weather/route_client-reference-manifest.js +1 -1
  31. package/.next/standalone/.next/server/app/index.html +1 -1
  32. package/.next/standalone/.next/server/app/index.rsc +3 -3
  33. package/.next/standalone/.next/server/app/integrations.html +1 -1
  34. package/.next/standalone/.next/server/app/integrations.rsc +4 -4
  35. package/.next/standalone/.next/server/app/login/page.js +2 -2
  36. package/.next/standalone/.next/server/app/login/page.js.nft.json +1 -1
  37. package/.next/standalone/.next/server/app/login/page_client-reference-manifest.js +1 -1
  38. package/.next/standalone/.next/server/app/login.html +1 -1
  39. package/.next/standalone/.next/server/app/login.rsc +3 -3
  40. package/.next/standalone/.next/server/app/page.js +1 -1
  41. package/.next/standalone/.next/server/app/page_client-reference-manifest.js +1 -1
  42. package/.next/standalone/.next/server/app/projects.html +1 -1
  43. package/.next/standalone/.next/server/app/projects.rsc +4 -4
  44. package/.next/standalone/.next/server/app-paths-manifest.json +6 -5
  45. package/.next/standalone/.next/server/chunks/423.js +62 -0
  46. package/.next/standalone/.next/server/chunks/615.js +2 -2
  47. package/.next/standalone/.next/server/chunks/736.js +2 -2
  48. package/.next/standalone/.next/server/chunks/779.js +1 -0
  49. package/.next/standalone/.next/server/chunks/845.js +5 -5
  50. package/.next/standalone/.next/server/chunks/898.js +21 -0
  51. package/.next/standalone/.next/server/pages/404.html +1 -1
  52. package/.next/standalone/.next/server/pages/500.html +1 -1
  53. package/.next/standalone/.next/static/chunks/172-84d6b7afea495880.js +1 -0
  54. package/.next/standalone/.next/static/chunks/246-28370f424ce95be6.js +1 -0
  55. package/.next/standalone/.next/static/chunks/253-d1beae5e3cf2d88e.js +1 -0
  56. package/.next/standalone/.next/static/chunks/642-d84ad067810dd35b.js +1 -0
  57. package/.next/standalone/.next/static/chunks/661-a763fedcbf90af81.js +1 -0
  58. package/.next/standalone/.next/static/chunks/793-7306e111aea85b00.js +1 -0
  59. package/.next/standalone/.next/static/chunks/968-a7dcf12036013254.js +62 -0
  60. package/.next/standalone/.next/static/chunks/app/(dashboard)/integrations/page-d62f7774ba0ed3ab.js +1 -0
  61. package/.next/standalone/.next/static/chunks/app/(dashboard)/layout-e4ed5abcbb7c8802.js +1 -0
  62. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[projectId]/page-0d320c1bd8d89d9c.js +1 -0
  63. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[projectId]/summary/page-1b2e89d37c95e30f.js +1 -0
  64. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/page-5f4191feafff095a.js +1 -0
  65. package/.next/standalone/.next/static/chunks/app/api/e2e/route-234cc6154c5cd194.js +1 -0
  66. package/.next/standalone/.next/static/chunks/app/api/generate/route-234cc6154c5cd194.js +1 -0
  67. package/.next/standalone/.next/static/chunks/app/api/llm/encrypt/route-234cc6154c5cd194.js +1 -0
  68. package/.next/standalone/.next/static/chunks/app/api/llm/test/route-234cc6154c5cd194.js +1 -0
  69. package/.next/standalone/.next/static/chunks/app/api/refine-notes/route-234cc6154c5cd194.js +1 -0
  70. package/.next/standalone/.next/static/chunks/app/api/weather/route-234cc6154c5cd194.js +1 -0
  71. package/.next/{static/chunks/app/login/page-a655de2a3e8514f8.js → standalone/.next/static/chunks/app/login/page-35c717d39c71dcbf.js} +1 -1
  72. package/.next/standalone/.next/static/chunks/app/page-dd12a450edb4a44d.js +1 -0
  73. package/.next/standalone/.next/static/css/d31bdcc43c2da03c.css +3 -0
  74. package/.next/standalone/.next/static/pu5ThH8RrsP9e4dTXjYwA/_buildManifest.js +1 -0
  75. package/.next/standalone/package.json +1 -1
  76. package/.next/static/chunks/172-84d6b7afea495880.js +1 -0
  77. package/.next/static/chunks/246-28370f424ce95be6.js +1 -0
  78. package/.next/static/chunks/253-d1beae5e3cf2d88e.js +1 -0
  79. package/.next/static/chunks/642-d84ad067810dd35b.js +1 -0
  80. package/.next/static/chunks/661-a763fedcbf90af81.js +1 -0
  81. package/.next/static/chunks/793-7306e111aea85b00.js +1 -0
  82. package/.next/static/chunks/968-a7dcf12036013254.js +62 -0
  83. package/.next/static/chunks/app/(dashboard)/integrations/page-d62f7774ba0ed3ab.js +1 -0
  84. package/.next/static/chunks/app/(dashboard)/layout-e4ed5abcbb7c8802.js +1 -0
  85. package/.next/static/chunks/app/(dashboard)/projects/[projectId]/page-0d320c1bd8d89d9c.js +1 -0
  86. package/.next/static/chunks/app/(dashboard)/projects/[projectId]/summary/page-1b2e89d37c95e30f.js +1 -0
  87. package/.next/static/chunks/app/(dashboard)/projects/page-5f4191feafff095a.js +1 -0
  88. package/.next/static/chunks/app/api/e2e/route-234cc6154c5cd194.js +1 -0
  89. package/.next/static/chunks/app/api/generate/route-234cc6154c5cd194.js +1 -0
  90. package/.next/static/chunks/app/api/llm/encrypt/route-234cc6154c5cd194.js +1 -0
  91. package/.next/static/chunks/app/api/llm/test/route-234cc6154c5cd194.js +1 -0
  92. package/.next/static/chunks/app/api/refine-notes/route-234cc6154c5cd194.js +1 -0
  93. package/.next/static/chunks/app/api/weather/route-234cc6154c5cd194.js +1 -0
  94. package/.next/{standalone/.next/static/chunks/app/login/page-a655de2a3e8514f8.js → static/chunks/app/login/page-35c717d39c71dcbf.js} +1 -1
  95. package/.next/static/chunks/app/page-dd12a450edb4a44d.js +1 -0
  96. package/.next/static/css/d31bdcc43c2da03c.css +3 -0
  97. package/.next/static/pu5ThH8RrsP9e4dTXjYwA/_buildManifest.js +1 -0
  98. package/README.md +27 -4
  99. package/package.json +1 -1
  100. package/.next/standalone/.next/server/chunks/350.js +0 -21
  101. package/.next/standalone/.next/server/chunks/403.js +0 -1
  102. package/.next/standalone/.next/server/chunks/583.js +0 -1
  103. package/.next/standalone/.next/static/5bU_Xo0_CNnVnb2HQeysr/_buildManifest.js +0 -1
  104. package/.next/standalone/.next/static/chunks/246-1673b37cc8edb269.js +0 -1
  105. package/.next/standalone/.next/static/chunks/485-23e4a6e33ee79f14.js +0 -1
  106. package/.next/standalone/.next/static/chunks/532-95cb537bb36c2e68.js +0 -62
  107. package/.next/standalone/.next/static/chunks/637-dcbc811f7143935f.js +0 -1
  108. package/.next/standalone/.next/static/chunks/708-1fc7a6d1d5b4aee7.js +0 -1
  109. package/.next/standalone/.next/static/chunks/app/(dashboard)/integrations/page-f5e71fcfbeffdfb1.js +0 -1
  110. package/.next/standalone/.next/static/chunks/app/(dashboard)/layout-a5bf2535f1470c77.js +0 -1
  111. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[projectId]/page-7205f74080ad5010.js +0 -1
  112. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/[projectId]/summary/page-b69fc155f1796e19.js +0 -1
  113. package/.next/standalone/.next/static/chunks/app/(dashboard)/projects/page-11a49918142004f5.js +0 -1
  114. package/.next/standalone/.next/static/chunks/app/api/e2e/route-ccff81cd0a5704f2.js +0 -1
  115. package/.next/standalone/.next/static/chunks/app/api/generate/route-ccff81cd0a5704f2.js +0 -1
  116. package/.next/standalone/.next/static/chunks/app/api/llm/encrypt/route-ccff81cd0a5704f2.js +0 -1
  117. package/.next/standalone/.next/static/chunks/app/api/llm/test/route-ccff81cd0a5704f2.js +0 -1
  118. package/.next/standalone/.next/static/chunks/app/api/weather/route-ccff81cd0a5704f2.js +0 -1
  119. package/.next/standalone/.next/static/chunks/app/page-a90eeaea3538ebf2.js +0 -1
  120. package/.next/standalone/.next/static/css/f78c165472d53f48.css +0 -3
  121. package/.next/static/5bU_Xo0_CNnVnb2HQeysr/_buildManifest.js +0 -1
  122. package/.next/static/chunks/246-1673b37cc8edb269.js +0 -1
  123. package/.next/static/chunks/485-23e4a6e33ee79f14.js +0 -1
  124. package/.next/static/chunks/532-95cb537bb36c2e68.js +0 -62
  125. package/.next/static/chunks/637-dcbc811f7143935f.js +0 -1
  126. package/.next/static/chunks/708-1fc7a6d1d5b4aee7.js +0 -1
  127. package/.next/static/chunks/app/(dashboard)/integrations/page-f5e71fcfbeffdfb1.js +0 -1
  128. package/.next/static/chunks/app/(dashboard)/layout-a5bf2535f1470c77.js +0 -1
  129. package/.next/static/chunks/app/(dashboard)/projects/[projectId]/page-7205f74080ad5010.js +0 -1
  130. package/.next/static/chunks/app/(dashboard)/projects/[projectId]/summary/page-b69fc155f1796e19.js +0 -1
  131. package/.next/static/chunks/app/(dashboard)/projects/page-11a49918142004f5.js +0 -1
  132. package/.next/static/chunks/app/api/e2e/route-ccff81cd0a5704f2.js +0 -1
  133. package/.next/static/chunks/app/api/generate/route-ccff81cd0a5704f2.js +0 -1
  134. package/.next/static/chunks/app/api/llm/encrypt/route-ccff81cd0a5704f2.js +0 -1
  135. package/.next/static/chunks/app/api/llm/test/route-ccff81cd0a5704f2.js +0 -1
  136. package/.next/static/chunks/app/api/weather/route-ccff81cd0a5704f2.js +0 -1
  137. package/.next/static/chunks/app/page-a90eeaea3538ebf2.js +0 -1
  138. package/.next/static/css/f78c165472d53f48.css +0 -3
  139. /package/.next/standalone/.next/static/{5bU_Xo0_CNnVnb2HQeysr → pu5ThH8RrsP9e4dTXjYwA}/_ssgManifest.js +0 -0
  140. /package/.next/static/{5bU_Xo0_CNnVnb2HQeysr → pu5ThH8RrsP9e4dTXjYwA}/_ssgManifest.js +0 -0
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[305],{63:(e,t,r)=>{"use strict";var a=r(7260);r.o(a,"useParams")&&r.d(t,{useParams:function(){return a.useParams}}),r.o(a,"usePathname")&&r.d(t,{usePathname:function(){return a.usePathname}}),r.o(a,"useRouter")&&r.d(t,{useRouter:function(){return a.useRouter}})},265:(e,t,r)=>{"use strict";r.d(t,{Vx:()=>n,p1:()=>o});var a=r(5155),s=r(2115);let l=(0,s.createContext)(null);function o(){let e=(0,s.useContext)(l);if(!e)throw Error("useProgress must be used within ProgressProvider");return e}function n(e){let{children:t}=e,[r,o]=(0,s.useState)(0),[n,i]=(0,s.useState)(""),[c,d]=(0,s.useState)(!1),u=(0,s.useRef)(null),x=(0,s.useRef)(null),h=(0,s.useCallback)(()=>{u.current&&(clearInterval(u.current),u.current=null),x.current&&(clearTimeout(x.current),x.current=null)},[]),p=(0,s.useCallback)(()=>{d(!1),o(0),i("")},[]),m=(0,s.useCallback)(e=>{h(),o(0),i(e||""),d(!0),u.current=setInterval(()=>{o(e=>e>=90?(u.current&&clearInterval(u.current),u.current=null,90):e+15*Math.random())},300),x.current=setTimeout(()=>{p()},8e3)},[h,p]),v=(0,s.useCallback)((e,t)=>{o(Math.min(95,e)),t&&i(t)},[]),g=(0,s.useCallback)(e=>{h(),o(100),e&&i(e),setTimeout(()=>{p()},500)},[h,p]),b=(0,s.useCallback)(()=>{h(),p()},[h,p]);return(0,s.useEffect)(()=>()=>h(),[h]),(0,a.jsxs)(l.Provider,{value:{startProgress:m,updateProgress:v,completeProgress:g,cancelProgress:b,isProgressing:c},children:[t,(0,a.jsxs)("div",{className:"fixed bottom-0 left-0 right-0 z-[600] transition-all duration-300 ease-out",style:{opacity:+!!c,transform:c?"translateY(0)":"translateY(100%)",pointerEvents:c?"auto":"none"},children:[(0,a.jsx)("div",{className:"h-1 w-full",style:{backgroundColor:"var(--bg-secondary)"},children:(0,a.jsx)("div",{className:"h-full transition-all duration-200 ease-out",style:{width:"".concat(r,"%"),backgroundColor:r>=100?"var(--status-pass-text)":"var(--accent)",boxShadow:r>=100?"0 0 10px var(--status-pass-text)":"none"}})}),n&&(0,a.jsxs)("div",{className:"flex items-center justify-center py-2 px-4 text-xs font-medium cursor-pointer",onClick:b,style:{backgroundColor:"var(--bg-card)",color:r>=100?"var(--status-pass-text)":"var(--text-secondary)",borderTop:"1px solid var(--border)"},children:[r>=100&&(0,a.jsx)("svg",{className:"mr-2",width:"12",height:"12",viewBox:"0 0 12 12",fill:"none",children:(0,a.jsx)("path",{d:"M2 6l3 3 5-5",stroke:"var(--status-pass-text)",strokeWidth:"1.5",strokeLinecap:"round",strokeLinejoin:"round"})}),n]})]})]})}},854:(e,t,r)=>{"use strict";r.d(t,{A:()=>o});var a=r(2115);let s="qa-auth";function l(e){try{sessionStorage.setItem(s,JSON.stringify(e))}catch(e){}}function o(){let[e,t]=(0,a.useState)({name:"",isLoggedIn:!1}),[r,o]=(0,a.useState)(!1);(0,a.useEffect)(()=>{t(function(){try{let e=sessionStorage.getItem(s);if(!e)return{name:"",isLoggedIn:!1};return JSON.parse(e)}catch(e){return{name:"",isLoggedIn:!1}}}()),o(!0)},[]);let n=(0,a.useCallback)(e=>{let r={name:e,isLoggedIn:!0};l(r),t(r)},[]),i=(0,a.useCallback)(()=>{let e={name:"",isLoggedIn:!1};l(e),t(e)},[]);return{...e,loaded:r,login:n,logout:i}}},8609:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>M});var a=r(5155),s=r(2115),l=r(63),o=r(7246),n=r(2619),i=r.n(n),c=r(854),d=r(8566);let u=["https://cdn.jsdelivr.net/gh/alohe/avatars/png/upstream_11.png","https://cdn.jsdelivr.net/gh/alohe/avatars/png/upstream_12.png","https://cdn.jsdelivr.net/gh/alohe/avatars/png/upstream_13.png","https://cdn.jsdelivr.net/gh/alohe/avatars/png/upstream_14.png","https://cdn.jsdelivr.net/gh/alohe/avatars/png/upstream_15.png","https://cdn.jsdelivr.net/gh/alohe/avatars/png/upstream_16.png","https://cdn.jsdelivr.net/gh/alohe/avatars/png/upstream_17.png","https://cdn.jsdelivr.net/gh/alohe/avatars/png/upstream_18.png","https://cdn.jsdelivr.net/gh/alohe/avatars/png/upstream_19.png","https://cdn.jsdelivr.net/gh/alohe/avatars/png/upstream_20.png","https://cdn.jsdelivr.net/gh/alohe/avatars/png/upstream_21.png","https://cdn.jsdelivr.net/gh/alohe/avatars/png/upstream_22.png"],x=["https://i.pinimg.com/736x/ed/74/06/ed74063ade6d66fce2ca19acbe74babc.jpg","https://i.pinimg.com/736x/8c/6d/56/8c6d563311f0917d45d1f2ce5d7c1a2d.jpg","https://i.pinimg.com/736x/86/b8/be/86b8bea1c772cf5c540e6f01e6acce59.jpg","https://i.pinimg.com/736x/78/d4/b1/78d4b1787a4fd23c2a8d21e4fbbc016f.jpg","https://i.pinimg.com/1200x/87/de/e6/87dee6d33b04f1df28bc85702ee12d4b.jpg","https://i.pinimg.com/1200x/3b/e3/95/3be395c4a94705f95e0603afb04f9d56.jpg","https://media.licdn.com/dms/image/v2/D5603AQHBu4wrzFWoTw/profile-displayphoto-crop_800_800/B56Zq.Sy6LKsAI-/0/1764129191465?e=1782345600&v=beta&t=79y6xLivwcpvwy53sy1TuVopK4FMp6O8uAu7QxlIxDo"],h=["QA Engineer","QA Lead","Developer","Designer","Manager"];function p(e,t){let r=parseInt(e.replace("#",""),16),a=Math.min(255,(r>>16)+Math.round((255-(r>>16))*t)),s=Math.min(255,(r>>8&255)+Math.round((255-(r>>8&255))*t)),l=Math.min(255,(255&r)+Math.round((255-(255&r))*t));return"#".concat((a<<16|s<<8|l).toString(16).padStart(6,"0"))}function m(e){let{profile:t,initials:r,onSetName:l,onSetBannerColor:o,onSetAvatarUrl:n,onSetRole:i}=e,[c,m]=(0,s.useState)(!1),[v,g]=(0,s.useState)(!1),[b,f]=(0,s.useState)(!1),[j,y]=(0,s.useState)(t.name),[k,w]=(0,s.useState)(t.role||""),C=(0,s.useRef)(null),N=(0,s.useRef)(null),S=(0,s.useRef)(null);(0,s.useEffect)(()=>{let e=e=>{C.current&&!C.current.contains(e.target)&&m(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[]),(0,s.useEffect)(()=>{v&&N.current&&N.current.focus()},[v]),(0,s.useEffect)(()=>{b&&S.current&&S.current.focus()},[b]);let M=()=>{l(j.trim()),g(!1)},L=()=>{i(k.trim()),f(!1)},E=!!t.avatarUrl;return(0,a.jsxs)("div",{className:"relative",ref:C,children:[(0,a.jsx)("button",{onClick:()=>m(!c),className:"w-9 h-9 rounded-full flex items-center justify-center text-xs font-medium overflow-hidden border-2 transition-all hover:scale-105",style:{borderColor:c?"var(--accent)":"transparent",boxShadow:c?"0 0 0 2px var(--accent), 0 2px 8px rgba(0,0,0,0.1)":"0 1px 3px rgba(0,0,0,0.08)"},children:E?(0,a.jsx)("img",{src:t.avatarUrl,alt:"Avatar",className:"w-full h-full object-cover"}):(0,a.jsx)("span",{className:"w-full h-full flex items-center justify-center",style:{backgroundColor:t.bannerColor,color:"#fff"},children:r})}),c&&(0,a.jsxs)("div",{className:"absolute right-0 top-full mt-2 w-80 border z-50 overflow-hidden",style:{backgroundColor:"var(--bg-card)",borderColor:"var(--border)",borderRadius:"var(--radius-lg)",boxShadow:"var(--shadow-xl)",animation:"fadeIn 150ms ease-out"},children:[(0,a.jsxs)("div",{className:"relative px-5 pt-5 pb-4",style:{background:"linear-gradient(135deg, ".concat(t.bannerColor," 0%, ").concat(p(t.bannerColor,.4)," 50%, ").concat(t.bannerColor," 100%)")},children:[(0,a.jsx)("div",{className:"absolute inset-0 opacity-10",style:{backgroundImage:"radial-gradient(circle at 20% 50%, white 1px, transparent 1px), radial-gradient(circle at 80% 20%, white 1px, transparent 1px)",backgroundSize:"30px 30px"}}),(0,a.jsxs)("div",{className:"relative flex items-end gap-4",children:[(0,a.jsxs)("div",{className:"relative group",children:[(0,a.jsx)("div",{className:"w-16 h-16 rounded-xl overflow-hidden border-3 flex-shrink-0",style:{borderColor:"rgba(255,255,255,0.3)",boxShadow:"0 4px 12px rgba(0,0,0,0.2)"},children:E?(0,a.jsx)("img",{src:t.avatarUrl,alt:"Avatar",className:"w-full h-full object-cover"}):(0,a.jsx)("div",{className:"w-full h-full flex items-center justify-center text-xl font-bold",style:{backgroundColor:t.bannerColor,color:"#fff"},children:r})}),(0,a.jsx)("div",{className:"absolute inset-0 rounded-xl flex items-center justify-center opacity-0 group-hover:opacity-100 cursor-pointer transition-opacity",style:{backgroundColor:"rgba(0,0,0,0.4)"},onClick:e=>{var t;e.stopPropagation(),null==(t=document.getElementById("avatar-gallery"))||t.scrollIntoView({behavior:"smooth"})},children:(0,a.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"white",children:(0,a.jsx)("path",{d:"M14 11V14H2V11H0V14C0 15.1.9 16 2 16H14C15.1 16 16 15.1 16 14V11H14ZM7 9L4.5 6.5L3 8L8 13L13 8L11.5 6.5L9 9V0H7V9Z"})})})]}),(0,a.jsxs)("div",{className:"flex-1 min-w-0 pb-1",children:[v?(0,a.jsx)("input",{ref:N,value:j,onChange:e=>y(e.target.value),onBlur:M,onKeyDown:e=>{"Enter"===e.key&&M(),"Escape"===e.key&&g(!1)},className:"w-full bg-white/20 backdrop-blur-sm outline-none text-white text-sm font-semibold px-2 py-1 rounded placeholder-white/50",placeholder:"Your name..."}):(0,a.jsx)("div",{className:"text-sm font-semibold text-white cursor-pointer hover:opacity-80 truncate",onClick:()=>{y(t.name),g(!0)},children:t.name||"Click to set name"}),(0,a.jsx)("div",{className:"text-[11px] mt-0.5 px-2 py-0.5 rounded-full inline-block cursor-pointer hover:opacity-80",style:{backgroundColor:"rgba(255,255,255,0.15)",color:"rgba(255,255,255,0.9)"},onClick:()=>{w(t.role||""),f(!0)},children:b?(0,a.jsx)("input",{ref:S,value:k,onChange:e=>w(e.target.value),onBlur:L,onKeyDown:e=>{"Enter"===e.key&&L(),"Escape"===e.key&&f(!1)},className:"bg-transparent outline-none text-white text-[11px] w-24 placeholder-white/50",placeholder:"Your role..."}):t.role||"Set role..."})]})]})]}),(0,a.jsxs)("div",{className:"px-4 pt-3 pb-2",children:[(0,a.jsx)("label",{className:"text-[10px] font-semibold uppercase tracking-wider block mb-2",style:{color:"var(--text-tertiary)"},children:"Role"}),(0,a.jsx)("div",{className:"flex flex-wrap gap-1.5",children:h.map(e=>(0,a.jsx)("button",{onClick:()=>i(e),className:"px-2 py-1 text-[10px] rounded-md border transition-colors",style:{borderColor:t.role===e?"var(--accent)":"var(--border)",color:t.role===e?"var(--accent)":"var(--text-secondary)",backgroundColor:t.role===e?"var(--accent)10":"transparent",fontWeight:t.role===e?600:400},children:e},e))})]}),(0,a.jsxs)("div",{id:"avatar-gallery",className:"px-4 pt-2 pb-3",children:[(0,a.jsx)("label",{className:"text-[10px] font-semibold uppercase tracking-wider block mb-2",style:{color:"var(--text-tertiary)"},children:"Choose Avatar"}),(0,a.jsx)("div",{className:"grid grid-cols-6 gap-2",children:u.map((e,r)=>(0,a.jsx)("button",{onClick:()=>n(e),className:"w-10 h-10 rounded-lg overflow-hidden border-2 transition-all hover:scale-110 hover:shadow-md",style:{borderColor:t.avatarUrl===e?"var(--accent)":"transparent",boxShadow:t.avatarUrl===e?"0 0 0 2px var(--accent)":"none"},children:(0,a.jsx)("img",{src:e,alt:"Avatar ".concat(r+11),className:"w-full h-full object-cover",loading:"lazy"})},e))}),(0,a.jsx)("div",{className:"grid grid-cols-6 gap-2 mt-2",children:x.map((e,r)=>(0,a.jsx)("button",{onClick:()=>n(e),className:"w-10 h-10 rounded-lg overflow-hidden border-2 transition-all hover:scale-110 hover:shadow-md",style:{borderColor:t.avatarUrl===e?"var(--accent)":"transparent",boxShadow:t.avatarUrl===e?"0 0 0 2px var(--accent)":"none"},children:(0,a.jsx)("img",{src:e,alt:"Avatar ".concat(r+23),className:"w-full h-full object-cover",loading:"lazy"})},e))})]}),(0,a.jsxs)("div",{className:"px-4 pb-4",children:[(0,a.jsx)("label",{className:"text-[10px] font-semibold uppercase tracking-wider block mb-2",style:{color:"var(--text-tertiary)"},children:"Banner Color"}),(0,a.jsx)("div",{className:"grid grid-cols-8 gap-1.5",children:d.T7.map(e=>(0,a.jsx)("button",{onClick:()=>o(e),className:"w-6 h-6 rounded-full transition-transform hover:scale-110 relative overflow-hidden",style:{background:"linear-gradient(135deg, ".concat(function(e,t){let r=parseInt(e.replace("#",""),16),a=Math.max(0,(r>>16)-Math.round((r>>16)*.3)),s=Math.max(0,(r>>8&255)-Math.round((r>>8&255)*.3)),l=Math.max(0,(255&r)-Math.round((255&r)*t));return"#".concat((a<<16|s<<8|l).toString(16).padStart(6,"0"))}(e,.3)," 0%, ").concat(e," 50%, ").concat(p(e,.3)," 100%)"),outline:t.bannerColor!==e||t.avatarUrl?"none":"2px solid var(--accent)",outlineOffset:2},children:(0,a.jsx)("div",{className:"absolute inset-0",style:{background:"linear-gradient(135deg, transparent 0%, rgba(255,255,255,0.3) 50%, transparent 100%)",animation:"shimmer 2s ease-in-out infinite"}})},e))})]}),(0,a.jsxs)("div",{className:"px-4 py-2.5 border-t flex items-center justify-between",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},children:[(0,a.jsx)("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:"Profile data stored locally"}),(0,a.jsx)("button",{onClick:()=>m(!1),className:"text-[10px] font-medium px-2 py-0.5 rounded",style:{color:"var(--accent)"},children:"Done"})]})]})]})}function v(e){let{open:t,onClose:r,profile:l,initials:o,stats:n}=e,[i,c]=(0,s.useState)(!1);if(!t)return null;let d="My Test Lah!:\n".concat(n.projects," Projects | ").concat(n.testCases," Cases | ").concat(n.passRate,"% Pass Rate"),u=async()=>{if(navigator.share)try{await navigator.share({title:"Test Lah! Stats",text:d})}catch(e){}else navigator.clipboard.writeText(d)};return(0,a.jsx)("div",{className:"fixed inset-0 z-[300] flex items-center justify-center",style:{backgroundColor:"rgba(0,0,0,0.3)",animation:"fadeIn 150ms ease-out"},onClick:r,children:(0,a.jsxs)("div",{className:"w-72 mx-4",onClick:e=>e.stopPropagation(),style:{perspective:"1000px"},children:[(0,a.jsxs)("div",{className:"relative w-full",style:{transformStyle:"preserve-3d",transform:i?"rotateY(180deg)":"rotateY(0)",transition:"transform 0.5s ease",height:"380px"},children:[(0,a.jsxs)("div",{className:"absolute inset-0 rounded-xl overflow-hidden border",style:{backfaceVisibility:"hidden",borderColor:"var(--border)",boxShadow:"var(--shadow-lg)"},children:[(0,a.jsx)("div",{className:"absolute inset-0",style:{background:"linear-gradient(160deg, ".concat(function(e,t){let r=parseInt(e.replace("#",""),16),a=Math.max(0,(r>>16)-Math.round((r>>16)*.25)),s=Math.max(0,(r>>8&255)-Math.round((r>>8&255)*t)),l=Math.max(0,(255&r)-Math.round((255&r)*t));return"#".concat((a<<16|s<<8|l).toString(16).padStart(6,"0"))}(l.bannerColor,.25)," 0%, ").concat(l.bannerColor," 50%, ").concat(function(e,t){let r=parseInt(e.replace("#",""),16),a=Math.min(255,(r>>16)+Math.round((255-(r>>16))*.2)),s=Math.min(255,(r>>8&255)+Math.round((255-(r>>8&255))*t)),l=Math.min(255,(255&r)+Math.round((255-(255&r))*t));return"#".concat((a<<16|s<<8|l).toString(16).padStart(6,"0"))}(l.bannerColor,.2)," 100%)")}}),(0,a.jsxs)("div",{className:"relative h-full flex flex-col items-center justify-center px-4",children:[(0,a.jsx)("div",{className:"w-20 h-20 rounded-xl overflow-hidden border-2 mb-3",style:{borderColor:"rgba(255,255,255,0.3)"},children:l.avatarUrl?(0,a.jsx)("img",{src:l.avatarUrl,alt:"Avatar",className:"w-full h-full object-cover"}):(0,a.jsx)("div",{className:"w-full h-full flex items-center justify-center text-2xl font-bold",style:{backgroundColor:"rgba(0,0,0,0.2)",color:"#fff"},children:o})}),(0,a.jsx)("h3",{className:"text-base font-semibold text-white drop-shadow-sm",children:l.name||"Anonymous Tester"}),(0,a.jsx)("p",{className:"text-xs mt-0.5 text-white/70",children:l.role||"No role set"}),(0,a.jsxs)("div",{className:"flex items-center gap-4 mt-4",children:[(0,a.jsx)(g,{value:n.projects,label:"Projects"}),(0,a.jsx)("div",{className:"w-px h-6 bg-white/20"}),(0,a.jsx)(g,{value:n.testCases,label:"Cases"}),(0,a.jsx)("div",{className:"w-px h-6 bg-white/20"}),(0,a.jsx)(g,{value:"".concat(n.passRate,"%"),label:"Pass"})]}),(0,a.jsx)("button",{onClick:()=>c(!0),className:"mt-5 px-4 py-1.5 text-[11px] font-medium rounded-full transition-colors",style:{backgroundColor:"rgba(255,255,255,0.2)",color:"#fff"},children:"View stats"})]})]}),(0,a.jsx)("div",{className:"absolute inset-0 rounded-xl overflow-hidden border",style:{backfaceVisibility:"hidden",transform:"rotateY(180deg)",borderColor:"var(--border)",backgroundColor:"var(--bg-card)",boxShadow:"var(--shadow-lg)"},children:(0,a.jsxs)("div",{className:"h-full flex flex-col",children:[(0,a.jsxs)("div",{className:"px-4 py-3 border-b flex items-center justify-between",style:{borderColor:"var(--border)"},children:[(0,a.jsx)("span",{className:"text-xs font-semibold",style:{color:"var(--text-primary)"},children:"Statistics"}),(0,a.jsx)("button",{onClick:()=>c(!1),className:"text-[10px] px-2 py-0.5 rounded border transition-colors hover:bg-[var(--bg-secondary)]",style:{color:"var(--text-tertiary)",borderColor:"var(--border)"},children:"Back"})]}),(0,a.jsxs)("div",{className:"flex-1 overflow-auto p-4 space-y-3",children:[(0,a.jsxs)("div",{children:[(0,a.jsxs)("div",{className:"flex items-center justify-between mb-1.5",children:[(0,a.jsx)("span",{className:"text-[10px] uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Pass Rate"}),(0,a.jsxs)("span",{className:"text-sm font-semibold",style:{color:n.passRate>=80?"var(--status-pass-text)":n.passRate>=50?"var(--status-skip-text)":"var(--status-fail-text)"},children:[n.passRate,"%"]})]}),(0,a.jsx)("div",{className:"h-1.5 rounded-full overflow-hidden",style:{backgroundColor:"var(--bg-secondary)"},children:(0,a.jsx)("div",{className:"h-full rounded-full",style:{width:"".concat(n.passRate,"%"),backgroundColor:n.passRate>=80?"var(--status-pass-text)":n.passRate>=50?"var(--status-skip-text)":"var(--status-fail-text)"}})})]}),(0,a.jsxs)("div",{className:"grid grid-cols-4 gap-1.5",children:[(0,a.jsx)(b,{label:"Pass",value:n.pass,color:"var(--status-pass-text)"}),(0,a.jsx)(b,{label:"Fail",value:n.fail,color:"var(--status-fail-text)"}),(0,a.jsx)(b,{label:"Skip",value:n.skip,color:"var(--status-skip-text)"}),(0,a.jsx)(b,{label:"New",value:n.untested})]}),(0,a.jsxs)("div",{className:"space-y-1",children:[(0,a.jsx)(f,{label:"Test Cases",value:n.testCases}),(0,a.jsx)(f,{label:"Flow Nodes",value:n.nodes}),(0,a.jsx)(f,{label:"Edges",value:n.edges}),(0,a.jsx)(f,{label:"Projects",value:n.projects})]}),(0,a.jsxs)("button",{onClick:u,className:"w-full px-3 py-2 text-[11px] font-medium rounded-lg border transition-colors hover:bg-[var(--bg-secondary)] flex items-center justify-center gap-1.5",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:[(0,a.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M4 12v8a2 2 0 002 2h12a2 2 0 002-2v-8"}),(0,a.jsx)("polyline",{points:"16 6 12 2 8 6"}),(0,a.jsx)("line",{x1:"12",y1:"2",x2:"12",y2:"15"})]}),"Share"]})]})]})})]}),(0,a.jsx)("button",{onClick:r,className:"w-full mt-2 px-3 py-2 text-[11px] font-medium rounded-lg border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)",backgroundColor:"var(--bg-card)"},children:"Close"})]})})}function g(e){let{value:t,label:r}=e;return(0,a.jsxs)("div",{className:"text-center",children:[(0,a.jsx)("div",{className:"text-sm font-semibold text-white",children:t}),(0,a.jsx)("div",{className:"text-[9px] uppercase tracking-wider text-white/60",children:r})]})}function b(e){let{label:t,value:r,color:s}=e;return(0,a.jsxs)("div",{className:"py-2 rounded-lg text-center",style:{backgroundColor:"var(--bg-secondary)"},children:[(0,a.jsx)("div",{className:"text-sm font-medium",style:{color:null!=s?s:"var(--text-secondary)"},children:r}),(0,a.jsx)("div",{className:"text-[8px] uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:t})]})}function f(e){let{label:t,value:r}=e;return(0,a.jsxs)("div",{className:"flex items-center justify-between px-3 py-2 rounded-lg",style:{backgroundColor:"var(--bg-secondary)"},children:[(0,a.jsx)("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:t}),(0,a.jsx)("span",{className:"text-xs font-medium",style:{color:"var(--text-primary)"},children:r})]})}var j=r(265);function y(){let{projects:e,activeProject:t,activeProjectId:r,profile:n,profileInitials:d,setProfileName:u,setProfileBannerColor:x,setProfileAvatarUrl:h,setProfileRole:p}=(0,o.M)(),{logout:g}=(0,c.A)(),b=(0,l.useRouter)(),f=(0,l.usePathname)(),{startProgress:y,completeProgress:w}=(0,j.p1)(),[C,N]=(0,s.useState)(!1),[S,M]=(0,s.useState)(!1),L=Object.values(e),E=(0,s.useMemo)(()=>{let e=L.flatMap(e=>Object.values(e.testCases).flat()),t=e.length,r=e.filter(e=>"pass"===e.status).length,a=e.filter(e=>"fail"===e.status).length,s=e.filter(e=>"skip"===e.status).length,l=e.filter(e=>"untested"===e.status).length,o=L.reduce((e,t)=>e+t.flows.length,0),n=L.reduce((e,t)=>{var r;return e+(null!=(r=t.edges)?r:[]).length},0),i=t-s,c=i>0?Math.round(r/i*100):0;return{projects:L.length,testCases:t,passRate:c,nodes:o,edges:n,pass:r,fail:a,skip:s,untested:l}},[L]),P=f.startsWith("/integrations")?"integrations":"projects";return(0,a.jsxs)("header",{className:"flex flex-col border-b flex-shrink-0 relative",style:{backgroundColor:"var(--bg-card)",borderColor:"var(--border)"},children:[(0,a.jsx)("div",{className:"absolute inset-0 overflow-hidden flex items-center justify-center pointer-events-none group/duck",children:(0,a.jsx)("img",{src:"https://static.vecteezy.com/system/resources/thumbnails/067/162/149/small/cute-duck-meme-sticker-transparent-cute-illustration-free-png.png",alt:"",className:"h-[85%] object-contain select-none transition-all duration-300 group-hover/duck:scale-110 group-hover/duck:opacity-[0.15] cursor-pointer",style:{opacity:.09,pointerEvents:"auto"},onClick:()=>b.push("/projects"),title:"Quack! \uD83E\uDD86"})}),(0,a.jsxs)("div",{className:"relative z-10 flex items-center justify-between px-6 py-2.5",children:[(0,a.jsx)("div",{className:"flex items-center gap-3",children:(0,a.jsxs)(i(),{href:"/projects",className:"flex items-center gap-2",children:[(0,a.jsx)("div",{className:"w-8 h-8 rounded-md overflow-hidden bg-white flex-shrink-0",style:{boxShadow:"0 1px 4px rgba(0,0,0,0.08)"},children:(0,a.jsx)("img",{src:"https://static.vecteezy.com/system/resources/thumbnails/067/162/149/small/cute-duck-meme-sticker-transparent-cute-illustration-free-png.png",alt:"Logo",width:32,height:32,className:"w-full h-full object-contain"})}),(0,a.jsx)("span",{className:"shimmer-text text-sm font-bold tracking-wide select-none",style:{background:"linear-gradient(90deg, var(--text-primary) 0%, var(--text-primary) 40%, #FFD54F 50%, var(--text-primary) 60%, var(--text-primary) 100%)",backgroundSize:"200% 100%",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",backgroundClip:"text",animation:"shimmerText 3s ease-in-out infinite"},children:"Test Lah!"})]})}),(0,a.jsxs)("div",{className:"flex items-center gap-2",children:[(0,a.jsx)("button",{onClick:()=>N(!0),className:"hidden md:block px-3 py-1.5 text-[11px] font-medium rounded-md border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:"My Card"}),(0,a.jsx)("div",{className:"hidden md:block w-px h-5 mx-0.5",style:{backgroundColor:"var(--border)"}}),(0,a.jsx)("div",{className:"relative z-[60]",children:(0,a.jsx)(m,{profile:n,initials:d,onSetName:u,onSetBannerColor:x,onSetAvatarUrl:h,onSetRole:p})}),(0,a.jsx)("button",{onClick:()=>{M(!0)},className:"w-8 h-8 flex items-center justify-center text-xs rounded-md border transition-colors hover:bg-[var(--bg-secondary)] hover:border-[var(--status-fail-text)]",style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},title:"Logout",children:(0,a.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:(0,a.jsx)("path",{d:"M5 2H3.5A1.5 1.5 0 002 3.5v7A1.5 1.5 0 003.5 12H5M9 10l3-3-3-3M6 7h6",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]}),(0,a.jsxs)("div",{className:"relative z-10 flex items-center gap-1 px-6",children:[(0,a.jsx)(k,{label:"All Projects",href:"/projects",icon:(0,a.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",children:[(0,a.jsx)("rect",{x:"1",y:"1",width:"5",height:"5",rx:"1",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),(0,a.jsx)("rect",{x:"8",y:"1",width:"5",height:"5",rx:"1",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),(0,a.jsx)("rect",{x:"1",y:"8",width:"5",height:"5",rx:"1",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),(0,a.jsx)("rect",{x:"8",y:"8",width:"5",height:"5",rx:"1",stroke:"currentColor",strokeWidth:"1.2",fill:"none"})]}),active:"projects"===P}),(0,a.jsx)(k,{label:"Integrations",href:"/integrations",icon:(0,a.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 14 14",fill:"none",children:[(0,a.jsx)("circle",{cx:"5",cy:"5",r:"2.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),(0,a.jsx)("circle",{cx:"9",cy:"9",r:"2.5",stroke:"currentColor",strokeWidth:"1.2",fill:"none"}),(0,a.jsx)("path",{d:"M7.5 5.5L6.5 8.5",stroke:"currentColor",strokeWidth:"1.2",strokeLinecap:"round"})]}),active:"integrations"===P})]}),(0,a.jsx)(v,{open:C,onClose:()=>N(!1),profile:n,initials:d,stats:E}),S&&(0,a.jsx)("div",{className:"fixed inset-0 z-[400] flex items-center justify-center",style:{backgroundColor:"rgba(0,0,0,0.3)",animation:"fadeIn 150ms ease-out"},onClick:()=>M(!1),children:(0,a.jsxs)("div",{className:"w-full max-w-sm mx-4 rounded-xl border overflow-hidden",style:{backgroundColor:"var(--bg-card)",borderColor:"var(--border)",boxShadow:"var(--shadow-lg)",animation:"fadeInUp 200ms ease-out"},onClick:e=>e.stopPropagation(),children:[(0,a.jsxs)("div",{className:"px-6 pt-6 pb-4 text-center",children:[(0,a.jsx)("div",{className:"w-14 h-14 mx-auto mb-4 rounded-full flex items-center justify-center",style:{backgroundColor:"var(--status-skip-bg)"},children:(0,a.jsxs)("svg",{width:"28",height:"28",viewBox:"0 0 24 24",fill:"none",stroke:"var(--status-skip-text)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,a.jsx)("path",{d:"M9 21H5a2 2 0 01-2-2V5a2 2 0 012-2h4"}),(0,a.jsx)("polyline",{points:"16 17 21 12 16 7"}),(0,a.jsx)("line",{x1:"21",y1:"12",x2:"9",y2:"12"})]})}),(0,a.jsx)("h3",{className:"text-base font-semibold mb-2",style:{color:"var(--text-primary)"},children:"Mau Keluar? Sedekahnya mana??"}),(0,a.jsx)("p",{className:"text-xs leading-relaxed",style:{color:"var(--text-tertiary)"},children:"Sebelum keluar, mungkin bisa traktir developer secangkir kopi? ☕"})]}),(0,a.jsxs)("div",{className:"px-6 pb-5 flex gap-2",children:[(0,a.jsx)("button",{onClick:()=>M(!1),className:"flex-1 px-3 py-2.5 text-xs font-medium rounded-lg border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:"Batal"}),(0,a.jsx)("button",{onClick:()=>{M(!1),y("Logging out..."),g(),setTimeout(()=>{w("Logged out!"),b.push("/login")},500)},className:"flex-1 px-3 py-2.5 text-xs font-medium rounded-lg transition-opacity hover:opacity-80",style:{backgroundColor:"var(--status-fail-text)",color:"#fff"},children:"Keluar"})]})]})})]})}function k(e){let{label:t,icon:r,active:s,href:l,badge:o}=e;return(0,a.jsxs)(i(),{href:l,className:"flex items-center gap-2 px-3 py-2 text-xs font-medium rounded-t-md transition-colors relative",style:{color:s?"var(--accent)":"var(--text-tertiary)",backgroundColor:s?"var(--bg-secondary)":"transparent"},children:[r,t,o&&(0,a.jsx)("span",{className:"ml-1 px-1.5 py-0.5 text-[9px] font-semibold rounded-full leading-none",style:{backgroundColor:s?"var(--accent)":"var(--bg-secondary)",color:s?"#fff":"var(--text-tertiary)"},children:o}),s&&(0,a.jsx)("div",{className:"absolute bottom-0 left-2 right-2 h-0.5 rounded-t-full",style:{backgroundColor:"var(--accent)"}})]})}var w=r(7065);function C(e){let{children:t}=e,r=(0,l.useRouter)(),{isLoggedIn:o,loaded:n}=(0,c.A)();return((0,s.useEffect)(()=>{n&&!o&&r.replace("/login")},[n,o,r]),n)?o?(0,a.jsx)(a.Fragment,{children:t}):null:(0,a.jsx)("div",{className:"h-screen flex items-center justify-center",style:{backgroundColor:"var(--bg-primary)"},children:(0,a.jsx)("div",{className:"text-sm",style:{color:"var(--text-tertiary)"},children:"Loading..."})})}function N(){let{undo:e,redo:t,canUndo:r,canRedo:a}=(0,o.M)();return(0,s.useEffect)(()=>{let s=s=>{(s.ctrlKey||s.metaKey)&&"z"===s.key&&!s.shiftKey&&(s.preventDefault(),r&&e()),(s.ctrlKey||s.metaKey)&&("Z"===s.key||"z"===s.key&&s.shiftKey)&&(s.preventDefault(),a&&t()),(s.ctrlKey||s.metaKey)&&"y"===s.key&&(s.preventDefault(),a&&t())};return window.addEventListener("keydown",s),()=>window.removeEventListener("keydown",s)},[e,t,r,a]),null}function S(e){let{children:t}=e,{dialog:r}=(0,o.M)();return(0,a.jsxs)(a.Fragment,{children:[t,(0,a.jsx)(w.q,{dialog:r})]})}function M(e){let{children:t}=e;return(0,a.jsx)(C,{children:(0,a.jsx)(o.q,{children:(0,a.jsx)(S,{children:(0,a.jsxs)("div",{className:"h-screen flex flex-col",style:{backgroundColor:"var(--bg-primary)"},children:[(0,a.jsx)(N,{}),(0,a.jsx)(y,{}),(0,a.jsx)("div",{className:"flex-1 min-h-0",children:t})]})})})})}},9715:(e,t,r)=>{Promise.resolve().then(r.bind(r,8609))}},e=>{e.O(0,[619,246,441,255,358],()=>e(e.s=9715)),_N_E=e.O()}]);
@@ -1 +0,0 @@
1
- (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[948],{158:(e,t,r)=>{"use strict";r.d(t,{Bf:()=>S,G$:()=>w,Rz:()=>b,Vj:()=>x,hX:()=>p,ii:()=>d,k5:()=>u,sy:()=>N,wy:()=>i});var s=r(8566),a=r(9280),o=r.n(a);let l={untested:"⬜ Untested",pass:"✅ Pass",fail:"❌ Fail",skip:"⏭ Skip"},n=e=>e.replace(/\n/g,"<br>").replace(/\|/g,"\\|");function i(e,t,r){let a=(r.length>0?r:s._X).filter(e=>e.visible),o=a.map(e=>e.label).join(" | "),i=a.map(()=>"---").join(" | "),c="# ".concat(e.code?e.code+" — ":"").concat(e.label,"\n\n");c+="| # | ".concat(o," |\n"),c+="|---|".concat(i,"|\n"),t.forEach((e,t)=>{let r=a.map(t=>"status"===t.key?l[e.status]:n(e[t.key]||""));c+="| ".concat(t+1," | ").concat(r.join(" | ")," |\n")});let d=t.length,x=t.filter(e=>"skip"===e.status).length,u=t.filter(e=>"pass"===e.status).length,p=d-x>0?Math.round(u/(d-x)*100):0;return c+="\n**Pass rate: ".concat(u,"/").concat(d-x," (").concat(p,"%)**\n")}function c(e,t,r){let s=new Blob([e],{type:r}),a=URL.createObjectURL(s),o=document.createElement("a");o.href=a,o.download=t,o.click(),URL.revokeObjectURL(a)}function d(e){c(function(e){let t="# ".concat(e.name,"\n\n");for(let x of e.flows){var r,a,o,i,c,d;let u=e.testCases[x.id];if(!u||0===u.length)continue;let p=((null!=(i=null!=(o=null==(r=e.columnConfigs)?void 0:r[x.id])?o:e.columnConfig)?i:[]).length>0?null!=(d=null!=(c=null==(a=e.columnConfigs)?void 0:a[x.id])?c:e.columnConfig)?d:[]:s._X).filter(e=>e.visible),m=p.map(e=>e.label).join(" | "),h=p.map(()=>"---").join(" | ");t+="## ".concat(x.code?x.code+" — ":"").concat(x.label,"\n\n"),t+="| # | ".concat(m," |\n"),t+="|---|".concat(h,"|\n"),u.forEach((e,r)=>{let s=p.map(t=>"status"===t.key?l[e.status]:n(e[t.key]||""));t+="| ".concat(r+1," | ").concat(s.join(" | ")," |\n")});let f=u.length,b=u.filter(e=>"skip"===e.status).length,v=u.filter(e=>"pass"===e.status).length,y=f-b>0?Math.round(v/(f-b)*100):0;t+="\n**Pass rate: ".concat(v,"/").concat(f-b," (").concat(y,"%)**\n\n---\n\n")}return t}(e),"".concat(e.name,".md"),"text/markdown")}function x(e){c(JSON.stringify(e,null,2),"".concat(e.name,".json"),"application/json")}function u(e,t,r){let s=(e.code||e.label).replace(/[^a-zA-Z0-9_-]/g,"_");c(i(e,t,r),"".concat(s,".md"),"text/markdown")}function p(e,t){let r=(e.code||e.label).replace(/[^a-zA-Z0-9_-]/g,"_");c(JSON.stringify({node:e,testCases:t},null,2),"".concat(r,".json"),"application/json")}function m(e,t){let r=e&&e.length>0?e:t;return r.length>0?r:s._X}function h(e,t){return t.map(t=>"status"===t.key?l[e.status]:e[t.key]||"")}function f(e){return e.includes(",")||e.includes('"')||e.includes("\n")?'"'.concat(e.replace(/"/g,'""'),'"'):e}function b(e,t,r){let a=(e.code||e.label).replace(/[^a-zA-Z0-9_-]/g,"_");c(function(e,t,r){let a=m(r,s._X).filter(e=>e.visible);return[["#",...a.map(e=>f(e.label))].join(","),...t.map((e,t)=>[String(t+1),...h(e,a).map(f)].join(","))].join("\n")}(0,t,r),"".concat(a,".csv"),"text/csv")}function v(e,t){var r,a,o;let l=null!=(o=null!=(a=null==(r=e.columnConfigs)?void 0:r[t])?a:e.columnConfig)?o:[];return l.length>0?l:s._X}function y(e){e.fill={type:"pattern",pattern:"solid",fgColor:{argb:"FFdbd8d3"}},e.font={name:"Inter",bold:!0,size:11},e.border={top:{style:"thin"},bottom:{style:"thin"},left:{style:"thin"},right:{style:"thin"}},e.alignment={vertical:"middle",horizontal:"left",wrapText:!0}}function g(e){e.border={top:{style:"thin"},bottom:{style:"thin"},left:{style:"thin"},right:{style:"thin"}},e.font={name:"Inter",size:11},e.alignment={vertical:"middle",horizontal:"left",wrapText:!0}}function j(e,t,r,s,a){let o=e.addWorksheet(t);return o.columns=[{header:"#",key:"row",width:6},...a.map(e=>({header:e.label,key:e.key,width:Math.max(e.label.length+4,18)}))],o.getRow(1).eachCell(y),s.forEach((e,t)=>{let r={row:t+1};a.forEach(t=>{"status"===t.key?r[t.key]=l[e.status]:r[t.key]=e[t.key]||""}),o.addRow(r).eachCell(g)}),o}async function k(e,t,r){let a=m(r,s._X).filter(e=>e.visible),l=new(o()).Workbook;return l.creator="Ayu Management Tools",j(l,e.label,e.label,t,a),new Blob([await l.xlsx.writeBuffer()],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}async function w(e,t,r){let s=(e.code||e.label).replace(/[^a-zA-Z0-9_-]/g,"_"),a=await k(e,t,r),o=URL.createObjectURL(a),l=document.createElement("a");l.href=o,l.download="".concat(s,".xlsx"),l.click(),URL.revokeObjectURL(o)}async function C(e){let t=new(o()).Workbook;for(let r of(t.creator="Ayu Management Tools",e.flows)){let s=e.testCases[r.id];if(!s||0===s.length)continue;let a=v(e,r.id).filter(e=>e.visible);j(t,(r.code||r.label).substring(0,31).replace(/[\\/*?[\]]/g,"_"),r.label,s,a)}return new Blob([await t.xlsx.writeBuffer()],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"})}async function N(e){let t=await C(e),r=URL.createObjectURL(t),s=document.createElement("a");s.href=r,s.download="".concat(e.name,".xlsx"),s.click(),URL.revokeObjectURL(r)}function S(e){c(function(e){let t="";for(let r of e.flows){let s=e.testCases[r.id];if(!s||0===s.length)continue;let a=v(e,r.id).filter(e=>e.visible);t+="# ".concat(r.code?r.code+" — ":"").concat(r.label,"\n"),t+=["#",...a.map(e=>f(e.label))].join(",")+"\n",s.forEach((e,r)=>{let s=[String(r+1),...h(e,a).map(f)];t+=s.join(",")+"\n"}),t+="\n"}return t}(e),"".concat(e.name,".csv"),"text/csv")}},882:(e,t,r)=>{"use strict";r.r(t),r.d(t,{default:()=>er});var s=r(5155),a=r(8661),o=r.n(a),l=r(2115),n=r(63),i=r(7246);let c=(0,l.memo)(function(e){let{node:t,position:r,isSelected:a,testCases:o,isDragged:n,edgeDragActive:i,isEdgeDropTarget:c,deleteMode:d,isDeleteChecked:x,onSelect:u,onAddChild:p,onDelete:m,onUnlinkNode:h,onRename:f,onUpdateNode:b,onDragStart:v,onEdgeStart:y,onToggleDeleteCheck:g,depth:j,svgRef:k}=e,[w,C]=(0,l.useState)(!1),[N,S]=(0,l.useState)(t.label),[L,D]=(0,l.useState)(!1),[E,M]=(0,l.useState)(!1),[R,A]=(0,l.useState)("horizontal"),[I,U]=(0,l.useState)(""),P=(0,l.useRef)(null),z=(0,l.useRef)(null),T=(0,l.useRef)(null),W=(0,l.useRef)({startX:0,startY:0,moved:!1}),{w:F,h:B}=0===j?{w:160,h:56}:1===j?{w:144,h:48}:{w:132,h:42},O=o.some(e=>"fail"===e.status),X=o.some(e=>"skip"===e.status),G=o.some(e=>"untested"===e.status),H=O||X||G,_=o.length>0&&o.every(e=>"pass"===e.status);(0,l.useEffect)(()=>{let e=e=>{let r=e.detail;(null==r?void 0:r.parentId)===t.id&&(M(!0),U(""))};return window.addEventListener("mindmap:add-child",e),()=>window.removeEventListener("mindmap:add-child",e)},[t.id]),(0,l.useEffect)(()=>{if(!E)return;let e=e=>{T.current&&!T.current.contains(e.target)&&(I.trim()?q():(M(!1),U("")))};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[E,I]),(0,l.useEffect)(()=>{E&&z.current&&z.current.focus()},[E]);let K=(0,l.useCallback)(()=>{S(t.label),C(!0),setTimeout(()=>{var e;return null==(e=P.current)?void 0:e.focus()},0)},[t.label]),Y=(0,l.useCallback)(()=>{N.trim()&&f(t.id,N.trim()),C(!1)},[N,t.id,f]),q=(0,l.useCallback)(()=>{if(I.trim()){let e="vertical"===R?{x:r.x,y:r.y+B+60}:{x:r.x+F+120,y:r.y};p(t.id,I.trim(),e,R)}M(!1),U("")},[I,t.id,p,r.x,r.y,B,F,R]),V=(0,l.useCallback)(e=>t=>{t.stopPropagation(),A(e),M(!0),U("")},[]),J=(0,l.useCallback)(e=>{if(2===e.button||d)return;if(e.stopPropagation(),!e.target.closest('[data-drag-handle="true"]'))return void u(t.id);e.preventDefault(),W.current={startX:e.clientX,startY:e.clientY,moved:!1};let s=e=>e.preventDefault();document.addEventListener("contextmenu",s);let a=e=>{let s=e.clientX-W.current.startX,a=e.clientY-W.current.startY;!W.current.moved&&(Math.abs(s)>6||Math.abs(a)>6)&&(W.current.moved=!0,v(t.id,W.current.startX,W.current.startY,r.x,r.y))},o=()=>{window.removeEventListener("mousemove",a),window.removeEventListener("mouseup",o),setTimeout(()=>document.removeEventListener("contextmenu",s),100)};window.addEventListener("mousemove",a),window.addEventListener("mouseup",o)},[t.id,u,v,d,r]),Z=t.id.replace(/[^a-zA-Z0-9]/g,"").slice(0,8),$=a&&!d;return(0,s.jsxs)("g",{transform:"translate(".concat(r.x,", ").concat(r.y,")"),onMouseDown:J,onDoubleClick:e=>{e.stopPropagation(),d||K()},onMouseEnter:()=>D(!0),onMouseLeave:()=>D(!1),style:{cursor:d?"pointer":"default",transition:n?"none":"transform 150ms ease-out"},onClick:()=>{d&&g(t.id)},children:[(0,s.jsxs)("defs",{children:[(0,s.jsxs)("linearGradient",{id:"fill-".concat(Z),x1:"0",y1:"0",x2:"0",y2:"1",children:[(0,s.jsx)("stop",{offset:"0%",stopColor:"#FFFFFF"}),(0,s.jsx)("stop",{offset:"100%",stopColor:"#FAF9F7"})]}),(0,s.jsxs)("filter",{id:"shadow-".concat(Z),x:"-10%",y:"-10%",width:"120%",height:"130%",children:[(0,s.jsx)("feDropShadow",{dx:"0",dy:"1",stdDeviation:"2",floodOpacity:"0.08"}),(0,s.jsx)("feDropShadow",{dx:"0",dy:"3",stdDeviation:"6",floodOpacity:"0.05"})]}),(0,s.jsxs)("filter",{id:"shadow-hover-".concat(Z),x:"-10%",y:"-10%",width:"120%",height:"140%",children:[(0,s.jsx)("feDropShadow",{dx:"0",dy:"2",stdDeviation:"4",floodOpacity:"0.12"}),(0,s.jsx)("feDropShadow",{dx:"0",dy:"6",stdDeviation:"12",floodOpacity:"0.08"})]}),(0,s.jsxs)("filter",{id:"shadow-drag-".concat(Z),x:"-20%",y:"-20%",width:"140%",height:"160%",children:[(0,s.jsx)("feDropShadow",{dx:"0",dy:"4",stdDeviation:"8",floodOpacity:"0.2"}),(0,s.jsx)("feDropShadow",{dx:"0",dy:"8",stdDeviation:"16",floodOpacity:"0.1"})]}),(0,s.jsxs)("filter",{id:"glow-".concat(Z),x:"-50%",y:"-50%",width:"200%",height:"200%",children:[(0,s.jsx)("feGaussianBlur",{in:"SourceGraphic",stdDeviation:"3",result:"blur"}),(0,s.jsx)("feColorMatrix",{in:"blur",type:"matrix",values:"0 0 0 0 0.4 0 0 0 0 0.8 0 0 0 0 0.4 0 0 0 0.6 0"})]})]}),!d&&(0,s.jsxs)("g",{"data-drag-handle":"true",transform:"translate(0, ".concat(-B/2-10,")"),style:{cursor:n?"grabbing":"grab"},children:[(0,s.jsx)("rect",{x:-20,y:-7,width:40,height:14,rx:4,fill:"var(--bg-card)",stroke:"var(--border)",strokeWidth:1,opacity:L||a?.9:.5,style:{transition:"opacity 150ms ease-out"}}),(0,s.jsx)("circle",{cx:-8,cy:-1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,s.jsx)("circle",{cx:-8,cy:1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,s.jsx)("circle",{cx:-4,cy:-1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,s.jsx)("circle",{cx:-4,cy:1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,s.jsx)("circle",{cx:0,cy:-1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,s.jsx)("circle",{cx:0,cy:1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,s.jsx)("circle",{cx:4,cy:-1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,s.jsx)("circle",{cx:4,cy:1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,s.jsx)("circle",{cx:8,cy:-1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6}),(0,s.jsx)("circle",{cx:8,cy:1.5,r:1.2,fill:"var(--text-tertiary)",opacity:.6})]}),c&&(0,s.jsx)("rect",{x:-F/2-6,y:-B/2-6,width:F+12,height:B+12,rx:8,fill:"var(--status-pass-bg)",stroke:"var(--status-pass-text)",strokeWidth:2,opacity:.5}),(()=>{let e=O?"var(--status-fail-bg)":H?"var(--status-skip-bg)":_?"var(--status-pass-bg)":null;return(0,s.jsxs)(s.Fragment,{children:[e&&(0,s.jsx)("rect",{x:-F/2,y:-B/2,width:F,height:B,rx:4,fill:e,opacity:O?.2:.15}),(0,s.jsx)("rect",{x:-F/2,y:-B/2,width:F,height:B,rx:4,fill:"url(#fill-".concat(Z,")"),stroke:d&&x?"var(--status-fail-text)":"var(--border)",strokeWidth:d&&x?2:.5,filter:n?"url(#shadow-drag-".concat(Z,")"):L?"url(#shadow-hover-".concat(Z,")"):"url(#shadow-".concat(Z,")"),style:{transition:"filter 200ms ease-out, stroke 150ms ease-out"}}),(0,s.jsx)("path",{d:"M ".concat(F/2-10," ").concat(-B/2," L ").concat(F/2," ").concat(-B/2," L ").concat(F/2," ").concat(-B/2+10," Z"),fill:"var(--bg-secondary)",opacity:.5}),(0,s.jsx)("path",{d:"M ".concat(F/2-10," ").concat(-B/2," L ").concat(F/2-10," ").concat(-B/2+10," L ").concat(F/2," ").concat(-B/2+10),fill:"none",stroke:"var(--border)",strokeWidth:.5,opacity:.4})]})})(),o.length>0&&!d&&(0,s.jsxs)("g",{transform:"translate(".concat(F/2-6,", ").concat(B/2-6,")"),style:{opacity:L||a?1:.7,transition:"opacity 150ms ease-out"},children:[(0,s.jsx)("rect",{x:-12,y:-8,width:24,height:16,rx:8,fill:O?"var(--status-fail-bg)":H?"var(--status-skip-bg)":"var(--status-pass-bg)",stroke:O?"var(--status-fail-text)":H?"var(--status-skip-text)":"var(--status-pass-text)",strokeWidth:.75}),(0,s.jsxs)("text",{textAnchor:"middle",dominantBaseline:"central",style:{fill:O?"var(--status-fail-text)":H?"var(--status-skip-text)":"var(--status-pass-text)",fontSize:9,fontWeight:600,fontFamily:"monospace"},children:[O?o.filter(e=>"fail"===e.status).length:H?o.filter(e=>"pass"!==e.status).length:o.length,"/",o.length]})]}),d&&(0,s.jsxs)("g",{transform:"translate(".concat(-F/2+8,", 0)"),children:[(0,s.jsx)("rect",{x:-7,y:-7,width:14,height:14,rx:3,fill:x?"var(--status-fail-text)":"transparent",stroke:x?"var(--status-fail-text)":"var(--border)",strokeWidth:1.5}),x&&(0,s.jsx)("path",{d:"M -4 0 L -1 3 L 4 -2",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]}),t.code&&!d&&(0,s.jsxs)("g",{transform:"translate(".concat(-F/2+6,", ").concat(-B/2-11,")"),style:{opacity:L||a?1:0,transition:"opacity 150ms ease-out"},children:[(0,s.jsx)("rect",{x:0,y:0,width:Math.max(6.5*t.code.length+10,28),height:14,rx:7,fill:"var(--accent)",opacity:.08}),(0,s.jsx)("text",{x:5,y:10,style:{fill:"var(--text-tertiary)",fontSize:8,fontWeight:500,fontFamily:"monospace",letterSpacing:"0.05em"},children:t.code})]}),w?(0,s.jsx)("foreignObject",{x:-F/2+8,y:-B/2+4,width:F-16,height:B-8,children:(0,s.jsx)("input",{ref:P,value:N,onChange:e=>S(e.target.value),onBlur:Y,onKeyDown:e=>{"Enter"===e.key&&Y(),"Escape"===e.key&&C(!1)},className:"w-full h-full bg-transparent outline-none text-center text-xs",style:{color:"var(--text-primary)",fontFamily:"inherit"}})}):(0,s.jsx)("text",{textAnchor:"middle",dominantBaseline:"central",className:"select-none",onClick:e=>{e.stopPropagation(),d||K()},style:{fill:"var(--text-primary)",fontSize:0===j?13:11.5,fontWeight:0===j?600:450,fontFamily:"inherit",letterSpacing:"-0.01em",cursor:L&&!d?"text":"default",pointerEvents:"auto"},children:t.label.length>22?t.label.slice(0,22)+"…":t.label}),$&&!w&&!i&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("g",{transform:"translate(".concat(F/2+3,", ").concat(-11,")"),children:[(0,s.jsxs)("g",{onClick:V("horizontal"),onMouseDown:e=>e.stopPropagation(),style:{cursor:"pointer"},children:[(0,s.jsx)("rect",{x:0,y:0,width:22,height:22,rx:3,fill:"var(--bg-card)",stroke:"var(--border)",strokeWidth:.75,opacity:.9}),(0,s.jsx)("line",{x1:11,y1:5,x2:11,y2:17,stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinecap:"round"}),(0,s.jsx)("line",{x1:5,y1:11,x2:17,y2:11,stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinecap:"round"})]}),(0,s.jsx)("g",{transform:"translate(".concat(24,", ").concat(7,")"),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),y(t.id,"pass",r.x+F/2+3+22+2+4,r.y-11+11,"horizontal")},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),y(t.id,"fail",r.x+F/2+3+22+2+4,r.y-11+11,"horizontal")},style:{cursor:"crosshair"},children:(0,s.jsx)("circle",{cx:4,cy:4,r:4,fill:"var(--status-pass-text)",opacity:.8,children:(0,s.jsx)("animate",{attributeName:"opacity",values:"0.6;1;0.6",dur:"2s",repeatCount:"indefinite"})})})]}),(0,s.jsxs)("g",{transform:"translate(".concat(-11,", ").concat(B/2+3,")"),children:[(0,s.jsxs)("g",{onClick:V("vertical"),onMouseDown:e=>e.stopPropagation(),style:{cursor:"pointer"},children:[(0,s.jsx)("rect",{x:0,y:0,width:22,height:22,rx:3,fill:"var(--bg-card)",stroke:"var(--border)",strokeWidth:.75,opacity:.9}),(0,s.jsx)("line",{x1:11,y1:5,x2:11,y2:17,stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinecap:"round"}),(0,s.jsx)("line",{x1:5,y1:11,x2:17,y2:11,stroke:"var(--text-tertiary)",strokeWidth:1.5,strokeLinecap:"round"})]}),(0,s.jsx)("g",{transform:"translate(".concat(24,", ").concat(7,")"),onMouseDown:e=>{e.stopPropagation(),e.preventDefault(),y(t.id,"pass",r.x-11+11,r.y+B/2+3+22+2+4,"vertical")},onContextMenu:e=>{e.preventDefault(),e.stopPropagation(),y(t.id,"fail",r.x-11+11,r.y+B/2+3+22+2+4,"vertical")},style:{cursor:"crosshair"},children:(0,s.jsx)("circle",{cx:4,cy:4,r:4,fill:"var(--accent)",opacity:.8,children:(0,s.jsx)("animate",{attributeName:"opacity",values:"0.6;1;0.6",dur:"2s",repeatCount:"indefinite"})})})]})]}),i&&!c&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("g",{transform:"translate(".concat(-F/2-10,", 0)"),children:(0,s.jsx)("circle",{r:6,fill:"var(--bg-card)",stroke:"var(--border)",strokeWidth:1.5,opacity:.6,strokeDasharray:"3 2"})}),(0,s.jsx)("g",{transform:"translate(0, ".concat(-B/2-10,")"),children:(0,s.jsx)("circle",{r:6,fill:"var(--bg-card)",stroke:"var(--border)",strokeWidth:1.5,opacity:.6,strokeDasharray:"3 2"})})]}),E&&(0,s.jsxs)("g",{children:["vertical"===R?(0,s.jsx)("line",{x1:0,y1:B/2,x2:0,y2:B/2+50,stroke:"var(--border-hover)",strokeWidth:1.5}):(0,s.jsx)("line",{x1:F/2,y1:0,x2:F/2+50,y2:0,stroke:"var(--border-hover)",strokeWidth:1.5}),(0,s.jsx)("rect",{x:"vertical"===R?-F/2:F/2+50,y:"vertical"===R?B/2+50:-B/2,width:F,height:B,rx:4,fill:"var(--bg-card)",stroke:"var(--accent)",strokeWidth:1,strokeDasharray:"4 3"}),(0,s.jsx)("foreignObject",{x:"vertical"===R?-F/2+4:F/2+50+4,y:"vertical"===R?B/2+50+4:-B/2+4,width:F-8,height:B-8,children:(0,s.jsx)("div",{ref:T,children:(0,s.jsx)("input",{ref:z,value:I,onChange:e=>U(e.target.value),onBlur:()=>{I.trim()?q():(M(!1),U(""))},onKeyDown:e=>{"Enter"===e.key&&q(),"Escape"===e.key&&(M(!1),U("")),e.stopPropagation()},onMouseDown:e=>e.stopPropagation(),placeholder:"Name node...",className:"w-full h-full bg-transparent outline-none text-center text-xs",style:{color:"var(--text-primary)",fontFamily:"inherit"}})})})]})]})});var d=r(7786),x=r(4269);function u(e){let{width:t=16,height:r=16,x:a=0,y:o=0,cx:n=1,cy:i=1,cr:c=1,className:u,glow:p=!1,...m}=e,h=(0,l.useId)(),f=(0,l.useRef)(null),[b,v]=(0,l.useState)({width:0,height:0});(0,l.useEffect)(()=>{let e=()=>{if(f.current){let{width:e,height:t}=f.current.getBoundingClientRect();v({width:e,height:t})}};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);let y=Array.from({length:Math.ceil(b.width/t)*Math.ceil(b.height/r)},(e,s)=>{let l=s%Math.ceil(b.width/t),c=Math.floor(s/Math.ceil(b.width/t));return{x:l*t+n+a,y:c*r+i+o,delay:5*Math.random(),duration:3*Math.random()+2}});return(0,s.jsxs)("svg",{ref:f,"aria-hidden":"true",className:(0,x.cn)("pointer-events-none absolute inset-0 h-full w-full text-neutral-400/80",u),...m,children:[(0,s.jsx)("defs",{children:(0,s.jsxs)("radialGradient",{id:"".concat(h,"-gradient"),children:[(0,s.jsx)("stop",{offset:"0%",stopColor:"currentColor",stopOpacity:"1"}),(0,s.jsx)("stop",{offset:"100%",stopColor:"currentColor",stopOpacity:"0"})]})}),y.map(e=>(0,s.jsx)(d.P.circle,{cx:e.x,cy:e.y,r:c,fill:p?"url(#".concat(h,"-gradient)"):"currentColor",initial:p?{opacity:.4,scale:1}:{},animate:p?{opacity:[.4,1,.4],scale:[1,1.5,1]}:{},transition:p?{duration:e.duration,repeat:1/0,repeatType:"reverse",delay:e.delay,ease:"easeInOut"}:{}},"".concat(e.x,"-").concat(e.y)))]})}let p=l.forwardRef((e,t)=>{let{className:r,children:a,rippleColor:o="#ffffff",duration:n="600ms",onClick:i,...c}=e,[d,u]=(0,l.useState)([]);return(0,l.useEffect)(()=>{let e=null;if(d.length>0){let t=d[d.length-1];e=setTimeout(()=>{u(e=>e.filter(e=>e.key!==t.key))},parseInt(n))}return()=>{null!==e&&clearTimeout(e)}},[d,n]),(0,s.jsxs)("button",{className:(0,x.cn)("bg-background text-primary relative flex cursor-pointer items-center justify-center overflow-hidden rounded-lg border-2 px-4 py-2 text-center",r),onClick:e=>{(e=>{let t=e.currentTarget.getBoundingClientRect(),r=Math.max(t.width,t.height),s={x:e.clientX-t.left-r/2,y:e.clientY-t.top-r/2,size:r,key:Date.now()};u(e=>[...e,s])})(e),null==i||i(e)},ref:t,...c,children:[(0,s.jsx)("div",{className:"relative z-10",children:a}),(0,s.jsx)("span",{className:"pointer-events-none absolute inset-0",children:d.map(e=>(0,s.jsx)("span",{className:"animate-rippling bg-background absolute rounded-full opacity-30",style:{width:"".concat(e.size,"px"),height:"".concat(e.size,"px"),top:"".concat(e.y,"px"),left:"".concat(e.x,"px"),backgroundColor:o,transform:"scale(0)","--duration":n}},e.key))})]})});function m(e){let{nodes:t,edges:r,testCases:a,selectedNodeId:o,onSelect:n,onAddNode:i,onDeleteNode:d,onDeleteNodes:x,onUnlinkNode:m,onRenameNode:b,onUpdateNode:v,onAddEdge:y,onDeleteEdge:g,onUpdateEdge:j,canUndo:k,canRedo:w,onUndo:C,onRedo:N}=e,S=(0,l.useMemo)(()=>(function(e){let t=new Map;if(0===e.length)return t;let r=new Map;for(let t of e)r.set(t.id,t);let s=new Set;for(let t of e)t.position&&s.add(t.id);let a=e.filter(e=>null===e.parentId);if(0===a.length)return t;let o=0;for(let e of a)o=function e(a,o,l,n,i){var c,d,x,u;let p=r.get(a);if(!p)return l;let m="vertical"===p.direction,h=m?null!=(d=null==(c=p.position)?void 0:c.x)?d:n:60+180*o,f=l;for(let t of p.children)f=m?e(t,o,f,n,i):e(t,o+1,f,n,i);let b=p.children.map(e=>t.get(e)).filter(Boolean),v=b.length>0?(Math.min(...b.map(e=>e.y))+Math.max(...b.map(e=>e.y)))/2:l;if(s.has(a)&&p.position){let r=b.length>0?v:l,s=p.position.x-(m?p.position.x:h),n=p.position.y-r;t.set(a,p.position);let i=l;for(let t of p.children)i=m?e(t,o,i,s,n):e(t,o+1,i,s,n);return i}return m?t.set(a,{x:(null!=(u=null==(x=p.position)?void 0:x.x)?u:0)+n,y:v+i}):t.set(a,{x:h+n,y:v+i}),f}(e.id,0,o,0,0);let l=Array.from(t.entries());if(l.length>0){let e=l.filter(e=>{let[t]=e;return!s.has(t)}).map(e=>{let[,t]=e;return t.y});if(e.length>0){let r=(Math.min(...e)+Math.max(...e))/2;for(let[e,a]of l)s.has(e)||t.set(e,{x:a.x,y:a.y-r+300})}}return t})(t),[t]),[L,D]=(0,l.useState)({x:0,y:0}),[E,M]=(0,l.useState)(1),[R,A]=(0,l.useState)(!1),[I,U]=(0,l.useState)({x:0,y:0}),[P,z]=(0,l.useState)(null),[T,W]=(0,l.useState)(!1),[F,B]=(0,l.useState)(null),[O,X]=(0,l.useState)(null),[G,H]=(0,l.useState)(null),[_,K]=(0,l.useState)(null),[Y,q]=(0,l.useState)(!1),[V,J]=(0,l.useState)(new Set),[Z,$]=(0,l.useState)(!1),[Q,ee]=(0,l.useState)(null),[et,er]=(0,l.useState)(!1),[es,ea]=(0,l.useState)(new Set),eo=(0,l.useRef)(null),el=(0,l.useRef)(null),en=(0,l.useRef)(null);(0,l.useEffect)(()=>{let e=eo.current;if(!e)return;let t=e=>{e.preventDefault();let t=e.deltaY>0?.9:1.1;M(e=>Math.max(.2,Math.min(3,e*t)))};return e.addEventListener("wheel",t,{passive:!1}),()=>e.removeEventListener("wheel",t)},[]);let ei=(0,l.useCallback)(()=>{let e=Array.from(S.values());if(0===e.length){M(1),D({x:0,y:0});return}if(!eo.current)return;let t=eo.current.getBoundingClientRect(),r=Math.min(...e.map(e=>e.x))-80,s=Math.max(...e.map(e=>e.x))+80,a=Math.min(...e.map(e=>e.y))-80,o=Math.max(...e.map(e=>e.y))+80,l=Math.min(t.width/(s-r),t.height/(o-a),1.5);M(l),D({x:t.width/2/l-(r+s)/2,y:t.height/2/l-(a+o)/2})},[S]);(0,l.useEffect)(()=>{let e=e=>{var r;let s=null==(r=e.target)?void 0:r.tagName;if("INPUT"!==s&&"TEXTAREA"!==s){if((e.ctrlKey||e.metaKey)&&(("="===e.key||"+"===e.key)&&(e.preventDefault(),M(e=>Math.min(3,1.15*e))),"-"===e.key&&(e.preventDefault(),M(e=>Math.max(.2,.85*e))),"0"===e.key&&(e.preventDefault(),ei())),"Tab"===e.key&&o&&!e.ctrlKey&&!e.metaKey){e.preventDefault();let r=t.find(e=>e.id===o);if(r){let e=new CustomEvent("mindmap:add-child",{detail:{parentId:r.id}});window.dispatchEvent(e)}}if("Enter"===e.key&&o&&!e.ctrlKey&&!e.metaKey){e.preventDefault();let r=t.find(e=>e.id===o);if(r)if(r.parentId){let e=new CustomEvent("mindmap:add-child",{detail:{parentId:r.parentId}});window.dispatchEvent(e)}else{let e=S.get(r.id);e&&i(null,"",{x:e.x,y:e.y+70})}}"Delete"!==e.key&&"Backspace"!==e.key||!o||e.ctrlKey||e.metaKey||(e.preventDefault(),ee(o),$(!0))}};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[o,t,S,i,d,ei]);let ec=(0,l.useCallback)((e,t)=>{if(!eo.current)return{x:0,y:0};let r=eo.current.getBoundingClientRect();return{x:(e-r.left)/E-L.x,y:(t-r.top)/E-L.y}},[E,L]),ed=(0,l.useCallback)(e=>{e.target===eo.current&&(A(!0),U({x:e.clientX-L.x*E,y:e.clientY-L.y*E}))},[L,E]),ex=(0,l.useCallback)(e=>{if(R&&D({x:(e.clientX-I.x)/E,y:(e.clientY-I.y)/E}),P){let t=ec(P.startClientX,P.startClientY),r=ec(e.clientX,e.clientY),s=r.x-t.x,a=r.y-t.y,o=P.startNodeX+s,l=P.startNodeY+a;en.current={id:P.id,x:o,y:l},el.current||(el.current=requestAnimationFrame(()=>{en.current&&(v(en.current.id,{position:{x:en.current.x,y:en.current.y}}),en.current=null),el.current=null}))}if(O){let r=ec(e.clientX,e.clientY);X(e=>e?{...e,curX:r.x,curY:r.y}:null);let s=null;for(let e of t){if(e.id===O.fromId)continue;let t=S.get(e.id);if(!t)continue;let a=r.x-t.x,o=r.y-t.y;if(80>Math.abs(a)&&40>Math.abs(o)){s=e.id;break}}K(s)}},[R,I,E,P,O,ec,v,t,S]),eu=(0,l.useCallback)(()=>{if(O){let e={x:O.curX,y:O.curY};for(let r of t){let t=S.get(r.id);if(!t)continue;let s=e.x-t.x,a=e.y-t.y;if(80>Math.abs(s)&&40>Math.abs(a)&&r.id!==O.fromId){y(O.fromId,r.id,O.type);break}}X(null),K(null)}A(!1),z(null),el.current&&(cancelAnimationFrame(el.current),el.current=null)},[O,t,S,y]),ep=(0,l.useCallback)(e=>{e.target===eo.current&&(n(null),W(!1))},[n]),em=(0,l.useCallback)(e=>{e.target===eo.current&&(B(ec(e.clientX,e.clientY)),W(!0))},[ec]),eh=(0,l.useCallback)(e=>{e.trim()&&i(null,e.trim(),null!=F?F:void 0),W(!1),B(null)},[i,F]),ef=(0,l.useCallback)((e,t,r,s,a)=>{z({id:e,startNodeX:s,startNodeY:a,startClientX:t,startClientY:r})},[]),eb=(0,l.useCallback)((e,t,r,s,a)=>{X({fromId:e,type:t,startX:r,startY:s,curX:r,curY:s,direction:a})},[]),ev=(0,l.useCallback)(()=>{q(e=>!e),J(new Set),er(!1),ea(new Set)},[]),ey=(0,l.useCallback)(()=>{er(e=>!e),ea(new Set),q(!1),J(new Set)},[]),eg=(0,l.useCallback)(e=>{ea(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]),ej=(0,l.useCallback)(()=>{Array.from(es).forEach(e=>{e.startsWith("tree-")?m(e.replace("tree-","")):g(e)}),ea(new Set),er(!1)},[es,m,g]),ek=(0,l.useCallback)(e=>{J(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]),ew=(0,l.useCallback)(()=>{Q?(d(Q),ee(null)):V.size>0&&(x(Array.from(V)),J(new Set),q(!1)),$(!1)},[Q,V,d,x]),eC=Array.from(S.values());return eC.length>0&&(eC.map(e=>e.x),eC.map(e=>e.x)),eC.length>0&&(eC.map(e=>e.y),eC.map(e=>e.y)),(0,s.jsxs)("div",{className:"relative w-full h-full overflow-hidden",style:{backgroundColor:"var(--bg-primary)"},children:[(0,s.jsx)(u,{width:24,height:24,cr:1,className:"text-neutral-300/60 dark:text-neutral-600/40"}),(0,s.jsxs)("div",{className:"absolute top-3 right-3 z-10 flex flex-col gap-1",children:[(0,s.jsx)("button",{onClick:()=>M(e=>Math.min(3,1.2*e)),className:"w-7 h-7 flex items-center justify-center text-xs rounded border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)",backgroundColor:"var(--bg-card)"},children:"+"}),(0,s.jsx)("button",{onClick:()=>M(e=>Math.max(.2,.8*e)),className:"w-7 h-7 flex items-center justify-center text-xs rounded border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)",backgroundColor:"var(--bg-card)"},children:"−"}),(0,s.jsx)("button",{onClick:ei,className:"w-7 h-7 flex items-center justify-center text-[10px] rounded border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)",backgroundColor:"var(--bg-card)"},children:"Fit"}),(0,s.jsxs)("div",{className:"text-[10px] text-center mt-0.5",style:{color:"var(--text-tertiary)"},children:[Math.round(100*E),"%"]}),(0,s.jsxs)("div",{className:"mt-1 border-t pt-1",style:{borderColor:"var(--border)"},children:[(0,s.jsx)("button",{onClick:ev,className:"w-7 h-7 flex items-center justify-center text-[10px] rounded border transition-colors",style:{borderColor:Y?"var(--status-fail-text)":"var(--border)",color:Y?"var(--status-fail-text)":"var(--text-secondary)",backgroundColor:Y?"var(--status-fail-bg)":"var(--bg-card)"},title:Y?"Exit delete mode":"Delete nodes",children:(0,s.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("polyline",{points:"3 6 5 6 21 6"}),(0,s.jsx)("path",{d:"M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6m3 0V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2"})]})}),(0,s.jsx)("button",{onClick:ey,className:"w-7 h-7 mt-1 flex items-center justify-center text-[10px] rounded border transition-colors",style:{borderColor:et?"var(--status-skip-text)":"var(--border)",color:et?"var(--status-skip-text)":"var(--text-secondary)",backgroundColor:et?"var(--status-skip-bg)":"var(--bg-card)"},title:et?"Exit unlink mode":"Unlink lines",children:(0,s.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("path",{d:"M15 7h3a5 5 0 0 1 0 10h-3m-6 0H6a5 5 0 0 1 0-10h3"}),(0,s.jsx)("line",{x1:"8",y1:"12",x2:"16",y2:"12",strokeDasharray:"3 3"})]})})]})]}),(0,s.jsxs)("div",{className:"absolute top-3 left-3 z-10 flex flex-col gap-1",children:[(0,s.jsx)("button",{onClick:C,disabled:!k,className:"w-7 h-7 flex items-center justify-center text-xs rounded border transition-colors hover:bg-[var(--bg-secondary)] disabled:opacity-25",style:{borderColor:"var(--border)",color:"var(--text-secondary)",backgroundColor:"var(--bg-card)"},title:"Undo (Ctrl+Z)",children:(0,s.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:[(0,s.jsx)("path",{d:"M3 5h5a3 3 0 0 1 0 6H6",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),(0,s.jsx)("path",{d:"M5.5 2.5L3 5l2.5 2.5",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})}),(0,s.jsx)("button",{onClick:N,disabled:!w,className:"w-7 h-7 flex items-center justify-center text-xs rounded border transition-colors hover:bg-[var(--bg-secondary)] disabled:opacity-25",style:{borderColor:"var(--border)",color:"var(--text-secondary)",backgroundColor:"var(--bg-card)"},title:"Redo (Ctrl+Shift+Z)",children:(0,s.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 14 14",fill:"none",children:[(0,s.jsx)("path",{d:"M11 5H6a3 3 0 0 0 0 6h2",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"}),(0,s.jsx)("path",{d:"M8.5 2.5L11 5 8.5 7.5",stroke:"currentColor",strokeWidth:"1.3",strokeLinecap:"round",strokeLinejoin:"round",fill:"none"})]})})]}),Y&&(0,s.jsxs)("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 z-20 flex items-center gap-3 px-4 py-2 rounded-lg border",style:{backgroundColor:"var(--bg-card)",borderColor:"var(--status-fail-text)",boxShadow:"var(--shadow-lg)",animation:"fadeInDown 200ms ease-out"},children:[(0,s.jsx)("span",{className:"text-xs font-medium",style:{color:"var(--text-primary)"},children:"Select nodes to delete"}),(0,s.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{backgroundColor:"var(--status-fail-bg)",color:"var(--status-fail-text)"},children:[V.size," selected"]}),(0,s.jsx)("button",{onClick:()=>{V.size>0&&$(!0)},disabled:0===V.size,className:"px-3 py-1 text-[11px] font-medium rounded transition-colors disabled:opacity-40",style:{backgroundColor:"var(--status-fail-text)",color:"white"},children:"Delete"}),(0,s.jsx)("button",{onClick:ev,className:"px-3 py-1 text-[11px] rounded border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:"Cancel"})]}),et&&(0,s.jsxs)("div",{className:"absolute top-3 left-1/2 -translate-x-1/2 z-20 flex items-center gap-3 px-4 py-2 rounded-lg border",style:{backgroundColor:"var(--bg-card)",borderColor:"var(--status-skip-text)",boxShadow:"var(--shadow-lg)",animation:"fadeInDown 200ms ease-out"},children:[(0,s.jsx)("span",{className:"text-xs font-medium",style:{color:"var(--text-primary)"},children:"Select lines to unlink"}),(0,s.jsxs)("span",{className:"text-[10px] px-1.5 py-0.5 rounded",style:{backgroundColor:"var(--status-skip-bg)",color:"var(--status-skip-text)"},children:[es.size," selected"]}),(0,s.jsx)("button",{onClick:ej,disabled:0===es.size,className:"px-3 py-1 text-[11px] font-medium rounded transition-colors disabled:opacity-40",style:{backgroundColor:"var(--status-skip-text)",color:"white"},children:"Unlink"}),(0,s.jsx)("button",{onClick:ey,className:"px-3 py-1 text-[11px] rounded border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:"Cancel"})]}),Z&&(0,s.jsx)("div",{className:"fixed inset-0 z-[400] flex items-center justify-center",style:{backgroundColor:"rgba(0,0,0,0.3)",animation:"fadeIn 150ms ease-out"},onClick:()=>$(!1),children:(0,s.jsxs)("div",{className:"w-full max-w-sm mx-4 p-5 rounded-xl border",style:{backgroundColor:"var(--bg-card)",borderColor:"var(--border)",boxShadow:"var(--shadow-lg)"},onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)("h3",{className:"text-sm font-semibold mb-2",style:{color:"var(--text-primary)"},children:["Delete ",Q?"node":"".concat(V.size," node").concat(V.size>1?"s":""),"?"]}),(0,s.jsxs)("p",{className:"text-xs mb-4",style:{color:"var(--text-tertiary)"},children:["This will permanently remove the ",Q?"node":"selected node".concat(V.size>1?"s":"")," and all their test cases. This action cannot be undone."]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("button",{onClick:()=>$(!1),className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:"Cancel"}),(0,s.jsx)("button",{onClick:ew,className:"flex-1 px-3 py-2 text-xs font-medium rounded-lg transition-colors",style:{backgroundColor:"var(--status-fail-text)",color:"white"},children:"Delete"})]})]})}),o&&(0,s.jsxs)("div",{className:"absolute bottom-3 left-3 z-10 flex gap-2 text-[10px]",style:{color:"var(--text-tertiary)"},children:[(0,s.jsx)("span",{className:"px-1.5 py-0.5 rounded border",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-card)"},children:"Tab = add child"}),(0,s.jsx)("span",{className:"px-1.5 py-0.5 rounded border",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-card)"},children:"Enter = add sibling"}),(0,s.jsx)("span",{className:"px-1.5 py-0.5 rounded border",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-card)"},children:"Del = delete"})]}),(0,s.jsxs)("svg",{ref:eo,width:"100%",height:"100%",onMouseDown:ed,onMouseMove:ex,onMouseUp:eu,onClick:ep,onDoubleClick:em,style:{cursor:R||P?"grabbing":O?"crosshair":"default"},children:[(0,s.jsxs)("defs",{children:[(0,s.jsx)("marker",{id:"arrow-pass",markerWidth:"8",markerHeight:"8",refX:"8",refY:"4",orient:"auto",children:(0,s.jsx)("path",{d:"M0,0 L8,4 L0,8",fill:"var(--status-pass-text)"})}),(0,s.jsx)("marker",{id:"arrow-fail",markerWidth:"8",markerHeight:"8",refX:"8",refY:"4",orient:"auto",children:(0,s.jsx)("path",{d:"M0,0 L8,4 L0,8",fill:"var(--status-fail-text)"})}),(0,s.jsx)("marker",{id:"arrow-default",markerWidth:"8",markerHeight:"8",refX:"8",refY:"4",orient:"auto",children:(0,s.jsx)("path",{d:"M0,0 L8,4 L0,8",fill:"var(--text-tertiary)"})})]}),(0,s.jsxs)("g",{transform:"scale(".concat(E,") translate(").concat(L.x,", ").concat(L.y,")"),children:[t.map(e=>{let a;if(!e.parentId)return null;let o=S.get(e.parentId),l=S.get(e.id);if(!o||!l||r.some(t=>t.fromId===e.parentId&&t.toId===e.id||t.fromId===e.id&&t.toId===e.parentId))return null;let n=t.find(t=>t.id===e.parentId),i=(null==n?void 0:n.direction)==="vertical",c="tree-".concat(e.id),d=es.has(c);if(i){let e=o.y+40,t=l.y-40;a="M ".concat(o.x," ").concat(o.y+28," C ").concat(o.x," ").concat(e,", ").concat(l.x," ").concat(t,", ").concat(l.x," ").concat(l.y-21)}else{let e=o.x+60,t=l.x-60;a="M ".concat(o.x+70," ").concat(o.y," C ").concat(e," ").concat(o.y,", ").concat(t," ").concat(l.y,", ").concat(l.x-60," ").concat(l.y)}let x=(o.x+l.x)/2,u=(o.y+l.y)/2;return(0,s.jsxs)("g",{children:[(0,s.jsx)("path",{d:a,fill:"none",stroke:"transparent",strokeWidth:12,style:{cursor:"pointer"},onClick:()=>{et?eg(c):y(e.parentId,e.id,"pass")},onDoubleClick:t=>{t.stopPropagation(),et||m(e.id)}}),(0,s.jsx)("path",{d:a,fill:"none",stroke:et&&d?"var(--status-skip-text)":"var(--border-hover)",strokeWidth:et&&d?2.5:1.5,strokeDasharray:et&&d?"6 4":"none",style:{pointerEvents:"none",transition:"stroke 150ms, stroke-width 150ms"}}),et&&(0,s.jsxs)("g",{transform:"translate(".concat(x,", ").concat(u,")"),style:{pointerEvents:"none"},children:[(0,s.jsx)("rect",{x:-7,y:-7,width:14,height:14,rx:3,fill:d?"var(--status-skip-text)":"var(--bg-card)",stroke:d?"var(--status-skip-text)":"var(--border)",strokeWidth:1.5}),d&&(0,s.jsx)("path",{d:"M -4 0 L -1 3 L 4 -2",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]})]},"tree-edge-".concat(e.id))}),r.map(e=>{let r,a=S.get(e.fromId),o=S.get(e.toId);if(!a||!o)return null;let l="pass"===e.type,n="fail"===e.type;e.type;let i=l?"var(--status-pass-text)":n?"var(--status-fail-text)":"var(--text-tertiary)",c=(a.x+o.x)/2,d=(a.y+o.y)/2-12,x=es.has(e.id),u=t.find(t=>t.id===e.fromId);return r=(null==u?void 0:u.direction)==="vertical"?"M ".concat(a.x," ").concat(a.y," C ").concat(a.x," ").concat(a.y+80,", ").concat(o.x," ").concat(o.y-80,", ").concat(o.x," ").concat(o.y):"M ".concat(a.x," ").concat(a.y," C ").concat(a.x+80," ").concat(a.y,", ").concat(o.x-80," ").concat(o.y,", ").concat(o.x," ").concat(o.y),(0,s.jsxs)("g",{children:[(0,s.jsx)("path",{d:r,fill:"none",stroke:"transparent",strokeWidth:16,style:{cursor:"pointer"},onClick:()=>{et?eg(e.id):l?j(e.id,{type:"fail"}):n?j(e.id,{type:"default"}):j(e.id,{type:"pass"})},onMouseEnter:()=>H(e.id),onMouseLeave:()=>H(null)}),(0,s.jsx)("path",{d:r,fill:"none",stroke:et&&x?"var(--status-skip-text)":i,strokeWidth:et&&x||G===e.id?2.5:1.8,strokeDasharray:et&&x?"6 4":l?"none":n?"6 4":"3 3",markerEnd:et?void 0:l?"url(#arrow-pass)":n?"url(#arrow-fail)":"url(#arrow-default)",style:{transition:"stroke-width 150ms ease-out, stroke 150ms ease-out",pointerEvents:"none"}}),et&&(0,s.jsxs)("g",{transform:"translate(".concat(c,", ").concat(d,")"),style:{pointerEvents:"none"},children:[(0,s.jsx)("rect",{x:-7,y:-7,width:14,height:14,rx:3,fill:x?"var(--status-skip-text)":"var(--bg-card)",stroke:x?"var(--status-skip-text)":"var(--border)",strokeWidth:1.5}),x&&(0,s.jsx)("path",{d:"M -4 0 L -1 3 L 4 -2",fill:"none",stroke:"white",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]}),!et&&G===e.id&&(0,s.jsxs)("g",{transform:"translate(".concat(c,", ").concat(d-12,")"),style:{pointerEvents:"none"},children:[(0,s.jsx)("rect",{x:-22,y:-7,width:44,height:14,rx:7,fill:l?"var(--status-pass-bg)":n?"var(--status-fail-bg)":"var(--bg-secondary)",stroke:l?"var(--status-pass-text)":n?"var(--status-fail-text)":"var(--border)",strokeWidth:.5}),(0,s.jsx)("text",{textAnchor:"middle",dominantBaseline:"central",style:{fill:i,fontSize:9,fontWeight:500},children:l?"Pass":n?"Fail":"Default"})]})]},e.id)}),O&&(0,s.jsx)("line",{x1:O.startX,y1:O.startY,x2:O.curX,y2:O.curY,stroke:"pass"===O.type?"var(--status-pass-text)":"var(--status-fail-text)",strokeWidth:2,strokeDasharray:"6 4",opacity:.6}),t.map(e=>{var r;let l=S.get(e.id);if(!l)return null;let x=function(e,t){let r=0,s=e;for(;s.parentId;){r++;let e=t.find(e=>e.id===s.parentId);if(!e)break;s=e}return r}(e,t);return(0,s.jsx)(c,{node:e,position:l,isSelected:e.id===o,testCases:null!=(r=a[e.id])?r:[],isDragged:(null==P?void 0:P.id)===e.id,edgeDragActive:null!==O,isEdgeDropTarget:_===e.id&&null!==O&&e.id!==O.fromId,deleteMode:Y,isDeleteChecked:V.has(e.id),onSelect:n,onAddChild:(e,t,r,s)=>{i(e,t,r,s)},onDelete:d,onUnlinkNode:m,onRename:b,onUpdateNode:v,onDragStart:ef,onEdgeStart:eb,onToggleDeleteCheck:ek,depth:x,svgRef:eo},e.id)})]})]}),T&&F&&(0,s.jsx)(f,{position:F,scale:E,pan:L,svgRef:eo,onSubmit:eh,onCancel:()=>W(!1)}),0===t.length&&!T&&(0,s.jsx)("div",{className:"absolute inset-0 flex items-center justify-center",children:(0,s.jsx)(p,{onClick:()=>{if(!eo.current){B({x:0,y:0}),W(!0);return}let e=eo.current.getBoundingClientRect();B({x:e.width/2/E-L.x,y:e.height/2/E-L.y}),W(!0)},rippleColor:"rgba(0,0,0,0.08)",className:"text-sm px-6 py-2.5",style:{color:"var(--text-tertiary)",borderColor:"var(--border)",borderRadius:"var(--radius-pill)",backgroundColor:"transparent"},children:(0,s.jsxs)("span",{className:"inline-flex items-center gap-2",children:[(0,s.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 16 16",fill:"none",children:(0,s.jsx)("path",{d:"M8 3v10M3 8h10",stroke:"currentColor",strokeWidth:"1.5",strokeLinecap:"round"})}),"Create your first flow node"]})})}),t.length>0&&(0,s.jsx)(h,{nodes:t,positions:S,pan:L,scale:E})]})}function h(e){let{nodes:t,positions:r,pan:a,scale:o}=e,l=Array.from(r.values());if(0===l.length)return null;let n=Math.min(...l.map(e=>e.x)),i=Math.max(...l.map(e=>e.x)),c=Math.min(...l.map(e=>e.y)),d=Math.max(...l.map(e=>e.y)),x=i-n+80,u=d-c+80,p=Math.max(60,u/x*120),m=120/x,h=p/u;return(0,s.jsx)("div",{className:"absolute bottom-3 right-3 border z-10",style:{width:120,height:p,backgroundColor:"var(--bg-card)",borderColor:"var(--border)",borderRadius:"var(--radius-sm)",opacity:.85},children:(0,s.jsx)("svg",{width:120,height:p,children:t.map(e=>{let t=r.get(e.id);if(!t)return null;let a=(t.x-n+40)*m,o=(t.y-c+40)*h;return(0,s.jsx)("circle",{cx:a,cy:o,r:2.5,fill:"var(--accent)",opacity:.6},e.id)})})})}function f(e){let{position:t,scale:r,pan:a,svgRef:o,onSubmit:n,onCancel:i}=e,[c,d]=(0,l.useState)(""),x=(0,l.useRef)(null),u=(0,l.useRef)(null),p=(0,l.useCallback)(()=>{if(!o.current)return{left:"50%",top:"50%"};let e=o.current.getBoundingClientRect();return{left:(t.x+a.x)*r+e.left,top:(t.y+a.y)*r+e.top}},[t,r,a,o])(),m=144*r,h=48*r;return(0,l.useEffect)(()=>{let e=e=>{u.current&&!u.current.contains(e.target)&&(c.trim()?n(c):i())};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[c,n,i]),(0,s.jsxs)("div",{ref:u,className:"fixed z-50",style:{left:"".concat(p.left,"px"),top:"".concat(p.top,"px"),transform:"translate(-50%, 0)"},children:[(0,s.jsx)("div",{style:{width:2,height:20*r,margin:"0 auto",backgroundColor:"var(--border-hover)"}}),(0,s.jsx)("div",{style:{width:"".concat(m,"px"),height:"".concat(h,"px"),border:"1.5px dashed var(--accent)",borderRadius:4*r,backgroundColor:"var(--bg-card)",display:"flex",alignItems:"center",justifyContent:"center",padding:"".concat(4*r,"px")},children:(0,s.jsx)("input",{ref:x,autoFocus:!0,value:c,onChange:e=>d(e.target.value),onKeyDown:e=>{"Enter"===e.key&&c.trim()&&n(c),"Escape"===e.key&&i(),e.stopPropagation()},onBlur:()=>{c.trim()?n(c):i()},placeholder:"Name node...",className:"w-full h-full bg-transparent outline-none text-center text-xs",style:{color:"var(--text-primary)",fontFamily:"inherit"}})})]})}function b(e){return(0,s.jsxs)("div",{className:"flex flex-col h-full",children:[(0,s.jsxs)("div",{className:"px-4 py-2 border-b flex items-center gap-2",style:{borderColor:"var(--border)"},children:[(0,s.jsx)("span",{className:"text-xs font-medium uppercase tracking-wider",style:{color:"var(--text-tertiary)"},children:"Flow Map"}),(0,s.jsxs)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:[e.nodes.length," node",1!==e.nodes.length?"s":""]}),(0,s.jsx)("div",{className:"flex-1"}),(0,s.jsx)("button",{onClick:e.onResetLayout,className:"px-2 py-1 text-[10px] rounded border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)",borderRadius:"var(--radius-sm)"},children:"Reset layout"})]}),(0,s.jsx)("div",{className:"flex-1 min-h-0",children:(0,s.jsx)(m,{nodes:e.nodes,edges:e.edges,testCases:e.testCases,selectedNodeId:e.selectedNodeId,onSelect:e.onSelect,onAddNode:e.onAddNode,onDeleteNode:e.onDeleteNode,onDeleteNodes:e.onDeleteNodes,onUnlinkNode:e.onUnlinkNode,onRenameNode:e.onRenameNode,onUpdateNode:e.onUpdateNode,onAddEdge:e.onAddEdge,onDeleteEdge:e.onDeleteEdge,onUpdateEdge:e.onUpdateEdge,canUndo:e.canUndo,canRedo:e.canRedo,onUndo:e.onUndo,onRedo:e.onRedo})})]})}p.displayName="RippleButton";var v=r(8566),y=r(5815);function g(e){let{value:t,className:r=""}=e,a=Math.max(0,Math.min(100,t));return(0,s.jsx)("div",{className:"h-2 w-full overflow-hidden ".concat(r),style:{backgroundColor:"var(--bg-secondary)",borderRadius:"var(--radius-pill)"},children:(0,s.jsx)("div",{className:"h-full transition-all duration-150 ease-out",style:{width:"".concat(a,"%"),backgroundColor:a>=80?"var(--status-pass-text)":a>=50?"var(--status-skip-text)":"var(--status-fail-text)",borderRadius:"var(--radius-pill)"}})})}function j(e){let{onAdd:t,nodeLabel:r}=e,[a,o]=(0,l.useState)(""),n=(0,l.useRef)(null);(0,l.useEffect)(()=>{var e;null==(e=n.current)||e.focus()},[r]);let i=()=>{a.trim()&&(t(a.trim()),o(""))};return(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("input",{ref:n,value:a,onChange:e=>o(e.target.value),onKeyDown:e=>{"Enter"===e.key&&i()},placeholder:'Add test case for "'.concat(r,'"...'),className:"flex-1 px-3 py-2 text-sm bg-transparent outline-none border transition-colors focus:border-[var(--border-hover)]",style:{borderColor:"var(--border)",borderRadius:"var(--radius-sm)",color:"var(--text-primary)"}}),(0,s.jsx)("button",{onClick:i,disabled:!a.trim(),className:"px-4 py-2 text-sm font-medium rounded-md transition-opacity hover:opacity-80 disabled:opacity-30",style:{backgroundColor:"var(--accent)",color:"var(--bg-primary)",borderRadius:"var(--radius-sm)"},children:"+ Add"})]})}let k={untested:{bg:"var(--status-untested-bg)",text:"var(--status-untested-text)",label:"Untested"},pass:{bg:"var(--status-pass-bg)",text:"var(--status-pass-text)",label:"Pass"},fail:{bg:"var(--status-fail-bg)",text:"var(--status-fail-text)",label:"Fail"},skip:{bg:"var(--status-skip-bg)",text:"var(--status-skip-text)",label:"Skip"}},w=["untested","pass","fail","skip"];function C(e){let{status:t,onChange:r}=e,a=k[t];return(0,s.jsx)("select",{value:t,onChange:e=>r(e.target.value),className:"text-[11px] font-medium px-2 py-0.5 rounded-full border-0 outline-none cursor-pointer appearance-none",style:{backgroundColor:a.bg,color:a.text,borderRadius:"var(--radius-pill)",minWidth:72},children:w.map(e=>(0,s.jsx)("option",{value:e,children:k[e].label},e))})}function N(e){let{tc:t,visibleCols:r,expandAll:a,selected:o,onToggleSelect:n,onUpdate:i,onDelete:c,onDragStart:d,onDragOver:x,onDrop:u}=e,[p,m]=(0,l.useState)(null),[h,f]=(0,l.useState)(""),[b,v]=(0,l.useState)(!1),[y,g]=(0,l.useState)(null),j=(0,l.useRef)(null);(0,l.useEffect)(()=>{p&&j.current&&j.current.focus()},[p]);let k=e=>{var r;f(null!=(r=t[e])?r:""),m(e)},w=()=>{p&&(i({[p]:h}),m(null))},N=e=>{i({status:e})},S=e=>{if("Enter"===e.key&&"steps"!==p&&w(),"Escape"===e.key&&(m(null),f("")),"Tab"===e.key){e.preventDefault(),w();let t=r.filter(e=>"status"!==e.key&&"code"!==e.key).map(e=>e.key),s=t.indexOf(p),a=e.shiftKey?t[s-1]:t[s+1];a&&k(a)}},D=e=>{let r=t[e];return r&&r.length>40};return(0,s.jsx)(s.Fragment,{children:(0,s.jsxs)("tr",{className:"group transition-colors",style:{backgroundColor:b?"var(--bg-secondary)":"transparent"},onMouseEnter:()=>v(!0),onMouseLeave:()=>v(!1),draggable:!0,onDragStart:d,onDragOver:x,onDrop:u,children:[(0,s.jsx)("td",{className:"px-2 py-1.5 border-b",style:{borderColor:"var(--border)",width:28},children:(0,s.jsx)("input",{type:"checkbox",checked:o,onChange:n,className:"cursor-pointer accent-[var(--accent)]",style:{width:14,height:14}})}),r.map(e=>(0,s.jsx)("td",{className:"px-2 py-1.5 text-xs border-b",style:{borderColor:"var(--border)",color:"var(--text-primary)",maxWidth:"steps"===e.key||"expected"===e.key?300:void 0},children:"status"===e.key?(0,s.jsx)(C,{status:t.status,onChange:N}):"code"===e.key?(0,s.jsx)("span",{className:"font-mono text-[10px]",style:{color:"var(--text-tertiary)"},children:t.code||"—"}):"case_type"===e.key?(0,s.jsx)(L,{value:t.case_type||"General",onChange:e=>i({case_type:e})}):p===e.key?"steps"===e.key?(0,s.jsx)("textarea",{ref:j,value:h,onChange:e=>f(e.target.value),onBlur:w,onKeyDown:S,className:"w-full bg-transparent outline-none border rounded p-1 text-xs resize-none",style:{borderColor:"var(--accent)",color:"var(--text-primary)",minHeight:60},rows:3}):(0,s.jsx)("input",{ref:j,value:h,onChange:e=>f(e.target.value),onBlur:w,onKeyDown:S,className:"w-full bg-transparent outline-none border-b text-xs",style:{borderColor:"var(--accent)",color:"var(--text-primary)"}}):"links"===e.key?(0,s.jsx)("div",{className:"flex items-center gap-1",children:t.links?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("a",{href:t.links,target:"_blank",rel:"noopener noreferrer",className:"text-[11px] underline hover:opacity-80 transition-opacity",style:{color:"var(--accent)"},onClick:e=>e.stopPropagation(),children:"Open Link"}),(0,s.jsx)("button",{onClick:e=>{e.stopPropagation(),i({links:""})},className:"text-[10px] opacity-0 group-hover:opacity-100 hover:opacity-100 transition-opacity px-0.5",style:{color:"var(--status-fail-text)"},title:"Clear link",children:"\xd7"})]}):(0,s.jsx)("span",{className:"cursor-text block text-[11px]",onClick:()=>k(e.key),style:{color:"var(--text-tertiary)"},children:"Add link..."})}):(0,s.jsx)("span",{className:"cursor-text block",onClick:()=>{D(e.key)&&(y===e.key?g(null):g(e.key))},onDoubleClick:()=>k(e.key),title:D(e.key)?y===e.key||a?"Click to collapse \xb7 Double-click to edit":"Click to expand \xb7 Double-click to edit":"Double-click to edit",style:{overflow:"hidden",textOverflow:"ellipsis",whiteSpace:y===e.key||a&&D(e.key)?"pre-wrap":"nowrap",display:"block",maxHeight:y===e.key||a&&D(e.key)?"none":"1.2em",lineHeight:"1.2em"},children:t[e.key]||(0,s.jsx)("span",{style:{color:"var(--text-tertiary)"},children:"—"})})},e.key)),(0,s.jsx)("td",{className:"px-1 py-1.5 border-b",style:{borderColor:"var(--border)"},children:b&&(0,s.jsx)("button",{onClick:c,className:"text-[10px] opacity-50 hover:opacity-100 transition-opacity px-0.5",style:{color:"var(--status-fail-text)"},children:"\xd7"})})]})})}let S={Positive:{bg:"var(--status-pass-bg)",text:"var(--status-pass-text)"},Negative:{bg:"var(--status-fail-bg)",text:"var(--status-fail-text)"},General:{bg:"var(--bg-secondary)",text:"var(--text-tertiary)"}};function L(e){let{value:t,onChange:r}=e,a=S[t]||S.General;return(0,s.jsx)("select",{value:t,onChange:e=>r(e.target.value),className:"text-[10px] font-medium px-2 py-0.5 rounded-full border-0 outline-none cursor-pointer",style:{backgroundColor:a.bg,color:a.text},children:v.D_.map(e=>(0,s.jsx)("option",{value:e,children:e},e))})}function D(e){let{testCases:t,columns:r,expandAll:a,selectedIds:o,onToggleSelect:l,onToggleSelectAll:n,sortKey:i,sortDirection:c,onSortChange:d,onUpdate:x,onDelete:u,onReorder:p}=e,m=r.filter(e=>e.visible),h=t.length>0&&t.every(e=>o.has(e.id)),f=t.some(e=>o.has(e.id)),b=e=>{e.preventDefault(),e.dataTransfer.dropEffect="move"};return 0===t.length?null:(0,s.jsx)("div",{className:"overflow-x-auto",style:{minWidth:0},children:(0,s.jsxs)("table",{className:"text-xs",style:{minWidth:"900px",width:"100%"},children:[(0,s.jsx)("thead",{className:"sticky top-0 z-10",style:{backgroundColor:"var(--bg-primary)"},children:(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{className:"px-2 py-1.5 border-b",style:{borderColor:"var(--border)",width:28},children:(0,s.jsx)("input",{type:"checkbox",checked:h,ref:e=>{e&&(e.indeterminate=f&&!h)},onChange:n,className:"cursor-pointer accent-[var(--accent)]",style:{width:14,height:14}})}),m.map(e=>(0,s.jsx)("th",{className:"px-2 py-1.5 text-left text-[10px] font-medium uppercase tracking-wider border-b cursor-pointer select-none hover:bg-[var(--bg-secondary)] transition-colors",style:{color:"var(--text-tertiary)",borderColor:"var(--border)",whiteSpace:"nowrap"},onClick:()=>d(e.key),children:(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("span",{children:e.label}),i===e.key&&(0,s.jsx)("span",{className:"text-[8px]",children:"asc"===c?"↑":"↓"})]})},e.key)),(0,s.jsx)("th",{className:"w-6 border-b",style:{borderColor:"var(--border)"}})]})}),(0,s.jsx)("tbody",{children:t.map(e=>(0,s.jsx)(N,{tc:e,visibleCols:m,expandAll:a,selected:o.has(e.id),onToggleSelect:()=>l(e.id),onUpdate:t=>x(e.id,t),onDelete:()=>u(e.id),onDragStart:t=>{var r;return r=e.id,void(t.dataTransfer.setData("text/plain",r),t.dataTransfer.effectAllowed="move")},onDragOver:b,onDrop:r=>((e,r)=>{e.preventDefault();let s=e.dataTransfer.getData("text/plain");if(s===r)return;let a=t.map(e=>e.id),o=a.indexOf(s),l=a.indexOf(r);if(-1===o||-1===l)return;let n=[...a];n.splice(o,1),n.splice(l,0,s),p(n)})(r,e.id)},e.id))})]})})}function E(e){let{stats:t}=e;return(0,s.jsxs)("div",{className:"flex items-center gap-4 px-4 py-2 text-xs border-t flex-wrap",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:[(0,s.jsxs)("span",{children:["Total: ",(0,s.jsx)("strong",{style:{color:"var(--text-primary)"},children:t.total})]}),(0,s.jsxs)("span",{children:["Pass: ",(0,s.jsx)("strong",{style:{color:"var(--status-pass-text)"},children:t.pass}),t.total>0&&" (".concat(t.passRate,"%)")]}),(0,s.jsxs)("span",{children:["Fail: ",(0,s.jsx)("strong",{style:{color:"var(--status-fail-text)"},children:t.fail})]}),(0,s.jsxs)("span",{children:["Skip: ",(0,s.jsx)("strong",{style:{color:"var(--status-skip-text)"},children:t.skip})]}),(0,s.jsxs)("span",{children:["Untested: ",(0,s.jsx)("strong",{style:{color:"var(--status-untested-text)"},children:t.untested})]})]})}var M=r(158);function R(e){let{open:t,onClose:r,node:a,testCases:o,columns:l}=e,n=l&&l.length>0?l:v._X;return t?(0,s.jsx)("div",{className:"fixed inset-0 z-[300] flex items-center justify-center",style:{backgroundColor:"rgba(0,0,0,0.3)",animation:"fadeIn 150ms ease-out"},onClick:r,children:(0,s.jsxs)("div",{className:"w-full max-w-sm mx-4 rounded-xl p-5",style:{backgroundColor:"var(--bg-card)",boxShadow:"var(--shadow-lg)",borderRadius:"var(--radius-lg)"},onClick:e=>e.stopPropagation(),children:[(0,s.jsx)("h3",{className:"text-sm font-semibold mb-1",style:{color:"var(--text-primary)"},children:"Export Test Cases"}),(0,s.jsxs)("p",{className:"text-xs mb-4",style:{color:"var(--text-tertiary)"},children:["Export “",a.label,"” (",o.length," case",1!==o.length?"s":"",")"]}),(0,s.jsxs)("div",{className:"flex flex-col gap-2",children:[(0,s.jsxs)("button",{onClick:()=>{(0,M.k5)(a,o,n),r()},className:"w-full text-left px-4 py-3 text-sm rounded-lg border transition-colors hover:border-[var(--border-hover)]",style:{borderColor:"var(--border)",borderRadius:"var(--radius-sm)"},children:[(0,s.jsx)("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:"Markdown (.md)"}),(0,s.jsx)("br",{}),(0,s.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Formatted table for documentation"})]}),(0,s.jsxs)("button",{onClick:()=>{(0,M.hX)(a,o),r()},className:"w-full text-left px-4 py-3 text-sm rounded-lg border transition-colors hover:border-[var(--border-hover)]",style:{borderColor:"var(--border)",borderRadius:"var(--radius-sm)"},children:[(0,s.jsx)("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:"JSON (.json)"}),(0,s.jsx)("br",{}),(0,s.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Structured data backup"})]}),(0,s.jsxs)("button",{onClick:()=>{(0,M.Rz)(a,o,n),r()},className:"w-full text-left px-4 py-3 text-sm rounded-lg border transition-colors hover:border-[var(--border-hover)]",style:{borderColor:"var(--border)",borderRadius:"var(--radius-sm)"},children:[(0,s.jsx)("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:"CSV (.csv)"}),(0,s.jsx)("br",{}),(0,s.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Spreadsheet-compatible format"})]}),(0,s.jsxs)("button",{onClick:async()=>{await (0,M.G$)(a,o,n),r()},className:"w-full text-left px-4 py-3 text-sm rounded-lg border transition-colors hover:border-[var(--border-hover)]",style:{borderColor:"var(--border)",borderRadius:"var(--radius-sm)"},children:[(0,s.jsx)("span",{className:"font-medium",style:{color:"var(--text-primary)"},children:"Excel (.xlsx)"}),(0,s.jsx)("br",{}),(0,s.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Styled spreadsheet for reporting"})]})]}),(0,s.jsx)("button",{onClick:r,className:"w-full mt-3 px-3 py-2 text-xs font-medium rounded-lg border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:"Cancel"})]})}):null}var A=r(5653);async function I(e,t,r){let s=arguments.length>3&&void 0!==arguments[3]?arguments[3]:"google",a=arguments.length>4&&void 0!==arguments[4]?arguments[4]:"",o=arguments.length>5&&void 0!==arguments[5]?arguments[5]:"en",l=arguments.length>6?arguments[6]:void 0,n=arguments.length>7?arguments[7]:void 0,i=await fetch("/api/generate",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({title:e,prompt:t,apiKey:r,provider:s,model:a,language:o,baseURL:l,images:n})});if(!i.ok)throw Error((await i.json().catch(()=>({error:"Request failed"}))).error||"HTTP ".concat(i.status));return(await i.json()).testCases}A.Ik({title:A.Yj().describe("Short descriptive title of the test case"),steps:A.Yj().describe("Numbered test steps separated by newlines"),expected:A.Yj().describe("Expected result of the test")});var U=r(7669);async function P(e){var t;let r=URL.createObjectURL(e),s=document.createElement("video");s.muted=!0,s.preload="auto",s.crossOrigin="anonymous",await new Promise((e,t)=>{s.onloadedmetadata=()=>e(),s.onerror=()=>t(Error("Failed to load video")),s.src=r}),await s.play().catch(()=>{}),s.pause();let a=s.duration;if(!isFinite(a)||a<=0)throw URL.revokeObjectURL(r),Error("Could not determine video duration");let o=Math.min(a<=10?4:8,Math.ceil(a)),l=[];for(let e=0;e<o;e++){let t=.1+e/o*(a-.2);l.push(Math.min(t,a-.05))}let n=document.createElement("canvas"),i=n.getContext("2d"),c=[];for(let e of l){await function(e,t){return new Promise(r=>{let s=()=>{e.removeEventListener("seeked",s),requestAnimationFrame(()=>r())};e.addEventListener("seeked",s),e.currentTime=t})}(s,e);let t=function(e,t,r){let{videoWidth:s,videoHeight:a}=e,o=s>1280?1280/s:1;return t.width=Math.round(s*o),t.height=Math.round(a*o),r.drawImage(e,0,0,t.width,t.height),t.toDataURL("image/jpeg",.82)}(s,n,i);c.push(t)}return URL.revokeObjectURL(r),{frames:c,duration:a,thumbnail:null!=(t=c[0])?t:""}}let z=["User can log in with valid credentials","Invalid input shows validation error","Form submits successfully and redirects","Edge case: empty required fields"],T=["While you wait... have this cute cat!","Hang tight! Here's a furry friend.","Generating... enjoy this kitty!","Almost there! Cat says hi.","Test cases incoming... meow!"];function W(e){let{open:t,onClose:r,node:a,onGenerate:o}=e,{isConnected:n,activeProvider:i,activeProviderId:c}=(0,U.P)(),[d,x]=(0,l.useState)(""),[u,p]=(0,l.useState)(""),[m,h]=(0,l.useState)("en"),[f,b]=(0,l.useState)(!1),[v,y]=(0,l.useState)(!1),[g,j]=(0,l.useState)(null),[k,w]=(0,l.useState)([]),[C,N]=(0,l.useState)(""),[S,L]=(0,l.useState)(T[0]),[D,E]=(0,l.useState)(0),M=(0,l.useRef)(null),R=(0,l.useRef)(null),A=(0,l.useRef)(null),[W,F]=(0,l.useState)(!1),[B,O]=(0,l.useState)(!1),[X,G]=(0,l.useState)(null),[H,_]=(0,l.useState)([]),[K,Y]=(0,l.useState)(new Set),[q,V]=(0,l.useState)(!1),[J,Z]=(0,l.useState)(null),$=(0,l.useCallback)(async()=>{try{var e;let t=await fetch("https://api.thecatapi.com/v1/images/search?size=med"),r=await t.json();(null==r||null==(e=r[0])?void 0:e.url)&&N(r[0].url)}catch(e){N("")}L(T[Math.floor(Math.random()*T.length)])},[]);(0,l.useEffect)(()=>{t&&(x(a.label),p(""),j(null),y(!1),w([]),_([]),Y(new Set),V(!1),N(""),E(0))},[t,a.label]),(0,l.useEffect)(()=>{if(!v)return;$();let e=setInterval(()=>{E(e=>e+1),$()},2e3);return()=>clearInterval(e)},[v,$]);let Q=e=>new Promise((t,r)=>{if(!e.type.startsWith("image/"))return void r(Error("Not an image file"));if(e.size>5242880)return void r(Error("Image too large (max ".concat(5,"MB)")));let s=new FileReader;s.onload=()=>t(s.result),s.onerror=()=>r(Error("Failed to read file")),s.readAsDataURL(e)}),ee=(0,l.useCallback)(async e=>{if(!e.type.startsWith("video/"))return void j("Not a video file");if(e.size>0x3200000)return void j("Video too large (max ".concat(50,"MB)"));O(!0),G("Loading video...");try{let t=await P(e);if(t.duration>120){j("Video too long (".concat(Math.round(t.duration),"s). Max ").concat(120,"s.")),O(!1),G(null);return}G("Extracted ".concat(t.frames.length," frames. Select which to include...")),_(t.frames),Y(new Set(t.frames.map((e,t)=>t))),V(!0),j(null)}catch(e){j(e instanceof Error?e.message:"Failed to process video")}finally{O(!1),G(null)}},[]),et=(0,l.useCallback)(()=>{let e=5-k.length,t=H.filter((e,t)=>K.has(t)).slice(0,e);t.length>0&&w(e=>[...e,...t]),_([]),Y(new Set),V(!1)},[H,K,k.length]),er=(0,l.useCallback)(()=>{_([]),Y(new Set),V(!1)},[]),es=(0,l.useCallback)(e=>{Y(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.size<5&&r.add(e),r})},[]),ea=(0,l.useCallback)(()=>{Y(new Set(Array.from({length:Math.min(H.length,5)},(e,t)=>t)))},[H]),eo=(0,l.useCallback)(()=>{Y(new Set)},[]),el=(0,l.useCallback)(async e=>{let t=5-k.length;if(t<=0)return void j("Maximum ".concat(5," images/frames allowed"));let r=Array.from(e),s=r.filter(e=>e.type.startsWith("image/")),a=r.filter(e=>e.type.startsWith("video/")),o=s.slice(0,t),l=[];for(let e of o)try{let t=await Q(e);l.push(t)}catch(e){j(e instanceof Error?e.message:"Failed to load image")}l.length>0&&(w(e=>[...e,...l]),j(null)),a.length>0&&await ee(a[0])},[k.length,ee]),en=(0,l.useCallback)(e=>{w(t=>t.filter((t,r)=>r!==e))},[]);(0,l.useEffect)(()=>{if(!t)return;let e=e=>{var t;let r=null==(t=e.clipboardData)?void 0:t.items;if(!r)return;let s=[];for(let e of Array.from(r))if(e.type.startsWith("image/")){let t=e.getAsFile();t&&s.push(t)}s.length>0&&(e.preventDefault(),el(s))};return document.addEventListener("paste",e),()=>document.removeEventListener("paste",e)},[t,el]);let ei=(0,l.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),F(!0)},[]),ec=(0,l.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),F(!1)},[]),ed=(0,l.useCallback)(e=>{e.preventDefault(),e.stopPropagation(),F(!1),e.dataTransfer.files.length>0&&el(e.dataTransfer.files)},[el]);(0,l.useCallback)(async e=>{await ee(e)},[ee]);let ex=(0,l.useCallback)(e=>{e.target.files&&e.target.files.length>0&&(el(e.target.files),e.target.value="")},[el]),eu=async()=>{if(!n)return void j("Please configure an AI provider in Integrations first.");if(!u.trim()&&0===k.length)return void j("Please describe the feature, paste a ticket, or attach an image.");y(!0),j(null);try{let e=await I(d,u,i.apiKey,null!=c?c:void 0,i.defaultModel,m,i.baseURL||void 0,k.length>0?k:void 0);o(e),r()}catch(e){j(e instanceof Error?e.message:"Generation failed")}finally{y(!1)}};return t?(0,s.jsxs)("div",{className:"fixed inset-0 z-[300] flex items-center justify-center",style:{backgroundColor:"rgba(0,0,0,0.3)",animation:"fadeIn 150ms ease-out"},onClick:r,children:[(0,s.jsxs)("div",{className:"flex rounded-xl overflow-hidden",style:{maxWidth:v?"720px":"512px",width:"100%",margin:"0 16px",backgroundColor:"var(--bg-card)",boxShadow:"var(--shadow-lg)",transition:"max-width 400ms cubic-bezier(0.4, 0, 0.2, 1)"},onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)("div",{className:"flex-1 min-w-0",style:{maxWidth:"512px"},children:[(0,s.jsxs)("div",{className:"px-5 pt-5 pb-4 border-b",style:{borderColor:"var(--border)"},children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 mb-1",children:[(0,s.jsx)("div",{className:"w-6 h-6 rounded-md flex items-center justify-center",style:{background:"linear-gradient(135deg, #8D6E63, #A1887F)"},children:(0,s.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"white",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:(0,s.jsx)("polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2"})})}),(0,s.jsx)("h3",{className:"text-sm font-semibold",style:{color:"var(--text-primary)"},children:"Generate Test Cases"})]}),(0,s.jsxs)("p",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:["Describe the feature and let AI generate test cases for “",a.label,"”"]})]}),(0,s.jsxs)("div",{className:"px-5 py-4 space-y-4",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-xs font-medium block mb-1.5",style:{color:"var(--text-secondary)"},children:"Test Case Title"}),(0,s.jsx)("input",{value:d,onChange:e=>x(e.target.value),className:"w-full px-3 py-2 text-sm rounded-lg outline-none border transition-colors focus:border-[var(--accent)]",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-card)",color:"var(--text-primary)"},placeholder:"Feature name..."})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-xs font-medium block mb-1.5",style:{color:"var(--text-secondary)"},children:"Description / DoD / Ticket"}),(0,s.jsx)("textarea",{value:u,onChange:e=>p(e.target.value),rows:4,className:"w-full px-3 py-2 text-sm rounded-lg outline-none border resize-none transition-colors focus:border-[var(--accent)]",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-card)",color:"var(--text-primary)"},placeholder:"id"===m?"Jelaskan fitur, kriteria penerimaan, atau tempel tiket...":"Describe the feature, acceptance criteria, or paste a ticket..."}),(0,s.jsx)("div",{className:"flex flex-wrap gap-1.5 mt-2",children:z.map(e=>(0,s.jsxs)("button",{onClick:()=>p(t=>t?"".concat(t,"\n").concat(e):e),className:"px-2 py-0.5 text-[10px] rounded-full border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},children:["+ ",e]},e))})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("label",{className:"text-xs font-medium block mb-1.5",style:{color:"var(--text-secondary)"},children:["Screenshots & Videos ",(0,s.jsx)("span",{className:"font-normal",style:{color:"var(--text-tertiary)"},children:"(optional)"})]}),k.length>0&&(0,s.jsx)("div",{className:"flex flex-wrap gap-2 mb-2",children:k.map((e,t)=>(0,s.jsxs)("div",{className:"relative group rounded-lg overflow-hidden border",style:{borderColor:"var(--border)",width:72,height:72},children:[(0,s.jsx)("img",{src:e,alt:"Screenshot ".concat(t+1),className:"w-full h-full object-cover"}),(0,s.jsx)("button",{onClick:()=>en(t),className:"absolute top-0.5 right-0.5 w-5 h-5 rounded-full flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",style:{backgroundColor:"rgba(0,0,0,0.7)",color:"#fff"},title:"Remove",children:(0,s.jsxs)("svg",{width:"10",height:"10",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,s.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]},t))}),(0,s.jsx)("div",{ref:A,onDragOver:ei,onDragLeave:ec,onDrop:ed,onClick:()=>{var e;return null==(e=M.current)?void 0:e.click()},className:"rounded-lg border-2 border-dashed cursor-pointer transition-colors",style:{borderColor:W?"var(--accent)":"var(--border)",backgroundColor:W?"var(--accent)08":"transparent",padding:k.length>0?"8px":"16px"},children:(0,s.jsxs)("div",{className:"flex items-center justify-center gap-2",children:[(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("rect",{x:"3",y:"3",width:"18",height:"18",rx:"2",ry:"2"}),(0,s.jsx)("circle",{cx:"8.5",cy:"8.5",r:"1.5"}),(0,s.jsx)("polyline",{points:"21 15 16 10 5 21"})]}),(0,s.jsx)("span",{className:"text-[11px]",style:{color:"var(--text-tertiary)"},children:k.length>0?"Add more (".concat(k.length,"/").concat(5,") \xb7 paste, drop, or click"):"Paste from clipboard, drop, or click to upload"})]})}),!q&&k.length<5&&(0,s.jsx)("div",{className:"mt-2",children:B?(0,s.jsxs)("div",{className:"flex items-center gap-2 px-3 py-2 rounded-lg",style:{backgroundColor:"var(--bg-secondary)"},children:[(0,s.jsx)("svg",{className:"animate-spin",width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",children:(0,s.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeDasharray:"30 70"})}),(0,s.jsx)("span",{className:"text-[11px]",style:{color:"var(--text-secondary)"},children:X})]}):(0,s.jsxs)("button",{type:"button",onClick:e=>{var t;e.stopPropagation(),null==(t=R.current)||t.click()},className:"flex items-center gap-2 px-3 py-1.5 text-[11px] rounded-lg border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},children:[(0,s.jsxs)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("polygon",{points:"23 7 16 12 23 17 23 7"}),(0,s.jsx)("rect",{x:"1",y:"5",width:"15",height:"14",rx:"2",ry:"2"})]}),"Upload video (extract key frames)"]})}),q&&H.length>0&&(0,s.jsxs)("div",{className:"mt-2 p-3 rounded-lg border",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsxs)("span",{className:"text-[11px] font-medium",style:{color:"var(--text-secondary)"},children:["Select frames ",(0,s.jsxs)("span",{style:{color:"var(--text-tertiary)"},children:["(",K.size,"/",5," max)"]})]}),(0,s.jsxs)("div",{className:"flex gap-1",children:[(0,s.jsx)("button",{type:"button",onClick:ea,className:"text-[10px] px-1.5 py-0.5 rounded hover:bg-[var(--bg-card)]",style:{color:"var(--text-tertiary)"},children:"All"}),(0,s.jsx)("button",{type:"button",onClick:eo,className:"text-[10px] px-1.5 py-0.5 rounded hover:bg-[var(--bg-card)]",style:{color:"var(--text-tertiary)"},children:"None"})]})]}),(0,s.jsx)("div",{className:"flex flex-wrap gap-2 mb-3",children:H.map((e,t)=>(0,s.jsxs)("div",{className:"relative group rounded-md overflow-hidden border-2 transition-all cursor-pointer",style:{width:80,height:80,borderColor:K.has(t)?"var(--accent)":"var(--border)",opacity:K.has(t)?1:.5},children:[(0,s.jsx)("button",{type:"button",onClick:()=>es(t),className:"w-full h-full",children:(0,s.jsx)("img",{src:e,alt:"Frame ".concat(t+1),className:"w-full h-full object-cover"})}),(0,s.jsx)("button",{type:"button",onClick:t=>{t.stopPropagation(),Z(e)},className:"absolute top-0.5 left-0.5 w-6 h-6 rounded flex items-center justify-center opacity-0 group-hover:opacity-100 transition-opacity",style:{backgroundColor:"rgba(0,0,0,0.7)",color:"#fff"},title:"Zoom",children:(0,s.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,s.jsx)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"}),(0,s.jsx)("line",{x1:"11",y1:"8",x2:"11",y2:"14"}),(0,s.jsx)("line",{x1:"8",y1:"11",x2:"14",y2:"11"})]})}),K.has(t)&&(0,s.jsx)("div",{className:"absolute top-0.5 right-0.5 w-5 h-5 rounded-full flex items-center justify-center",style:{backgroundColor:"var(--accent)",color:"#fff"},children:(0,s.jsx)("svg",{width:"11",height:"11",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"3",strokeLinecap:"round",strokeLinejoin:"round",children:(0,s.jsx)("polyline",{points:"20 6 9 17 4 12"})})}),(0,s.jsx)("span",{className:"absolute bottom-0 left-0 right-0 text-center text-[9px] py-0.5",style:{backgroundColor:"rgba(0,0,0,0.6)",color:"#fff"},children:t+1})]},t))}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("button",{type:"button",onClick:er,className:"flex-1 px-3 py-1.5 text-[11px] rounded-md border transition-colors hover:bg-[var(--bg-card)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:"Cancel"}),(0,s.jsxs)("button",{type:"button",onClick:et,disabled:0===K.size,className:"flex-1 px-3 py-1.5 text-[11px] rounded-md transition-colors hover:opacity-90 disabled:opacity-40 disabled:cursor-not-allowed",style:{backgroundColor:"var(--accent)",color:"#fff"},children:["Add ",K.size," frame",1!==K.size?"s":""]})]})]}),(0,s.jsx)("input",{ref:M,type:"file",accept:"image/*",multiple:!0,className:"hidden",onChange:ex}),(0,s.jsx)("input",{ref:R,type:"file",accept:"video/*",className:"hidden",onChange:async e=>{var t;let r=null==(t=e.target.files)?void 0:t[0];r&&(await ee(r),e.target.value="")}})]}),g&&(0,s.jsx)("div",{className:"text-xs px-3 py-2 rounded-lg",style:{backgroundColor:"var(--status-fail-bg)",color:"var(--status-fail-text)"},children:g}),!n&&(0,s.jsx)("div",{className:"text-xs px-3 py-2 rounded-lg",style:{backgroundColor:"var(--status-skip-bg)",color:"var(--status-skip-text)"},children:"No AI provider configured. Go to Integrations to set up."}),(0,s.jsxs)("div",{className:"rounded-lg border overflow-hidden",style:{borderColor:"var(--border)"},children:[(0,s.jsxs)("button",{onClick:()=>b(e=>!e),className:"w-full flex items-center justify-between px-3 py-2 transition-colors hover:bg-[var(--bg-secondary)]",children:[(0,s.jsx)("span",{className:"text-xs font-medium",style:{color:"var(--text-secondary)"},children:"Language"}),(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("span",{className:"text-[10px] font-mono font-semibold px-1.5 py-0.5 rounded",style:{backgroundColor:"var(--bg-secondary)",color:"var(--text-tertiary)"},children:"en"===m?"EN":"ID"}),(0,s.jsx)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",style:{transform:f?"rotate(180deg)":"rotate(0deg)",transition:"transform 200ms ease-out"},children:(0,s.jsx)("polyline",{points:"6 9 12 15 18 9"})})]})]}),(0,s.jsx)("div",{style:{maxHeight:f?"80px":"0px",overflow:"hidden",transition:"max-height 200ms ease-out"},children:(0,s.jsx)("div",{className:"px-3 pb-2 pt-1",children:(0,s.jsxs)("select",{value:m,onChange:e=>{h(e.target.value),b(!1)},className:"w-full px-2.5 py-1.5 text-xs rounded-md border outline-none transition-colors cursor-pointer",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-card)",color:"var(--text-primary)"},children:[(0,s.jsx)("option",{value:"en",children:"English"}),(0,s.jsx)("option",{value:"id",children:"Bahasa Indonesia"})]})})})]})]}),(0,s.jsxs)("div",{className:"px-5 py-4 border-t flex gap-2",style:{borderColor:"var(--border)"},children:[(0,s.jsx)("button",{onClick:r,className:"flex-1 px-3 py-2.5 text-xs font-medium rounded-lg border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:"Cancel"}),(0,s.jsx)("button",{onClick:eu,disabled:v||!n,className:"flex-1 px-3 py-2.5 text-xs font-medium rounded-lg transition-all hover:opacity-90 active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed",style:{background:"linear-gradient(135deg, #8D6E63, #A1887F)",color:"#fff",boxShadow:"0 2px 8px rgba(141,110,99,0.3)"},children:v?(0,s.jsxs)("span",{className:"flex items-center justify-center gap-2",children:[(0,s.jsx)("svg",{className:"animate-spin",width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:(0,s.jsx)("circle",{cx:"12",cy:"12",r:"10",strokeDasharray:"30 70"})}),"Generating..."]}):"Generate Test Cases"})]})]}),(0,s.jsx)("div",{className:"flex-shrink-0 overflow-hidden",style:{width:v?"280px":"0px",transition:"width 400ms cubic-bezier(0.4, 0, 0.2, 1)"},children:(0,s.jsxs)("div",{className:"w-[280px] h-full flex flex-col items-center justify-center p-5 border-l",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)",opacity:+!!v,transition:"opacity 300ms ease-out 100ms"},children:[(0,s.jsx)("div",{className:"w-full rounded-xl overflow-hidden mb-4 border",style:{borderColor:"var(--border)",height:180,backgroundColor:"var(--bg-card)"},children:C&&(0,s.jsx)("img",{src:C,alt:"Cute cat",width:280,height:180,className:"w-full h-full object-cover",style:{animation:"fadeIn 800ms ease-out"},onError:e=>{e.target.style.display="none"}},D)}),(0,s.jsx)("p",{className:"text-xs text-center mb-3",style:{color:"var(--text-secondary)",animation:"fadeIn 800ms ease-out"},children:S}),(0,s.jsx)("button",{onClick:$,className:"px-3 py-1.5 text-[10px] rounded-full border transition-colors hover:bg-[var(--bg-card)]",style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},children:"New cat"})]})})]}),J&&(0,s.jsx)("div",{className:"fixed inset-0 z-[400] flex items-center justify-center p-8",style:{backgroundColor:"rgba(0,0,0,0.85)",animation:"fadeIn 150ms ease-out"},onClick:e=>{e.stopPropagation(),Z(null)},children:(0,s.jsxs)("div",{className:"relative max-w-4xl max-h-full",onClick:e=>e.stopPropagation(),children:[(0,s.jsx)("img",{src:J,alt:"Frame preview",className:"max-w-full max-h-[80vh] object-contain rounded-lg",style:{boxShadow:"0 8px 32px rgba(0,0,0,0.5)"}}),(0,s.jsx)("button",{onClick:()=>Z(null),className:"absolute -top-2 -right-2 w-8 h-8 rounded-full flex items-center justify-center transition-colors hover:opacity-80",style:{backgroundColor:"var(--bg-card)",color:"var(--text-primary)",boxShadow:"var(--shadow-lg)"},children:(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("line",{x1:"18",y1:"6",x2:"6",y2:"18"}),(0,s.jsx)("line",{x1:"6",y1:"6",x2:"18",y2:"18"})]})})]})})]}):null}let F={pass:{bg:"var(--status-pass-bg)",text:"var(--status-pass-text)"},fail:{bg:"var(--status-fail-bg)",text:"var(--status-fail-text)"},skip:{bg:"var(--status-skip-bg)",text:"var(--status-skip-text)"},untested:{bg:"var(--status-untested-bg)",text:"var(--status-untested-text)"}};function B(e){let{open:t,onClose:r,node:a,testCases:l,stats:n}=e;return t?(0,s.jsxs)("div",{style:{backgroundColor:"rgba(0,0,0,0.3)",animation:"fadeIn 150ms ease-out"},onClick:r,className:"jsx-540c0278eef48442 fixed inset-0 z-[300] flex items-center justify-center",children:[(0,s.jsxs)("div",{style:{backgroundColor:"var(--bg-card)",boxShadow:"var(--shadow-lg)",borderRadius:"var(--radius-lg)",animation:"fadeInUp 200ms ease-out"},onClick:e=>e.stopPropagation(),className:"jsx-540c0278eef48442 w-full max-w-lg mx-4 rounded-xl overflow-hidden",children:[(0,s.jsxs)("div",{style:{borderColor:"var(--border)"},className:"jsx-540c0278eef48442 px-5 pt-5 pb-4 border-b",children:[(0,s.jsxs)("div",{className:"jsx-540c0278eef48442 flex items-center justify-between mb-2",children:[(0,s.jsxs)("div",{className:"jsx-540c0278eef48442 flex items-center gap-2",children:[a.code&&(0,s.jsx)("span",{style:{backgroundColor:"var(--bg-secondary)",color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 text-[10px] font-mono px-1.5 py-0.5 rounded",children:a.code}),(0,s.jsx)("h3",{style:{color:"var(--text-primary)"},className:"jsx-540c0278eef48442 text-sm font-semibold",children:a.label})]}),(0,s.jsx)("button",{onClick:r,style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 text-[10px] opacity-50 hover:opacity-100",children:"\xd7"})]}),a.notes&&(0,s.jsx)("p",{style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 text-xs",children:a.notes})]}),(0,s.jsxs)("div",{className:"jsx-540c0278eef48442 grid grid-cols-4 gap-3 p-5",children:[(0,s.jsx)(O,{label:"Total",value:n.total}),(0,s.jsx)(O,{label:"Pass",value:n.pass,color:"var(--status-pass-text)"}),(0,s.jsx)(O,{label:"Fail",value:n.fail,color:"var(--status-fail-text)"}),(0,s.jsx)(O,{label:"Untested",value:n.untested,color:"var(--status-untested-text)"})]}),(0,s.jsxs)("div",{className:"jsx-540c0278eef48442 px-5 pb-4",children:[(0,s.jsxs)("div",{style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 flex items-center justify-between text-[10px] mb-1.5",children:[(0,s.jsx)("span",{className:"jsx-540c0278eef48442",children:"Pass Rate"}),(0,s.jsxs)("span",{style:{color:n.passRate>=80?"var(--status-pass-text)":n.passRate>=50?"var(--status-skip-text)":"var(--status-fail-text)",fontWeight:600},className:"jsx-540c0278eef48442",children:[n.passRate,"%"]})]}),(0,s.jsx)("div",{style:{backgroundColor:"var(--bg-secondary)"},className:"jsx-540c0278eef48442 h-2 w-full rounded-full overflow-hidden",children:(0,s.jsx)("div",{style:{width:"".concat(n.passRate,"%"),backgroundColor:n.passRate>=80?"var(--status-pass-text)":n.passRate>=50?"var(--status-skip-text)":"var(--status-fail-text)"},className:"jsx-540c0278eef48442 h-full rounded-full transition-all duration-500"})})]}),l.length>0&&(0,s.jsxs)("div",{className:"jsx-540c0278eef48442 px-5 pb-4",children:[(0,s.jsx)("h4",{style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 text-[10px] font-semibold uppercase tracking-wider mb-2",children:"Test Cases"}),(0,s.jsx)("div",{className:"jsx-540c0278eef48442 space-y-1.5 max-h-48 overflow-y-auto",children:l.map(e=>{let t=F[e.status]||F.untested;return(0,s.jsxs)("div",{style:{borderColor:"var(--border)"},className:"jsx-540c0278eef48442 flex items-center gap-2 px-3 py-2 rounded-lg border",children:[(0,s.jsx)("span",{style:{backgroundColor:t.bg,color:t.text},className:"jsx-540c0278eef48442 text-[9px] font-mono px-1.5 py-0.5 rounded-full flex-shrink-0",children:e.status}),(0,s.jsx)("span",{style:{color:"var(--text-primary)"},className:"jsx-540c0278eef48442 text-[11px] flex-1 truncate",children:e.title}),e.code&&(0,s.jsx)("span",{style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 text-[9px] font-mono flex-shrink-0",children:e.code})]},e.id)})})]}),0===l.length&&(0,s.jsx)("div",{className:"jsx-540c0278eef48442 px-5 pb-5 text-center",children:(0,s.jsx)("p",{style:{color:"var(--text-tertiary)"},className:"jsx-540c0278eef48442 text-xs",children:"No test cases for this node yet."})}),(0,s.jsx)("div",{style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},className:"jsx-540c0278eef48442 px-5 py-3 border-t",children:(0,s.jsx)("button",{onClick:r,style:{borderColor:"var(--border)",color:"var(--text-secondary)"},className:"jsx-540c0278eef48442 w-full px-3 py-2 text-xs font-medium rounded-lg border transition-colors hover:bg-[var(--bg-card)]",children:"Close"})})]}),(0,s.jsx)(o(),{id:"540c0278eef48442",children:"@keyframes fadeIn{from{opacity:0}to{opacity:1}}@keyframes fadeInUp{from{opacity:0;transform:translatey(12px)}to{opacity:1;transform:translatey(0)}}"})]}):null}function O(e){let{label:t,value:r,color:a}=e;return(0,s.jsxs)("div",{className:"text-center p-2 rounded-lg border",style:{borderColor:"var(--border)"},children:[(0,s.jsx)("div",{className:"text-[10px] mb-0.5",style:{color:"var(--text-tertiary)"},children:t}),(0,s.jsx)("div",{className:"text-lg font-semibold",style:{color:null!=a?a:"var(--text-primary)"},children:r})]})}function X(e){let t=[],r="",s=!1;for(let a=0;a<e.length;a++){let o=e[a];s?'"'===o?a+1<e.length&&'"'===e[a+1]?(r+='"',a++):s=!1:r+=o:'"'===o?s=!0:","===o?(t.push(r),r=""):r+=o}return t.push(r),t}function G(e){let{open:t,onClose:r,onImport:a,nodeLabel:o}=e,[n,i]=(0,l.useState)("csv"),[c,d]=(0,l.useState)(null),[x,u]=(0,l.useState)(null),[p,m]=(0,l.useState)(!1),h=(0,l.useRef)(null),f=()=>{d(null),u(null),m(!1)},b=(0,l.useCallback)(e=>{d(null),u(null);let t=new FileReader;t.onload=()=>{try{let r=t.result,s=e.name.endsWith(".json")||"application/json"===e.type?function(e){let t=JSON.parse(e),r=Array.isArray(t)?t:t.testCases||t.test_cases||t.cases;if(!Array.isArray(r))throw Error('JSON must be an array of test cases, or an object with a "testCases" array');let s=[];for(let e of r){if("string"==typeof e){e.trim()&&s.push({title:e.trim(),steps:"",expected:""});continue}if("object"!=typeof e||!e)continue;let t=e.title||e.name||e.testCase||e["test case"]||"";t&&"string"==typeof t&&s.push({title:t.trim(),steps:String(e.steps||e.instructions||"").trim(),expected:String(e.expected||e["expected result"]||e.result||"").trim()})}if(0===s.length)throw Error("No valid test cases found in JSON");return s}(r):function(e){let t=e.split("\n").map(e=>e.trim()).filter(e=>e.length>0);if(t.length<2)throw Error("CSV must have a header row and at least one data row");let r=X(t[0]).map(e=>e.toLowerCase().trim()),s=r.findIndex(e=>"title"===e||"test case"===e||"testcase"===e||"name"===e||"test case title"===e),a=r.findIndex(e=>"steps"===e||"test steps"===e||"step"===e||"instructions"===e),o=r.findIndex(e=>"expected"===e||"expected result"===e||"expected results"===e||"result"===e);if(-1===s)throw Error('Could not find a "title" or "test case" column in the CSV header');let l=[];for(let e=1;e<t.length;e++){let r=X(t[e]),n=(r[s]||"").trim();n&&l.push({title:n,steps:a>=0?(r[a]||"").trim():"",expected:o>=0?(r[o]||"").trim():""})}if(0===l.length)throw Error("No valid test cases found in CSV");return l}(r);u(s)}catch(e){d(e instanceof Error?e.message:"Failed to parse file")}},t.onerror=()=>d("Failed to read file"),t.readAsText(e)},[]);return t?(0,s.jsx)("div",{className:"fixed inset-0 z-[300] flex items-center justify-center",style:{backgroundColor:"rgba(0,0,0,0.3)",animation:"fadeIn 150ms ease-out"},onClick:()=>{f(),r()},children:(0,s.jsxs)("div",{className:"w-full max-w-lg mx-4 rounded-xl overflow-hidden",style:{backgroundColor:"var(--bg-card)",boxShadow:"var(--shadow-lg)"},onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)("div",{className:"px-5 pt-5 pb-4 border-b",style:{borderColor:"var(--border)"},children:[(0,s.jsx)("h3",{className:"text-sm font-semibold mb-1",style:{color:"var(--text-primary)"},children:"Import Test Cases"}),(0,s.jsxs)("p",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:["Import test cases into “",o,"” from CSV or JSON"]})]}),(0,s.jsxs)("div",{className:"px-5 py-4 space-y-4",children:[(0,s.jsxs)("div",{className:"text-[11px] rounded-lg px-3 py-2",style:{backgroundColor:"var(--bg-secondary)",color:"var(--text-tertiary)"},children:[(0,s.jsx)("p",{className:"font-medium mb-1",style:{color:"var(--text-secondary)"},children:"Supported formats:"}),(0,s.jsxs)("ul",{className:"space-y-0.5 ml-3",children:[(0,s.jsxs)("li",{children:[(0,s.jsx)("strong",{children:"CSV:"})," Header row with columns: title, steps, expected (or similar names)"]}),(0,s.jsxs)("li",{children:[(0,s.jsx)("strong",{children:"JSON:"}),' Array of objects with "title", "steps", "expected" fields']})]})]}),(0,s.jsx)("div",{onDragOver:e=>{e.preventDefault(),m(!0)},onDragLeave:()=>m(!1),onDrop:e=>{e.preventDefault(),m(!1);let t=e.dataTransfer.files[0];t&&b(t)},onClick:()=>{var e;return null==(e=h.current)?void 0:e.click()},className:"border-2 border-dashed rounded-lg cursor-pointer transition-colors py-8",style:{borderColor:p?"var(--accent)":"var(--border)",backgroundColor:p?"var(--accent)08":"transparent"},children:(0,s.jsxs)("div",{className:"flex flex-col items-center gap-2",children:[(0,s.jsxs)("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4"}),(0,s.jsx)("polyline",{points:"17 8 12 3 7 8"}),(0,s.jsx)("line",{x1:"12",y1:"3",x2:"12",y2:"15"})]}),(0,s.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:"Drop a .csv or .json file here, or click to browse"})]})}),(0,s.jsx)("input",{ref:h,type:"file",accept:".csv,.json",className:"hidden",onChange:e=>{var t;let r=null==(t=e.target.files)?void 0:t[0];r&&b(r),e.target.value=""}}),c&&(0,s.jsx)("div",{className:"text-xs px-3 py-2 rounded-lg",style:{backgroundColor:"var(--status-fail-bg)",color:"var(--status-fail-text)"},children:c}),x&&x.length>0&&(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsxs)("span",{className:"text-xs font-medium",style:{color:"var(--text-secondary)"},children:["Preview (",x.length," test case",1!==x.length?"s":"",")"]}),(0,s.jsx)("button",{onClick:()=>u(null),className:"text-[10px] px-1.5 py-0.5 rounded border hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},children:"Clear"})]}),(0,s.jsxs)("div",{className:"max-h-[200px] overflow-auto rounded-lg border",style:{borderColor:"var(--border)"},children:[(0,s.jsxs)("table",{className:"text-[11px] w-full",children:[(0,s.jsx)("thead",{children:(0,s.jsxs)("tr",{style:{backgroundColor:"var(--bg-secondary)"},children:[(0,s.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",style:{color:"var(--text-tertiary)"},children:"#"}),(0,s.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",style:{color:"var(--text-tertiary)"},children:"Title"}),(0,s.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",style:{color:"var(--text-tertiary)"},children:"Steps"}),(0,s.jsx)("th",{className:"px-2 py-1.5 text-left font-medium",style:{color:"var(--text-tertiary)"},children:"Expected"})]})}),(0,s.jsx)("tbody",{children:x.slice(0,20).map((e,t)=>(0,s.jsxs)("tr",{className:"border-t",style:{borderColor:"var(--border)"},children:[(0,s.jsx)("td",{className:"px-2 py-1",style:{color:"var(--text-tertiary)"},children:t+1}),(0,s.jsx)("td",{className:"px-2 py-1",style:{color:"var(--text-primary)"},children:e.title}),(0,s.jsx)("td",{className:"px-2 py-1 max-w-[120px] truncate",style:{color:"var(--text-secondary)"},children:e.steps||"—"}),(0,s.jsx)("td",{className:"px-2 py-1 max-w-[120px] truncate",style:{color:"var(--text-secondary)"},children:e.expected||"—"})]},t))})]}),x.length>20&&(0,s.jsxs)("div",{className:"px-2 py-1 text-[10px] border-t",style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},children:["...and ",x.length-20," more"]})]})]})]}),(0,s.jsxs)("div",{className:"px-5 py-4 border-t flex gap-2",style:{borderColor:"var(--border)"},children:[(0,s.jsx)("button",{onClick:()=>{f(),r()},className:"flex-1 px-3 py-2.5 text-xs font-medium rounded-lg border transition-colors hover:bg-[var(--bg-secondary)]",style:{borderColor:"var(--border)",color:"var(--text-secondary)"},children:"Cancel"}),(0,s.jsxs)("button",{onClick:()=>{x&&0!==x.length&&(a(x),f(),r())},disabled:!x||0===x.length,className:"flex-1 px-3 py-2.5 text-xs font-medium rounded-lg transition-all hover:opacity-90 active:scale-[0.98] disabled:opacity-50 disabled:cursor-not-allowed",style:{background:"linear-gradient(135deg, #8D6E63, #A1887F)",color:"#fff"},children:["Import ",x?"(".concat(x.length,")"):""]})]})]})}):null}function H(e){var t;let{testCases:r,projectId:a,onClose:o}=e,{e2e:n,testCases:c}=(0,i.M)(),[d,x]=(0,l.useState)(n.config.baseUrl),[u,p]=(0,l.useState)(n.config.browser),[m,h]=(0,l.useState)(n.config.headless),[f,b]=(0,l.useState)(n.config.timeout),[v,y]=(0,l.useState)("runner"),[g,j]=(0,l.useState)(!1),[k,w]=(0,l.useState)(!1),[C,N]=(0,l.useState)([]),[S,L]=(0,l.useState)(null),[D,E]=(0,l.useState)([]),[M,R]=(0,l.useState)([]),[A,I]=(0,l.useState)(null),[U,P]=(0,l.useState)(!0),[z,T]=(0,l.useState)(22),[W,F]=(0,l.useState)(!0),B=(0,l.useRef)(!1),O=(0,l.useRef)(null),[X,G]=(0,l.useState)(""),[H,_]=(0,l.useState)(!1),[K,Y]=(0,l.useState)({}),[q,V]=(0,l.useState)(null),[J,Z]=(0,l.useState)(""),[$,Q]=(0,l.useState)(null),[ee,et]=(0,l.useState)(null),er=(0,l.useRef)(null),es=(0,l.useRef)(null),[ea,eo]=(0,l.useState)(new Set(r.map(e=>e.id)));(0,l.useEffect)(()=>{let e=()=>{window.innerWidth<768?(F(!1),P(!1)):(F(!0),P(!0))};return e(),window.addEventListener("resize",e),()=>window.removeEventListener("resize",e)},[]);let el=(0,l.useCallback)(e=>{e.preventDefault(),B.current=!0,document.body.style.cursor="col-resize",document.body.style.userSelect="none";let t=e=>{if(!B.current||!O.current)return;let t=O.current.getBoundingClientRect(),r=e.clientX;T(Math.min(Math.max((t.right-r)/t.width*100,15),50))},r=()=>{B.current=!1,document.body.style.cursor="",document.body.style.userSelect="",document.removeEventListener("mousemove",t),document.removeEventListener("mouseup",r)};document.addEventListener("mousemove",t),document.addEventListener("mouseup",r)},[]);(0,l.useEffect)(()=>{let e={};for(let t of r){let r=n.getScript(t.id);r&&(e[t.id]=r.script)}Y(e)},[r,n]),(0,l.useEffect)(()=>{let e=window.setTimeout(()=>{n.saveConfig({baseUrl:d,browser:u,headless:m,timeout:f})},500);return()=>window.clearTimeout(e)},[d,u,m,f,n]);let en=(0,l.useCallback)((e,t)=>{E(r=>[...r,{time:new Date,type:e,message:t}]),window.setTimeout(()=>{var e;null==(e=es.current)||e.scrollIntoView({behavior:"smooth"})},50)},[]),ei=(0,l.useCallback)(e=>{eo(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]),ec=(0,l.useCallback)(()=>{ea.size===r.length?eo(new Set):eo(new Set(r.map(e=>e.id)))},[r,ea]),ed=(0,l.useCallback)(()=>{var e;let t=localStorage.getItem("qa-llm-config");if(!t)return null;let r=JSON.parse(t),s=r.activeProvider;if(!s||!(null==(e=r.providers)?void 0:e[s]))return null;let a=r.providers[s];return a.apiKey&&a.connected?{provider:s,model:a.defaultModel,apiKey:a.apiKey,baseURL:a.baseURL}:null},[]),ex=(0,l.useCallback)(async()=>{let e=ed();if(!e)return void en("error","Please configure LLM in Integrations page first");w(!0),en("info","Generating test scripts...");try{let t=await fetch("/api/e2e",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({testCases:r.filter(e=>ea.has(e.id)),baseUrl:d,llmConfig:e,generateOnly:!0})});if(!t.ok)return void en("error","Failed to generate scripts");let s=await t.json();for(let[e,t]of(Y(e=>({...e,...s.scripts})),Object.entries(s.scripts))){let s=r.find(t=>t.id===e);s&&n.saveScript(e,s.title,s.code,t)}en("success","Generated ".concat(Object.keys(s.scripts).length," test script(s)")),y("scripts")}catch(e){en("error","Error: ".concat(e instanceof Error?e.message:String(e)))}finally{w(!1)}},[r,ea,d,ed,en,n]),eu=(0,l.useCallback)(async()=>{let e=r.filter(e=>ea.has(e.id));if(0===e.length)return;let t=ed();if(!t)return void en("error","Please configure LLM in Integrations page first");j(!0),N([]),E([]),R([]),I(null),G(""),_(!1);let s=new AbortController;er.current=s,en("info","Starting E2E test run with ".concat(e.length," test(s)...")),en("info","Target: ".concat(d)),en("info","Browser: ".concat(u," | Headless: ").concat(m));try{var o,l;let r=await fetch("/api/e2e",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({testCases:e,baseUrl:d,browser:u,headless:m,timeout:f,llmConfig:t}),signal:s.signal});if(!r.ok){let e=await r.json();en("error",e.error||"Failed to run tests"),j(!1);return}let i=null==(o=r.body)?void 0:o.getReader(),c=new TextDecoder,x="",p=[];if(i)for(;;){let{done:e,value:t}=await i.read();if(e)break;let r=(x+=c.decode(t,{stream:!0})).split("\n");for(let e of(x=r.pop()||"",r))if(e.startsWith("data: "))try{let t=JSON.parse(e.slice(6));switch(t.type){case"status":en("info",t.message);break;case"testStart":L({index:t.index,title:t.title}),en("info","\n━━━ Test ".concat(t.index,"/").concat(t.total,": ").concat(t.code," - ").concat(t.title," ━━━")),t.script&&Y(e=>({...e,[t.testCaseId]:t.script}));break;case"step":en("info"," → ".concat(t.message));break;case"aiThinking":en("ai"," \uD83E\uDD16 ".concat(t.message));break;case"aiAction":en("ai"," \uD83C\uDFAF ".concat(t.message));break;case"screenshot":I(t.image),R(e=>[...e,{image:t.image,label:t.label,timestamp:new Date}]);break;case"stepResult":en("pass"===t.status?"success":"error"," ".concat("pass"===t.status?"✓":"✗"," ").concat(t.message));break;case"healing":en("healing"," \uD83D\uDD27 ".concat(t.message));break;case"healingAction":en("healing"," \uD83D\uDC8A ".concat(t.message));break;case"healed":en("success"," ✨ ".concat(t.message));break;case"aiAnalysis":en("ai"," \uD83D\uDCCA AI Analysis:\n".concat(t.message));break;case"error":en("error"," ⚠ ".concat(t.message));break;case"healingReport":G(t.report),t.report&&!t.report.includes("All tests passed")&&_(!0);break;case"testComplete":en("pass"===t.status?"success":"error","\n ".concat("pass"===t.status?"✓":"✗"," Test ").concat(t.index," completed: ").concat(t.status.toUpperCase()," (").concat(t.duration,"ms)")),t.script&&(Y(e=>({...e,[t.testCaseId]:t.script})),n.saveScript(t.testCaseId,(null==(l=t.result)?void 0:l.testCaseTitle)||"","",t.script)),p.push(t.result),N([...p]);break;case"complete":en("success","\n═══════════════════════════════════════");let r=t.results.filter(e=>"pass"===e.status).length,s=t.results.filter(e=>"fail"===e.status||"error"===e.status).length;en("success","Test run complete: ".concat(r," passed, ").concat(s," failed")),n.saveRun({projectId:a,config:{baseUrl:d,browser:u,headless:m,timeout:f},results:t.results,totalPassed:r,totalFailed:s,totalDuration:t.results.reduce((e,t)=>e+t.duration,0),healingReport:X||void 0});break;case"aborted":en("warning","\n━━━ Test run stopped by user ━━━")}}catch(e){}}}catch(e){e instanceof Error&&"AbortError"===e.name?en("warning","\n━━━ Test run stopped by user ━━━"):en("error","Error: ".concat(e instanceof Error?e.message:String(e)))}j(!1),L(null),er.current=null},[r,ea,d,u,m,f,en,ed,a,n,X]),ep=(0,l.useCallback)(()=>{er.current&&(en("warning","Stopping test run..."),er.current.abort())},[en]),em=(0,l.useCallback)(()=>{if(!q||!J)return;let e=r.find(e=>e.id===q);e&&(n.saveScript(e.id,e.title,e.code,J),Y(t=>({...t,[e.id]:J})),en("success","Script saved for ".concat(e.code))),V(null),Z("")},[q,J,r,n,en]);return(0,s.jsxs)("div",{className:"fixed inset-0 z-50 flex items-center justify-center p-2 md:p-4",style:{backgroundColor:"rgba(0,0,0,0.5)"},children:[(0,s.jsxs)("div",{className:"w-full max-w-6xl max-h-[95vh] md:max-h-[92vh] rounded-lg shadow-xl flex flex-col",style:{backgroundColor:"var(--bg-primary)",border:"1px solid var(--border)"},children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-3 md:p-4 border-b shrink-0",style:{borderColor:"var(--border)"},children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsx)("h2",{className:"text-base md:text-lg font-semibold truncate",style:{color:"var(--text-primary)"},children:"E2E Agentic Test Runner"}),(0,s.jsx)("p",{className:"text-xs mt-0.5 hidden sm:block",style:{color:"var(--text-tertiary)"},children:"AI-powered testing with script generation & live preview"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-2 ml-2",children:["runner"===v&&(0,s.jsx)("button",{onClick:()=>F(!W),className:"md:hidden p-1.5 rounded",style:{backgroundColor:W?"var(--accent)":"var(--bg-secondary)",color:W?"white":"var(--text-secondary)"},title:"Toggle config panel",children:"☰"}),(0,s.jsx)("button",{onClick:o,className:"p-1 rounded hover:opacity-80",style:{color:"var(--text-tertiary)"},children:"✕"})]})]}),(0,s.jsx)("div",{className:"flex border-b overflow-x-auto shrink-0",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},children:[{id:"runner",label:"Runner",icon:"▶"},{id:"scripts",label:"Scripts",icon:"{ }"},{id:"history",label:"History",icon:"\uD83D\uDCCB"}].map(e=>(0,s.jsxs)("button",{onClick:()=>y(e.id),className:"px-3 md:px-4 py-2 text-xs flex items-center gap-1.5 transition-colors whitespace-nowrap",style:{backgroundColor:v===e.id?"var(--bg-secondary)":"transparent",color:v===e.id?"var(--accent)":"var(--text-tertiary)",borderBottom:v===e.id?"2px solid var(--accent)":"2px solid transparent"},children:[(0,s.jsx)("span",{children:e.icon}),e.label]},e.id))}),"runner"===v&&(0,s.jsxs)("div",{className:"flex-1 overflow-hidden flex flex-col md:flex-row",children:[(0,s.jsx)("div",{className:"".concat(W?"max-h-[35vh] md:max-h-none":"max-h-0 md:max-h-none"," md:flex-[0_0_28%] border-b md:border-b-0 md:border-r overflow-auto transition-all duration-200 shrink-0"),style:{borderColor:"var(--border)"},children:(0,s.jsxs)("div",{className:"p-3 md:p-4 space-y-3 md:space-y-4",children:[(0,s.jsxs)("div",{className:"p-3 rounded-lg space-y-3",style:{backgroundColor:"var(--bg-secondary)",border:"1px solid var(--border)"},children:[(0,s.jsx)("h3",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:"Configuration"}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-xs block mb-1",style:{color:"var(--text-tertiary)"},children:"Target URL"}),(0,s.jsx)("input",{type:"url",value:d,onChange:e=>x(e.target.value),disabled:g,className:"w-full text-sm px-2 py-1.5 rounded disabled:opacity-50",style:{backgroundColor:"var(--bg-primary)",border:"1px solid var(--border)",color:"var(--text-primary)"},placeholder:"http://localhost:3000"})]}),(0,s.jsxs)("div",{className:"grid grid-cols-2 gap-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-xs block mb-1",style:{color:"var(--text-tertiary)"},children:"Browser"}),(0,s.jsxs)("select",{value:u,onChange:e=>p(e.target.value),disabled:g,className:"w-full text-sm px-2 py-1.5 rounded disabled:opacity-50",style:{backgroundColor:"var(--bg-primary)",border:"1px solid var(--border)",color:"var(--text-primary)"},children:[(0,s.jsx)("option",{value:"chromium",children:"Chromium"}),(0,s.jsx)("option",{value:"firefox",children:"Firefox"}),(0,s.jsx)("option",{value:"webkit",children:"WebKit"}),(0,s.jsx)("option",{value:"edge",children:"Edge"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsx)("label",{className:"text-xs block mb-1",style:{color:"var(--text-tertiary)"},children:"Timeout (ms)"}),(0,s.jsx)("input",{type:"number",value:f,onChange:e=>b(Number(e.target.value)),disabled:g,className:"w-full text-sm px-2 py-1.5 rounded disabled:opacity-50",style:{backgroundColor:"var(--bg-primary)",border:"1px solid var(--border)",color:"var(--text-primary)"}})]})]}),(0,s.jsxs)("label",{className:"flex items-center gap-2 text-xs cursor-pointer",children:[(0,s.jsx)("input",{type:"checkbox",checked:m,onChange:e=>h(e.target.checked),disabled:g,className:"accent-[var(--accent)]"}),(0,s.jsx)("span",{style:{color:"var(--text-secondary)"},children:"Run headless"})]})]}),(0,s.jsxs)("div",{children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-2",children:[(0,s.jsxs)("h3",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:["Test Cases (",ea.size,"/",r.length,")"]}),(0,s.jsx)("button",{onClick:ec,disabled:g,className:"text-xs underline disabled:opacity-50",style:{color:"var(--accent)"},children:ea.size===r.length?"Deselect All":"Select All"})]}),(0,s.jsx)("div",{className:"max-h-[150px] md:max-h-[200px] overflow-auto rounded-lg",style:{border:"1px solid var(--border)"},children:r.map(e=>{let t=C.find(t=>t.testCaseId===e.id);return(0,s.jsxs)("label",{className:"flex items-center gap-2 px-3 py-2 text-xs border-b last:border-b-0 hover:opacity-80 cursor-pointer",style:{borderColor:"var(--border)",backgroundColor:ea.has(e.id)?"var(--bg-secondary)":"transparent"},children:[(0,s.jsx)("input",{type:"checkbox",checked:ea.has(e.id),onChange:()=>ei(e.id),disabled:g,className:"accent-[var(--accent)]"}),(0,s.jsx)("span",{className:"flex-1 truncate",style:{color:"var(--text-primary)"},children:e.code}),t&&(0,s.jsx)("span",{style:{color:"pass"===t.status?"var(--status-pass-text)":"var(--status-fail-text)"},children:"pass"===t.status?"✓":"✗"})]},e.id)})})]}),(0,s.jsxs)("div",{className:"space-y-2",children:[(0,s.jsx)("button",{onClick:ex,disabled:g||k||0===ea.size,className:"w-full px-3 py-2 text-xs rounded flex items-center justify-center gap-2 disabled:opacity-50",style:{border:"1px solid var(--border)",color:"var(--text-secondary)"},children:k?"⏳ Generating...":"{ } Generate Scripts"}),X&&(0,s.jsx)("button",{onClick:()=>_(!0),className:"w-full px-3 py-2 text-xs rounded flex items-center justify-center gap-2",style:{backgroundColor:"var(--status-skip-bg)",border:"1px solid var(--status-skip-border)",color:"var(--status-skip-text)"},children:"\uD83D\uDD27 View Healing Report"})]})]})}),(0,s.jsxs)("div",{ref:O,className:"flex-1 flex flex-col overflow-hidden min-h-0",children:[(0,s.jsxs)("div",{className:"flex-1 flex flex-col md:flex-row overflow-hidden min-h-0",children:[(0,s.jsxs)("div",{className:"flex-1 flex flex-col min-h-0 max-h-[45vh] md:max-h-none",children:[(0,s.jsx)("div",{className:"p-3 border-b",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},children:(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("h3",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:"Execution Log"}),g&&(0,s.jsxs)("div",{className:"flex items-center gap-2",children:[(0,s.jsx)("div",{className:"w-2 h-2 rounded-full bg-green-500 animate-pulse"}),(0,s.jsx)("span",{className:"text-xs truncate max-w-[150px]",style:{color:"var(--text-tertiary)"},children:S?S.title:"Processing..."})]})]})}),(0,s.jsxs)("div",{className:"flex-1 overflow-auto p-3 font-mono text-xs",style:{backgroundColor:"var(--bg-primary)"},children:[0===D.length?(0,s.jsx)("div",{className:"text-center py-8",style:{color:"var(--text-tertiary)"},children:'Click "Run Tests" to start'}):D.map((e,t)=>(0,s.jsx)("div",{className:"py-0.5",style:{color:(e=>{switch(e){case"error":return"var(--status-fail-text)";case"success":return"var(--status-pass-text)";case"ai":return"#8b5cf6";case"healing":return"#f59e0b";case"warning":return"var(--status-skip-text)";default:return"var(--text-secondary)"}})(e.type)},children:e.message.split("\n").map((e,t)=>(0,s.jsx)("div",{children:e||"\xa0"},t))},t)),(0,s.jsx)("div",{ref:es})]})]}),(0,s.jsx)("div",{className:"w-1 md:w-1.5 cursor-col-resize hover:bg-[var(--accent)] transition-colors shrink-0",style:{backgroundColor:"var(--border)"},onMouseDown:el}),(0,s.jsxs)("div",{className:"border-t md:border-t-0 md:border-l flex flex-col transition-all duration-200",style:{borderColor:"var(--border)",maxHeight:U?"300px":"36px",minHeight:U?"200px":"36px",width:"auto",flex:U?"0 0 ".concat(z,"%"):"0 0 36px",...window.innerWidth>=768?{maxHeight:"none",minHeight:"auto",flex:U?"0 0 ".concat(z,"%"):"0 0 36px"}:{}},children:[(0,s.jsxs)("div",{className:"p-2 md:p-3 border-b cursor-pointer flex items-center gap-2 shrink-0",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},onClick:()=>P(!U),children:[(0,s.jsx)("span",{className:"text-sm",children:"\uD83D\uDDA5️"}),U&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("h3",{className:"text-sm font-medium flex-1",style:{color:"var(--text-primary)"},children:"Browser Preview"}),(0,s.jsx)("span",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:M.length>0?"".concat(M.length," screenshots"):""})]})]}),U&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{className:"flex-1 overflow-auto p-2",style:{backgroundColor:"var(--bg-secondary)"},children:A?(0,s.jsx)("img",{src:"data:image/jpeg;base64,".concat(A),alt:"Browser preview",className:"w-full rounded"}):(0,s.jsx)("div",{className:"flex items-center justify-center h-full min-h-[100px] text-xs",style:{color:"#666"},children:g?"Waiting...":"Preview during execution"})}),M.length>0&&(0,s.jsx)("div",{className:"p-2 border-t overflow-x-auto flex gap-1 shrink-0",style:{borderColor:"var(--border)"},children:M.slice(-6).map((e,t)=>(0,s.jsx)("button",{onClick:()=>I(e.image),className:"flex-shrink-0 w-10 h-7 md:w-12 md:h-8 rounded overflow-hidden border",style:{border:A===e.image?"2px solid var(--accent)":"1px solid var(--border)"},title:e.label,children:(0,s.jsx)("img",{src:"data:image/jpeg;base64,".concat(e.image),alt:e.label,className:"w-full h-full object-cover"})},t))})]})]})]}),C.length>0&&(0,s.jsx)("div",{className:"p-2 md:p-3 border-t shrink-0",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},children:(0,s.jsxs)("div",{className:"flex flex-wrap gap-3 md:gap-4 text-xs md:text-sm",children:[(0,s.jsxs)("span",{style:{color:"var(--status-pass-text)"},children:["✓ ",C.filter(e=>"pass"===e.status).length]}),(0,s.jsxs)("span",{style:{color:"var(--status-fail-text)"},children:["✗ ",C.filter(e=>"fail"===e.status).length]}),(0,s.jsxs)("span",{style:{color:"var(--status-fail-text)"},children:["⚠ ",C.filter(e=>"error"===e.status).length]}),(0,s.jsxs)("span",{className:"ml-auto",style:{color:"var(--text-tertiary)"},children:[Math.round(C.reduce((e,t)=>e+t.duration,0)/1e3),"s"]})]})})]})]}),"scripts"===v&&(0,s.jsxs)("div",{className:"flex-1 overflow-hidden flex flex-col md:flex-row",children:[(0,s.jsx)("div",{className:"w-full md:w-64 border-b md:border-b-0 md:border-r overflow-auto max-h-[30vh] md:max-h-none",style:{borderColor:"var(--border)"},children:(0,s.jsxs)("div",{className:"p-3",children:[(0,s.jsx)("h3",{className:"text-sm font-medium mb-3",style:{color:"var(--text-primary)"},children:"Test Scripts"}),(0,s.jsx)("div",{className:"space-y-1",children:r.map(e=>{let t=!!K[e.id],r=$===e.id;return(0,s.jsxs)("button",{onClick:()=>{Q(e.id),V(null)},className:"w-full text-left px-3 py-2 text-xs rounded flex items-center gap-2",style:{backgroundColor:r?"var(--bg-secondary)":"transparent",color:"var(--text-primary)",border:r?"1px solid var(--border)":"1px solid transparent"},children:[(0,s.jsx)("span",{className:t?"text-green-500":"text-gray-400",children:t?"✓":"○"}),(0,s.jsxs)("span",{className:"truncate",children:[e.code," - ",e.title]})]},e.id)})})]})}),(0,s.jsx)("div",{className:"flex-1 flex flex-col min-h-0 max-h-[45vh] md:max-h-none",children:$?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{className:"p-3 border-b flex items-center justify-between shrink-0",style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},children:[(0,s.jsxs)("div",{className:"min-w-0 flex-1",children:[(0,s.jsxs)("h3",{className:"text-sm font-medium truncate",style:{color:"var(--text-primary)"},children:[null==(t=r.find(e=>e.id===$))?void 0:t.code," - Script"]}),(0,s.jsx)("p",{className:"text-xs mt-0.5",style:{color:"var(--text-tertiary)"},children:q?"Editing":"Click Edit to modify"})]}),(0,s.jsx)("div",{className:"flex gap-2 ml-2",children:q?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{onClick:()=>{V(null),Z("")},className:"px-3 py-1.5 text-xs rounded",style:{border:"1px solid var(--border)",color:"var(--text-secondary)"},children:"Cancel"}),(0,s.jsx)("button",{onClick:em,className:"px-3 py-1.5 text-xs rounded",style:{backgroundColor:"var(--accent)",color:"white"},children:"Save"})]}):(0,s.jsx)("button",{onClick:()=>{V($),Z(K[$]||"")},className:"px-3 py-1.5 text-xs rounded",style:{border:"1px solid var(--border)",color:"var(--text-secondary)"},children:"✏️ Edit"})})]}),(0,s.jsx)("div",{className:"flex-1 overflow-auto p-4",style:{backgroundColor:"#1e1e2e"},children:q?(0,s.jsx)("textarea",{value:J,onChange:e=>Z(e.target.value),className:"w-full h-full min-h-[300px] font-mono text-sm p-4 rounded resize-none",style:{backgroundColor:"#1e1e2e",color:"#cdd6f4",border:"none",outline:"none"},spellCheck:!1}):K[$]?(0,s.jsx)("pre",{className:"font-mono text-sm whitespace-pre-wrap",style:{color:"#cdd6f4"},children:K[$]}):(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-4",children:[(0,s.jsx)("p",{className:"text-sm",style:{color:"#666"},children:"No script generated yet"}),(0,s.jsx)("button",{onClick:ex,disabled:k,className:"px-4 py-2 text-sm rounded disabled:opacity-50",style:{backgroundColor:"var(--accent)",color:"white"},children:k?"Generating...":"Generate Script"})]})})]}):(0,s.jsx)("div",{className:"flex-1 flex items-center justify-center p-4",children:(0,s.jsxs)("div",{className:"text-center",style:{color:"var(--text-tertiary)"},children:[(0,s.jsx)("p",{className:"text-3xl md:text-4xl mb-3"}),(0,s.jsx)("p",{className:"text-sm",children:"Select a test case to view its script"})]})})})]}),"history"===v&&(0,s.jsxs)("div",{className:"flex-1 overflow-hidden flex flex-col md:flex-row",children:[(0,s.jsx)("div",{className:"w-full md:w-80 border-b md:border-b-0 md:border-r overflow-auto max-h-[40vh] md:max-h-none",style:{borderColor:"var(--border)"},children:(0,s.jsxs)("div",{className:"p-3",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between mb-3",children:[(0,s.jsxs)("h3",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:["Run History (",n.runs.length,")"]}),n.runs.length>0&&(0,s.jsx)("button",{onClick:n.clearRuns,className:"text-xs underline",style:{color:"var(--status-fail-text)"},children:"Clear All"})]}),0===n.runs.length?(0,s.jsx)("div",{className:"text-center py-8 text-xs",style:{color:"var(--text-tertiary)"},children:"No test runs yet"}):(0,s.jsx)("div",{className:"space-y-2",children:n.runs.map(e=>(0,s.jsxs)("div",{className:"p-3 rounded-lg group relative",style:{backgroundColor:(null==ee?void 0:ee.id)===e.id?"var(--bg-secondary)":"transparent",border:(null==ee?void 0:ee.id)===e.id?"1px solid var(--border)":"1px solid transparent"},children:[(0,s.jsxs)("button",{onClick:()=>et(e),className:"w-full text-left",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between",children:[(0,s.jsx)("span",{className:"text-xs font-medium",style:{color:"var(--text-primary)"},children:new Date(e.timestamp).toLocaleString()}),(0,s.jsxs)("span",{className:"text-xs",style:{color:e.totalFailed>0?"var(--status-fail-text)":"var(--status-pass-text)"},children:[e.totalPassed,"✓ ",e.totalFailed,"✗"]})]}),(0,s.jsxs)("div",{className:"text-xs mt-1 truncate",style:{color:"var(--text-tertiary)"},children:[e.config.baseUrl," • ",e.config.browser]})]}),(0,s.jsx)("button",{onClick:()=>{n.deleteRun(e.id),(null==ee?void 0:ee.id)===e.id&&et(null)},className:"absolute top-2 right-2 p-1 rounded opacity-0 group-hover:opacity-100 transition-opacity",style:{color:"var(--status-fail-text)"},title:"Delete run",children:"✕"})]},e.id))})]})}),(0,s.jsx)("div",{className:"flex-1 overflow-auto",children:ee?(0,s.jsxs)("div",{className:"p-4 space-y-4",children:[(0,s.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h3",{className:"text-sm font-medium",style:{color:"var(--text-primary)"},children:"Run Details"}),(0,s.jsx)("p",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:new Date(ee.timestamp).toLocaleString()})]}),(0,s.jsxs)("div",{className:"flex gap-3 text-sm",children:[(0,s.jsxs)("span",{style:{color:"var(--status-pass-text)"},children:["✓ ",ee.totalPassed]}),(0,s.jsxs)("span",{style:{color:"var(--status-fail-text)"},children:["✗ ",ee.totalFailed]})]})]}),(0,s.jsx)("div",{className:"space-y-2",children:ee.results.map((e,t)=>(0,s.jsxs)("div",{className:"p-3 rounded-lg",style:{backgroundColor:"var(--bg-secondary)",border:"1px solid ".concat("pass"===e.status?"var(--status-pass-border)":"var(--status-fail-border)")},children:[(0,s.jsxs)("div",{className:"flex items-center justify-between flex-wrap gap-2",children:[(0,s.jsxs)("span",{className:"text-sm font-medium truncate",style:{color:"var(--text-primary)"},children:[e.testCaseCode||"Test ".concat(t+1)," - ",e.testCaseTitle]}),(0,s.jsx)("span",{className:"text-xs px-2 py-0.5 rounded shrink-0",style:{backgroundColor:"pass"===e.status?"var(--status-pass-bg)":"var(--status-fail-bg)",color:"pass"===e.status?"var(--status-pass-text)":"var(--status-fail-text)"},children:e.status.toUpperCase()})]}),e.error&&(0,s.jsx)("p",{className:"text-xs mt-2 p-2 rounded break-words",style:{backgroundColor:"var(--status-fail-bg)",color:"var(--status-fail-text)"},children:e.error}),(0,s.jsx)("div",{className:"mt-2 space-y-1",children:e.steps.map((e,t)=>(0,s.jsxs)("div",{className:"flex items-start gap-2 text-xs",children:[(0,s.jsx)("span",{className:"shrink-0",style:{color:"pass"===e.status?"var(--status-pass-text)":"var(--status-fail-text)"},children:"pass"===e.status?"✓":"✗"}),(0,s.jsx)("span",{style:{color:"var(--text-secondary)"},children:e.step})]},t))}),e.aiAnalysis&&(0,s.jsxs)("div",{className:"mt-2 p-2 rounded text-xs break-words",style:{backgroundColor:"var(--bg-primary)",color:"var(--text-secondary)"},children:[(0,s.jsx)("strong",{children:"AI:"})," ",e.aiAnalysis]})]},e.testCaseId))})]}):(0,s.jsx)("div",{className:"flex items-center justify-center h-full p-4",children:(0,s.jsxs)("div",{className:"text-center",style:{color:"var(--text-tertiary)"},children:[(0,s.jsx)("p",{className:"text-3xl md:text-4xl mb-3",children:"\uD83D\uDCCB"}),(0,s.jsx)("p",{className:"text-sm",children:"Select a run to view details"})]})})})]}),(0,s.jsxs)("div",{className:"p-3 md:p-4 border-t flex items-center justify-between shrink-0",style:{borderColor:"var(--border)"},children:[(0,s.jsxs)("div",{className:"text-xs truncate max-w-[200px] md:max-w-none",style:{color:"var(--text-tertiary)"},children:[g&&S&&(0,s.jsxs)("span",{children:["Running: ",S.title]}),!g&&C.length>0&&(0,s.jsxs)("span",{children:[C.length," tests completed"]}),!g&&0===C.length&&"runner"===v&&(0,s.jsx)("span",{className:"hidden sm:inline",children:"Config saved per project"})]}),(0,s.jsxs)("div",{className:"flex gap-2",children:[(0,s.jsx)("button",{onClick:o,disabled:g,className:"px-3 md:px-4 py-2 text-sm rounded disabled:opacity-50",style:{border:"1px solid var(--border)",color:"var(--text-secondary)"},children:"Close"}),"runner"===v&&(g?(0,s.jsx)("button",{onClick:ep,className:"px-3 md:px-4 py-2 text-sm rounded flex items-center gap-2",style:{backgroundColor:"#ef4444",color:"white"},children:"■ Stop"}):(0,s.jsx)("button",{onClick:eu,disabled:0===ea.size,className:"px-3 md:px-4 py-2 text-sm rounded disabled:opacity-50",style:{backgroundColor:"var(--accent)",color:"white"},children:"▶ Run"}))]})]})]}),H&&(0,s.jsx)("div",{className:"fixed inset-0 z-60 flex items-center justify-center p-4",style:{backgroundColor:"rgba(0,0,0,0.6)"},children:(0,s.jsxs)("div",{className:"w-full max-w-2xl max-h-[80vh] rounded-lg shadow-xl flex flex-col",style:{backgroundColor:"var(--bg-primary)",border:"1px solid var(--border)"},children:[(0,s.jsxs)("div",{className:"flex items-center justify-between p-4 border-b",style:{borderColor:"var(--border)"},children:[(0,s.jsxs)("div",{children:[(0,s.jsx)("h2",{className:"text-lg font-semibold",style:{color:"var(--text-primary)"},children:"\uD83D\uDD27 Healing Report"}),(0,s.jsx)("p",{className:"text-xs mt-1",style:{color:"var(--text-tertiary)"},children:"AI recommendations"})]}),(0,s.jsx)("button",{onClick:()=>_(!1),className:"p-1 rounded hover:opacity-80",style:{color:"var(--text-tertiary)"},children:"✕"})]}),(0,s.jsx)("div",{className:"flex-1 overflow-auto p-4",children:(0,s.jsx)("pre",{className:"whitespace-pre-wrap text-xs font-mono break-words",style:{color:"var(--text-secondary)"},children:X})}),(0,s.jsx)("div",{className:"p-4 border-t flex justify-end",style:{borderColor:"var(--border)"},children:(0,s.jsx)("button",{onClick:()=>_(!1),className:"px-4 py-2 text-sm rounded",style:{backgroundColor:"var(--accent)",color:"white"},children:"Close"})})]})})]})}var _=r(3101),K=r(3350),Y=r(9770),q=r(7952);let V=(0,_.F)("supports-backdrop-blur:bg-white/10 supports-backdrop-blur:dark:bg-black/10 mx-auto mt-8 flex h-[58px] w-max items-center justify-center gap-2 rounded-2xl border p-2 backdrop-blur-md"),J=l.forwardRef((e,t)=>{let{className:r,children:a,iconSize:o=40,iconMagnification:n=60,disableMagnification:i=!1,iconDistance:c=140,direction:u="middle",...p}=e,m=(0,K.d)(1/0);return(0,s.jsx)(d.P.div,{ref:t,onMouseMove:e=>m.set(e.pageX),onMouseLeave:()=>m.set(1/0),...p,className:(0,x.cn)(V({className:r}),{"items-start":"top"===u,"items-center":"middle"===u,"items-end":"bottom"===u}),children:l.Children.map(a,e=>l.isValidElement(e)&&e.type===Z?l.cloneElement(e,{...e.props,mouseX:m,size:o,magnification:n,disableMagnification:i,distance:c}):e)})});J.displayName="Dock";let Z=e=>{let{size:t=40,magnification:r=60,disableMagnification:a,distance:o=140,mouseX:n,className:i,children:c,...u}=e,p=(0,l.useRef)(null),m=Math.max(6,.2*t),h=(0,K.d)(1/0),f=(0,Y.G)(null!=n?n:h,e=>{var t,r;let s=null!=(r=null==(t=p.current)?void 0:t.getBoundingClientRect())?r:{x:0,width:0};return e-s.x-s.width/2}),b=a?t:r,v=(0,Y.G)(f,[-o,0,o],[t,b,t]),y=(0,q.z)(v,{mass:.15,stiffness:120,damping:25});return(0,s.jsx)(d.P.div,{ref:p,style:{width:y,height:y,padding:m},className:(0,x.cn)("flex aspect-square cursor-pointer items-center justify-center rounded-full",a&&"hover:bg-muted-foreground transition-colors",i),...u,children:(0,s.jsx)("div",{children:c})})};Z.displayName="DockIcon";var $=r(1045);function Q(e){let{className:t,orientation:r="horizontal",...a}=e;return(0,s.jsx)($.w,{"data-slot":"separator",orientation:r,className:(0,x.cn)("shrink-0 bg-border data-horizontal:h-px data-horizontal:w-full data-vertical:w-px data-vertical:self-stretch",t),...a})}function ee(e){var t;let{selectedNode:r,testCases:a,stats:i,columns:c,projectId:d,fullscreen:x,onAddTestCase:u,onUpdateTestCase:p,onDeleteTestCase:m,onBulkDelete:h,onBulkUpdate:f,onReorderTestCases:b,onReorderColumn:k,onToggleColumn:w,onRenameColumn:C,onUpdateNode:N,onAddColumn:S,onDeleteColumn:L,confirmDialog:A}=e;(0,n.useRouter)();let[I,U]=(0,l.useState)(!1),[P,z]=(0,l.useState)(!1),[T,F]=(0,l.useState)(!1),[O,X]=(0,l.useState)(!1),[_,K]=(0,l.useState)(!1),[Y,q]=(0,l.useState)(!1),[V,$]=(0,l.useState)(!1),[ee,et]=(0,l.useState)(!1),[er,es]=(0,l.useState)(!1),[ea,eo]=(0,l.useState)("all"),[el,en]=(0,l.useState)(new Set),[ei,ec]=(0,l.useState)(null),[ed,ex]=(0,l.useState)("asc"),[eu,ep]=(0,l.useState)(!1),[em,eh]=(0,l.useState)(""),ef=(0,l.useRef)(null),eb=(0,l.useRef)(null),ev=x?c:c.filter(e=>"code"!==e.key),ey=v._X.map(e=>e.key);(0,l.useEffect)(()=>{en(new Set)},[null==r?void 0:r.id]);let eg=(0,l.useCallback)(e=>{en(t=>{let r=new Set(t);return r.has(e)?r.delete(e):r.add(e),r})},[]),ej="all"===ea?a:a.filter(e=>e.status===ea),ek=(0,l.useCallback)(()=>{el.size===ej.length?en(new Set):en(new Set(ej.map(e=>e.id)))},[el.size,ej]),ew=(0,l.useCallback)(()=>en(new Set),[]),eC=(0,l.useCallback)(async()=>{r&&0!==el.size&&(!A||await A("Delete Test Cases","Delete ".concat(el.size," selected test case(s)?")))&&(h(r.id,Array.from(el)),en(new Set))},[r,el,h,A]),eN=(0,l.useCallback)(e=>{r&&0!==el.size&&(f(r.id,Array.from(el),{status:e}),en(new Set))},[r,el,f]),eS=ei?[...ej].sort((e,t)=>{let r=e[ei]||"",s=t[ei]||"",a=r.localeCompare(s);return"asc"===ed?a:-a}):ej;(0,l.useEffect)(()=>{eu&&ef.current&&ef.current.focus()},[eu]),(0,l.useEffect)(()=>{if(!V)return;let e=e=>{eb.current&&!eb.current.contains(e.target)&&$(!1)};return document.addEventListener("mousedown",e),()=>document.removeEventListener("mousedown",e)},[V]);let eL=(0,l.useCallback)(e=>{if(r)for(let t of e)u(r.id,t.title,t.steps,t.expected)},[r,u]),eD=(0,l.useCallback)(e=>{if(r)for(let t of e)u(r.id,t.title,t.steps,t.expected)},[r,u]);return r?(0,s.jsxs)("div",{className:"jsx-bc071752c54fb059 flex flex-col h-full relative",children:[(0,s.jsxs)("div",{style:{borderColor:"var(--border)"},className:"jsx-bc071752c54fb059 px-4 py-3 border-b",children:[(0,s.jsx)("h2",{style:{color:"var(--text-primary)"},className:"jsx-bc071752c54fb059 text-base font-medium mb-2",children:r.label}),(0,s.jsx)(g,{value:i.passRate}),(0,s.jsx)("div",{className:"jsx-bc071752c54fb059 flex items-center gap-1.5 mt-2",children:[["all","All"],["untested","Untested"],["pass","Pass"],["fail","Fail"],["skip","Skip"]].map(e=>{let[t,r]=e,o=ea===t,l="all"===t?a.length:a.filter(e=>e.status===t).length,n={all:{bg:"var(--bg-secondary)",text:"var(--text-secondary)"},untested:{bg:"var(--status-untested-bg)",text:"var(--status-untested-text)"},pass:{bg:"var(--status-pass-bg)",text:"var(--status-pass-text)"},fail:{bg:"var(--status-fail-bg)",text:"var(--status-fail-text)"},skip:{bg:"var(--status-skip-bg)",text:"var(--status-skip-text)"}}[t];return(0,s.jsxs)("button",{onClick:()=>eo(t),style:{backgroundColor:o?n.bg:"transparent",color:o?n.text:"var(--text-tertiary)",borderColor:o?"transparent":"var(--border)"},className:"jsx-bc071752c54fb059 flex items-center gap-1 px-2 py-0.5 text-[10px] font-medium rounded-full border transition-colors",children:[r,(0,s.jsx)("span",{style:{backgroundColor:o?"rgba(0,0,0,0.1)":"var(--bg-secondary)",color:o?n.text:"var(--text-tertiary)"},className:"jsx-bc071752c54fb059 px-1 py-0 text-[9px] rounded-full min-w-[16px] text-center",children:l})]},t)})})]}),I&&(0,s.jsxs)("div",{style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},className:"jsx-bc071752c54fb059 px-4 py-3 border-b",children:[(0,s.jsx)("label",{style:{color:"var(--text-tertiary)"},className:"jsx-bc071752c54fb059 text-xs font-medium mb-1 block",children:"Node Notes"}),(0,s.jsx)("textarea",{value:null!=(t=r.notes)?t:"",onChange:e=>N(r.id,{notes:e.target.value}),placeholder:"Add notes for this node...",rows:3,style:{borderColor:"var(--border)",borderRadius:"var(--radius-sm)",color:"var(--text-primary)"},className:"jsx-bc071752c54fb059 w-full px-3 py-2 text-sm bg-transparent outline-none border resize-none"})]}),(0,s.jsx)("div",{className:"jsx-bc071752c54fb059 px-4 py-3",children:(0,s.jsx)(j,{onAdd:e=>u(r.id,e),nodeLabel:r.label})}),el.size>0&&(0,s.jsxs)("div",{style:{borderColor:"var(--accent)",backgroundColor:"var(--accent)",animation:"fadeInUp 150ms ease-out"},className:"jsx-bc071752c54fb059 mx-4 mb-2 px-3 py-2 rounded-lg border flex items-center gap-3",children:[(0,s.jsxs)("span",{className:"jsx-bc071752c54fb059 text-xs font-medium text-white",children:[el.size," selected"]}),(0,s.jsx)("div",{className:"jsx-bc071752c54fb059 flex-1"}),["pass","fail","skip","untested"].map(e=>(0,s.jsxs)("button",{onClick:()=>eN(e),style:{color:"#fff"},className:"jsx-bc071752c54fb059 px-2 py-1 text-[10px] font-medium rounded-md transition-colors hover:bg-white/20",children:["Mark ",e.charAt(0).toUpperCase()+e.slice(1)]},e)),(0,s.jsx)("div",{className:"jsx-bc071752c54fb059 w-px h-4 bg-white/30"}),(0,s.jsx)("button",{onClick:eC,style:{color:"#fff"},className:"jsx-bc071752c54fb059 px-2 py-1 text-[10px] font-medium rounded-md transition-colors hover:bg-white/20",children:"Delete"}),(0,s.jsx)("button",{onClick:ew,style:{color:"#fff"},title:"Clear selection",className:"jsx-bc071752c54fb059 px-1.5 py-1 text-[10px] font-medium rounded-md transition-colors hover:bg-white/20",children:"\xd7"})]}),(0,s.jsx)("div",{className:"jsx-bc071752c54fb059 flex-1 min-h-0 overflow-auto px-2",children:0===a.length?(0,s.jsx)(y.p,{message:"No test cases yet. Use the quick-add bar or Generate button to add test cases."}):(0,s.jsx)(D,{testCases:eS,columns:ev,expandAll:ee,selectedIds:el,onToggleSelect:eg,onToggleSelectAll:ek,sortKey:ei,sortDirection:ed,onSortChange:e=>{null===e?ec(null):ei===e?ex(e=>"asc"===e?"desc":"asc"):(ec(e),ex("asc"))},onUpdate:(e,t)=>p(r.id,e,t),onDelete:e=>m(r.id,e),onReorder:e=>b(r.id,e)})}),(0,s.jsx)(E,{stats:i}),(0,s.jsxs)("div",{style:{borderColor:"var(--border)",backgroundColor:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 flex-shrink-0 border-t py-2 flex justify-center relative",children:[V&&(0,s.jsxs)("div",{ref:eb,style:{bottom:"100%",left:"50%",transform:"translateX(-50%)",marginBottom:2,backgroundColor:"var(--bg-card)",borderColor:"var(--border)",boxShadow:"var(--shadow-lg)",animation:"fadeInUp 200ms ease-out",width:180},className:"jsx-bc071752c54fb059 absolute z-30 rounded-xl border",children:[(0,s.jsxs)("div",{style:{borderColor:"var(--border)"},className:"jsx-bc071752c54fb059 flex items-center justify-between px-3 py-2 border-b",children:[(0,s.jsx)("h4",{style:{color:"var(--text-primary)"},className:"jsx-bc071752c54fb059 text-[11px] font-semibold",children:"Columns"}),(0,s.jsx)("button",{onClick:()=>$(!1),style:{color:"var(--text-tertiary)"},className:"jsx-bc071752c54fb059 text-[10px] opacity-50 hover:opacity-100",children:"\xd7"})]}),(0,s.jsxs)("div",{className:"jsx-bc071752c54fb059 py-1 max-h-[240px] overflow-y-auto",children:[ev.map((e,t)=>{let o=!ey.includes(e.key);return(0,s.jsxs)("div",{className:"jsx-bc071752c54fb059 flex items-center justify-between px-3 py-1.5 text-[11px] hover:bg-[var(--bg-secondary)] transition-colors group/col",children:[(0,s.jsxs)("button",{onClick:()=>r&&w(r.id,e.key),style:{color:e.visible?"var(--text-primary)":"var(--text-tertiary)"},className:"jsx-bc071752c54fb059 flex items-center gap-2 flex-1 text-left",children:[(0,s.jsx)("span",{className:"jsx-bc071752c54fb059 w-3 text-center",children:e.visible?"✓":""}),(0,s.jsx)("span",{className:"jsx-bc071752c54fb059",children:e.label})]}),(0,s.jsxs)("div",{className:"jsx-bc071752c54fb059 flex items-center gap-0.5 opacity-0 group-hover/col:opacity-100 transition-opacity",children:[(0,s.jsx)("button",{onClick:()=>r&&(null==k?void 0:k(r.id,e.key,"up")),disabled:0===t,style:{color:"var(--text-tertiary)"},title:"Move up",className:"jsx-bc071752c54fb059 w-4 h-4 flex items-center justify-center rounded text-[10px] disabled:opacity-20 hover:bg-[var(--bg-secondary)]",children:"↑"}),(0,s.jsx)("button",{onClick:()=>r&&(null==k?void 0:k(r.id,e.key,"down")),disabled:t===ev.length-1,style:{color:"var(--text-tertiary)"},title:"Move down",className:"jsx-bc071752c54fb059 w-4 h-4 flex items-center justify-center rounded text-[10px] disabled:opacity-20 hover:bg-[var(--bg-secondary)]",children:"↓"}),o&&(0,s.jsx)("button",{onClick:async()=>{if(r&&L)(!a.some(t=>{let r=t[e.key];return r&&"string"==typeof r&&""!==r.trim()})||!A||await A("Delete Column",'This column has data in some test cases. Delete "'.concat(e.label,'" anyway?')))&&L(r.id,e.key)},style:{color:"var(--status-fail-text)"},title:"Delete ".concat(e.label),className:"jsx-bc071752c54fb059 w-4 h-4 flex items-center justify-center rounded hover:opacity-100 transition-opacity text-[10px]",children:"\xd7"})]})]},e.key)}),eu?(0,s.jsx)("div",{className:"jsx-bc071752c54fb059 px-3 py-1.5",children:(0,s.jsx)("input",{ref:ef,value:em,onChange:e=>eh(e.target.value),onKeyDown:e=>{"Enter"===e.key&&em.trim()&&(null==S||S(r.id,em.trim()),eh(""),ep(!1)),"Escape"===e.key&&(ep(!1),eh(""))},onBlur:()=>{em.trim()&&(null==S||S(r.id,em.trim())),eh(""),ep(!1)},placeholder:"Column name...",style:{borderColor:"var(--accent)",backgroundColor:"var(--bg-card)",color:"var(--text-primary)"},className:"jsx-bc071752c54fb059 w-full px-2 py-1 text-[11px] rounded border outline-none"})}):(0,s.jsxs)("button",{onClick:()=>ep(!0),style:{color:"var(--accent)"},className:"jsx-bc071752c54fb059 w-full px-3 py-1.5 text-[11px] text-left flex items-center gap-2 hover:bg-[var(--bg-secondary)] transition-colors",children:[(0,s.jsx)("span",{className:"jsx-bc071752c54fb059 w-3 text-center",children:"+"}),(0,s.jsx)("span",{className:"jsx-bc071752c54fb059",children:"Add New Column"})]})]})]}),(0,s.jsxs)(J,{direction:"middle",iconSize:32,iconMagnification:44,iconDistance:100,children:[(0,s.jsx)(Z,{children:(0,s.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,s.jsx)("button",{onClick:()=>X(!0),className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full hover:bg-[var(--bg-secondary)] transition-colors",children:(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:[(0,s.jsx)("path",{d:"M14 2H6a2 2 0 00-2 2v16a2 2 0 002 2h12a2 2 0 002-2V8z",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("polyline",{points:"14 2 14 8 20 8",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("line",{x1:"16",y1:"13",x2:"8",y2:"13",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("line",{x1:"16",y1:"17",x2:"8",y2:"17",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("polyline",{points:"10 9 9 9 8 9",className:"jsx-bc071752c54fb059"})]})}),(0,s.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:"Node Summary"})]})}),(0,s.jsx)(Q,{orientation:"vertical",className:"h-full"}),(0,s.jsx)(Z,{children:(0,s.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,s.jsx)("button",{onClick:()=>U(!I),style:{backgroundColor:I?"var(--bg-secondary)":"transparent"},className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full transition-colors",children:(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:I?"var(--accent)":"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:[(0,s.jsx)("path",{d:"M11 4H4a2 2 0 00-2 2v14a2 2 0 002 2h14a2 2 0 002-2v-7",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("path",{d:"M18.5 2.5a2.121 2.121 0 013 3L12 15l-4 1 1-4 9.5-9.5z",className:"jsx-bc071752c54fb059"})]})}),(0,s.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:"Notes"})]})}),(0,s.jsx)(Z,{children:(0,s.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,s.jsx)("button",{onClick:()=>z(!0),className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full hover:bg-[var(--bg-secondary)] transition-colors",children:(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:[(0,s.jsx)("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("polyline",{points:"7 10 12 15 17 10",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("line",{x1:"12",y1:"15",x2:"12",y2:"3",className:"jsx-bc071752c54fb059"})]})}),(0,s.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:"Export"})]})}),(0,s.jsx)(Z,{children:(0,s.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,s.jsx)("button",{onClick:()=>{let e=(0,M.wy)(r,ej,c);navigator.clipboard.writeText(e).then(()=>{es(!0),setTimeout(()=>es(!1),2e3)})},style:{backgroundColor:er?"var(--bg-secondary)":"transparent"},className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full transition-colors",children:er?(0,s.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--accent)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:(0,s.jsx)("polyline",{points:"20 6 9 17 4 12",className:"jsx-bc071752c54fb059"})}):(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:[(0,s.jsx)("rect",{x:"9",y:"9",width:"13",height:"13",rx:"2",ry:"2",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("path",{d:"M5 15H4a2 2 0 01-2-2V4a2 2 0 012-2h9a2 2 0 012 2v1",className:"jsx-bc071752c54fb059"})]})}),(0,s.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:er?"Copied!":"Copy as Markdown"})]})}),(0,s.jsx)(Z,{children:(0,s.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,s.jsx)("button",{onClick:()=>$(!V),style:{backgroundColor:V?"var(--bg-secondary)":"transparent"},className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full transition-colors",children:(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:V?"var(--accent)":"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:[(0,s.jsx)("rect",{x:"3",y:"3",width:"7",height:"7",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("rect",{x:"14",y:"3",width:"7",height:"7",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("rect",{x:"14",y:"14",width:"7",height:"7",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("rect",{x:"3",y:"14",width:"7",height:"7",className:"jsx-bc071752c54fb059"})]})}),(0,s.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:"Columns"})]})}),(0,s.jsx)(Z,{children:(0,s.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,s.jsx)("button",{onClick:()=>et(e=>!e),style:{backgroundColor:ee?"var(--bg-secondary)":"transparent"},className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full transition-colors",children:(0,s.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:ee?"var(--accent)":"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:ee?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("line",{x1:"3",y1:"6",x2:"21",y2:"6",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("line",{x1:"3",y1:"12",x2:"21",y2:"12",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("line",{x1:"3",y1:"18",x2:"21",y2:"18",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("polyline",{points:"7 3 3 6 7 9",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("polyline",{points:"17 15 21 18 17 21",className:"jsx-bc071752c54fb059"})]}):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("line",{x1:"3",y1:"6",x2:"21",y2:"6",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("line",{x1:"3",y1:"12",x2:"21",y2:"12",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("line",{x1:"3",y1:"18",x2:"21",y2:"18",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("polyline",{points:"17 3 21 6 17 9",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("polyline",{points:"7 15 3 18 7 21",className:"jsx-bc071752c54fb059"})]})})}),(0,s.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:ee?"Collapse All":"Expand All"})]})}),(0,s.jsx)(Q,{orientation:"vertical",className:"h-full"}),(0,s.jsx)(Z,{children:(0,s.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,s.jsx)("button",{onClick:()=>K(!0),className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full hover:bg-[var(--bg-secondary)] transition-colors",children:(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:[(0,s.jsx)("path",{d:"M21 15v4a2 2 0 01-2 2H5a2 2 0 01-2-2v-4",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("polyline",{points:"17 8 12 3 7 8",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("line",{x1:"12",y1:"3",x2:"12",y2:"15",className:"jsx-bc071752c54fb059"})]})}),(0,s.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:"Import Cases"})]})}),(0,s.jsx)(Z,{children:(0,s.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,s.jsx)("button",{onClick:()=>q(!0),className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full hover:bg-[var(--bg-secondary)] transition-colors",children:(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"10",className:"jsx-bc071752c54fb059"}),(0,s.jsx)("polyline",{points:"12 6 12 12 16 14",className:"jsx-bc071752c54fb059"})]})}),(0,s.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:"E2E Test"})]})}),(0,s.jsx)(Z,{children:(0,s.jsxs)("div",{className:"jsx-bc071752c54fb059 relative group",children:[(0,s.jsx)("button",{onClick:()=>F(!0),className:"jsx-bc071752c54fb059 w-full h-full flex items-center justify-center rounded-full hover:bg-[var(--bg-secondary)] transition-colors",children:(0,s.jsx)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-secondary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-bc071752c54fb059",children:(0,s.jsx)("polygon",{points:"13 2 3 14 12 14 11 22 21 10 12 10 13 2",className:"jsx-bc071752c54fb059"})})}),(0,s.jsx)("div",{style:{backgroundColor:"var(--text-primary)",color:"var(--bg-primary)"},className:"jsx-bc071752c54fb059 absolute bottom-full left-1/2 -translate-x-1/2 mb-2 px-2 py-1 text-[10px] font-medium rounded whitespace-nowrap opacity-0 group-hover:opacity-100 transition-opacity pointer-events-none",children:"Generate"})]})})]})]}),(0,s.jsx)(R,{open:P,onClose:()=>z(!1),node:r,testCases:a,columns:c}),(0,s.jsx)(W,{open:T,onClose:()=>F(!1),node:r,onGenerate:eL}),(0,s.jsx)(B,{open:O,onClose:()=>X(!1),node:r,testCases:a,stats:i}),(0,s.jsx)(G,{open:_,onClose:()=>K(!1),onImport:eD,nodeLabel:r.label}),Y&&r&&(0,s.jsx)(H,{testCases:a,projectId:d,onClose:()=>q(!1)}),(0,s.jsx)(o(),{id:"bc071752c54fb059",children:"@keyframes fadeInUp{from{opacity:0;transform:translatey(8px)}to{opacity:1;transform:translatey(0)}}"})]}):(0,s.jsx)("div",{className:"h-full",children:(0,s.jsx)(y.p,{message:"Select a node from the mindmap to view its test cases."})})}function et(e){let{nodes:t,testCases:r,onSelectNode:a,onClose:o}=e,[n,i]=(0,l.useState)(""),[c,d]=(0,l.useState)(0),x=(0,l.useRef)(null),u=(0,l.useRef)(null);(0,l.useEffect)(()=>{var e;null==(e=x.current)||e.focus()},[]);let p=(0,l.useMemo)(()=>{if(!n.trim())return[];let e=n.toLowerCase().trim(),s=[];for(let o of t){var a;for(let t of null!=(a=r[o.id])?a:[]){let r=t.title.toLowerCase().includes(e),a=t.steps.toLowerCase().includes(e),l=t.expected.toLowerCase().includes(e),n=t.code.toLowerCase().includes(e);if(r||a||l||n){let e="title",r=t.title;a?(e="steps",r=t.steps):l?(e="expected",r=t.expected):n&&(e="code",r=t.code),s.push({node:o,testCase:t,matchField:e,matchText:r})}}}return s},[n,t,r]);(0,l.useEffect)(()=>{d(0)},[p.length]),(0,l.useEffect)(()=>{var e;u.current&&(null==(e=u.current.querySelectorAll("[data-search-item]")[c])||e.scrollIntoView({block:"nearest"}))},[c]);let m=(0,l.useCallback)(e=>{a(e.node.id),o()},[a,o]),h=(0,l.useCallback)(e=>{"Escape"===e.key?o():"ArrowDown"===e.key?(e.preventDefault(),d(e=>Math.min(e+1,p.length-1))):"ArrowUp"===e.key?(e.preventDefault(),d(e=>Math.max(e-1,0))):"Enter"===e.key&&p.length>0&&(e.preventDefault(),m(p[c]))},[p,c,m,o]),f=(e,t)=>{if(!t.trim())return e;let r=e.toLowerCase().indexOf(t.toLowerCase());if(-1===r)return e;let a=e.slice(0,r),o=e.slice(r,r+t.length),l=e.slice(r+t.length);return(0,s.jsxs)(s.Fragment,{children:[a.length>30&&"...",a.length>30?a.slice(-30):a,(0,s.jsx)("mark",{style:{backgroundColor:"var(--accent)",color:"#fff",borderRadius:2,padding:"0 1px"},children:o}),l.slice(0,40),l.length>40&&"..."]})},b={untested:{bg:"var(--status-untested-bg)",text:"var(--status-untested-text)"},pass:{bg:"var(--status-pass-bg)",text:"var(--status-pass-text)"},fail:{bg:"var(--status-fail-bg)",text:"var(--status-fail-text)"},skip:{bg:"var(--status-skip-bg)",text:"var(--status-skip-text)"}};return(0,s.jsx)("div",{className:"fixed inset-0 z-[350] flex items-start justify-center pt-[15vh]",style:{backgroundColor:"rgba(0,0,0,0.3)",animation:"fadeIn 150ms ease-out"},onClick:o,children:(0,s.jsxs)("div",{className:"w-full max-w-lg rounded-xl overflow-hidden",style:{backgroundColor:"var(--bg-card)",boxShadow:"var(--shadow-lg)"},onClick:e=>e.stopPropagation(),children:[(0,s.jsxs)("div",{className:"flex items-center gap-2 px-4 py-3 border-b",style:{borderColor:"var(--border)"},children:[(0,s.jsxs)("svg",{width:"16",height:"16",viewBox:"0 0 24 24",fill:"none",stroke:"var(--text-tertiary)",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",children:[(0,s.jsx)("circle",{cx:"11",cy:"11",r:"8"}),(0,s.jsx)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65"})]}),(0,s.jsx)("input",{ref:x,value:n,onChange:e=>i(e.target.value),onKeyDown:h,placeholder:"Search test cases...",className:"flex-1 bg-transparent outline-none text-sm",style:{color:"var(--text-primary)"}}),(0,s.jsx)("kbd",{className:"text-[10px] px-1.5 py-0.5 rounded border",style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},children:"ESC"})]}),(0,s.jsxs)("div",{ref:u,className:"max-h-[300px] overflow-y-auto",children:[n.trim()&&0===p.length&&(0,s.jsx)("div",{className:"px-4 py-8 text-center",children:(0,s.jsxs)("p",{className:"text-xs",style:{color:"var(--text-tertiary)"},children:["No test cases found for “",n,"”"]})}),p.map((e,t)=>{let r=b[e.testCase.status]||b.untested;return(0,s.jsxs)("div",{"data-search-item":!0,className:"flex items-start gap-3 px-4 py-2.5 cursor-pointer transition-colors",style:{backgroundColor:t===c?"var(--bg-secondary)":"transparent",borderLeft:t===c?"2px solid var(--accent)":"2px solid transparent"},onClick:()=>m(e),onMouseEnter:()=>d(t),children:[(0,s.jsx)("div",{className:"w-2 h-2 rounded-full mt-1.5 flex-shrink-0",style:{backgroundColor:r.text}}),(0,s.jsxs)("div",{className:"flex-1 min-w-0",children:[(0,s.jsx)("div",{className:"flex items-center gap-2 mb-0.5",children:(0,s.jsx)("span",{className:"text-[10px] font-mono truncate",style:{color:"var(--text-tertiary)"},children:e.node.code||e.node.label})}),(0,s.jsx)("div",{className:"text-xs font-medium truncate",style:{color:"var(--text-primary)"},children:f(e.testCase.title,n)}),"title"!==e.matchField&&(0,s.jsxs)("div",{className:"text-[11px] truncate mt-0.5",style:{color:"var(--text-tertiary)"},children:[(0,s.jsxs)("span",{className:"font-medium",style:{color:"var(--text-secondary)"},children:[e.matchField,":"]})," ",f(e.matchText,n)]})]}),(0,s.jsx)("span",{className:"text-[10px] font-medium px-1.5 py-0.5 rounded-full flex-shrink-0",style:{backgroundColor:r.bg,color:r.text},children:e.testCase.status})]},"".concat(e.node.id,"-").concat(e.testCase.id))})]}),n.trim()&&p.length>0&&(0,s.jsxs)("div",{className:"flex items-center gap-3 px-4 py-2 border-t",style:{borderColor:"var(--border)"},children:[(0,s.jsxs)("span",{className:"text-[10px]",style:{color:"var(--text-tertiary)"},children:[p.length," result",1!==p.length?"s":""]}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("kbd",{className:"text-[9px] px-1 py-0.5 rounded border",style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},children:"↑↓"}),(0,s.jsx)("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:"navigate"})]}),(0,s.jsxs)("div",{className:"flex items-center gap-1",children:[(0,s.jsx)("kbd",{className:"text-[9px] px-1 py-0.5 rounded border",style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},children:"↵"}),(0,s.jsx)("span",{className:"text-[9px]",style:{color:"var(--text-tertiary)"},children:"go to node"})]})]})]})})}function er(){var e,t,r,a,c,d,x;let u=(0,n.useParams)(),p=(0,n.useRouter)(),m=u.projectId,{projects:h,activeProject:f,activeProjectId:v,selectedNodeId:g,setSelectedNodeId:j,switchProject:k,mindmap:w,testCases:C,pushState:N,lastSaved:S,canUndo:L,canRedo:D,undo:E,redo:M,confirmDialog:R}=(0,i.M)(),A=null!=(t=h[m])?t:null,I=(0,l.useRef)(null),U=v===m?f:A;(0,l.useEffect)(()=>{h[m]&&I.current!==m&&(I.current=m,k(m))},[m,h,k]),(0,l.useEffect)(()=>{j(null)},[m,j]);let P=(0,l.useMemo)(()=>{var e;return null!=(e=null==U?void 0:U.flows.find(e=>e.id===g))?e:null},[U,g]),[z,T]=(0,l.useState)("mindmap"),[W,F]=(0,l.useState)(!1),[B,O]=(0,l.useState)(.5),[X,G]=(0,l.useState)(!1),[H,_]=(0,l.useState)(!1),[K,Y]=(0,l.useState)(!1),[q,V]=(0,l.useState)(!1),J=(0,l.useRef)(null),Z=(0,l.useRef)(null),$=(0,l.useRef)(null),Q=(0,l.useRef)(null),er=(0,l.useRef)({mouseX:0,startRatio:.5}),es=(0,l.useCallback)(e=>{e.preventDefault(),er.current={mouseX:e.clientX,startRatio:B},G(!0)},[B]);return((0,l.useEffect)(()=>{if(!X)return;let e=e=>{if(!J.current)return;let t=J.current.getBoundingClientRect(),r=(e.clientX-er.current.mouseX)/t.width;O(Math.max(.1,Math.min(.9,er.current.startRatio+r)))},t=()=>G(!1);return window.addEventListener("mousemove",e),window.addEventListener("mouseup",t),()=>{window.removeEventListener("mousemove",e),window.removeEventListener("mouseup",t)}},[X]),(0,l.useEffect)(()=>{let e=e=>{(e.metaKey||e.ctrlKey)&&"k"===e.key&&(e.preventDefault(),F(e=>!e))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[]),A)?U?(0,s.jsxs)("div",{className:"jsx-a894832df36b68ca h-full flex flex-col",children:[(0,s.jsxs)("div",{style:{borderColor:"var(--border)",backgroundColor:"var(--bg-card)"},className:"jsx-a894832df36b68ca flex md:hidden border-b flex-shrink-0",children:[(0,s.jsx)("button",{onClick:()=>T("mindmap"),style:{color:"mindmap"===z?"var(--accent)":"var(--text-tertiary)",borderBottom:"mindmap"===z?"2px solid var(--accent)":"2px solid transparent"},className:"jsx-a894832df36b68ca flex-1 px-4 py-2 text-xs font-medium transition-colors",children:"Mindmap"}),(0,s.jsx)("button",{onClick:()=>T("testcases"),style:{color:"testcases"===z?"var(--accent)":"var(--text-tertiary)",borderBottom:"testcases"===z?"2px solid var(--accent)":"2px solid transparent"},className:"jsx-a894832df36b68ca flex-1 px-4 py-2 text-xs font-medium transition-colors",children:"Test Cases"})]}),(0,s.jsxs)("div",{style:{borderColor:"var(--border)"},className:"jsx-a894832df36b68ca flex items-center justify-between px-4 py-1.5 border-b flex-shrink-0",children:[(0,s.jsx)("div",{style:{color:"var(--text-tertiary)"},className:"jsx-a894832df36b68ca text-[10px]",children:S?(0,s.jsxs)("span",{className:"jsx-a894832df36b68ca",children:["Last saved ",function(e){let t=new Date(e),r=Math.floor((new Date().getTime()-t.getTime())/1e3),s=Math.floor(r/60),a=Math.floor(s/60);return r<10?"just now":r<60?"".concat(r,"s ago"):s<60?"".concat(s,"m ago"):a<24?"".concat(a,"h ago"):t.toLocaleDateString("en-US",{month:"short",day:"numeric",hour:"2-digit",minute:"2-digit"})}(S)]}):(0,s.jsx)("span",{className:"jsx-a894832df36b68ca",children:"Not saved yet"})}),(0,s.jsxs)("div",{className:"jsx-a894832df36b68ca flex items-center gap-2",children:[(0,s.jsxs)("button",{onClick:()=>F(!0),style:{borderColor:"var(--border)",color:"var(--text-tertiary)"},title:"Search test cases (Ctrl+K)",className:"jsx-a894832df36b68ca flex items-center gap-1.5 px-2 py-1 rounded-md border text-[11px] transition-colors hover:bg-[var(--bg-secondary)]",children:[(0,s.jsxs)("svg",{width:"12",height:"12",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-a894832df36b68ca",children:[(0,s.jsx)("circle",{cx:"11",cy:"11",r:"8",className:"jsx-a894832df36b68ca"}),(0,s.jsx)("line",{x1:"21",y1:"21",x2:"16.65",y2:"16.65",className:"jsx-a894832df36b68ca"})]}),(0,s.jsx)("span",{className:"jsx-a894832df36b68ca hidden sm:inline",children:"Search"}),(0,s.jsx)("kbd",{style:{borderColor:"var(--border)",backgroundColor:"var(--bg-secondary)"},className:"jsx-a894832df36b68ca text-[9px] px-1 py-0.5 rounded border ml-1 hidden sm:inline",children:"⌘K"})]}),(0,s.jsx)("button",{onClick:()=>Y(e=>!e),style:{color:"var(--text-tertiary)"},title:K?"Exit fullscreen":"Expand test cases",className:"jsx-a894832df36b68ca p-1 rounded transition-colors hover:bg-[var(--bg-secondary)]",children:K?(0,s.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-a894832df36b68ca",children:(0,s.jsx)("path",{d:"M8 3v3a2 2 0 01-2 2H3m18 0h-3a2 2 0 01-2-2V3m0 18v-3a2 2 0 012-2h3M3 16h3a2 2 0 012 2v3",className:"jsx-a894832df36b68ca"})}):(0,s.jsx)("svg",{width:"14",height:"14",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round",className:"jsx-a894832df36b68ca",children:(0,s.jsx)("path",{d:"M8 3H5a2 2 0 00-2 2v3m18 0V5a2 2 0 00-2-2h-3m0 18h3a2 2 0 002-2v-3M3 16v3a2 2 0 002 2h3",className:"jsx-a894832df36b68ca"})})}),(0,s.jsx)("button",{onClick:()=>p.push("/projects/".concat(m,"/summary")),style:{borderColor:"var(--border)",color:"var(--text-secondary)"},className:"jsx-a894832df36b68ca hidden md:block px-3 py-1 text-xs font-medium rounded-md border transition-colors hover:bg-[var(--bg-secondary)]",children:"Project Report"}),(0,s.jsx)("button",{onClick:()=>{V(!0),setTimeout(()=>V(!1),1500);let e=new Event("save-project");window.dispatchEvent(e)},style:{borderColor:q?"var(--status-pass-text)":"var(--border)",color:q?"var(--status-pass-text)":"var(--text-secondary)",backgroundColor:q?"var(--status-pass-bg)":"transparent"},className:"jsx-a894832df36b68ca px-3 py-1 text-xs font-medium rounded-md border transition-all",children:q?"Saved!":"Save"})]})]}),(0,s.jsxs)("div",{ref:J,style:{cursor:X?"col-resize":void 0},className:"jsx-a894832df36b68ca flex-1 flex min-h-0 relative",children:[!K&&(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("div",{ref:Z,style:{width:"".concat(100*B,"%")},className:"jsx-a894832df36b68ca "+"\n ".concat("mindmap"===z?"flex":"hidden","\n md:flex flex-col min-w-0 mobile-full-width\n "),children:(0,s.jsx)(b,{nodes:w.nodes,edges:w.edges,testCases:null!=(r=U.testCases)?r:{},selectedNodeId:g,onSelect:w.selectNode,onAddNode:(e,t,r,s)=>{N("Add node"),w.addNode(e,t,r,s)},onDeleteNode:e=>{N("Delete node"),w.deleteNode(e)},onDeleteNodes:e=>{N("Delete nodes"),w.deleteNodes(e)},onUnlinkNode:e=>{N("Unlink node"),w.unlinkNode(e)},onRenameNode:(e,t)=>{N("Rename node"),w.renameNode(e,t)},onUpdateNode:(e,t)=>{N("Update node"),w.updateNode(e,t)},onAddEdge:(e,t,r)=>{N("Add edge"),w.addEdge(e,t,r)},onDeleteEdge:e=>{N("Delete edge"),w.deleteEdge(e)},onUpdateEdge:(e,t)=>{N("Update edge"),w.updateEdge(e,t)},onResetLayout:()=>{N("Reset layout"),w.resetLayout()},canUndo:L,canRedo:D,onUndo:E,onRedo:M})}),(0,s.jsxs)("div",{ref:Q,style:{width:20,cursor:"col-resize"},onMouseDown:es,onMouseEnter:()=>_(!0),onMouseLeave:()=>_(!1),className:"jsx-a894832df36b68ca hidden md:flex items-center justify-center flex-shrink-0 select-none relative group",children:[(0,s.jsx)("div",{style:{backgroundColor:H||X?"var(--bg-secondary)":"transparent"},className:"jsx-a894832df36b68ca absolute inset-y-0 -left-2 -right-2 transition-colors duration-150"}),(0,s.jsx)("div",{style:{backgroundColor:"var(--border)",opacity:H||X?0:1},className:"jsx-a894832df36b68ca absolute inset-y-0 left-1/2 -translate-x-1/2 w-[1px] transition-opacity duration-150"}),(0,s.jsx)("div",{style:{background:"linear-gradient(180deg, #9E7AFF 0%, #FE8BBB 50%, #9E7AFF 100%)",opacity:H||X?.8:.4,animation:"beamFlow 3s ease-in-out infinite",backgroundSize:"100% 200%"},className:"jsx-a894832df36b68ca absolute inset-y-0 left-1/2 -translate-x-1/2 w-[2px] transition-opacity duration-150"}),(0,s.jsxs)("div",{className:"jsx-a894832df36b68ca relative z-10 flex flex-col gap-1.5",children:[(0,s.jsx)("div",{style:{backgroundColor:H||X?"var(--text-secondary)":"var(--text-tertiary)"},className:"jsx-a894832df36b68ca w-1.5 h-1.5 rounded-full transition-colors duration-150"}),(0,s.jsx)("div",{style:{backgroundColor:H||X?"var(--text-secondary)":"var(--text-tertiary)"},className:"jsx-a894832df36b68ca w-1.5 h-1.5 rounded-full transition-colors duration-150"}),(0,s.jsx)("div",{style:{backgroundColor:H||X?"var(--text-secondary)":"var(--text-tertiary)"},className:"jsx-a894832df36b68ca w-1.5 h-1.5 rounded-full transition-colors duration-150"})]})]})]}),(0,s.jsx)("div",{ref:$,style:{width:K?"100%":"".concat((1-B)*100,"%")},className:"jsx-a894832df36b68ca "+"\n ".concat("testcases"===z?"flex":"hidden","\n md:flex flex-col min-w-0 mobile-full-width\n "),children:(0,s.jsx)(ee,{selectedNode:P,testCases:C.testCases,stats:C.stats,columns:g?null!=(c=null!=(a=null==(e=U.columnConfigs)?void 0:e[g])?a:U.columnConfig)?c:[]:null!=(d=U.columnConfig)?d:[],projectId:m,fullscreen:K,onAddTestCase:C.addTestCase,onUpdateTestCase:C.updateTestCase,onDeleteTestCase:C.deleteTestCase,onBulkDelete:C.bulkDeleteTestCases,onBulkUpdate:C.bulkUpdateTestCases,onReorderTestCases:C.reorderTestCases,onToggleColumn:C.toggleColumnVisibility,onRenameColumn:C.updateColumnConfig,onUpdateNode:w.updateNode,onAddColumn:C.addColumn,onDeleteColumn:C.deleteColumn,onReorderColumn:C.reorderColumn,confirmDialog:R})})]}),(0,s.jsx)(o(),{id:"a894832df36b68ca",children:"@media(max-width:767px){.mobile-full-width.jsx-a894832df36b68ca{width:100%!important}}"}),W&&U&&(0,s.jsx)(et,{nodes:U.flows,testCases:null!=(x=U.testCases)?x:{},onSelectNode:e=>{j(e),w.selectNode(e)},onClose:()=>F(!1)})]}):(0,s.jsx)("div",{className:"flex items-center justify-center h-full",children:(0,s.jsx)("div",{className:"text-sm",style:{color:"var(--text-tertiary)"},children:"Loading project..."})}):(0,s.jsx)(y.p,{message:"Project not found.",action:{label:"Back to Projects",onClick:()=>p.push("/projects")}})}},1868:(e,t,r)=>{Promise.resolve().then(r.bind(r,882))},3362:(e,t,r)=>{"use strict";r.d(t,{Pj:()=>s});let s=Object.values({openai:{id:"openai",name:"OpenAI",type:"native",description:"GPT models powering ChatGPT. Industry-leading language understanding.",logoUrl:"https://cdn.jsdelivr.net/gh/simple-icons/simple-icons/icons/openai.svg",keyUrl:"https://platform.openai.com/api-keys",keyPlaceholder:"sk-...",color:"#10A37F",sdkProvider:"openai",defaultModel:"gpt-4o-mini",popularModels:["gpt-4o","gpt-4o-mini","gpt-4-turbo","gpt-3.5-turbo"]},google:{id:"google",name:"Google Gemini",type:"native",description:"Google's multimodal AI with strong reasoning capabilities.",logoUrl:"https://cdn.jsdelivr.net/gh/simple-icons/simple-icons/icons/googlegemini.svg",keyUrl:"https://aistudio.google.com/apikey",keyPlaceholder:"AIza...",color:"#4285F4",sdkProvider:"google",defaultModel:"gemini-2.5-flash",popularModels:["gemini-2.5-flash","gemini-2.5-pro","gemini-2.0-flash"]},anthropic:{id:"anthropic",name:"Anthropic",type:"native",description:"Claude models — safe, steerable, and highly capable.",logoUrl:"https://cdn.jsdelivr.net/gh/simple-icons/simple-icons/icons/anthropic.svg",keyUrl:"https://console.anthropic.com/settings/keys",keyPlaceholder:"sk-ant-...",color:"#D97706",sdkProvider:"anthropic",defaultModel:"claude-sonnet-4-20250514",popularModels:["claude-sonnet-4-20250514","claude-haiku-4-20250514","claude-3-5-sonnet-20241022"]},deepseek:{id:"deepseek",name:"DeepSeek",type:"openai-compatible",description:"High-performance open-source models with competitive reasoning.",logoUrl:"https://cdn.jsdelivr.net/gh/simple-icons/simple-icons/icons/deepseek.svg",keyUrl:"https://platform.deepseek.com/api_keys",keyPlaceholder:"sk-...",color:"#4D6BFE",sdkProvider:"openai",baseURL:"https://api.deepseek.com/v1",defaultModel:"deepseek-chat",popularModels:["deepseek-chat","deepseek-reasoner"]},xiaomi:{id:"xiaomi",name:"Xiaomi (MiMo)",type:"openai-compatible",description:"Xiaomi's MiMo models — OpenAI-compatible API.",logoUrl:"https://cdn.jsdelivr.net/gh/simple-icons/simple-icons/icons/xiaomi.svg",keyUrl:"https://platform.xiaomimimo.com/",keyPlaceholder:"tp-...",color:"#FF6900",sdkProvider:"openai",baseURL:"https://token-plan-sgp.xiaomimimo.com/v1",defaultModel:"mimo-v2.5",popularModels:["mimo-v2.5","mimo-v2.5-pro"]},openrouter:{id:"openrouter",name:"OpenRouter",type:"openai-compatible",description:"Unified gateway to 200+ models — Claude, Llama, Mistral, Gemini, and more.",logoUrl:"https://cdn.jsdelivr.net/gh/simple-icons/simple-icons/icons/openrouter.svg",keyUrl:"https://openrouter.ai/keys",keyPlaceholder:"sk-or-...",color:"#6366F1",sdkProvider:"openai",baseURL:"https://openrouter.ai/api/v1",defaultModel:"openrouter/free",popularModels:["openrouter/free","meta-llama/llama-4-maverick:free","google/gemini-2.5-flash:free","deepseek/deepseek-chat-v3-0324:free","mistralai/mistral-small-3.2-24b:free","qwen/qwen3-235b-a22b:free","microsoft/phi-4-reasoning-plus:free"]},groq:{id:"groq",name:"Groq",type:"native",description:"Ultra-fast inference with LPU hardware. Blazing speed for Llama, Mixtral, and Gemma models.",logoUrl:"https://cdn.jsdelivr.net/gh/simple-icons/simple-icons/icons/groq.svg",keyUrl:"https://console.groq.com/keys",keyPlaceholder:"gsk_...",color:"#F55036",sdkProvider:"groq",defaultModel:"llama-3.3-70b-versatile",popularModels:["llama-3.3-70b-versatile","llama-3.1-8b-instant","mixtral-8x7b-32768","gemma2-9b-it","meta-llama/llama-4-scout-17b-16e-instruct","qwen-qwq-32b"]},custom:{id:"custom",name:"Custom (OpenAI-compatible)",type:"openai-compatible",description:"Any OpenAI-compatible API — Ollama, LM Studio, vLLM, LiteLLM, etc.",logoUrl:"",keyUrl:"",keyPlaceholder:"sk-... or any key",color:"#6B7280",sdkProvider:"openai",defaultModel:"",popularModels:[],requiresBaseURL:!0}})},4269:(e,t,r)=>{"use strict";r.d(t,{cn:()=>o});var s=r(2821),a=r(5889);function o(){for(var e=arguments.length,t=Array(e),r=0;r<e;r++)t[r]=arguments[r];return(0,a.QP)((0,s.$)(t))}},5815:(e,t,r)=>{"use strict";r.d(t,{p:()=>a});var s=r(5155);function a(e){let{message:t,action:r}=e;return(0,s.jsxs)("div",{className:"flex flex-col items-center justify-center h-full gap-4 px-6 text-center",children:[(0,s.jsx)("img",{src:"https://static.vecteezy.com/system/resources/thumbnails/067/162/149/small/cute-duck-meme-sticker-transparent-cute-illustration-free-png.png",alt:"",className:"w-28 h-28 object-contain select-none opacity-15",draggable:!1}),(0,s.jsx)("p",{className:"text-sm max-w-[280px]",style:{color:"var(--text-tertiary)"},children:t}),r&&(0,s.jsx)("button",{onClick:r.onClick,className:"px-4 py-2 text-sm font-medium rounded-md transition-opacity hover:opacity-80",style:{backgroundColor:"var(--accent)",color:"var(--bg-primary)",borderRadius:"var(--radius-pill)"},children:r.label})]})}},7669:(e,t,r)=>{"use strict";r.d(t,{P:()=>d});var s=r(2115),a=r(3362);let o="qa-llm-config",l={apiKey:"",baseURL:"",defaultModel:"",secondaryModel:"",models:[],connected:!1};function n(){let e={};for(let t of a.Pj)e[t.id]={...l,baseURL:t.baseURL||""};return{activeProvider:null,providers:e}}function i(){try{let t=localStorage.getItem(o);if(!t)return n();let r=JSON.parse(t);if(r.provider&&r.apiKey&&!r.providers){let e=n();return{...e,activeProvider:null,providers:{...e.providers,google:{...l,apiKey:r.apiKey,connected:!0}}}}let s=n(),i={...s,...r,providers:{...s.providers}};for(let t of a.Pj){var e;let s=null==(e=r.providers)?void 0:e[t.id];i.providers[t.id]={...l,baseURL:t.baseURL||"",...s}}return i}catch(e){return n()}}function c(e){try{localStorage.setItem(o,JSON.stringify(e))}catch(e){}}function d(){let[e,t]=(0,s.useState)(n),[r,a]=(0,s.useState)(!1);(0,s.useEffect)(()=>{t(i()),a(!0)},[]);let o=(0,s.useCallback)((e,r)=>{let s=i(),a={...s,providers:{...s.providers,[e]:{...s.providers[e],...r}}};c(a),t(a)},[]),l=(0,s.useCallback)(e=>{let r={...i(),activeProvider:e};c(r),t(r)},[]),d=e.activeProvider?e.providers[e.activeProvider]:null,x=r&&!!d&&d.apiKey.length>0&&d.connected;return{config:e,loaded:r,isConnected:x,activeProvider:d,activeProviderId:e.activeProvider,updateProvider:o,setActiveProvider:l}}}},e=>{e.O(0,[343,909,485,637,532,246,441,255,358],()=>e(e.s=1868)),_N_E=e.O()}]);