copilot-operator 0.1.52 → 0.1.54

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 (154) hide show
  1. package/README.md +23 -1
  2. package/dist/src/api/operator.controller.js +71 -2
  3. package/dist/src/api/operator.service.js +99 -7
  4. package/dist/src/config/schema.js +32 -0
  5. package/dist/src/exec/policy.js +11 -1
  6. package/dist/src/exec/scriptFiles.js +108 -2
  7. package/dist/src/orchestrator/leadRunner.js +50 -4
  8. package/dist/src/orchestrator/review.js +9 -3
  9. package/dist/src/orchestrator/taskRunner.js +55 -3
  10. package/dist/src/plan/kerrigan.js +35 -4
  11. package/dist/src/plan/systemGuide.js +234 -4
  12. package/dist/src/session/compose.js +16 -4
  13. package/dist/src/session/store.js +3 -0
  14. package/dist/src/session/workspace.js +22 -0
  15. package/dist/src/session/workspaceSearch.js +162 -0
  16. package/dist/src/util/pacing.js +33 -2
  17. package/dist/src/vcs/git.js +12 -2
  18. package/dist/src/vcs/referenceGuard.js +299 -0
  19. package/dist/web/404.html +3 -2
  20. package/dist/web/_next/static/{_1zhoDsMOPAH2xW702E5A → WuIGWiKKh_ESR3KwzsLZF}/_buildManifest.js +1 -1
  21. package/dist/web/_next/static/chunks/1017.ce926873b598fb89.js +1 -0
  22. package/dist/web/_next/static/chunks/1077.ae2fd686ef05572e.js +1 -0
  23. package/dist/web/_next/static/chunks/12.06a7f14bd6716249.js +1 -0
  24. package/dist/web/_next/static/chunks/1350.a5dc706c8110fd34.js +24 -0
  25. package/dist/web/_next/static/chunks/1548.bd558d3f2c8df4af.js +1 -0
  26. package/dist/web/_next/static/chunks/1706.db51b57351297898.js +309 -0
  27. package/dist/web/_next/static/chunks/1707.7d64ffc060c697a0.js +193 -0
  28. package/dist/web/_next/static/chunks/1880.87829ecb91209eda.js +24 -0
  29. package/dist/web/_next/static/chunks/20154aaa.28032c3aa5bcd84d.js +1 -0
  30. package/dist/web/_next/static/chunks/2037.d1bb5e37c7fe85ae.js +104 -0
  31. package/dist/web/_next/static/chunks/2163.b41334711ddcceff.js +1 -0
  32. package/dist/web/_next/static/chunks/2398d077.79ae940919b9695e.js +1 -0
  33. package/dist/web/_next/static/chunks/2435.9b433b38d34b4b2e.js +1 -0
  34. package/dist/web/_next/static/chunks/2506.bc8515842e225d2a.js +1 -0
  35. package/dist/web/_next/static/chunks/2529.c88688b437d71d68.js +41 -0
  36. package/dist/web/_next/static/chunks/2908.4e0e875d2d471932.js +1 -0
  37. package/dist/web/_next/static/chunks/3117.a4e1c3348e8bead9.js +1 -0
  38. package/dist/web/_next/static/chunks/3131-8ec8b632ebf0450d.js +1 -0
  39. package/dist/web/_next/static/chunks/3134-b6a7bc1f267c39aa.js +1 -0
  40. package/dist/web/_next/static/chunks/3233.1dcc2798f7f5efa0.js +149 -0
  41. package/dist/web/_next/static/chunks/344.41cc997c8c8deeed.js +115 -0
  42. package/dist/web/_next/static/chunks/3690.f691d3fcbd70073d.js +1 -0
  43. package/dist/web/_next/static/chunks/3804.593b14643e74a2a1.js +1 -0
  44. package/dist/web/_next/static/chunks/3816.9f5568918e35e4ef.js +77 -0
  45. package/dist/web/_next/static/chunks/3859.f56f3c6ac4b74cf1.js +94 -0
  46. package/dist/web/_next/static/chunks/3976.11b159e82e0aa974.js +1 -0
  47. package/dist/web/_next/static/chunks/3986.d47ed4855773e6dd.js +1 -0
  48. package/dist/web/_next/static/chunks/441.172f3f581f0030d1.js +226 -0
  49. package/dist/web/_next/static/chunks/442.2e236a6c5c413bd9.js +1 -0
  50. package/dist/web/_next/static/chunks/4459.d6df347eb58fccd7.js +1 -0
  51. package/dist/web/_next/static/chunks/4619.ae3628373decf74f.js +34 -0
  52. package/dist/web/_next/static/chunks/4623.d5711a8d967e49f4.js +1 -0
  53. package/dist/web/_next/static/chunks/4670.6b811cc3f67a851c.js +62 -0
  54. package/dist/web/_next/static/chunks/4812.0af1380aa478f6d3.js +93 -0
  55. package/dist/web/_next/static/chunks/4969.4f7aff472cf938bf.js +1 -0
  56. package/dist/web/_next/static/chunks/5790.fe114d1a18741d62.js +86 -0
  57. package/dist/web/_next/static/chunks/603.4055460889ea24d8.js +1 -0
  58. package/dist/web/_next/static/chunks/6072.b4b359b24b1738d4.js +286 -0
  59. package/dist/web/_next/static/chunks/6230.8645bbed143793da.js +1 -0
  60. package/dist/web/_next/static/chunks/6260.6b5b5c9713d7133f.js +1 -0
  61. package/dist/web/_next/static/chunks/63b9f8e2.218fd437b256a7e4.js +1 -0
  62. package/dist/web/_next/static/chunks/6421.3ace3aefc3e7350e.js +1 -0
  63. package/dist/web/_next/static/chunks/6542.963ec591b5c2bc5a.js +1 -0
  64. package/dist/web/_next/static/chunks/6885.8fb8eeb9e792b515.js +1 -0
  65. package/dist/web/_next/static/chunks/6891.dd910309748ad46b.js +1 -0
  66. package/dist/web/_next/static/chunks/714.cb77983f9be215c9.js +1 -0
  67. package/dist/web/_next/static/chunks/7220.072a60cd9d60220a.js +1 -0
  68. package/dist/web/_next/static/chunks/7307.39c27470a879fd0a.js +1 -0
  69. package/dist/web/_next/static/chunks/7333.04d0e45b223dadd4.js +32 -0
  70. package/dist/web/_next/static/chunks/7489.395193bf37b80884.js +1 -0
  71. package/dist/web/_next/static/chunks/7496.17282033df0e8794.js +148 -0
  72. package/dist/web/_next/static/chunks/7500-f90e2ae7061e351d.js +1 -0
  73. package/dist/web/_next/static/chunks/7507.9fd648884587a7f3.js +287 -0
  74. package/dist/web/_next/static/chunks/76.f9c2aea58a61692f.js +1 -0
  75. package/dist/web/_next/static/chunks/7664.bd6265e6e94e1ecd.js +79 -0
  76. package/dist/web/_next/static/chunks/7872.9b08a88b7289949f.js +64 -0
  77. package/dist/web/_next/static/chunks/7921-54dae769aa8bae96.js +1 -0
  78. package/dist/web/_next/static/chunks/795.710d39b80c9ae80c.js +1 -0
  79. package/dist/web/_next/static/chunks/8173.b82aa1855e641605.js +1 -0
  80. package/dist/web/_next/static/chunks/8216.b248ebe0af447347.js +8 -0
  81. package/dist/web/_next/static/chunks/82d3f3cb.23be11b749288234.js +62 -0
  82. package/dist/web/_next/static/chunks/8381.2d6783c030f8a913.js +27 -0
  83. package/dist/web/_next/static/chunks/85120a0e.ac16dccf0b8d73d3.js +66 -0
  84. package/dist/web/_next/static/chunks/8547.0a9997b67008c706.js +1 -0
  85. package/dist/web/_next/static/chunks/8584.9d5d6c09b0375015.js +1 -0
  86. package/dist/web/_next/static/chunks/8662.f2663643214caed1.js +38 -0
  87. package/dist/web/_next/static/chunks/8689.e564346c6e0d16be.js +1 -0
  88. package/dist/web/_next/static/chunks/9067.832c4761a991f2c2.js +1 -0
  89. package/dist/web/_next/static/chunks/9125.8589db5ba200cbf1.js +1 -0
  90. package/dist/web/_next/static/chunks/9202.8dcf7e6a85cc3d36.js +1 -0
  91. package/dist/web/_next/static/chunks/9249.916a423ac8a07e76.js +1 -0
  92. package/dist/web/_next/static/chunks/9313.e4f6405d96375c40.js +92 -0
  93. package/dist/web/_next/static/chunks/937.6d8406b06135134f.js +1 -0
  94. package/dist/web/_next/static/chunks/9418.1e8f8e14bb5fe3ae.js +217 -0
  95. package/dist/web/_next/static/chunks/9591.fabd60bd0d10341c.js +1 -0
  96. package/dist/web/_next/static/chunks/972.db753db904050e48.js +23 -0
  97. package/dist/web/_next/static/chunks/9747.c8d4ba56c9eef95f.js +1 -0
  98. package/dist/web/_next/static/chunks/9763.da9015d4a1b533b9.js +36 -0
  99. package/dist/web/_next/static/chunks/9884.8712c5ed7b044ff2.js +1 -0
  100. package/dist/web/_next/static/chunks/9891.91a2c59fd073fd48.js +74 -0
  101. package/dist/web/_next/static/chunks/9984.cdabea5a592e42a1.js +1 -0
  102. package/dist/web/_next/static/chunks/a9ddb983.8bbb677720017a57.js +122 -0
  103. package/dist/web/_next/static/chunks/app/_not-found/page-1264c0db9665169c.js +1 -0
  104. package/dist/web/_next/static/chunks/app/defaults/page-a1f90fe37e302928.js +1 -0
  105. package/dist/web/_next/static/chunks/app/layout-46efb208d7c88648.js +1 -0
  106. package/dist/web/_next/static/chunks/app/page-57787f15774d76b8.js +1 -0
  107. package/dist/web/_next/static/chunks/app/system/page-825f53f14d16033d.js +1 -0
  108. package/dist/web/_next/static/chunks/c7879cf7-fabe25011515220e.js +1 -0
  109. package/dist/web/_next/static/chunks/c7ea4e13.9b71b5f026a1d6d4.js +1 -0
  110. package/dist/web/_next/static/chunks/f99cb6a2.3f570aeba3860608.js +160 -0
  111. package/dist/web/_next/static/chunks/framework-a8bf4d38dd23845f.js +1 -0
  112. package/dist/web/_next/static/chunks/main-app-f747f0f5ddb4213b.js +1 -0
  113. package/dist/web/_next/static/chunks/main-d3bbfb91b54fbcc3.js +1 -0
  114. package/dist/web/_next/static/chunks/pages/_app-5b348989bba3d570.js +1 -0
  115. package/dist/web/_next/static/chunks/pages/_error-cf88c6d2cc5868d7.js +1 -0
  116. package/dist/web/_next/static/chunks/webpack-cb74fa884b8af278.js +1 -0
  117. package/dist/web/_next/static/css/d3398f485b2a9075.css +1 -0
  118. package/dist/web/defaults.html +3 -2
  119. package/dist/web/defaults.txt +16 -16
  120. package/dist/web/index.html +4 -2
  121. package/dist/web/index.txt +16 -16
  122. package/dist/web/system.html +3 -2
  123. package/dist/web/system.txt +16 -16
  124. package/package.json +8 -2
  125. package/prompts/level1.md +32 -12
  126. package/prompts/review1.md +287 -286
  127. package/dist/web/_next/static/chunks/12.f1f4d35b52633e8d.js +0 -1
  128. package/dist/web/_next/static/chunks/131-bae98f790a541679.js +0 -1
  129. package/dist/web/_next/static/chunks/134-ddd50a7fbb536ec8.js +0 -1
  130. package/dist/web/_next/static/chunks/163.dbd7d36584d0bb37.js +0 -1
  131. package/dist/web/_next/static/chunks/220.35531b39410e1a9f.js +0 -1
  132. package/dist/web/_next/static/chunks/489.158bbe303a595fba.js +0 -1
  133. package/dist/web/_next/static/chunks/548.71ac96c94136659b.js +0 -1
  134. package/dist/web/_next/static/chunks/584.6df695c5b86a75aa.js +0 -1
  135. package/dist/web/_next/static/chunks/67.9ed79e2fbfb56f26.js +0 -1
  136. package/dist/web/_next/static/chunks/714.1e2338736a70b9c7.js +0 -1
  137. package/dist/web/_next/static/chunks/747.d2c1249d736dc03b.js +0 -1
  138. package/dist/web/_next/static/chunks/77.a200abef0f5b4a7f.js +0 -1
  139. package/dist/web/_next/static/chunks/808-bc7d7eac6d823291.js +0 -1
  140. package/dist/web/_next/static/chunks/921-dc5538cd779c6432.js +0 -1
  141. package/dist/web/_next/static/chunks/app/_not-found/page-0d0d8e7e62efca12.js +0 -1
  142. package/dist/web/_next/static/chunks/app/defaults/page-edd7534ca9ecf366.js +0 -1
  143. package/dist/web/_next/static/chunks/app/layout-8f99a164d76897a0.js +0 -1
  144. package/dist/web/_next/static/chunks/app/page-4bed816eda370d0c.js +0 -1
  145. package/dist/web/_next/static/chunks/app/system/page-1cf9e75e76da59ed.js +0 -1
  146. package/dist/web/_next/static/chunks/c7879cf7-b5ab1053c1d9a2e7.js +0 -1
  147. package/dist/web/_next/static/chunks/framework-9ac6a346bd42cedd.js +0 -1
  148. package/dist/web/_next/static/chunks/main-6be4444e2d667e41.js +0 -1
  149. package/dist/web/_next/static/chunks/main-app-e3a5f713ba31557e.js +0 -1
  150. package/dist/web/_next/static/chunks/pages/_app-32d20d5a04949d29.js +0 -1
  151. package/dist/web/_next/static/chunks/pages/_error-abbab53f25ea29b0.js +0 -1
  152. package/dist/web/_next/static/chunks/webpack-77147e31d2125631.js +0 -1
  153. package/dist/web/_next/static/css/3bea264adc472bc8.css +0 -1
  154. /package/dist/web/_next/static/{_1zhoDsMOPAH2xW702E5A → WuIGWiKKh_ESR3KwzsLZF}/_ssgManifest.js +0 -0
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[9492],{12768:(e,t,l)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"HTTPAccessErrorFallback",{enumerable:!0,get:function(){return o}});let r=l(73365),n=l(13799);function o(e){let{status:t,message:l}=e;return(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("title",{children:t+": "+l}),(0,r.jsx)("div",{style:n.styles.error,children:(0,r.jsxs)("div",{children:[(0,r.jsx)("style",{dangerouslySetInnerHTML:{__html:"body{color:#000;background:#fff;margin:0}.next-error-h1{border-right:1px solid rgba(0,0,0,.3)}@media (prefers-color-scheme:dark){body{color:#fff;background:#000}.next-error-h1{border-right:1px solid rgba(255,255,255,.3)}}"}}),(0,r.jsx)("h1",{className:"next-error-h1",style:n.styles.h1,children:t}),(0,r.jsx)("div",{style:n.styles.desc,children:(0,r.jsx)("h2",{style:n.styles.h2,children:l})})]})})]})}("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},13799:(e,t)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"styles",{enumerable:!0,get:function(){return l}});let l={error:{fontFamily:'system-ui,"Segoe UI",Roboto,Helvetica,Arial,sans-serif,"Apple Color Emoji","Segoe UI Emoji"',height:"100vh",textAlign:"center",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center"},desc:{display:"inline-block"},h1:{display:"inline-block",margin:"0 20px 0 0",padding:"0 23px 0 0",fontSize:24,fontWeight:500,verticalAlign:"top",lineHeight:"49px"},h2:{fontSize:14,fontWeight:400,lineHeight:"49px",margin:0}};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},14086:(e,t,l)=>{"use strict";Object.defineProperty(t,"__esModule",{value:!0}),Object.defineProperty(t,"default",{enumerable:!0,get:function(){return o}});let r=l(73365),n=l(12768),o=function(){return(0,r.jsx)("html",{children:(0,r.jsx)("body",{children:(0,r.jsx)(n.HTTPAccessErrorFallback,{status:404,message:"This page could not be found."})})})};("function"==typeof t.default||"object"==typeof t.default&&null!==t.default)&&void 0===t.default.__esModule&&(Object.defineProperty(t.default,"__esModule",{value:!0}),Object.assign(t.default,t),e.exports=t.default)},64509:(e,t,l)=>{(window.__NEXT_P=window.__NEXT_P||[]).push(["/_not-found/page",function(){return l(14086)}])}},e=>{e.O(0,[2347,3131,7358],()=>e(e.s=64509)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1189],{5462:(e,l,t)=>{"use strict";t.d(l,{f:()=>i,q:()=>s});var a=t(73365),n=t(1521);function i(){let e=arguments.length>0&&void 0!==arguments[0]?arguments[0]:"below",[l,t]=(0,n.useState)(!1),a=(0,n.useRef)(null),i=(0,n.useRef)(null),s=(0,n.useId)(),[r,o]=(0,n.useState)({visibility:"hidden"}),c=(0,n.useCallback)(()=>t(!1),[]),d=(0,n.useCallback)(()=>t(e=>!e),[]);return(0,n.useLayoutEffect)(()=>{var t;let n,s;if(!l)return void o({visibility:"hidden"});let r=null==(t=a.current)?void 0:t.getBoundingClientRect(),c=i.current;if(!r||!c)return;let d=c.offsetWidth,u=c.offsetHeight;"right"===e?(n=r.right+6,s=Math.min(r.top,window.innerHeight-u-8)):(n=Math.min(r.left,window.innerWidth-d-8),s=r.bottom+6+u>window.innerHeight-8?r.top-6-u:r.bottom+6),o({left:Math.max(8,n),top:Math.max(8,s)})},[l,e]),(0,n.useEffect)(()=>{if(!l)return;let e=e=>{var l,n;let s=e.target;(null==(l=i.current)?void 0:l.contains(s))||(null==(n=a.current)?void 0:n.contains(s))||t(!1)},n=e=>{var l;"Escape"===e.key&&(t(!1),null==(l=a.current)||l.focus())},s=()=>t(!1);return document.addEventListener("pointerdown",e,!0),document.addEventListener("keydown",n),window.addEventListener("resize",s),()=>{document.removeEventListener("pointerdown",e,!0),document.removeEventListener("keydown",n),window.removeEventListener("resize",s)}},[l]),{open:l,setOpen:t,toggle:d,close:c,anchor:a,panel:i,style:r,id:s}}function s(e){let{label:l,text:t}=e,n=i("below");return(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)("button",{ref:n.anchor,type:"button",className:"info-btn","aria-label":l,title:l,"aria-expanded":n.open,"aria-controls":n.open?n.id:void 0,onClick:n.toggle,children:"i"}),n.open&&(0,a.jsxs)("div",{ref:n.panel,id:n.id,role:"dialog","aria-label":l,className:"pop info-pop",style:n.style,children:[(0,a.jsx)("p",{className:"pop-title",children:l}),t.split(/\n\s*\n/).map(e=>(0,a.jsx)("p",{children:e},e))]})]})}},11272:(e,l,t)=>{"use strict";t.d(l,{O:()=>n});var a=t(73365);function n(){return(0,a.jsxs)("svg",{className:"branch-ico",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[(0,a.jsx)("path",{d:"M4.5 3.5v9M4.5 10c0-3 7-2.5 7-5.5",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),(0,a.jsx)("circle",{cx:"4.5",cy:"3",r:"1.7",fill:"currentColor"}),(0,a.jsx)("circle",{cx:"4.5",cy:"13",r:"1.7",fill:"currentColor"}),(0,a.jsx)("circle",{cx:"11.5",cy:"4.2",r:"1.7",fill:"currentColor"})]})}},24784:(e,l,t)=>{"use strict";t.d(l,{Yb:()=>o,u:()=>r});var a=t(73365),n=t(1521),i=t(15549),s=t(8205);let r="::by-hand::";function o(e){var l,t,o;let{id:c,chosen:d,onChange:u,none:m,byHand:h,catalogue:x,disabled:p=!1,style:j}=e,{t:v}=(0,s.kj)(),f=function(e){let[l,t]=(0,n.useState)(null);return(0,n.useEffect)(()=>{if(void 0!==e)return;let l=!0;return i.FH.models().then(e=>{l&&t(e)}).catch(()=>void 0),()=>{l=!1}},[e]),void 0!==e?e:l}(x),b=null!=(l=null==f?void 0:f.options)?l:[],g=e=>e.toLowerCase().replace(/[-‐‑‒–—_]+/g," ").replace(/\s+/g," ").trim(),y=d&&d!==r?b.find(e=>g(e.name)===g(d)):void 0,k=null!=(t=null==y?void 0:y.name)?t:d,w=!!y||d===r&&void 0!==h,N=b.filter(e=>!e.group),S=new Map;for(let e of b)e.group&&S.set(e.group,[...null!=(o=S.get(e.group))?o:[],e]);return(0,a.jsxs)("select",{id:c,value:k,onChange:e=>u(e.target.value),disabled:p,style:{width:"auto",minWidth:280,...j},children:[void 0!==h&&(0,a.jsx)("option",{value:r,children:h}),void 0!==m&&(0,a.jsx)("option",{value:"",children:m}),d&&!w&&(0,a.jsx)("option",{value:d,children:v("model.notInList",{name:d})}),N.map(e=>(0,a.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(v("model.unavailable")):""]},e.name)),[...S.entries()].map(e=>{let[l,t]=e;return(0,a.jsx)("optgroup",{label:l,children:t.map(e=>(0,a.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(v("model.unavailable")):""]},e.name))},l)})]})}},51035:(e,l,t)=>{"use strict";t.d(l,{DialogHost:()=>d,Z:()=>c});var a=t(73365),n=t(1521),i=t(8205),s=t(94969);let r=null,o=[];function c(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:{};return new Promise(t=>{var a;return a={kind:"confirm",message:e,...l,resolve:t},void(r?r(a):o.push(a))})}function d(e){var l,t;let{children:c}=e,{t:d}=(0,i.kj)(),[u,m]=(0,n.useState)([]),h=(0,n.useRef)(null),x=(0,n.useRef)(null);(0,n.useEffect)(()=>{if(r=e=>m(l=>[...l,e]),o.length>0){let e=o.splice(0,o.length);m(l=>[...l,...e])}return()=>{r=null}},[]);let p=u[0],j=(0,n.useCallback)(e=>{p&&(p.resolve(e),m(e=>e.slice(1)))},[p]);return(0,s.V)(x,!!p,h),(0,n.useEffect)(()=>{if(!p)return;let e=e=>{"Escape"===e.key&&(e.preventDefault(),j(!1))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[p,j]),(0,a.jsxs)(a.Fragment,{children:[c,p&&(0,a.jsx)("div",{className:"modal-backdrop",onClick:()=>j(!1),role:"presentation",children:(0,a.jsxs)("div",{ref:x,className:"modal".concat(p.danger?" danger":""),role:"confirm"===p.kind?"alertdialog":"dialog","aria-modal":"true","aria-labelledby":"modal-title","aria-describedby":"modal-body",onClick:e=>e.stopPropagation(),children:[(0,a.jsx)("h2",{id:"modal-title",children:null!=(l=p.title)?l:d("confirm"===p.kind?"dialog.confirmTitle":"dialog.noticeTitle")}),(0,a.jsx)("div",{id:"modal-body",className:"modal-body",children:p.message}),(0,a.jsxs)("div",{className:"row modal-actions",children:["confirm"===p.kind&&(0,a.jsx)("button",{type:"button",className:"quiet",onClick:()=>j(!1),children:d("dialog.cancel")}),(0,a.jsx)("button",{ref:h,type:"button",className:p.danger?"danger":"primary",onClick:()=>j(!0),children:null!=(t=p.okLabel)?t:d("dialog.ok")})]})]})})]})}},61896:(e,l,t)=>{Promise.resolve().then(t.bind(t,73197))},73197:(e,l,t)=>{"use strict";t.r(l),t.d(l,{default:()=>u});var a=t(73365),n=t(1521),i=t(15549),s=t(8205),r=t(51035),o=t(24784),c=t(5462),d=t(11272);function u(){let{t:e}=(0,s.kj)(),[l,t]=(0,n.useState)(null),[o,c]=(0,n.useState)(!1),[d,u]=(0,n.useState)("");(0,n.useEffect)(()=>{i.FH.models().then(t).catch(()=>void 0)},[]);let m=async()=>{if(await (0,r.Z)(e("model.refreshConfirm"))){c(!0),u(e("model.refreshing"));try{var l;let a=await i.FH.models().then(()=>i.FH.refreshModels());t(a),u(0===a.options.length?null!=(l=a.note)?l:e("model.none"):e("model.refreshed",{n:a.options.length}))}catch(e){u(e.message)}finally{c(!1)}}},h={catalogue:l,setCatalogue:t,refreshModels:m,refreshing:o,refreshMsg:d};return(0,a.jsxs)("div",{className:"settings",children:[(0,a.jsxs)("div",{className:"panel",children:[(0,a.jsx)("h2",{children:e("def.title")}),(0,a.jsx)("p",{className:"muted small",children:e("def.intro")}),(0,a.jsx)("p",{className:"why",children:e("def.autoSave")})]}),(0,a.jsx)(y,{}),(0,a.jsx)(k,{}),(0,a.jsx)(b,{}),(0,a.jsx)(N,{}),(0,a.jsx)(S,{...h}),(0,a.jsx)(R,{...h}),(0,a.jsx)(F,{})]})}function m(e){let{htmlFor:l,label:t,info:n,as:i="label"}=e,{t:r}=(0,s.kj)();return(0,a.jsxs)("div",{className:"field-label",children:["label"===i?(0,a.jsx)("label",{htmlFor:l,children:t}):(0,a.jsx)("span",{className:"field-name",children:t}),(0,a.jsx)(c.q,{label:r("info.about",{name:t}),text:n})]})}function h(e){let{id:l,label:t,info:n,unit:i,children:s}=e;return(0,a.jsxs)("div",{className:"settings-field",children:[(0,a.jsx)(m,{htmlFor:l,label:t,info:n}),(0,a.jsxs)("div",{className:"field-control",children:[s,i&&(0,a.jsx)("span",{className:"unit",children:i})]})]})}function x(e){let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:900,t=(0,n.useRef)(null),a=(0,n.useRef)(null),i=(0,n.useRef)(e);return i.current=e,(0,n.useEffect)(()=>()=>{t.current&&clearTimeout(t.current),a.current&&i.current(a.current.value)},[]),e=>{t.current&&clearTimeout(t.current),a.current={value:e},t.current=setTimeout(()=>{a.current=null,i.current(e)},l)}}function p(e){let{id:l,value:t,min:i,max:s,onChange:r,disabled:o}=e,[c,d]=(0,n.useState)(String(t));return(0,n.useEffect)(()=>d(e=>j(e)===t?e:String(t)),[t]),(0,a.jsx)("input",{id:l,type:"number",className:"number",min:i,max:s,step:1,value:c,onChange:e=>{d(e.target.value);let l=j(e.target.value);null!==l&&l>=i&&l<=s&&r(l)},onBlur:()=>{let e=j(c),l=null===e?t:Math.max(i,Math.min(s,e));d(String(l)),l!==t&&r(l)},disabled:o})}function j(e){if(""===e.trim())return null;let l=Number(e);return Number.isInteger(l)?l:null}function v(e){let{msg:l,onSave:t}=e,{t:n}=(0,s.kj)();return(0,a.jsxs)("div",{className:"row saved-note",children:[t&&(0,a.jsx)("button",{className:"quiet",onClick:t,title:n("def.saveAnywayWhy"),children:n("def.saveAnyway")}),(0,a.jsx)("span",{className:"muted small",role:"status",children:l||n("def.savedAutomatically")})]})}let f={name:"",description:"",text:"",projectDir:""};function b(){let{t:e}=(0,s.kj)(),[l,t]=(0,n.useState)(null),[o,c]=(0,n.useState)({maxText:8e3,maxDescription:300}),[d,u]=(0,n.useState)([]),[m,h]=(0,n.useState)(""),[x,p]=(0,n.useState)(""),[j,b]=(0,n.useState)(!1),[y,k]=(0,n.useState)(f);(0,n.useEffect)(()=>{i.FH.skills().then(e=>{t(e.skills),c({maxText:e.maxText,maxDescription:e.maxDescription})}).catch(e=>p(e.message)),i.FH.project().then(e=>u([...e.rootDir?[{name:e.name||e.rootDir,dir:e.rootDir}]:[],...e.others.map(e=>({name:e.name,dir:e.rootDir}))])).catch(()=>void 0)},[]);let w=async l=>{b(!0),p("");try{let a=await i.FH.setSkills(l);return t(a.skills),h(e("skills.saved",{n:a.skills.length})),!0}catch(e){return p(e.message),!1}finally{b(!1)}},N=null!=l?l:[],S=async()=>{await w([...N,{...y,name:y.name.trim().toLowerCase()}])&&k(f)},C=async l=>{await (0,r.Z)(e("skills.removeConfirm",{name:N[l].name}))&&await w(N.filter((e,t)=>t!==l))};return(0,a.jsxs)("section",{className:"panel",id:"skills","aria-labelledby":"skills-title",children:[(0,a.jsx)("h2",{id:"skills-title",children:e("skills.title")}),(0,a.jsx)("p",{className:"muted small",children:e("skills.intro")}),x&&(0,a.jsx)("div",{className:"err",children:x}),l&&0===l.length&&(0,a.jsx)("p",{className:"muted small",children:e("skills.none")}),N.map((e,l)=>(0,a.jsx)(g,{skill:e,projects:d,limits:o,onChange:e=>w(N.map((t,a)=>a===l?e:t)),onRemove:()=>void C(l),busy:j},"skill-".concat(l))),(0,a.jsx)(v,{msg:m}),(0,a.jsx)("h3",{id:"skills-add",children:e("skills.addTitle")}),(0,a.jsx)(g,{skill:y,projects:d,limits:o,onDraft:k,busy:j}),(0,a.jsx)("div",{className:"row",children:(0,a.jsx)("button",{className:"primary",onClick:()=>void S(),disabled:j||!y.name.trim()||!y.text.trim(),children:e("skills.add")})})]})}function g(e){let{skill:l,projects:t,limits:i,onChange:r,onDraft:o,onRemove:c,busy:d}=e,{t:u}=(0,s.kj)(),h=(0,n.useId)(),[p,j]=(0,n.useState)(l),v=(0,n.useRef)(!1);(0,n.useEffect)(()=>{v.current||j(l)},[l]);let f=e=>{let l={...p,...e};return j(l),null==o||o(l),l},b=x(async e=>{v.current=!1,r&&e.text!==l.text&&await r(e)},1200),g=()=>{r&&(p.name!==l.name||p.description!==l.description)&&r(p)};return(0,a.jsxs)("div",{className:"panel inner skill-entry".concat(r?"":" skill-new"),children:[(0,a.jsxs)("div",{className:"project-fields",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(m,{htmlFor:"".concat(h,"-name"),label:u("skills.name"),info:u("skills.nameInfo")}),(0,a.jsxs)("div",{className:"input-with-buttons",children:[(0,a.jsx)("span",{className:"skill-slash","aria-hidden":"true",children:"/"}),(0,a.jsx)("input",{id:"".concat(h,"-name"),type:"text",value:p.name,onChange:e=>f({name:e.target.value}),onBlur:g,placeholder:"new-test",spellCheck:!1})]})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(m,{htmlFor:"".concat(h,"-description"),label:u("skills.description"),info:u("skills.descriptionInfo")}),(0,a.jsx)("input",{id:"".concat(h,"-description"),type:"text",value:p.description,maxLength:i.maxDescription,onChange:e=>f({description:e.target.value}),onBlur:g})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(m,{htmlFor:"".concat(h,"-project"),label:u("skills.project"),info:u("skills.projectInfo")}),(0,a.jsxs)("div",{className:"input-with-buttons",children:[(0,a.jsxs)("select",{id:"".concat(h,"-project"),value:p.projectDir,onChange:e=>{let l=f({projectDir:e.target.value});r&&r(l)},children:[(0,a.jsx)("option",{value:"",children:u("skills.allProjects")}),t.map(e=>(0,a.jsx)("option",{value:e.dir,children:e.name},e.dir))]}),c&&(0,a.jsx)("button",{className:"quiet",onClick:c,disabled:d,children:u("skills.remove")})]})]})]}),(0,a.jsxs)("div",{className:"project-level2",children:[(0,a.jsx)(m,{htmlFor:"".concat(h,"-text"),label:u("skills.text"),info:u("skills.textInfo",{n:i.maxText.toLocaleString()})}),(0,a.jsx)("textarea",{id:"".concat(h,"-text"),className:"prose",rows:5,maxLength:i.maxText,value:p.text,onChange:e=>{let l=f({text:e.target.value});r&&(v.current=!0,b(l))},placeholder:u("skills.textPlaceholder")}),(0,a.jsx)("span",{className:"muted small",children:u("skills.count",{n:p.text.length.toLocaleString(),max:i.maxText.toLocaleString()})})]})]})}function y(){let{t:e}=(0,s.kj)(),[l,t]=(0,n.useState)(null),[r,o]=(0,n.useState)("");return(0,n.useEffect)(()=>{i.FH.level1().then(e=>t(e.content)).catch(l=>o(e("l1.failed",{reason:l.message})))},[]),(0,a.jsxs)("section",{className:"panel",id:"level1","aria-labelledby":"level1-title",children:[(0,a.jsxs)("div",{className:"row section-title",children:[(0,a.jsx)("h2",{id:"level1-title",children:e("l1.title")}),(0,a.jsx)("span",{className:"badge",children:e("l1.readOnly")})]}),(0,a.jsx)("div",{className:"callout",role:"note",children:e("l1.what")}),r&&(0,a.jsx)("div",{className:"err",children:r}),(0,a.jsxs)("details",{className:"l1-text",children:[(0,a.jsx)("summary",{children:e("l1.show")}),(0,a.jsx)("pre",{className:"l1-pre",children:null!=l?l:"…"})]})]})}function k(){var e,l;let{t}=(0,s.kj)(),[r,o]=(0,n.useState)(null),[c,d]=(0,n.useState)(""),[u,h]=(0,n.useState)(""),[p,j]=(0,n.useState)(""),[f,b]=(0,n.useState)(""),[g,y]=(0,n.useState)(!1),[k,N]=(0,n.useState)(""),[S,C]=(0,n.useState)(""),R=(0,n.useCallback)(async()=>{try{let e=await i.FH.project();o(e),d(e.rootDir),h(e.name),b("")}catch(e){b(e.message)}},[]);(0,n.useEffect)(()=>{R()},[R]);let F=async(e,l)=>{y(!0),j("");try{let t=await i.FH.setProject(e);return o(t),d(t.rootDir),j(l(t)),b(""),!0}catch(e){return b(e.message),!1}finally{y(!1)}},M=e=>F({rootDir:e},e=>e.rootDir?t("proj.saved",{dir:e.rootDir}):t("proj.cleared")),E=e=>F({name:e},()=>t("proj.nameSaved")),D=x(M),I=x(E),O=async(e,l)=>{y(!0);try{var t;let a=await i.FH.browseFolder(l.trim()||void 0);a.ok?e(a.path):a.cancelled||b(null!=(t=a.reason)?t:"")}catch(e){b(e.message)}finally{y(!1)}},L=null!=(e=null==r?void 0:r.others)?e:[],H=e=>e.map(e=>({name:e.name,rootDir:e.rootDir,level2:e.level2,readOnly:e.readOnly})),W=(e,l,t)=>F({others:H(L.map(t=>t.name===e.name?{...t,...l}:t))},t),T=async()=>{await F({others:[...H(L),{name:k.trim(),rootDir:S.trim(),level2:"",readOnly:!1}]},e=>t("proj.othersSaved",{n:e.others.length}))&&(N(""),C(""))};return(0,a.jsxs)("section",{className:"panel",id:"project","aria-labelledby":"project-title",children:[(0,a.jsx)("h2",{id:"project-title",children:t("proj.title")}),(0,a.jsx)("p",{className:"muted small",children:t("proj.intro")}),f&&(0,a.jsx)("div",{className:"err",children:f}),(0,a.jsx)(w,{name:u,dir:c,repoOk:!!(null==r?void 0:r.repoOk),repoProblem:null==r?void 0:r.repoProblem,branch:null==r?void 0:r.branch,level2:null!=(l=null==r?void 0:r.level2)?l:"",readOnly:(null==r?void 0:r.readOnly)===!0,onReadOnly:e=>F({readOnly:e},()=>t(e?"proj.readOnlyOn":"proj.readOnlyOff",{name:u||c})),isDefault:!0,busy:g,onNameInput:e=>{h(e),I(e)},onName:e=>void E(e),onDirInput:e=>{d(e),D(e)},onDir:e=>void M(e),onBrowse:()=>void O(e=>void M(e),c),onLevel2:e=>F({level2:e},()=>t("proj.level2Saved",{name:u||c})),onRemove:(null==r?void 0:r.rootDir)?()=>void M(""):void 0,removeLabel:t("proj.clear")}),r&&!r.rootDir&&(0,a.jsx)("p",{className:"muted small",children:t("proj.none")}),L.map((e,l)=>(0,a.jsx)(w,{name:e.name,dir:e.rootDir,repoOk:e.repoOk,repoProblem:e.repoProblem,branch:e.branch,level2:e.level2,readOnly:!0===e.readOnly,onReadOnly:l=>W(e,{readOnly:l},()=>t(l?"proj.readOnlyOn":"proj.readOnlyOff",{name:e.name})),busy:g,onName:l=>void W(e,{name:l},()=>t("proj.nameSaved")),onDir:l=>void W(e,{rootDir:l},()=>t("proj.othersSaved",{n:L.length})),onBrowse:()=>void O(l=>void W(e,{rootDir:l},()=>t("proj.othersSaved",{n:L.length})),e.rootDir),onLevel2:l=>W(e,{level2:l},()=>t("proj.level2Saved",{name:e.name})),onRemove:()=>{let l;l=e.name,F({others:H(L.filter(e=>e.name!==l))},e=>t("proj.othersSaved",{n:e.others.length}))},removeLabel:t("proj.otherRemove")},"other-".concat(l))),(0,a.jsx)(v,{msg:p}),(0,a.jsx)("h3",{id:"others",children:t("proj.addTitle")}),(0,a.jsx)("p",{className:"muted small",children:t("proj.othersIntro")}),(0,a.jsxs)("div",{className:"project-fields add-project",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(m,{htmlFor:"new-project-name",label:t("proj.entryName"),info:t("proj.nameInfo")}),(0,a.jsx)("input",{id:"new-project-name",type:"text",value:k,onChange:e=>N(e.target.value),placeholder:t("proj.entryName"),disabled:g})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(m,{htmlFor:"new-project-dir",label:t("proj.entryDir"),info:t("proj.dirInfo")}),(0,a.jsxs)("div",{className:"input-with-buttons",children:[(0,a.jsx)("input",{id:"new-project-dir",type:"text",value:S,onChange:e=>C(e.target.value),placeholder:"C:\\Projects\\my-app-tests",disabled:g}),(0,a.jsx)("button",{onClick:()=>void O(e=>C(e),S),disabled:g,children:t("mirror.browse")}),(0,a.jsx)("button",{className:"primary",onClick:()=>void T(),disabled:g||!k.trim()||!S.trim(),children:t("proj.otherAdd")})]})]})]})]})}function w(e){var l;let{name:t,dir:i,repoOk:r,repoProblem:o,branch:u,level2:h,readOnly:p,onReadOnly:j,isDefault:v=!1,busy:f,onNameInput:b,onName:g,onDirInput:y,onDir:k,onBrowse:w,onLevel2:N,onRemove:S,removeLabel:C}=e,{t:R}=(0,s.kj)(),F=(0,n.useId)(),[M,E]=(0,n.useState)(t),[D,I]=(0,n.useState)(i),[O,L]=(0,n.useState)(h),H=(0,n.useRef)(!1),[W,T]=(0,n.useState)(p);(0,n.useEffect)(()=>T(p),[p]),(0,n.useEffect)(()=>E(t),[t]),(0,n.useEffect)(()=>I(i),[i]),(0,n.useEffect)(()=>{H.current||L(h)},[h]);let B=x(async e=>{H.current=!1,e!==h&&await N(e)},1200);return(0,a.jsxs)("div",{className:"panel inner project-entry",children:[(0,a.jsxs)("div",{className:"row project-tags",children:[v&&(0,a.jsx)("span",{className:"chip",title:R("proj.isDefaultWhy"),children:R("proj.isDefault")}),W&&(0,a.jsx)("span",{className:"badge reference",title:R("proj.readOnlyInfo"),children:R("proj.readOnlyBadge")}),i&&(0,a.jsx)("span",{className:"badge ".concat(r?"done":""),title:r?R("proj.isRepo"):o,children:R(r?"proj.otherRepo":"proj.otherNotRepo")}),i&&r&&u&&(0,a.jsxs)("span",{className:"branch-tag",children:[(0,a.jsxs)("span",{className:"badge branch",children:[(0,a.jsx)(d.O,{})," ","HEAD"===u?R("proj.detached"):R("proj.branch",{name:u})]}),(0,a.jsx)(c.q,{label:R("info.about",{name:R("proj.branch",{name:u})}),text:R("proj.branchInfo")})]})]}),i&&!r&&(0,a.jsx)("p",{className:"muted small",children:o||R("proj.notRepoWhy")}),(0,a.jsxs)("div",{className:"field-label check-label project-readonly",children:[(0,a.jsx)("input",{id:"".concat(F,"-readonly"),type:"checkbox",checked:W,onChange:e=>{let l=e.target.checked;T(l),j(l).then(e=>{!1===e&&T(!l)})}}),(0,a.jsx)("label",{htmlFor:"".concat(F,"-readonly"),children:R("proj.readOnly")}),(0,a.jsx)(c.q,{label:R("info.about",{name:R("proj.readOnly")}),text:R("proj.readOnlyInfo")})]}),(0,a.jsxs)("div",{className:"project-fields",children:[(0,a.jsxs)("div",{children:[(0,a.jsx)(m,{htmlFor:"".concat(F,"-name"),label:R("proj.entryName"),info:R("proj.nameInfo")}),(0,a.jsx)("input",{id:"".concat(F,"-name"),type:"text",value:M,onChange:e=>{E(e.target.value),null==b||b(e.target.value)},onBlur:()=>{(M!==t||b)&&g(M)},placeholder:i?null!=(l=i.replace(/[\\/]+$/,"").split(/[\\/]/).pop())?l:"":R("proj.namePlaceholder")})]}),(0,a.jsxs)("div",{children:[(0,a.jsx)(m,{htmlFor:"".concat(F,"-dir"),label:R("proj.entryDir"),info:R("proj.dirInfo")}),(0,a.jsxs)("div",{className:"input-with-buttons",children:[(0,a.jsx)("input",{id:"".concat(F,"-dir"),type:"text",value:D,onChange:e=>{I(e.target.value),null==y||y(e.target.value)},onBlur:()=>{(D!==i||y)&&k(D)},placeholder:"C:\\Projects\\my-app"}),(0,a.jsx)("button",{onClick:w,disabled:f,children:R("mirror.browse")}),S&&(0,a.jsx)("button",{className:"quiet",onClick:S,disabled:f,children:C})]})]})]}),(0,a.jsxs)("div",{className:"project-level2",children:[(0,a.jsx)(m,{htmlFor:"".concat(F,"-level2"),label:R("proj.level2"),info:R("proj.level2Info",{n:8e3.toLocaleString()})}),(0,a.jsx)("textarea",{id:"".concat(F,"-level2"),className:"prose",rows:4,maxLength:8e3,value:O,onChange:e=>{H.current=!0,L(e.target.value),B(e.target.value)},placeholder:R("proj.level2Placeholder")}),(0,a.jsx)("span",{className:"muted small",children:R("proj.level2Count",{n:O.length.toLocaleString(),max:8e3.toLocaleString()})})]})]})}function N(){let{t:e}=(0,s.kj)(),[l,t]=(0,n.useState)(""),[r,o]=(0,n.useState)(!1),[c,d]=(0,n.useState)(""),[u,m]=(0,n.useState)(""),x=async()=>{o(!0),m(""),d(e("login.waiting"));try{let e=await i.FH.login(l);e.ok?d(e.message):(d(""),m(e.message))}catch(e){d(""),m(e.message)}finally{o(!1)}};return(0,a.jsxs)("section",{className:"panel",id:"login","aria-labelledby":"login-title",children:[(0,a.jsx)("h2",{id:"login-title",children:e("login.title")}),(0,a.jsx)("p",{className:"muted small",children:e("login.intro")}),u&&(0,a.jsx)("div",{className:"err",children:u}),(0,a.jsxs)(h,{id:"login-account",label:e("login.account"),info:e("login.accountWhy"),children:[(0,a.jsx)("input",{id:"login-account",type:"email",value:l,onChange:e=>t(e.target.value),placeholder:"name@company.com",disabled:r}),(0,a.jsx)("button",{className:"primary",onClick:()=>void x(),disabled:r,children:r?e("login.busy"):e("login.button")})]}),c&&(0,a.jsx)("div",{className:"small",role:"status",children:c})]})}function S(e){var l;let{catalogue:t,setCatalogue:r,refreshModels:c,refreshing:d,refreshMsg:u}=e,{t:m}=(0,s.kj)(),x=(0,s.W3)(),[p,j]=(0,n.useState)(""),[f,b]=(0,n.useState)(""),[g,y]=(0,n.useState)(!1),k=null!=(l=null==t?void 0:t.defaultModel)?l:"",w=async e=>{y(!0),j("");try{let l=await i.FH.setDefaultModel(e);t&&r({...t,defaultModel:l.defaultModel}),j(l.defaultModel?m("def.modelSaved",{name:l.defaultModel}):m("def.modelCleared")),b("")}catch(e){b(e.message)}finally{y(!1)}};return(0,a.jsxs)("section",{className:"panel",id:"model","aria-labelledby":"model-title",children:[(0,a.jsx)("h2",{id:"model-title",children:m("def.modelTitle")}),(0,a.jsx)("p",{className:"muted small",children:m("def.modelIntro")}),f&&(0,a.jsx)("div",{className:"err",children:f}),(0,a.jsxs)(h,{id:"default-model",label:m("def.modelField"),info:m("def.modelInfo"),children:[(0,a.jsx)(o.Yb,{id:"default-model",chosen:k,onChange:e=>void w(e),none:m("def.modelNone"),catalogue:t,disabled:g||d}),(0,a.jsx)("button",{className:"quiet",onClick:()=>void w(""),disabled:g||!k,children:m("proj.clear")}),(0,a.jsx)("button",{onClick:()=>void c(),disabled:g||d,children:m("model.refresh")})]}),(0,a.jsx)("p",{className:"muted small field-after",children:(null==t?void 0:t.readAt)?m("model.readAt",{t:x(t.readAt),n:t.options.length}):m("model.neverRead")}),(0,a.jsx)(C,{}),(0,a.jsx)(v,{msg:p||u})]})}function C(){let{t:e}=(0,s.kj)(),[l,t]=(0,n.useState)(null),[r,o]=(0,n.useState)("");(0,n.useEffect)(()=>{i.FH.settings().then(e=>{var l,a,n;let i=null==(l=e.raw.copilot)?void 0:l.manualModel,s=null==(n=e.defaults)||null==(a=n.copilot)?void 0:a.manualModel;t("boolean"==typeof i?i:!1!==s)}).catch(e=>o(e.message))},[]);let d=async e=>{t(e);try{var l;let t=await i.FH.settings();await i.FH.saveSettings({...t.raw,copilot:{...null!=(l=t.raw.copilot)?l:{},manualModel:e}}),o("")}catch(e){o(e.message)}};return(0,a.jsxs)("div",{className:"settings-field",children:[(0,a.jsxs)("div",{className:"field-label check-label",children:[(0,a.jsx)("input",{id:"manual-model",type:"checkbox",checked:!0===l,disabled:null===l,onChange:e=>void d(e.target.checked)}),(0,a.jsx)("label",{htmlFor:"manual-model",children:e("def.manualModel")}),(0,a.jsx)(c.q,{label:e("info.about",{name:e("def.manualModel")}),text:e("def.manualModelWhy")})]}),r&&(0,a.jsx)("div",{className:"err",children:r})]})}function R(e){var l,t;let{catalogue:r,setCatalogue:c,refreshModels:d,refreshing:u,refreshMsg:m}=e,{t:x}=(0,s.kj)(),[p,j]=(0,n.useState)(""),[f,b]=(0,n.useState)(""),[g,y]=(0,n.useState)(!1),k=null!=(l=null==r?void 0:r.defaultReviewModel)?l:"",w=async e=>{y(!0),j("");try{let l=await i.FH.setDefaultReviewModel(e);r&&c({...r,defaultReviewModel:l.defaultReviewModel}),j(l.defaultReviewModel?x("def.reviewSaved",{name:l.defaultReviewModel}):x("def.reviewCleared")),b("")}catch(e){b(e.message)}finally{y(!1)}},N=""!==k&&k===(null!=(t=null==r?void 0:r.defaultModel)?t:"");return(0,a.jsxs)("section",{className:"panel",id:"review","aria-labelledby":"review-title",children:[(0,a.jsx)("h2",{id:"review-title",children:x("def.reviewTitle")}),(0,a.jsx)("p",{className:"muted small",children:x("def.reviewIntro")}),f&&(0,a.jsx)("div",{className:"err",children:f}),(0,a.jsxs)(h,{id:"default-review-model",label:x("def.reviewField"),info:x("def.reviewInfo"),children:[(0,a.jsx)(o.Yb,{id:"default-review-model",chosen:k,onChange:e=>void w(e),none:x("def.reviewNone"),catalogue:r,disabled:g||u}),(0,a.jsx)("button",{className:"quiet",onClick:()=>void w(""),disabled:g||!k,children:x("proj.clear")}),(0,a.jsx)("button",{onClick:()=>void d(),disabled:g||u,children:x("model.refresh")})]}),N&&(0,a.jsx)("p",{className:"why field-after warned-text",children:x("def.reviewSame")}),(0,a.jsx)(v,{msg:p||m})]})}function F(){let{t:e}=(0,s.kj)(),[l,t]=(0,n.useState)(null),r=(0,n.useRef)(null),o=(0,n.useRef)(Promise.resolve()),[d,u]=(0,n.useState)(2),[m,j]=(0,n.useState)(3),[f,b]=(0,n.useState)(2),[g,y]=(0,n.useState)(2),[k,w]=(0,n.useState)(60),[N,S]=(0,n.useState)(240),[C,R]=(0,n.useState)(20),[F,M]=(0,n.useState)(900),[E,D]=(0,n.useState)(!1),[I,O]=(0,n.useState)(60),[L,H]=(0,n.useState)(!1),[W,T]=(0,n.useState)(90),[B,A]=(0,n.useState)("none"),[P,q]=(0,n.useState)("confirm"),[U,_]=(0,n.useState)("ask"),[V,Y]=(0,n.useState)(""),[Z,z]=(0,n.useState)("");(0,n.useEffect)(()=>{i.FH.settings().then(e=>{var l,a,n,i,s,o,c;r.current=e.raw,t(e.raw);let d=null!=(l=e.raw.limits)?l:{};j("number"==typeof d.autoContinue?d.autoContinue:3),u("number"==typeof d.retryBlockedInFreshChat?d.retryBlockedInFreshChat:2),b("number"==typeof d.minApproachesBeforeBlocked?d.minApproachesBeforeBlocked:2),y("number"==typeof d.maxReviewRounds?d.maxReviewRounds:2),w("number"==typeof d.maxIterations?d.maxIterations:60),S("number"==typeof d.maxRunMinutes?d.maxRunMinutes:240),R("number"==typeof d.maxSubtasks?d.maxSubtasks:20);let m=null!=(a=e.raw.pacing)?a:{};D(!0===m.gapEnabled),O("number"==typeof m.gapSec?m.gapSec:60),H(!0===m.gapRandom),T("number"==typeof m.gapMaxSec?m.gapMaxSec:90);let h=null!=(n=e.raw.copilot)?n:{};M("number"==typeof h.replyTimeoutSec?h.replyTimeoutSec:900);let x=null!=(i=e.raw.execution)?i:{};A(null!=(s=x.isolation)?s:"none"),q(null!=(o=x.mode)?o:"confirm"),_(null!=(c=x.networkFetch)?c:"ask")}).catch(e=>z(e.message))},[]);let K=(l,a,n)=>{let s=async()=>{var s;if(!r.current)return;let o=await i.FH.settings().then(e=>e.raw).catch(()=>r.current),c={...o,[l]:{...null!=(s=o[l])?s:{},[a]:n}};Y("");try{await i.FH.saveSettings(c),r.current=c,t(c),Y(e("exec.saved")),z("")}catch(e){z(e.message)}},c=o.current.then(s);return o.current=c.catch(()=>void 0),c},$=x(e=>K("limits","retryBlockedInFreshChat",e)),G=x(e=>K("limits","autoContinue",e)),J=x(e=>K("limits","minApproachesBeforeBlocked",e)),Q=x(e=>K("limits","maxReviewRounds",e)),X=x(e=>K("limits","maxIterations",e)),ee=x(e=>K("limits","maxRunMinutes",e)),el=x(e=>K("limits","maxSubtasks",e)),et=x(e=>K("copilot","replyTimeoutSec",e)),ea=x(e=>K("pacing","gapSec",e)),en=x(e=>K("pacing","gapMaxSec",e)),ei=(e,l)=>K("execution",e,l),es=[{id:"auto-continue",label:e("exec.autoContinue"),info:e("exec.autoContinueWhy"),unit:e("exec.autoContinueUnit"),value:m,min:0,max:20,set:j,later:G},{id:"min-approaches",label:e("exec.minApproaches"),info:e("exec.minApproachesWhy"),unit:e("exec.minApproachesUnit"),value:f,min:2,max:20,set:b,later:J},{id:"max-review-rounds",label:e("exec.maxReviewRounds"),info:e("exec.maxReviewRoundsWhy"),unit:e("exec.maxReviewRoundsUnit"),value:g,min:1,max:6,set:y,later:Q},{id:"retry-blocked",label:e("exec.retryBlocked"),info:e("exec.retryBlockedWhy"),unit:e("exec.retryBlockedTimes"),value:d,min:0,max:5,set:u,later:$},{id:"max-iterations",label:e("exec.maxIterations"),info:e("exec.maxIterationsWhy"),unit:e("exec.maxIterationsUnit"),value:k,min:5,max:200,set:w,later:X},{id:"max-minutes",label:e("exec.maxRunMinutes"),info:e("exec.maxRunMinutesWhy"),unit:e("exec.maxRunMinutesUnit"),value:N,min:10,max:1440,set:S,later:ee},{id:"max-subtasks",label:e("exec.maxSubtasks"),info:e("exec.maxSubtasksWhy"),unit:e("exec.maxSubtasksUnit"),value:C,min:1,max:100,set:R,later:el},{id:"reply-timeout",label:e("exec.replyTimeout"),info:e("exec.replyTimeoutWhy"),unit:e("exec.replyTimeoutUnit"),value:F,min:60,max:10800,set:M,later:et}];return(0,a.jsxs)("section",{className:"panel",id:"execution","aria-labelledby":"execution-title",children:[(0,a.jsx)("h2",{id:"execution-title",children:e("exec.title")}),(0,a.jsx)("p",{className:"muted small",children:e("exec.intro")}),Z&&(0,a.jsx)("div",{className:"err",children:Z}),es.map(e=>(0,a.jsx)(h,{id:e.id,label:e.label,info:e.info,unit:e.unit,children:(0,a.jsx)(p,{id:e.id,value:e.value,min:e.min,max:e.max,onChange:l=>{e.set(l),e.later(l)},disabled:!l})},e.id)),(0,a.jsx)("div",{className:"settings-field",children:(0,a.jsxs)("div",{className:"field-label check-label",children:[(0,a.jsx)("input",{id:"gap-on",type:"checkbox",checked:E,disabled:!l,onChange:e=>{D(e.target.checked),K("pacing","gapEnabled",e.target.checked)}}),(0,a.jsx)("label",{htmlFor:"gap-on",children:e("exec.gap")}),(0,a.jsx)(c.q,{label:e("info.about",{name:e("exec.gap")}),text:e("exec.gapWhy")})]})}),E&&(0,a.jsx)(h,{id:"gap-sec",label:e("exec.gapSec"),info:e("exec.gapSecWhy"),unit:e("exec.gapUnit"),children:(0,a.jsx)(p,{id:"gap-sec",value:I,min:1,max:3600,onChange:e=>{O(e),ea(e)},disabled:!l})}),E&&(0,a.jsx)("div",{className:"settings-field gap-random",children:(0,a.jsxs)("div",{className:"field-label check-label",children:[(0,a.jsx)("input",{id:"gap-random",type:"checkbox",checked:L,disabled:!l,onChange:e=>{H(e.target.checked),K("pacing","gapRandom",e.target.checked),e.target.checked&&W<I&&(T(I),en(I))}}),(0,a.jsx)("label",{htmlFor:"gap-random",children:e("exec.gapRandom")}),(0,a.jsx)(c.q,{label:e("info.about",{name:e("exec.gapRandom")}),text:e("exec.gapRandomWhy")})]})}),E&&L&&(0,a.jsx)(h,{id:"gap-max",label:e("exec.gapMax"),info:e("exec.gapMaxWhy"),unit:e("exec.gapUnit"),children:(0,a.jsx)(p,{id:"gap-max",value:W,min:I,max:3600,onChange:e=>{T(e),en(e)},disabled:!l})}),(0,a.jsx)(h,{id:"isolation",label:e("exec.isolation"),info:e("exec.isolationWhy"),children:(0,a.jsxs)("select",{id:"isolation",value:B,onChange:e=>{let l=e.target.value;A(l),ei("isolation",l)},disabled:!l,children:[(0,a.jsx)("option",{value:"none",children:e("exec.isolationNone")}),(0,a.jsx)("option",{value:"none-accepted",children:e("exec.isolationNoneAccepted")}),(0,a.jsx)("option",{value:"separate-account",children:e("exec.isolationAccount")}),(0,a.jsx)("option",{value:"sandbox",children:e("exec.isolationSandbox")}),(0,a.jsx)("option",{value:"vm",children:e("exec.isolationVm")})]})}),(0,a.jsx)(h,{id:"start-mode",label:e("exec.startMode"),info:e("exec.startModeWhy"),children:(0,a.jsxs)("select",{id:"start-mode",value:P,onChange:e=>{let l=e.target.value;q(l),ei("mode",l)},disabled:!l,children:[(0,a.jsx)("option",{value:"confirm",children:e("exec.startModeAsk")}),(0,a.jsx)("option",{value:"unattended",children:e("exec.startModeAuto")})]})}),(0,a.jsx)(h,{id:"network-fetch",label:e("exec.networkFetch"),info:e("exec.networkFetchWhy"),children:(0,a.jsxs)("select",{id:"network-fetch",value:U,onChange:e=>{let l=e.target.value;_(l),ei("networkFetch",l)},disabled:!l,children:[(0,a.jsx)("option",{value:"ask",children:e("exec.networkFetchAsk")}),(0,a.jsx)("option",{value:"refuse",children:e("exec.networkFetchRefuse")}),(0,a.jsx)("option",{value:"run",children:e("exec.networkFetchRun")})]})}),(0,a.jsx)(v,{msg:V})]})}},94969:(e,l,t)=>{"use strict";t.d(l,{V:()=>i});var a=t(1521);let n='a[href], button:not([disabled]), textarea:not([disabled]), input:not([disabled]), select:not([disabled]), [tabindex]:not([tabindex="-1"])';function i(e,l,t){(0,a.useEffect)(()=>{var a,i;if(!l)return;let s=document.activeElement instanceof HTMLElement?document.activeElement:null,r=e.current,o=null!=(i=null!=(a=null==t?void 0:t.current)?a:null==r?void 0:r.querySelector(n))?i:null;null==o||o.focus();let c=e=>{if("Tab"!==e.key||!r)return;let l=Array.from(r.querySelectorAll(n)).filter(e=>null!==e.offsetParent);if(0===l.length)return;let t=l[0],a=l[l.length-1],i=r.contains(document.activeElement);e.shiftKey&&(document.activeElement===t||!i)?(e.preventDefault(),a.focus()):e.shiftKey||document.activeElement!==a&&i||(e.preventDefault(),t.focus())};return document.addEventListener("keydown",c),()=>{document.removeEventListener("keydown",c),s&&document.contains(s)&&s.focus()}},[e,l,t])}}},e=>{e.O(0,[7921,2347,3131,7358],()=>e(e.s=61896)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[7177],{952:()=>{},28214:(e,t,s)=>{"use strict";s.d(t,{SkipLink:()=>v,s:()=>j});var l=s(73365),n=s(1521),r=s(18197),a=s.n(r),i=s(1702),o=s(15549),c=s(87527),d=s(8205),h=s(46575),u=s(1758);let m={workbench:(0,l.jsx)("path",{d:"M4 5h16v11H9l-5 4zM8 9h8M8 12h5",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"}),defaults:(0,l.jsx)("path",{d:"M12 8a4 4 0 1 0 0 8 4 4 0 0 0 0-8zm8.5 4 1.5 1-1.6 2.8-1.8-.4a7 7 0 0 1-1.5 1.5l.4 1.8L14.7 21l-1-1.5a7 7 0 0 1-3.4 0l-1 1.5-2.8-1.6.4-1.8A7 7 0 0 1 5.4 16l-1.8.4L2 13.6 3.5 12.6V11.4L2 10.4l1.6-2.8 1.8.4A7 7 0 0 1 6.9 6.5l-.4-1.8L9.3 3l1 1.5a7 7 0 0 1 3.4 0l1-1.5 2.8 1.6-.4 1.8a7 7 0 0 1 1.5 1.5l1.8-.4L22 10.4l-1.5 1z"}),system:(0,l.jsx)("path",{d:"M4 5h16v10H4zM2 19h20M9 15v4M15 15v4",fill:"none",stroke:"currentColor",strokeWidth:"2",strokeLinejoin:"round"})},f=[{href:"/",label:"nav.workbench",icon:"workbench"},{href:"/defaults",label:"nav.defaults",icon:"defaults"},{href:"/system",label:"nav.system",icon:"system"}];function v(){let{t:e}=(0,d.kj)();return(0,l.jsx)("a",{className:"skip-link",href:"#main",children:e("a11y.skip")})}function j(){let{t:e}=(0,d.kj)(),t=(0,i.usePathname)(),s=function(){let[e,t]=(0,n.useState)(0);return(0,c.z)(()=>o.FH.activity().then(e=>t(e.sessions)).catch(()=>void 0),4e3),e}();return(0,l.jsxs)("nav",{"aria-label":e("nav.label"),children:[f.flatMap(n=>[(0,l.jsxs)(a(),{href:n.href,"aria-current":t===n.href?"page":void 0,children:[(0,l.jsx)("svg",{className:"nav-icon",viewBox:"0 0 24 24",width:"16",height:"16",fill:"currentColor","aria-hidden":"true",children:m[n.icon]}),(0,l.jsx)("span",{children:e(n.label)}),"/"===n.href&&s>0&&(0,l.jsxs)("span",{className:"live",title:e("nav.liveTitle",{n:s}),children:[(0,l.jsx)("span",{className:"dot","aria-hidden":"true"}),e("nav.live")]})]},n.href),..."/defaults"===n.href?[(0,l.jsx)(u.y,{},"appearance")]:[]]),(0,l.jsx)(h.c,{})]})}},68300:(e,t,s)=>{"use strict";s.d(t,{Shell:()=>p});var l=s(73365),n=s(18197),r=s.n(n),a=s(1702),i=s(28214),o=s(36657),c=s(1521),d=s(15549),h=s(8205),u=s(87527);function m(e){var t,s;let{failure:n,reason:r,onDismiss:a,intro:i,children:o}=e,{t:c}=(0,h.kj)(),u=(0,h.W3)(),m=null!=(s=null!=(t=null==n?void 0:n.message)?t:r)?s:"";return(0,l.jsxs)("div",{className:"notice caution start-failure",role:"alert",style:{overflowWrap:"anywhere"},children:[i&&(0,l.jsx)("p",{className:"small",style:{marginTop:0},children:i}),(0,l.jsx)("strong",{children:c("startfail.title")}),n&&(0,l.jsx)("p",{className:"small",style:{margin:"4px 0"},children:c("startfail.where",{stage:c("startfail.stage.".concat(n.stage))})}),(0,l.jsx)("pre",{className:"sync-cmd small",style:{margin:"6px 0"},children:m}),o,n&&(0,l.jsxs)("p",{className:"muted small",style:{margin:"4px 0"},children:[n.runId?c("startfail.when",{when:u(n.at),run:n.runId}):c("startfail.whenNoRun",{when:u(n.at)}),n.sessions.length>0?" \xb7 ".concat(n.sessions.map(e=>'"'.concat(e,'"')).join(", ")):""]}),(0,l.jsxs)("div",{className:"row",style:{marginTop:6},children:[n&&(0,l.jsx)("a",{className:"button-link",href:d.FH.startFailureUrl(n.id),download:!0,children:c("startfail.download")}),(0,l.jsx)("a",{className:n?"button-link":"button-link plain",href:d.FH.terminalUrl(),download:!0,children:c("startfail.terminal")}),a&&(0,l.jsx)("button",{type:"button",className:"quiet",onClick:a,children:c("startfail.dismiss")})]}),(0,l.jsx)("p",{className:"why",children:c("startfail.downloadWhy")})]})}let f="cop.startFailure.dismissed";function v(){try{var e;let t=JSON.parse(null!=(e=window.localStorage.getItem(f))?e:"[]");return Array.isArray(t)?t.filter(e=>"string"==typeof e):[]}catch(e){return[]}}function j(){let{t:e}=(0,h.kj)(),[t,s]=(0,c.useState)([]),[n,r]=(0,c.useState)([]);(0,u.z)(()=>d.FH.startFailures(!0).then(e=>{s(e),r(v())}).catch(()=>void 0),5e3);let a=t.find(e=>!n.includes(e.id));return a?(0,l.jsx)("div",{style:{marginBottom:12},children:(0,l.jsx)(m,{failure:a,intro:e("at-turn"===a.stage?"startfail.laterSession":"startfail.later"),onDismiss:()=>{let e=[...new Set([...v(),a.id])].slice(-50);try{window.localStorage.setItem(f,JSON.stringify(e))}catch(e){}r(e)}})}):null}function p(e){let{children:t}=e;return"/"===(0,a.usePathname)()?(0,l.jsxs)("div",{className:"wb-root",children:[(0,l.jsx)(o.U,{}),(0,l.jsx)(j,{}),(0,l.jsx)("main",{id:"main",className:"wb-main",children:t})]}):(0,l.jsxs)("div",{className:"wrap",children:[(0,l.jsxs)("header",{className:"top",children:[(0,l.jsx)("h1",{children:(0,l.jsx)(r(),{href:"/",children:"copilot-operator"})}),(0,l.jsx)(i.s,{})]}),(0,l.jsx)(o.U,{}),(0,l.jsx)(j,{}),(0,l.jsx)("main",{id:"main",children:t})]})}},84529:(e,t,s)=>{Promise.resolve().then(s.bind(s,51035)),Promise.resolve().then(s.t.bind(s,952,23)),Promise.resolve().then(s.bind(s,28214)),Promise.resolve().then(s.bind(s,87712)),Promise.resolve().then(s.bind(s,68300)),Promise.resolve().then(s.bind(s,98078)),Promise.resolve().then(s.bind(s,8205))},87712:(e,t,s)=>{"use strict";s.d(t,{ScrollJump:()=>a});var l=s(73365),n=s(1521),r=s(8205);function a(){let{t:e}=(0,r.kj)(),[t,s]=(0,n.useState)({long:!1,atTop:!0,atBottom:!1});return((0,n.useEffect)(()=>{let e=()=>{let e=document.documentElement;s({long:e.scrollHeight>2*window.innerHeight,atTop:window.scrollY<200,atBottom:window.innerHeight+window.scrollY>=e.scrollHeight-200})};e(),window.addEventListener("scroll",e,{passive:!0}),window.addEventListener("resize",e);let t=new ResizeObserver(e);return t.observe(document.body),()=>{window.removeEventListener("scroll",e),window.removeEventListener("resize",e),t.disconnect()}},[]),t.long)?(0,l.jsxs)("div",{className:"scroll-jump",children:[!t.atTop&&(0,l.jsx)("button",{type:"button","aria-label":e("scroll.top"),title:e("scroll.top"),onClick:()=>window.scrollTo({top:0,behavior:"smooth"}),children:"↑"}),!t.atBottom&&(0,l.jsx)("button",{type:"button","aria-label":e("scroll.bottom"),title:e("scroll.bottom"),onClick:()=>window.scrollTo({top:document.documentElement.scrollHeight,behavior:"smooth"}),children:"↓"})]}):null}}},e=>{e.O(0,[7353,3134,7921,7500,2347,3131,7358],()=>e(e.s=84529)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[8974],{11272:(e,t,l)=>{"use strict";l.d(t,{O:()=>a});var s=l(73365);function a(){return(0,s.jsxs)("svg",{className:"branch-ico",viewBox:"0 0 16 16","aria-hidden":"true",focusable:"false",children:[(0,s.jsx)("path",{d:"M4.5 3.5v9M4.5 10c0-3 7-2.5 7-5.5",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinecap:"round"}),(0,s.jsx)("circle",{cx:"4.5",cy:"3",r:"1.7",fill:"currentColor"}),(0,s.jsx)("circle",{cx:"4.5",cy:"13",r:"1.7",fill:"currentColor"}),(0,s.jsx)("circle",{cx:"11.5",cy:"4.2",r:"1.7",fill:"currentColor"})]})}},24784:(e,t,l)=>{"use strict";l.d(t,{Yb:()=>c,u:()=>r});var s=l(73365),a=l(1521),n=l(15549),i=l(8205);let r="::by-hand::";function c(e){var t,l,c;let{id:o,chosen:d,onChange:u,none:h,byHand:p,catalogue:m,disabled:f=!1,style:x}=e,{t:b}=(0,i.kj)(),v=function(e){let[t,l]=(0,a.useState)(null);return(0,a.useEffect)(()=>{if(void 0!==e)return;let t=!0;return n.FH.models().then(e=>{t&&l(e)}).catch(()=>void 0),()=>{t=!1}},[e]),void 0!==e?e:t}(m),g=null!=(t=null==v?void 0:v.options)?t:[],w=e=>e.toLowerCase().replace(/[-‐‑‒–—_]+/g," ").replace(/\s+/g," ").trim(),j=d&&d!==r?g.find(e=>w(e.name)===w(d)):void 0,k=null!=(l=null==j?void 0:j.name)?l:d,y=!!j||d===r&&void 0!==p,N=g.filter(e=>!e.group),S=new Map;for(let e of g)e.group&&S.set(e.group,[...null!=(c=S.get(e.group))?c:[],e]);return(0,s.jsxs)("select",{id:o,value:k,onChange:e=>u(e.target.value),disabled:f,style:{width:"auto",minWidth:280,...x},children:[void 0!==p&&(0,s.jsx)("option",{value:r,children:p}),void 0!==h&&(0,s.jsx)("option",{value:"",children:h}),d&&!y&&(0,s.jsx)("option",{value:d,children:b("model.notInList",{name:d})}),N.map(e=>(0,s.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(b("model.unavailable")):""]},e.name)),[...S.entries()].map(e=>{let[t,l]=e;return(0,s.jsx)("optgroup",{label:t,children:l.map(e=>(0,s.jsxs)("option",{value:e.name,disabled:e.disabled,children:[e.name,e.disabled?" — ".concat(b("model.unavailable")):""]},e.name))},t)})]})}},25669:(e,t,l)=>{"use strict";l.r(t),l.d(t,{default:()=>to});var s=l(73365),a=l(1521),n=l(18197),i=l.n(n),r=l(15549),c=l(87527),o=l(8205),d=l(46575);let u=[{id:"plain",name:"Plain text"},{id:"typescript",name:"TypeScript"},{id:"javascript",name:"JavaScript"},{id:"json",name:"JSON"},{id:"html",name:"HTML"},{id:"xml",name:"XML"},{id:"css",name:"CSS"},{id:"scss",name:"SCSS"},{id:"markdown",name:"Markdown"},{id:"powershell",name:"PowerShell"},{id:"batch",name:"Batch (cmd)"},{id:"shell",name:"Shell"},{id:"python",name:"Python"},{id:"csharp",name:"C#"},{id:"java",name:"Java"},{id:"kotlin",name:"Kotlin"},{id:"go",name:"Go"},{id:"rust",name:"Rust"},{id:"c",name:"C"},{id:"cpp",name:"C++"},{id:"swift",name:"Swift"},{id:"dart",name:"Dart"},{id:"php",name:"PHP"},{id:"ruby",name:"Ruby"},{id:"lua",name:"Lua"},{id:"sql",name:"SQL"},{id:"yaml",name:"YAML"},{id:"toml",name:"TOML"},{id:"ini",name:"INI / config"},{id:"dockerfile",name:"Dockerfile"},{id:"makefile",name:"Makefile"},{id:"vue",name:"Vue"}],h={ts:"typescript",tsx:"typescript",mts:"typescript",cts:"typescript",js:"javascript",jsx:"javascript",mjs:"javascript",cjs:"javascript",json:"json",jsonc:"json",json5:"json",webmanifest:"json",har:"json",css:"css",scss:"scss",sass:"scss",less:"scss",html:"html",htm:"html",xhtml:"html",svelte:"html",vue:"vue",xml:"xml",svg:"xml",xsd:"xml",xsl:"xml",csproj:"xml",props:"xml",targets:"xml",config:"xml",resx:"xml",plist:"xml",vbproj:"xml",fsproj:"xml",nuspec:"xml",md:"markdown",markdown:"markdown",mdx:"markdown",ps1:"powershell",psm1:"powershell",psd1:"powershell",bat:"batch",cmd:"batch",sh:"shell",bash:"shell",zsh:"shell",py:"python",pyw:"python",pyi:"python",cs:"csharp",csx:"csharp",java:"java",kt:"kotlin",kts:"kotlin",gradle:"kotlin",go:"go",rs:"rust",c:"c",h:"c",cpp:"cpp",cc:"cpp",cxx:"cpp",hpp:"cpp",hh:"cpp",hxx:"cpp",swift:"swift",dart:"dart",php:"php",rb:"ruby",lua:"lua",sql:"sql",yml:"yaml",yaml:"yaml",toml:"toml",ini:"ini",cfg:"ini",conf:"ini",properties:"ini",env:"ini",editorconfig:"ini",gitconfig:"ini",npmrc:"ini",dockerfile:"dockerfile",mk:"makefile"},p={dockerfile:"dockerfile",containerfile:"dockerfile",makefile:"makefile",gnumakefile:"makefile",".gitignore":"shell",".gitattributes":"shell",".dockerignore":"shell",".npmignore":"shell",".prettierignore":"shell",".eslintignore":"shell",".env":"ini",".editorconfig":"ini",".npmrc":"ini",".gitconfig":"ini",".babelrc":"json",".prettierrc":"json",".eslintrc":"json","tsconfig.json":"json","package.json":"json",gemfile:"ruby",rakefile:"ruby",jenkinsfile:"java"};function m(e){var t;let l=arguments.length>1&&void 0!==arguments[1]?arguments[1]:"",s=e.split("/").pop().toLowerCase();if(p[s])return p[s];if(s.startsWith(".env."))return"ini";if(s.startsWith("dockerfile."))return"dockerfile";let a=s.lastIndexOf(".");if(a>0&&h[s.slice(a+1)])return h[s.slice(a+1)];let n=null!=(t=l.slice(0,200).split(/\r?\n/)[0])?t:"",i=/^#!.*\b(python\d?|node|deno|bun|bash|sh|zsh|pwsh|powershell|ruby|php|lua)\b/.exec(n);if(i){let e=i[1];return e.startsWith("python")?"python":"node"===e||"deno"===e||"bun"===e?"javascript":"pwsh"===e||"powershell"===e?"powershell":"ruby"===e?"ruby":"php"===e?"php":"lua"===e?"lua":"shell"}let r=l.trimStart().slice(0,100);if(/^<\?xml\b/.test(r))return"xml";if(/^<!doctype html|^<html\b/i.test(r))return"html";if(/^[{[]/.test(r))try{return JSON.parse(l),"json"}catch(e){}return"plain"}let f=e=>e.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;"),x=(e,t)=>'<span class="hl-'.concat(e,'">').concat(f(t),"</span>"),b=e=>new Set(e.split(/\s+/).filter(Boolean)),v=b("break case catch class const continue debugger default delete do else export extends finally for from function if import in instanceof let new of return super switch this throw try typeof var void while with yield async await static get set as satisfies"),g=new Set([...v,...b("interface type enum implements namespace module declare abstract private protected public readonly keyof infer is asserts override accessor unique")]),w=b("string number boolean bigint symbol object unknown any never void undefined Record Partial Required Readonly Pick Omit Promise Array Map Set Date Error RegExp"),j=b("true false null undefined NaN Infinity"),k={typescript:{line:["//"],block:[["/*","*/"]],quotes:['"',"'","`"],multiline:["`"],keywords:g,types:w,literals:j,calls:!0,sigil:/^@[A-Za-z_]\w*/},javascript:{line:["//"],block:[["/*","*/"]],quotes:['"',"'","`"],multiline:["`"],keywords:v,literals:j,calls:!0},csharp:{line:["//"],block:[["/*","*/"]],quotes:['"',"'"],calls:!0,literals:b("true false null"),keywords:b("abstract as base break case catch checked class const continue default delegate do else enum event explicit extern finally fixed for foreach goto if implicit in interface internal is lock namespace new operator out override params private protected public readonly ref return sealed sizeof stackalloc static struct switch this throw try typeof unchecked unsafe using virtual volatile while async await var record init required get set value where yield partial"),types:b("bool byte char decimal double float int long object sbyte short string uint ulong ushort void dynamic Task List Dictionary")},java:{line:["//"],block:[["/*","*/"]],quotes:['"',"'"],calls:!0,literals:b("true false null"),keywords:b("abstract assert break case catch class const continue default do else enum extends final finally for goto if implements import instanceof interface native new package private protected public return static strictfp super switch synchronized this throw throws transient try volatile while var record sealed permits yield"),types:b("boolean byte char double float int long short void String Object List Map Integer"),sigil:/^@[A-Za-z_]\w*/},kotlin:{line:["//"],block:[["/*","*/"]],quotes:['"',"'"],calls:!0,literals:b("true false null"),keywords:b("as break class continue do else for fun if in interface is object package return super this throw try typealias typeof val var when while by catch constructor delegate dynamic field file finally get import init param property receiver set setparam where actual abstract annotation companion const crossinline data enum expect external final infix inline inner internal lateinit noinline open operator out override private protected public reified sealed suspend tailrec vararg"),types:b("Int Long Short Byte Double Float Boolean Char String Unit Any Nothing List Map Set"),sigil:/^@[A-Za-z_]\w*/},go:{line:["//"],block:[["/*","*/"]],quotes:['"',"'","`"],multiline:["`"],calls:!0,literals:b("true false nil iota"),keywords:b("break case chan const continue default defer else fallthrough for func go goto if import interface map package range return select struct switch type var"),types:b("bool byte complex64 complex128 error float32 float64 int int8 int16 int32 int64 rune string uint uint8 uint16 uint32 uint64 uintptr any")},rust:{line:["//"],block:[["/*","*/"]],quotes:['"'],calls:!0,literals:b("true false None Some Ok Err"),keywords:b("as async await break const continue crate dyn else enum extern fn for if impl in let loop match mod move mut pub ref return self Self static struct super trait type unsafe use where while"),types:b("bool char f32 f64 i8 i16 i32 i64 i128 isize str u8 u16 u32 u64 u128 usize String Vec Option Result Box"),sigil:/^#!?\[[^\]]*\]/},c:{line:["//"],block:[["/*","*/"]],quotes:['"',"'"],calls:!0,literals:b("true false NULL"),keywords:b("auto break case const continue default do else enum extern for goto if inline register restrict return sizeof static struct switch typedef union volatile while"),types:b("char double float int long short signed unsigned void size_t bool"),sigil:/^#\s*\w+/},cpp:{line:["//"],block:[["/*","*/"]],quotes:['"',"'"],calls:!0,literals:b("true false nullptr NULL"),keywords:b("alignas alignof and asm auto break case catch class const constexpr const_cast continue decltype default delete do dynamic_cast else enum explicit export extern for friend goto if inline mutable namespace new noexcept not operator or private protected public register reinterpret_cast return sizeof static static_assert static_cast struct switch template this thread_local throw try typedef typeid typename union using virtual volatile while override final concept requires co_await co_return co_yield"),types:b("bool char double float int long short signed unsigned void wchar_t size_t string vector map std"),sigil:/^#\s*\w+/},swift:{line:["//"],block:[["/*","*/"]],quotes:['"'],calls:!0,literals:b("true false nil"),keywords:b("associatedtype class deinit enum extension fileprivate func import init inout internal let open operator private protocol public rethrows static struct subscript typealias var break case continue default defer do else fallthrough for guard if in repeat return switch where while as catch is self Self super throw throws try async await some any"),types:b("Int Double Float Bool String Character Array Dictionary Set Optional Void"),sigil:/^@[A-Za-z_]\w*/},dart:{line:["//"],block:[["/*","*/"]],quotes:['"',"'"],calls:!0,literals:b("true false null"),keywords:b("abstract as assert async await break case catch class const continue covariant default deferred do dynamic else enum export extends extension external factory final finally for get hide if implements import in interface is late library mixin new on operator part required rethrow return set show static super switch sync this throw try typedef var void while with yield"),types:b("int double num bool String List Map Set Future Stream Object"),sigil:/^@[A-Za-z_]\w*/},php:{line:["//","#"],block:[["/*","*/"]],quotes:['"',"'"],calls:!0,caseless:!0,literals:b("true false null"),keywords:b("abstract and array as break callable case catch class clone const continue declare default do echo else elseif empty enddeclare endfor endforeach endif endswitch endwhile enum extends final finally fn for foreach function global goto if implements include include_once instanceof insteadof interface isset list match namespace new or print private protected public readonly require require_once return static switch throw trait try unset use var while xor yield"),sigil:/^\$[A-Za-z_]\w*/},lua:{line:["--"],block:[["--[[","]]"]],quotes:['"',"'"],calls:!0,literals:b("true false nil"),keywords:b("and break do else elseif end for function goto if in local not or repeat return then until while")},powershell:{line:["#"],block:[["<#","#>"]],quotes:['"',"'"],multiline:['"',"'"],caseless:!0,calls:!1,literals:b("$true $false $null"),keywords:b("begin break catch class continue data define do dynamicparam else elseif end enum exit filter finally for foreach from function hidden if in inlinescript param process return sequence static switch throw trap try until using var while workflow -and -or -not -xor -eq -ne -gt -ge -lt -le -like -notlike -match -notmatch -contains -notcontains -in -notin -replace -split -join -is -isnot -as -band -bor -f"),sigil:/^\$(?:\{[^}]*\}|[A-Za-z_][\w:]*|[?^$_])/},python:{line:["#"],quotes:['"""',"'''",'"',"'"],multiline:['"""',"'''"],calls:!0,literals:b("True False None"),keywords:b("and as assert async await break class continue def del elif else except finally for from global if import in is lambda nonlocal not or pass raise return try while with yield match case"),types:b("int float str bool list dict set tuple bytes object type self cls"),sigil:/^@[A-Za-z_][\w.]*/},ruby:{line:["#"],block:[["=begin","=end"]],quotes:['"',"'"],calls:!0,literals:b("true false nil"),keywords:b("alias and begin break case class def defined? do else elsif end ensure for if in module next not or redo rescue retry return self super then undef unless until when while yield require require_relative attr_accessor attr_reader attr_writer"),sigil:/^(?:@@?|\$)[A-Za-z_]\w*|^:[A-Za-z_]\w*/},shell:{line:["#"],quotes:['"',"'"],multiline:['"',"'"],literals:b("true false"),keywords:b("if then else elif fi case esac for select while until do done in function time coproc return exit export local readonly declare unset shift source alias echo cd"),sigil:/^\$(?:\{[^}]*\}|[A-Za-z_]\w*|[0-9@#?$!*-])/},batch:{line:["REM ","rem ","::"],quotes:['"'],caseless:!0,keywords:b("call cd chdir cls copy del dir echo else endlocal errorlevel exist exit for goto if in md mkdir move not off on pause popd pushd rd rem ren rmdir set setlocal shift start title type"),sigil:/^%[^%\s]+%|^%%?[A-Za-z0-9~]/},dockerfile:{line:["#"],quotes:['"',"'"],caseless:!0,keywords:b("from as run cmd label maintainer expose env add copy entrypoint volume user workdir arg onbuild stopsignal healthcheck shell"),sigil:/^\$(?:\{[^}]*\}|[A-Za-z_]\w*)/},makefile:{line:["#"],quotes:['"',"'"],keywords:b("ifeq ifneq ifdef ifndef else endif include define endef export override .PHONY"),sigil:/^\$(?:\([^)]*\)|\{[^}]*\}|[@<^*?%])/},sql:{line:["--"],block:[["/*","*/"]],quotes:["'",'"'],caseless:!0,calls:!0,literals:b("true false null"),keywords:b("select from where and or not insert into values update set delete create table view index drop alter add column primary key foreign references join left right inner outer full on as group by order having limit offset union all distinct case when then else end exists in is like between with returning begin commit rollback transaction grant revoke default constraint unique check if replace truncate procedure function trigger declare"),types:b("int integer bigint smallint decimal numeric float real double varchar char text date time timestamp boolean bool uuid json jsonb blob")}};function y(e,t){let l="",s=0,a=e.length,n=l=>t.caseless?e.substr(s,l.length).toLowerCase()===l.toLowerCase():e.startsWith(l,s),i=[...t.quotes].sort((e,t)=>t.length-e.length);for(;s<a;){var r,c,o,d,u,h,p;let m=e[s],b=null==(r=t.block)?void 0:r.find(e=>{let[t]=e;return n(t)});if(b){let t=e.indexOf(b[1],s+b[0].length),n=t<0?a:t+b[1].length;l+=x("com",e.slice(s,n)),s=n;continue}if(null==(c=t.line)?void 0:c.find(e=>n(e))){let t=e.indexOf("\n",s),n=t<0?a:t;l+=x("com",e.slice(s,n)),s=n;continue}let v=i.find(t=>e.startsWith(t,s));if(v){let n=s+v.length,i=null==(o=t.multiline)?void 0:o.includes(v),r=t!==k.powershell&&t!==k.batch&&(t!==k.shell&&t!==k.sql||"'"!==v);for(;n<a;){if("\\"===e[n]&&r){n+=2;continue}if(e.startsWith(v,n)){n+=v.length;break}if("\n"===e[n]&&!i)break;n+=1}l+=x("str",e.slice(s,Math.min(n,a))),s=Math.min(n,a);continue}if(t.sigil&&/[$@#%:[]/.test(m)){let a=t.sigil.exec(e.slice(s,s+200));if(a){let e=a[0];l+=x("@"===m||"#"===m||"["===m?"meta":"var",e),s+=e.length;continue}}if(/[0-9]/.test(m)||"."===m&&/[0-9]/.test(null!=(d=e[s+1])?d:"")){let t=null!=(u=e[s-1])?u:"";if(!/[\w$]/.test(t)){let t=/^(?:0[xX][\da-fA-F_]+|0[bB][01_]+|0[oO][0-7_]+|(?:\d[\d_]*\.?\d*|\.\d+)(?:[eE][+-]?\d+)?)[a-zA-Z]*/.exec(e.slice(s,s+64));if(t){l+=x("num",t[0]),s+=t[0].length;continue}}}if(/[A-Za-z_$-]/.test(m)){let a=/^-?[A-Za-z_$][\w$-]*\??/.exec(e.slice(s,s+120));if(a&&!(a[0].startsWith("-")&&!t.caseless)){let n=a[0];t!==k.powershell&&n.includes("-")&&(n=n.split("-")[0]||n.slice(0,1)),n||(n=m);let i=t.caseless?n.toLowerCase():n,r=(null==(h=t.literals)?void 0:h.has(i))?"lit":t.keywords.has(i)?"kw":(null==(p=t.types)?void 0:p.has(i))?"type":null;r?l+=x(r,n):t.calls&&"("===e[s+n.length]?l+=x("fn",n):/^[A-Z][a-z]\w*$/.test(n)&&t.types?l+=x("type",n):t===k.powershell&&/^[A-Z][a-z]+-[A-Z]\w*$/.test(n)?l+=x("fn",n):l+=f(n),s+=n.length;continue}}l+=f(m),s+=1}return l}function N(e,t){let l="",s=0,a=e.length;for(;s<a;){if(e.startsWith("\x3c!--",s)){let t=e.indexOf("--\x3e",s+4),n=t<0?a:t+3;l+=x("com",e.slice(s,n)),s=n;continue}if(e.startsWith("<![CDATA[",s)){let t=e.indexOf("]]>",s),n=t<0?a:t+3;l+=x("str",e.slice(s,n)),s=n;continue}let n=/^<\/?[A-Za-z!?][\w:.-]*/.exec(e.slice(s,s+100));if(n){let i=n[0];for(l+=x(i.startsWith("<!")||i.startsWith("<?")?"meta":"tag",i),s+=i.length;s<a&&">"!==e[s];){let t=/^[\s/?]+/.exec(e.slice(s,s+50));if(t){l+=f(t[0]),s+=t[0].length;continue}if('"'===e[s]||"'"===e[s]){let t=e.indexOf(e[s],s+1),n=t<0?a:t+1;l+=x("str",e.slice(s,n)),s=n;continue}let n=/^[^\s=>/"']+/.exec(e.slice(s,s+100));if(n){l+=x("attr",n[0]),s+=n[0].length;continue}l+=f(e[s]),s+=1}s<a&&(l+=x("tag",">"),s+=1);let r=i.toLowerCase();if(t&&("<script"===r||"<style"===r)){let t="<script"===r?"</script":"</style",n=e.toLowerCase().indexOf(t,s),i=n<0?a:n,c=e.slice(s,i);l+="<script"===r?y(c,k.javascript):S(c,!1),s=i}continue}if("&"===e[s]){let t=/^&[#\w]+;/.exec(e.slice(s,s+12));if(t){l+=x("lit",t[0]),s+=t[0].length;continue}}let i=e.indexOf("<",s+1),r=e.indexOf("&",s+1),c=Math.min(i<0?a:i,r<0?a:r);l+=f(e.slice(s,c)),s=c}return l}function S(e,t){let l="",s=0,a=e.length,n=0,i=!1;for(;s<a;){var r;let c=e[s];if(e.startsWith("/*",s)){let t=e.indexOf("*/",s+2),n=t<0?a:t+2;l+=x("com",e.slice(s,n)),s=n;continue}if(t&&e.startsWith("//",s)){let t=e.indexOf("\n",s),n=t<0?a:t;l+=x("com",e.slice(s,n)),s=n;continue}if('"'===c||"'"===c){let t=s+1;for(;t<a&&e[t]!==c&&"\n"!==e[t];)t+="\\"===e[t]?2:1;l+=x("str",e.slice(s,t+1)),s=t+1;continue}if("@"===c){let t=/^@[\w-]+/.exec(e.slice(s,s+40));if(t){l+=x("kw",t[0]),s+=t[0].length;continue}}if("$"===c&&t){let t=/^\$[\w-]+/.exec(e.slice(s,s+60));if(t){l+=x("var",t[0]),s+=t[0].length;continue}}if("{"===c&&(n+=1),"}"===c&&(n=Math.max(0,n-1),i=!1),";"===c&&(i=!1),":"===c&&n>0){l+=f(c),s+=1,i=!0;continue}if("#"===c&&i){let t=/^#[\da-fA-F]{3,8}\b/.exec(e.slice(s,s+12));if(t){l+=x("num",t[0]),s+=t[0].length;continue}}if(/[\d.]/.test(c)&&i&&!/[\w-]/.test(null!=(r=e[s-1])?r:"")){let t=/^-?(?:\d+\.?\d*|\.\d+)(?:%|[a-zA-Z]+)?/.exec(e.slice(s,s+20));if(t){l+=x("num",t[0]),s+=t[0].length;continue}}if(/[A-Za-z_-]/.test(c)){let t=/^-?-?[A-Za-z_][\w-]*/.exec(e.slice(s,s+80));if(t){let a=t[0];l+=n>0&&!i&&/^\s*:/.test(e.slice(s+a.length,s+a.length+10))?x("prop",a):i?/^(important|inherit|initial|unset|none|auto)$/.test(a)?x("lit",a):"("===e[s+a.length]?x("fn",a):f(a):x("tag",a),s+=a.length;continue}}l+=f(c),s+=1}return l}function C(e,t){switch(t){case"plain":return f(e);case"json":return e.replace(/("(?:[^"\\\n]|\\.)*")(\s*:)?|\/\/[^\n]*|\/\*[\s\S]*?\*\/|\b(true|false|null)\b|-?\b\d+(?:\.\d+)?(?:[eE][+-]?\d+)?\b|[&<>]/g,(e,t,l,s)=>void 0!==t?l?x("prop",t)+f(l):x("str",t):e.startsWith("//")||e.startsWith("/*")?x("com",e):s?x("lit",e):/^[&<>]$/.test(e)?f(e):x("num",e));case"html":case"vue":return N(e,!0);case"xml":return N(e,!1);case"css":return S(e,!1);case"scss":return S(e,!0);case"yaml":return e.split("\n").map(e=>{let t=/^(\s*(?:- )?)([^#:'"\n][^:#\n]*?)(:)(\s|$)(.*)$/.exec(e),l=e=>e.replace(/(#.*$)|("(?:[^"\\]|\\.)*"|'[^']*')|(\b(?:true|false|null|yes|no|on|off|~)\b)|(-?\b\d+(?:\.\d+)?\b)|([&*][\w-]+)|([&<>])/gi,(e,t,l,s,a,n,i)=>t?x("com",t):l?x("str",l):s?x("lit",s):a?x("num",a):n?x("var",n):i?f(i):f(e));return/^\s*#/.test(e)?x("com",e):/^\s*---|^\s*\.\.\./.test(e)?x("meta",e):t?f(t[1])+x("prop",t[2])+f(t[3])+f(t[4])+l(t[5]):l(e)}).join("\n");case"ini":case"toml":return e.split("\n").map(e=>{if(/^\s*[#;]/.test(e))return x("com",e);let t=/^(\s*)(\[\[?[^\]]*\]\]?)(.*)$/.exec(e);if(t)return f(t[1])+x("head",t[2])+f(t[3]);let l=/^(\s*)([^=:\s][^=:]*?)(\s*[=:]\s*)(.*)$/.exec(e);if(l){let e=l[4],t=/^(".*"|'.*')$/.test(e.trim())?x("str",e):/^-?\d+(\.\d+)?$/.test(e.trim())?x("num",e):/^(true|false|yes|no|on|off)$/i.test(e.trim())?x("lit",e):f(e);return f(l[1])+x("prop",l[2])+f(l[3])+t}return f(e)}).join("\n");case"markdown":return function(e){let t=e.split("\n"),l=[],s=null;for(let e of t){if(s){e.trimStart().startsWith(s.mark)?(l.push(s.body.length?C(s.body.join("\n"),s.lang):""),l.push(x("code",e)),s=null):s.body.push(e);continue}let t=/^(\s*)(```+|~~~+)\s*([\w+#-]*)/.exec(e);if(t){var a,n,i;let r=t[3]?null!=(i=h[t[3].toLowerCase()])?i:null!=(n=null==(a=u.find(e=>e.name.toLowerCase()===t[3].toLowerCase()))?void 0:a.id)?n:"plain":"plain";s={mark:t[2],lang:r,body:[]},l.push(x("code",e));continue}if(/^\s{0,3}#{1,6}\s/.test(e)){l.push(x("head",e));continue}if(/^\s*>/.test(e)){l.push(x("com",e));continue}let r=f(e);r=r.replace(/^(\s*)([-*+]|\d+[.)])(\s)/,(e,t,l,s)=>"".concat(t,'<span class="hl-kw">').concat(l,"</span>").concat(s)).replace(/(`+)([^`]+?)\1/g,e=>'<span class="hl-code">'.concat(e,"</span>")).replace(RegExp("(\\*\\*|__)(?=\\S)(.+?)(?<=\\S)\\1","g"),e=>'<span class="hl-head">'.concat(e,"</span>")).replace(RegExp("(^|[^*\\w])(\\*|_)(?=\\S)(.+?)(?<=\\S)\\2(?!\\w)","g"),(e,t,l,s)=>"".concat(t,'<span class="hl-em">').concat(l).concat(s).concat(l,"</span>")).replace(/(!?\[[^\]]*\])(\([^)]*\))/g,(e,t,l)=>'<span class="hl-str">'.concat(t,'</span><span class="hl-link">').concat(l,"</span>")),l.push(r)}return s&&l.push(C(s.body.join("\n"),s.lang)),l.join("\n")}(e);default:{let l=k[t];return l?y(e,l):f(e)}}}let M={typescript:{text:"TS",color:"#3178c6"},javascript:{text:"JS",color:"#b89a00"},json:{text:"{}",color:"#c48c12"},html:{text:"<>",color:"#e34c26"},xml:{text:"<>",color:"#e37933"},css:{text:"#",color:"#2f6fe0"},scss:{text:"S",color:"#cd6799"},markdown:{text:"M↓",color:"#3f7fbf"},powershell:{text:"PS",color:"#2a7bd0"},batch:{text:"BAT",color:"#7c8a96"},shell:{text:"$_",color:"#4a9e22"},python:{text:"PY",color:"#3d7fbf"},csharp:{text:"C#",color:"#9b4dca"},java:{text:"J",color:"#b07219"},kotlin:{text:"K",color:"#7f52ff"},go:{text:"GO",color:"#00a3cc"},rust:{text:"RS",color:"#c4561f"},c:{text:"C",color:"#6f8aa6"},cpp:{text:"C++",color:"#d6336c"},swift:{text:"SW",color:"#f05138"},dart:{text:"DT",color:"#0a85d6"},php:{text:"PHP",color:"#777bb4"},ruby:{text:"RB",color:"#cc342d"},lua:{text:"LUA",color:"#5466d6"},sql:{text:"SQL",color:"#d48a00"},yaml:{text:"Y",color:"#cb3a3a"},toml:{text:"T",color:"#b5562a"},ini:{glyph:"gear",color:"#7c8a96"},dockerfile:{text:"D",color:"#2496ed"},makefile:{text:"MK",color:"#7c8a96"},vue:{text:"V",color:"#3fae7c"}},F={glyph:"image",color:"#a074c4"},O={glyph:"archive",color:"#a07d3e"},L={png:F,jpg:F,jpeg:F,gif:F,webp:F,ico:F,bmp:F,svg:{text:"SVG",color:"#d6922d"},pdf:{text:"PDF",color:"#d03b35"},csv:{text:"CSV",color:"#2e8a55"},xlsx:{text:"XLS",color:"#2e8a55"},docx:{text:"DOC",color:"#3a6cc0"},pptx:{text:"PPT",color:"#d04a26"},zip:O,gz:O,"7z":O,tgz:O,txt:{text:"TXT",color:"#7c8a96"},log:{text:"LOG",color:"#7c8a96"},lock:{glyph:"lock",color:"#7c8a96"},exe:{text:"EXE",color:"#7c8a96"},dll:{text:"DLL",color:"#7c8a96"},sln:{text:"SLN",color:"#9b4dca"},csproj:{text:"C#",color:"#9b4dca"},tsx:{text:"TSX",color:"#3178c6"},jsx:{text:"JSX",color:"#b89a00"}},q={glyph:"git",color:"#f14e32"},E={".gitignore":q,".gitattributes":q,".gitmodules":q,"package.json":{text:"npm",color:"#cb3837"},"package-lock.json":{text:"npm",color:"#cb3837"},license:{text:"\xa9",color:"#7c8a96"},"license.md":{text:"\xa9",color:"#7c8a96"},"license.txt":{text:"\xa9",color:"#7c8a96"},".env":{glyph:"gear",color:"#c49a10"}};[...Object.values(M),...Object.values(L),...Object.values(E)].filter(e=>!!e);let I=e=>{let t=e.replace("#",""),l=3===t.length?t.split("").map(e=>e+e).join(""):t;return[0,2,4].map(e=>parseInt(l.slice(e,e+2),16))},D=e=>{let[t,l,s]=e;return"#".concat([t,l,s].map(e=>Math.round(e).toString(16).padStart(2,"0")).join(""))};function H(e){let[t,l,s]=I(e).map(e=>{let t=e/255;return t<=.03928?t/12.92:((t+.055)/1.055)**2.4});return .2126*t+.7152*l+.0722*s}let z=new Map;function W(e){let{glyph:t}=e;switch(t){case"image":return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("circle",{cx:"11",cy:"4.5",r:"1.8",fill:"currentColor"}),(0,s.jsx)("path",{d:"M1 14 6 7l3.5 4.5L11.5 9 15 14z",fill:"currentColor"})]});case"git":return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("path",{d:"M4.5 3v10M4.5 9.5c0-2.5 7-2 7-5",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round"}),(0,s.jsx)("circle",{cx:"4.5",cy:"3",r:"1.9",fill:"currentColor"}),(0,s.jsx)("circle",{cx:"4.5",cy:"13",r:"1.9",fill:"currentColor"}),(0,s.jsx)("circle",{cx:"11.5",cy:"4.5",r:"1.9",fill:"currentColor"})]});case"lock":return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("path",{d:"M5 7V5a3 3 0 0 1 6 0v2",fill:"none",stroke:"currentColor",strokeWidth:"1.8"}),(0,s.jsx)("rect",{x:"3",y:"7",width:"10",height:"8",rx:"1.5",fill:"currentColor"})]});case"gear":return(0,s.jsx)("path",{d:"M8 5.2a2.8 2.8 0 1 0 0 5.6 2.8 2.8 0 0 0 0-5.6zM7 1h2l.4 1.9 1.3.6 1.7-1 1.4 1.4-1 1.7.6 1.3L15 7v2l-1.9.4-.6 1.3 1 1.7-1.4 1.4-1.7-1-1.3.6L9 15H7l-.4-1.9-1.3-.6-1.7 1-1.4-1.4 1-1.7-.6-1.3L1 9V7l1.9-.4.6-1.3-1-1.7 1.4-1.4 1.7 1 1.3-.6z",fill:"currentColor",fillRule:"evenodd"});case"archive":return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("path",{d:"M2 4h12v10H2z",fill:"none",stroke:"currentColor",strokeWidth:"1.6",strokeLinejoin:"round"}),(0,s.jsx)("path",{d:"M8 4v1.5M8 7v1.5M8 10v1.5",stroke:"currentColor",strokeWidth:"1.6"}),(0,s.jsx)("path",{d:"M1.5 1.5h13V4h-13z",fill:"currentColor"})]})}}let A=e=>({"--ico":e.color,"--ico-dark":function(e){let t=z.get(e);if(t)return t;let l=I(e),s=D(l);for(let e=.12;e<=1&&!(function(e,t){let[l,s]=[H(e),H(t)].sort((e,t)=>t-e);return(l+.05)/(s+.05)}(s=D(l.map(t=>t+(255-t)*e)),"#152436")>=4.8);e+=.04);return z.set(e,s),s}(e.color)});function T(e){var t;let{path:l}=e,a=function(e){var t;let l=e.split("/").pop().toLowerCase();if(E[l])return E[l];let s=l.lastIndexOf("."),a=s>0?l.slice(s+1):"";return L[a]?L[a]:null!=(t=M[m(e)])?t:null}(l);if(!a)return(0,s.jsxs)("svg",{className:"file-ico",viewBox:"0 0 16 16","aria-hidden":"true",children:[(0,s.jsx)("path",{d:"M3.5 1.5h6l3 3v10h-9z",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"}),(0,s.jsx)("path",{d:"M9.5 1.5v3h3",fill:"none",stroke:"currentColor",strokeWidth:"1.2",strokeLinejoin:"round"})]});if(a.glyph)return(0,s.jsx)("svg",{className:"file-ico marked",viewBox:"0 0 16 16","aria-hidden":"true",style:A(a),children:(0,s.jsx)(W,{glyph:a.glyph})});let n=null!=(t=a.text)?t:"",i=n.length>=3?9.2:2===n.length?11.5:15;return(0,s.jsx)("svg",{className:"file-ico marked",viewBox:"0 0 16 16","aria-hidden":"true",style:A(a),children:(0,s.jsx)("text",{x:"8",y:"8.6",textAnchor:"middle",dominantBaseline:"middle",fontFamily:"'Segoe UI', system-ui, sans-serif",fontWeight:"800",fontSize:i,fill:"currentColor",...n.length>=2?{textLength:n.length>=3?16:15,lengthAdjust:"spacingAndGlyphs"}:{},children:n})})}var R=l(11272);function _(e){let{view:t,onOpen:l,workspace:a,onOpenFolder:n,grip:i}=e;return"commits"===t?(0,s.jsx)(Z,{workspace:a,onOpen:l,onOpenFolder:n,grip:i}):(0,s.jsx)(K,{workspace:a,onOpen:l,onOpenFolder:n,grip:i})}function P(e){let{title:t,children:l,grip:a}=e;return(0,s.jsxs)("div",{className:"wb-side-head",children:[a,(0,s.jsx)("h2",{children:t}),(0,s.jsx)("span",{className:"grow"}),l]})}let $=(e,t)=>e.localeCompare(t,void 0,{sensitivity:"base"});function K(e){let{workspace:t,onOpen:l,onOpenFolder:n,grip:i}=e,{t:d}=(0,o.kj)(),[u,h]=(0,a.useState)(null),[p,m]=(0,a.useState)(""),[f,x]=(0,a.useState)(new Set),b=()=>(null==t?void 0:t.ok)?r.FH.workspaceFiles().then(e=>{h(e.files),m("")}).catch(e=>m(e.message)):Promise.resolve();(0,a.useEffect)(()=>{h(null),b()},[null==t?void 0:t.dir,null==t?void 0:t.ok]),(0,c.z)(b,6e3,!!(null==t?void 0:t.ok));let v=(e,t)=>(0,s.jsxs)(s.Fragment,{children:[[...e.dirs.keys()].sort($).map(l=>{let a=t?"".concat(t,"/").concat(l):l;return(0,s.jsxs)("li",{role:"treeitem","aria-expanded":f.has(a),children:[(0,s.jsxs)("button",{type:"button",className:"wb-row",onClick:()=>x(e=>{let t=new Set(e);return t.has(a)?t.delete(a):t.add(a),t}),children:[(0,s.jsx)("span",{className:"wb-chev","aria-hidden":"true",children:f.has(a)?"▾":"▸"}),(0,s.jsx)("span",{className:"wb-row-name",children:l})]}),f.has(a)&&(0,s.jsx)("ul",{role:"group",children:v(e.dirs.get(l),a)})]},"d:".concat(a))}),[...e.files].sort((e,t)=>$(e.split("/").pop(),t.split("/").pop())).map(e=>(0,s.jsx)("li",{role:"treeitem",children:(0,s.jsxs)("button",{type:"button",className:"wb-row file",onClick:()=>l({kind:"file",path:e}),title:e,children:[(0,s.jsx)(T,{path:e}),(0,s.jsx)("span",{className:"wb-row-name",children:e.split("/").pop()})]})},"f:".concat(e)))]});return(0,s.jsxs)("div",{className:"wb-tree",children:[(0,s.jsxs)(P,{title:(null==t?void 0:t.ok)?t.name:d("wb.files"),grip:i,children:[(0,s.jsx)("button",{type:"button",className:"wb-icon-btn",onClick:n,title:d("chat.openFolder"),"aria-label":d("chat.openFolder"),children:"⋯"}),(0,s.jsx)("button",{type:"button",className:"wb-icon-btn",onClick:()=>void b(),title:d("wb.refresh"),"aria-label":d("wb.refresh"),children:"↻"})]}),t?t.ok?p?(0,s.jsx)("p",{className:"err small wb-pad",children:p}):u?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("p",{className:"muted small wb-pad",title:t.dir,children:t.branch?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)(R.O,{})," ",t.branch]}):t.dir}),(0,s.jsx)("ul",{className:"wb-tree-list",role:"tree","aria-label":d("wb.files"),children:v(function(e){let t={dirs:new Map,files:[]};for(let l of e){let e=l.split("/"),s=t;for(let t of e.slice(0,-1)){let e=s.dirs.get(t);e||(e={dirs:new Map,files:[]},s.dirs.set(t,e)),s=e}s.files.push(l)}return t}(u),"")})]}):(0,s.jsx)("p",{className:"muted small wb-pad",children:d("wb.loading")}):(0,s.jsxs)("div",{className:"wb-pad",children:[(0,s.jsx)("p",{className:"small",children:t.problem}),(0,s.jsx)("button",{type:"button",className:"primary",onClick:n,children:d("chat.openFolder")})]}):(0,s.jsx)("p",{className:"muted small wb-pad",children:d("wb.loading")})]})}function Z(e){var t;let{workspace:l,onOpen:n,onOpenFolder:i,grip:d}=e,{t:u}=(0,o.kj)(),h=(0,o.W3)(),[p,m]=(0,a.useState)(null),[f,x]=(0,a.useState)(""),[b,v]=(0,a.useState)(new Set),[g,w]=(0,a.useState)(""),[j,k]=(0,a.useState)(new Map),y=(0,a.useCallback)(()=>r.FH.workspaceGit().then(e=>{m(e),x("")}).catch(e=>x(e.message)),[]);(0,a.useEffect)(()=>{m(null),(null==l?void 0:l.ok)&&y()},[y,null==l?void 0:l.ok,null==l?void 0:l.dir]),(0,c.z)(y,5e3,!!(null==l?void 0:l.ok));let N=(e,t,l)=>{let a,i=e.path.lastIndexOf("/");return(0,s.jsx)("li",{children:(0,s.jsxs)("button",{type:"button",className:"wb-row wb-git-file",onClick:()=>n({kind:"diff",area:t,path:e.path,...l?{commit:l}:{}}),title:"".concat(e.oldPath?"".concat(e.oldPath," → "):"").concat(e.path," \xb7 ").concat((a=e.status,u("git.status.".concat("!"===a?"conflict":a)))),children:[(0,s.jsx)(T,{path:e.path}),(0,s.jsx)("span",{className:"wb-row-name",children:e.path.slice(i+1)}),i>=0&&(0,s.jsx)("span",{className:"muted wb-git-dir",children:e.path.slice(0,i)}),(0,s.jsx)("span",{className:"grow"}),(0,s.jsx)("span",{className:"wb-git-counts",children:e.added<0?u("diff.binaryShort"):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("span",{className:"plus",children:["+",e.added]})," ",(0,s.jsxs)("span",{className:"minus",children:["−",e.removed]})]})}),(0,s.jsx)("span",{className:"wb-git-status s-".concat("!"===e.status?"conflict":e.status),"aria-hidden":"true",children:e.status})]})},"".concat(t,":").concat(null!=l?l:"",":").concat(e.path))},S=(e,t,l,a)=>(0,s.jsxs)("div",{className:"wb-git-section",children:[(0,s.jsxs)("button",{type:"button",className:"wb-git-head","aria-expanded":!b.has(e),onClick:()=>v(t=>new Set(t.has(e)?[...t].filter(t=>t!==e):[...t,e])),children:[(0,s.jsx)("span",{"aria-hidden":"true",children:b.has(e)?"▸":"▾"})," ",t,null!==l&&(0,s.jsx)("span",{className:"wb-badge",children:l})]}),!b.has(e)&&a]});return(0,s.jsxs)("div",{className:"wb-tree",children:[(0,s.jsx)(P,{title:u("git.title"),grip:d,children:(0,s.jsx)("button",{type:"button",className:"wb-icon-btn",onClick:()=>void y(),title:u("git.refresh"),"aria-label":u("git.refresh"),disabled:!(null==l?void 0:l.ok),children:"↻"})}),(null==l?void 0:l.ok)?f?(0,s.jsx)("p",{className:"err small wb-pad",children:f}):p?p.isRepo?(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("p",{className:"small wb-pad wb-git-branch",children:[(0,s.jsx)(R.O,{})," ",(0,s.jsx)("strong",{children:null!=(t=p.branch)?t:"HEAD"}),p.upstream&&(0,s.jsxs)("span",{className:"muted",children:[" \xb7 ",u("git.upstream",{name:p.upstream.name,ahead:p.upstream.ahead,behind:p.upstream.behind})]})]}),p.staged.length>0&&S("staged",u("git.staged"),p.staged.length,(0,s.jsx)("ul",{className:"wb-git-files",children:p.staged.map(e=>N(e,"staged"))})),S("changes",u("git.changes"),p.changes.length,0===p.changes.length?(0,s.jsx)("p",{className:"muted small wb-pad",children:u("git.noChanges")}):(0,s.jsx)("ul",{className:"wb-git-files",children:p.changes.map(e=>N(e,"changes"))})),S("commits",u("git.commits"),null,0===p.commits.length?(0,s.jsx)("p",{className:"muted small wb-pad",children:u("git.noCommits")}):(0,s.jsx)("ul",{className:"wb-commits",children:p.commits.map(e=>{let t=j.get(e.sha);return(0,s.jsxs)("li",{children:[(0,s.jsxs)("button",{type:"button",className:"wb-row","aria-expanded":g===e.sha,onClick:()=>(e=>{if(g===e)return void w("");w(e),j.has(e)||r.FH.workspaceCommit(e).then(t=>k(l=>new Map(l).set(e,t.files))).catch(t=>k(l=>new Map(l).set(e,t.message)))})(e.sha),title:e.subject,children:[(0,s.jsx)("span",{"aria-hidden":"true",children:g===e.sha?"▾":"▸"}),(0,s.jsx)("code",{children:e.short}),(0,s.jsx)("span",{className:"wb-row-name",children:e.subject})]}),(0,s.jsxs)("div",{className:"muted wb-commit-meta",children:[e.author," \xb7 ",h(e.at)]}),g===e.sha&&(void 0===t?(0,s.jsx)("p",{className:"muted small wb-pad",children:u("wb.loading")}):"string"==typeof t?(0,s.jsx)("p",{className:"err small wb-pad",children:t}):(0,s.jsx)("ul",{className:"wb-git-files nested","aria-label":u("git.commitFiles",{sha:e.short}),children:t.map(t=>N(t,"commit",e.sha))}))]},e.sha)})})),p.moreCommits&&(0,s.jsx)("p",{className:"muted small wb-pad",children:u("git.more",{n:p.commits.length})})]}):(0,s.jsx)("p",{className:"muted small wb-pad",children:u("git.notRepo")}):(0,s.jsx)("p",{className:"muted small wb-pad",children:u("wb.loading")}):(0,s.jsxs)("div",{className:"wb-pad",children:[(0,s.jsx)("p",{className:"muted small",children:u("git.noFolder")}),(0,s.jsx)("button",{type:"button",onClick:i,children:u("chat.openFolder")})]})]})}let B=/^(\s{0,3})(`{3,}|~{3,})\s*([^\s`]*)?.*$/,U=/^(\s*)([-*+]|\d{1,9}[.)])\s+(.*)$/;function V(e,t){if(/^[a-z][a-z0-9+.-]*:/i.test(t)||t.startsWith("//"))return null;let l=decodeURI(t.split("#")[0].split("?")[0]),s=(l.startsWith("/")?l.slice(1):"".concat(e).concat(e?"/":"").concat(l)).split("/"),a=[];for(let e of s)if(""!==e&&"."!==e)if(".."===e){if(0===a.length)return null;a.pop()}else a.push(e);return a.join("/")}function J(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"i",a=[],n=e,i=0,c=()=>"".concat(l,"-").concat(i++),o=[[/^\\([\\`*_{}[\]()#+\-.!|~<>])/,e=>e[1]],[/^(`+)([\s\S]*?[^`])\1(?!`)/,e=>(0,s.jsx)("code",{children:e[2].replace(/^ (.*) $/,"$1")},c())],[/^!\[([^\]]*)\]\(\s*<?([^\s)>]+)>?(?:\s+"([^"]*)")?\s*\)/,e=>{let l=V(t.dir,e[2]);return null===l?(0,s.jsxs)("a",{href:e[2],target:"_blank",rel:"noopener noreferrer",title:t.t("md.externalImage",{url:e[2]}),children:["\uD83D\uDDBC ",e[1]||e[2]]},c()):(0,s.jsx)("img",{src:"".concat(r.nC,"/workspace/raw?path=").concat(encodeURIComponent(l)),alt:e[1],title:e[3],loading:"lazy"},c())}],[/^\[((?:[^\][]|\[[^\]]*\])*)\]\(\s*<?([^\s)>]*)>?(?:\s+"([^"]*)")?\s*\)/,e=>d(e[2],J(e[1],t,c()),e[3])],[/^<(https?:\/\/[^>\s]+)>/,e=>d(e[1],[e[1]])],[/^(https?:\/\/[^\s<>()]+[^\s<>().,;:!?'"])/,e=>d(e[1],[e[1]])],[/^(\*\*|__)(?=\S)([\s\S]*?\S)\1/,e=>(0,s.jsx)("strong",{children:J(e[2],t,c())},c())],[RegExp("^(\\*|_)(?=\\S)([\\s\\S]*?\\S)\\1(?![\\p{L}\\p{N}])","u"),e=>(0,s.jsx)("em",{children:J(e[2],t,c())},c())],[/^~~(?=\S)([\s\S]*?\S)~~/,e=>(0,s.jsx)("del",{children:J(e[1],t,c())},c())],[/^( {2,}|\\)\n/,()=>(0,s.jsx)("br",{},c())]];function d(e,l,a){if(e.startsWith("#"))return(0,s.jsx)("a",{href:e,title:a,children:l},c());let n=V(t.dir,e);return null!==n?(0,s.jsx)("a",{href:"#".concat(n),title:null!=a?a:n,onClick:e=>{e.preventDefault(),t.onOpenFile(n)},children:l},c()):(0,s.jsx)("a",{href:e,target:"_blank",rel:"noopener noreferrer",title:a,children:l},c())}let u="",h=()=>{u&&a.push(u),u=""};for(;n.length>0;){let e=!1;for(let[t,l]of o){let s=t.exec(n);if(s){h(),a.push(l(s)),n=n.slice(s[0].length),e=!0;break}}e||(u+=n[0],n=n.slice(1))}return h(),a}function X(e){let{code:t}=e,{t:n}=(0,o.kj)(),i=(0,a.useId)().replace(/[^a-zA-Z0-9]/g,""),[r,c]=(0,a.useState)(""),[d,u]=(0,a.useState)(""),[h,p]=(0,a.useState)("");return((0,a.useEffect)(()=>{let e=()=>{var e;return p(null!=(e=document.documentElement.dataset.theme)?e:"light")};e();let t=new MutationObserver(e);return t.observe(document.documentElement,{attributes:!0,attributeFilter:["data-theme"]}),()=>t.disconnect()},[]),(0,a.useEffect)(()=>{if(!h)return;let e=!1;return(async()=>{try{let s=(await Promise.all([l.e(7100),l.e(8653),l.e(9891)]).then(l.bind(l,50879))).default;s.initialize({startOnLoad:!1,securityLevel:"strict",theme:"dark"===h?"dark":"default",fontFamily:"inherit"});let a=await s.render("mmd-".concat(i,"-").concat(h),t);e||(c(a.svg),u(""))}catch(t){var s;e||u(null!=(s=t.message.split("\n")[0])?s:String(t))}})(),()=>{e=!0}},[t,h,i]),d)?(0,s.jsxs)("div",{className:"md-mermaid bad",children:[(0,s.jsx)("p",{className:"small",children:n("md.mermaidError",{why:d})}),(0,s.jsx)("pre",{children:(0,s.jsx)("code",{children:t})})]}):r?(0,s.jsx)("div",{className:"md-mermaid",role:"img","aria-label":t.split("\n")[0],dangerouslySetInnerHTML:{__html:r}}):(0,s.jsx)("p",{className:"md-mermaid muted small",children:n("md.mermaidLoading")})}function Y(e){let{text:t,path:l,onOpenFile:a}=e,{t:n}=(0,o.kj)(),i=l.includes("/")?l.slice(0,l.lastIndexOf("/")):"";return(0,s.jsx)("article",{className:"md",children:function e(t,l){let a=arguments.length>2&&void 0!==arguments[2]?arguments[2]:"b";return t.map((t,n)=>{let i="".concat(a,"-").concat(n);switch(t.kind){case"heading":{let e="h".concat(t.level);return(0,s.jsx)(e,{id:t.text.toLowerCase().replace(/[`*_~[\]()]/g,"").replace(RegExp("[^\\p{L}\\p{N}\\s-]","gu"),"").trim().replace(/\s+/g,"-"),children:J(t.text,l,i)},i)}case"para":return(0,s.jsx)("p",{children:J(t.text,l,i)},i);case"rule":return(0,s.jsx)("hr",{},i);case"html":return(0,s.jsx)("pre",{className:"md-html",children:(0,s.jsx)("code",{children:t.text})},i);case"quote":return(0,s.jsx)("blockquote",{children:e(t.blocks,l,i)},i);case"code":{var r,c;if("mermaid"===t.lang)return(0,s.jsx)(X,{code:t.text},i);let e=null!=(c=null==(r=u.find(e=>e.id===t.lang||e.name.toLowerCase()===t.lang))?void 0:r.id)?c:({ts:"typescript",tsx:"typescript",js:"javascript",jsx:"javascript",sh:"shell",bash:"shell",zsh:"shell",ps1:"powershell",pwsh:"powershell",py:"python",cs:"csharp","c#":"csharp",yml:"yaml",md:"markdown",html:"html",xml:"xml",json:"json",css:"css",sql:"sql",rs:"rust",go:"go",java:"java",kt:"kotlin",rb:"ruby",php:"php",cpp:"cpp","c++":"cpp",c:"c",bat:"batch",cmd:"batch",toml:"toml",ini:"ini",dockerfile:"dockerfile"})[t.lang];return(0,s.jsx)("pre",{className:"md-code",children:e?(0,s.jsx)("code",{dangerouslySetInnerHTML:{__html:C(t.text,e)}}):(0,s.jsx)("code",{children:t.text})},i)}case"list":{let a=t.items.map((t,a)=>(0,s.jsxs)("li",{className:t.task?"md-task":void 0,children:[t.task&&(0,s.jsx)("input",{type:"checkbox",checked:!!t.done,disabled:!0,"aria-label":t.done?"✓":"○"}),1===t.blocks.length&&"para"===t.blocks[0].kind?J(t.blocks[0].text,l,"".concat(i,"-").concat(a)):e(t.blocks,l,"".concat(i,"-").concat(a))]},"".concat(i,"-").concat(a)));return t.ordered?(0,s.jsx)("ol",{start:t.start,children:a},i):(0,s.jsx)("ul",{children:a},i)}case"table":return(0,s.jsx)("div",{className:"md-table",children:(0,s.jsxs)("table",{children:[(0,s.jsx)("thead",{children:(0,s.jsx)("tr",{children:t.head.map((e,a)=>(0,s.jsx)("th",{style:t.align[a]?{textAlign:t.align[a]}:void 0,children:J(e,l,"".concat(i,"-h").concat(a))},a))})}),(0,s.jsx)("tbody",{children:t.rows.map((e,a)=>(0,s.jsx)("tr",{children:t.head.map((n,r)=>{var c;return(0,s.jsx)("td",{style:t.align[r]?{textAlign:t.align[r]}:void 0,children:J(null!=(c=e[r])?c:"",l,"".concat(i,"-").concat(a,"-").concat(r))},r)})},a))})]})},i)}})}(function e(t){let l=t.replace(/\r\n?/g,"\n").split("\n"),s=[],a=0,n=e=>void 0===e||""===e.trim();for(;a<l.length;){var i,r,c,o,d,u,h,p;let t=l[a];if(n(t)){a+=1;continue}let m=B.exec(t);if(m){let e=m[2],t=[];for(a+=1;a<l.length&&!l[a].trim().startsWith(e[0].repeat(e.length));)t.push(l[a++]);a+=1,s.push({kind:"code",lang:(null!=(i=m[3])?i:"").toLowerCase(),text:t.join("\n")});continue}let f=/^\s{0,3}(#{1,6})\s+(.*?)\s*#*\s*$/.exec(t);if(f){s.push({kind:"heading",level:f[1].length,text:f[2]}),a+=1;continue}if(/^\s{0,3}([-*_])(\s*\1){2,}\s*$/.test(t)){s.push({kind:"rule"}),a+=1;continue}if(/^\s{0,3}>/.test(t)){let t=[];for(;a<l.length&&!n(l[a])&&(/^\s{0,3}>/.test(l[a])||t.length>0)&&!(!/^\s{0,3}>/.test(l[a])&&(B.test(l[a])||U.test(l[a])));)t.push(l[a].replace(/^\s{0,3}>\s?/,"")),a+=1;s.push({kind:"quote",blocks:e(t.join("\n"))});continue}if(t.includes("|")&&a+1<l.length&&/^\s*\|?\s*:?-{1,}:?\s*(\|\s*:?-{1,}:?\s*)*\|?\s*$/.test(l[a+1])){let e=e=>e.trim().replace(/^\|/,"").replace(/\|$/,"").split(RegExp("(?<!\\\\)\\|")).map(e=>e.trim().replace(/\\\|/g,"|")),i=e(t),r=e(l[a+1]).map(e=>e.startsWith(":")&&e.endsWith(":")?"center":e.endsWith(":")?"right":e.startsWith(":")?"left":"");a+=2;let c=[];for(;a<l.length&&!n(l[a])&&l[a].includes("|");)c.push(e(l[a++]));s.push({kind:"table",head:i,align:r,rows:c});continue}let x=U.exec(t);if(x){let t=x[1].length,i=/\d/.test(x[2]),m=[];for(;a<l.length;){let s=U.exec(l[a]);if(!s||s[1].length!==t||/\d/.test(s[2])!==i)break;let f=[s[3]];for(a+=1;a<l.length;){let e=l[a],s=U.exec(e);if(n(e)){if(a+1<l.length&&(null!=(u=null==(d=l[a+1].match(/^\s*/))?void 0:d[0].length)?u:0)>t&&!n(l[a+1])){f.push(""),a+=1;continue}break}if(s&&s[1].length<=t)break;let r=null!=(h=null==(o=e.match(/^\s*/))?void 0:o[0].length)?h:0;if(r<=t&&!s&&/^\s{0,3}(#|>|```|~~~)/.test(e))break;f.push(r>t?e.slice(Math.min(r,t+2+ +!!i)):e.trim()),a+=1}let x=/^\[([ xX])\]\s+/.exec(f[0]);for(x&&(f[0]=f[0].slice(x[0].length)),m.push({blocks:e(f.join("\n")),...x?{task:!0,done:" "!==x[1]}:{}});a<l.length&&n(l[a])&&(null==(c=U.exec(null!=(p=l[a+1])?p:""))||null==(r=c[1])?void 0:r.length)===t;)a+=1}s.push({kind:"list",ordered:i,start:i?parseInt(x[2],10):1,items:m});continue}if(/^\s{0,3}<[a-zA-Z!/]/.test(t)){let e=[];for(;a<l.length&&!n(l[a]);)e.push(l[a++]);s.push({kind:"html",text:e.join("\n")});continue}let b=[];for(;a<l.length&&!n(l[a])&&!B.test(l[a])&&!/^\s{0,3}(#{1,6}\s|>)/.test(l[a])&&!(b.length>0&&U.test(l[a]));){if(b.length>0&&/^\s{0,3}(=+|-+)\s*$/.test(l[a])){s.push({kind:"heading",level:l[a].trim().startsWith("=")?1:2,text:b.join(" ")}),b.length=0,a+=1;break}b.push(l[a++])}b.length>0&&s.push({kind:"para",text:b.join("\n")})}return s}(t),{dir:i,onOpenFile:a,t:n})})}let G="cop.md.view";function Q(e){var t,l,n,i,d;let{path:h,onDirty:p,goTo:f,onOpenFile:x}=e,{t:b}=(0,o.kj)(),[v,g]=(0,a.useState)(null),[w,j]=(0,a.useState)(""),[k,y]=(0,a.useState)(""),[N,S]=(0,a.useState)(""),[M,F]=(0,a.useState)(!1),[O,L]=(0,a.useState)(!1),[q,E]=(0,a.useState)("auto"),I=(0,a.useRef)(null),D=(0,a.useRef)(null),H=(0,a.useRef)(null),z=!!v&&null!==v.text&&w!==v.text;(0,a.useEffect)(()=>null==p?void 0:p(h,z),[h,z,p]);let W=(0,a.useCallback)(async()=>{try{var e;let t=await r.FH.workspaceFile(h);g(t),j(null!=(e=t.text)?e:""),L(!1),y("")}catch(e){y(e.message)}},[h]);(0,a.useEffect)(()=>{g(null),S(""),L(!1),W()},[W]),(0,c.z)(async()=>{if(!(null==v?void 0:v.version)||M)return;let e=await r.FH.workspaceFile(h).catch(()=>null);if((null==e?void 0:e.version)&&e.version!==v.version)if(z)L(!0);else{var t;g(e),j(null!=(t=e.text)?t:"")}},4e3,!!v);let A="auto"===q?m(h,null!=(t=null==v?void 0:v.text)?t:""):q,R="markdown"===m(h,""),[_,P]=(0,a.useState)("preview");(0,a.useEffect)(()=>{try{let e=window.localStorage.getItem(G);("code"===e||"split"===e||"preview"===e)&&P(e)}catch(e){}},[]);let $=e=>{P(e);try{window.localStorage.setItem(G,e)}catch(e){}},K=R?_:"code",Z=(0,a.useMemo)(()=>w.length>4e5?C(w,"plain"):C(w,A),[w,A]),B=(0,a.useMemo)(()=>{let e=w.split("\n").length,t="";for(let l=1;l<=e;l+=1)t+="".concat(l,"\n");return t},[w]),U=async function(){let e=arguments.length>0&&void 0!==arguments[0]&&arguments[0];if(v&&!M){F(!0),S("");try{let t=await r.FH.saveWorkspaceFile(h,w,e?void 0:v.version);g({...v,text:w,version:t.version,size:t.size}),L(!1),S(b("ed.saved"))}catch(e){409===e.status?L(!0):S(e.message)}finally{F(!1)}}},V=()=>{let e=I.current;e&&(D.current&&(D.current.scrollTop=e.scrollTop,D.current.scrollLeft=e.scrollLeft),H.current&&(H.current.scrollTop=e.scrollTop))};return((0,a.useEffect)(V,[Z]),(0,a.useEffect)(()=>{var e,t,l;if(!f||!v||null===v.text)return;R&&"preview"===_&&P("split");let s=I.current;if(!s)return;let a=s.value.split("\n"),n=Math.max(1,Math.min(f.line,a.length)),i=0;for(let e=0;e<n-1;e+=1)i+=a[e].length+1;let r=a[n-1].length,c=i+Math.min(null!=(e=f.from)?e:0,r),o=i+Math.min(null!=(l=null!=(t=f.to)?t:f.from)?l:0,r);s.focus({preventScroll:!0}),s.setSelectionRange(c,o);let d=parseFloat(getComputedStyle(s).lineHeight)||20;s.scrollTop=Math.max(0,(n-1)*d-s.clientHeight/3),V()},[null==f?void 0:f.n,null==v?void 0:v.version]),k&&!v)?(0,s.jsx)("p",{className:"err small",children:k}):v?v.binary||v.tooLarge?(0,s.jsxs)("div",{className:"wb-file",children:[(0,s.jsx)("p",{className:"muted small",children:b("wb.fileOnDisk",{path:v.path})}),(0,s.jsx)("p",{className:"muted",children:v.binary?b("wb.binary"):b("wb.tooLarge")})]}):(0,s.jsxs)("div",{className:"ed",children:[(0,s.jsxs)("div",{className:"ed-bar",children:[(0,s.jsx)(T,{path:h}),(0,s.jsx)("span",{className:"ed-path",title:v.path,children:v.path}),(0,s.jsx)("span",{className:"small ".concat(z?"ed-dirty":"muted"),role:"status",children:z?b("ed.unsaved"):N||b("ed.clean")}),(0,s.jsx)("span",{className:"grow"}),R&&(0,s.jsx)("span",{className:"segmented ed-md-view",role:"group","aria-label":b("ed.view"),title:b("ed.viewWhy"),children:["code","split","preview"].map(e=>(0,s.jsx)("button",{type:"button","aria-pressed":_===e,onClick:()=>$(e),children:b("code"===e?"ed.viewCode":"split"===e?"ed.viewSplit":"ed.viewPreview")},e))}),(0,s.jsx)("label",{htmlFor:"ed-lang-".concat(h),className:"sr-only",children:b("ed.language")}),(0,s.jsxs)("select",{id:"ed-lang-".concat(h),className:"ed-lang",value:q,onChange:e=>E(e.target.value),title:b("ed.language"),children:[(0,s.jsx)("option",{value:"auto",children:b("ed.langAuto",{name:(n=m(h,null!=(l=v.text)?l:""),null!=(d=null==(i=u.find(e=>e.id===n))?void 0:i.name)?d:n)})}),u.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name},e.id))]}),(0,s.jsx)("button",{type:"button",className:"quiet small",disabled:!z||M,onClick:()=>{var e;j(null!=(e=v.text)?e:""),S("")},children:b("ed.revert")}),(0,s.jsx)("button",{type:"button",className:"primary small",disabled:!z||M,onClick:()=>void U(),title:"Ctrl+S",children:b("ed.save")})]}),O&&(0,s.jsxs)("div",{className:"notice caution small ed-conflict",role:"alert",children:[(0,s.jsx)("span",{children:b("ed.changedOnDisk")}),(0,s.jsx)("button",{type:"button",className:"small",onClick:()=>void W(),children:b("ed.reload")}),(0,s.jsx)("button",{type:"button",className:"small danger",onClick:()=>void U(!0),children:b("ed.saveOver")})]}),(0,s.jsxs)("div",{className:"ed-body ed-show-".concat(K),children:["code"!==K&&(0,s.jsx)("div",{className:"ed-preview",children:(0,s.jsx)(Y,{text:w,path:h,onOpenFile:e=>null==x?void 0:x(e)})}),(0,s.jsx)("pre",{ref:H,className:"ed-gutter","aria-hidden":"true",children:B}),(0,s.jsxs)("div",{className:"ed-area",children:[(0,s.jsx)("pre",{ref:D,className:"ed-shown","aria-hidden":"true",children:(0,s.jsx)("code",{dangerouslySetInnerHTML:{__html:"".concat(Z,"\n")}})}),(0,s.jsx)("textarea",{ref:I,className:"ed-input",value:w,onChange:e=>j(e.target.value),onScroll:V,onKeyDown:e=>{(e.ctrlKey||e.metaKey)&&"s"===e.key.toLowerCase()?(e.preventDefault(),U()):(e.ctrlKey||e.metaKey)&&e.shiftKey&&"v"===e.key.toLowerCase()&&R?(e.preventDefault(),$("code"===_?"preview":"code")):"Tab"!==e.key||e.ctrlKey||e.altKey||e.metaKey?"Escape"===e.key&&e.currentTarget.blur():(e.preventDefault(),((e,t)=>{let l=/^\t/m.test(e.value)&&!/^ {2,}\S/m.test(e.value)?" ":" ",{selectionStart:s,selectionEnd:a,value:n}=e;if(s===a&&!t){document.execCommand("insertText",!1,l)||e.setRangeText(l,s,a,"end"),j(e.value);return}let i=n.lastIndexOf("\n",s-1)+1,r=a>s&&"\n"===n[a-1]?a-1:a,c=n.slice(i,r).split("\n").map(e=>t?e.replace(" "===l?/^\t/:/^ {1,2}/,""):l+e).join("\n");e.setSelectionRange(i,r),document.execCommand("insertText",!1,c)||e.setRangeText(c,i,r,"select"),e.setSelectionRange(i,i+c.length),j(e.value)})(e.currentTarget,e.shiftKey))},spellCheck:!1,autoCapitalize:"off",autoComplete:"off",autoCorrect:"off",wrap:"off","aria-label":b("ed.label",{path:v.path})})]})]})]}):(0,s.jsx)("p",{className:"muted small",children:b("wb.loading")})}function ee(e){if(null===e||""===e)return[];let t=e.split(/\r?\n/);return""===t[t.length-1]&&t.pop(),t}function et(e,t){let l=function(e,t){let l=0;for(;l<e.length&&l<t.length&&e[l]===t[l];)l+=1;let s=e.length,a=t.length;for(;s>l&&a>l&&e[s-1]===t[a-1];)s-=1,a-=1;let n=[];for(let e=0;e<l;e+=1)n.push({kind:"same",a:e,b:e});for(let i of function(e,t){let l=e.length,s=t.length;if(0===l)return t.map((e,t)=>({kind:"add",b:t}));if(0===s)return e.map((e,t)=>({kind:"del",a:t}));let a=l+s,n=a+1,i=new Int32Array(2*a+3),r=[];for(let c=0;c<=Math.min(a,2e3);c+=1){r.push(i.slice(n-c-1,n+c+2));for(let a=-c;a<=c;a+=2){let o=a===-c||a!==c&&i[n+a-1]<i[n+a+1]?i[n+a+1]:i[n+a-1]+1,d=o-a;for(;o<l&&d<s&&e[o]===t[d];)o+=1,d+=1;if(i[n+a]=o,o>=l&&d>=s)return function(e,t,l,s){let a=[],n=t.length,i=l.length;for(let t=s;t>0;t-=1){let l=e[t],s=e=>l[e+t+1],r=n-i,c=r===-t||r!==t&&s(r-1)<s(r+1)?r+1:r-1,o=s(c),d=o-c;for(;n>o&&i>d;)n-=1,i-=1,a.push({kind:"same",a:n,b:i});n===o?a.push({kind:"add",b:d}):a.push({kind:"del",a:o}),n=o,i=d}for(;n>0&&i>0;)n-=1,i-=1,a.push({kind:"same",a:n,b:i});return a.reverse()}(r,e,t,c)}}return[...e.map((e,t)=>({kind:"del",a:t})),...t.map((e,t)=>({kind:"add",b:t}))]}(e.slice(l,s),t.slice(l,a)))n.push({kind:i.kind,...void 0!==i.a?{a:i.a+l}:{},...void 0!==i.b?{b:i.b+l}:{}});for(let t=0;s+t<e.length;t+=1)n.push({kind:"same",a:s+t,b:a+t});return n}(e,t),s=[];for(let a=0;a<l.length;){let n=l[a];if("same"===n.kind){s.push({kind:"same",left:{no:n.a+1,text:e[n.a]},right:{no:n.b+1,text:t[n.b]}}),a+=1;continue}let i=[],r=[];for(;a<l.length&&"same"!==l[a].kind;){let e=l[a];"del"===e.kind?i.push(e.a):r.push(e.b),a+=1}let c=Math.max(i.length,r.length);for(let l=0;l<c;l+=1){let a=i[l],n=r[l];s.push({kind:void 0!==a&&void 0!==n?"change":void 0!==a?"del":"add",...void 0!==a?{left:{no:a+1,text:e[a]}}:{},...void 0!==n?{right:{no:n+1,text:t[n]}}:{}})}}return s}function el(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:3,l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:new Set,s=arguments.length>3&&void 0!==arguments[3]&&arguments[3];if(s)return e.map((e,t)=>({type:"row",row:e,index:t}));let a=[];for(let s=0;s<e.length;){if("same"!==e[s].kind){a.push({type:"row",row:e[s],index:s}),s+=1;continue}let n=s;for(;n<e.length&&"same"===e[n].kind;)n+=1;let i=0===s?0:t,r=n===e.length?0:t,c=n-s-i-r;if(c>1&&!l.has(s+i)){for(let t=s;t<s+i;t+=1)a.push({type:"row",row:e[t],index:t});a.push({type:"gap",from:s+i,count:c});for(let t=n-r;t<n;t+=1)a.push({type:"row",row:e[t],index:t})}else for(let t=s;t<n;t+=1)a.push({type:"row",row:e[t],index:t});s=n}return a}var es=l(94969);function ea(e){let{sessionId:t,taskId:l,runId:n,title:i,files:r}=e,{t:c}=(0,o.kj)(),[d,u]=(0,a.useState)(!1);return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{type:"button",className:"linkish",onClick:()=>u(!0),title:c("diff.openWhy"),children:c("diff.open",{n:r})}),d&&(0,s.jsx)(en,{sessionId:t,taskId:l,runId:n,title:i,onClose:()=>u(!1)})]})}function en(e){var t,l,n,i,c,d,u;let{sessionId:h,taskId:p,runId:m,title:f,onClose:x}=e,{t:b}=(0,o.kj)(),[v,g]=(0,a.useState)(null),[w,j]=(0,a.useState)(""),[k,y]=(0,a.useState)(0),[N,S]=(0,a.useState)(new Map),[C,M]=(0,a.useState)(!1),[F,O]=(0,a.useState)(!0),[L,q]=(0,a.useState)(new Map),[E,I]=(0,a.useState)(-1),D=(0,a.useRef)(null),H=(0,a.useRef)(null),z=(0,a.useRef)(null);(0,es.V)(H,!0,z),(0,a.useEffect)(()=>{r.FH.taskChanges(h,p,m).then(g).catch(e=>j(e.message))},[h,p,m]);let W=null!=(n=null==v?void 0:v.files)?n:[],A=W[k];(0,a.useEffect)(()=>{!A||N.has(A.path)||r.FH.taskChangeFile(h,p,A.path,m).then(e=>S(t=>new Map(t).set(A.path,e))).catch(e=>S(t=>new Map(t).set(A.path,e.message)))},[A,N,h,p,m]);let T=A?N.get(A.path):void 0,R=(0,a.useMemo)(()=>!T||"string"==typeof T||T.binary||T.tooLarge?[]:et(ee(T.before),ee(T.after)),[T]),_=A&&L.get(A.path)||new Set,P=(0,a.useMemo)(()=>el(R,3,_,C),[R,_,C]),$=(0,a.useMemo)(()=>R.flatMap((e,t)=>"same"!==e.kind&&(0===t||"same"===R[t-1].kind)?[t]:[]),[R]);(0,a.useEffect)(()=>{I(-1),D.current&&(D.current.scrollTop=0)},[k]);let K=(0,a.useCallback)(e=>{var t;if(0===$.length)return;let l=E<0?1===e?0:$.length-1:Math.min($.length-1,Math.max(0,E+e));I(l);let s=null==(t=D.current)?void 0:t.querySelector('[data-row="'.concat($[l],'"]'));null==s||s.scrollIntoView({block:"center"})},[E,$]),Z=(0,a.useCallback)(e=>y(t=>Math.min(Math.max(0,t+e),Math.max(0,W.length-1))),[W.length]);(0,a.useEffect)(()=>{let e=e=>{if(!e.ctrlKey&&!e.metaKey&&!e.altKey){if("Escape"===e.key)x();else if("n"===e.key)K(1);else if("p"===e.key)K(-1);else if("]"===e.key)Z(1);else{if("["!==e.key)return;Z(-1)}e.preventDefault()}};window.addEventListener("keydown",e);let t=document.body.style.overflow;return document.body.style.overflow="hidden",()=>{window.removeEventListener("keydown",e),document.body.style.overflow=t}},[K,Z,x]);let B=W.reduce((e,t)=>({added:e.added+Math.max(0,t.added),removed:e.removed+Math.max(0,t.removed)}),{added:0,removed:0});return(0,s.jsxs)("div",{ref:H,className:"diff-overlay",role:"dialog","aria-modal":"true","aria-labelledby":"diff-title",children:[(0,s.jsxs)("div",{className:"diff-head",children:[(0,s.jsx)("h2",{id:"diff-title",children:b("diff.title",{title:f})}),(null==v?void 0:v.ok)&&(0,s.jsxs)("span",{className:"muted small",children:[v.branch?"".concat(v.branch," \xb7 "):"",null==(t=v.base)?void 0:t.slice(0,8)," → ",null==(l=v.commit)?void 0:l.slice(0,8)," \xb7 ",b("diff.summary",{n:W.length,a:B.added,r:B.removed})]}),(0,s.jsx)("span",{className:"grow"}),(0,s.jsx)("span",{className:"muted small",children:b("diff.keys")}),(0,s.jsx)("button",{ref:z,type:"button",onClick:x,children:b("diff.close")})]}),w&&(0,s.jsx)("div",{className:"err",style:{padding:12},children:w}),!v&&!w&&(0,s.jsx)("div",{className:"muted",style:{padding:12},children:b("diff.loading")}),v&&!v.ok&&(0,s.jsx)("div",{className:"notice caution",style:{margin:12},children:v.problem}),(null==v?void 0:v.ok)&&0===W.length&&(0,s.jsx)("div",{className:"notice",style:{margin:12},children:b("diff.nothing")}),(null==v?void 0:v.ok)&&W.length>0&&(0,s.jsxs)("div",{className:"diff-body",children:[(0,s.jsx)("nav",{className:"diff-files","aria-label":b("diff.files"),children:W.map((e,t)=>{let l=e.path.lastIndexOf("/");return(0,s.jsxs)("button",{type:"button",className:"diff-file".concat(t===k?" on":""),onClick:()=>y(t),title:e.oldPath?"".concat(e.oldPath," → ").concat(e.path):e.path,children:[(0,s.jsx)("span",{className:"diff-status s-".concat(e.status),children:e.status}),(0,s.jsxs)("span",{className:"diff-path",children:[l>=0&&(0,s.jsx)("span",{className:"muted",children:e.path.slice(0,l+1)}),(0,s.jsx)("strong",{children:e.path.slice(l+1)})]}),(0,s.jsx)("span",{className:"diff-counts",children:e.added<0?b("diff.binaryShort"):(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("span",{className:"plus",children:["+",e.added]})," ",(0,s.jsxs)("span",{className:"minus",children:["−",e.removed]})]})})]},e.path)})}),(0,s.jsxs)("div",{className:"diff-main",children:[A&&(0,s.jsxs)("div",{className:"diff-toolbar",children:[(0,s.jsxs)("div",{className:"diff-title-row",children:[(0,s.jsx)("strong",{className:"diff-name",children:A.oldPath?"".concat(A.oldPath," → ").concat(A.path):A.path}),(0,s.jsx)("span",{className:"muted small",children:"A"===A.status?b("diff.added"):"D"===A.status?b("diff.deleted"):"R"===A.status?b("diff.renamed"):""})]}),(0,s.jsx)(ei,{changes:$.length,onChange:K,files:{at:k,count:W.length,onFile:Z},whole:C,onWhole:M,wrap:F,onWrap:O})]}),(0,s.jsxs)("div",{className:"diff-scroll",ref:D,children:[void 0===T&&(0,s.jsx)("div",{className:"muted",style:{padding:12},children:b("diff.loading")}),"string"==typeof T&&(0,s.jsx)("div",{className:"err",style:{padding:12},children:T}),T&&"string"!=typeof T&&T.binary&&(0,s.jsx)("div",{className:"notice",style:{margin:12},children:b("diff.binary")}),T&&"string"!=typeof T&&T.tooLarge&&(0,s.jsx)("div",{className:"notice",style:{margin:12},children:b("diff.tooLarge")}),T&&"string"!=typeof T&&!T.binary&&!T.tooLarge&&(0,s.jsxs)(s.Fragment,{children:[(null!=(i=T.before)?i:"").includes("\r\n")!==(null!=(c=T.after)?c:"").includes("\r\n")&&null!==T.before&&null!==T.after&&(0,s.jsx)("div",{className:"notice small",style:{margin:8},children:b("diff.eol",{from:(null!=(d=T.before)?d:"").includes("\r\n")?"CRLF":"LF",to:(null!=(u=T.after)?u:"").includes("\r\n")?"CRLF":"LF"})}),R.length>0&&0===$.length&&(0,s.jsx)("div",{className:"notice small",style:{margin:8},children:b("diff.sameText")}),(0,s.jsxs)("table",{className:"diff-table".concat(F?"":" nowrap"),children:[(0,s.jsxs)("colgroup",{children:[(0,s.jsx)("col",{className:"num"}),(0,s.jsx)("col",{}),(0,s.jsx)("col",{className:"num"}),(0,s.jsx)("col",{})]}),(0,s.jsx)(er,{changes:$.length,at:E}),(0,s.jsx)("tbody",{children:P.map(e=>"gap"===e.type?(0,s.jsx)("tr",{className:"diff-gap",children:(0,s.jsx)("td",{colSpan:4,children:(0,s.jsx)("button",{type:"button",className:"linkish small",onClick:()=>{var t;return t=e.from,void(A&&q(e=>{var l;return new Map(e).set(A.path,new Set([...null!=(l=e.get(A.path))?l:[],t]))}))},children:b("diff.gap",{n:e.count})})})},"g".concat(e.from)):(0,s.jsx)(ec,{row:e.row,index:e.index,current:E>=0&&$[E]===e.index},e.index))})]})]})]})]})]})]})}function ei(e){let{changes:t,onChange:l,files:a,whole:n,onWhole:i,wrap:r,onWrap:c}=e,{t:d}=(0,o.kj)();return(0,s.jsxs)("div",{className:"diff-tools",children:[(0,s.jsxs)("span",{className:"diff-pair",children:[(0,s.jsx)("button",{type:"button",className:"quiet",onClick:()=>l(-1),disabled:0===t,children:d("diff.prevChange")}),(0,s.jsx)("button",{type:"button",className:"quiet",onClick:()=>l(1),disabled:0===t,children:d("diff.nextChange")})]}),a&&a.count>1&&(0,s.jsxs)("span",{className:"diff-pair",children:[(0,s.jsx)("button",{type:"button",className:"quiet",onClick:()=>a.onFile(-1),disabled:0===a.at,children:d("diff.prevFile")}),(0,s.jsx)("button",{type:"button",className:"quiet",onClick:()=>a.onFile(1),disabled:a.at>=a.count-1,children:d("diff.nextFile")})]}),(0,s.jsxs)("span",{className:"diff-pair",children:[(0,s.jsxs)("label",{className:"option-inline",children:[(0,s.jsx)("input",{type:"checkbox",checked:n,onChange:e=>i(e.target.checked)})," ",d("diff.whole")]}),(0,s.jsxs)("label",{className:"option-inline",children:[(0,s.jsx)("input",{type:"checkbox",checked:r,onChange:e=>c(e.target.checked)})," ",d("diff.wrap")]})]})]})}function er(e){let{changes:t,at:l}=e,{t:a}=(0,o.kj)();return(0,s.jsxs)("thead",{children:[t>0&&(0,s.jsx)("tr",{className:"diff-where",children:(0,s.jsx)("th",{colSpan:4,children:a("diff.changeN",{i:l<0?"–":l+1,n:t})})}),(0,s.jsxs)("tr",{children:[(0,s.jsx)("th",{colSpan:2,children:a("diff.before")}),(0,s.jsx)("th",{colSpan:2,children:a("diff.after")})]})]})}function ec(e){var t,l,n,i;let{row:r,index:c,current:o}=e,d="change"===r.kind?function(e,t){let l=0;for(;l<e.length&&l<t.length&&e[l]===t[l];)l+=1;let s=e.length,a=t.length;for(;s>l&&a>l&&e[s-1]===t[a-1];)s-=1,a-=1;return{start:l,leftEnd:s,rightEnd:a}}(r.left.text,r.right.text):null,u=e=>{let t=r[e];if(!t)return null;if(!d)return t.text;let l="left"===e?d.leftEnd:d.rightEnd;return(0,s.jsxs)(a.Fragment,{children:[t.text.slice(0,d.start),(0,s.jsx)("mark",{children:t.text.slice(d.start,l)}),t.text.slice(l)]})};return(0,s.jsxs)("tr",{className:"diff-row ".concat(r.kind).concat(o?" current":""),"data-row":c,children:[(0,s.jsx)("td",{className:"num",children:null!=(n=null==(t=r.left)?void 0:t.no)?n:""}),(0,s.jsx)("td",{className:"code l".concat(r.left?"":" empty"),children:u("left")}),(0,s.jsx)("td",{className:"num",children:null!=(i=null==(l=r.right)?void 0:l.no)?i:""}),(0,s.jsx)("td",{className:"code r".concat(r.right?"":" empty"),children:u("right")})]})}function eo(e){var t;let{area:l,path:n,commit:i}=e,{t:d}=(0,o.kj)(),[u,h]=(0,a.useState)(null),[p,m]=(0,a.useState)(""),[f,x]=(0,a.useState)(!1),[b,v]=(0,a.useState)(!0),[g,w]=(0,a.useState)(new Set),[j,k]=(0,a.useState)(-1),y=(0,a.useRef)(null),N=(0,a.useCallback)(()=>r.FH.workspaceGitFile(l,n,i).then(e=>{h(e),m("")}).catch(e=>m(e.message)),[l,n,i]);(0,a.useEffect)(()=>{h(null),m(""),w(new Set),k(-1),N()},[N]),(0,c.z)(N,5e3,"commit"!==l);let S=(0,a.useMemo)(()=>!u||u.binary||u.tooLarge?[]:et(ee(u.before),ee(u.after)),[u]),C=(0,a.useMemo)(()=>el(S,3,g,f),[S,g,f]),M=(0,a.useMemo)(()=>S.flatMap((e,t)=>"same"!==e.kind&&(0===t||"same"===S[t-1].kind)?[t]:[]),[S]),F="commit"===l?(null!=i?i:"").slice(0,7):d("staged"===l?"git.index":"git.workingTree"),O=null!=(t=null==u?void 0:u.status)?t:"";return(0,s.jsxs)("div",{className:"wb-gitdiff",children:[(0,s.jsxs)("div",{className:"diff-toolbar",children:[(0,s.jsxs)("div",{className:"diff-title-row",children:[(0,s.jsx)("strong",{className:"diff-name",children:(null==u?void 0:u.oldPath)?"".concat(u.oldPath," → ").concat(n):n}),(0,s.jsxs)("span",{className:"muted small",children:[F,O?" \xb7 ".concat(d("git.status.".concat("!"===O?"conflict":O))):""]})]}),(0,s.jsx)(ei,{changes:M.length,onChange:e=>{var t,l;if(0===M.length)return;let s=j<0?1===e?0:M.length-1:Math.min(M.length-1,Math.max(0,j+e));k(s),null==(l=y.current)||null==(t=l.querySelector('[data-row="'.concat(M[s],'"]')))||t.scrollIntoView({block:"center"})},whole:f,onWhole:x,wrap:b,onWrap:v})]}),(0,s.jsxs)("div",{className:"diff-scroll",ref:y,children:[p&&(0,s.jsx)("div",{className:"err",style:{padding:12},children:p}),!u&&!p&&(0,s.jsx)("div",{className:"muted",style:{padding:12},children:d("diff.loading")}),(null==u?void 0:u.binary)&&(0,s.jsx)("div",{className:"notice",style:{margin:12},children:d("diff.binary")}),(null==u?void 0:u.tooLarge)&&(0,s.jsx)("div",{className:"notice",style:{margin:12},children:d("diff.tooLarge")}),u&&!u.binary&&!u.tooLarge&&(0,s.jsxs)(s.Fragment,{children:[S.length>0&&0===M.length&&(0,s.jsx)("div",{className:"notice small",style:{margin:8},children:d("diff.sameText")}),(0,s.jsxs)("table",{className:"diff-table".concat(b?"":" nowrap"),children:[(0,s.jsxs)("colgroup",{children:[(0,s.jsx)("col",{className:"num"}),(0,s.jsx)("col",{}),(0,s.jsx)("col",{className:"num"}),(0,s.jsx)("col",{})]}),(0,s.jsx)(er,{changes:M.length,at:j}),(0,s.jsx)("tbody",{children:C.map(e=>"gap"===e.type?(0,s.jsx)("tr",{className:"diff-gap",children:(0,s.jsx)("td",{colSpan:4,children:(0,s.jsx)("button",{type:"button",className:"linkish small",onClick:()=>w(t=>new Set([...t,e.from])),children:d("diff.gap",{n:e.count})})})},"g".concat(e.from)):(0,s.jsx)(ec,{row:e.row,index:e.index,current:j>=0&&M[j]===e.index},e.index))})]})]})]})]})}function ed(e,t){let[l,s]=(0,a.useState)(null),n=(0,a.useRef)(!0),[i,r]=(0,a.useState)(!0),c=(0,a.useCallback)(e=>s(e),[]);return(0,a.useLayoutEffect)(()=>{if(!l)return;let e=()=>{let e=l.scrollHeight-l.scrollTop-l.clientHeight<=24;n.current=e,r(e)};return l.addEventListener("scroll",e,{passive:!0}),()=>l.removeEventListener("scroll",e)},[l]),(0,a.useLayoutEffect)(()=>{l&&e&&n.current&&(l.scrollTop=l.scrollHeight)},[l,e,t]),{ref:c,following:i,follow:(0,a.useCallback)(()=>{n.current=!0,r(!0),l&&(l.scrollTop=l.scrollHeight)},[l])}}var eu=l(51035),eh=l(24784),ep=l(24872);function em(e,t){let l,a=[],n=/(`[^`\n]+`)|(\*\*[^*\n]+\*\*)|(\*[^*\n]+\*)/g,i=0,r=0;for(;null!==(l=n.exec(e));){l.index>i&&a.push(e.slice(i,l.index));let n=l[0],c="".concat(t,"-i").concat(r+=1);n.startsWith("`")?a.push((0,s.jsx)("code",{children:n.slice(1,-1)},c)):n.startsWith("**")?a.push((0,s.jsx)("strong",{children:n.slice(2,-2)},c)):a.push((0,s.jsx)("em",{children:n.slice(1,-1)},c)),i=l.index+n.length}return i<e.length&&a.push(e.slice(i)),a}function ef(e){let t=/^\s*[-*•]\s+(.*)$/.exec(e);if(t)return t[1];let l=/^\s*\d+[.)]\s+(.*)$/.exec(e);return l?l[1]:null}function ex(e){let{text:t,className:l}=e,n=[],i=t.replace(/\r\n/g,"\n").split("\n"),r=0,c=0;for(;r<i.length;){let e=i[r];if(e.trim().startsWith("```")){let e=[];for(r+=1;r<i.length&&!i[r].trim().startsWith("```");)e.push(i[r++]);r+=1,e.length>0&&n.push((0,s.jsx)("pre",{children:e.join("\n")},"b".concat(c+=1)));continue}if(null!==ef(e)){let e=[];for(;r<i.length&&null!==ef(i[r]);)e.push(ef(i[r++]));n.push((0,s.jsx)("ul",{children:e.map((e,t)=>(0,s.jsx)("li",{children:em(e,"b".concat(c,"-").concat(t))},t))},"b".concat(c+=1)));continue}if(""===e.trim()){r+=1;continue}let t=[];for(;r<i.length&&""!==i[r].trim()&&null===ef(i[r])&&!i[r].trim().startsWith("```");)t.push(i[r++]);let l=c+=1;n.push((0,s.jsx)("p",{children:t.map((e,t)=>(0,s.jsxs)(a.Fragment,{children:[t>0&&(0,s.jsx)("br",{}),em(e,"b".concat(l,"-").concat(t))]},t))},"b".concat(l)))}return(0,s.jsx)("div",{className:"rich ".concat(null!=l?l:""),children:n})}var eb=l(36657),ev=l(79717);let eg="cop.chat.thread",ew="cop.chat.mode",ej="cop.chat.plan",ek="cop.chat.review",ey="cop.chat.lead",eN=(e,t)=>{try{t?window.localStorage.setItem(e,t):window.localStorage.removeItem(e)}catch(e){}},eS=e=>{try{var t;return null!=(t=window.localStorage.getItem(e))?t:""}catch(e){return""}};function eC(e){var t,l,n,i,d,u,h,p,m,f,x,b,v;let{workspace:g,composeAsk:w,showThread:j,onOpenFile:k,onChange:y,onOpenFolder:N,onTurn:S}=e,{t:C,locale:M}=(0,o.kj)(),F=function(){let[e,t]=(0,a.useState)(!1);return(0,a.useEffect)(()=>{let e=!0;return r.FH.settings().then(l=>{var s;let a=null!=(s=l.raw.execution)?s:{};e&&t("unattended"===a.mode)}).catch(()=>void 0),()=>{e=!1}},[]),e}(),[O,L]=(0,a.useState)([]),[q,E]=(0,a.useState)(""),[I,D]=(0,a.useState)(null),[H,z]=(0,a.useState)("confirm"),[W,A]=(0,a.useState)(!1),[T,R]=(0,a.useState)(!0),[_,P]=(0,a.useState)(!1),[$,K]=(0,a.useState)(""),[Z,B]=(0,a.useState)(null),[U,V]=(0,a.useState)(""),[J,X]=(0,a.useState)(!1),[Y,G]=(0,a.useState)(""),[Q,ee]=(0,a.useState)([]),[et,el]=(0,a.useState)(null),[es,ea]=(0,a.useState)(""),[en,ei]=(0,a.useState)(!1),[er,ec]=(0,a.useState)([]),[eo,ep]=(0,a.useState)(""),em=(0,a.useRef)(null),ef=!!I&&"idle"!==I.status,ex=null!=(h=null==et?void 0:et.defaultModel)?h:"",eb=I?!I.manualModel&&(I.model||ex)?null!=(p=I.model)?p:"":eh.u:"",ev=es!==eh.u&&(es||ex)?es:eh.u;(0,a.useEffect)(()=>{E(eS(eg)),A("on"===eS(ej)),R("off"!==eS(ek)),P("on"===eS(ey));let e=eS(ew);"confirm"===e||"unattended"===e?z(e):r.FH.settings().then(e=>{var t;return z((null==(t=e.raw.execution)?void 0:t.mode)==="unattended"?"unattended":"confirm")}).catch(()=>void 0)},[]),(0,a.useEffect)(()=>{var e;w>0&&(null==(e=em.current)||e.focus())},[w]),(0,a.useEffect)(()=>{(null==j?void 0:j.id)&&eA(j.id)},[null==j?void 0:j.n]),(0,a.useEffect)(()=>{r.FH.models().then(el).catch(()=>void 0),r.FH.skills().then(e=>ec(e.skills)).catch(()=>void 0)},[]);let eC=e=>e.trim().replace(/[\\/]+$/,"").replace(/\//g,"\\").toLowerCase(),eF=er.filter(e=>!e.projectDir||(null==g?void 0:g.dir)&&eC(e.projectDir)===eC(g.dir)),eO=(0,a.useCallback)(()=>r.FH.chatThreads().then(L).catch(()=>void 0),[]);(0,c.z)(eO,5e3);let eq=(0,a.useCallback)(()=>q?r.FH.session(q).then(e=>D("chat"===e.kind?e:null)).catch(e=>{404===e.status&&(D(null),E(""),eN(eg,""))}):Promise.resolve(D(null)),[q]);(0,a.useEffect)(()=>{eq()},[eq]),(0,c.z)(eq,ef?1500:5e3,!!q);let eE=(0,a.useRef)(new Set),eI=()=>q&&ef?r.FH.approvals(q).then(e=>ee(e.filter(e=>!eE.current.has(e.id)))).catch(()=>void 0):Promise.resolve(ee([]));(0,c.z)(eI,1500,!!q);let eD=(e,t)=>{t&&(eE.current.add(e),ee(t=>t.filter(t=>t.id!==e))),eI()},eH=null!=(m=null==I||null==(t=I.lead)?void 0:t.workerSessionId)?m:"",eW=(0,a.useCallback)(()=>eH?r.FH.session(eH).then(B).catch(()=>void 0):Promise.resolve(B(null)),[eH]);(0,a.useEffect)(()=>{eW()},[eW]),(0,c.z)(eW,ef?1500:1e4,!!eH);let eA=e=>{E(e),eN(eg,e),G("")},eT=e=>(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("label",{htmlFor:"cs-model",className:"sr-only",children:C("chat.model")}),(0,s.jsx)(eh.Yb,{id:"cs-model",chosen:I?eb:ev,onChange:e=>void eK(e),byHand:C("chat.modelByHand"),none:(null==et?void 0:et.defaultModel)?C("chat.modelDefault",{model:et.defaultModel}):void 0,catalogue:et,disabled:ef,style:{minWidth:0,maxWidth:e}}),(0,s.jsx)("button",{type:"button",className:"wb-icon-btn",onClick:()=>void eV(),disabled:en||ef,title:C("chat.readModels"),"aria-label":C("chat.readModels"),children:"↻"})]}),eR=ef||O.some(e=>e.running)?C("chat.newChatRunning"):I?"":C("chat.newChatFresh"),e_=async()=>{let e=U.trim();if(!e||J)return;let t=eo,l=eF.length>0?/^\/([a-z0-9][a-z0-9-]*[a-z0-9])(?=\s|$)\s*([\s\S]*)$/.exec(e):null;if(l){let s=eF.find(e=>e.name===l[1]);if(!s)return void G(C("chat.skillUnknown",{name:l[1],names:eF.map(e=>"/".concat(e.name)).join(", ")}));if(!l[2].trim())return void G(C("chat.skillNoText",{name:s.name}));t=s.name,e=l[2].trim()}X(!0),G("");try{var s;let l=!q,a=l&&es===eh.u,n=l&&_?{workerModel:$===eh.u?void 0:$||void 0,workerManualModel:$===eh.u}:void 0,i=await r.FH.chatSend(e,q||void 0,l&&!a&&es||void 0,a,M,l&&W,l?!n&&T:void 0,n,t||void 0);if(V(""),ep(""),eA(i.threadId),i.noted)return void G(C("chat.noted"));if("unattended"===H&&l&&!F&&!await (0,eu.Z)(C("session.unattendedConfirm")))return void G(C("chat.notStartedYet"));let c=await r.FH.start(i.threadId,H);c.started||G(C("chat.notStarted",{reason:null!=(s=c.reason)?s:""}))}catch(e){G(e.message)}finally{X(!1),eq(),eO(),y()}},eP=async e=>{if(I&&!J&&await (0,eu.Z)(C("chat.rewindConfirm",{n:I.tasks.length-I.tasks.indexOf(e)}))){X(!0),G("");try{var t;let l=await r.FH.chatRewind(I.id,e.id);V(l.text),G(C("chat.rewound")),null==(t=em.current)||t.focus()}catch(e){G(e.message)}finally{X(!1),eq(),y()}}},e$=async e=>{if(I){D(t=>{var l;if(!t)return t;let{review:s,workerModel:a,workerManualModel:n,...i}=e;return{...t,...i,...s?{review:{...null!=(l=t.review)?l:{enabled:!0,model:""},...s}}:{},...t.lead&&(void 0!==a||void 0!==n)?{lead:{...t.lead,workerManualModel:n||void 0,workerModel:n?void 0:a||void 0}}:{}}});try{await r.FH.updateSession(I.id,e)}catch(e){G(e.message)}finally{eq()}}},eK=async e=>{if(!I)return void ea(e);await e$(e===eh.u?{model:"",manualModel:!0}:{model:e,manualModel:!1})},eZ=I?!!I.lead:_,eB=I?(null==(l=I.lead)?void 0:l.workerManualModel)?eh.u:null!=(f=null==(n=I.lead)?void 0:n.workerModel)?f:"":$,eU=async e=>{if(!I)return void K(e);await e$(e===eh.u?{workerModel:"",workerManualModel:!0}:{workerModel:e,workerManualModel:!1})},eV=async()=>{ei(!0),G(C("chat.modelsReading"));try{el(await r.FH.refreshModels()),G(C("chat.modelsRead"))}catch(e){G(e.message)}finally{ei(!1)}},eJ=I?"approve"===I.planMode:W,eX=async e=>{if(!I){A(e),eN(ej,e?"on":"");return}await e$({planMode:e?"approve":"off"})},eY=I?(null==(i=I.review)?void 0:i.enabled)!==!1:T,eG=async e=>{if(!I){R(e),eN(ek,e?"":"off");return}await e$({review:{enabled:e}})},eQ=ef&&!!(null==I?void 0:I.paused),e0=async()=>{if(!I)return;let e=!I.paused;D(t=>t?{...t,paused:e}:t);try{await (e?r.FH.pause(I.id):r.FH.resume(I.id))}catch(e){G(e.message)}finally{eq()}},e1=null==I?void 0:I.tasks.at(-1),e2=null==e1||null==(u=e1.lead)||null==(d=u.rounds.filter(e=>e.subtask).at(-1))?void 0:d.subtask;(0,a.useEffect)(()=>{S(q?I&&e1?e2&&eH?{sessionId:eH,taskId:e2.taskId}:{sessionId:I.id,taskId:e1.id}:null:"new")},[q,null==I?void 0:I.id,null==e1?void 0:e1.id,null==e2?void 0:e2.taskId,eH]);let{ref:e3}=ed(!0,"".concat(null!=(x=null==I?void 0:I.tasks.length)?x:0,":").concat(null!=(b=null==e1?void 0:e1.status)?b:"",":").concat(null!=(v=null==e1?void 0:e1.iterations)?v:0));return(0,s.jsxs)("div",{className:"cs",children:[(0,s.jsxs)("div",{className:"cs-head",children:[(0,s.jsx)("label",{htmlFor:"cs-thread",className:"sr-only",children:C("chat.thread")}),(0,s.jsxs)("select",{id:"cs-thread",dir:"auto",value:q,onChange:e=>eA(e.target.value),children:[(0,s.jsx)("option",{value:"",children:C("chat.newThread")}),O.map(e=>(0,s.jsx)("option",{value:e.id,children:e.name.replace(/^chat: /,"")},e.id))]}),(0,s.jsxs)("span",{className:"cs-new-wrap",children:[(0,s.jsx)("button",{type:"button",className:"cs-new","aria-disabled":!!eR||void 0,"aria-describedby":eR?"cs-new-tip":void 0,onClick:()=>{var e;eR||(eA(""),D(null),null==(e=em.current)||e.focus())},title:eR?void 0:C("chat.newChatWhy"),children:C("chat.newChat")}),eR&&(0,s.jsx)("span",{id:"cs-new-tip",role:"tooltip",className:"cs-new-tip",children:eR})]})]}),(0,s.jsxs)("div",{className:"cs-body",ref:e3,"aria-live":"polite",children:[I?I.tasks.map(e=>I.lead?(0,s.jsx)(ez,{session:I,task:e,worker:Z,approvals:Q,onDecided:eD,onOpenFile:k,onRewind:ef||J?void 0:()=>void eP(e)},e.id):(0,s.jsx)(eL,{session:I,task:e,approvals:Q.filter(t=>t.taskId===e.id),onDecided:eD,onOpenFile:k,onRewind:ef||J?void 0:()=>void eP(e)},e.id)):(0,s.jsx)(eM,{workspace:g,onPick:e=>{var t;V(e),null==(t=em.current)||t.focus()},onOpenFolder:N}),eQ&&(0,s.jsx)("p",{className:"cs-system cs-paused",role:"status",children:C("chat.pausedNote")}),Y&&(0,s.jsx)("p",{className:"cs-system",role:"status",children:Y})]}),(0,s.jsxs)("div",{className:"cs-compose",children:[(0,s.jsx)("label",{htmlFor:"cs-input",className:"sr-only",children:C("chat.input")}),(0,s.jsx)("textarea",{id:"cs-input",ref:em,value:U,onChange:e=>V(e.target.value),placeholder:ef?C("chat.placeholderRunning"):(null==g?void 0:g.ok)?C("chat.placeholder",{folder:g.name}):C("chat.placeholderNoFolder"),disabled:J||!(null==g?void 0:g.ok),onKeyDown:e=>{"Enter"!==e.key||e.shiftKey||e.nativeEvent.isComposing||(e.preventDefault(),e_())}}),eZ?(0,s.jsxs)("div",{className:"cs-models",children:[(0,s.jsx)("span",{className:"cs-pick-label","aria-hidden":"true",children:C("chat.leadModel")}),(0,s.jsx)("div",{className:"cs-bar",children:eT("90%")}),(0,s.jsx)("label",{htmlFor:"cs-worker-model",className:"cs-pick-label",children:C("chat.workerModel")}),(0,s.jsx)("div",{className:"cs-bar",children:(0,s.jsx)(eh.Yb,{id:"cs-worker-model",chosen:eB,onChange:e=>void eU(e),byHand:C("chat.modelByHand"),none:C("chat.workerSameModel"),catalogue:et,disabled:ef,style:{minWidth:0,maxWidth:"90%"}})})]}):(0,s.jsx)("div",{className:"cs-bar",children:eT("48%")}),eF.length>0&&(0,s.jsxs)("div",{className:"cs-bar",children:[(0,s.jsx)("label",{htmlFor:"cs-skill",className:"cs-pick-label",children:C("chat.skill")}),(0,s.jsxs)("select",{id:"cs-skill",value:eo,onChange:e=>ep(e.target.value),disabled:ef,title:C("chat.skillWhy"),style:{minWidth:0,maxWidth:"70%"},children:[(0,s.jsx)("option",{value:"",children:C("chat.skillNone")}),eF.map(e=>(0,s.jsxs)("option",{value:e.name,title:e.description,children:["/",e.name,e.description?" — ".concat(e.description):""]},e.name))]})]}),(0,s.jsxs)("div",{className:"cs-bar",children:[(0,s.jsx)("label",{htmlFor:"cs-mode",className:"sr-only",children:C("chat.mode")}),(0,s.jsxs)("select",{id:"cs-mode",value:H,onChange:e=>{let t=e.target.value;z(t),eN(ew,t)},disabled:ef,title:C("chat.modeWhy"),children:[(0,s.jsx)("option",{value:"confirm",children:C("chat.modeAsk")}),(0,s.jsx)("option",{value:"unattended",children:C("chat.modeAuto")})]}),(0,s.jsxs)("label",{className:"cs-plan-toggle",title:C("chat.planModeWhy"),children:[(0,s.jsx)("input",{type:"checkbox",checked:eJ,disabled:ef,onChange:e=>void eX(e.target.checked)}),(0,s.jsx)("span",{children:C("chat.planMode")})]}),(0,s.jsxs)("label",{className:"cs-plan-toggle cs-lead-toggle",title:C("chat.leadWhy"),children:[(0,s.jsx)("input",{type:"checkbox",checked:eZ,disabled:ef||!!I,onChange:e=>{var t;return t=e.target.checked,void(!I&&(P(t),eN(ey,t?"on":"")))}}),(0,s.jsx)("span",{children:C("chat.lead")})]}),!eZ&&(0,s.jsxs)("label",{className:"cs-plan-toggle cs-review-toggle",title:C("chat.reviewWhy"),children:[(0,s.jsx)("input",{type:"checkbox",checked:eY,disabled:ef,onChange:e=>void eG(e.target.checked)}),(0,s.jsx)("span",{children:C("chat.review")})]}),(0,s.jsxs)("span",{className:"cs-actions",children:[ef&&(0,s.jsx)("button",{type:"button",className:"cs-pause",onClick:()=>void e0(),title:eQ?C("chat.resumeWhy"):C("chat.pauseWhy"),children:eQ?C("chat.resume"):C("chat.pause")}),ef&&(0,s.jsx)("button",{type:"button",className:"danger",onClick:()=>{I&&r.FH.stop(I.id).then(()=>G(C("chat.stopping"))).catch(e=>G(e.message))},children:C("chat.stop")}),(0,s.jsx)("button",{type:"button",className:"primary",disabled:J||!U.trim()||!(null==g?void 0:g.ok),onClick:()=>void e_(),title:C("chat.sendWhy"),children:ef?C("chat.sendNote"):C("chat.send")})]})]})]})]})}function eM(e){var t;let{workspace:l,onPick:a,onOpenFolder:n}=e,{t:i}=(0,o.kj)();if(!l)return(0,s.jsx)("p",{className:"muted small",children:i("wb.loading")});if(!l.ok)return(0,s.jsxs)("div",{className:"cs-welcome",children:[(0,s.jsx)("p",{children:l.problem}),(0,s.jsx)("button",{type:"button",className:"primary",onClick:n,children:i("chat.openFolder")})]});let r=[i("chat.example1"),i("chat.example2"),i("chat.example3")];return(0,s.jsxs)("div",{className:"cs-welcome",children:[(0,s.jsx)("h3",{children:i("chat.welcome",{folder:l.name})}),(0,s.jsx)("p",{className:"muted small",children:i("chat.welcomeWhy",{dir:l.dir,branch:null!=(t=l.branch)?t:"—"})}),(0,s.jsx)("ul",{className:"cs-examples",children:r.map(e=>(0,s.jsx)("li",{children:(0,s.jsx)("button",{type:"button",className:"linkish",onClick:()=>a(e),children:e})},e))})]})}function eF(e,t){var l;let[s,n]=(0,a.useState)(null),i=(null==t?void 0:t.status)==="running"||(null==t?void 0:t.status)==="waiting-approval",o=()=>t&&(t.startedAt||i)?r.FH.taskStory(e,t.id,t.runId).then(n).catch(()=>void 0):Promise.resolve();(0,a.useEffect)(()=>{o()},[e,null==t?void 0:t.id,null==t?void 0:t.runId,null==t?void 0:t.status]),(0,c.z)(o,i?1500:6e4,!!i);let d=[],u=e=>e.forEach(e=>"review"===e.kind?u(e.entries):d.push(e));return u(null!=(l=null==s?void 0:s.entries)?l:[]),d}function eO(e){let{entries:t}=e;return(0,s.jsx)(s.Fragment,{children:t.map((e,t)=>{var l;return"reply"===e.kind?(null==(l=e.notes)?void 0:l.trim())?(0,s.jsxs)("div",{className:"cs-bot",children:[(0,s.jsx)(ex,{text:e.notes}),(0,s.jsx)("div",{className:"cs-copy-row",children:(0,s.jsx)(ep.i,{text:e.notes,what:"chat.copyReply"})})]},t):null:"step"===e.kind?(0,s.jsx)(eD,{step:e},t):null})})}function eL(e){var t,l,a,n;let{session:i,task:c,approvals:d,onDecided:u,onOpenFile:h,onRewind:p}=e,{t:m}=(0,o.kj)(),f="running"===c.status||"waiting-approval"===c.status,x=eF(i.id,c);return(0,s.jsxs)("section",{className:"cs-turn",id:"cs-turn-".concat(c.id),"aria-label":m("chat.turn",{text:c.title}),children:[(0,s.jsxs)("div",{className:"cs-user-row",children:[p&&(c.checkpoint||"queued"===c.status)&&(0,s.jsx)("button",{type:"button",className:"wb-icon-btn cs-rewind",onClick:p,title:m("chat.rewind"),"aria-label":m("chat.rewind"),children:"↶"}),(0,s.jsxs)("div",{className:"cs-user",children:[c.skill&&(0,s.jsx)(eW,{skill:c.skill}),(0,s.jsx)(eI,{children:(0,s.jsx)(ex,{text:c.prompt})}),(0,s.jsx)("div",{className:"cs-copy-row",children:(0,s.jsx)(ep.i,{text:c.prompt,what:"chat.copyMessage"})})]})]}),"queued"===c.status&&(0,s.jsx)("p",{className:"muted small cs-system",children:m("idle"===i.status?"chat.queued":"chat.waitingTurn")}),(0,s.jsx)(eO,{entries:x}),(null==(t=c.plan)?void 0:t.approved)&&!d.some(e=>e.plan)&&(0,s.jsxs)("details",{className:"cs-plan",children:[(0,s.jsx)("summary",{children:m("chat.planShown",{v:c.plan.version})}),(0,s.jsx)(ev.D,{plan:c.plan})]}),d.map(e=>(0,s.jsx)(eH,{approval:e,onDecided:u},e.id)),f&&(0,s.jsxs)("p",{className:"cs-working",role:"status",children:[(0,s.jsx)("span",{className:"wb-live","aria-hidden":"true"})," ",m("chat.working",{n:c.iterations})]}),!f&&"queued"!==c.status&&(0,s.jsx)(eq,{task:c}),c.runId&&(0,s.jsx)("div",{className:"cs-exchange",children:(0,s.jsx)("a",{className:"button-link quiet small",href:r.FH.taskExchangeUrl(i.id,c.id),download:!0,title:m("chat.exchangeWhy"),children:m("chat.exchange")})}),(null!=(n=null==(a=c.vcs)||null==(l=a.files)?void 0:l.length)?n:0)>0&&!f&&(0,s.jsxs)("div",{className:"cs-files",children:[(0,s.jsx)("span",{className:"small",children:m("chat.changed",{n:c.vcs.files.length})}),c.vcs.files.slice(0,12).map(e=>(0,s.jsxs)("button",{type:"button",className:"cs-file",onClick:()=>h(e.path),title:e.path,children:[(0,s.jsx)(T,{path:e.path})," ",e.path.split("/").pop()," ",(0,s.jsx)("span",{className:"muted",children:e.added>=0?"+".concat(e.added," −").concat(e.removed):""})]},e.path)),(0,s.jsx)(ea,{sessionId:i.id,taskId:c.id,runId:c.runId,title:c.title,files:c.vcs.files.length})]})]})}function eq(e){let{task:t}=e,l=(0,a.useRef)(null),[n,i]=(0,a.useState)(!1),r=[t.summary,"done"!==t.status?t.reason:""].filter(Boolean).join("\n\n");return(0,a.useEffect)(()=>{let e=l.current;if(!e)return;let t=()=>{let t=window.getComputedStyle(e),l=parseFloat(t.lineHeight)||1.45*parseFloat(t.fontSize);i(e.scrollHeight>l*eE)};t();let s=new ResizeObserver(t);return s.observe(e),()=>s.disconnect()},[]),(0,s.jsxs)("div",{className:"cs-end s-".concat(t.status),children:[(0,s.jsx)(tr,{status:t.status}),(0,s.jsxs)("div",{className:"grow",ref:l,children:[t.summary?(0,s.jsx)(ex,{text:t.summary}):null,"done"!==t.status&&t.reason?(0,s.jsx)("p",{className:"small",children:t.reason}):null,r&&n&&(0,s.jsx)("div",{className:"cs-copy-row cs-copy-bottom",children:(0,s.jsx)(ep.i,{text:r,what:"chat.copySummary"})})]}),r&&(0,s.jsx)(ep.i,{text:r,what:"chat.copySummary"})]})}let eE=6;function eI(e){let{children:t}=e,{t:l}=(0,o.kj)(),n=(0,a.useRef)(null),[i,r]=(0,a.useState)(0),[c,d]=(0,a.useState)(!1),[u,h]=(0,a.useState)(!1);(0,a.useEffect)(()=>{let e=n.current;if(!e)return;let t=()=>{let t=window.getComputedStyle(e),l=parseFloat(t.lineHeight)||1.45*parseFloat(t.fontSize),s=Math.round(3*l);r(s),d(e.scrollHeight>s+.6*l)};t();let l=new ResizeObserver(t);return l.observe(e),()=>l.disconnect()},[]);let p=c&&!u;return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsxs)("div",{ref:n,className:"cs-fold".concat(p?" folded":""),style:p?{maxHeight:i}:void 0,children:[t,p&&(0,s.jsxs)("div",{className:"cs-fold-blur","aria-hidden":"true",children:[(0,s.jsx)("span",{}),(0,s.jsx)("span",{}),(0,s.jsx)("span",{})]})]}),c&&(0,s.jsx)("button",{type:"button",className:"cs-fold-toggle","aria-expanded":u,"aria-label":l(u?"chat.foldClose":"chat.foldOpen"),title:l(u?"chat.foldClose":"chat.foldOpen"),onClick:()=>h(!u),children:u?"▴":"▾"})]})}function eD(e){let{step:t}=e,{t:l}=(0,o.kj)(),n=!t.outcome,[i,r]=(0,a.useState)(null),c=null!=i?i:n||t.failed;return(0,s.jsxs)("div",{className:"cs-cmd".concat(t.failed?" bad":""),children:[(0,s.jsxs)("div",{className:"cs-cmd-row",children:[(0,s.jsxs)("button",{type:"button",className:"cs-cmd-head","aria-expanded":c,onClick:()=>r(!c),children:[(0,s.jsx)("span",{className:"cs-cmd-ico","aria-hidden":"true",children:n?"⟳":t.failed?"✗":"✓"}),(0,s.jsx)("code",{className:"wb-row-name",children:t.command}),(0,s.jsx)("span",{className:"muted small",children:n?l("chat.running"):void 0!==t.exitCode?l("chat.exit",{code:t.exitCode}):t.outcome})]}),(0,s.jsx)(ep.i,{text:t.output?"$ ".concat(t.command,"\n").concat(t.output):t.command,what:"chat.copyCommand"})]}),c&&t.output&&(0,s.jsx)("pre",{className:"cs-out",children:t.output})]})}function eH(e){let{approval:t,onDecided:l}=e,{t:n}=(0,o.kj)(),[i,c]=(0,a.useState)(!1),d=async e=>{c(!0);let s=!1;try{await r.FH.decide(t.id,e),s=!0}finally{c(!1),l(t.id,s)}};return t.plan?(0,s.jsx)("div",{className:"cs-plan-ask",children:(0,s.jsx)(eb.M,{approval:t,onDecided:e=>l(t.id,e)})}):t.question?(0,s.jsx)(eR,{approval:t,onDecided:l}):t.model?(0,s.jsx)("p",{className:"cs-system small",children:n("chat.lookAbove")}):(0,s.jsxs)("div",{className:"cs-ask",role:"group","aria-label":n("chat.askTitle"),children:[(0,s.jsx)("p",{className:"small",children:(0,s.jsx)("strong",{children:n("chat.askTitle")})}),(0,s.jsx)("pre",{className:"cs-out",children:t.description}),(0,s.jsxs)("div",{className:"row",children:[(0,s.jsx)("button",{type:"button",className:"primary",disabled:i,onClick:()=>void d("run"),children:n("chat.askRun")}),!t.network&&(0,s.jsx)("button",{type:"button",disabled:i,onClick:()=>void d("run-all"),children:n("chat.askRunAll")}),(0,s.jsx)("button",{type:"button",disabled:i,onClick:()=>void d("skip"),children:n("chat.askSkip")})]})]})}function ez(e){var t,l,n,i,c,d,u,h,p,m,f,x,b,v;let{session:g,task:w,worker:j,approvals:k,onDecided:y,onOpenFile:N,onRewind:S}=e,{t:C}=(0,o.kj)(),M="running"===w.status||"waiting-approval"===w.status,F=null!=(f=null==(t=w.lead)?void 0:t.rounds)?f:[],O=null==(l=F.filter(e=>"plan"===e.status).at(-1))?void 0:l.n,L=k.filter(e=>e.taskId===w.id),q=(null==(n=F.at(-1))?void 0:n.subtask)&&(null==j?void 0:j.tasks.find(e=>{var t,l;return e.id===(null==(l=F.at(-1))||null==(t=l.subtask)?void 0:t.taskId)&&("running"===e.status||"waiting-approval"===e.status)}));return(0,s.jsxs)("section",{className:"cs-turn cs-lead-turn",id:"cs-turn-".concat(w.id),"aria-label":C("chat.turn",{text:w.title}),children:[(0,s.jsxs)("div",{className:"cs-user-row",children:[S&&(w.checkpoint||"queued"===w.status)&&(0,s.jsx)("button",{type:"button",className:"wb-icon-btn cs-rewind",onClick:S,title:C("chat.rewind"),"aria-label":C("chat.rewind"),children:"↶"}),(0,s.jsxs)("div",{className:"cs-user",children:[w.skill&&(0,s.jsx)(eW,{skill:w.skill}),(0,s.jsx)(eI,{children:(0,s.jsx)(ex,{text:w.prompt})}),(0,s.jsx)("div",{className:"cs-copy-row",children:(0,s.jsx)(ep.i,{text:w.prompt,what:"chat.copyMessage"})})]})]}),"queued"===w.status&&(0,s.jsx)("p",{className:"muted small cs-system",children:"idle"===g.status?C("chat.queued"):C("chat.waitingTurn")}),F.map(e=>{var t;return(0,s.jsxs)(a.Fragment,{children:[e.understanding&&(0,s.jsx)(eA,{who:C("lead.understood"),text:e.understanding}),e.notes&&(0,s.jsx)(eA,{who:C("lead.who"),text:e.notes}),"plan"===e.status&&e.n===O&&w.plan&&!L.some(e=>e.plan)&&(0,s.jsxs)("details",{className:"cs-plan",children:[(0,s.jsx)("summary",{children:C("lead.plan",{v:w.plan.version})}),(0,s.jsx)(ev.D,{plan:w.plan})]}),e.subtask&&(0,s.jsx)(eT,{round:e,worker:j,approvals:k.filter(t=>{var l;return t.taskId===(null==(l=e.subtask)?void 0:l.taskId)}),onDecided:y,onOpenFile:N}),(null==(t=e.question)?void 0:t.answer)!==void 0&&(0,s.jsxs)("div",{className:"cs-bot cs-lead-qa",children:[(0,s.jsx)("p",{className:"cs-who",children:C("lead.question")}),(0,s.jsx)(ex,{text:e.question.text}),(0,s.jsx)("p",{className:"cs-who",children:C("lead.answered")}),(0,s.jsx)(ex,{text:e.question.answer})]})]},e.n)}),L.map(e=>(0,s.jsx)(eH,{approval:e,onDecided:y},e.id)),M&&(0,s.jsxs)("p",{className:"cs-working",role:"status",children:[(0,s.jsx)("span",{className:"wb-live","aria-hidden":"true"})," ",q?C("lead.working",{n:null!=(x=null==(c=F.at(-1))||null==(i=c.subtask)?void 0:i.n)?x:0}):C("lead.thinking"),w.lead?(0,s.jsxs)("span",{className:"muted small",children:[" \xb7 ",C("lead.subtasks",{n:w.lead.subtasks,max:w.lead.maxSubtasks})]}):null]}),(null==(d=w.lead)?void 0:d.messages)&&(0,s.jsx)("p",{className:"muted small cs-lead-count",children:C("lead.messages",{lead:w.lead.messages.lead,worker:w.lead.messages.worker,total:w.lead.messages.lead+w.lead.messages.worker})}),!M&&"queued"!==w.status&&(0,s.jsx)(eq,{task:w}),!M&&(null!=(b=null==(h=w.lead)||null==(u=h.evidence)?void 0:u.length)?b:0)>0&&(0,s.jsxs)("div",{className:"cs-evidence",children:[(0,s.jsx)("p",{className:"cs-who",children:C("lead.evidence")}),(0,s.jsx)("ul",{children:w.lead.evidence.map(e=>(0,s.jsx)("li",{children:(0,s.jsx)(ex,{text:e})},e))})]}),w.runId&&(0,s.jsx)("div",{className:"cs-exchange",children:(0,s.jsx)("a",{className:"button-link quiet small",href:r.FH.taskExchangeUrl(g.id,w.id),download:!0,title:C("chat.exchangeWhy"),children:C("chat.exchange")})}),(null!=(v=null==(m=w.vcs)||null==(p=m.files)?void 0:p.length)?v:0)>0&&!M&&(0,s.jsxs)("div",{className:"cs-files",children:[(0,s.jsx)("span",{className:"small",children:C("chat.changed",{n:w.vcs.files.length})}),w.vcs.files.slice(0,12).map(e=>(0,s.jsxs)("button",{type:"button",className:"cs-file",onClick:()=>N(e.path),title:e.path,children:[(0,s.jsx)(T,{path:e.path})," ",e.path.split("/").pop()," ",(0,s.jsx)("span",{className:"muted",children:e.added>=0?"+".concat(e.added," −").concat(e.removed):""})]},e.path)),(0,s.jsx)(ea,{sessionId:g.id,taskId:w.id,runId:w.runId,title:w.title,files:w.vcs.files.length})]})]})}function eW(e){let{skill:t}=e,{t:l}=(0,o.kj)();return(0,s.jsx)("p",{className:"cs-skill-chip",children:(0,s.jsx)("span",{className:"badge skill",title:t.description||void 0,children:l("chat.skillUsed",{name:t.name})})})}function eA(e){let{who:t,text:l}=e;return(0,s.jsxs)("div",{className:"cs-bot cs-lead-say",children:[(0,s.jsx)("p",{className:"cs-who",children:t}),(0,s.jsx)(ex,{text:l}),(0,s.jsx)("div",{className:"cs-copy-row",children:(0,s.jsx)(ep.i,{text:l,what:"chat.copyReply"})})]})}function eT(e){var t,l,a,n,i,r;let{round:c,worker:d,approvals:u,onDecided:h,onOpenFile:p}=e,{t:m}=(0,o.kj)(),f=c.subtask,x=null==d?void 0:d.tasks.find(e=>e.id===f.taskId),b=(null==x?void 0:x.status)==="running"||(null==x?void 0:x.status)==="waiting-approval",v=eF(null!=(a=null==d?void 0:d.id)?a:"",x);return(0,s.jsxs)("details",{className:"cs-subtask s-".concat(null!=(n=null==x?void 0:x.status)?n:"queued"),open:b||u.length>0||void 0,children:[(0,s.jsxs)("summary",{children:[(0,s.jsx)(tr,{status:null!=(i=null==x?void 0:x.status)?i:"queued"})," ",(0,s.jsx)("span",{children:m("lead.subtask",{n:f.n,title:f.title})}),f.readOnly&&(0,s.jsx)("span",{className:"badge",children:m("lead.readOnly")}),f.fresh&&(0,s.jsx)("span",{className:"badge",children:m("lead.fresh")})]}),(0,s.jsxs)("div",{className:"cs-subtask-body",children:[(0,s.jsx)(eO,{entries:v}),u.map(e=>(0,s.jsx)(eH,{approval:e,onDecided:h},e.id)),x&&!b&&"queued"!==x.status&&(0,s.jsx)(eq,{task:x}),x&&(null!=(r=null==(l=x.vcs)||null==(t=l.files)?void 0:t.length)?r:0)>0&&!b&&(0,s.jsx)("div",{className:"cs-files",children:x.vcs.files.slice(0,8).map(e=>(0,s.jsxs)("button",{type:"button",className:"cs-file",onClick:()=>p(e.path),title:e.path,children:[(0,s.jsx)(T,{path:e.path})," ",e.path.split("/").pop()]},e.path))})]})]})}function eR(e){let{approval:t,onDecided:l}=e,{t:n}=(0,o.kj)(),i=(0,a.useId)(),[c,d]=(0,a.useState)(""),[u,h]=(0,a.useState)(!1),[p,m]=(0,a.useState)(""),f=t.question,x=async e=>{if(!e.trim())return;h(!0),m("");let s=!1;try{await r.FH.answerQuestion(t.id,e),s=!0}catch(e){m(e.message)}finally{h(!1),l(t.id,s)}},b=async()=>{if(!await (0,eu.Z)(n("lead.stopConfirm")))return;h(!0);let e=!1;try{await r.FH.decide(t.id,"abort"),e=!0}finally{h(!1),l(t.id,e)}};return(0,s.jsxs)("div",{className:"cs-ask cs-question",role:"group","aria-label":n("lead.question"),children:[(0,s.jsx)("p",{className:"small",children:(0,s.jsx)("strong",{children:n("lead.question")})}),(0,s.jsx)(ex,{text:f.text}),f.why&&(0,s.jsx)("p",{className:"muted small",children:f.why}),f.options.length>0&&(0,s.jsx)("div",{className:"row cs-options",children:f.options.map(e=>(0,s.jsx)("button",{type:"button",disabled:u,onClick:()=>void x(e),children:e},e))}),(0,s.jsx)("label",{htmlFor:"".concat(i,"-answer"),className:"small",children:n("lead.answer")}),(0,s.jsx)("textarea",{id:"".concat(i,"-answer"),className:"prose",rows:3,value:c,onChange:e=>d(e.target.value),placeholder:n("lead.answerPlaceholder"),disabled:u}),(0,s.jsxs)("div",{className:"row",children:[(0,s.jsx)("button",{type:"button",className:"primary",disabled:u||!c.trim(),onClick:()=>void x(c),children:n("lead.send")}),(0,s.jsx)("button",{type:"button",className:"danger",disabled:u,onClick:()=>void b(),children:n("lead.stop")})]}),p&&(0,s.jsx)("p",{className:"err",role:"alert",children:p})]})}function e_(e){let{workspace:t,composeAsk:l,showThread:a,onOpenFile:n,onOpenFolder:i,onTurn:r,onChange:c,onClose:d,grip:u}=e,{t:h}=(0,o.kj)();return(0,s.jsxs)("div",{className:"wb-chat-inner",children:[(0,s.jsxs)("div",{className:"wb-chat-tabs",role:"tablist","aria-label":h("wb.chatPanel"),children:[u,(0,s.jsx)("button",{type:"button",role:"tab","aria-selected":!0,className:"on",children:h("wb.chatTab")}),(0,s.jsx)("span",{className:"grow"}),(0,s.jsx)("button",{type:"button",className:"wb-icon-btn","aria-label":h("wb.toggleChat"),title:h("wb.toggleChat"),onClick:d,children:"\xd7"})]}),(0,s.jsx)(eC,{workspace:t,composeAsk:l,showThread:a,onOpenFile:n,onChange:c,onOpenFolder:i,onTurn:r})]})}var eP=l(5462);let e$=[{tab:"terminal",label:"wb.terminal",infoLabel:"wb.terminalInfoLabel",info:"wb.terminalInfo"},{tab:"problems",label:"wb.problems",infoLabel:"wb.problemsInfoLabel",info:"wb.problemsInfo"},{tab:"output",label:"wb.output",infoLabel:"wb.outputInfoLabel",info:"wb.outputInfo"}];function eK(e){let{open:t,onToggle:l,tab:n,onTab:i,session:r,task:c,newChat:d=!1,onShowMessage:u}=e,{t:h}=(0,o.kj)(),p=r?function(e){let t=[];return e.tasks.forEach((l,s)=>{var a,n,i,r;let c="".concat(s+1,". ").concat(l.title),o=function(s,a){var n;let i=arguments.length>2&&void 0!==arguments[2]?arguments[2]:c;t.push({key:"".concat(e.id,"|").concat(l.id,"|a").concat(null!=(n=l.attempt)?n:1,"|").concat(s,"|").concat(a),taskId:l.id,kind:s,text:a,where:i})};for(let e of null!=(i=l.checkResults)?i:[])e.passed||o("error","".concat(e.name,": ").concat(e.detail.slice(0,160)));if((null==(a=l.review)?void 0:a.verdict)==="fail")for(let e of null!=(r=l.review.findings)?r:[])o("error",e.what.slice(0,200),e.where?"".concat(c," \xb7 ").concat(e.where):c);["failed","blocked","limit-reached","aborted"].includes(l.status)&&l.reason&&o("warn",l.reason.slice(0,200)),(null==(n=l.vcs)?void 0:n.problem)&&o("warn",l.vcs.problem.slice(0,200))}),t}(r):[],[m,f]=(0,a.useState)(()=>new Set),[x,b]=(0,a.useState)(!1);(0,a.useEffect)(()=>f(eB()),[]);let v=e=>f(function(e){let t=[...new Set([...eB(),...e.filter(e=>e)])].slice(-500);try{window.localStorage.setItem(eZ,JSON.stringify(t))}catch(e){}return new Set(t)}(e)),g=p.filter(e=>!m.has(e.key)),w=x?p:g,j=p.length-g.length;return(0,s.jsxs)("section",{className:"wb-bottom","aria-label":h("wb.panel"),children:[(0,s.jsxs)("div",{className:"wb-bottom-tabs",role:"tablist","aria-label":h("wb.panel"),children:[e$.map(e=>{let{tab:l,label:r,infoLabel:c,info:o}=e;return(0,s.jsxs)(a.Fragment,{children:[(0,s.jsxs)("button",{type:"button",role:"tab","aria-selected":t&&n===l,className:t&&n===l?"on":"",onClick:()=>i(l),children:[h(r),"problems"===l&&g.length>0&&(0,s.jsx)("span",{className:"wb-badge",children:g.length})]}),(0,s.jsx)(eP.q,{label:h(c),text:h(o)})]},l)}),(0,s.jsx)("span",{className:"grow"}),(0,s.jsx)("button",{type:"button",className:"wb-icon-btn","aria-label":h("wb.cmdPanel"),title:"".concat(h("wb.cmdPanel")," (Ctrl+J)"),onClick:l,children:t?"▾":"▴"})]}),t&&(0,s.jsx)("div",{className:"wb-bottom-body",role:"tabpanel",children:"terminal"===n?d?(0,s.jsx)("p",{className:"muted small wb-pad",children:h("wb.newChatTerminal")}):(0,s.jsx)(eU,{session:r,task:c}):"problems"===n?0===p.length?(0,s.jsx)("p",{className:"muted small wb-pad",children:d?h("wb.newChatProblems"):r?h("wb.noProblems"):h("wb.pickChat")}):(0,s.jsxs)(s.Fragment,{children:[0===w.length?(0,s.jsx)("p",{className:"muted small wb-pad",children:h("wb.problemsNoneNew")}):(0,s.jsx)("ul",{className:"wb-problems",children:w.map(e=>(0,s.jsxs)("li",{className:m.has(e.key)?"seen":void 0,children:[(0,s.jsxs)("button",{type:"button",className:"wb-row",onClick:()=>u(e.taskId),title:h("wb.problemShow"),children:[(0,s.jsx)("span",{className:"wb-sev ".concat(e.kind),"aria-hidden":"true",children:"error"===e.kind?"✗":"⚠"}),(0,s.jsx)("span",{className:"wb-row-name",children:e.text}),(0,s.jsx)("span",{className:"muted",children:e.where})]}),!m.has(e.key)&&(0,s.jsx)("button",{type:"button",className:"quiet small wb-seen",onClick:()=>v([e.key]),title:h("wb.problemSeenWhy"),children:h("wb.problemSeen")})]},e.key))}),(g.length>1||j>0)&&(0,s.jsxs)("div",{className:"row wb-pad",children:[g.length>1&&(0,s.jsx)("button",{type:"button",className:"quiet small",onClick:()=>v(g.map(e=>e.key)),title:h("wb.problemSeenWhy"),children:h("wb.problemsAllSeen")}),j>0&&(0,s.jsx)("button",{type:"button",className:"quiet small",onClick:()=>b(!x),children:x?h("wb.problemsHideSeen"):h("wb.problemsShowSeen",{n:j})})]})]}):d?(0,s.jsx)("p",{className:"muted small wb-pad",children:h("wb.newChatOutput")}):(0,s.jsx)(eV,{session:r})})]})}let eZ="cop.problems.seen";function eB(){try{var e;let t=JSON.parse(null!=(e=window.localStorage.getItem(eZ))?e:"[]");return new Set(Array.isArray(t)?t.filter(e=>"string"==typeof e):[])}catch(e){return new Set}}function eU(e){var t,l;let{session:n,task:i}=e,{t:d}=(0,o.kj)(),[u,h]=(0,a.useState)(null),p=(null==i?void 0:i.status)==="running"||(null==i?void 0:i.status)==="waiting-approval",{ref:m}=ed(!!p,null!=(t=null==u?void 0:u.entries.length)?t:0),f=()=>n&&i&&(i.startedAt||p)?r.FH.taskStory(n.id,i.id,i.runId).then(h).catch(()=>void 0):Promise.resolve();if((0,a.useEffect)(()=>{h(null),f()},[null==i?void 0:i.id,null==i?void 0:i.runId]),(0,c.z)(f,p?2e3:15e3,!!n&&!!i),!i)return(0,s.jsx)("p",{className:"muted small wb-pad",children:d("wb.pickChat")});let x=[],b=e=>e.forEach(e=>"step"===e.kind?x.push(e):"review"===e.kind?b(e.entries):void 0);return(b(null!=(l=null==u?void 0:u.entries)?l:[]),0===x.length)?(0,s.jsx)("p",{className:"muted small wb-pad",children:u?d("wb.noSteps"):d("wb.loading")}):(0,s.jsx)("div",{ref:m,className:"wb-terminal","aria-live":"off",children:x.map((e,t)=>(0,s.jsxs)("div",{className:e.failed?"bad":"",children:[(0,s.jsxs)("div",{className:"wb-cmd",children:[(0,s.jsx)("span",{"aria-hidden":"true",children:"$ "}),e.command,(0,s.jsxs)("span",{className:"muted",children:[" ",e.outcome?"".concat(e.outcome).concat(void 0!==e.exitCode?" (".concat(e.exitCode,")"):""):d("wb.runningNow")]})]}),e.output&&(0,s.jsx)("pre",{children:e.output})]},t))})}function eV(e){let{session:t}=e,{t:l}=(0,o.kj)(),n=(0,o.W3)(),[i,d]=(0,a.useState)([]),{ref:u}=ed(!0,i.length),h=()=>t?r.FH.sessionEvents(t.id).then(d).catch(()=>void 0):Promise.resolve();return((0,a.useEffect)(()=>{d([]),h()},[null==t?void 0:t.id]),(0,c.z)(h,3e3,!!t),t)?(0,s.jsx)("div",{ref:u,className:"wb-terminal",children:0===i.length?(0,s.jsx)("p",{className:"muted small",children:l("wb.noEvents")}):i.map((e,t)=>{var l;return(0,s.jsxs)("div",{className:"error"===e.level?"bad":"warn"===e.level?"warnline":"",children:[(0,s.jsxs)("span",{className:"muted",children:[n(e.at)," "]}),null!=(l=e.message)?l:e.type]},t)})}):(0,s.jsx)("p",{className:"muted small wb-pad",children:l("wb.pickChat")})}function eJ(e){var t,l,n,i,d,u,h,p,m,f,x;let{sessions:b,session:v,workspace:g,onShowThread:w}=e,{t:j}=(0,o.kj)(),k=function(e){let t=arguments.length>1&&void 0!==arguments[1]?arguments[1]:1e3,[l,s]=(0,a.useState)(()=>Date.now());return(0,a.useEffect)(()=>{if(!e)return;s(Date.now());let l=window.setInterval(()=>s(Date.now()),t);return()=>window.clearInterval(l)},[e,t]),l}(!0,5e3),[y,N]=(0,a.useState)(0),[S,C]=(0,a.useState)({iterations:60,minutes:240});(0,a.useEffect)(()=>{r.FH.settings().then(e=>{var t,l,s;let a=null!=(t=e.raw.limits)?t:{};C({iterations:null!=(l=a.maxIterations)?l:60,minutes:null!=(s=a.maxRunMinutes)?s:240})}).catch(()=>void 0)},[]),(0,c.z)(()=>r.FH.approvals().then(e=>N(e.length)).catch(()=>void 0),3e3);let M=null!=(d=b.find(e=>"idle"!==e.status&&!e.workerOf))?d:b.find(e=>"idle"!==e.status),F=null==M?void 0:M.tasks.find(e=>"running"===e.status||"waiting-approval"===e.status),O=(null==F?void 0:F.startedAt)?Math.floor((k-Date.parse(F.startedAt))/6e4):0;return(0,s.jsxs)("footer",{className:"wb-statusbar","aria-label":j("wb.status"),children:[(null==g?void 0:g.ok)&&(0,s.jsxs)("span",{title:g.dir,children:[(0,s.jsx)(R.O,{})," ",g.branch?"".concat(g.name," \xb7 ").concat(g.branch):g.name]}),M&&F?(0,s.jsxs)("button",{type:"button",className:"wb-status-btn",onClick:()=>w(M.id),title:j("wb.openRunning"),children:[(0,s.jsx)("span",{className:M.paused?"wb-live paused":"wb-live","aria-hidden":"true"})," ",F.lead?j("wb.runningLineTwo",{session:M.name.replace(/^chat: /,""),task:F.title,lead:null!=(u=null==(t=F.lead.messages)?void 0:t.lead)?u:0,worker:null!=(h=null==(l=F.lead.messages)?void 0:l.worker)?h:0,total:(null!=(p=null==(n=F.lead.messages)?void 0:n.lead)?p:0)+(null!=(m=null==(i=F.lead.messages)?void 0:i.worker)?m:0),m:O,maxm:S.minutes}):j("wb.runningLine",{session:M.name.replace(/^chat: /,""),task:F.title,n:F.iterations,max:S.iterations,m:O,maxm:S.minutes}),M.paused&&(0,s.jsxs)("strong",{className:"wb-paused",children:[" \xb7 ",j("wb.pausedTag")]})]}):(0,s.jsx)("span",{children:j("wb.idle")}),(0,s.jsx)("span",{className:"grow"}),y>0&&(0,s.jsx)("button",{type:"button",className:"wb-status-btn warn",onClick:()=>{var e;return null==(e=document.querySelector(".approval-banner"))?void 0:e.scrollIntoView({block:"start"})},children:j("wb.waiting",{n:y})}),v&&(0,s.jsx)("span",{title:j("wb.modelNow"),children:null!=(x=null!=(f=v.modelInUse)?f:v.model)?x:j("wb.modelDefault")})]})}var eX=l(1702);function eY(e){let{commands:t,onClose:l}=e,{t:n}=(0,o.kj)(),i=(0,eX.useRouter)(),[r,c]=(0,a.useState)(""),[d,u]=(0,a.useState)(0),h=(0,a.useRef)(null);(0,a.useEffect)(()=>{var e;return null==(e=h.current)?void 0:e.focus()},[]);let p=(0,a.useMemo)(()=>{let e=r.toLowerCase().split(/\s+/).filter(Boolean);return t.filter(t=>e.every(e=>{var l;return"".concat(t.label," ").concat(null!=(l=t.hint)?l:"").toLowerCase().includes(e)})).slice(0,60)},[r,t]),m=0===p.length?-1:Math.min(d,p.length-1),f=e=>{var t;e&&(l(),e.href?i.push(e.href):null==(t=e.run)||t.call(e))};return(0,s.jsx)("div",{className:"modal-backdrop",role:"presentation",onClick:l,children:(0,s.jsxs)("div",{className:"wb-palette",role:"dialog","aria-modal":"true","aria-label":n("wb.palette"),onClick:e=>e.stopPropagation(),children:[(0,s.jsx)("input",{ref:h,type:"text",role:"combobox","aria-expanded":"true","aria-controls":"wb-palette-list","aria-activedescendant":m>=0?"wb-cmd-".concat(m):void 0,"aria-label":n("wb.palette"),placeholder:n("wb.palettePlaceholder"),value:r,onChange:e=>{c(e.target.value),u(0)},onKeyDown:e=>{"Escape"===e.key?l():"ArrowDown"===e.key?(e.preventDefault(),u(Math.min(p.length-1,m+1))):"ArrowUp"===e.key?(e.preventDefault(),u(Math.max(0,m-1))):"Enter"===e.key&&(e.preventDefault(),f(p[m]))}}),(0,s.jsxs)("ul",{id:"wb-palette-list",role:"listbox","aria-label":n("wb.palette"),children:[0===p.length&&(0,s.jsx)("li",{className:"muted small",children:n("wb.paletteNone")}),p.map((e,t)=>(0,s.jsxs)("li",{id:"wb-cmd-".concat(t),role:"option","aria-selected":t===m,className:t===m?"on":"",onMouseEnter:()=>u(t),onClick:()=>f(e),children:[(0,s.jsx)("span",{className:"wb-row-name",children:e.label}),e.hint&&(0,s.jsx)("span",{className:"muted small",children:e.hint})]},e.id))]})]})})}var eG=l(1758);function eQ(){let{t:e,locale:t}=(0,o.kj)(),l=(0,eP.f)("below"),[n,i]=(0,a.useState)(""),c=async()=>{try{let l=await r.FH.kerrigan(t);return l.filled?l:{...l,text:l.text.replace(/⟦([\w.-]+)⟧/g,(t,l)=>e(l))}}catch(t){return i(e("kerrigan.failed",{reason:t.message})),null}},d=async()=>{l.close();let t=await c();if(!t)return;let s=URL.createObjectURL(new Blob([t.text],{type:"text/markdown;charset=utf-8"})),a=document.createElement("a");a.href=s,a.download=t.fileName,a.click(),URL.revokeObjectURL(s),i(e("kerrigan.saved",{name:t.fileName}))},u=async()=>{l.close();let t=await c();t&&i(await (0,ep.D)(t.text)?e("kerrigan.copied",{n:t.text.length}):e("kerrigan.copyFailed"))};return(0,s.jsxs)("div",{className:"kerrigan",children:[(0,s.jsxs)("div",{className:"row",children:[(0,s.jsxs)("button",{ref:l.anchor,type:"button",className:"primary","aria-haspopup":"menu","aria-expanded":l.open,"aria-controls":l.open?l.id:void 0,onClick:()=>{l.open||c(),l.toggle()},children:[e("kerrigan.button")," ",(0,s.jsx)("span",{"aria-hidden":"true",children:"▾"})]}),(0,s.jsx)(eP.q,{label:e("kerrigan.infoLabel"),text:e("kerrigan.info")})]}),l.open&&(0,s.jsxs)("div",{ref:l.panel,id:l.id,role:"menu","aria-label":e("kerrigan.menu"),className:"pop menu",style:l.style,children:[(0,s.jsx)("button",{type:"button",role:"menuitem",onClick:()=>void d(),children:e("kerrigan.save")}),(0,s.jsx)("button",{type:"button",role:"menuitem",onClick:()=>void u(),children:e("kerrigan.copy")})]}),n&&(0,s.jsx)("p",{className:"small",role:"status",children:n})]})}let e0=(e,t)=>0===t||/[/\\._\-\s]/.test(e[t-1])||/[a-z]/.test(e[t-1])&&/[A-Z]/.test(e[t]);function e1(e,t){let l=e.toLowerCase(),s=[],a=0,n=0,i=-2;for(let r of t.toLowerCase()){let t=l.indexOf(r,n);if(t<0)return null;for(let s=t;s>=0&&s<l.length&&s<t+12;s=l.indexOf(r,s+1))if(e0(e,s)){t=s;break}a+=1,t===i+1&&(a+=5),e0(e,t)&&(a+=3),e[t]===r&&(a+=1),s.push(t),i=t,n=t+1}return{score:a-.05*Math.max(0,s[0]),hits:s}}function e2(e,t){let l=new Set(t),a=[],n="",i=!1,r=e=>{n&&(a.push(i?(0,s.jsx)("mark",{className:"qo-hit",children:n},e):n),n="")};return[...e].forEach((e,t)=>{let s=l.has(t);s!==i&&(r(t),i=s),n+=e}),r(e.length),a}function e3(e){let{recent:t,onOpen:l,onClose:n}=e,{t:i}=(0,o.kj)(),[c,d]=(0,a.useState)(null),[u,h]=(0,a.useState)(""),[p,m]=(0,a.useState)(0),[f,x]=(0,a.useState)(!1),b=(0,a.useRef)(null),v=(0,a.useRef)(null);(0,a.useEffect)(()=>{var e;return null==(e=b.current)?void 0:e.focus()},[]),(0,a.useEffect)(()=>{r.FH.workspaceFiles().then(e=>d(e.files)).catch(()=>d([]))},[]);let{query:g,line:w}=function(e){let t=/^(.*?):(\d+)(?::\d+)?\s*$/.exec(e);return t?{query:t[1],line:Number(t[2])}:{query:e}}(u),j=(0,a.useMemo)(()=>{if(!c)return[];if(!g.trim()){let e=new Set(c),l=t.filter(t=>e.has(t)),s=c.filter(e=>!l.includes(e)).slice(0,50);return[...l.map(e=>({path:e,score:0,nameHits:[],dirHits:[],recent:!0})),...s.map(e=>({path:e,score:0,nameHits:[],dirHits:[]}))]}return function(e,t){let l=arguments.length>2&&void 0!==arguments[2]?arguments[2]:50,s=[];for(let l of e){let e=function(e,t){let l=t.trim();if(!l)return{path:e,score:0,nameHits:[],dirHits:[]};let s=e.lastIndexOf("/"),a=e.slice(s+1),n=s>=0?e.slice(0,s):"",i=0,r=[],c=[];for(let t of l.split(/\s+/).filter(Boolean)){if(t.includes("/")){let l=e1(e,t);if(!l)return null;for(let e of(i+=l.score,l.hits))e>s?r.push(e-s-1):c.push(e);continue}let l=e1(a,t);if(l){i+=l.score+10+8*!!a.toLowerCase().startsWith(t.toLowerCase()),r.push(...l.hits);continue}let n=e1(e,t);if(!n)return null;for(let e of(i+=n.score,n.hits))e>s?r.push(e-s-1):c.push(e)}return{path:e,score:i-.01*e.length-(n?.2*n.split("/").length:0),nameHits:r,dirHits:c}}(l,t);e&&s.push(e)}return s.sort((e,t)=>t.score-e.score||e.path.localeCompare(t.path)).slice(0,l)}(c,g,60)},[c,g,t]),k=0===j.length?-1:Math.min(p,j.length-1);(0,a.useEffect)(()=>{var e,t;null==(t=v.current)||null==(e=t.querySelector('[aria-selected="true"]'))||e.scrollIntoView({block:"nearest"})},[k]);let y=e=>{e&&(n(),l(e.path,w))};return(0,a.useEffect)(()=>{f&&c&&(x(!1),y(j[0]))},[f,c]),(0,s.jsx)("div",{className:"modal-backdrop qo-backdrop",role:"presentation",onClick:n,children:(0,s.jsxs)("div",{className:"wb-palette qo",role:"dialog","aria-modal":"true","aria-label":i("quick.label"),onClick:e=>e.stopPropagation(),children:[(0,s.jsx)("input",{ref:b,type:"text",role:"combobox","aria-expanded":"true","aria-controls":"qo-list","aria-activedescendant":k>=0?"qo-".concat(k):void 0,"aria-label":i("quick.label"),placeholder:i("quick.placeholder"),value:u,spellCheck:!1,onChange:e=>{h(e.target.value),m(0)},onKeyDown:e=>{"Escape"===e.key?n():"ArrowDown"===e.key?(e.preventDefault(),m(Math.min(j.length-1,k+1))):"ArrowUp"===e.key?(e.preventDefault(),m(Math.max(0,k-1))):"Enter"===e.key&&(e.preventDefault(),c?y(j[k]):x(!0))}}),(0,s.jsxs)("ul",{id:"qo-list",ref:v,role:"listbox","aria-label":i("quick.label"),children:[c&&0===j.length&&(0,s.jsx)("li",{className:"muted small qo-none",children:i("quick.none")}),j.map((e,t)=>{let l=e.path.lastIndexOf("/"),a=e.path.slice(l+1),n=l>=0?e.path.slice(0,l):"";return(0,s.jsxs)("li",{id:"qo-".concat(t),role:"option","aria-selected":t===k,className:"qo-row".concat(t===k?" on":""),onMouseEnter:()=>m(t),onClick:()=>y(e),title:e.path,children:[(0,s.jsx)(T,{path:e.path}),(0,s.jsx)("span",{className:"qo-name",children:e2(a,e.nameHits)}),n&&(0,s.jsx)("span",{className:"qo-dir",children:e2(n,e.dirHits)}),"recent"in e&&e.recent&&(0,s.jsx)("span",{className:"qo-tag",children:i("quick.recent")})]},e.path)})]})]})})}function e5(e){var t;let{onOpen:l,grip:n,focusAsk:i}=e,{t:c}=(0,o.kj)(),[d,u]=(0,a.useState)(""),[h,p]=(0,a.useState)(!1),[m,f]=(0,a.useState)(!1),[x,b]=(0,a.useState)(!1),[v,g]=(0,a.useState)(!1),[w,j]=(0,a.useState)(""),[k,y]=(0,a.useState)(""),[N,S]=(0,a.useState)(null),[C,M]=(0,a.useState)(!1),[F,O]=(0,a.useState)(""),[L,q]=(0,a.useState)(new Set),E=(0,a.useRef)(null),I=(0,a.useRef)(0);(0,a.useEffect)(()=>{if(i>0){var e,t;null==(e=E.current)||e.focus(),null==(t=E.current)||t.select()}},[i]);let D=async()=>{let e=++I.current;if(!d){S(null),M(!1),O("");return}M(!0);try{let t=await r.FH.workspaceSearch(d,{matchCase:h,wholeWord:m,regex:x,include:w,exclude:k});if(e!==I.current)return;S(t),O(""),q(new Set)}catch(t){e===I.current&&O(t.message)}finally{e===I.current&&M(!1)}};(0,a.useEffect)(()=>{let e=setTimeout(()=>void D(),300);return()=>clearTimeout(e)},[d,h,m,x,w,k]);let H=null!=(t=null==N?void 0:N.files)?t:[],z=H.length>0&&H.every(e=>L.has(e.path)),W=(e,t,l,a,n)=>(0,s.jsx)("button",{type:"button",className:"sv-toggle ".concat(n).concat(t?" on":""),"aria-pressed":t,"aria-label":e,title:e,onClick:()=>l(!t),children:a}),A=C?c("search.searching"):F||(null==N?void 0:N.problem)?c("search.problem",{why:F||(null==N?void 0:N.problem)||""}):N&&d?0===N.total?c("search.none"):c("search.results",{n:N.total,files:H.length}):"";return(0,s.jsxs)("div",{className:"sv",children:[(0,s.jsxs)("div",{className:"wb-side-head",children:[n,(0,s.jsx)("h2",{children:c("search.title")}),(0,s.jsx)("span",{className:"grow"}),(0,s.jsx)("button",{type:"button",className:"wb-icon-btn",onClick:()=>void D(),disabled:!d,"aria-label":c("search.refresh"),title:c("search.refresh"),children:"↻"}),(0,s.jsx)("button",{type:"button",className:"wb-icon-btn",onClick:()=>{var e;u(""),S(null),null==(e=E.current)||e.focus()},disabled:!d&&!N,"aria-label":c("search.clear"),title:c("search.clear"),children:(0,s.jsx)("svg",{viewBox:"0 0 16 16",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.4","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M3 4h10M6 4V2.5h4V4M4.5 4l.7 9.5h5.6L11.5 4"})})}),(0,s.jsx)("button",{type:"button",className:"wb-icon-btn",onClick:()=>q(z?new Set:new Set(H.map(e=>e.path))),disabled:0===H.length,"aria-label":c(z?"search.expand":"search.collapse"),title:c(z?"search.expand":"search.collapse"),children:(0,s.jsx)("svg",{viewBox:"0 0 16 16",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.4","aria-hidden":"true",children:z?(0,s.jsx)("path",{d:"M4 6l4 4 4-4"}):(0,s.jsx)("path",{d:"M3 3h10v10H3zM5.5 8h5"})})})]}),(0,s.jsxs)("div",{className:"sv-form",children:[(0,s.jsxs)("div",{className:"sv-row",children:[(0,s.jsx)("button",{type:"button",className:"sv-details".concat(v?" on":""),"aria-expanded":v,"aria-label":c("search.details"),title:c("search.details"),onClick:()=>g(!v),children:"…"}),(0,s.jsxs)("div",{className:"sv-box",children:[(0,s.jsx)("input",{ref:E,type:"text",value:d,onChange:e=>u(e.target.value),onKeyDown:e=>{"Enter"===e.key&&D()},placeholder:c("search.input"),"aria-label":c("search.input"),spellCheck:!1}),W(c("search.matchCase"),h,p,"Aa","case"),W(c("search.wholeWord"),m,f,(0,s.jsx)("span",{className:"sv-word",children:"ab"}),"word"),W(c("search.regex"),x,b,".*","regex")]})]}),v&&(0,s.jsxs)("div",{className:"sv-globs",children:[(0,s.jsx)("label",{htmlFor:"sv-include",children:c("search.include")}),(0,s.jsx)("input",{id:"sv-include",type:"text",value:w,onChange:e=>j(e.target.value),placeholder:c("search.includePlaceholder"),spellCheck:!1}),(0,s.jsx)("label",{htmlFor:"sv-exclude",children:c("search.exclude")}),(0,s.jsx)("input",{id:"sv-exclude",type:"text",value:k,onChange:e=>y(e.target.value),placeholder:c("search.excludePlaceholder"),spellCheck:!1})]}),A&&(0,s.jsx)("p",{className:"sv-message".concat(F||(null==N?void 0:N.problem)?" bad":""),role:"status",children:A}),(null==N?void 0:N.truncated)&&!C&&(0,s.jsx)("p",{className:"sv-message",children:c("search.truncated")})]}),(0,s.jsx)("div",{className:"sv-results",role:"tree","aria-label":c("search.title"),children:H.map(e=>{let t=!L.has(e.path),a=e.path.lastIndexOf("/");return(0,s.jsxs)("div",{role:"treeitem","aria-expanded":t,"aria-selected":!1,className:"sv-file",children:[(0,s.jsxs)("button",{type:"button",className:"sv-file-head",onClick:()=>q(t=>{let l=new Set(t);return l.has(e.path)?l.delete(e.path):l.add(e.path),l}),title:e.path,children:[(0,s.jsx)("span",{className:"sv-chevron".concat(t?" open":""),"aria-hidden":"true",children:"›"}),(0,s.jsx)(T,{path:e.path}),(0,s.jsx)("span",{className:"sv-name",children:e.path.slice(a+1)}),a>0&&(0,s.jsx)("span",{className:"sv-dir",children:e.path.slice(0,a)}),(0,s.jsx)("span",{className:"sv-count",children:e.matches.reduce((e,t)=>e+Math.max(1,t.ranges.length),0)})]}),t&&(0,s.jsx)("div",{role:"group",children:e.matches.map((t,a)=>(0,s.jsx)("button",{type:"button",role:"treeitem","aria-selected":!1,className:"sv-match",title:"".concat(e.path,":").concat(t.line),onClick:()=>{var s;return l({path:e.path,line:t.line,...void 0!==t.column?{from:t.column,to:t.column+(null!=(s=t.length)?s:0)}:{}})},children:function(e,t){let l=[],a=0;return t.forEach((t,n)=>{let[i,r]=t;i>a&&l.push(e.slice(a,i)),l.push((0,s.jsx)("mark",{className:"sv-hit",children:e.slice(i,r)},n)),a=r}),a<e.length&&l.push(e.slice(a)),l}(t.text,t.ranges)},"".concat(t.line,"-").concat(a)))})]},e.path)})})]})}let e4=["side","center","chat"],e6="application/x-cop-area",e7=["wb.moveLeft","wb.moveCenter","wb.moveRight"];function e8(e){let{name:t,place:l,onMove:a,onDragging:n}=e,{t:i}=(0,o.kj)(),r=(0,eP.f)("below");return(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("button",{ref:r.anchor,type:"button",className:"wb-grip",draggable:!0,"aria-haspopup":"menu","aria-expanded":r.open,"aria-controls":r.open?r.id:void 0,"aria-label":i("wb.move",{name:t}),title:i("wb.moveWhy"),onClick:r.toggle,onDragStart:e=>{var t,l;e.dataTransfer.setData(e6,null!=(l=null==(t=e.currentTarget.closest("[data-area]"))?void 0:t.dataset.area)?l:""),e.dataTransfer.effectAllowed="move",r.close(),n(!0)},onDragEnd:()=>n(!1),children:(0,s.jsx)("svg",{viewBox:"0 0 10 16",width:"8",height:"13","aria-hidden":"true",children:[3,8,13].map(e=>(0,s.jsxs)("g",{children:[(0,s.jsx)("circle",{cx:"2.5",cy:e,r:"1.4",fill:"currentColor"}),(0,s.jsx)("circle",{cx:"7.5",cy:e,r:"1.4",fill:"currentColor"})]},e))})}),r.open&&(0,s.jsx)("div",{ref:r.panel,id:r.id,role:"menu","aria-label":i("wb.move",{name:t}),className:"pop wb-move-menu",style:r.style,children:e7.map((e,t)=>(0,s.jsx)("button",{type:"button",role:"menuitem",disabled:t===l,onClick:()=>{r.close(),a(t)},children:i(e)},e))})]})}let e9=e=>{var t;return"diff"===e.kind?"d:".concat(e.area,":").concat(null!=(t=e.commit)?t:"",":").concat(e.path):"f:".concat(e.path)},te={side:290,chat:420,bottom:240,sideOpen:!0,chatOpen:!0,bottomOpen:!0,order:e4},tt="cop.workbench.layout";function tl(){return(0,s.jsx)(a.Suspense,{fallback:null,children:(0,s.jsx)(ts,{})})}function ts(){let{t:e}=(0,o.kj)(),[t,l]=(0,a.useState)(null),[n,u]=(0,a.useState)([]),[h,p]=(0,a.useState)(""),[m,f]=(0,a.useState)("files"),[x,b]=(0,a.useState)(""),[v,g]=(0,a.useState)(null),[w,j]=(0,a.useState)(null),[k,y]=(0,a.useState)("terminal"),[N,S]=(0,a.useState)(te),[C,M]=(0,a.useState)(!1),[F,O]=(0,a.useState)(0),[L,q]=(0,a.useState)(null),[E,I]=(0,a.useState)(new Set),D=(0,a.useCallback)((e,t)=>{I(l=>{if(l.has(e)===t)return l;let s=new Set(l);return t?s.add(e):s.delete(e),s})},[]),H=(0,a.useCallback)(()=>r.FH.sessions().then(e=>l(e.filter(e=>"chat"===e.kind))).catch(()=>void 0),[]);(0,c.z)(H,3e3);let z=(0,a.useCallback)(()=>r.FH.workspace().then(g).catch(()=>void 0),[]);(0,c.z)(z,1e4);let W=(0,a.useCallback)(async()=>{try{var e;let t=await r.FH.browseFolder((null==v?void 0:v.dir)||void 0);if(!t.ok)return;let l=await r.FH.settings();await r.FH.saveSettings({...l.raw,project:{...null!=(e=l.raw.project)?e:{},rootDir:t.path}}),await z()}catch(e){b(e.message)}},[null==v?void 0:v.dir,z]);(0,a.useEffect)(()=>S(function(){try{var e;let t=window.localStorage.getItem(tt);if(!t)return te;let l={...te,...JSON.parse(t)};return{...l,order:(e=l.order,Array.isArray(e)&&3===e.length&&e4.every(t=>e.includes(t))?e:e4)}}catch(e){return te}}()),[]),(0,a.useEffect)(()=>{try{window.localStorage.setItem(tt,JSON.stringify(N))}catch(e){}},[N]);let A=(0,a.useCallback)(e=>{u(t=>t.some(t=>e9(t)===e9(e))?t:[...t,e]),p(e9(e))},[]),[R,P]=(0,a.useState)(!1),[$,K]=(0,a.useState)(null),[Z,B]=(0,a.useState)(0),U=(0,a.useCallback)(e=>{A({kind:"file",path:e.path}),K(t=>{var l;return{path:e.path,line:e.line,from:e.from,to:e.to,n:(null!=(l=null==t?void 0:t.n)?l:0)+1}})},[A]),V=()=>{f("search"),ee({sideOpen:!0}),B(e=>e+1)},J=async t=>{let l=n.find(e=>e9(e)===t);if((null==l?void 0:l.kind)==="file"&&E.has(l.path)){var s;if(!await (0,eu.Z)(e("ed.closeUnsaved",{name:null!=(s=l.path.split("/").pop())?s:l.path})))return;D(l.path,!1)}u(e=>{let l=e.findIndex(e=>e9(e)===t),s=e.filter(e=>e9(e)!==t);return t===h&&p(s[Math.max(0,l-1)]?e9(s[Math.max(0,l-1)]):""),s})},X=n.find(e=>e9(e)===h),Y=w&&"new"!==w?null==t?void 0:t.find(e=>e.id===w.sessionId):void 0,G=w&&"new"!==w?null==Y?void 0:Y.tasks.find(e=>e.id===w.taskId):void 0,ee=e=>S(t=>({...t,...e})),et=()=>{ee({chatOpen:!0}),O(e=>e+1)};(0,a.useEffect)(()=>{let e=e=>{if(!(e.ctrlKey||e.metaKey))return;let t=e.key.toLowerCase();"k"===t||"p"===t&&e.shiftKey?(e.preventDefault(),M(!0)):"p"===t?(e.preventDefault(),P(!0)):"f"===t&&e.shiftKey?(e.preventDefault(),V()):"e"===t&&e.shiftKey?(e.preventDefault(),f("files"),ee({sideOpen:!0})):"b"!==t||e.shiftKey?"j"===t?(e.preventDefault(),ee({bottomOpen:!N.bottomOpen})):"l"===t&&(e.preventDefault(),et()):(e.preventDefault(),ee({sideOpen:!N.sideOpen}))};return window.addEventListener("keydown",e),()=>window.removeEventListener("keydown",e)},[N]);let el=(0,a.useMemo)(()=>[{id:"chat",label:e("wb.cmdChat"),hint:"Ctrl+L",run:et},{id:"side",label:e("wb.cmdSide"),hint:"Ctrl+B",run:()=>ee({sideOpen:!N.sideOpen})},{id:"panel",label:e("wb.cmdPanel"),hint:"Ctrl+J",run:()=>ee({bottomOpen:!N.bottomOpen})},{id:"quick-open",label:e("wb.cmdQuickOpen"),hint:"Ctrl+P",run:()=>P(!0)},{id:"search",label:e("wb.cmdSearch"),hint:"Ctrl+Shift+F",run:V},{id:"layout",label:e("wb.cmdResetLayout"),run:()=>ee({order:e4,side:te.side,chat:te.chat})},{id:"files",label:e("wb.cmdFiles"),run:()=>{ee({sideOpen:!0}),f("files")}},{id:"commits",label:e("wb.cmdCommits"),run:()=>{ee({sideOpen:!0}),f("commits")}},{id:"problems",label:e("wb.cmdProblems"),run:()=>{ee({bottomOpen:!0}),y("problems")}},...[["/defaults","nav.defaults"],["/system","nav.system"]].map(t=>{let[l,s]=t;return{id:"go:".concat(l),label:e("wb.cmdGo",{page:e(s)}),href:l}}),...(null!=t?t:[]).map(t=>({id:"c:".concat(t.id),label:e("wb.cmdThread",{name:t.name.replace(/^chat: /,"")}),run:()=>{ee({chatOpen:!0}),q(e=>{var l;return{id:t.id,n:(null!=(l=null==e?void 0:e.n)?l:0)+1}})}}))],[t,e,N]),[es,ea]=(0,a.useState)(!1),[en,ei]=(0,a.useState)(null),er=e=>N.order.indexOf(e),ec=N.order.filter(e=>"side"===e?N.sideOpen:"chat"!==e||N.chatOpen),ed=ec.map(e=>1===er(e)?"minmax(0, 1fr)":"".concat(0===er(e)?N.side:N.chat,"px"));ed.length>0&&!ed.includes("minmax(0, 1fr)")&&(ed[ed.length-1]="minmax(0, 1fr)");let eh=["46px",...ed.flatMap((e,t)=>0===t?[e]:["5px",e])].join(" "),ep=(e,t)=>ee({order:function(e,t,l){let s=e.indexOf(t);if(s<0||l<0||l>2||s===l)return e;let a=[...e];return a[s]=e[l],a[l]=t,a}(N.order,e,t)}),em=(e,t)=>(0,s.jsx)(e8,{area:e,name:t,place:er(e),onMove:t=>ep(e,t),onDragging:ea}),ef=t=>({"data-area":t,"data-drop":e("wb.dropHere"),onDragOver:e=>{e.dataTransfer.types.includes(e6)&&(e.preventDefault(),e.dataTransfer.dropEffect="move",en!==t&&ei(t))},onDragLeave:e=>{e.currentTarget.contains(e.relatedTarget)||ei(e=>e===t?null:e)},onDrop:e=>{let l=e.dataTransfer.getData(e6);e.preventDefault(),ei(null),ea(!1),l&&l!==t&&N.order.includes(l)&&ep(l,er(t))}}),ex=e=>"".concat(es?" wb-drop":"").concat(en===e?" wb-drop-over":""),eb={"--wb-columns":eh,"--wb-side":N.sideOpen?"".concat(N.side,"px"):"0px","--wb-chat":N.chatOpen?"".concat(N.chat,"px"):"0px","--wb-bottom":N.bottomOpen?"".concat(N.bottom,"px"):"34px"},ev={side:(0,s.jsxs)("aside",{className:"wb-side".concat(ex("side")),"aria-label":e("wb.explorer"),hidden:!N.sideOpen,...ef("side"),children:[(0,s.jsx)("div",{className:"wb-side-view",hidden:"search"!==m,children:(0,s.jsx)(e5,{onOpen:U,grip:"search"===m?em("side",e("wb.explorer")):void 0,focusAsk:Z})}),"search"!==m&&(0,s.jsx)(_,{view:m,onOpen:A,workspace:v,onOpenFolder:()=>void W(),grip:em("side",e("wb.explorer"))})]},"side"),center:(0,s.jsxs)("section",{className:"wb-center".concat(ex("center")),"aria-label":e("wb.editor"),...ef("center"),children:[(0,s.jsxs)("div",{className:"wb-tabs",role:"tablist","aria-label":e("wb.openTabs"),children:[em("center",e("wb.editor")),0===n.length&&(0,s.jsx)("span",{className:"muted small wb-tabs-empty",children:e("wb.noTabs")}),n.map(t=>{var l,a;let n=e9(t),i="diff"===t.kind?"".concat(t.path.split("/").pop()," (").concat("commit"===t.area?(null!=(l=t.commit)?l:"").slice(0,7):e("staged"===t.area?"git.index":"git.workingTree"),")"):null!=(a=t.path.split("/").pop())?a:t.path;return(0,s.jsxs)("div",{className:"wb-tab".concat(n===h?" active":""),children:[(0,s.jsxs)("button",{type:"button",role:"tab","aria-selected":n===h,onClick:()=>p(n),title:t.path,children:["diff"===t.kind?(0,s.jsx)("span",{className:"wb-ico","aria-hidden":"true",children:"\xb1"}):(0,s.jsx)(T,{path:t.path}),(0,s.jsx)("span",{className:"wb-tab-label",children:i}),"file"===t.kind&&E.has(t.path)&&(0,s.jsx)("span",{className:"wb-unsaved",title:e("ed.unsaved"),"aria-label":e("ed.unsaved"),children:"●"})]}),(0,s.jsx)("button",{type:"button",className:"wb-tab-close","aria-label":e("wb.closeTab",{name:i}),onClick:()=>void J(n),children:"\xd7"})]},n)})]}),(0,s.jsxs)("div",{className:"wb-editor",role:"tabpanel",children:[X?"diff"===X.kind?(0,s.jsx)(eo,{area:X.area,path:X.path,commit:X.commit},e9(X)):null:(0,s.jsx)(tc,{workspace:v,problem:x}),n.map(e=>"file"===e.kind?(0,s.jsx)("div",{className:"wb-file-pane",hidden:e9(e)!==h,children:(0,s.jsx)(Q,{path:e.path,onDirty:D,goTo:(null==$?void 0:$.path)===e.path?$:void 0,onOpenFile:e=>A({kind:"file",path:e})})},e9(e)):null)]}),N.bottomOpen&&(0,s.jsx)(ti,{axis:"y",label:e("wb.resize"),onDrag:e=>ee({bottom:ta(N.bottom-e,90,700)})}),(0,s.jsx)(eK,{open:N.bottomOpen,onToggle:()=>ee({bottomOpen:!N.bottomOpen}),tab:k,onTab:e=>{y(e),ee({bottomOpen:!0})},session:Y,task:G,newChat:"new"===w,onShowMessage:e=>{ee({chatOpen:!0}),window.setTimeout(()=>{var t;return null==(t=document.getElementById("cs-turn-".concat(e)))?void 0:t.scrollIntoView({block:"start",behavior:"smooth"})},50)}})]},"center"),chat:(0,s.jsx)("aside",{className:"wb-chat".concat(ex("chat")),"aria-label":e("wb.chatPanel"),hidden:!N.chatOpen,...ef("chat"),children:(0,s.jsx)(e_,{workspace:v,composeAsk:F,showThread:L,onOpenFile:e=>A({kind:"file",path:e}),onOpenFolder:()=>void W(),onTurn:j,onChange:()=>void H(),onClose:()=>ee({chatOpen:!1}),grip:em("chat",e("wb.chatPanel"))})},"chat")};return(0,s.jsxs)("div",{className:"wb",style:eb,children:[(0,s.jsxs)("header",{className:"wb-top",children:[(0,s.jsx)("span",{className:"wb-brand",children:"copilot-operator"}),(0,s.jsxs)("button",{type:"button",className:"wb-search",onClick:()=>M(!0),title:e("wb.paletteWhy"),children:[(0,s.jsx)("span",{children:e("wb.palette")}),(0,s.jsx)("kbd",{children:"Ctrl+K"})]}),(0,s.jsxs)("nav",{className:"wb-menu","aria-label":e("nav.label"),children:[(0,s.jsx)(i(),{href:"/defaults",children:e("nav.defaults")}),(0,s.jsx)(eG.y,{}),(0,s.jsx)(i(),{href:"/system",children:e("nav.system")}),(0,s.jsx)(d.c,{})]})]}),(0,s.jsxs)("div",{className:"wb-body".concat(N.sideOpen?"":" no-side").concat(N.chatOpen?"":" no-chat"),children:[(0,s.jsx)(tn,{side:m,sideOpen:N.sideOpen,onSide:e=>{e===m&&N.sideOpen?ee({sideOpen:!1}):(f(e),ee({sideOpen:!0}))},chatOpen:N.chatOpen,onChat:()=>ee({chatOpen:!N.chatOpen})}),N.order.map(t=>{let l=ec.indexOf(t),n=l>0?ec[l-1]:null;return(0,s.jsxs)(a.Fragment,{children:[n&&(0,s.jsx)(ti,{axis:"x",label:e("wb.resize"),onDrag:e=>{0===er(n)?ee({side:ta(N.side+e,180,820)}):2===er(t)&&ee({chat:ta(N.chat-e,260,820)})}}),ev[t]]},t)})]}),(0,s.jsx)(eJ,{sessions:null!=t?t:[],session:Y,workspace:v,onShowThread:e=>{ee({chatOpen:!0}),q(t=>{var l;return{id:e,n:(null!=(l=null==t?void 0:t.n)?l:0)+1}})}}),C&&(0,s.jsx)(eY,{commands:el,onClose:()=>M(!1)}),R&&(0,s.jsx)(e3,{recent:n.filter(e=>"file"===e.kind).map(e=>e.path).reverse(),onOpen:(e,t)=>t?U({path:e,line:t}):A({kind:"file",path:e}),onClose:()=>P(!1)})]})}let ta=(e,t,l)=>Math.max(t,Math.min(l,e));function tn(e){let{side:t,sideOpen:l,onSide:a,chatOpen:n,onChat:i}=e,{t:r}=(0,o.kj)(),c=(e,n,i)=>(0,s.jsx)("button",{type:"button",className:"wb-act".concat(l&&t===e?" on":""),"aria-pressed":l&&t===e,"aria-label":n,title:n,onClick:()=>a(e),children:(0,s.jsx)("svg",{viewBox:"0 0 24 24",width:"22",height:"22",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",children:i})});return(0,s.jsxs)("nav",{className:"wb-activity","aria-label":r("wb.views"),children:[c("files",r("wb.viewFiles"),(0,s.jsx)("path",{d:"M4 4h6l2 2h8v14H4z"})),c("search",r("wb.search"),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("circle",{cx:"10.5",cy:"10.5",r:"6"}),(0,s.jsx)("path",{d:"M15 15l5 5"})]})),c("commits",r("wb.viewCommits"),(0,s.jsxs)(s.Fragment,{children:[(0,s.jsx)("circle",{cx:"12",cy:"12",r:"3"}),(0,s.jsx)("path",{d:"M12 3v6M12 15v6"})]})),(0,s.jsx)("span",{className:"grow"}),(0,s.jsx)("button",{type:"button",className:"wb-act".concat(n?" on":""),"aria-pressed":n,"aria-label":r("wb.toggleChat"),title:"".concat(r("wb.toggleChat")," (Ctrl+L)"),onClick:i,children:(0,s.jsx)("svg",{viewBox:"0 0 24 24",width:"22",height:"22",fill:"none",stroke:"currentColor",strokeWidth:"1.8",strokeLinejoin:"round","aria-hidden":"true",children:(0,s.jsx)("path",{d:"M4 5h16v11H9l-5 4z"})})})]})}function ti(e){let{axis:t,label:l,onDrag:n}=e,i=(0,a.useRef)(null);return(0,s.jsx)("div",{className:"wb-split ".concat(t),role:"separator","aria-orientation":"x"===t?"vertical":"horizontal","aria-label":l,tabIndex:0,onPointerDown:e=>{i.current="x"===t?e.clientX:e.clientY,e.target.setPointerCapture(e.pointerId)},onPointerMove:e=>{if(null===i.current)return;let l="x"===t?e.clientX:e.clientY;n(l-i.current),i.current=l},onPointerUp:()=>i.current=null,onKeyDown:e=>{let l=e.shiftKey?40:12;("x"===t&&"ArrowLeft"===e.key||"y"===t&&"ArrowUp"===e.key)&&n(-l),("x"===t&&"ArrowRight"===e.key||"y"===t&&"ArrowDown"===e.key)&&n(l)}})}function tr(e){var t;let{status:l}=e,{t:a}=(0,o.kj)();return(0,s.jsx)("span",{className:"wb-status s-".concat(l),title:a("status.".concat(l)),"aria-label":a("status.".concat(l)),role:"img",children:null!=(t=({done:"✓",failed:"✗",blocked:"⊘","limit-reached":"⏸",aborted:"■",queued:"○",running:"●","waiting-approval":"◐"})[l])?t:"\xb7"})}function tc(e){let{workspace:t,problem:l}=e,{t:a}=(0,o.kj)();return(0,s.jsxs)("div",{className:"wb-welcome",children:[(0,s.jsx)("h2",{children:(null==t?void 0:t.ok)?t.name:a("wb.welcome")}),(0,s.jsx)("p",{className:"muted",children:(null==t?void 0:t.ok)?a("wb.welcomeChat",{dir:t.dir}):a("wb.welcomeWhy")}),l&&(0,s.jsx)("p",{className:"err small",children:l}),(0,s.jsx)(eQ,{}),(0,s.jsx)("p",{className:"muted small",children:a("wb.keys")})]})}function to(){return(0,s.jsx)(tl,{})}},95704:(e,t,l)=>{Promise.resolve().then(l.bind(l,25669))}},e=>{e.O(0,[3134,7921,7500,2347,3131,7358],()=>e(e.s=95704)),_N_E=e.O()}]);
@@ -0,0 +1 @@
1
+ (self.webpackChunk_N_E=self.webpackChunk_N_E||[]).push([[1186],{13134:(s,e,n)=>{"use strict";n.r(e),n.d(e,{default:()=>t});var r=n(73365),l=n(1521),i=n(15549),d=n(8205);function t(){var s;let{t:e}=(0,d.kj)(),[n,t]=(0,l.useState)(null),[c,a]=(0,l.useState)(null),[h,x]=(0,l.useState)("");(0,l.useEffect)(()=>{i.FH.doctor().then(t).catch(s=>x(s.message)),i.FH.settings().then(a).catch(s=>x(s.message))},[]);let j=null==n?void 0:n.profileHeldBy;return(0,r.jsxs)(r.Fragment,{children:[h&&(0,r.jsx)("div",{className:"panel err",children:h}),(0,r.jsxs)("div",{className:"panel",children:[(0,r.jsx)("h2",{children:e("sys.machine")}),!n&&(0,r.jsx)("div",{className:"muted",children:e("sys.loading")}),n&&(0,r.jsx)("table",{children:(0,r.jsxs)("tbody",{children:[(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:e("sys.version")}),(0,r.jsx)("td",{children:String(null!=(s=n.version)?s:"—")})]}),(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:e("sys.node")}),(0,r.jsx)("td",{children:String(n.node)})]}),(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:e("sys.edge")}),(0,r.jsx)("td",{children:n.edge?String(n.edge):(0,r.jsx)("span",{className:"err",children:e("sys.edgeMissing")})})]}),(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:e("sys.profile")}),(0,r.jsxs)("td",{children:[String(n.profileDir)," ",n.profileExists?"":(0,r.jsx)("span",{className:"muted",children:e("sys.profileMissing")})]})]}),(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:e("sys.profileInUse")}),(0,r.jsx)("td",{children:Array.isArray(j)&&j.length>0&&n.botRunning?(0,r.jsx)("span",{className:"muted",children:e("sys.profileBot",{n:j.length})}):Array.isArray(j)&&j.length>0?(0,r.jsx)("span",{className:"err",children:e("sys.profileHeld",{pids:j.join(", ")})}):"unknown"===j?(0,r.jsx)("span",{className:"muted",children:e("sys.profileUnknown")}):e("sys.profileFree")})]}),(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:e("sys.desktop")}),(0,r.jsxs)("td",{children:[String(n.desktop)," ",(0,r.jsx)("span",{className:"muted",children:e(n.desktopSynced?"sys.desktopSynced":"sys.desktopLocal")})]})]}),(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:e("sys.cwd")}),(0,r.jsx)("td",{children:String(n.cwd)})]}),(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:e("sys.runs")}),(0,r.jsx)("td",{children:String(n.runsDir)})]}),(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:e("sys.data")}),(0,r.jsx)("td",{children:String(n.dataDir)})]}),(0,r.jsxs)("tr",{children:[(0,r.jsx)("th",{children:e("sys.mode")}),(0,r.jsx)("td",{children:String(n.mode)})]})]})}),(0,r.jsx)("div",{className:"row",style:{marginTop:10},children:(0,r.jsx)("a",{className:"button-link plain",href:i.FH.terminalUrl(),download:!0,children:e("startfail.terminal")})}),(0,r.jsx)("p",{className:"why",children:e("sys.terminalWhy")})]}),(0,r.jsxs)("div",{className:"panel",children:[(0,r.jsx)("h2",{children:e("sys.settings")}),(0,r.jsx)("p",{className:"muted small",children:e("sys.settingsHint",{file:"data/settings.json",example:"run.example.yaml"})}),c&&(0,r.jsxs)(r.Fragment,{children:[(0,r.jsx)("h3",{children:e("sys.asSaved")}),(0,r.jsx)("pre",{className:"tall",children:JSON.stringify(c.raw,null,2)}),(0,r.jsx)("h3",{children:e("sys.resolved")}),(0,r.jsx)("pre",{children:JSON.stringify(c.resolved,null,2)})]})]}),(0,r.jsxs)("div",{className:"panel",children:[(0,r.jsx)("h2",{children:e("sys.signin")}),(0,r.jsx)("p",{className:"muted small",children:e("sys.signinHint")}),(0,r.jsx)("pre",{children:"npx tsx src/cli.ts login --account you@yourtenant.org"})]})]})}},45323:(s,e,n)=>{Promise.resolve().then(n.bind(n,13134))}},s=>{s.O(0,[7921,2347,3131,7358],()=>s(s.s=45323)),_N_E=s.O()}]);