@capagents/forgeqe 3.3.6 → 3.3.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (109) hide show
  1. package/HOW_TO_USE.md +56 -7
  2. package/dist/docs-site/docs/area-mobile/index.html +33 -7
  3. package/dist/docs-site/docs/area-operations/index.html +41 -7
  4. package/dist/docs-site/docs/area-quality/index.html +15 -2
  5. package/dist/docs-site/docs/area-test-cases/index.html +41 -27
  6. package/dist/docs-site/docs/mobile/index.html +33 -7
  7. package/dist/docs-site/docs/overview/index.html +1 -1
  8. package/dist/docs-site/docs/search.js +1 -1
  9. package/dist/forgeqe.js +3743 -3559
  10. package/dist/web/assets/{3d-force-graph-Dzh7nZHB.js → 3d-force-graph-Bsispdm1.js} +1 -1
  11. package/dist/web/assets/Agent-39FbaH7G.js +10 -0
  12. package/dist/web/assets/{AgentWork-CHC16tCh.js → AgentWork-BugEUl60.js} +1 -1
  13. package/dist/web/assets/ApiTests-B9rtwCbe.js +17 -0
  14. package/dist/web/assets/{Browse-BT4NwFlf.js → Browse-Dl2Lneca.js} +1 -1
  15. package/dist/web/assets/Chat-DocT7FlH.js +3 -0
  16. package/dist/web/assets/{CommandPalette-D2T-HldB.js → CommandPalette-B7YPDCOk.js} +1 -1
  17. package/dist/web/assets/{Compare-CVId7eRu.js → Compare-D6XsFmmb.js} +1 -1
  18. package/dist/web/assets/Cost-DvbuXS6u.js +1 -0
  19. package/dist/web/assets/Data-BmZHJkfj.js +6 -0
  20. package/dist/web/assets/Desktop-DD3F69ih.js +1 -0
  21. package/dist/web/assets/{DesktopReview-CfozOqkA.js → DesktopReview-BR0LtVFw.js} +2 -2
  22. package/dist/web/assets/Evidence-OqAiYzrl.js +1 -0
  23. package/dist/web/assets/Explore-QNyusEFo.js +2 -0
  24. package/dist/web/assets/Features-N3_77mz-.js +1 -0
  25. package/dist/web/assets/Flags-Yv4Ttmmh.js +2 -0
  26. package/dist/web/assets/Flaky-Bg2f2K1U.js +1 -0
  27. package/dist/web/assets/Impact-CpxvVnKj.js +3 -0
  28. package/dist/web/assets/Jobs-_gZTxoaG.js +5 -0
  29. package/dist/web/assets/KindPage-Amr6R7Ym.js +6 -0
  30. package/dist/web/assets/{LiveDevice-DdzQmJat.js → LiveDevice-j7NZXIJZ.js} +1 -1
  31. package/dist/web/assets/Migration-DfPYzTfk.js +8 -0
  32. package/dist/web/assets/Mobile-fIhhQPsp.js +1 -0
  33. package/dist/web/assets/Observability-13DkrRp2.js +1 -0
  34. package/dist/web/assets/{OwnItems-D-GGL7l6.js → OwnItems-BdiPfdTw.js} +3 -3
  35. package/dist/web/assets/PageAgent-CC8Ha6vu.js +1 -0
  36. package/dist/web/assets/Product-CnXkqwQm.js +6 -0
  37. package/dist/web/assets/Production-5mTIt4sr.js +1 -0
  38. package/dist/web/assets/Quality-DbLcbP1X.js +1 -0
  39. package/dist/web/assets/Readiness-BG1xmC09.js +1 -0
  40. package/dist/web/assets/Record-sFth-2I1.js +1 -0
  41. package/dist/web/assets/Regression-Dd4y8I1z.js +5 -0
  42. package/dist/web/assets/{RelationGraph-Icd1HaVO.js → RelationGraph-Blfs7PhK.js} +1 -1
  43. package/dist/web/assets/Reports-HQkTX4Kr.js +2 -0
  44. package/dist/web/assets/Requirements-DmhUNCIP.js +2 -0
  45. package/dist/web/assets/Responsive-D18eYdCh.js +3 -0
  46. package/dist/web/assets/RunDiff-75a-smeg.js +1 -0
  47. package/dist/web/assets/{Settings-COjVzBnC.js → Settings-BaodIliH.js} +15 -15
  48. package/dist/web/assets/{Steps-p2mtjaQd.js → Steps-ZPH_rTJh.js} +1 -1
  49. package/dist/web/assets/TestData-DUlTo5qt.js +2 -0
  50. package/dist/web/assets/TestManagement-DUMGdHDw.js +4 -0
  51. package/dist/web/assets/{WhatsNew-BsUPo-AN.js → WhatsNew-BrVNacPl.js} +1 -1
  52. package/dist/web/assets/{agentSettingsSheet-BYfhgj6t.js → agentSettingsSheet-UCqUtdjq.js} +1 -1
  53. package/dist/web/assets/{api-BUoHbp5V.js → api-D8-lxyQi.js} +1 -1
  54. package/dist/web/assets/{dataParts-DbfDDph_.js → dataParts-C0C67bVQ.js} +3 -3
  55. package/dist/web/assets/{desktopAppPath-CRwtH7Mm.js → desktopAppPath-B89LKvjx.js} +1 -1
  56. package/dist/web/assets/{flowTheme-DM9ULk-2.js → flowTheme-BNKwRxun.js} +1 -1
  57. package/dist/web/assets/frame-C8sL1yo-.js +13 -0
  58. package/dist/web/assets/index-BFG13fbg.js +55 -0
  59. package/dist/web/assets/index-DBnWgocz.css +2 -0
  60. package/dist/web/assets/{markdown-BhteivTy.js → markdown-CxsWgpYs.js} +1 -1
  61. package/dist/web/assets/{nav-DE7YMNUI.js → nav-DYgvAJu-.js} +1 -1
  62. package/dist/web/assets/{pageBack-D89f9SN4.js → pageBack-BefA2rh7.js} +1 -1
  63. package/dist/web/assets/{palette-DLNRH9CW.js → palette-BgJTq_Ot.js} +1 -1
  64. package/dist/web/assets/parts-BNpm4gXC.js +1 -0
  65. package/dist/web/assets/{productParts-CiA1iUMC.js → productParts-ZEi0sPIk.js} +1 -1
  66. package/dist/web/assets/{qualityParts-BSRlONZr.js → qualityParts-DtsD70Qh.js} +1 -1
  67. package/dist/web/assets/{recordTest-DQFAYzce.js → recordTest-Bz5ryzpS.js} +1 -1
  68. package/dist/web/assets/{stepper-DbGnuiC8.js → stepper-CONWT_tv.js} +1 -1
  69. package/dist/web/assets/{wizardParts-D6YJXD6A.js → wizardParts-CulZqqjz.js} +1 -1
  70. package/dist/web/index.html +8 -8
  71. package/docs/MOBILE.md +35 -7
  72. package/docs/user-guide.html +130 -43
  73. package/env.example.yaml +2 -0
  74. package/package.json +1 -1
  75. package/py/forgeqe_mobile/service.py +9 -1
  76. package/dist/web/assets/Agent-TMDBO05H.js +0 -10
  77. package/dist/web/assets/ApiTests-BhmPtlha.js +0 -17
  78. package/dist/web/assets/Chat-5kT-DaOX.js +0 -3
  79. package/dist/web/assets/Cost-BcGPKNts.js +0 -1
  80. package/dist/web/assets/Data-BoZOA_H9.js +0 -6
  81. package/dist/web/assets/Desktop-dYRmoU_-.js +0 -1
  82. package/dist/web/assets/Evidence-BseJLe3S.js +0 -1
  83. package/dist/web/assets/Explore-2g74_R0C.js +0 -2
  84. package/dist/web/assets/Features-DgJqPa-3.js +0 -1
  85. package/dist/web/assets/Flags-C9Vli2I6.js +0 -2
  86. package/dist/web/assets/Flaky-BHoLVcnp.js +0 -1
  87. package/dist/web/assets/Impact-vNOLMC--.js +0 -3
  88. package/dist/web/assets/Jobs-BXJHiDme.js +0 -5
  89. package/dist/web/assets/KindPage-CAlLQ-wX.js +0 -6
  90. package/dist/web/assets/Migration-D1uvBaBZ.js +0 -8
  91. package/dist/web/assets/Mobile-DUW4OwBK.js +0 -1
  92. package/dist/web/assets/Observability-BstgIeKO.js +0 -1
  93. package/dist/web/assets/PageAgent-sAuAp86u.js +0 -1
  94. package/dist/web/assets/Product-BaV0xHXM.js +0 -6
  95. package/dist/web/assets/Production-B2O4o_2w.js +0 -1
  96. package/dist/web/assets/Quality-B-4lwa5s.js +0 -1
  97. package/dist/web/assets/Readiness-DYEhtv3L.js +0 -1
  98. package/dist/web/assets/Record-DJtJ5lHo.js +0 -1
  99. package/dist/web/assets/Regression-Dl74mLPk.js +0 -5
  100. package/dist/web/assets/Reports-BEgu0hEa.js +0 -2
  101. package/dist/web/assets/Requirements-BGrUE42Y.js +0 -2
  102. package/dist/web/assets/Responsive-CE1Mk2v1.js +0 -3
  103. package/dist/web/assets/RunDiff-CL_5y-Qe.js +0 -1
  104. package/dist/web/assets/TestData-B6h_wMZg.js +0 -2
  105. package/dist/web/assets/TestManagement-CmwX5zHH.js +0 -4
  106. package/dist/web/assets/frame-DW-Hx3fC.js +0 -13
  107. package/dist/web/assets/index-CsEmZt6_.js +0 -55
  108. package/dist/web/assets/index-DVlmTifI.css +0 -2
  109. package/dist/web/assets/parts-CuY97ZCG.js +0 -1
@@ -0,0 +1,13 @@
1
+ const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/paletteCommands-Isq1rLs-.js","assets/route-oDy8sV6H.js","assets/rolldown-runtime-XKyaHtl9.js","assets/react-BDur5s0O.js","assets/sectionList-B651VPon.js","assets/line-icons-CwCZidXs.js","assets/coverage-pqIlfEP0.js","assets/logos-P2LOMyTK.js","assets/utils-DJRAScIl.js","assets/jsx-runtime-LKYXHABd.js","assets/CommandPalette-B7YPDCOk.js","assets/preload-helper-BupTYkQW.js","assets/palette-BgJTq_Ot.js","assets/api-D8-lxyQi.js"])))=>i.map(i=>d[i]);
2
+ import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{t}from"./react-BDur5s0O.js";import{r as n}from"./route-oDy8sV6H.js";import{F as r,H as i,L as a,R as o,V as s,c,d as l,l as u,p as d,s as f,t as p}from"./preload-helper-BupTYkQW.js";import{n as m,t as h}from"./utils-DJRAScIl.js";import{t as g}from"./jsx-runtime-LKYXHABd.js";import{F as _,G as v,K as y,L as b,R as x,U as S,a as C,i as w,j as T,n as E,u as D}from"./palette-BgJTq_Ot.js";import{M as O,d as k,f as A,i as j,m as M,t as ee,x as N}from"./sectionList-B651VPon.js";import{$ as te,ft as ne,h as re,mt as ie,rt as ae,s as oe,tt as se,u as P,y as ce}from"./api-D8-lxyQi.js";import{C as le,S as ue,_ as F,a as de,b as I,g as fe,i as pe,l as me,o as he,p as ge,r as _e,v as ve,x as L,y as ye}from"./pageBack-BefA2rh7.js";import{$n as be,$t as xe,A as Se,An as Ce,Ar as we,At as Te,B as Ee,Bn as De,Bt as Oe,C as ke,Cn as Ae,Ct as je,Dn as Me,Dr as Ne,Dt as Pe,E as Fe,En as Ie,Et as Le,Ft as Re,Hn as ze,I as Be,It as Ve,Jn as He,Jt as Ue,K as We,Kt as Ge,Lr as Ke,Mn as qe,N as Je,Nn as Ye,O as Xe,On as Ze,Pn as Qe,Pr as $e,Pt as et,Q as tt,Qt as nt,Rr as rt,Sr as it,St as at,Tt as ot,U as st,V as ct,Vn as lt,Vt as ut,W as dt,Wn as ft,Xn as pt,Xt as mt,Y as ht,Zn as gt,Zt as _t,_r as vt,br as yt,c as bt,d as xt,dr as St,dt as Ct,en as wt,f as Tt,fn as Et,g as Dt,gn as Ot,gt as kt,h as At,hr as jt,i as Mt,in as Nt,ir as Pt,jt as Ft,k as It,kn as Lt,l as Rt,lr as zt,lt as Bt,m as Vt,mn as Ht,mr as Ut,mt as Wt,n as Gt,nn as Kt,nr as qt,o as Jt,on as Yt,pr as Xt,q as Zt,qn as Qt,r as $t,s as en,sn as tn,t as nn,tr as rn,tt as an,u as on,ur as sn,v as cn,vr as ln,vt as un,w as dn,wn as fn,x as pn,xr as mn,xt as hn,y as gn,yn as _n,yr as vn,z as yn}from"./line-icons-CwCZidXs.js";import{a as bn,c as xn,d as Sn,f as Cn,l as wn,n as Tn,o as En,s as Dn,t as On}from"./nav-DYgvAJu-.js";var R=e(t(),1),z=g();function kn({open:e,onClose:t,title:n,description:r,children:i,footer:a,wide:o,bare:s}){let c=(0,R.useRef)(null),l=(0,R.useId)(),u=(0,R.useRef)({title:n,description:r,children:i,footer:a});e&&(u.current={title:n,description:r,children:i,footer:a});let[d,f]=(0,R.useState)(!1),p=e?{title:n,description:r,children:i,footer:a}:u.current;return(0,R.useEffect)(()=>{let t=c.current;if(!t)return;if(e){t.classList.remove(`is-closing`),f(!1),t.open||t.showModal();return}if(!t.open)return;if(window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches)return t.close();t.classList.add(`is-closing`),f(!0);let n=setTimeout(()=>{t.classList.remove(`is-closing`),f(!1),t.close()},150);return()=>clearTimeout(n)},[e]),(0,z.jsxs)(`dialog`,{ref:c,"aria-labelledby":s?void 0:l,"aria-label":s?n:void 0,onCancel:e=>{e.target===c.current&&(e.preventDefault(),t())},onClick:e=>{e.target===c.current&&t()},className:h(y,`sheet bg-canvas backdrop-blur-none fixed inset-y-0 right-0 left-auto m-0 h-[calc(100dvh/var(--ui-zoom))] max-h-none w-full rounded-r-none border-0 p-0 backdrop:bg-[rgba(15,23,42,0.2)]`,o?`max-w-[760px]`:`max-w-[480px]`),children:[(e||d)&&s&&(0,z.jsx)(`div`,{className:`h-full`,children:p.children}),(e||d)&&!s&&(0,z.jsxs)(`div`,{className:`flex h-full flex-col`,children:[(0,z.jsxs)(`div`,{className:`flex items-start gap-4 px-6 pt-6 pb-4`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,z.jsx)(`h2`,{id:l,className:`m-0 text-headline-sm`,children:p.title}),p.description&&(0,z.jsx)(`p`,{className:`m-0 text-body-sm leading-relaxed text-muted`,children:p.description})]}),(0,z.jsx)(L,{variant:`icon`,size:`icon`,"aria-label":`Close`,"data-tip":`Close`,onClick:t,className:`-mt-1 -mr-2`,children:(0,z.jsx)(rt,{size:20,"aria-hidden":`true`})})]}),(0,z.jsx)(`div`,{className:`sheet-body flex-1 overflow-y-auto px-6 pb-6`,children:p.children}),(0,z.jsx)(`div`,{className:`flex flex-wrap justify-end gap-2 px-6 py-4`,children:p.footer})]})]})}var An=new Map,jn=!1,Mn=()=>typeof document>`u`?null:document,Nn=()=>Mn()?.visibilityState===`hidden`;function Pn(){if(!Nn())for(let e of[...An.values()])e()}function Fn(e,t){let n=setInterval(()=>{Nn()||e()},t);An.set(n,e);let r=Mn();return r&&!jn&&(r.addEventListener(`visibilitychange`,Pn),jn=!0),n}function In(e){if(e==null)return;clearInterval(e),An.delete(e);let t=Mn();t&&jn&&An.size===0&&(t.removeEventListener(`visibilitychange`,Pn),jn=!1)}function Ln({open:e,id:t,className:n,children:r}){let[i,a]=(0,R.useState)(e),[o,s]=(0,R.useState)(e),[c,l]=(0,R.useState)(e);return(0,R.useEffect)(()=>{if(e){a(!0);let e=0,t=requestAnimationFrame(()=>{e=requestAnimationFrame(()=>s(!0))});return()=>{cancelAnimationFrame(t),cancelAnimationFrame(e)}}s(!1),l(!1);let t=setTimeout(()=>a(!1),320);return()=>clearTimeout(t)},[e]),i?(0,z.jsx)(`div`,{id:t,inert:!e||void 0,className:h(`collapse-box`,o&&`is-open`),onTransitionEnd:t=>{t.target===t.currentTarget&&t.propertyName===`grid-template-rows`&&(e?l(!0):a(!1))},children:(0,z.jsx)(`div`,{className:h(`min-h-0 min-w-0`,c?`overflow-visible`:`overflow-hidden`),children:(0,z.jsx)(`div`,{className:n,children:r})})}):null}var Rn=null,zn=e=>void(Rn=e),Bn=/password|secret|token|api.?key|\bkey\b|credential|\bprod(uction)?\b|\bprd\b|\blive\b/i,Vn=1e3,Hn=60,Un=e=>e.replace(/[\u0000-\u001f\u007f\u2028\u2029]+/g,` `).replace(/\s+/g,` `).trim();function Wn(e){let t=new Set,n=[];for(let r of e){let e=Un(r.label).slice(0,Hn);if(!e||r.kind===`link`&&!/^#\/[^\s]*$/.test(r.href??``))continue;let i=`${r.kind} ${e.toLowerCase()}`;if(t.has(i)||(t.add(i),(r.kind===`setting`||r.kind===`field`||r.kind===`button`)&&Bn.test(e)))continue;let a=r.value===void 0?void 0:Un(r.value).slice(0,Hn);if(n.push({ref:`c${n.length+1}`,kind:r.kind,label:e,...a===void 0?{}:{value:a},from:r}),n.length>=120)break}return n}var Gn=e=>e.map(e=>`${e.ref} ${e.kind}: ${e.label}${e.value===void 0?``:` (now: ${e.value||`empty`})`}`).join(`
3
+ `);function Kn(e){let t;try{t=JSON.parse(e)}catch{return null}if(!t||typeof t!=`object`||Array.isArray(t))return null;let n=t;if(typeof n.ref!=`string`||!/^c\d{1,3}$/.test(n.ref)||typeof n.label!=`string`)return null;let r=typeof n.text==`string`?Un(n.text).slice(0,Vn):``;return{ref:n.ref,label:Un(n.label),text:r}}function qn(e,t){let n=e.find(e=>e.ref===t.ref);return!n||n.label.toLowerCase()!==t.label.toLowerCase()?`The page changed since it was read: read it again.`:(n.kind===`search`||n.kind===`field`)&&!t.text?`Say what to type into “${n.label}”.`:n.kind===`setting`&&!t.text?`Say what to set “${n.label}” to.`:n.kind!==`search`&&n.kind!==`setting`&&n.kind!==`field`&&t.text?`“${n.label}” takes a click, not text.`:n}var Jn=()=>/^#\/settings(?:\/|$)/.test(location.hash)&&!/^#\/settings\/secrets/.test(location.hash);function Yn(e){let t=e.id?document.querySelector(`label[for="${CSS.escape(e.id)}"]`):null,n=e.getAttribute(`aria-labelledby`)?.split(/\s+/).map(e=>document.getElementById(e)?.innerText||``).join(` `);return e.getAttribute(`aria-label`)||t?.innerText||n||e.closest(`label`)?.innerText||``}function Xn(e){return e instanceof HTMLInputElement&&e.type===`checkbox`?e.checked?`on`:`off`:e.getAttribute(`role`)===`switch`?e.getAttribute(`aria-checked`)===`true`?`on`:`off`:e instanceof HTMLSelectElement?e.selectedOptions[0]?.text||``:e.value??``}function Zn(){let e=[],t=e=>e.offsetParent!==null&&!e.closest(`[aria-label="Talk"]`)&&!e.closest(`[inert]`),n=e=>e.getAttribute(`aria-label`)||e.innerText||e.getAttribute(`placeholder`)||e.getAttribute(`title`)||``,r=Jn();for(let i of document.querySelectorAll(`a[href^="#/"], [role="tab"], [role="radiogroup"] [role="radio"], input, textarea, select, [role="switch"], button, [role="button"]`)){if(!t(i))continue;let a=i.disabled||i.readOnly||i.getAttribute(`aria-disabled`)===`true`;if(!i.closest(`dialog[open], [role='dialog'], [role='alertdialog']`)||i.matches(`button, [role='button']`)&&/^(cancel|close|no|back|not now)$/i.test(Un(n(i)))){if(i instanceof HTMLTextAreaElement)a||e.push({kind:r?`setting`:`field`,label:Yn(i)||i.placeholder||`Text`,value:r?Xn(i):void 0,el:i});else if(i.matches(`button, [role='button']`)&&!i.matches(`[role='tab'], [role='radio'], [role='switch']`))a||e.push({kind:`button`,label:n(i),el:i});else if(!(i instanceof HTMLInputElement&&[`hidden`,`password`,`file`,`submit`,`button`,`image`,`reset`].includes(i.type))){if(i instanceof HTMLInputElement&&i.type!==`checkbox`&&i.type!==`radio`){let t=`${i.getAttribute(`aria-label`)||``} ${i.placeholder||``} ${i.type}`;if(a)continue;/search|filter|find/i.test(t)?e.push({kind:`search`,label:i.getAttribute(`aria-label`)||i.placeholder||`Search`,el:i}):r?e.push({kind:`setting`,label:Yn(i),value:Xn(i),el:i}):e.push({kind:`field`,label:Yn(i)||i.placeholder||`Text`,el:i})}else i instanceof HTMLSelectElement||i.getAttribute(`role`)===`switch`||i instanceof HTMLInputElement&&i.type===`checkbox`?r&&!a&&e.push({kind:`setting`,label:Yn(i)||n(i),value:Xn(i),el:i}):i.matches(`a`)?e.push({kind:`link`,label:n(i),href:i.getAttribute(`href`)||``,el:i}):i instanceof HTMLInputElement||e.push({kind:i.getAttribute(`role`)===`tab`?`tab`:`option`,label:n(i),el:i})}}}return e}var Qn=()=>Wn(Zn());function $n(e){let t=Qn(),n=((document.querySelector(`[data-screen]`)??document.body).innerText||``).replace(/[ \t]+/g,` `).replace(/\n{3,}/g,`
4
+
5
+ `).trim(),r=Gn(t);return`${r?`Controls (page_act takes a ref and its label):\n${r}\n\n`:``}Page text:\n${n}`.slice(0,e)}function er(e,t){if(e instanceof HTMLInputElement&&e.type===`checkbox`){let n=tr(t);return n===null?`Say on or off.`:(e.checked!==n&&e.click(),null)}if(e.getAttribute(`role`)===`switch`){let n=tr(t);return n===null?`Say on or off.`:(e.getAttribute(`aria-checked`)===`true`!==n&&e.click(),null)}if(e instanceof HTMLSelectElement){let n=[...e.options].find(e=>e.text.trim().toLowerCase()===t.toLowerCase()||e.value.toLowerCase()===t.toLowerCase());return n?(e.value=n.value,e.dispatchEvent(new Event(`change`,{bubbles:!0})),null):`It is one of: ${[...e.options].map(e=>e.text.trim()).filter(Boolean).slice(0,8).join(`, `)}.`}let n=e;return Object.getOwnPropertyDescriptor(e instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype,`value`)?.set?.call(n,t),n.dispatchEvent(new Event(`input`,{bubbles:!0})),n.dispatchEvent(new Event(`change`,{bubbles:!0})),null}var tr=e=>/^(on|yes|true|enabled?|shown?)$/i.test(e)?!0:!/^(off|no|false|disabled?|hidden)$/i.test(e)&&null;async function nr(e){let t=Kn(e);if(!t)return`That is not a control of this page.`;let n=qn(Qn(),t);if(typeof n==`string`)return n;let r=n.from.el;if(n.kind===`setting`||n.kind===`option`&&Jn()){let e=n.kind===`setting`?t.text:n.label;return Rn?await Rn(n.kind===`setting`?`Change ${n.label} to ${e}?`:`Switch to ${e}?`)?n.kind===`option`?(r.click(),`Switched to ${e}. Settings saves it.`):er(r,t.text)??`Changed ${n.label} to ${t.text}. Settings saves it.`:`Not changed: the person did not say yes.`:`Changing a setting needs Talk on: ask the person to change it on the page.`}if(n.kind===`button`)return Rn?await Rn(`Press ${n.label}?`)?(r.click(),`Pressed ${n.label}.`):`Not pressed: the person did not say yes.`:`Pressing a button needs Talk on: ask the person to press it.`;if(n.kind===`field`){let e=r instanceof HTMLTextAreaElement?HTMLTextAreaElement.prototype:HTMLInputElement.prototype;return Object.getOwnPropertyDescriptor(e,`value`)?.set?.call(r,t.text),r.dispatchEvent(new Event(`input`,{bubbles:!0})),r.focus(),`Typed into ${n.label}.`}return n.kind===`search`&&r instanceof HTMLInputElement?(Object.getOwnPropertyDescriptor(HTMLInputElement.prototype,`value`)?.set?.call(r,t.text),r.dispatchEvent(new Event(`input`,{bubbles:!0})),r.focus(),`Typed “${t.text}” into ${n.label}.`):(r.click(),n.kind===`link`?`Opened ${n.label}.`:`Picked ${n.label}.`)}var rr=[`open`,`open_run`,`open_chat`,`search`,`back`,`new_chat`,`set`,`read`,`act`],ir={theme:[`light`,`dark`,`system`],sidebar:[`open`,`closed`],browser:[`shown`,`hidden`],talk:[`off`]},ar=8e3,or=/^(?:latest|last|newest|most recent)?$/i,sr=/^[A-Za-z0-9_-]{1,80}$/,cr=e=>e.replace(/[\u0000-\u001f\u007f]+/g,` `).trim().slice(0,1200);function lr(e){if(!e||typeof e!=`object`)return null;let t=e;if(typeof t.id!=`string`||!sr.test(t.id)||!rr.includes(t.action))return null;let n=typeof t.what==`string`?cr(t.what):void 0;return{id:t.id,action:t.action,...n?{what:n}:{}}}function ur(e,t){let n=e=>{let t=e.toLowerCase().replace(/[^a-z]/g,``).replace(/c(?=[eiy])/g,`s`).replace(/c/g,`k`).replace(/ph/g,`f`).replace(/sh/g,`s`);return((/^[aeiou]/.test(t)?`a`:``)+t.replace(/[aeiouyhw]/g,``)).replace(/(.)\1+/g,`$1`)},r=t.replace(/^(the|a|an|my)\s+|\s+(page|section|settings?)$/gi,``).toLowerCase().replace(/[^a-z]/g,``),i=n(r);if(i.length<2)return[];let a=e.filter(e=>e.kind!==`field`).map(e=>{let t=e.label.toLowerCase().replace(/[^a-z]/g,``),a=dr(i,n(t))/Math.max(i.length,n(t).length);return{label:e.label,sound:a,d:a+.5*Math.abs(r.length-t.length)/Math.max(r.length,t.length)}}).filter(e=>e.sound<=.5).sort((e,t)=>e.d-t.d);return[...new Set(a.map(e=>e.label))].slice(0,3)}function dr(e,t){let n=Array.from({length:t.length+1},(e,t)=>t);for(let r=1;r<=e.length;r++){let i=n[0];n[0]=r;for(let a=1;a<=t.length;a++){let o=n[a];n[a]=Math.min(n[a]+1,n[a-1]+1,i+(e[r-1]===t[a-1]?0:1)),i=o}}return n[t.length]}var fr=e=>e.toLowerCase().replace(/[^\p{L}\p{N}]+/gu,``);function pr(e,t){let n=fr(t),r=n.length>=4?e.filter(e=>e.kind!==`field`&&fr(e.label)===n):[];return r.length===1?r[0]:void 0}var mr=/^(?:settings\s*[›>:/-]\s*(.+)|(?:the\s+)?(.+?)\s+settings?)$/i;async function hr(e,t){let r=(e.what||``).trim();switch(e.action){case`open`:{let e=await t.commands(),n=mr.exec(r),i=n?(n[1]||n[2]||``).trim():``,a=r?i&&E(e.filter(e=>e.kind===`setting`),i.toLowerCase())||E(e,r.toLowerCase())||pr(e,r):void 0;if(!a){let t=ur(e,r);return`Nothing in ForgeQE is called “${r}”.${t.length?` The nearest: ${t.join(`, `)}.`:``}`}return t.go(a.href)===!1?`${a.label} is already open.`:`Opened ${a.label}.`}case`open_run`:{let e=await t.runs(),i=or.test(r)?e[0]:e.find(e=>e.name===r)??e.find(e=>e.title.toLowerCase()===r.toLowerCase());return i?(t.go(n(`runs`,encodeURIComponent(i.name))),`Opened the run “${i.title||i.name}”.`):e.length?`No run is called “${r}”.`:`There are no runs yet.`}case`open_chat`:{let e=await t.chats(),i=or.test(r)?e.find(e=>e.id!==t.current):e.find(e=>e.id===r)??e.find(e=>e.title.toLowerCase()===r.toLowerCase());return i?(t.go(n(`chats`,i.id)),`Opened the chat “${i.title}”.`):`No chat is called “${r}”.`}case`search`:return r?(t.find(r),`Searching for “${r}”.`):`Nothing to search for.`;case`back`:return t.back(),`Went back.`;case`new_chat`:return t.go(n()),`Opened a new chat.`;case`set`:{let[e,n,...i]=r.split(` `),a=e&&Object.hasOwn(ir,e)?ir[e]:void 0;return!a||!n||i.length||!a.includes(n)?`That cannot be changed from here.`:t.set?await t.set(e,n):`That cannot be changed from here.`}case`read`:return(t.screen?.(ar)??``).slice(0,ar);case`act`:return t.actOn?await t.actOn(r):`That cannot be done from here.`}}var gr=new Set;function _r(e,t){gr.has(e.id)||(gr.add(e.id),t(e))}function vr(e,t,n,r){let i=(0,R.useRef)(null);(0,R.useEffect)(()=>{if(n&&e){if(i.current!==e){i.current=e;for(let e of t)gr.add(e.id)}else for(let e of t)gr.has(e.id)||(gr.add(e.id),r(e))}},[e,t.length,n])}var yr=(0,R.createContext)(null);function br({pages:e,find:t,set:n,children:r}){let i=(0,R.useRef)(null),a=(0,R.useCallback)(r=>({commands:()=>i.current??=p(()=>import(`./paletteCommands-Isq1rLs-.js`).then(t=>t.everyCommand(e)),__vite__mapDeps([0,1,2,3,4,5,6])),runs:async()=>(await te.list()).runs.map(e=>({name:e.name,title:e.title})),chats:async()=>(await ce.list()).chats.map(e=>({id:e.id,title:e.title})),find:t,go:e=>location.hash.replace(/^#/,``)===e.replace(/^#/,``)?(window.dispatchEvent(new HashChangeEvent(`hashchange`)),!1):(location.hash=e,!0),back:()=>history.back(),...r?{current:r}:{},...n?{set:(e,t)=>n(e,t,r)}:{},screen:$n,actOn:nr}),[e,t,n]),o=(0,R.useCallback)(async(e,t)=>{let n=await hr(e,a(t)).catch(e=>`That did not work: ${e.message}`);return t&&/^act_[a-f0-9]{16}$/.test(e.id)&&await ce.screen(t,e.id,n).catch(()=>{}),n},[a]),s=(0,R.useMemo)(()=>({act:o}),[o]);return(0,z.jsx)(yr.Provider,{value:s,children:r})}function xr(){let e=(0,R.useContext)(yr);return e?e.act:async()=>``}var Sr=16e3;function Cr(e,t){if(!e.length||!(t>0))return new Int16Array;let n=t/Sr,r=Math.floor(e.length/n),i=new Int16Array(r);for(let t=0;t<r;t++){let r=Math.floor(t*n),a=Math.max(r+1,Math.floor((t+1)*n)),o=0;for(let t=r;t<a;t++)o+=e[t]??0;let s=Math.max(-1,Math.min(1,o/(a-r)));i[t]=Math.round(s<0?s*32768:s*32767)}return i}function wr(e){let t;try{t=atob(e)}catch{return new Float32Array}let n=Math.floor(t.length/2),r=new Float32Array(n);for(let e=0;e<n;e++){let n=t.charCodeAt(2*e)|t.charCodeAt(2*e+1)<<8;n>=32768&&(n-=65536),r[e]=n/32768}return r}var Tr=(0,R.createContext)(null);function Er(){let e=(0,R.useContext)(Tr);if(!e)throw Error(`useTalk outside TalkProvider`);return e}var Dr=e=>{try{return localStorage.getItem(e)}catch{return null}},Or=(e,t)=>{try{localStorage.setItem(e,t)}catch{}},kr=()=>{let e=Dr(`forgeqe.voice.eagerness`);return e===`eager`||e===`patient`?e:`normal`},Ar=e=>Or(`forgeqe.voice.eagerness`,e),jr=null;function Mr(e=!1){return(e||!jr)&&(jr=ne.status()),jr.catch(()=>jr=null),jr}var Nr=()=>/^#\/chats\/([a-f0-9]{18})(?:[/?]|$)/.exec(location.hash)?.[1]??null,Pr=320;function Fr({children:e}){let[t,n]=(0,R.useState)(`off`),[r,i]=(0,R.useState)(null),[a,o]=(0,R.useState)(!1),[s,c]=(0,R.useState)(``),[l,u]=(0,R.useState)(null),d=xr(),f=(0,R.useRef)(null),m=(0,R.useRef)(null),h=(0,R.useRef)(null),g=(0,R.useRef)(null),_=(0,R.useRef)([]),v=(0,R.useRef)(0),y=(0,R.useRef)(0),b=(0,R.useRef)(new Int16Array),x=(0,R.useRef)({hearing:!1,thinking:!1,speaking:!1}),S=(0,R.useRef)(null),C=(0,R.useRef)(0),w=(0,R.useRef)(new Map),T=(0,R.useCallback)(()=>{let e=x.current;n(e.hearing?`hearing`:e.speaking?`speaking`:e.thinking?`thinking`:`listening`)},[]),E=(0,R.useCallback)(e=>{y.current=e;let t=m.current,n=h.current;if(!t||!n)return;let r=t.currentTime;n.gain.cancelScheduledValues(r),n.gain.setValueAtTime(n.gain.value,r),n.gain.linearRampToValueAtTime(0,r+.08);let i=_.current;_.current=[],v.current=0,setTimeout(()=>{for(let e of i)try{e.stop()}catch{}n.gain.setValueAtTime(1,t.currentTime)},90),x.current.speaking=!1,T()},[T]),D=(0,R.useCallback)((e,t,n)=>{let r=m.current,i=h.current;if(!r||!i||e<y.current)return;let a=wr(n);if(!a.length||!(t>=8e3&&t<=48e3))return;let o=r.createBuffer(1,a.length,t);o.copyToChannel(a,0);let s=r.createBufferSource();s.buffer=o,s.connect(i),v.current=Math.max(v.current,r.currentTime+.04),s.start(v.current),v.current+=o.duration,_.current.push(s),s.onended=()=>{_.current=_.current.filter(e=>e!==s),_.current.length||(x.current.speaking=!1,T())},x.current.speaking=!0,T()},[T]),O=(0,R.useCallback)(e=>{let t;try{t=JSON.parse(e)}catch{return}let n=e=>typeof e==`string`?e:``;switch(t.type){case`audio`:typeof t.gen==`number`&&typeof t.rate==`number`&&D(t.gen,t.rate,n(t.pcm));break;case`interrupt`:typeof t.gen==`number`&&E(t.gen);break;case`chat`:{if(t.id===null){S.current=null,i(null),u(null);break}let e=n(t.id);if(!/^[a-f0-9]{18}$/.test(e))break;S.current=e,i(e);break}case`caption`:{let e=n(t.text).slice(0,300);t.who===`you`?u({who:`you`,text:e}):u(t=>({who:`atlas`,text:t?.who===`atlas`?`${t.text} ${e}`.slice(-300):e}));break}case`state`:for(let e of[`hearing`,`thinking`,`speaking`])typeof t[e]==`boolean`&&(x.current[e]=t[e]);typeof t.thinking==`boolean`&&o(t.thinking),T();break;case`app_action`:{let e=lr(t);e&&(C.current=Date.now(),_r(e,e=>d(e,S.current??void 0)));break}case`confirmed`:{let e=w.current.get(n(t.id));w.current.delete(n(t.id)),e?.(t.yes===!0);break}case`error`:c(n(t.message).slice(0,300))}},[d,E,D,T]),k=()=>{zn(null);for(let e of w.current.values())e(!1);w.current.clear();try{f.current?.close()}catch{}f.current=null,g.current?.getTracks().forEach(e=>e.stop()),g.current=null,m.current?.close().catch(()=>{}),m.current=null,h.current=null,_.current=[],v.current=0,b.current=new Int16Array},A=(0,R.useCallback)(()=>{k(),x.current={hearing:!1,thinking:!1,speaking:!1},S.current=null,i(null),u(null),n(`off`),o(!1)},[]),j=(0,R.useCallback)(async()=>{if(!f.current){c(``),n(`connecting`);try{if(!(await Mr()).ready)throw Error(`Speech is not set up on this computer yet: Settings › Voice.`);ne.warm().catch(()=>{});let e=new AudioContext;m.current=e;let t=e.createGain();t.connect(e.destination),h.current=t;let r=await navigator.mediaDevices.getUserMedia({audio:{echoCancellation:!0,noiseSuppression:!0,autoGainControl:!0,channelCount:1}});g.current=r;let{default:a}=await p(async()=>{let{default:e}=await import(`./capture.worklet-C65DyLpl.js`);return{default:e}},[]);await e.audioWorklet.addModule(a);let o=new AudioWorkletNode(e,`forgeqe-capture`);e.createMediaStreamSource(r).connect(o),o.port.onmessage=t=>{let n=Cr(t.data,e.sampleRate),r=new Int16Array(b.current.length+n.length);r.set(b.current),r.set(n,b.current.length);let i=0;for(;r.length-i>=Pr;i+=Pr)f.current?.readyState===WebSocket.OPEN&&f.current.send(r.slice(i,i+Pr).buffer);b.current=r.slice(i)},S.current=Nr(),i(S.current);let{ticket:s}=await ne.ticket(S.current,kr()),c=new WebSocket(`${location.protocol===`https:`?`wss`:`ws`}://${location.host}/api/voice/session?ticket=${s}`);c.binaryType=`arraybuffer`,c.onmessage=e=>typeof e.data==`string`&&O(e.data),c.onopen=()=>{x.current={hearing:!1,thinking:!1,speaking:!1},n(`listening`),zn(e=>new Promise(t=>{if(c.readyState!==WebSocket.OPEN)return t(!1);let n=Math.random().toString(36).slice(2,12);w.current.set(n,t),setTimeout(()=>w.current.get(n)===t&&(w.current.delete(n),t(!1)),35e3),c.send(JSON.stringify({type:`confirm`,id:n,text:e.slice(0,200)}))}))},c.onclose=()=>{f.current===c&&(k(),n(`off`))},f.current=c}catch(e){k(),n(`off`),c(e.name===`NotAllowedError`?`The browser was not allowed to use the microphone: allow it in the address bar, then try again.`:e.message)}}},[O]);(0,R.useEffect)(()=>()=>k(),[]),(0,R.useEffect)(()=>{let e=()=>{let e=()=>_.current.length?setTimeout(e,300):A();setTimeout(e,1500)};return window.addEventListener(`forgeqe:talk-off`,e),()=>window.removeEventListener(`forgeqe:talk-off`,e)},[A]),(0,R.useEffect)(()=>{if(t===`off`)return;let e=()=>{if(Date.now()-C.current<3e3)return;let e=Nr(),t=location.hash===``||location.hash===`#`||location.hash===`#/`;(e||t)&&(e??null)!==S.current&&f.current?.readyState===WebSocket.OPEN&&f.current.send(JSON.stringify({type:`page`,chat:e}))};return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[t]);let M=(0,R.useMemo)(()=>({phase:t,chat:r,working:a,error:s,line:l,start:()=>void j(),end:A,dismiss:()=>c(``)}),[t,r,a,s,l,j,A]);return(0,z.jsx)(Tr.Provider,{value:M,children:e})}function Ir({chat:e,disabled:t}){let n=Er(),[r,i]=(0,R.useState)(null);(0,R.useEffect)(()=>{Mr().then(e=>i(e.ready)).catch(()=>i(!1))},[]);let a=Br(n,e),o=r===!1;return(0,z.jsx)(L,{variant:`icon`,size:`icon`,className:h(`flex-none`,a&&`bg-accent-soft text-accent-fg`),"aria-label":`Talk`,"aria-pressed":a,disabled:o||t&&!a,"data-tip":o?`Talk needs a one-time setup: Settings › Voice`:a?`End the talk`:`Talk to Atlas: speech stays on this computer`,onClick:()=>{if(a)return n.end();n.phase!==`off`&&n.end(),n.start()},children:(0,z.jsx)(bt,{"aria-hidden":`true`})})}function Lr({chat:e}){let t=Er(),n=Br(t,e);if(!n&&!t.error)return null;let r=n&&t.phase!==`thinking`;return(0,z.jsxs)(`div`,{"aria-live":`polite`,className:`-mt-1 mb-4 flex flex-col gap-2 border-b border-line-soft pb-4 text-body-sm`,children:[(0,z.jsxs)(`div`,{className:`flex min-h-7 flex-wrap items-center gap-x-2 gap-y-1`,children:[r?(0,z.jsx)(ye,{state:Hr[t.phase],px:18}):(0,z.jsx)(bt,{size:16,"aria-hidden":`true`,className:`text-muted`}),(0,z.jsx)(`span`,{className:`font-medium`,children:n?Vr[t.phase]:`Talk stopped`}),n&&(0,z.jsx)(`span`,{className:`text-muted`,children:`Talk over Atlas any time; it stops and listens.`}),(0,z.jsx)(`span`,{className:`flex-auto`}),n?(0,z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:t.end,children:`End`}):(0,z.jsx)(L,{variant:`icon`,size:`icon-xs`,type:`button`,"aria-label":`Close the note`,"data-tip":`Close the note`,onClick:t.dismiss,children:(0,z.jsx)(rt,{size:14,"aria-hidden":`true`})})]}),t.error&&(0,z.jsx)(`p`,{className:h(le.fail,`m-0`),children:t.error})]})}function Rr({rail:e=!1}){let t=Er(),n=t.phase!==`off`,r=()=>n?t.end():t.start();return e?(0,z.jsx)(L,{variant:`icon`,size:`icon`,"aria-label":`Talk`,"aria-pressed":n,"data-tip":`Talk to Atlas`,"data-tip-side":`left`,onClick:r,className:h(`size-9`,n&&`bg-accent-soft text-accent-fg`),children:(0,z.jsx)(bt,{strokeWidth:1.8,"aria-hidden":`true`})}):(0,z.jsxs)(L,{size:`sm`,"aria-pressed":n,onClick:r,className:`w-full justify-start px-2`,children:[(0,z.jsx)(bt,{strokeWidth:1.8,"aria-hidden":`true`}),(0,z.jsx)(`span`,{className:`flex-1 text-left`,children:`Talk`})]})}function zr(){let e=Er(),[t,r]=(0,R.useState)(location.hash);(0,R.useEffect)(()=>{let e=()=>r(location.hash);return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[]);let i=t===``||t===`#`||t===`#/`;return e.phase===`off`||(e.chat?Nr()===e.chat:i)?null:(0,z.jsxs)(`div`,{role:`region`,"aria-label":`Talk`,"aria-live":`polite`,className:h(y,`fixed right-4 bottom-4 z-30 flex max-w-[min(560px,calc(100vw-32px))] items-center gap-2 text-body-sm`),children:[e.phase===`thinking`?(0,z.jsx)(bt,{size:16,"aria-hidden":`true`,className:`flex-none text-muted`}):(0,z.jsx)(ye,{state:Hr[e.phase],px:18}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.line?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:`text-muted`,children:e.line.who===`you`?`You: `:`Atlas: `}),e.line.text]}):(0,z.jsx)(`span`,{className:`font-medium`,children:Vr[e.phase]})}),e.chat&&(0,z.jsx)(`a`,{href:n(`chats`,e.chat),className:h(ue({variant:`ghost`,size:`sm`}),`no-underline`),children:`Open the chat`}),(0,z.jsx)(L,{variant:`ghost`,size:`sm`,type:`button`,onClick:e.end,children:`End`})]})}var Br=(e,t)=>e.phase!==`off`&&(e.chat??null)===t,Vr={off:`Talk stopped`,connecting:`Starting Talk…`,listening:`Listening. Just talk.`,hearing:`Hearing you…`,thinking:`Listening while Atlas works.`,speaking:`Speaking.`},Hr={off:`idle`,connecting:`waiting`,listening:`waiting`,hearing:`recording`,thinking:`thinking`,speaking:`writing`},Ur={pass:`bg-pass-soft text-pass shadow-none`,warn:`bg-warn-soft text-warn shadow-none`,fail:`bg-fail-soft text-fail shadow-none`,info:`bg-accent-soft text-accent-fg shadow-none`},Wr={md:`size-9`,lg:`size-10`,xl:`size-14`},Gr={md:18,lg:20,xl:28},Kr={md:20,lg:24,xl:32},qr={md:`size-[18px]`,lg:`size-5`,xl:`size-7`};function Jr({icon:e,logo:t,pixel:n,tone:r,size:i=`md`,className:a}){return(0,z.jsx)(`span`,{"aria-hidden":`true`,"data-icon-tile":``,className:h(`inline-flex flex-none items-center justify-center rounded-base`,l,r&&Ur[r],Wr[i],a),children:n?(0,z.jsx)(d,{name:n,px:Kr[i]}):t?(0,z.jsx)(t,{className:qr[i]}):e?(0,z.jsx)(I,{icon:e,size:Gr[i]}):null})}var Yr=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{};function Xr(e,t){let n=e;for(let e of t)n=Yr(n)[e];return n}var Zr=e=>e===void 0||e===``||typeof e==`number`&&Number.isNaN(e);function Qr(e,t,n){let[r,...i]=t;if(r===void 0)return e;let a={...e},o=i.length?Qr(Yr(e[r]),i,n):n;return Zr(o)||i.length&&Zr(n)&&!Object.keys(Yr(o)).length?delete a[r]:a[r]=o,a}function $r(e,t,n){let r={};for(let[i,a]of Object.entries(e))r[i===t?n:i]=a;return r}function ei(e,t){if(!(t in e))return t;for(let n=2;;n++)if(!(`${t}-${n}`in e))return`${t}-${n}`}var ti=(e,t)=>JSON.stringify(e)===JSON.stringify(t);function ni({checked:e,onChange:t,label:n,id:r,disabled:i}){return(0,z.jsx)(`button`,{type:`button`,role:`switch`,id:r,"aria-checked":e,"aria-label":n,disabled:i,onClick:()=>t(!e),className:h(`relative h-5 w-9 flex-none cursor-pointer rounded-full border-0 p-0 transition-colors disabled:cursor-not-allowed disabled:opacity-50`,e?`bg-accent`:`bg-line`),children:(0,z.jsx)(`span`,{"aria-hidden":`true`,className:h(`absolute top-1/2 size-4 -translate-y-1/2 rounded-full bg-white shadow-[0_1px_2px_var(--shadow-float-ink)] left-0.5 transition-transform`,e&&`translate-x-4`)})})}function ri(e){return{label:`All agents`,href:n(`agents`)}}var ii=`orchestrator`;function ai(e){return e.page?A(e.page)??j.find(e=>e.id===`orchestrator`):j.find(t=>t.agent!==`forgeqe`&&e.title.startsWith(`${M(t.agent).name}: `))??j.find(e=>e.id===`orchestrator`)}var oi=(e,t)=>t.filter(t=>ai(t)?.id===e.id);function si(e,t){if(e[0]!==`chats`||!e[1]||!t)return e;let n=ai(t);return n&&n.agent!==`forgeqe`?[`agents`,n.id]:e}function ci(e){let t=e[0]===`chats`?e[1]:void 0,[n,r]=(0,R.useState)(null);return(0,R.useEffect)(()=>{if(!t)return;let e=!1;return ce.events(t,2**53-1,!1).then(n=>!e&&r({id:t,title:n.title,...n.page?{page:n.page}:{}}),()=>{}),()=>{e=!0}},[t]),si(e,n&&n.id===t?n:null)}var li=`rounded-base border border-line bg-bg shadow-none in-[.rounded-lg.bg-bg]:shadow-none`,ui=`px-4 py-2 text-left text-label-md font-medium whitespace-nowrap text-muted`,di=`px-4 py-2 text-right text-label-md font-medium whitespace-nowrap text-muted`,fi=`h-12 border-t border-line-soft align-middle transition-colors duration-150 data-[state=selected]:bg-tint-hover`,pi=`h-12 cursor-pointer border-t border-line-soft align-middle transition-colors duration-150 hover:bg-tint data-[state=selected]:bg-tint-hover`,mi=`px-4 py-2`,hi=`px-4 py-2 text-right whitespace-nowrap tabular-nums`,gi=`w-full max-w-0 px-4 py-2`,_i=`block truncate font-medium text-ink`,vi=`block truncate text-body-sm text-muted`,yi=new Set([`className`,`style`,`key`,`ref`,`id`,`role`,`type`,`colSpan`,`rowSpan`,`scope`,`data-tip-side`]);function bi(e,t=0){if(e==null||typeof e==`boolean`||typeof e==`function`||t>12)return``;if(typeof e==`string`||typeof e==`number`)return String(e);if(Array.isArray(e))return e.map(e=>bi(e,t+1)).join(` `);if((0,R.isValidElement)(e))return bi(e.props,t+1);if(typeof e==`object`){let n=[];for(let[r,i]of Object.entries(e))yi.has(r)||r.startsWith(`on`)||r.startsWith(`aria-`)||n.push(bi(i,t+1));return n.join(` `)}return``}function xi(e){return R.Children.toArray((0,R.isValidElement)(e)&&e.type===R.Fragment?e.props.children:e)}function Si(e,t=0){if(e==null||typeof e==`boolean`||t>12)return``;if(typeof e==`string`||typeof e==`number`)return String(e);if(Array.isArray(e))return e.map(e=>Si(e,t+1)).join(` `);if(!(0,R.isValidElement)(e))return``;let n=e.props;return typeof n.className==`string`&&/(^|\s)sr-only(\s|$)/.test(n.className)||n.onCheckedChange!==void 0?``:Si(n.children,t+1)}function Ci(e){return(0,R.isValidElement)(e)?e.type===`tr`?e:e.type===R.Fragment?R.Children.toArray(e.props.children).find(e=>(0,R.isValidElement)(e)&&e.type===`tr`)??null:null:null}var wi=/^[-+]?(?:\d{1,3}(?:,\d{3})+|\d+)?(?:\.\d+)?\s*(?:%|ms|s|m|h|d|x|kb|mb|gb)?$/i;function Ti(e){if(!(0,R.isValidElement)(e))return``;let t=e.props,n=t[`data-sort`];if(typeof n==`number`)return n;if(typeof n==`string`)return wi.test(n.trim())&&/\d/.test(n)?parseFloat(n.replace(/,/g,``)):n.toLowerCase();let r=t[`data-tip`];if(typeof r==`string`&&/\d{1,4}[/.-]\d{1,2}[/.-]\d{1,4}/.test(r)){let e=Date.parse(r);if(Number.isFinite(e))return e}let i=Si(t.children).replace(/\s+/g,` `).trim();return i&&/\d/.test(i)&&wi.test(i)?parseFloat(i.replace(/,/g,``)):i.toLowerCase()}function Ei(e,t,n){if(!t.size||!(0,R.isValidElement)(e))return e;let r=e=>{let r=R.Children.toArray(e.props.children);return r.length===n?(0,R.cloneElement)(e,void 0,r.filter((e,n)=>!t.has(n))):e};return e.type===`tr`?r(e):e.type===R.Fragment?(0,R.cloneElement)(e,void 0,R.Children.toArray(e.props.children).map(e=>(0,R.isValidElement)(e)&&e.type===`tr`?r(e):e)):e}function Di(e){if(!(0,R.isValidElement)(e))return e;if(e.type===`tr`)return(0,R.cloneElement)(e,{"data-row":``});if(e.type===R.Fragment){let t=!1;return(0,R.cloneElement)(e,void 0,R.Children.toArray(e.props.children).map(e=>t||!(0,R.isValidElement)(e)||e.type!==`tr`?e:(t=!0,(0,R.cloneElement)(e,{"data-row":``}))))}return e}function Oi({on:e,dir:t,num:n,onClick:r,children:i}){let a=e&&t===`asc`?en:Mt;return(0,z.jsxs)(`button`,{type:`button`,onClick:r,className:h(`group -mx-2 inline-flex cursor-pointer items-center gap-1 rounded-sm border-0 bg-transparent px-2 py-1 font-medium transition-colors duration-150 hover:text-ink focus-visible:outline-2 focus-visible:outline-accent`,e?`text-ink`:`text-muted`,n&&`flex-row-reverse`),children:[i,e?(0,z.jsx)(a,{size:12,"aria-hidden":`true`,className:`flex-none`}):(0,z.jsx)(Se,{size:12,"aria-hidden":`true`,className:`flex-none opacity-0 transition-opacity duration-150 group-hover:opacity-100 group-focus-visible:opacity-100`})]})}function ki({label:e,head:t,children:n,empty:i=`None.`,size:a=25,resetKey:o,fixed:s=!1,minWidth:c,className:l,search:d=!0,sortable:f=!0,columns:p=!0,placeholder:m,tools:g,end:_,selection:v,height:y,count:b=!0,framed:x=!1}){let S=R.Children.toArray(n),[C,w]=(0,R.useState)(``),T=C.toLowerCase().split(/\s+/).filter(Boolean),E=(0,R.useMemo)(()=>d?S.map(e=>bi(e).toLowerCase()):[],[n,d]),D=T.length?S.filter((e,t)=>T.every(e=>E[t].includes(e))):S,O=xi(t),k=O.map(e=>(0,R.isValidElement)(e)&&e.type===`th`?Si(e.props.children).replace(/\s+/g,` `).trim():``),A=(0,R.useMemo)(()=>S.every(e=>Ci(e)?R.Children.toArray(Ci(e).props.children).length===O.length:!1),[n,O.length]),[j,M]=(0,R.useState)(null),ee=f&&A&&S.length>1,N=(0,R.useMemo)(()=>{if(!ee||!j||!k[j.col])return D;let e=j.dir===`asc`?1:-1;return D.map(e=>({r:e,v:Ti(R.Children.toArray(Ci(e).props.children)[j.col])})).toSorted((t,n)=>(typeof t.v==`number`&&typeof n.v==`number`?t.v-n.v:String(t.v).localeCompare(String(n.v),void 0,{numeric:!0,sensitivity:`base`}))*e).map(e=>e.r)},[D,j,ee]),te=e=>{if(j?.col===e)return M({col:e,dir:j.dir===`asc`?`desc`:`asc`});let t=D.length?Ti(R.Children.toArray(Ci(D[0]).props.children)[e]):``;M({col:e,dir:typeof t==`number`?`desc`:`asc`})},ne=k.flatMap((e,t)=>e?[t]:[]),re=p&&A?ne.slice(1):[],[ie,ae]=(0,R.useState)([]),oe=new Set(ie.map(Number).filter(e=>re.includes(e))),se=O.map((e,t)=>{if(!ee||!k[t]||!(0,R.isValidElement)(e)||e.type!==`th`)return e;let n=e,r=j?.col===t,i=/(^|\s)text-right(\s|$)/.test(n.props.className??``);return(0,R.cloneElement)(n,{"aria-sort":r?j.dir===`asc`?`ascending`:`descending`:`none`},(0,z.jsx)(Oi,{on:r,dir:j?.dir??`asc`,num:i,onClick:()=>te(t),children:n.props.children}))}).filter((e,t)=>!oe.has(t)),P=re.length>=2?(0,z.jsx)(Pi,{columns:re.map(e=>({id:String(e),label:k[e]})),hidden:ie,onChange:ae}):null,[ce,le]=(0,R.useState)(0);(0,R.useEffect)(()=>le(0),[o,C,j]);let ue=(0,R.useRef)(null),[F,de]=(0,R.useState)(null),I=(0,R.useRef)(0),fe=()=>{let e=ue.current;if(!y||!e)return;let t=e.querySelector(`thead`)?.offsetHeight??0,n=e.querySelectorAll(`tbody > tr[data-row]`);for(let t of n.length?n:e.querySelectorAll(`tbody > tr`))I.current=Math.max(I.current,t.offsetHeight);I.current&&de(Math.max(1,Math.min(a,Math.floor((e.clientHeight-t)/I.current))))};(0,R.useEffect)(()=>{let e=ue.current;if(!y||!e||typeof ResizeObserver>`u`)return;let t=e.clientWidth,n=new ResizeObserver(()=>{e.clientWidth!==t&&(I.current=0),t=e.clientWidth,fe()});return n.observe(e),()=>n.disconnect()},[y,a]);let pe=y?F??a:a,me=Math.max(1,Math.ceil(N.length/pe)),he=Math.min(ce,me-1),_e=N.slice(he*pe,he*pe+pe).map(e=>Di(Ei(e,oe,O.length)));(0,R.useEffect)(fe,[he,pe,N,ie]);let[ve,ye]=(0,R.useState)(!1);(0,R.useEffect)(()=>{let e=ue.current;if(!e||typeof ResizeObserver>`u`)return;let t=()=>ye(e.scrollWidth>e.clientWidth+1),n=new ResizeObserver(t);return n.observe(e),e.firstElementChild&&n.observe(e.firstElementChild),t(),()=>n.disconnect()},[y]);let be=O.length-oe.size,xe=_||P?(0,z.jsxs)(z.Fragment,{children:[P,_]}):null;return(0,z.jsxs)(`div`,{className:h(u,`@container overflow-hidden p-0 in-[.rounded-lg.bg-bg]:shadow-none in-[.panel]:shadow-none`,x&&li,l),children:[(d||g||xe)&&(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 px-4 pt-4 pb-2`,children:[d&&(0,z.jsxs)(`label`,{className:`relative flex min-w-0 w-full max-w-[320px] flex-[0_1_320px] items-center`,children:[(0,z.jsx)(He,{size:14,"aria-hidden":`true`,className:`pointer-events-none absolute left-2.5 text-muted`}),(0,z.jsxs)(`span`,{className:`sr-only`,children:[`Find in `,e.toLowerCase()]}),(0,z.jsx)(r,{size:`sm`,type:`search`,value:C,spellCheck:!1,placeholder:m??`Find in ${e.toLowerCase()}`,onChange:e=>w(e.target.value),className:`pl-8`})]}),g,T.length>0&&(0,z.jsxs)(`span`,{className:`text-body-sm whitespace-nowrap text-muted`,role:`status`,children:[N.length,` of `,S.length]}),xe&&(0,z.jsx)(`div`,{className:`ml-auto flex flex-wrap items-center gap-2`,children:xe})]}),!!v?.count&&(0,z.jsxs)(`div`,{role:`region`,"aria-label":`Selected ${e.toLowerCase()}`,className:`flex flex-wrap items-center justify-between gap-2 border-b border-line-soft bg-surface-muted px-4 py-2`,children:[(0,z.jsxs)(`span`,{className:`flex items-center gap-2`,children:[(0,z.jsxs)(`span`,{className:`text-body-sm font-medium text-ink tabular-nums`,role:`status`,children:[v.count,` selected`]}),(0,z.jsx)(L,{size:`sm`,variant:`ghost`,onClick:v.onClear,children:`Clear`})]}),v.actions&&(0,z.jsx)(`span`,{className:`flex flex-wrap items-center gap-2`,children:v.actions})]}),(0,z.jsx)(`div`,{ref:ue,...ve?{tabIndex:0,role:`region`,"aria-label":`${e}, scrolls`}:{},className:h(`relative overflow-x-auto focus-visible:outline-offset-[-2px]`,y&&`overflow-y-hidden`),style:y?{height:y}:void 0,children:(0,z.jsxs)(`table`,{"aria-label":e,className:h(`w-full border-collapse text-body-sm text-ink-2`,s&&`table-fixed`),style:c?{minWidth:c}:void 0,children:[(0,z.jsx)(`thead`,{children:(0,z.jsx)(`tr`,{className:`h-10 text-left align-middle text-muted`,children:se})}),(0,z.jsxs)(`tbody`,{children:[_e,!N.length&&(0,z.jsx)(`tr`,{children:(0,z.jsx)(`td`,{colSpan:Math.max(1,be),className:`px-4 py-4 text-center text-muted`,children:T.length&&S.length?`Nothing matches.`:i})})]})]})}),N.length>0&&(b||N.length>pe)&&(0,z.jsx)(ge,{page:he,size:pe,total:N.length,onPage:le,label:`Pages of ${e.toLowerCase()}`})]})}var Ai=`max(320px, calc(var(--screen) - 288px))`;function ji(e,t,n=`asc`){return e.key===t?{key:t,dir:e.dir===`asc`?`desc`:`asc`}:{key:t,dir:n}}function Mi(e,t,n){let r=n[t.key],i=t.dir===`asc`?1:-1;return e.toSorted((e,t)=>{let n=r(e),a=r(t);return(typeof n==`number`&&typeof a==`number`?n-a:String(n).localeCompare(String(a),void 0,{sensitivity:`base`,numeric:!0}))*i})}function Ni({col:e,sort:t,onSort:n,first:r=`asc`,num:i=!1,className:a,children:o}){let s=t.key===e;return(0,z.jsx)(`th`,{scope:`col`,"aria-sort":s?t.dir===`asc`?`ascending`:`descending`:`none`,className:h(i?di:ui,a),children:(0,z.jsx)(Oi,{on:s,dir:t.dir,num:i,onClick:()=>n(ji(t,e,r)),children:o})})}function Pi({columns:e,hidden:t,onChange:n}){let[r,i]=(0,R.useState)(!1);return(0,z.jsxs)(`span`,{className:`relative inline-block`,children:[(0,z.jsxs)(L,{size:`sm`,variant:`ghost`,"aria-haspopup":`menu`,"aria-expanded":r,onClick:()=>i(!r),children:[(0,z.jsx)(Zt,{"aria-hidden":`true`}),`Columns`,(0,z.jsx)(Fe,{"aria-hidden":`true`})]}),(0,z.jsx)(S,{open:r,onClose:()=>i(!1),label:`Columns to show`,align:`end`,className:`min-w-[200px]`,children:e.map(e=>{let r=!t.includes(e.id);return(0,z.jsx)(v,{role:`menuitemcheckbox`,checked:r,onSelect:()=>n(r?[...t,e.id]:t.filter(t=>t!==e.id)),children:(0,z.jsx)(`span`,{className:`flex-1`,children:e.label})},e.id)})})]})}function Fi({children:e,className:t}){return(0,z.jsx)(`kbd`,{className:h(f,`inline-flex min-h-5 items-center rounded-full px-2 font-sans text-label-sm text-ink-2 shadow-[inset_0_-1px_0_var(--shadow-float-ink)]`,t),children:e})}var Ii={x:0,y:0,w:0,h:0,on:!1},Li=(e,t)=>e.on===t.on&&e.x===t.x&&e.y===t.y&&e.w===t.w&&e.h===t.h;function Ri(e,t){if(!t||!t.isConnected||t.closest(`[inert]`)||!t.offsetHeight)return Ii;let n=0,r=0,i=t;for(;i&&i!==e;)n+=i.offsetLeft,r+=i.offsetTop,i=i.offsetParent;return i===e?{x:n,y:r,w:t.offsetWidth,h:t.offsetHeight,on:!0}:Ii}function zi(e,t,n){let[r,i]=(0,R.useState)(Ii),a=(0,R.useCallback)(()=>{let n=e.current;if(!n)return;let r=Ri(n,n.querySelector(t));i(e=>Li(e,r)?e:r)},[e,t]);return(0,R.useLayoutEffect)(a,[n,a]),(0,R.useLayoutEffect)(()=>{let t=e.current;if(!t||typeof ResizeObserver>`u`)return;let n=new ResizeObserver(a);n.observe(t);for(let e of Array.from(t.children))n.observe(e);return()=>n.disconnect()},[a]),r}var Bi=new Map,Vi=1500;function Hi({pill:e,className:t,memory:n,children:r}){let[i,a]=(0,R.useState)(()=>{let e=n?Bi.get(n):void 0;return e&&Date.now()-e.at<Vi?e.pill:void 0});(0,R.useEffect)(()=>{n&&e.on&&Bi.set(n,{pill:e,at:Date.now()})},[n,e]),(0,R.useEffect)(()=>{if(!i||!e.on)return;let t=0,n=requestAnimationFrame(()=>{t=requestAnimationFrame(()=>a(void 0))});return()=>{cancelAnimationFrame(n),cancelAnimationFrame(t)}},[i,e.on]);let o=i&&e.on?i:e,s=(0,R.useRef)(!1),c=s.current;return o.on&&(s.current=!0),(0,z.jsx)(`span`,{"aria-hidden":`true`,className:h(`pointer-events-none absolute top-0 left-0 z-0 motion-reduce:transition-none`,c&&`transition-[transform,width,height,opacity] duration-(--motion) ease-out`,t),style:{transform:`translate(${o.x}px, ${o.y}px)`,width:o.w,height:o.h,opacity:+!!o.on},children:r})}var Ui=`flex w-fit max-w-full flex-wrap gap-1 rounded-full bg-surface-strong p-1`,Wi=e=>h(`inline-flex min-h-8 cursor-pointer items-center gap-2 rounded-full border-0 px-4 text-body-sm font-medium whitespace-nowrap`,e?`bg-bg text-ink shadow-sm`:`bg-transparent text-muted hover:text-ink`),Gi=`rounded-full bg-bg shadow-sm`,Ki=(e,t)=>h(Wi(e),`relative z-10 transition-colors duration-(--motion-fast)`,e&&t&&`bg-transparent shadow-none`);function qi({icon:e}){return typeof e==`object`&&e&&`pixel`in e?(0,z.jsx)(d,{name:e.pixel,px:18,className:`flex-none`}):(0,z.jsx)(I,{icon:e,size:16,className:`flex-none`})}function Ji(e,t,n,r,i){let a=n===`ArrowRight`?e[(t+1)%e.length]:n===`ArrowLeft`?e[(t-1+e.length)%e.length]:void 0;return a?(i(a.id),document.getElementById(`${r}-${a.id}`)?.focus(),!0):!1}function Yi({tabs:e,current:t,onPick:n,hrefOf:r,label:i,className:a,prefix:o=`tab`}){let s=o===`tab`?c:`${o}-panel`,l=(0,R.useRef)(null),u=zi(l,`[aria-selected="true"], [aria-current="page"]`,t);(0,R.useEffect)(()=>{let e=l.current?.querySelector(`[aria-selected="true"], [aria-current="page"]`),t=l.current;if(!e||!t)return;let n=e.offsetLeft-t.offsetLeft;n<t.scrollLeft?t.scrollLeft=n:n+e.offsetWidth>t.scrollLeft+t.clientWidth&&(t.scrollLeft=n+e.offsetWidth-t.clientWidth)},[t]);let d=h(`relative mb-6`,Ui,`flex-nowrap overflow-x-auto [scrollbar-width:thin]`,a),f=e=>(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(qi,{icon:e.icon}),e.label,e.n!==void 0&&e.n!==null&&(0,z.jsx)(`span`,{className:h(`text-body-sm font-normal tabular-nums`,e.tone||`text-muted`),children:e.n})]}),p=e=>h(Ki(t===e.id,u.on),`flex-none focus-visible:outline-offset-[-2px]`,e.mono&&`font-mono text-body-sm font-normal`);return r?(0,z.jsxs)(`nav`,{ref:l,"aria-label":i,className:d,children:[(0,z.jsx)(Hi,{pill:u,className:Gi,memory:`tabs:${i}`}),e.map(e=>(0,z.jsx)(`a`,{id:`${o}-${e.id}`,href:r(e.id),"aria-current":t===e.id?`page`:void 0,className:h(p(e),`no-underline hover:no-underline`,t===e.id&&`hover:text-ink`),children:f(e)},e.id))]}):(0,z.jsxs)(`div`,{ref:l,role:`tablist`,"aria-label":i,className:d,children:[(0,z.jsx)(Hi,{pill:u,className:Gi}),e.map((r,i)=>(0,z.jsx)(`button`,{id:`${o}-${r.id}`,type:`button`,role:`tab`,"aria-selected":t===r.id,"aria-controls":`${s}-${r.id}`,tabIndex:t===r.id?0:-1,onClick:()=>n?.(r.id),onKeyDown:t=>{n&&Ji(e,i,t.key,o,n)&&t.preventDefault()},className:p(r),children:f(r)},r.id))]})}function Xi({tabs:e,current:t,onPick:n,label:r,className:i,prefix:a=`tab`}){let o=a===`tab`?c:`${a}-panel`,s=(0,R.useRef)(null),l=zi(s,`[aria-selected="true"]`,t);return(0,z.jsxs)(`div`,{ref:s,role:`tablist`,"aria-label":r,className:h(`relative mb-6 flex flex-wrap gap-x-6 border-b border-line-soft`,i),children:[(0,z.jsx)(Hi,{pill:l,className:`border-b-2 border-ink`}),e.map((r,i)=>(0,z.jsxs)(`button`,{id:`${a}-${r.id}`,type:`button`,role:`tab`,"aria-selected":t===r.id,"aria-controls":`${o}-${r.id}`,tabIndex:t===r.id?0:-1,onClick:()=>n(r.id),onKeyDown:t=>{Ji(e,i,t.key,a,n)&&t.preventDefault()},className:h(`relative z-10 -mb-px inline-flex min-h-11 cursor-pointer items-center gap-2 border-0 border-b-2 bg-transparent px-1 text-body-sm font-medium transition-colors duration-(--motion-fast)`,r.mono&&`font-mono text-body-sm font-normal`,t===r.id?h(`text-ink`,l.on?`border-transparent`:`border-ink`):`border-transparent text-muted hover:text-ink`),children:[r.label,r.n!==void 0&&r.n!==null&&(0,z.jsx)(`span`,{className:h(`text-body-sm font-normal tabular-nums`,r.tone||`text-muted`),children:r.n})]},r.id))]})}function Zi({links:e,current:t,label:n,className:r}){let i=(0,R.useRef)(null),a=zi(i,`[aria-current="page"]`,t);return(0,z.jsxs)(`nav`,{ref:i,"aria-label":n,className:h(`relative`,Ui,r),children:[(0,z.jsx)(Hi,{pill:a,className:Gi,memory:`links:${n}`}),e.map(e=>(0,z.jsxs)(`a`,{href:e.href,"aria-current":t===e.id?`page`:void 0,className:h(Ki(t===e.id,a.on),`no-underline hover:no-underline`,t===e.id&&`hover:text-ink`),children:[(0,z.jsx)(qi,{icon:e.icon}),e.label]},e.id))]})}function Qi({options:e,value:t,onChange:n,label:r,labelledBy:i,disabled:a=!1,className:o}){let s=e.filter(e=>!e.disabled&&!a),c=(0,R.useRef)(null),l=zi(c,`[aria-checked="true"]`,t),u=(e,t)=>{let a=s.findIndex(t=>t.id===e),o=s[(a+t+s.length)%s.length];o&&(n(o.id),document.querySelector(`[data-choice="${CSS.escape(o.id)}"][data-group="${CSS.escape(r||i||``)}"]`)?.focus())};return(0,z.jsxs)(`span`,{ref:c,role:`radiogroup`,"aria-label":r,"aria-labelledby":i,className:h(`relative`,Ui,o),children:[(0,z.jsx)(Hi,{pill:l,className:Gi}),e.map(e=>{let o=a||!!e.disabled;return(0,z.jsxs)(`button`,{type:`button`,role:`radio`,"data-choice":e.id,"data-group":r||i||``,"aria-checked":t===e.id,"aria-disabled":o||void 0,tabIndex:t===e.id?0:-1,"data-tip":e.tip,onClick:()=>!o&&n(e.id),onKeyDown:t=>{(t.key===`ArrowRight`||t.key===`ArrowLeft`)&&(t.preventDefault(),u(e.id,t.key===`ArrowRight`?1:-1))},className:h(Ki(t===e.id,l.on),o&&`cursor-not-allowed opacity-50`),children:[e.icon,e.label,e.n!==void 0&&e.n!==null&&(0,z.jsx)(`span`,{className:h(`text-body-sm font-normal tabular-nums`,e.tone||`text-muted`),children:e.n})]},e.id)})]})}var $i={good:`pass`,bad:`fail`,same:`neutral`},ea={good:`text-pass`,bad:`text-fail`,same:`text-muted`};function ta(e){return e.dir===`same`||e.good===void 0?`same`:e.good?`good`:`bad`}function na({children:e,label:t,className:n}){return(0,z.jsx)(`section`,{"aria-label":t,className:h(u,`grid grid-cols-[repeat(auto-fit,minmax(min(100%,150px),1fr))] overflow-hidden p-0`,n),children:e})}function B({label:e,value:t,note:n,icon:r,period:i,change:a,tone:o,big:s,compact:c,className:l}){let u=a&&ta(a),d=a?.dir===`up`?mn:a?.dir===`down`?yt:void 0;return(0,z.jsxs)(`div`,{className:h(`-mr-px -mb-px flex min-w-0 flex-col border-r border-b border-line-soft`,c?`gap-1 px-4 py-2`:`gap-1 px-6 py-4`,l),children:[(0,z.jsxs)(`span`,{className:h(`flex min-w-0 items-center gap-2 font-medium text-ink`,`text-body-sm`),children:[r&&(0,z.jsx)(I,{icon:r,size:14,className:`flex-none text-muted`}),(0,z.jsx)(`span`,{className:`min-w-0`,children:e})]}),i&&(0,z.jsx)(`span`,{className:`text-body-sm text-muted`,children:i}),(0,z.jsxs)(`span`,{className:h(`flex flex-wrap items-center gap-x-2 gap-y-1`,c?`mt-0`:i?`mt-2`:`mt-1`),children:[(0,z.jsx)(`span`,{className:h(`tabular-nums`,s?`text-headline-md`:c?`text-headline-sm`:`text-headline-md`,o),children:t}),a&&u&&(0,z.jsx)(`span`,{"aria-hidden":a.against?!0:void 0,className:`inline-flex`,children:(0,z.jsxs)(fe,{tone:$i[u],icon:!1,className:`tabular-nums`,children:[d&&(0,z.jsx)(d,{size:12,strokeWidth:2.5,"aria-hidden":`true`,className:`flex-none`}),a.text]})})]}),(n||a?.against)&&(0,z.jsx)(`span`,{className:h(`text-muted tabular-nums`,c?`truncate text-body-sm`:`text-body-sm`),children:a?.against&&u?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:ea[u],children:a.amount??a.text}),` `,a.against,n?(0,z.jsxs)(z.Fragment,{children:[` · `,n]}):null]}):n})]})}var ra={line:16,inset:24},ia={line:8,inset:16},aa=(0,R.createContext)(null),oa=`relative z-10 flex h-8 short:h-7 w-full min-w-0 items-center gap-2 rounded-sm px-2 text-body-sm no-underline outline-none select-none focus-visible:ring-2 focus-visible:ring-accent`;function sa({offsets:e,width:t,className:n,style:r}){if(!e.length)return null;let i=e[e.length-1],a=i+1;return(0,z.jsxs)(`svg`,{"aria-hidden":`true`,width:t,height:a,viewBox:`0 0 ${t} ${a}`,fill:`none`,style:r,className:h(`pointer-events-none absolute top-0 z-0 text-line-strong`,n),children:[(0,z.jsx)(`path`,{d:`M0.5 0 V${i-5}`,stroke:`currentColor`,strokeWidth:`1`}),e.map((e,n)=>(0,z.jsx)(`path`,{d:`M0.5 ${e-5} Q0.5 ${e} 5.5 ${e} H${t-.5}`,stroke:`currentColor`,strokeWidth:`1`},n))]})}function ca({lines:e,label:t,className:n,children:r}){let i=(0,R.useRef)(null),[a,o]=(0,R.useState)([]),s=R.Children.count(r),c=(0,R.useCallback)(()=>{let t=i.current;if(!t||!e)return;let n=Array.from(t.children).filter(e=>e.tagName.toLowerCase()!==`svg`&&!e.hasAttribute(`data-tree-group`)).map(e=>{let n=e.matches(`[data-tree-row]`)?e:e.querySelector(`[data-tree-row]`);if(!n)return 0;let r=0,i=n;for(;i&&i!==t;)r+=i.offsetTop,i=i.offsetParent;return i===t?Math.round(r+n.offsetHeight/2):0}).filter(e=>e>0);o(e=>e.join()===n.join()?e:n)},[e]);return(0,R.useLayoutEffect)(()=>{if(c(),!i.current||typeof ResizeObserver>`u`)return;let e=new ResizeObserver(c);return e.observe(i.current),()=>e.disconnect()},[s,c]),(0,z.jsxs)(`div`,{ref:i,role:`group`,"aria-label":t,className:h(`relative flex flex-col gap-px`,n),style:e?{paddingLeft:e.inset}:void 0,children:[e&&(0,z.jsx)(sa,{offsets:a,width:e.inset-e.line,style:{left:e.line}}),r]})}function la(){let e=(0,R.useContext)(aa);return{onPointerEnter:t=>t.pointerType===`mouse`&&e?.hover(t.currentTarget),onFocus:t=>t.currentTarget.matches(`:focus-visible`)&&e?.hover(t.currentTarget)}}function ua({href:e,label:t,current:n,icon:r,badge:i,after:a,tip:o,className:s}){let c=la(),l=(0,z.jsxs)(`a`,{href:e,"data-tree-row":``,"aria-current":n?`page`:void 0,"data-tip":o,"data-tip-side":o?`right`:void 0,...c,className:h(oa,n?`font-medium text-(--side-current-ink) hover:text-(--side-current-ink)`:`text-ink-2 hover:text-ink`,a&&`pr-8`,s),children:[r??(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`size-[18px] flex-none`}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:t}),i]});return a?(0,z.jsxs)(`div`,{className:`group relative`,children:[l,a]}):l}function da(e,t,n){let[r,i]=(0,R.useState)(t),a=e??r;return[a,()=>{e===void 0&&i(!a),n?.(!a)}]}function fa({href:e,label:t}){return(0,z.jsx)(`a`,{href:e,"aria-label":t,"data-tip":t,"data-tip-side":`right`,className:h(ue({variant:`icon`,size:`icon-xs`}),`absolute top-1/2 right-[30px] z-20 -translate-y-1/2 bg-surface-strong opacity-0 transition-opacity group-hover:opacity-100 focus-visible:opacity-100 focus-visible:ring-2 focus-visible:ring-accent`),children:(0,z.jsx)(Jt,{size:14,strokeWidth:2,"aria-hidden":`true`})})}function pa({label:e,href:t,current:n,className:r,children:i}){let a=(0,R.useId)(),o=`flex h-7 short:h-6 items-center rounded-sm px-2 text-body-sm font-medium text-muted no-underline`;return(0,z.jsxs)(`div`,{"data-tree-group":``,role:`group`,"aria-labelledby":a,className:h(`flex flex-col gap-px`,r),children:[t?(0,z.jsx)(`a`,{id:a,href:t,"aria-current":n?`page`:void 0,className:h(o,`hover:text-ink`,n&&`text-(--side-current-ink)`),children:e}):(0,z.jsx)(`span`,{id:a,className:o,children:e}),i]})}function ma({label:e,icon:t,badge:n,href:r,hrefLabel:i,current:a,open:o,defaultOpen:s=!1,onOpenChange:c,children:l,className:u}){let[d,f]=da(o,s,c),p=(0,R.useId)(),m=la();return(0,z.jsxs)(`div`,{className:h(`flex flex-col gap-px`,u),children:[(0,z.jsxs)(`div`,{className:`group relative`,children:[(0,z.jsxs)(`button`,{type:`button`,"data-tree-row":``,"aria-expanded":d,"aria-controls":p,"aria-current":a?`page`:void 0,onClick:f,...m,className:h(oa,`cursor-pointer text-left`,a?`font-medium text-(--side-current-ink)`:`text-ink-2 hover:text-ink`),children:[t,(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),n,(0,z.jsx)(Xe,{size:14,strokeWidth:2,"aria-hidden":`true`,className:h(`flex-none text-muted transition-transform group-hover:text-ink motion-reduce:transition-none`,d&&`rotate-90`)})]}),r&&(0,z.jsx)(fa,{href:r,label:i||`Open ${e}`})]}),(0,z.jsx)(Ln,{open:d,id:p,children:(0,z.jsx)(ca,{lines:ia,label:e,children:l})})]})}function ha({label:e,icon:t,href:n,hrefLabel:r,current:i,lines:a,open:o,defaultOpen:s=!0,onOpenChange:c,children:l,className:u}){let[d,f]=da(o,s,c),p=(0,R.useId)(),m=la();return(0,z.jsxs)(`div`,{className:h(`flex flex-col gap-px`,u),children:[(0,z.jsxs)(`div`,{className:`group relative`,children:[(0,z.jsxs)(`button`,{type:`button`,"data-tree-row":``,"aria-expanded":d,"aria-controls":p,"aria-current":i?`page`:void 0,onClick:f,...m,className:h(oa,`cursor-pointer text-left font-medium`,i?`text-(--side-current-ink)`:t?`text-ink`:`text-muted hover:text-ink`),children:[t,(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e}),(0,z.jsx)(Fe,{size:14,strokeWidth:2,"aria-hidden":`true`,className:h(`flex-none text-muted transition-transform group-hover:text-ink motion-reduce:transition-none`,!d&&`-rotate-90`)})]}),n&&(0,z.jsx)(fa,{href:n,label:r||`Open ${e}`})]}),(0,z.jsx)(Ln,{open:d,id:p,children:(0,z.jsx)(ca,{lines:a,label:e,children:l})})]})}function ga({routeKey:e,className:t,children:n}){let r=(0,R.useRef)(null),i=(0,R.useRef)(null),[a,o]=(0,R.useState)([]),[s,c]=(0,R.useState)(Ii),l=(0,R.useCallback)(()=>{let e=r.current;if(!e)return;let t=[...e.querySelectorAll(`[data-tree-row][aria-current="page"]`)].map(t=>Ri(e,t)).filter(e=>e.on);o(e=>e.length===t.length&&e.every((e,n)=>Li(e,t[n]))?e:t);let n=i.current?.getAttribute(`aria-current`)===`page`?Ii:Ri(e,i.current);c(e=>Li(e,n)?e:n)},[]);(0,R.useLayoutEffect)(l,[e,l]),(0,R.useLayoutEffect)(()=>{let e=r.current;if(!e||typeof ResizeObserver>`u`)return;let t=new ResizeObserver(l);t.observe(e);let n=new MutationObserver(l);return n.observe(e,{subtree:!0,attributes:!0,attributeFilter:[`aria-current`,`inert`],childList:!0}),()=>{t.disconnect(),n.disconnect()}},[l]);let u=(0,R.useRef)({hover:e=>{i.current=e,l()}}).current;return(0,z.jsx)(aa.Provider,{value:u,children:(0,z.jsxs)(`div`,{ref:r,onPointerLeave:()=>u.hover(null),onBlur:e=>{e.currentTarget.contains(e.relatedTarget)||u.hover(null)},className:h(`relative flex w-full flex-col gap-px`,t),children:[(0,z.jsx)(Hi,{pill:s,className:`rounded-sm bg-surface-strong/60`}),a.map((e,t)=>(0,z.jsx)(Hi,{pill:e,className:`rounded-sm bg-(--side-current-bg)`},t)),n]})})}var _a=`flex h-8 short:h-7 items-center gap-2 rounded-full px-4 text-body-sm no-underline`,va=e=>e?`bg-(--side-current-bg) font-medium text-(--side-current-ink) hover:text-(--side-current-ink)`:`text-ink-2 hover:bg-tint hover:text-ink`,ya=e=>e.id===`agents`?{href:n(`agents`),label:e.label}:{label:e.label},ba=/^[A-Za-z0-9][\w.-]{0,120}$/;function xa(e){let[t,r,i,a]=e;if(t===`responsive`&&r===`runs`&&i)return{middle:{href:n(`responsive`,`runs`),label:`Runs`},here:`Run`};if(t===`product`&&r===`services`&&i)return{middle:{href:n(`product`,`architecture`,`services`),label:`Services`},here:`Service`};if(t===`agents`&&r===`custom`&&i&&i!==`new`)return{parent:{href:n(`agents`),label:`Agents`},middle:{href:n(`agents`,`category`,`custom`),label:`Custom agents`},here:`Custom agent`};if(t===`agents`&&r===`teams`&&i)return{parent:{href:n(`agents`),label:`Agents`},middle:{href:n(`agents`,`category`,`custom`),label:`Custom agents`},here:i===`new`?`New team`:`Team`};if(t===`test-management`&&r===`cases`&&i)return{middle:{href:n(`test-management`,`cases`),label:`Test cases`},here:`Test case`};if(t===`test-management`&&r===`tests`&&i)return{middle:{href:n(`test-management`,`tests`),label:`Automated tests`},here:`Test`};if(t===`test-management`&&r===`suites`&&i)return{middle:{href:n(`test-management`,`suites`),label:`Suites`},here:`Suite`};if(t===`agents`&&r===`basal`&&i===`tests`&&a)return{parent:{href:n(`agents`),label:`Agents`},middle:{href:n(`agents`,`basal`,`tests`),label:`BASAL tests`},here:`Test`};if((t===`migration`||t===`tosca`)&&r&&ba.test(r)&&i===`compare`)return{middle:{href:n(`migration`,r),label:`Conversion`},here:`Compare`}}function Sa(e){if(!e.length)return;if(e[0]===`settings`){let t=ee.find(t=>t.id===(e[1]||`models`));return t?{parent:{href:n(`settings`),label:`Settings`},here:{label:t.label}}:void 0}let t=Dn(e),r=xa(e);if(r&&(r.parent||t))return{parent:r.parent??ya(t.category),middle:r.middle,here:{label:r.here}};let i=e[0]===`agents`&&e[1]&&e[1]!==`category`&&e[1]!==`custom`?k(e[1]):void 0;if(i)return{parent:{href:n(`agents`),label:`Agents`},here:{label:M(i.agent).name,href:e.length>2?n(`agents`,i.id):void 0}};if(!t)return;let a=xn(t.item,e),o=t.item.path.length>0&&e.length>a;return{parent:ya(t.category),here:{label:t.item.label,href:o?n(...t.item.path):void 0}}}var Ca=(0,R.createContext)({pending:{},set:()=>{},saved:new Set,vars:{},store:`the credential store`}),wa=()=>(0,R.useContext)(Ca);function Ta(e){return/[\\/]/.test(e)?`ForgeQE's private credentials file (readable only by you)`:e}var Ea=/^[A-Za-z_][A-Za-z0-9_]*$/;function Da(e,t){return t in e.pending?e.pending[t]===null?`removing`:`pending`:e.saved.has(t)?`saved`:e.vars[t]?`environment`:`missing`}var Oa={pending:`Not saved yet`,removing:`Removed when you save`,saved:`Saved`,environment:`Set in the environment`,missing:`Not set`},ka=(e,t)=>[`pending`,`saved`,`environment`].includes(Da(e,t));function Aa({name:e}){let t=wa();if(!e)return null;if(!Ea.test(e))return(0,z.jsx)(`span`,{className:`text-body-sm text-fail`,children:`Not a variable name`});let n=Da(t,e);return(0,z.jsx)(`span`,{className:h(`text-body-sm`,n===`saved`||n===`environment`?`text-pass`:n===`missing`?`text-muted`:`text-accent-fg`),children:Oa[n]})}var ja=/user|email|login|client_id|account/i;function Ma({id:e,name:t,field:n,onRename:i,compact:a}){let o=wa(),s=(0,R.useId)(),c=e||s,[l,u]=(0,R.useState)(!1),d=Da(o,t),f=typeof o.pending[t]==`string`?o.pending[t]:``,p=ja.test(n)||ja.test(t);return(0,z.jsxs)(`div`,{className:`flex w-full min-w-0 flex-col gap-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,z.jsx)(r,{id:c,"aria-label":e?void 0:n,type:p?`text`:`password`,autoComplete:`off`,spellCheck:!1,value:f,disabled:!Ea.test(t),placeholder:d===`saved`?`Saved. Type a new value to replace it`:d===`environment`?`Set in the environment. Type a value to save one`:p?`Type it once`:`Paste it once`,onChange:e=>o.set(t,e.target.value||void 0)}),d===`saved`&&(0,z.jsx)(L,{variant:`icon`,size:`icon-sm`,onClick:()=>o.set(t,null),"aria-label":`Remove the saved value of ${t}`,"data-tip":`Remove the saved value of ${t}`,children:(0,z.jsx)(vn,{"aria-hidden":`true`})}),d===`removing`&&(0,z.jsxs)(L,{size:`sm`,"data-tip":`Keep the saved value of ${t}`,onClick:()=>o.set(t,void 0),children:[(0,z.jsx)(dn,{"aria-hidden":`true`}),`Keep`]})]}),!a&&(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-body-sm text-muted`,children:[(0,z.jsx)(Aa,{name:t}),(0,z.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),l&&i?(0,z.jsx)(r,{size:`sm`,"aria-label":`Variable name`,autoFocus:!0,defaultValue:t,spellCheck:!1,onBlur:e=>{let n=e.target.value.trim();n&&Ea.test(n)&&n!==t&&i(n),u(!1)},onKeyDown:e=>w(e)&&e.target.blur(),className:`max-w-[260px] font-mono`}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`span`,{children:[`Kept as `,(0,z.jsx)(`span`,{className:`font-mono text-body-sm`,children:t})]}),i&&(0,z.jsxs)(L,{variant:`link`,size:`inline`,onClick:()=>u(!0),"data-tip":`Change the variable's name`,children:[(0,z.jsx)(qe,{"aria-hidden":`true`}),`Rename`]})]})]})]})}function Na({name:e}){return(0,z.jsx)(Aa,{name:e})}function Pa({id:e,name:t,field:n,named:r,onName:i}){let a=wa();return(0,z.jsx)(Fa,{onFirstValue:()=>{!r&&t&&i(t)},secrets:a,children:(0,z.jsx)(Ma,{id:e,name:t,field:n,onRename:i})})}function Fa({secrets:e,onFirstValue:t,children:n}){return(0,z.jsx)(Ca.Provider,{value:{...e,set:(n,r)=>{r&&t(),e.set(n,r)}},children:n})}function Ia({label:e,help:t,htmlFor:n,children:r,className:i,stacked:a,yamlKey:o}){let s=o?(0,z.jsx)(`code`,{className:`font-mono text-body-sm text-muted [overflow-wrap:anywhere]`,children:o}):null;return a?(0,z.jsxs)(`div`,{className:h(`flex flex-col gap-4 py-4`,i),children:[(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[n?(0,z.jsx)(`label`,{htmlFor:n,className:`text-body-sm leading-snug font-medium text-ink`,children:e}):(0,z.jsx)(`span`,{className:`text-body-sm leading-snug font-medium text-ink`,children:e}),t&&(0,z.jsx)(`span`,{className:`text-body-sm leading-relaxed text-ink-2`,children:t}),s]}),(0,z.jsx)(`div`,{className:`[&>*]:max-w-none`,children:r})]}):(0,z.jsxs)(`div`,{className:h(`flex min-h-16 flex-wrap items-center gap-x-10 gap-y-4 border-t border-line-soft py-4`,i),children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[n?(0,z.jsx)(`label`,{htmlFor:n,className:`text-body-sm leading-snug font-medium text-ink`,children:e}):(0,z.jsx)(`span`,{className:`text-body-sm leading-snug font-medium text-ink`,children:e}),t&&(0,z.jsx)(`span`,{className:`text-body-sm leading-relaxed text-ink-2`,children:t}),s]}),r!=null&&r!==!1&&(0,z.jsx)(`div`,{className:`flex w-full flex-wrap items-center gap-2 sm:w-[340px] sm:flex-none sm:justify-end`,children:r})]})}var La=`flex w-full flex-wrap items-center gap-2 sm:w-[340px] sm:flex-none sm:justify-end`,Ra={"By how you asked":Ht,"Test runs":Qe,"Speech on this computer":bt,Conversation:Ot,"What went wrong":it,"What ForgeQE found":kt,Questions:Be,"The bug":gn,"What is attached":Ce,Send:pt,"Test case ids":vt,"Where runs happen":Et,"The browser window":$t,"Limits and checks":ln,"Remote browser, set here":st,"Where tests go":Le,"How hard it tries":De,"Help it gets":wt,Reports:Bt,"Memory and replays":cn,Suites:Nt,"Flaky tests":rn,"Release readiness":lt,"Regression packs in a pipeline":fn,"Defect analysis":gn,Accessibility:nn,"Performance and visual changes":Te,"API tests":$e,"The product":Dt,"Instructions and knowledge":Vt,Capabilities:Ke,"Project report":ke,"Report datasets":Xt,"Running in parallel":Zt,Driver:tt,Appium:qt,"Devices on this computer":mt,"TestMu AI devices":st,"BrowserStack devices":st,"Browser devices":nt,"Appium on this computer":qt,Maestro:Ut,"Windows desktop apps":_n,Runtime:ht,"Tests in a container":at,"The coding agents' workspace":dt,"Browser in a container":Re,"How skills are used":Ve,Budgets:we,"Project folder":je,"ForgeQE in this folder":ot,Repository:Le,"Features to download":fn,Onboarding:lt,"This computer":mt,"A model":Pt,"Models file":Ct,"Default model":Pt,"Product knowledge graph":Ae,Repositories:Le,"Documents and links":xe,"Search service":Vt,Documents:xe,"The product and its knowledge":Dt,"Building the graph":Ke,"The team's knowledge":Ne,"Agent names":jt,"Custom agents":At,"Sign-ins":Ue,"Recent runs":Oe,"Saved runs":De,"Test data":Xt,"Areas of work":ft,"Which model a call gets":ft,Alerts:xt,"When to alert":Gt,Apps:nt,"By kind of run":be,"By run, newest first":Oe,Guides:Vt,"Last 30 days":pn,"Latest problems":it,"Links in alerts":Kt,"Model calls":Ot,Plans:Yt,"Recent requests":Ge,"Results and bugs":Ee,"What used the most":hn,"Send a test":pt,Services:gt,"Tools used":Ke,"What runs":Qe,"Check the agent's domain knowledge":Rt,"Test cases and bugs":ct,"Browser grids":st,Notifications:on,"Other tools":Tt},za=e=>e.toLowerCase().replace(/[^a-z0-9]+/g,`-`).replace(/^-|-$/g,``),Ba=h(`settings-card`,u);function Va({children:e,className:t}){return(0,z.jsx)(`div`,{className:h(Ba,t),children:e})}function Ha(e){return R.Children.toArray(e).flatMap(e=>(0,R.isValidElement)(e)&&e.type===R.Fragment?Ha(e.props.children):[e])}function V({children:e}){let t=[],n=[],r=null,i=()=>{r?.items.length&&n.push((0,z.jsx)(Va,{children:r.items},r.key)),r=null};return Ha(e).forEach((e,a)=>{(0,R.isValidElement)(e)&&Wa.has(e.type)?(i(),n.push(e)):((0,R.isValidElement)(e)&&e.type===H&&i(),r||(r={key:`card-${a}`,items:[]},t.push(r)),r.items.push(e))}),i(),(0,z.jsx)(z.Fragment,{children:n})}var Ua=e=>typeof e==`string`?e.trim().replace(/^\d+\.\s*/,``):``;function H({children:e,help:t,first:n,icon:r}){let i=r??Ra[Ua(e)];return(0,z.jsxs)(`div`,{"data-group-title":``,"data-tour":za(Ua(e)),className:h(`mb-4 flex flex-col gap-2`,n?`mt-0`:`mt-10`),children:[(0,z.jsxs)(`h3`,{className:`m-0 flex items-center gap-2 text-body-lg leading-snug font-medium text-ink`,children:[i&&(0,z.jsx)(I,{icon:i,size:18,className:`flex-none text-icon`}),e]}),t&&(0,z.jsx)(`p`,{className:h(`m-0 text-body-sm leading-relaxed text-ink-2`,i&&`pl-8`),children:t})]})}var Wa=new Set([V]),Ga=e=>Array.isArray(e)?e.map(String).join(`, `):typeof e==`string`?e:``,Ka=e=>e.split(`,`).map(e=>e.trim()).filter(Boolean);function qa({id:e,value:t,onChange:n,placeholder:i,mono:a}){let[o,s]=(0,R.useState)(Ga(t)),[c,l]=(0,R.useState)(t);return JSON.stringify(c)!==JSON.stringify(t)&&(l(t),s(Ga(t))),(0,z.jsx)(r,{id:e,value:o,placeholder:i,className:h(a&&`font-mono text-body-sm`),onChange:e=>{s(e.target.value);let t=Ka(e.target.value);l(t.length?t:void 0),n(t.length?t:void 0)}})}function Ja({def:e,edit:t,base:n,stacked:i}){let s=(0,R.useId)(),c=e.key?[...n,...e.key.split(`.`)]:n,l=Xr(t.value,c),u=e=>t.set(Qr(t.value,c,e)),d=`w-full`,f=t.file?c.join(`.`):void 0,p;switch(e.type){case`switch`:{let t=l===void 0?!!e.default:l===!0||l===`true`||l===`on`;return(0,z.jsx)(Ia,{label:e.label,help:e.help,yamlKey:f,children:(0,z.jsx)(ni,{checked:t,onChange:u,label:e.label})})}case`select`:p=(0,z.jsxs)(a,{id:s,value:String(l===void 0?e.default??``:l),onChange:e=>u(e.target.value!==`false`&&e.target.value),className:`w-full`,children:[e.default===void 0&&(0,z.jsx)(`option`,{value:``,children:e.emptyLabel||`Not set`}),e.options.map(e=>(0,z.jsx)(`option`,{value:e.value,children:e.label},e.value))]});break;case`number`:p=(0,z.jsx)(r,{id:s,type:`number`,inputMode:`numeric`,value:l==null?``:String(l),placeholder:e.default===void 0?e.placeholder:String(e.default),onChange:e=>u(e.target.value===``?void 0:Number(e.target.value)),className:`w-full`});break;case`list`:p=(0,z.jsx)(`div`,{className:d,children:(0,z.jsx)(qa,{id:s,value:l,onChange:u,placeholder:e.placeholder})});break;case`kv`:p=(0,z.jsx)(`div`,{className:d,children:(0,z.jsx)(Ya,{id:s,value:l,onChange:u,placeholder:e.placeholder})});break;case`textarea`:p=(0,z.jsx)(o,{id:s,rows:3,value:l===void 0?``:String(l),placeholder:e.placeholder,onChange:e=>u(e.target.value),className:d});break;case`var`:{let t=String(l??e.default??e.placeholder??``);return p=(0,z.jsx)(`div`,{className:d,children:(0,z.jsx)(Pa,{id:s,name:t,field:e.key,named:l!==void 0||e.default!==void 0,onName:e=>u(e)})}),(0,z.jsx)(Ia,{label:e.label.replace(/ variable$/,``),help:e.help,htmlFor:s,stacked:i,yamlKey:f,children:p})}default:p=(0,z.jsx)(r,{id:s,type:e.type===`url`?`url`:`text`,value:l===void 0?``:String(l),placeholder:e.placeholder??(e.default===void 0?void 0:String(e.default)),spellCheck:e.type===`text`,onChange:e=>u(e.target.value),className:h(d,e.type===`path`&&`font-mono text-body-sm`)})}return(0,z.jsx)(Ia,{label:e.label,help:e.help,htmlFor:s,stacked:i,yamlKey:f,children:p})}function Ya({id:e,value:t,onChange:n,placeholder:r}){let i=e=>Object.entries(e&&typeof e==`object`&&!Array.isArray(e)?e:{}).map(([e,t])=>`${e} = ${typeof t==`object`?JSON.stringify(t):String(t)}`).join(`
6
+ `),[a,s]=(0,R.useState)(i(t)),[c,l]=(0,R.useState)(t);return JSON.stringify(c)!==JSON.stringify(t)&&(l(t),s(i(t))),(0,z.jsx)(o,{id:e,rows:3,value:a,spellCheck:!1,placeholder:r??`NAME = value`,className:`font-mono`,onChange:e=>{s(e.target.value);let t={};for(let n of e.target.value.split(`
7
+ `)){let e=n.indexOf(`=`),r=(e<0?n:n.slice(0,e)).trim();if(!r)continue;let i=e<0?``:n.slice(e+1).trim();t[r]=/^-?\d+(\.\d+)?$/.test(i)?Number(i):i===`true`||i!==`false`&&i}let r=Object.keys(t).length?t:void 0;l(r),n(r)}})}function Xa({defs:e,edit:t,base:n,stacked:r}){let i=Xr(t.value,n),a=i&&typeof i==`object`&&!Array.isArray(i)?i:{};return(0,z.jsx)(z.Fragment,{children:e.filter(e=>!e.when||e.when(a)).map(e=>(0,z.jsx)(Ja,{def:e,edit:t,base:n,stacked:r},e.key))})}function Za({title:e,meta:t,state:n,open:r,onToggle:i,lead:a,actions:o,children:s,expandable:c}){let l=(0,R.useId)();return(0,z.jsxs)(`div`,{className:`border-t border-line-soft`,children:[(0,z.jsxs)(`div`,{className:`flex min-h-[68px] flex-wrap items-center gap-x-4 gap-y-2 py-4`,children:[a,c===!1?(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,z.jsx)(`span`,{className:`font-medium`,children:e}),t&&(0,z.jsx)(`span`,{className:`text-body-sm text-muted`,children:t})]}):(0,z.jsxs)(`button`,{type:`button`,"aria-expanded":r,"aria-controls":l,onClick:i,className:`flex min-w-0 flex-[1_1_260px] cursor-pointer items-center gap-4 border-0 bg-transparent p-0 text-left text-ink`,children:[(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,z.jsx)(`span`,{className:`font-medium`,children:e}),t&&(0,z.jsx)(`span`,{className:`text-body-sm text-muted`,children:t})]}),(0,z.jsx)(Fe,{size:18,"aria-hidden":`true`,className:h(`flex-none text-muted transition-transform`,r&&`rotate-180`)})]}),n,o]}),c!==!1&&(0,z.jsx)(Ln,{open:r,id:l,children:(0,z.jsx)(`div`,{className:`mb-4 border-l-2 border-line-soft pb-2 pl-4 sm:pl-6 [&>*:first-child]:border-t-0`,children:s})})]})}function Qa(e){let[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)(``),a=(0,R.useCallback)(()=>{i(``),e().then(n,e=>i(e.message))},[e]);return(0,R.useEffect)(a,[a]),{data:t,error:r,reload:a}}function $a({error:e,reload:t}){return e?(0,z.jsxs)(`div`,{role:`alert`,className:h(u,`flex flex-col items-start gap-4`),children:[(0,z.jsx)(`p`,{className:`m-0 text-body-sm leading-relaxed text-ink-2`,children:e}),(0,z.jsxs)(L,{size:`sm`,onClick:t,children:[(0,z.jsx)(ze,{"aria-hidden":`true`}),`Retry`]})]}):(0,z.jsx)(`p`,{role:`status`,className:`m-0 py-4 text-body-sm text-muted`,children:`Loading…`})}function U(e){return e>=1e9?`${(e/1e9).toFixed(1)}B`:e>=1e6?`${(e/1e6).toFixed(1)}M`:e>=1e4?`${Math.round(e/1e3)}k`:e>=1e3?`${(e/1e3).toFixed(1)}k`:String(e)}function eo(e){return`${U(e.input)} read${e.cached?` (${U(e.cached)} from cache)`:``} · ${U(e.output)} written`}var W=null;function to(e){W=e}function G(e,t){if(!t)return`—`;let n=W?.to,r=W?.perEur?.[t],i=n?W?.perEur?.[n]:void 0,[a,o]=n&&n!==t&&r&&i?[e/r*i,n]:[e,t];try{let e=Math.abs(a)>=1e4;return new Intl.NumberFormat(void 0,{style:`currency`,currency:o,...e?{notation:`compact`,maximumFractionDigits:1}:{maximumFractionDigits:Math.abs(a)<1?3:2}}).format(a)}catch{return`${a.toFixed(2)} ${o}`}}function no(e){if(!W?.perEur||!e||W.to===e||!W.perEur[e])return``;let t=G(1,e);return`Shown in ${W.to}, converted from ${e} at the European Central Bank's rate of ${W.date}: ${new Intl.NumberFormat(void 0,{style:`currency`,currency:e}).format(1)} = ${t}.`}var K=e=>{let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString(void 0,{dateStyle:`medium`,timeStyle:`short`})},ro=e=>e>=1048576?`${(e/1048576).toFixed(1)} MB`:e>=1024?`${Math.round(e/1024)} KB`:`${e} bytes`;function io({head:e,children:t,label:n,height:r}){let i=R.Children.toArray(t).map(e=>(0,R.isValidElement)(e)&&e.type===q?(0,z.jsx)(R.Fragment,{children:q(e.props)},e.key):e);return(0,z.jsx)(ki,{label:n,...r?{height:r}:{},head:e.map((e,t)=>(0,z.jsx)(`th`,{scope:`col`,className:t>0?di:ui,children:e},e||t)),children:i})}function q({cells:e,sort:t}){return(0,z.jsx)(`tr`,{className:`border-t border-line-soft`,children:e.map((e,n)=>(0,z.jsx)(`td`,{"data-sort":t?.[n],className:h(n>0?hi:mi,`align-top`,n===0&&`min-w-[200px]`),children:e},n))})}var ao={title:`How skills are used`,base:[`skills`],fields:[{key:`enabled`,label:`Use skills`,type:`switch`,default:!0},{key:`external`,label:`Also read Claude and agent skills`,help:`~/.claude/skills, ~/.agents/skills, and the repository's own.`,type:`switch`,default:!1},{key:`dirs`,label:`More skill folders`,help:`Comma separated. They win over the others.`,type:`list`,placeholder:`../shared-skills`},{key:`browser_max_chars`,label:`Skill text per browser run`,help:`Characters.`,type:`number`,default:6e3}]},oo={"no match":`not run before`,"not a rerun":`not run before`,"not a recorded goal":`not run before`,"no recorded run matches":`not run before`,"its last run did not pass":`its last run failed`,"marked stale":`its saved steps are out of date`,"more than one recorded start page for this goal":`saved from more than one start page`};function so(e,t){return e===`tier0`?t===`shadow`?`Test mode: AI ran it, could have replayed`:`Replayed for free`:`AI: ${oo[e]||e}`}function co({edit:e}){let{data:t,error:n,reload:r}=Qa(P.registry),[i,a]=(0,R.useState)(!1),o=String(Xr(e.value,[`registry`,`mode`])??`on`);return(0,z.jsxs)(V,{children:[(0,z.jsx)(Ia,{label:`Replay passed runs for free`,help:o===`shadow`?`In test mode now: ForgeQE only notes what it would have replayed, and the AI runs everything. Turn it on to use replays.`:`If the page changed, the AI takes over.`,yamlKey:e.file?`registry.mode`:void 0,children:(0,z.jsx)(ni,{checked:o===`on`,onChange:t=>e.set(Qr(e.value,[`registry`,`mode`],t?`on`:`off`)),label:`Replay passed runs for free`})}),t?!t.exists||t.plans.length===0?(0,z.jsx)(F,{children:`Nothing to replay yet. When a run passes, ForgeQE saves its steps, and running it again is free.`}):(0,z.jsxs)(V,{children:[(0,z.jsxs)(na,{label:`Replays`,className:`mt-4`,children:[(0,z.jsx)(B,{icon:De,label:`Free reruns`,value:String(t.replayed),note:`of ${m(t.total,`run`)}`}),(0,z.jsx)(B,{icon:Ye,label:`Tokens saved`,value:U(t.tokensSaved),note:`${m(t.plans.length,`passed run`)} ready to replay`})]}),(0,z.jsxs)(L,{variant:`link`,size:`inline`,"aria-expanded":i,"aria-controls":`replay-details`,onClick:()=>a(!i),"data-tip":i?`Hide details`:`Show details`,className:`mt-2 self-start`,children:[i?(0,z.jsx)(It,{"aria-hidden":`true`}):(0,z.jsx)(Fe,{"aria-hidden":`true`}),i?`Less`:`Details`]}),(0,z.jsxs)(Ln,{open:i,id:`replay-details`,children:[(0,z.jsx)(H,{first:!0,children:`Saved runs`}),(0,z.jsx)(io,{label:`Saved runs`,head:[`Goal`,`Passed`,`Failed`,`Tokens the first time`,`Last used`],children:t.plans.map(e=>(0,z.jsx)(q,{cells:[(0,z.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,z.jsx)(`span`,{className:`line-clamp-2`,children:e.goal}),e.stale&&(0,z.jsx)(`span`,{className:`text-body-sm text-warn`,children:`Out of date: the AI runs it next time`})]}),e.successes,e.failures,e.firstTokens?U(e.firstTokens):`—`,K(e.lastAt)],sort:[void 0,void 0,void 0,e.firstTokens??-1,new Date(e.lastAt).getTime()||0]},e.id))}),(0,z.jsx)(H,{children:`Recent runs`}),t.requests.length===0?(0,z.jsx)(F,{children:`No runs yet.`}):(0,z.jsx)(io,{label:`Recent runs`,head:[`Request`,`How it ran`,`Result`,`Tokens`,`When`],children:t.requests.map(e=>(0,z.jsx)(q,{cells:[(0,z.jsx)(`span`,{className:`line-clamp-2`,children:e.request||e.planGoal||e.id}),so(e.decision,e.mode),e.outcome||`—`,U(e.tokens),K(e.startedAt)],sort:[void 0,void 0,void 0,e.tokens,new Date(e.startedAt).getTime()||0]},e.id))})]})]}):(0,z.jsx)($a,{error:n,reload:r})]})}function lo(){let{data:e,error:t,reload:n}=Qa(P.logs),[r,i]=(0,R.useState)(null),[a,o]=(0,R.useState)(``);return e?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`mt-0 mb-4 text-body-sm text-muted`,children:[`Kept in `,(0,z.jsx)(`span`,{className:`font-mono text-body-sm`,children:e.dir}),`. Secrets are replaced with their names before a log is shown.`]}),a&&(0,z.jsx)(`p`,{role:`alert`,className:`mt-0 mb-4 text-body-sm text-fail`,children:a}),e.logs.length===0?(0,z.jsx)(F,{children:`No session logs yet. ForgeQE writes one for each chat, run and suite.`}):e.logs.map(e=>(0,z.jsxs)(`div`,{className:`flex min-h-[60px] flex-wrap items-center gap-x-4 gap-y-2 border-t border-line-soft py-2`,children:[(0,z.jsx)(Jr,{icon:Qt}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,children:[(0,z.jsx)(`span`,{className:`font-mono text-body-sm break-all`,children:e.name}),(0,z.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[K(e.modified),`, `,ro(e.size)]})]}),(0,z.jsx)(L,{variant:`icon`,size:`icon-sm`,"aria-label":`Open ${e.name}`,"data-tip":`Open ${e.name}`,onClick:()=>{o(``),P.log(e.name).then(i,e=>o(e.message))},children:(0,z.jsx)(Qt,{"aria-hidden":`true`})})]},e.name)),(0,z.jsx)(kn,{wide:!0,open:!!r,onClose:()=>i(null),title:r?.name||``,description:r?.truncated?`The end of the log; the start is cut to keep it quick to open.`:void 0,footer:(0,z.jsxs)(L,{onClick:()=>i(null),children:[(0,z.jsx)(rt,{"aria-hidden":`true`}),`Close`]}),children:r&&(0,z.jsx)(`pre`,{className:`m-0 mt-4 font-mono text-body-sm leading-relaxed whitespace-pre-wrap break-all`,children:(0,z.jsx)(_e,{text:r.text})})})]}):(0,z.jsx)($a,{error:t,reload:n})}var uo={error:`Error`,tool:`Tool call failed`,run:`Run failed`,engine:`Browser engine stopped`,agent:`Agent error`,model:`Model call failed`},fo={chat:`Chat`,start:`Shell`,run:`Run`,suite:`Suite`,code:`Write tests`,heal:`Heal`,monitor:`Monitor`,mcp:`MCP`,explore:`Explore`};function po(){let[e,t]=(0,R.useState)(null),[n,r]=(0,R.useState)(``);return{show:e=>{r(``),P.log(e).then(t,e=>r(e.message))},error:n,sheet:(0,z.jsx)(kn,{wide:!0,open:!!e,onClose:()=>t(null),title:e?.name||``,description:e?.truncated?`The end of the log; the start is cut to keep it quick to open.`:void 0,footer:(0,z.jsxs)(L,{onClick:()=>t(null),children:[(0,z.jsx)(rt,{"aria-hidden":`true`}),`Close`]}),children:e&&(0,z.jsx)(`pre`,{className:`m-0 mt-4 font-mono text-body-sm leading-relaxed break-all whitespace-pre-wrap`,children:(0,z.jsx)(_e,{text:e.text})})})}}function mo({entries:e}){let[t,n]=(0,R.useState)(-1);return e.length?(0,z.jsx)(z.Fragment,{children:e.map((e,r)=>(0,z.jsx)(Za,{lead:(0,z.jsx)(Jr,{icon:Oe}),title:`${e.action}: ${e.file}`,meta:`${K(e.at)}, ${e.user} on ${e.machine}, ${e.changes.length} change${e.changes.length===1?``:`s`}`,open:t===r,onToggle:()=>n(t===r?-1:r),children:(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0 py-4`,children:e.changes.map((e,t)=>(0,z.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-x-2 gap-y-1 text-body-sm`,children:[(0,z.jsx)(`span`,{className:`font-mono text-body-sm`,children:e.key}),(0,z.jsx)(`span`,{className:`text-muted`,children:e.before===void 0?(0,z.jsxs)(z.Fragment,{children:[`added `,(0,z.jsx)(`span`,{className:`text-ink`,children:e.after})]}):e.after===void 0?(0,z.jsxs)(z.Fragment,{children:[`removed `,(0,z.jsx)(`span`,{className:`text-ink line-through`,children:e.before})]}):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:`text-ink line-through`,children:e.before}),` → `,(0,z.jsx)(`span`,{className:`text-ink`,children:e.after})]})})]},t))})},r))}):(0,z.jsx)(F,{children:`No changes made in Settings yet.`})}function ho(){let{data:e,error:t,reload:n}=Qa(P.audit),[r,i]=(0,R.useState)(`summary`),a=po();if(!e)return(0,z.jsx)($a,{error:t,reload:n});let o=e.summary,s=o.totals,c=e=>e?`${e} failed`:`None failed`;return(0,z.jsxs)(V,{children:[(0,z.jsx)(`p`,{className:`mt-0 mb-4 text-body-sm text-muted`,children:`The last 30 days, from the session logs on this machine and its usage ledger. Model calls count every project on this machine.`}),(0,z.jsx)(Xi,{label:`Audit`,current:r,onPick:i,tabs:[{id:`summary`,label:`Summary`},{id:`problems`,label:`Problems`,n:o.problems.length},{id:`sessions`,label:`Sessions`,n:o.sessions.length},{id:`changes`,label:`Settings changes`,n:e.entries.length}]}),a.error&&(0,z.jsx)(`p`,{role:`alert`,className:`mt-0 mb-4 text-body-sm text-fail`,children:a.error}),(0,z.jsxs)(`div`,{id:`panel-${r}`,role:`tabpanel`,"aria-labelledby":`tab-${r}`,children:[r===`summary`&&(0,z.jsxs)(V,{children:[(0,z.jsxs)(na,{label:`Activity summary`,children:[(0,z.jsx)(B,{icon:Ot,label:`Sessions`,value:String(s.sessions),note:s.replays?`${s.replays} request${s.replays===1?``:`s`} replayed without the agent`:void 0}),(0,z.jsx)(B,{icon:Ke,label:`Tool calls`,value:String(s.toolCalls),note:c(s.toolErrors)}),(0,z.jsx)(B,{icon:Qe,label:`Runs`,value:String(s.runs),note:c(s.runsFailed)}),(0,z.jsx)(B,{icon:Pt,label:`Model calls`,value:String(s.modelCalls),note:c(s.modelErrors)}),(0,z.jsx)(B,{icon:it,label:`Errors`,value:String(s.errors),note:s.escalations?`${s.escalations} switch${s.escalations===1?``:`es`} to a stronger model`:void 0})]}),o.problems.length>0&&(0,z.jsxs)(V,{children:[(0,z.jsx)(H,{children:`Latest problems`}),(0,z.jsx)(go,{problems:o.problems.slice(0,5),onLog:a.show}),o.problems.length>5&&(0,z.jsxs)(L,{variant:`link`,size:`inline`,onClick:()=>i(`problems`),"data-tip":`All ${o.problems.length} problems`,className:`mt-4 self-start`,children:[(0,z.jsx)(Jt,{"aria-hidden":`true`}),`All (`,o.problems.length,`)`]})]}),(0,z.jsx)(H,{children:`Tools used`}),o.tools.length===0?(0,z.jsx)(F,{children:`No tool calls logged in the last 30 days.`}):(0,z.jsx)(io,{label:`Tools used`,head:[`Tool`,`Calls`,`Failed`,`Average time`],children:o.tools.map(e=>(0,z.jsx)(q,{cells:[(0,z.jsx)(`span`,{className:`font-mono text-body-sm`,children:e.name}),e.calls,e.errors?(0,z.jsx)(`span`,{className:`text-fail`,children:e.errors}):0,e.calls?`${(e.ms/e.calls/1e3).toFixed(1)} s`:`—`],sort:[void 0,e.calls,e.errors,e.calls?e.ms/e.calls:-1]},e.name))}),(0,z.jsx)(H,{children:`Model calls`}),o.models.length===0?(0,z.jsx)(F,{children:`No model calls in the usage ledger in the last 30 days.`}):(0,z.jsx)(io,{label:`Model calls`,head:[`Model`,`Calls`,`Failed`,`Tokens`],children:o.models.map(e=>(0,z.jsx)(q,{cells:[e.model,e.calls,e.errors?(0,z.jsx)(`span`,{className:`text-fail`,children:e.errors}):0,U(e.tokens)],sort:[void 0,e.calls,e.errors,e.tokens]},e.model))})]}),r===`problems`&&(o.problems.length?(0,z.jsx)(go,{problems:o.problems,onLog:a.show}):(0,z.jsx)(F,{children:`Nothing failed in the last 30 days.`})),r===`sessions`&&(o.sessions.length?(0,z.jsx)(io,{label:`Sessions`,height:`max(320px, calc(var(--screen) - 288px))`,head:[`Session`,`Tool calls`,`Runs`,`Errors`,`Tokens`,``],children:o.sessions.map(e=>(0,z.jsx)(q,{cells:[(0,z.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,z.jsx)(`span`,{className:`font-medium`,children:fo[e.command]||e.command}),(0,z.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[K(e.started),e.model?`, ${e.model}`:``]})]}),e.toolErrors?`${e.tools} (${e.toolErrors} failed)`:e.tools,e.runsFailed?`${e.runs} (${e.runsFailed} failed)`:e.runs,e.errors?(0,z.jsx)(`span`,{className:`text-fail`,children:e.errors}):0,U(e.tokens),(0,z.jsx)(L,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the log of the ${fo[e.command]||e.command} session at ${K(e.started)}`,"data-tip":`Open the log of the ${fo[e.command]||e.command} session at ${K(e.started)}`,onClick:()=>a.show(e.log),children:(0,z.jsx)(Qt,{"aria-hidden":`true`})})],sort:[void 0,e.tools,e.runs,e.errors,e.tokens]},e.log))}):(0,z.jsx)(F,{children:`No sessions logged in the last 30 days.`})),r===`changes`&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`p`,{className:`mt-0 mb-4 text-body-sm text-muted`,children:[`Every change made in Settings, kept in `,(0,z.jsx)(`span`,{className:`font-mono text-body-sm`,children:e.file}),`. Changes made to the files by hand are not here.`]}),(0,z.jsx)(mo,{entries:e.entries})]})]}),a.sheet]})}function go({problems:e,onLog:t}){return(0,z.jsx)(z.Fragment,{children:e.map((e,n)=>(0,z.jsxs)(`div`,{className:`flex min-h-[64px] flex-wrap items-center gap-x-4 gap-y-2 border-t border-line-soft py-4`,children:[(0,z.jsx)(Jr,{icon:e.kind===`run`||e.kind===`tool`?yn:it,tone:`fail`}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-1`,children:[(0,z.jsx)(`span`,{className:`font-medium`,children:uo[e.kind]}),(0,z.jsx)(`span`,{className:`text-body-sm break-words text-ink-2`,children:e.text}),(0,z.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[K(e.at),`, `,fo[e.command]||e.command]})]}),e.log&&(0,z.jsx)(L,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the log for: ${e.text.slice(0,60)}`,"data-tip":`Open the log for: ${e.text.slice(0,60)}`,onClick:()=>t(e.log),children:(0,z.jsx)(Qt,{"aria-hidden":`true`})})]},n))})}var _o={title:`Budgets`,help:`Money in the model's price currency, or GitHub Copilot premium requests. They only warn, at 80, 90 and 100 percent, and never stop a run. Day and month count every ForgeQE process on this machine.`,base:[`budget`],fields:[{key:`run`,label:`Per browser run`,type:`number`},{key:`day`,label:`Per day`,type:`number`},{key:`month`,label:`Per month`,type:`number`},{key:`currency`,label:`Currency`,type:`text`,placeholder:`USD`},{key:`premium_requests.run`,label:`Premium requests per browser run`,help:`GitHub Copilot: each call uses the model's multiplier, 0 for a model included in your plan.`,type:`number`},{key:`premium_requests.day`,label:`Premium requests per day`,type:`number`},{key:`premium_requests.month`,label:`Premium requests per month`,type:`number`}]},vo={suite:`Suites`,monitor:`Monitor rounds`,run:`Browser runs`,explore:`Exploratory`,api:`API tests`,desktop:`Desktop runs`,mobile:`Mobile runs`},yo={suite:`Suite`,monitor:`Monitor round`,run:`Browser run`,explore:`Exploratory`,api:`API test`,desktop:`Desktop run`,mobile:`Mobile run`,chat:`Chat`,"custom agent":`Custom agent`,talk:`Talk`,"browser test":`Browser run`,"mobile test":`Mobile run`},bo=e=>yo[e]||e.charAt(0).toUpperCase()+e.slice(1);function xo({days:e,currency:t}){let[n,r]=(0,R.useState)(-1),i=e.reduce((e,t)=>e+t.input+t.output,0),a=e.filter(e=>e.runs>0).length,o=e.reduce((e,t)=>t.input+t.output>e.input+e.output?t:e,e[0]),s=n>=0?e[n]:e[e.length-1],c=e=>new Date(`${e}T12:00:00Z`).toLocaleDateString(void 0,{month:`short`,day:`numeric`});return(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,z.jsxs)(`p`,{"aria-live":`polite`,className:`m-0 text-body-sm text-ink-2`,children:[(0,z.jsx)(`span`,{className:`font-medium`,children:c(s.day)}),`: `,U(s.input+s.output),` tokens, `,s.runs,` run`,s.runs===1?``:`s`,t?`, ${G(s.amount,t)}`:``]}),(0,z.jsx)(pe,{series:[{values:e.map(e=>e.input+e.output)}],label:`Tokens a day for the last 30 days: ${U(i)} in all, on ${a} days with runs; the busiest was ${c(o.day)} with ${U(o.input+o.output)}.`,hover:n,onHover:r,className:`h-[160px]`,axis:[c(e[0].day),c(e[e.length-1].day)]})]})}function So({rows:e,currency:t,label:n}){if(!e.length)return(0,z.jsx)(F,{children:`Nothing yet.`});let r=Math.max(1,e.reduce((e,t)=>e+t.sum.input+t.sum.output,0));return(0,z.jsx)(he,{label:n,rows:e.map(e=>{let n=e.sum.input+e.sum.output;return{key:e.name,label:e.name,value:U(n),sub:t&&e.sum.amount?G(e.sum.amount,t):`tokens`,share:n/r}})})}var Co=e=>{let t=Math.round(e*100)/100;return`${t} premium request${t===1?``:`s`}`};function wo({label:e,spent:t,limit:n,currency:r,premium:i}){let a=e=>i?Co(e):G(e,r),o=t/n*100,s=o>=100?`fail`:o>=80?`warn`:`ok`;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,z.jsxs)(`div`,{className:`flex items-baseline justify-between gap-4 text-body-sm`,children:[(0,z.jsx)(`span`,{className:`font-medium`,children:e}),(0,z.jsxs)(`span`,{className:h(`tabular-nums`,s===`fail`?`text-fail`:s===`warn`?`text-warn`:`text-ink-2`),children:[a(t),` of `,a(n),s===`fail`?`, over budget`:s===`warn`?`, ${Math.round(o)} percent used`:``]})]}),(0,z.jsx)(de,{value:t,limit:n,label:`${e}: ${a(t)} of ${a(n)}`})]})}function To({edit:e}){let{data:t,error:r,reload:i}=Qa(P.tokenomics),a=(0,z.jsx)(Xa,{defs:_o.fields,edit:e,base:_o.base});if(!t)return(0,z.jsx)($a,{error:r,reload:i});let o=t,s=o.currency,c=o.totals.input+o.totals.output,l=o.budget,d=l?.currency||o.spent?.currency||s,f=o.project?.days30.calls?o.project:void 0,p=f?f.days30.input+f.days30.output:0;return(0,z.jsxs)(V,{children:[f&&(0,z.jsxs)(V,{children:[(0,z.jsxs)(`p`,{className:`mt-0 mb-4 text-body-sm text-muted`,children:[`Every model call made for this project from `,o.days[0]?.day,` to today: chats, runs and the agents they started, each priced when it was made. These are the figures the workspace panel shows. `,(0,z.jsx)(`a`,{href:n(`cost`),children:`Cost and model usage`}),` breaks them down by agent, job and model, priced at today's prices.`]}),(0,z.jsxs)(na,{label:`All model calls, last 30 days`,children:[(0,z.jsx)(B,{icon:We,label:`Tokens`,value:U(p),note:eo(f.days30)}),(0,z.jsx)(B,{icon:we,label:`Cost`,value:f.currency?G(f.days30.amount,f.currency):`—`,note:f.currency?`When each call was made`:`No prices known`}),(0,z.jsx)(B,{icon:Te,label:`Calls`,value:f.days30.calls.toLocaleString(),note:`${U(f.today.input+f.today.output)} tokens today`}),(0,z.jsx)(B,{icon:an,label:`Read from cache`,value:f.days30.input?`${Math.round(f.days30.cached/f.days30.input*100)}%`:`—`,note:`Of the tokens read`})]}),no(f.currency)&&(0,z.jsx)(`p`,{className:`mt-4 mb-0 text-body-sm text-muted`,children:no(f.currency)}),f.byChannel&&(0,z.jsxs)(V,{children:[(0,z.jsx)(H,{help:`The same calls, by how the request was made: said aloud through Talk, or typed (and everything else ForgeQE ran).`,children:`By how you asked`}),(0,z.jsx)(So,{label:`Tokens by how you asked`,currency:f.currency,rows:[{name:`Voice (Talk), ${f.byChannel.voice.calls.toLocaleString()} calls`,sum:{runs:0,...f.byChannel.voice}},{name:`Typed and other, ${f.byChannel.typed.calls.toLocaleString()} calls`,sum:{runs:0,...f.byChannel.typed}}]})]}),!!f.top?.length&&(0,z.jsxs)(V,{children:[(0,z.jsx)(H,{help:`Every chat, custom agent, test run and writing job of the last 30 days, by the model calls it made.`,children:`What used the most`}),(0,z.jsx)(io,{label:`Work that used the most tokens`,head:[`Work`,`Kind`,`Tokens`,`Cost`,`When`],children:f.top.map(e=>(0,z.jsx)(q,{cells:[(0,z.jsxs)(`span`,{className:`line-clamp-2`,children:[e.title,e.voice?(0,z.jsx)(`span`,{className:`text-muted`,children:` · by voice`}):null]}),bo(e.kind),U(e.tokens),e.amount!==void 0&&f.currency?G(e.amount,f.currency):`—`,e.startedAt?K(e.startedAt):`—`],sort:[void 0,void 0,e.tokens,e.amount??-1,e.startedAt&&new Date(e.startedAt).getTime()||0]},e.id))})]}),(0,z.jsx)(H,{children:`Test runs`})]}),o.totals.runs===0?(0,z.jsx)(F,{children:`No test runs with token counts in the last 30 days. Every run and suite ForgeQE reports on is counted here; chats are not.`}):(0,z.jsxs)(V,{children:[(0,z.jsxs)(`p`,{className:`mt-0 mb-4 text-body-sm text-muted`,children:[`From `,o.totals.runs,` run`,o.totals.runs===1?``:`s`,` in this project's reports in the last 30 days`,o.from?`, ${o.from} to ${o.to}`:``,`: test runs only, not chats. Models and agents come from the `,o.totals.withCalls,` run`,o.totals.withCalls===1?``:`s`,` that kept their model calls.`]}),(0,z.jsxs)(na,{label:`Test runs, last 30 days`,children:[(0,z.jsx)(B,{icon:We,label:`Tokens`,value:U(c),note:eo(o.totals)}),(0,z.jsx)(B,{icon:we,label:`Cost`,value:G(o.totals.amount,s),note:o.totals.unpriced?`${o.totals.unpriced} run${o.totals.unpriced===1?``:`s`} had no price`:s?`At the models' prices`:`No prices known`}),(0,z.jsx)(B,{icon:Te,label:`Per run`,value:U(Math.round(c/o.totals.runs)),note:s?G(o.totals.amount/o.totals.runs,s):void 0}),(0,z.jsx)(B,{icon:an,label:`Read from cache`,value:o.totals.input?`${Math.round(o.totals.cached/o.totals.input*100)}%`:`—`,note:`Of the tokens read`})]}),no(o.currency)&&f?.currency!==o.currency&&(0,z.jsx)(`p`,{className:`mt-4 mb-0 text-body-sm text-muted`,children:no(o.currency)}),o.otherCurrency>0&&(0,z.jsxs)(`p`,{className:`mt-4 mb-0 text-body-sm text-muted`,children:[o.otherCurrency,` run`,o.otherCurrency===1?` was`:`s were`,` priced in another currency and left out of the cost.`]}),(0,z.jsx)(H,{children:`Last 30 days`}),(0,z.jsx)(xo,{days:o.days,currency:s}),(0,z.jsxs)(`div`,{className:`mt-8 flex flex-wrap gap-x-10 gap-y-8`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-4`,children:[(0,z.jsx)(`h3`,{className:`m-0 text-body-lg font-medium`,children:`By model`}),(0,z.jsx)(So,{label:`Tokens by model`,rows:o.byModel.map(e=>({name:e.model,sum:e})),currency:s})]}),(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_260px] flex-col gap-4`,children:[(0,z.jsx)(`h3`,{className:`m-0 text-body-lg font-medium`,children:`By agent`}),(0,z.jsx)(So,{label:`Tokens by agent`,rows:o.byAgent.map(e=>({name:e.agent,sum:e})),currency:s})]})]}),(0,z.jsx)(H,{children:`By kind of run`}),(0,z.jsx)(So,{label:`Tokens by kind of run`,rows:o.byKind.map(e=>({name:`${vo[e.kind]||e.kind} (${e.runs})`,sum:e})),currency:s})]}),(0,z.jsx)(H,{help:_o.help,children:_o.title}),l&&o.spent&&(l.day||l.month)?(0,z.jsxs)(`div`,{className:h(u,`mb-4 flex flex-col gap-4`),children:[l.day?(0,z.jsx)(wo,{label:`Today`,spent:o.spent.today,limit:l.day,currency:d}):null,l.month?(0,z.jsx)(wo,{label:`This month`,spent:o.spent.month,limit:l.month,currency:d}):null]}):null,l?.premium&&o.spent&&(l.premium.day||l.premium.month)?(0,z.jsxs)(`div`,{className:h(u,`mb-4 flex flex-col gap-4`),children:[l.premium.day?(0,z.jsx)(wo,{label:`Premium requests today`,spent:o.spent.premiumToday||0,limit:l.premium.day,premium:!0}):null,l.premium.month?(0,z.jsx)(wo,{label:`Premium requests this month`,spent:o.spent.premiumMonth||0,limit:l.premium.month,premium:!0}):null]}):null,a]})}var J=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{},Y=e=>typeof e==`string`?e:e==null?``:String(e),Eo=e=>e.replace(/(?:\s*\[(?:They spoke while you were talking; they heard up to: |Running elsewhere in ForgeQE now, as data: )[^\n]*\])+\s*$/,``),Do=(e,t=400)=>e.length>t?`${e.slice(0,t-1)}…`:e,Oo=e=>typeof e==`number`?` in ${Math.round(e/1e3)}s`:``;function X(e,t=400){return Do(e.replace(/\s+/g,` `).trim(),t).replace(/([\\`*_[\]<>#|~!])/g,`\\$1`)}function ko(e){let t=e.replace(/\s+/g,` `).trim();if(!t)return``;let n=t.includes("`")?"``":"`";return`${n}${n==="``"?` `:``}${t}${n==="``"?` `:``}${n}`}function Ao(e,t){return/^https?:\/\/[^\s)]+$/i.test(t)?`[${X(e||t,120)}](${t})`:X(e)}var jo=e=>[ko(Y(J(e).id)),X(Y(J(e).title),200)].filter(Boolean).join(` `);function Mo(e){return e.replace(/<!--[\s\S]*?(?:-->|$)/g,``).trim()}function No(e){return e.replace(/\[((?:\\.|[^\]\\])*)\]\(https?:\/\/[^\s)]+\)/g,`$1`).replace(/\\(.)/g,`$1`).replace(/[*`]/g,``)}var Z=(e,t)=>({tone:e,kind:`item`,md:t}),Po=(e,t)=>({tone:e,kind:`sub`,md:t});function Fo(e,t=``){let n=t||(e.agent&&e.agent!==`forgeqe`?`**${X(Y(e.agent))}:** `:``);switch(e.kind){case`info`:return Z(`info`,`${n}${X(Y(e.text))}`);case`start`:return Z(`dim`,`${n}→ ${ko(Y(e.tool))}${e.text&&e.text!==e.tool?` ${X(Y(e.text),200)}`:``}`);case`tool`:{let t=J(e.file),r=J(e.shell).exit,i=typeof r==`number`&&r!==0?` (exit code ${r})`:``;return Z(e.ok===!1?`warn`:`dim`,`${n}${e.ok===!1?`⚠`:`✓`} ${X(Y(e.text)||Y(e.tool),240)}${i}${t.path?` (${X(Y(t.action))} ${ko(Y(t.path))})`:``}`)}case`say`:{let t=Mo(Y(e.text));return t?Z(`say`,`${n}*${X(t)}*`):null}case`test`:return Number(e.attempt)>0?Z(e.ok?`ok`:`fail`,`${n}${e.ok?`✓`:`✗`} **Test, attempt ${X(Y(e.attempt))}:** ${X(Y(e.text),240)}`):Z(e.ok?`ok`:`fail`,`${n}${e.ok?`✓`:`✗`} ${X(Y(e.text),240)}`);case`plan`:{let t=Array.isArray(e.items)?e.items.map(J):[],r=t.find(e=>e.status===`in_progress`);return Z(`info`,`${n}**Plan:** ${t.filter(e=>e.status===`completed`).length} of ${t.length} done${r?`; now: ${X(Y(r.text))}`:``}`)}case`review`:return Z(e.approved?`ok`:`warn`,`${n}**Review, attempt ${X(Y(e.attempt))}:** ${e.approved?`approved`:`changes asked`}. ${X(Y(e.summary),240)}`);case`attempt`:return Z(`warn`,`${n}**Attempt ${X(Y(e.attempt))} of ${X(Y(e.max))}:** ${X(Y(e.why),240)}`);case`answer`:return Z(`dim`,`${n}Attempt ${X(Y(e.attempt))}: ${X(Y(e.notes)||`changed ${(Array.isArray(e.changed)?e.changed:[]).map(Y).join(`, `)}`,240)}`);case`context`:return e.compacted?Z(`info`,`${n}Context compacted: the conversation was summarised to make room.`):null;default:return null}}function Io(e,t=``){switch(e.type){case`log`:return Z(e.level===`error`?`fail`:e.level===`warn`?`warn`:`dim`,`${t}${e.level===`warn`||e.level===`error`?`⚠ `:``}${X(Y(e.text))}`);case`step`:return Z(`dim`,`${t}**Step ${X(Y(e.step))}** · ${e.source===`memory`?`from memory`:X(Y(e.category))} · ${Ao(Y(e.title)||`untitled`,Y(e.url))}`);case`memory`:return Z(`info`,`${t}↻ ${X(Y(e.text))}`);case`thought`:return Po(`think`,`*${X(Y(e.text))}*`);case`outcome`:return Po(e.ok?`ok`:`fail`,`${e.ok?`✓`:`✗`} ${X(Y(e.text),300)}`);case`done`:{let n=J(e.result);return Z(n.status===`complete`?`ok`:`fail`,`${t}**${X(Y(n.status))}:** ${X(Y(n.summary))}`)}case`code`:return Fo(e,t);default:return null}}function Lo(e){switch(e.type){case`run-start`:return{tone:`info`,kind:`head`,md:`Browser run: ${X(Y(e.goal),200)}${e.url?` · ${Ao(Y(e.url).replace(/^https?:\/\//,``),Y(e.url))}`:``}`};case`run-event`:return Io(J(e.event));case`run-done`:{let t=J(e.result),n=!e.error&&(t.outcome===`passed`||!t.outcome&&t.status===`complete`);return Z(n?`ok`:`fail`,`${n?`✓`:`✗`} **Run ${n?`passed`:`failed`}**${Oo(e.ms)}: ${X(Y(e.error)||Y(t.summary))}${e.runDir?` · ${ko(Y(e.runDir))}`:``}`)}case`suite-start`:return{tone:`info`,kind:`head`,md:`Suite: ${(Array.isArray(e.cases)?e.cases:[]).length} cases, ${X(Y(e.parallel))} at once`};case`suite-event`:{let t=J(e.event);if(t.type===`case-start`)return Z(`info`,`**Case ${Number(t.index)+1} of ${X(Y(t.total))}:** ${jo(t.case)}`);if(t.type===`case-event`)return Io(J(t.event),`${ko(Y(J(t.case).id))} `);if(t.type===`case-done`){let e=J(t.result);return Z(e.status===`passed`?`ok`:`fail`,`${e.status===`passed`?`✓`:`✗`} ${jo(e.case)}: **${X(Y(e.status))}**${Oo(e.ms)}${e.summary?`. ${X(Y(e.summary),240)}`:``}`)}return t.type===`code-start`?Z(`info`,`${ko(Y(J(t.case).id))} writing its test`):t.type===`writeback`?Z(`dim`,`Posted the result back: ${X(JSON.stringify(t.item),240)}`):null}case`suite-done`:{let t=(Array.isArray(J(e.suite).results)?J(e.suite).results:[]).map(J),n=t.filter(e=>e.status===`passed`).length;return Z(n===t.length?`ok`:`fail`,`**Suite: ${n} of ${t.length} passed**${Oo(J(e.suite).ms)}`)}case`info`:return Z(e.ok===!1?`fail`:e.ok===!0?`ok`:`info`,X(Y(e.text)));case`agent`:return Fo(J(J(e.event)),`**Quill:** `);case`code-start`:return{tone:`info`,kind:`head`,md:`Writing a test: ${X(Y(e.goal),200)}`};case`code-done`:{let t=Y(J(e.result).status);return e.error?Z(`fail`,`✗ **Test not written**${Oo(e.ms)}: ${X(Y(e.error),240)}`):!t||t===`passed`?Z(`ok`,`✓ **Test written**${Oo(e.ms)}`):t===`stopped`?Z(`warn`,`**Test writing stopped**${Oo(e.ms)}`):Z(`fail`,`✗ **Test not finished**${Oo(e.ms)} (${X(t,40)})`)}case`card`:{let t=J(e.card),n=(Array.isArray(t.body)?t.body:[]).map(Y).filter(Boolean);return Z(t.status===`ok`?`ok`:t.status===`fail`?`fail`:`info`,`**${X(Y(t.title))}**${t.stats?` · ${X(Y(t.stats))}`:``}${n.length?`: ${X(n.join(`; `),300)}`:``}`)}case`report`:return Z(`ok`,`✓ Report saved: ${X(Y(e.title))}`);case`call-start`:return Z(`dim`,`→ ${X(Y(e.text),240)}`);case`call`:return Z(e.ok===!1?`warn`:`dim`,`${e.ok===!1?`⚠`:`✓`} ${X(Y(e.text),240)}`);default:return null}}function Ro(e){let t=Y(e.at)||Y(e.t),n=null;switch(e.type){case`user`:n=Z(`you`,`**You:** ${X(Eo(Y(e.text)),240)}`);break;case`agent`:n=Fo(J(e.event));break;case`tool`:n=Lo(J(e.event));break;case`ask`:n=Z(`you`,`**Asked:** ${X(Y(J(e.question).title))}`);break;case`wait`:n=Z(`you`,`**Waiting for you:** ${X(Y(e.prompt))}`);break;case`answered`:n=Z(`you`,`**You:** ${e.label===void 0?e.ok?`done, continue`:`cancel`:X(Y(e.label))}`);break;case`turn_done`:n=Z(e.outcome===`done`?`ok`:e.outcome===`stopped`?`warn`:`fail`,`**${e.outcome===`done`?`Done`:e.outcome===`stopped`?`Stopped`:e.outcome===`needs_input`?`Needs your input`:`Failed`}**${e.error?`: ${X(Y(e.error),300)}`:``}`);break;case`settings`:n=Z(`you`,`**Settings:** browser ${e.headed?`shown`:`headless`}, ${e.writeTests?`passed runs become tests`:`no tests written`}`);break;case`model`:n=Z(`you`,`**Model:** ${X(Y(J(e.profile).name),80)}`);break;case`settings_applied`:n=Z(`you`,`**Settings:** carried on with the settings as they are on disk now`);break;case`stderr`:n={tone:`dim`,kind:`out`,md:Y(e.text)};break;case`error`:n=Z(`warn`,`⚠ ${X(Y(e.message))}`);break;case`fatal`:n=Z(`fail`,`✗ **ForgeQE cannot go on:** ${X(Y(e.message))}`);break;case`exit`:n=Z(e.code===0?`dim`:`fail`,`ForgeQE stopped${e.code!==null&&e.code!==void 0?` (exit ${X(Y(e.code))})`:``}${e.message?`: ${X(Y(e.message))}`:``}`)}return n?{at:t,...n,plain:n.kind===`out`?n.md:No(n.md)}:null}var zo=new Intl.DateTimeFormat(`en-GB`,{day:`numeric`,month:`short`}),Bo=new Intl.DateTimeFormat(`en-GB`,{hour:`2-digit`,minute:`2-digit`,second:`2-digit`,hour12:!1});function Vo(e){let t=e?Date.parse(e):NaN;if(!Number.isFinite(t))return``;let n=new Date(t);return`${zo.format(n)} ${Bo.format(n)}`}function Ho(e,t){let n=t?[`## ${X(t,200)}`,``]:[],r=[],i=()=>{if(!r.length)return;let e=Math.max(2,...r.map(e=>Math.max(0,...(e.match(/`+/g)||[]).map(e=>e.length)))),t="`".repeat(e+1);n.push(``,`${t}text`,...r,t,``),r=[]};for(let t of e){let e=Vo(t.at),a=e?`\`${e}\``:``;t.kind===`out`?r.push(e?`${e} ${t.md}`:t.md):(i(),t.kind===`head`?n.push(``,`#### ${t.md}${a?` ${a}`:``}`,``):t.kind===`sub`?n.push(` - ${t.md}`):n.push(`- ${a?`${a} `:``}${t.md}`))}return i(),n.join(`
8
+ `).replace(/\n{3,}/g,`
9
+
10
+ `).trim()+`
11
+ `}var Uo=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0?e:void 0;function Wo(e){let t=Q(e),n=Uo(t.input),r=Uo(t.output);if(n===void 0||r===void 0)return;let i=Uo(t.cached),a=Uo(t.ms),o=Uo(t.premium);return{input:n,output:r,...i?{cached:i}:{},...a===void 0?{}:{ms:a},...o===void 0?t.copilot===!0?{copilot:!0}:{}:{premium:o}}}var Go=e=>{let t=Q(e);return typeof t.input==`number`&&typeof t.output==`number`?{input:t.input,output:t.output,cached:typeof t.cached==`number`?t.cached:void 0}:void 0};function Ko(e,t){let n=(e?.cached||0)+(t?.cached||0);return{input:(e?.input||0)+(t?.input||0),output:(e?.output||0)+(t?.output||0),...n?{cached:n}:{}}}var Q=e=>e&&typeof e==`object`&&!Array.isArray(e)?e:{},$=e=>typeof e==`string`?e:e==null?``:String(e),qo=[[/^(product_(knowledge|docs|code|runs?)|services|database_schema)$/,`Product knowledge`],[/^page_memory$/,`Memory`],[/^playbook$/,`Playbook`],[/^(requirements_file|trace_criteria)$/,`Requirements`],[/^read_confluence$/,`Confluence pages`],[/^read_mapping_file$/,`Mapping file`]],Jo={github:`GitHub`,gitlab:`GitLab`,azure_devops:`Azure DevOps`,atlassian:`Jira`,confluence:`Confluence`,notify:`Notifications`,sentry:`Sentry`,browserstack:`BrowserStack`,testmu:`TestMu`,dataverse:`Dataverse`,aws:`AWS`,azure:`Azure`,gcp:`Google Cloud`,postman:`Postman`},Yo=20;function Xo(e,t,n){let r=(e,t)=>{t&&e.length<Yo&&!e.includes(t)&&e.push(t)},i=t.toLowerCase();if(i===`skill`){let t=(n||``).trim();/^[\w.:-]{1,64}$/.test(t)&&r(e.skills,t);return}let a=i.replace(/^forgeqe_/,``),o=qo.find(([e])=>e.test(a));if(o)return r(e.knowledge,o[1]);if(Object.hasOwn(Jo,a))return r(e.systems,Jo[a]);let s=cs.find(([e])=>e.test(a))?.[1];s&&r(e.systems,s)}function Zo(e,t){let n=e=>typeof e==`number`&&Number.isFinite(e)&&e>=0?e:0,r=e.sections??=[];for(let e of Array.isArray(t.sections)?t.sections:[]){let t=$(e).replace(/\s+/g,` `).trim().slice(0,160);t&&r.length<Yo&&!r.includes(t)&&r.push(t)}let i=e.text??={sent:0,whole:0};i.sent+=n(t.sent),i.whole+=n(t.whole)}var Qo=[[/find_test_cases|story_test_cases|check_test_cases|list_sprints/,`Finding test cases`,`searching`],[/environment|logins/,`Preparing the environment`,`handing`],[/run_test_cases|browser_run|suite|run_goal|run_direct/,`Running in the browser`,`browsing`],[/comment_on_pr/,`Commenting on the pull request`,`working`],[/write_back|post_result|post_results|file_bugs|create_bugs/,`Posting the result`,`working`],[/heal_api_contracts/,`Healing the API contracts`,`retrying`],[/run_api_contracts/,`Running the API contracts`,`working`],[/run_api_scenarios/,`Running the API scenarios`,`working`],[/run_api_load/,`Load testing the API`,`working`],[/run_api_security/,`Checking the API's security`,`working`],[/api_find_calls/,`Looking up API calls`,`working`],[/api_delete_set/,`Deleting an API`,`working`],[/api_edit_call/,`Changing a call`,`working`],[/api_rename_folder/,`Renaming a folder`,`working`],[/api_move_calls/,`Moving calls`,`working`],[/api_contracts|api_new_set|api_add_calls|api_import_collection/,`Making API contracts`,`working`],[/write_test|heal/,`Writing the test`,`writing`],[/run_tests/,`Running the tests`,`working`],[/^(bash|shell)$/,`Running a command`,`working`],[/read_confluence|read|grep|glob|list|webfetch/,`Reading`,`reading`],[/edit|write|patch/,`Changing the code`,`writing`],[/task/,`Handing work to another agent`,`handing`]],$o=/^(test|attempt|info|review)$/,es=/run_test_cases|browser_run|run_suite|write_test/,ts=[[/(^|_)skill/,`skill`],[/code_element/,`element`],[/code_outline/,`outline`],[/code_references/,`references`],[/code_impact|(^|_)impact/,`impact`],[/code_find|find_tests/,`find`],[/code_test_file/,`testfile`],[/code_command|code_status|run_tests|bash|shell/,`run`],[/find_test_cases|story_test_cases|check_test_cases|list_sprints/,`cases`],[/environment|logins/,`environment`],[/run_test_cases|browser_run|suite|run_goal|run_direct/,`browser`],[/comment_on_pr|write_back|post_result|post_results|file_bugs|create_bugs/,`post`],[/grep|glob|search/,`search`],[/webfetch|websearch|fetch/,`web`],[/(^|_)list/,`list`],[/read/,`read`],[/edit|write|patch/,`edit`],[/task/,`task`]];function ns(e){let t=e.toLowerCase();return ts.find(([e])=>e.test(t))?.[1]??`work`}function rs(e){let t=/^(.*?\(attempt \d+\/\d+\))\s*:\s*([\s\S]+)$/.exec(e)??/^([^:\n]{1,160}?):\s+([\s\S]{40,})$/.exec(e),n=(t?t[1]:e).replace(/\s*\(attempt \d+\/\d+\)$/,``).replace(/(^|\s)(?:[\w.-]+[\\/])+([\w.-]+)/g,`$1$2`);return{summary:n.length>140?`${n.slice(0,139)}…`:n,detail:t?t[2].trim():``}}var is=[[/find_test_cases|story_test_cases|check_test_cases/,`forgeqe-find`],[/run_test_cases|browser_run|run_goal|run_direct|suite|explore_run/,`engine`],[/write_test/,`forgeqe-test`],[/heal(?!_api_contracts)/,`forgeqe-heal`],[/review_pr|pr_review/,`forgeqe-pr-review`],[/api_plan/,`forgeqe-api-plan`],[/write_api|api_test/,`forgeqe-api`],[/perf_write/,`forgeqe-perf`],[/explore_plan|plan_charters/,`forgeqe-explore-plan`],[/defect_rca|root_cause/,`forgeqe-defect-rca`],[/insights|forgeqe_bi|defect_intelligence/,`forgeqe-bi`],[/refine/,`forgeqe-refine`]];function as(e){let t=e.toLowerCase();if(!us(t))return is.find(([e])=>e.test(t))?.[1]}var os=[[/write_api_tests/,`forgeqe-api`,`Write the API tests`],[/perf_write/,`forgeqe-perf`,`Write the load test plan`],[/(?<!run_)api_scenarios$/,`forgeqe-api-plan`,`Plan the API scenarios`]];function ss(e){let t=e.toLowerCase();if(us(t))return;let n=os.find(([e])=>e.test(t));return n?{agent:n[1],task:n[2]}:void 0}var cs=[[/^(azure_devops|ado|azuredevops)_/,`Azure DevOps`],[/^(jira|atlassian)_/,`Jira`],[/^confluence_/,`Confluence`],[/^github_/,`GitHub`],[/^xray_/,`Xray`],[/^testrail_/,`TestRail`],[/^zephyr_/,`Zephyr Scale`],[/^qtest_/,`qTest`]],ls=/(^|_)(create|update|add|delete|remove|post|comment|link|unlink|upload|set|assign|transition|edit|merge|close|reopen|queue|trigger|run|push|move|copy|import|write|publish|approve|vote|lock|unlock)(_|$)/;function us(e){let t=e.toLowerCase();if(!t.startsWith(`forgeqe_`))return cs.find(([e])=>e.test(t))?.[1]}var ds=e=>{let t=Q(e);return typeof t.diff==`string`&&t.diff?{diff:t.diff,added:Number(t.added)||0,removed:Number(t.removed)||0}:void 0},fs=e=>Array.isArray(e)?e.map($).filter(Boolean):[];function ps(e,t,n){let r=$(e.status)||(t?`failed`:``);return{status:r,ok:!t&&/^(passed|pass|written|ok|known_defect)$/i.test(r),...$(e.testFile)?{testFile:$(e.testFile)}:{},...$(e.testName)?{testName:$(e.testName)}:{},...$(e.command)?{command:$(e.command)}:{},...typeof e.attempts==`number`?{attempts:e.attempts}:{},...typeof e.maxAttempts==`number`?{maxAttempts:e.maxAttempts}:{},changed:fs(e.changed),reused:fs(e.reused),...n?{runDir:n}:{},...t?{error:t}:{},...$(e.notes)?{notes:$(e.notes)}:{}}}function ms(e){if(!Array.isArray(e))return[];let t=[];for(let n of e){let e=Q(n),r=(typeof n==`string`?n:$(e.label)||$(e.request)).replace(/\s+/g,` `).trim(),i=(typeof n==`string`?n:$(e.request)||$(e.label)).trim();r&&i&&!t.some(e=>e.label.toLowerCase()===r.toLowerCase())&&t.push({label:r.length>60?`${r.slice(0,59)}…`:r,request:i})}return t.slice(0,4)}function hs(e){let t=e.toLowerCase(),n=us(t);if(n)return ls.test(t.replace(/^[a-z]+_/,``))?{label:`Updating ${n}`,orb:`working`}:{label:`Reading ${n}`,orb:`reading`};for(let[e,n,r]of Qo)if(e.test(t))return{label:n,orb:r};let r=t.replace(/^forgeqe_/,``).replace(/[_-]+/g,` `).trim();return{label:r?r[0].toUpperCase()+r.slice(1):`Working`,orb:`working`}}function gs(e,t){return{id:e,user:t,steps:[],parts:[],next:[],asks:[],waits:[],log:[],plan:[],changes:[],tests:[],reports:[],actions:[]}}function _s(e){let t=Q(e);return[$(t.id),$(t.title)].filter(Boolean).join(`: `)}function vs(e,t){if(!t)return;let n=e.trim();if(!n)return t;if(t.trim().toLowerCase()!==n.toLowerCase())return t.slice(0,n.length).toLowerCase()===n.toLowerCase()&&/^[\s:·—-]/.test(t.slice(n.length))?t.slice(n.length).replace(/^[\s:·—-]+/,``)||void 0:t}function ys(e){let t=e.split(`
12
+ `)[0].trim(),n=e.includes(`
13
+ `)?`${t} …`:t;return n.length>80?`${n.slice(0,79)}…`:n}function bs(e,t,n){let r=Q(e),i=typeof r.command==`string`?r.command:``;if(!i)return;let a=typeof r.exit==`number`&&Number.isInteger(r.exit)?r.exit:void 0,o=typeof r.output==`string`?r.output:``;return{arg:ys(i),step:{command:i,...o?{output:o}:{},shell:{...a===void 0?{}:{exit:a},...t?n===`running`?{started:t}:{ended:t}:{}}}}}function xs(e){let t=[],n=(e,r,i)=>{for(let a of e){let e=a.handoff?.agent||a.agent||r;if(a.shell&&a.command){let n=a.status===`running`?i?`running`:`stopped`:a.status===`fail`?`fail`:a.status===`ok`?`ok`:`stopped`;t.push({key:a.key,command:a.command,status:n,...a.shell.exit===void 0?{}:{exit:a.shell.exit},...e?{agent:e}:{},...a.shell.started?{started:a.shell.started}:{},...a.shell.ended?{ended:a.shell.ended}:{}})}a.children&&n(a.children,e,i)}};for(let t of e.turns)n(t.steps,void 0,!t.outcome&&!e.ended);return t}function Ss(e){let t={turns:[],notes:[]},n=new Map,r=e=>(typeof e==`string`?n.get(e):void 0)??t.turns.at(-1),i=(e,t)=>{let n=e=>{for(let r of e){if(r.key===t)return r;let e=r.children&&n(r.children);if(e)return e}};return n(e.steps)},a=(e,t,n)=>{let r={lines:[],...t},i=vs(r.label,r.arg);if(i?r.arg=i:delete r.arg,n)n.push(r);else{let t=e.plan.find(e=>e.status===`active`)??e.plan.find(e=>e.status===`pending`)??e.plan.at(-1);t&&(r.phase=t.text),e.steps.push(r)}return r},o=(e,t,n)=>{let r=t.parent?i(e,`c:${$(t.parent)}`):void 0;if(r)return r.children??=[];let o=$(t.agent);if(!o&&$o.test($(t.kind))){let t=e.steps.findLast(e=>e.status===`running`&&!!e.agent&&e.agent!==`forgeqe`);return t?s(t):void 0}if(!n||!o||o===`forgeqe`)return;let c=e.steps.findLast(e=>e.status===`running`);return c||=a(e,{key:`ag:${o}:${e.steps.length}`,label:M(o).name,status:`running`,orb:`handing`,agent:o}),c.agent??=o,s(c)},s=e=>{let t=e.children??=[],n=t.at(-1);return n&&n.key.startsWith(`try:`)&&n.status===`running`?n.children??=[]:t},c=(e,t)=>{let n=e?.children?.at(-1);if(!n||!n.key.startsWith(`try:`)||n.status!==`running`)return;let r=[...n.children||[]].reverse().find(e=>e.key.startsWith(`t:`)||!!e.review),i=t??(r?r.review?r.review.approved:r.status===`ok`:void 0);n.status=i===void 0?`info`:i?`ok`:`fail`},l,u=new Map,d=new Map,f=0,p=e=>{let n=t.agents??=[],r=n.find(t=>t.agent===e);return r||n.push(r={agent:e,usage:{input:0,output:0},at:0}),r.at=++f,r},m=(e,n,r,s)=>{let f=$(n.kind),m=$(n.id);if(f===`output`){let t=m?i(e,`c:${m}`):void 0;t?.shell&&t.status===`running`&&typeof n.text==`string`&&n.text&&(t.output=n.text);return}if((f===`start`||f===`tool`)&&es.test($(n.tool))&&!us($(n.tool)))return;let h=o(e,n,r),g=Q(n.delegate),_=$(n.tool)||$(n.text),v=$(g.agent)?{agent:$(g.agent),task:$(g.task)}:!r&&!h?ss($(n.tool)):void 0;if(f===`start`){if(v)a(e,{key:`c:${m}`,label:`Hands off to ${N(M(v.agent).name)}`,arg:v.task||void 0,status:`running`,orb:`handing`,agent:v.agent,handoff:v,children:[]},h);else{let{label:t,orb:r}=hs(_),i=h?void 0:as($(n.tool)),o=bs(n.shell,s,`running`);a(e,{key:`c:${m}`,label:t,arg:o?o.arg:$(n.text)&&$(n.text)!==$(n.tool)?$(n.text):void 0,status:`running`,orb:r,icon:ns(_),...i?{agent:i}:{},...o?o.step:{}},h)}}else if(f===`tool`){n.ok!==!1&&$(n.tool)&&Xo(t.uses??={skills:[],knowledge:[],systems:[]},$(n.tool),$(n.skill));let r=m?i(e,`c:${m}`):void 0,o=Q(n.file),c=ds(n.change);if(c&&$(o.path)){let t=e.changes.find(e=>e.path===$(o.path));t?Object.assign(t,{diff:`${t.diff}\n${c.diff}`,added:t.added+c.added,removed:t.removed+c.removed}):e.changes.push({path:$(o.path),...c,...$(n.agent)?{agent:$(n.agent)}:{}})}let l=bs(n.shell,s,`ended`);if(r)r.status=n.ok===!1?`fail`:`ok`,r.handoff&&$(g.result)&&(r.handoff.result=$(g.result)),l&&(r.command=l.step.command,r.shell={...r.shell,...l.step.shell},l.step.output?r.output=l.step.output:delete r.output);else if(v)a(e,{key:`c:${m||e.steps.length}`,label:`Hands off to ${N(M(v.agent).name)}`,arg:v.task||void 0,status:n.ok===!1?`fail`:`ok`,orb:`handing`,agent:v.agent,handoff:{...v,...$(g.result)?{result:$(g.result)}:{}},children:[]},h);else{let{label:t,orb:r}=hs(_),i=h?void 0:as($(n.tool));a(e,{key:`c:${m||e.steps.length}`,label:t,arg:l?l.arg:$(o.path)||$(n.text)||void 0,status:n.ok===!1?`fail`:`ok`,orb:r,icon:ns(_),...i?{agent:i}:{},...c?{change:c}:{},...l?l.step:{}},h)}r&&c&&(r.change=c)}else if(f===`stream`||f===`say`){if(r)return;let t=e.parts.find(e=>e.id===m);t?t.text=f===`say`?$(n.text):t.text+$(n.text):e.parts.push({id:m||`p${e.parts.length}`,text:$(n.text)})}else if(f===`plan`){if(h||n.agent&&n.agent!==`forgeqe`)return;let t=Array.isArray(n.items)?n.items.map(Q):[],r=e=>e===`completed`?`done`:e===`in_progress`?`active`:e===`cancelled`?`skipped`:`pending`;e.plan=t.map(e=>({text:$(e.text),status:r(e.status)})).filter(e=>e.text)}else if(f===`test`){let t=Number(n.attempt)||0;if(t>0){let{summary:r,detail:i}=rs($(n.text));a(e,{key:`t:${t}:${e.steps.length}`,label:`Test, attempt ${t}`,arg:r||void 0,status:n.ok?`ok`:`fail`,orb:`retrying`,icon:`test`,...i?{output:i}:{},...l?{command:l}:{}},h),l=void 0}else if(n.ok&&/\bconnected$/i.test($(n.text)))return;else a(e,{key:`t:${e.steps.length}`,label:$(n.text)||(n.ok?`Checked`:`Check failed`),status:n.ok?`ok`:`fail`,orb:/connect|mcp/i.test($(n.text))?`waiting`:`working`},h)}else if(f===`attempt`){let t=e.steps.findLast(e=>e.status===`running`&&!!e.agent&&e.agent!==`forgeqe`);if(!t)return;c(t);let r=$(n.fixing)||$(n.why);(t.children??=[]).push({key:`try:${$(n.attempt)}:${t.children.length}`,label:`Attempt ${$(n.attempt)} of ${$(n.max)}`,arg:r?r.length>120?`${r.slice(0,119)}…`:r:void 0,status:`running`,orb:`retrying`,icon:`retry`,lines:r.length>120?[{text:r}]:[],children:[]})}else if(f===`review`){let t=(Array.isArray(n.issues)?n.issues:[]).map(Q).map(e=>({kind:$(e.kind)===`standards`?`standards`:`correctness`,...$(e.file)?{file:$(e.file)}:{},problem:$(e.problem),...$(e.fix)?{fix:$(e.fix)}:{}})).filter(e=>e.problem).slice(0,20),r=n.approved===!0,i=(h??e.steps).length;a(e,{key:`r:${$(n.attempt)}:${i}`,label:r?`Review approved`:`Review asked for changes`,arg:t.length?`${t.length} ${t.length===1?`issue`:`issues`}`:void 0,status:r?`ok`:`fail`,orb:`thinking`,agent:`forgeqe-review`,icon:`review`,review:{approved:r,summary:$(n.summary),issues:t}},h)}else if(f===`context`||f===`usage`){let e=$(n.agent)||`forgeqe`,r=p(e);f===`context`&&typeof n.tokens==`number`&&typeof n.limit==`number`&&(r.context={tokens:n.tokens,limit:n.limit,compactsAt:typeof n.compactsAt==`number`?n.compactsAt:void 0},e===`forgeqe`&&(t.context=r.context));let i=f===`usage`?Go(n.usage):void 0;if(i){let n=u.get(e);n&&(i.input<n.input||i.output<n.output)&&d.set(e,Ko(d.get(e),n)),u.set(e,i),r.usage=Ko(d.get(e),i),t.usage=(t.agents||[]).reduce((e,t)=>Ko(e,t.usage),void 0)}}else if(f===`info`){let t=(h??e.steps).at(-1),r=/^ForgeQE runs the test:\s*([\s\S]+)$/.exec($(n.text));r?l=r[1].trim():t&&t.lines.push({text:$(n.text)})}},h,g=(e,n,r)=>{let o=$(n.type);if(o===`docs`)return Zo(t.uses??={skills:[],knowledge:[],systems:[]},n);if(o===`ui-action`){let t=lr(n);t&&!e.actions.some(e=>e.id===t.id)&&e.actions.push(t)}else if(o===`run-start`)a(e,{key:`run:${e.steps.length}`,label:`Running in the browser`,arg:$(n.goal),status:`running`,orb:`browsing`,agent:`engine`});else if(o===`run-event`){let t=e.steps.findLast(e=>e.key.startsWith(`run:`)),r=Q(n.event);if(!t)return;r.type===`outcome`?t.lines.push({text:`Step ${$(r.step)}: ${$(r.action)||$(r.text)}`,ok:r.ok===!0||r.ok!==!1&&void 0}):r.type===`log`&&(r.level!==`info`||r.progress)&&t.lines.push({text:$(r.text),ok:r.level!==`error`&&void 0})}else if(o===`run-done`){let t=e.steps.findLast(e=>e.key.startsWith(`run:`)&&e.status===`running`),r=Q(n.result),i=!n.error&&(r.outcome===`passed`||!r.outcome&&r.status===`complete`);if(t){t.status=i?`ok`:`fail`;let e=$(n.error)||$(r.summary);e&&t.lines.push({text:e,ok:!!i})}$(n.runDir)&&e.reports.push({label:i?`Browser run report`:`Browser run report (failed)`,path:$(n.runDir)})}else if(o===`suite-start`){let t=Array.isArray(n.cases)?n.cases:[];a(e,{key:`suite:${e.steps.length}`,label:`Running ${t.length} test case${t.length===1?``:`s`}`,status:`running`,orb:`working`,agent:`engine`})}else if(o===`suite-event`){let t=e.steps.findLast(e=>e.key.startsWith(`suite:`)),r=Q(n.event);if(t&&r.type===`case-done`){let e=Q(r.result);t.lines.push({text:`${_s(e.case)}: ${$(e.status)}`,ok:e.status===`passed`})}}else if(o===`suite-done`){let t=e.steps.findLast(e=>e.key.startsWith(`suite:`)),r=Array.isArray(Q(n.suite).results)?Q(n.suite).results.map(Q):[];if(t){let e=r.filter(e=>e.status!==`passed`).length;t.status=e?`fail`:`ok`,t.arg=`${r.length-e} of ${r.length} passed`}}else if(o===`card`){let t=Q(n.card);a(e,{key:`card:${e.steps.length}`,label:$(t.title),arg:$(t.stats)||void 0,status:t.status===`ok`?`ok`:t.status===`fail`?`fail`:`info`,orb:`working`,lines:(Array.isArray(t.body)?t.body:[]).map(e=>({text:$(e)}))})}else if(o===`call-start`&&!n.quiet)a(e,{key:`call:${$(n.id)}`,label:$(n.text),status:`running`,orb:`working`});else if(o===`call`&&!n.quiet){let t=n.id?i(e,`call:${$(n.id)}`):void 0;t?t.status=n.ok===!1?`fail`:`ok`:a(e,{key:`call:${e.steps.length}`,label:$(n.text),status:n.ok===!1?`fail`:`ok`,orb:`working`})}else if(o===`code-start`)h=$(n.runDir)||void 0,a(e,{key:`code:${e.steps.length}`,label:`Hands off to Quill`,arg:$(n.goal),status:`running`,orb:`writing`,agent:`forgeqe-test`,handoff:{agent:`forgeqe-test`,task:$(n.goal)},children:[]});else if(o===`code-done`){let t=e.steps.findLast(e=>e.key.startsWith(`code:`)&&e.status===`running`);c(t),t&&(t.status=n.error?`fail`:`ok`,n.error&&t.lines.push({text:$(n.error),ok:!1}));let r=[],i=(e=[])=>e.forEach(e=>(r.push(e),i(e.children)));i(t?.children);let a=r.filter(e=>e.key.startsWith(`t:`)),o=r.filter(e=>e.review);e.tests.push({...ps(Q(n.result),$(n.error),h),...t?{runs:a.length,failedRuns:a.filter(e=>e.status===`fail`).length,reviews:o.length}:{},...o.length?{review:o.at(-1).review}:{}}),h=void 0}else if(o===`agent`)m(e,Q(n.event),!0,r);else if(o===`info`){let t=e.steps.at(-1);t?t.lines.push({text:$(n.text),ok:n.ok===!0||n.ok!==!1&&void 0}):a(e,{key:`info:${e.steps.length}`,label:$(n.text),status:n.ok===!1?`fail`:`info`,orb:`working`})}else o===`report`&&(a(e,{key:`report:${e.steps.length}`,label:`Report saved`,arg:$(n.title),status:`ok`,orb:`working`}),$(n.html)&&e.reports.push({label:$(n.title)||`Report`,path:$(n.html)}))};for(let r of e){_(r);let e=Ro(r);e&&(typeof r.id==`string`&&n.get(r.id)||typeof r.turn==`string`&&n.get(r.turn)||t.turns.at(-1))?.log.push(e)}return t;function _(e){switch(e.type){case`user`:{let r=gs($(e.id),Eo($(e.text)));t.turns.push(r),n.set(r.id,r);break}case`ready`:{t.ended=void 0,t.fatal=void 0;let n=Q(e.profile);n.name&&(t.model={name:$(n.name),provider:$(n.provider)}),t.writeTests=e.writeTests!==!1,t.headed=e.headed===!0;break}case`models`:case`model`:{let n=Q(e.profile);n.name&&(t.model={name:$(n.name),provider:$(n.provider)}),e.type===`models`&&Array.isArray(e.models)&&(t.models=e.models.map(e=>({name:$(Q(e).name),provider:$(Q(e).provider)})).filter(e=>e.name));break}case`settings`:typeof e.writeTests==`boolean`&&(t.writeTests=e.writeTests),typeof e.headed==`boolean`&&(t.headed=e.headed);break;case`turn_start`:{let t=r(e.id);t&&(t.started=$(e.t)||$(e.at));break}case`agent`:{let t=r(e.id);t&&m(t,Q(e.event),!1,$(e.t)||void 0);break}case`tool`:{let t=r(e.id);t&&g(t,Q(e.event),$(e.t)||void 0);break}case`ask`:{let t=r(e.turn),n=Q(e.question);t?.asks.push({id:$(e.id),title:$(n.title),detail:$(n.detail)||void 0,lines:Array.isArray(n.lines)?n.lines.map($):[],options:(Array.isArray(n.options)?n.options:[]).map(e=>({id:$(Q(e).id),label:$(Q(e).label)}))});break}case`wait`:r(e.turn)?.waits.push({id:$(e.id),prompt:$(e.prompt)});break;case`answered`:for(let n of t.turns){let t=n.asks.find(t=>t.id===e.ask);t&&(t.answer=$(e.label));let r=n.waits.find(t=>t.id===e.ask);r&&(r.answer=e.ok===!0)}break;case`turn_done`:{let n=r(e.id);if(!n)break;n.outcome=e.outcome,n.reply=$(e.reply),n.next=ms(e.next),n.error=$(e.error)||void 0,n.ended=$(e.t)||$(e.at),n.spent=Wo(e.spent),t.agents?.length||(t.usage=Go(e.usage)??t.usage);let i=e=>{for(let t of e)t.status===`running`&&(t.status=n.outcome===`done`?`ok`:`info`),t.children&&i(t.children)};if(i(n.steps),n.outcome===`done`)for(let e of n.plan)e.status===`active`&&(e.status=`done`);break}case`error`:e.code!==`busy`&&t.notes.push($(e.message));break;case`fatal`:t.fatal=$(e.message);break;case`exit`:t.ended={code:typeof e.code==`number`?e.code:null,stderr:Array.isArray(e.stderr)?e.stderr.map($):void 0,message:$(e.message)||void 0}}}}function Cs(e){let t=e.asks.find(e=>e.answer===void 0),n=e.waits.find(e=>e.answer===void 0);if(t||n)return{text:`Waiting for you…`,orb:`waiting`};let r=e.steps.findLast(e=>e.status===`running`);return r?{text:`${r.label}…`,orb:r.orb}:e.parts.some(e=>e.text.trim())&&e.steps.length?{text:`Writing a reply…`,orb:`writing`}:{text:`Thinking…`,orb:`thinking`}}function ws(e){if(!e.started||!e.ended)return`Done`;let t=Math.max(1,Math.round((Date.parse(e.ended)-Date.parse(e.started))/1e3)),n=e.outcome===`stopped`?`Stopped after`:`Worked for`;return t<60?`${n} ${t} second${t===1?``:`s`}`:`${n} ${Math.floor(t/60)} min ${t%60} s`}function Ts(e){let t=Math.max(0,Math.round(e));for(let[e,n]of[[1e9,`B`],[1e6,`M`],[1e3,`K`]])if(t>=e*.99995)return`${(t/e).toFixed(1)}${n}`;return String(t)}function Es(e){if(e===0)return`included in your plan`;let t=Number(e.toFixed(2));return`${t} premium request${t===1?``:`s`}`}function Ds(e){if(e<6e4)return`${(Math.max(0,e)/1e3).toFixed(1)}s`;let t=Math.round(e/1e3);return t<3600?`${Math.floor(t/60)}m ${String(t%60).padStart(2,`0`)}s`:`${Math.floor(t/3600)}h ${String(Math.floor(t%3600/60)).padStart(2,`0`)}m`}function Os(e,t){let n=e?Date.parse(e):NaN;if(Number.isNaN(n))return``;let r=Math.max(0,Math.floor((t-n)/1e3)),i=Math.floor(r/3600),a=Math.floor(r%3600/60),o=String(r%60).padStart(2,`0`);return i?`${i}:${String(a).padStart(2,`0`)}:${o}`:`${a}:${o}`}var ks={running:`active`,ok:`done`,fail:`failed`,info:`note`};function As(e,t){let n=e=>e===`active`&&!t?`done`:e;if(!e.plan.length)return e.steps.map(e=>({key:e.key,label:e.label,status:n(ks[e.status]),steps:[],step:e}));let r=new Set(e.plan.map(e=>e.text)),i=new Map,a=``;for(let t of e.steps)t.phase&&r.has(t.phase)&&(a=t.phase),i.set(a,[...i.get(a)||[],t]);let o=e=>e.some(e=>e.status===`running`),s=[],c=i.get(``)||[];c.length&&s.push({key:`plan:start`,label:`Getting started`,status:n(o(c)?`active`:`done`),steps:c});let l=e.plan.map((e,n)=>{let r=i.get(e.text)||[],a=e.status===`done`?`done`:e.status===`skipped`?`skipped`:e.status===`active`||o(r)?`active`:`pending`;return{key:`plan:${n}`,label:e.text,status:a===`active`&&!t?`pending`:a,steps:r}});return[...s,...js(l)]}function js(e){let t=e.findIndex(e=>e.status===`active`);return t<0?e:e.map((e,n)=>e.status===`skipped`||e.status===`failed`||n===t?e:{...e,status:n<t?`done`:`pending`})}function Ms(e){let t=e.filter(e=>e.status===`running`).reverse(),n=e.filter(e=>e.status!==`running`).reverse();return[...t,...n].slice(0,Math.max(8,t.length))}var Ns=`forgeqe-sidebar-panels`,Ps={env:gt,chat:Ot,usage:We,background:ut,commands:sn,changes:Wt,outputs:Pe};function Fs(e){return null}function Is(){let[e,t]=(0,R.useState)(()=>{try{let e=JSON.parse(localStorage.getItem(Ns)||`{}`);return e&&typeof e==`object`&&!Array.isArray(e)?Object.fromEntries(Object.entries(e).filter(([,e])=>typeof e==`boolean`)):{}}catch{return{}}}),n=(t,n)=>e[t]??n;return[n,(r,i)=>{let a={...e,[r]:!n(r,i)};t(a);try{localStorage.setItem(Ns,JSON.stringify(a))}catch{}}]}function Ls({children:e}){let[t,n]=Is(),r=R.Children.toArray(e).filter(e=>(0,R.isValidElement)(e)&&e.type===Fs).map(e=>e.props),a=r.map(e=>t(e.id,e.initial??!0));return(0,z.jsx)(`div`,{className:`flex flex-col`,children:r.map((e,t)=>{let o=a[t],s=t===0||a[t-1],c=t===r.length-1||a[t+1];return(0,z.jsxs)(`section`,{"aria-labelledby":`panel-${e.id}`,className:h(f,`overflow-hidden transition-[margin,border-radius] duration-200 ease-out motion-reduce:transition-none`,o?h(`rounded-lg`,t>0&&`mt-2`,t<r.length-1&&`mb-2`):h(t>0&&!a[t-1]&&`mt-px`,s?`rounded-t-lg`:`rounded-t-sm`,c?`rounded-b-lg`:`rounded-b-sm`)),children:[(0,z.jsx)(`h3`,{id:`panel-${e.id}`,className:`m-0`,children:(0,z.jsxs)(`button`,{type:`button`,"aria-expanded":o,onClick:()=>n(e.id,e.initial??!0),className:h(i,`min-h-11 gap-2 rounded-none px-2 py-1 font-medium`),children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-6 flex-none items-center justify-center`,children:(0,z.jsx)(I,{icon:Ps[e.id]??_t,size:16})}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),e.count!==void 0&&(0,z.jsx)(`span`,{className:`flex-none text-body-sm font-normal text-muted tabular-nums`,children:e.count}),(0,z.jsx)(Fe,{size:14,"aria-hidden":`true`,className:h(`flex-none text-muted transition-transform duration-200`,!o&&`-rotate-90`)})]})}),(0,z.jsx)(Ln,{open:o,className:`flex flex-col px-1 pb-2`,children:e.children})]},e.id)})})}function Rs({icon:e,label:t,value:n,detail:r,to:a,title:o,onClick:s,open:c,muted:l}){let u=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`flex size-6 flex-none items-center justify-center`,children:(0,z.jsx)(I,{icon:e,size:16,className:`text-muted`})}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,z.jsx)(`span`,{className:`text-label-md text-muted`,children:t}),(0,z.jsx)(`span`,{className:h(`truncate text-body-sm font-medium`,l?`text-muted`:`text-ink`),children:n}),r&&(0,z.jsx)(`span`,{className:`truncate text-body-sm text-muted`,children:r})]}),(a||s)&&(0,z.jsx)(Xe,{size:14,"aria-hidden":`true`,className:h(`flex-none text-muted transition-transform duration-200 motion-reduce:transition-none`,c&&`rotate-90`)})]}),d=[n,r,o].filter(Boolean).join(` · `),f=`group min-h-11 items-center gap-2 px-1 py-2`;return s?(0,z.jsx)(`button`,{type:`button`,"aria-expanded":c,"data-tip":d,onClick:s,className:h(i,f),children:u}):a?(0,z.jsx)(`a`,{href:a,"data-tip":d,className:h(i,f),children:u}):(0,z.jsx)(`div`,{"data-tip":d,className:h(`flex w-full text-left`,f),children:u})}var zs=e=>`Tokens used, added up over every model call: ${eo(e)}. Each call reads the conversation so far again, so this grows past the context window.`,Bs=`How much of the model's context window the conversation fills now. It drops when the conversation is compacted.`;function Vs({title:e,n:t,to:n}){let r=(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`span`,{className:`flex-1`,children:e}),t!==void 0&&(0,z.jsx)(`span`,{className:`tabular-nums`,children:t})]}),i=`flex min-h-7 items-end gap-2 px-2 pb-1 text-label-md text-muted`;return n?(0,z.jsx)(`a`,{href:n,"data-tip":`Open ${e}`,className:h(i,`no-underline hover:text-ink`),children:r}):(0,z.jsx)(`span`,{className:i,children:r})}function Hs({icon:e,text:t,value:n,tip:r}){return(0,z.jsxs)(`li`,{"data-tip":r??t,className:`flex min-h-7 items-center gap-2 px-2`,children:[(0,z.jsx)(`span`,{className:`flex size-4 flex-none items-center justify-center text-muted`,"aria-hidden":`true`,children:e}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-sm text-ink`,children:t}),n!==void 0&&(0,z.jsx)(`span`,{className:`flex-none text-body-sm text-ink tabular-nums`,children:n})]})}function Us({a:e,working:t}){let n=M(e.agent),r=e.context&&e.context.limit>0?e.context:null,i=r?Math.min(1,r.tokens/r.limit):0,a=r?r.tokens>=(r.compactsAt??r.limit*.8):!1;return(0,z.jsxs)(`li`,{className:`flex flex-col gap-1 px-2 py-1`,children:[(0,z.jsxs)(`span`,{className:`flex min-h-6 items-center gap-2`,"data-tip":zs(e.usage),children:[(0,z.jsx)(C,{agent:e.agent,px:16,decorative:!0,working:t}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-body-sm text-ink`,children:n.name}),(0,z.jsx)(`span`,{className:`flex-none text-body-sm text-ink tabular-nums`,children:U(e.usage.input+e.usage.output)})]}),r&&(0,z.jsxs)(`span`,{className:`flex items-center gap-2 pl-6`,"data-tip":`${Bs} ${U(r.tokens)} of ${U(r.limit)}.`,"aria-label":`Context ${Math.round(i*100)}% full: ${U(r.tokens)} of ${U(r.limit)}`,children:[(0,z.jsx)(me,{share:i,marks:[],fill:a?`bg-warn`:`bg-accent`,className:`h-1 flex-1`}),(0,z.jsxs)(`span`,{className:h(`w-10 flex-none text-right text-label-sm tabular-nums`,a?`text-warn`:`text-muted`),children:[Math.round(i*100),`%`]})]})]})}var Ws=[{id:`skills`,label:`Skills`,to:n(`skills`),icon:e=>(0,z.jsx)(Js,{name:e})},{id:`knowledge`,label:`Knowledge`,to:n(`knowledge`,`notes`),icon:()=>(0,z.jsx)(I,{icon:un,size:14})},{id:`sections`,label:`Document sections`,to:n(`knowledge`,`notes`),icon:()=>(0,z.jsx)(I,{icon:Vt,size:14})},{id:`systems`,label:`Systems`,icon:()=>(0,z.jsx)(I,{icon:gt,size:14})}];function Gs(e,t,n){let r=e.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean),i=e=>r.map(t=>Object.hasOwn(e,t)?e[t]:void 0).find(Boolean);return i(t)??i(n)}var Ks=()=>(0,z.jsx)(I,{icon:Pt,size:14}),qs=(0,R.lazy)(()=>p(()=>import(`./logos-P2LOMyTK.js`).then(e=>e.c).then(e=>({default:({name:t})=>{let n=Gs(t,e.FRAMEWORK_LOGOS,e.LANGUAGE_LOGOS);return n?(0,z.jsx)(n,{width:15,height:15,"aria-hidden":`true`}):(0,z.jsx)(Ks,{})}})),__vite__mapDeps([7,2,3,8,9,5])));function Js({name:e}){return(0,z.jsx)(R.Suspense,{fallback:(0,z.jsx)(Ks,{}),children:(0,z.jsx)(qs,{name:e})})}function Ys({uses:e}){let t=Ws.map(t=>({...t,names:e?.[t.id]||[]})).filter(e=>e.names.length);return(0,z.jsx)(z.Fragment,{children:t.map(t=>(0,z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,z.jsx)(Vs,{title:t.label,n:t.names.length,...t.to?{to:t.to}:{}}),(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:t.names.map(e=>(0,z.jsx)(Hs,{icon:t.icon(e),text:e},e))}),t.id===`sections`&&e?.text&&e.text.whole>e.text.sent&&(0,z.jsxs)(`span`,{"data-tip":`${e.text.sent.toLocaleString()} of ${e.text.whole.toLocaleString()} characters`,className:`px-2 pl-8 text-body-sm text-muted`,children:[Math.round((1-e.text.sent/e.text.whole)*100),`% less text than the whole documents`]})]},t.id))})}function Xs({value:e,max:t,warnAt:n,label:r}){return(0,z.jsx)(de,{value:e,limit:t,warnAt:n&&t>0?Math.min(1,n/t):.8,label:r,className:`mt-1`})}var Zs=e=>{try{return e?new URL(e).host:``}catch{return``}},Qs=e=>e.split(/[\\/]/).filter(Boolean).pop()||e;function $s({path:e,icon:t,extra:n}){let[r,a]=(0,R.useState)(``);return(0,z.jsxs)(`li`,{className:`flex flex-col`,children:[(0,z.jsxs)(`button`,{type:`button`,"data-tip":`Open ${e}`,onClick:async()=>a(await ve(e)),className:h(i,`min-h-8 gap-2 py-0`),children:[(0,z.jsx)(I,{icon:t,size:15,className:`flex-none text-muted`}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-mono text-body-sm text-accent-fg`,children:Qs(e)}),n]}),r&&(0,z.jsx)(`span`,{className:`px-4 text-body-sm text-fail`,children:r})]})}function ec(e,t){let n=e?Date.parse(e):NaN,r=t?Date.parse(t):NaN;if(Number.isNaN(n)||Number.isNaN(r))return``;let i=Math.max(0,Math.round((r-n)/1e3));return i<60?`${i}s`:`${Math.floor(i/60)} min`}function tc({c:e}){let t=e.status===`running`?nc(e.started):ec(e.started,e.ended),n=e.status===`running`?`Running`:e.status===`ok`?`Done`:e.status===`stopped`?`Stopped`:e.exit===void 0?`Failed`:`Exit code ${e.exit}`;return(0,z.jsx)(`li`,{children:(0,z.jsxs)(`div`,{tabIndex:0,"data-tip":e.command,"aria-label":`${e.command}. ${n}${t?`, ${t}`:``}`,className:`flex items-start gap-2 px-4 py-2`,children:[e.status===`running`?(0,z.jsx)(tn,{size:15,"aria-hidden":`true`,className:`mt-1 flex-none animate-spin text-accent-fg motion-reduce:animate-none`}):(0,z.jsx)(I,{icon:e.status===`ok`?Je:yn,size:15,className:h(`mt-1 flex-none`,e.status===`ok`?`text-pass`:e.status===`fail`?`text-fail`:`text-muted`)}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,z.jsx)(`span`,{className:`truncate font-mono text-body-sm text-ink`,children:ys(e.command)}),(0,z.jsx)(`span`,{className:`text-body-sm text-muted`,children:[e.agent?M(e.agent).name:``,n,t].filter(Boolean).join(` · `)})]})]})})}function nc(e){let t=e?Date.parse(e):NaN;if(Number.isNaN(t))return``;let n=Math.max(0,Math.round((Date.now()-t)/1e3));return n<60?`${n}s`:`${Math.floor(n/60)} min`}function rc({chat:e}){let[t,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(null),[o,s]=(0,R.useState)(null),[c,l]=(0,R.useState)(!1),[u,d]=(0,R.useState)([]);(0,R.useEffect)(()=>{let e=!1,t=()=>re.list().then(t=>!e&&d(t.tasks),()=>{});t();let n=Fn(t,4e3);return()=>{e=!0,In(n)}},[]);let f=location.hash.replace(/^#\/?/,``),p=e?.commands??[],g=Ms(p),_=u.filter(e=>e.to!==f);(0,R.useEffect)(()=>{let e=!1,t=()=>se.state().then(t=>{if(!e){if(r(t),!t.ready)return a(null);ie.get().then(t=>!e&&a(t),()=>{})}},()=>{});return t(),window.addEventListener(`hashchange`,t),()=>{e=!0,window.removeEventListener(`hashchange`,t)}},[]),(0,R.useEffect)(()=>{if(!t?.ready)return;let n=!1,r=()=>P.tokenomics().then(e=>!n&&s(e),()=>{});r();let i=Fn(r,e?.busy?3e4:18e4);return()=>{n=!0,In(i)}},[t?.ready,t?.project,e?.busy]);let v=t?t.project.split(/[\\/]/).filter(Boolean).pop()||t.project:``,y=i?.codeRepo||i?.repo,b=y?.branch?y.branch:y?.commit?`Commit ${y.commit}`:void 0,x=!!y?.branch&&!i?.codeRepo&&y.name===v,S=o?.days.find(e=>e.day===new Date().toISOString().slice(0,10)),C=i?.environment,w=(e,t)=>({tokens:e.input+e.output,cost:t&&e.amount?G(e.amount,t):void 0}),T=o?.project?`Today counts every model call made for this project: chats, runs and the agents they started.`:`Today counts this project's test runs.`,E=o?.project?w(o.project.today,o.project.currency):S?w(S,o?.currency):void 0,D=o?o.project?{tokens:o.project.days30.input+o.project.days30.output,cost:o.project.currency&&o.project.days30.amount?G(o.project.days30.amount,o.project.currency):void 0,title:`Every model call made for this project in the last 30 days.`}:{tokens:o.totals.input+o.totals.output,cost:o.currency&&o.totals.amount?G(o.totals.amount,o.currency):void 0,title:`Test runs of this project in the last 30 days.`}:void 0;return(0,z.jsxs)(Ls,{children:[(0,z.jsx)(Fs,{id:`env`,title:`Environment`,initial:!1,children:(0,z.jsxs)(`div`,{className:`flex flex-col gap-1 py-1`,children:[(0,z.jsx)(Rs,{icon:je,label:`Project`,value:t?.ready?v:`Not set up`,muted:!t?.ready,to:n(`settings`,`setup`),title:t?.project}),i&&(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(Rs,{icon:Ft,label:i.codeRepo?`Tests go to`:x?`Branch`:`Repository`,value:y?x&&b?b:y.name:`Not a git repository`,muted:!y,detail:x?void 0:y?.branch?`Branch ${y.branch}`:b,title:y?`${y.root}${y.commit?` @ ${y.commit}`:``}`:void 0,to:n(`settings`,`tests`)}),(0,z.jsx)(Rs,{icon:gt,label:`Test environment`,value:C?.active?C.active:C?.names.length?`None active`:`None yet`,muted:!C?.active,detail:C?.active&&Zs(C.startUrl)||void 0,title:C?.names.length?`${C.names.length} environment${C.names.length===1?``:`s`}: ${C.names.join(`, `)}${C.apps.length?`. Apps: ${C.apps.join(`, `)}`:``}`:void 0,to:n(`settings`,`environments`)}),(0,z.jsx)(Rs,{icon:Ct,label:`Files`,value:`${i.files.filter(e=>e.exists).length} of ${i.files.length} set up`,onClick:()=>l(!c),open:c}),(0,z.jsx)(Ln,{open:c,children:(0,z.jsx)(`ul`,{className:`m-0 mb-1 ml-8 flex list-none flex-col gap-1 p-0`,children:i.files.map(e=>(0,z.jsx)(`li`,{children:(0,z.jsxs)(`a`,{href:n(`settings`,`files`),"data-tip":e.path,className:h(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`min-h-0 flex-col items-start gap-0 px-1 py-1`,!e.exists&&`opacity-60`),children:[(0,z.jsx)(`span`,{className:`text-body-sm text-muted`,children:e.label}),(0,z.jsx)(`span`,{className:`truncate font-mono text-body-sm text-ink`,children:e.path})]})},e.label))})})]})]})}),e&&(0,z.jsx)(Fs,{id:`chat`,title:`This chat`,children:(0,z.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[e.agents?.length&&e.usage?(0,z.jsxs)(z.Fragment,{children:[(0,z.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[(0,z.jsx)(Hs,{icon:(0,z.jsx)(I,{icon:We,size:14}),text:`Tokens used`,value:(0,z.jsx)(`span`,{className:`font-medium`,children:U(e.usage.input+e.usage.output)}),tip:zs(e.usage)}),(0,z.jsxs)(`li`,{"data-tip":eo(e.usage),className:`truncate px-2 pl-8 text-body-sm text-muted tabular-nums`,children:[U(e.usage.input),` read · `,U(e.usage.output),` written`]})]}),(0,z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,z.jsx)(Vs,{title:`Agents`,n:e.agents.length}),(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.agents.toSorted((e,t)=>t.at-e.at).map((t,n)=>(0,z.jsx)(Us,{a:t,working:!!e.busy&&n===0},t.agent))})]})]}):(0,z.jsx)(`p`,{className:`m-0 px-2 py-1 text-body-sm text-muted`,children:e.busy?`Counted as soon as the agent's first model call comes back.`:`No model calls in this chat yet.`}),(0,z.jsx)(Ys,{uses:e.uses})]})}),t?.ready&&(0,z.jsx)(Fs,{id:`usage`,title:`This project`,children:(0,z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,z.jsxs)(`a`,{href:n(`settings`,`tokenomics`),"data-tip":`${D?.title??``} ${T} Open Tokenomics for more.`.trim(),className:h(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`grid grid-cols-2 gap-0 overflow-hidden p-0`),children:[(0,z.jsx)(B,{compact:!0,label:`Last 30 days`,value:D?U(D.tokens):`–`,note:D?.cost?`tokens · ${D.cost}`:`tokens`,className:`border-b-0 px-2`}),(0,z.jsx)(B,{compact:!0,label:`Today`,value:o?U(E?.tokens??0):`–`,note:E?.cost?`tokens · ${E.cost}`:`tokens`,className:`border-b-0 px-2`}),(0,z.jsx)(`span`,{className:`sr-only`,children:`Open Tokenomics`})]}),o?.spent&&o.budget?.month?(0,z.jsxs)(`div`,{className:`px-2 py-2`,children:[(0,z.jsxs)(`span`,{className:`flex items-baseline gap-2 text-body-sm text-muted`,children:[(0,z.jsx)(`span`,{className:`flex-1`,children:`This month, this computer`}),(0,z.jsxs)(`span`,{className:`text-ink tabular-nums`,children:[G(o.spent.month,o.spent.currency),` of `,G(o.budget.month,o.budget.currency||o.spent.currency)]})]}),(0,z.jsx)(Xs,{value:o.spent.month,max:o.budget.month,label:`This month's spend`})]}):null]})}),_.length>0&&(0,z.jsx)(Fs,{id:`background`,title:`Background tasks`,count:_.length,children:(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:_.map((e,t)=>(0,z.jsx)(`li`,{children:(0,z.jsxs)(`a`,{href:n(...e.to.split(`/`).filter(Boolean)),className:h(`flex w-full min-h-11 cursor-pointer items-center gap-4 rounded-base border-0 bg-transparent px-4 py-2 text-left text-body-sm text-ink no-underline transition-colors duration-150 hover:bg-tint hover:text-ink aria-[current]:bg-tint-hover aria-selected:bg-tint-hover aria-pressed:bg-tint-hover aria-checked:bg-tint-hover has-[:checked]:bg-tint-hover disabled:cursor-not-allowed disabled:opacity-50`,`items-start gap-2`),children:[(0,z.jsx)(tn,{size:15,"aria-hidden":`true`,className:`mt-1 flex-none animate-spin text-accent-fg motion-reduce:animate-none`}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,z.jsx)(`span`,{className:`truncate text-body-sm text-ink`,children:e.label}),(0,z.jsxs)(`span`,{className:`text-body-sm text-muted`,children:[e.detail||`Running`,nc(e.startedAt)&&` · ${nc(e.startedAt)}`]})]})]})},`${e.kind}-${t}`))})}),p.length>0&&(0,z.jsxs)(Fs,{id:`commands`,title:`Commands`,count:p.length,children:[(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:g.map(e=>(0,z.jsx)(tc,{c:e},e.key))}),p.length>g.length&&(0,z.jsxs)(`span`,{className:`px-4 pb-1 text-body-sm text-muted`,children:[m(p.length-g.length,`earlier command`),` in the chat`]})]}),e?.changes&&e.changes.length>0&&(0,z.jsxs)(Fs,{id:`changes`,title:`Changes`,count:e.changes.length,children:[(0,z.jsxs)(`span`,{className:`px-4 pb-1 font-mono text-body-sm tabular-nums`,children:[m(e.changes.length,`file`),` · `,(0,z.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.changes.reduce((e,t)=>e+t.added,0)]}),` `,(0,z.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.changes.reduce((e,t)=>e+t.removed,0)]})]}),(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.changes.map(e=>(0,z.jsx)($s,{path:e.path,icon:Wt,extra:(0,z.jsxs)(`span`,{className:`flex-none font-mono text-body-sm tabular-nums`,children:[(0,z.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,z.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})},e.path))}),e.onCreatePr&&(0,z.jsx)(`div`,{className:`px-2 pt-2 pb-1`,children:(0,z.jsxs)(L,{size:`sm`,variant:`primary`,disabled:e.busy,"data-tip":e.busy?`When ForgeQE has finished`:`Ask ForgeQE to open a pull request with these changes`,onClick:e.onCreatePr,className:`w-full justify-center`,children:[(0,z.jsx)(et,{"aria-hidden":`true`}),`Pull request`]})})]}),e?.outputs&&e.outputs.length>0&&(0,z.jsx)(Fs,{id:`outputs`,title:`Outputs`,count:e.outputs.length,children:(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.outputs.map(e=>(0,z.jsx)($s,{path:e.path,icon:e.kind===`test`?Ct:/\.html?$/i.test(e.path)?Bt:e.kind===`report`?Pe:un,extra:(0,z.jsx)(`span`,{className:`flex-none text-body-sm text-muted`,children:e.label})},e.path))})})]})}var ic=24;function ac(e,t,n){if(!t||!n||e.length<t*n*4)return null;let r=(e,n)=>(n*t+e)*4,i=[r(0,0),r(t-1,0),r(0,n-1),r(t-1,n-1)],a=i.every(t=>e[t+3]>=250),o=a&&i.every(t=>[0,1,2].every(n=>Math.abs(e[t+n]-e[i[0]+n])<=ic));if(a&&!o)return null;let s=[0,1,2].map(t=>e[i[0]+t]),c=t=>a?[0,1,2].every(n=>Math.abs(e[t+n]-s[n])<=ic):e[t+3]<16,l=t,u=n,d=-1,f=-1;for(let e=0;e<n;e++)for(let n=0;n<t;n++)c(r(n,e))||(n<l&&(l=n),n>d&&(d=n),e<u&&(u=e),e>f&&(f=e));if(d<0)return null;let p=Math.round(Math.max(d-l+1,f-u+1)*.02),m={x:Math.max(0,l-p),y:Math.max(0,u-p),w:0,h:0};return m.w=Math.min(t,d+1+p)-m.x,m.h=Math.min(n,f+1+p)-m.y,m.w>=t*.96&&m.h>=n*.96?null:m}function oc(e){return new Promise((t,n)=>{let r=new Image;r.onload=()=>t(r),r.onerror=()=>n(Error(`The logo could not be read.`)),r.src=e})}function sc(e){let t=e.naturalWidth||0,n=e.naturalHeight||0;if(!t||!n)return null;let r=Math.min(1,1024/Math.max(t,n))||1,i=document.createElement(`canvas`);i.width=Math.max(1,Math.round(t*r)),i.height=Math.max(1,Math.round(n*r));let a=i.getContext(`2d`,{willReadFrequently:!0});return a?(a.drawImage(e,0,0,i.width,i.height),{canvas:i,ctx:a}):null}async function cc(e){let t=sc(await oc(e));if(!t)return null;let{canvas:n,ctx:r}=t,i=ac(r.getImageData(0,0,n.width,n.height).data,n.width,n.height);if(!i)return null;let a=document.createElement(`canvas`);return a.width=i.w,a.height=i.h,a.getContext(`2d`)?.drawImage(n,i.x,i.y,i.w,i.h,0,0,i.w,i.h),a}var lc=new Map;function uc(e){return lc.has(e)||lc.set(e,cc(e).then(t=>t?t.toDataURL(`image/png`):e).catch(()=>e)),lc.get(e)}var dc=20971520,fc=[1,.75,.5,.35],pc=[[`image/png`,void 0],[`image/webp`,.92],[`image/webp`,.8]];async function mc(e,t){for(let n of fc)for(let[r,i]of pc){let a=await e(n,r,i);if(a&&a.type===r&&a.size<=t)return a}return null}function hc(e){return new Promise((t,n)=>{let r=new FileReader;r.onload=()=>t(String(r.result)),r.onerror=()=>n(r.error??Error(`the file could not be read`)),r.readAsDataURL(e)})}var gc={"image/png":`.png`,"image/webp":`.webp`};async function _c(e,t){let n=t=>new File([t],e.name.replace(/\.[^.]+$/,``)+gc[t.type],{type:t.type});if(e.size>t){if(e.type===`image/svg+xml`)throw Error(`${e.name} is over ${t/1024} KB.`);if(e.size>20971520)throw Error(`${e.name} is over ${dc/1024/1024} MB: save a smaller copy and upload that.`);let r=await oc(await hc(e)).catch(()=>null),i=r&&sc(r);if(!i)throw Error(`${e.name} could not be read: save it again as PNG or JPEG and upload that.`);let{canvas:a,ctx:o}=i,s=ac(o.getImageData(0,0,a.width,a.height).data,a.width,a.height)??{x:0,y:0,w:a.width,h:a.height},c=await mc((e,t,n)=>{let r=document.createElement(`canvas`);r.width=Math.max(1,Math.round(s.w*e)),r.height=Math.max(1,Math.round(s.h*e));let i=r.getContext(`2d`);return i?(i.imageSmoothingQuality=`high`,i.drawImage(a,s.x,s.y,s.w,s.h,0,0,r.width,r.height),new Promise(e=>r.toBlob(e,t,n))):Promise.resolve(null)},t);if(!c)throw Error(`${e.name} could not be made smaller than ${t/1024} KB: save a smaller copy and upload that.`);return n(c)}try{let r=await cc(await hc(e));if(!r)return e;let i=await new Promise(e=>r.toBlob(e,`image/png`));return!i||i.size>t?e:n(i)}catch{return e}}var vc=`/assets/forgeqe-logo-D3CwM2Jl.png`,yc=`/assets/forgeqe-logo-white-CoE-hF2l.png`,bc=`/assets/forgeqe-mark-ZLd4S3hw.png`;function xc(e){let[t,n]=(0,R.useState)({});return(0,R.useEffect)(()=>{if(!e)return;let t=!0;return uc(e).then(r=>t&&n({from:e,to:r})),()=>{t=!1}},[e]),e&&t.from===e?t.to:e}var Sc=e=>`#${e.map(e=>Math.round(e).toString(16).padStart(2,`0`)).join(``)}`;function Cc(e){try{let t=document.createElement(`canvas`);t.width=t.height=32;let n=t.getContext(`2d`,{willReadFrequently:!0});if(!n)return null;n.drawImage(e,0,0,32,32);let r=n.getImageData(0,0,32,32).data,i=(e,t)=>[...r.subarray((t*32+e)*4,(t*32+e)*4+4)],a=[i(1,1),i(30,1),i(1,30),i(30,30)];if(a.every(e=>e[3]>=200))return{kind:`background`,colour:Sc([0,1,2].map(e=>a.reduce((t,n)=>t+n[e],0)/4))};let o=[0,0,0],s=0;for(let e=0;e<r.length;e+=4)if(r[e+3]>=200){for(let t=0;t<3;t++)o[t]+=r[e+t];s++}return s?{kind:`ink`,colour:Sc(o.map(e=>e/s))}:null}catch{return null}}var wc=`h-auto w-auto min-h-10 max-h-[112px] max-w-full object-contain`,Tc=`h-11 w-auto max-w-[168px] object-contain object-left`;function Ec({aspect:e,alone:t,own:n,size:r,circle:i}){let a=e>1.6,o=a||t;if(n&&(!r||r===`auto`))return o?!a&&(e<=1.25||i)?{cls:i?`size-14 rounded-full object-cover`:`size-14 object-contain`,grow:!1,auto:!0}:{cls:wc,grow:!0,auto:!0}:{cls:i?`size-10 rounded-full object-cover`:`size-10 object-contain`,grow:!1,auto:!0};let s=r===`large`;return i?{cls:`${t?s?`size-16`:`size-11`:s?`size-12`:`size-8`} rounded-full object-cover`,grow:!1,auto:!1}:o?{cls:s?wc:Tc,grow:s,auto:!1}:{cls:s?`size-12 object-contain`:`size-8 object-contain`,grow:!1,auto:!1}}function Dc({theme:e,compact:t=!1,onPlate:n}){let{mode:r}=D(),i=r===`dark`?yc:vc,a=xc(e.logo)||i,[o,s]=(0,R.useState)(e.logo?1:2.1),[c,l]=(0,R.useState)(null),u=o>1.6,d=Ec({aspect:o,alone:!!e.logo&&!e.name,own:!!e.logo,size:t?`standard`:e.logoSize,circle:e.logoFrame===`circle`&&!u}),f=d.auto&&!e.logoFrame&&c?.kind===`background`,p=e.logo&&e.logoFrame!==`tile`&&!f?T(c,_(e,r)):null,m=f&&!!T(c,_(e,r));(0,R.useEffect)(()=>n?.(!!p),[p,n]);let g=e.logo?e.logoFrame===`circle`&&u?`rounded`:e.logoFrame||(d.auto&&c?.kind===`background`?`rounded`:`plain`):`plain`,v=d.cls,y=(0,z.jsx)(`img`,{src:a,alt:``,onLoad:e=>{let t=e.currentTarget;t.naturalWidth&&t.naturalHeight&&s(t.naturalWidth/t.naturalHeight),l(Cc(t))},className:h(`block min-w-0`,d.grow?`flex-initial`:`flex-none`,v,g===`rounded`&&`overflow-hidden rounded-sm`,m&&`shadow-[0_0_0_1px_rgb(0_0_0/0.12)]`)});return(0,z.jsxs)(`span`,{className:h(`flex min-w-0 items-center gap-2`,d.grow&&`flex-1`),children:[g===`tile`||p?(0,z.jsx)(`span`,{style:p?{background:p}:void 0,className:h(`flex items-center justify-center rounded-base p-2`,!p&&`bg-white shadow-[0_0_0_1px_rgb(0_0_0/0.06)]`,d.grow?`min-w-0 flex-initial`:`flex-none`),children:y}):y,!u&&e.name&&(0,z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.name})]})}function Oc({theme:e}){let{mode:t}=D(),[n,r]=(0,R.useState)(1),[i,a]=(0,R.useState)(null),o=xc(e.logoMark||e.logo),s=!!o&&(!!e.logoMark||n<=1.6),c=s?T(i,_(e,t)):null;return s?(0,z.jsx)(`span`,{style:c?{background:c}:void 0,className:h(`flex size-9 items-center justify-center rounded-base`,c&&`p-1`),children:(0,z.jsx)(`img`,{src:o,alt:``,onLoad:e=>{let t=e.currentTarget;t.naturalWidth&&t.naturalHeight&&r(t.naturalWidth/t.naturalHeight),a(Cc(t))},className:h(`block size-full object-contain`,e.logoFrame===`circle`?`rounded-full`:`rounded-sm`)})}):(0,z.jsxs)(`span`,{"aria-hidden":`true`,className:`flex size-9 items-center justify-center`,children:[(0,z.jsx)(`img`,{src:bc,alt:``,className:`block size-9 object-contain`}),o&&!e.logoMark&&(0,z.jsx)(`img`,{src:o,alt:``,className:`hidden`,onLoad:e=>e.currentTarget.naturalHeight&&r(e.currentTarget.naturalWidth/e.currentTarget.naturalHeight)})]})}var kc=`/assets/capgemini-mark-D6aZFnD3.png`,Ac=`m 153.2175,21.2782 c 3.4962,0 6.1962,-2.8462 6.2312,-6.225 -0.245,-1.475 -0.7625,-4.2037 -4.585,-4.2037 -4.19,0 -5.5762,5.8487 -8.985,9.6237 -0.2737,2.1438 -2.305,4.0625 -4.8387,4.385 0.62,0.6488 2.0025,1.0013 3.6525,1.0013 3.0175,0 6.67,-0.9088 8.5837,-2.7988 -2.5537,0.035 -4.1937,-1.6062 -4.355,-3.8762 1.245,1.5087 2.6513,2.0937 4.2963,2.0937`,jc=`m 126.3725,11.972 c 0,-1.86 -0.1125,-3.1 -1.3288,-3.1 -0.5562,0 -0.825,0.1125 -1.3087,0.2725 0.43,6.28 -0.9913,11.8125 -2.7238,11.8125 -2.2712,0 -1.1387,-13.4625 -5.9475,-13.4625 -4.4387,0 -5.0787,10.7475 -5.5812,10.7475 -0.3425,0 -0.395,-2.8225 -0.3763,-4.9763 0.1863,-1.03 0.2888,-1.9575 0.2888,-2.6612 0,-1 -0.41,-2.7288 -2.6813,-1.865 0.079,7.6862 -1.46,12.3287 -3.1937,12.3287 -2.5388,0 -2.5675,-6.9675 -2.5675,-8.8862 0,-1.875 0.1362,-4.38 -2.6513,-3.4913 -0.415,6.7038 -2.1737,11.7625 -3.2812,11.7625 -1.6513,0 -1.3188,-11.5812 -4.8888,-11.5812 -3.2125,0 -4.2037,10.9712 -4.8725,10.9712 -1.1962,0 0.3763,-12.3487 -4.2625,-12.3487 -2.4312,0 -3.3987,4.1212 -4.3512,8.735 -0.185,0.8937 -0.375,0.9237 -0.41,-0.087 -0.024,-0.8588 -0.029,-1.7238 -0.019,-2.5825 1.1663,-4.6388 -0.2587,-6.3525 -2.4075,-5.1175 0.6938,8.56 -3.2375,12.7437 -6.25,12.7437 -1.0887,0 -1.9487,-0.4637 -2.5875,-1.1962 3.6125,-2.2163 5.2188,-4.76 5.2188,-7.2463 0,-2.69 -1.5475,-4.2425 -4.1163,-4.2425 -3.5837,0 -5.59,3.6913 -5.59,6.8313 0,1.6887 0.3175,3.125 0.835,4.3062 -1.2312,0.5863 -2.3925,1.0938 -3.4725,1.5863 -0.098,-3.2275 -0.4587,-6.615 -0.7362,-9.745 -1.91,-0.5275 -2.4663,0.39 -2.6125,2.0887 -0.3425,3.8775 -1.7775,6.285 -3.0475,6.285 -0.9525,0 -1.5375,-1.1625 -1.6063,-2.3975 -0.3562,-6.2162 4.6875,-7.945 7.3288,-7.0412 0.5475,-1.3725 -0.054,-2.3588 -2.4363,-2.3588 -2.8862,0 -5.0437,1.7538 -6.6262,4.0038 -1.0538,1.5 -2.275,2.5637 -3.8963,3.8487 0.044,-0.3662 0.064,-0.7375 0.064,-1.1037 0,-4.38 -2.3738,-6.3038 -4.6388,-6.3038 -1.875,0 -3.0562,1.1225 -3.74,2.8513 -0.1662,-1.7338 -0.5125,-2.48 -1.5187,-2.48 -0.43,0 -1.03,0.1212 -1.67,0.4337 0.2925,0.9675 0.405,3.1113 0.405,4.5175 0,5.2675 -1.5088,7.6313 -2.9588,7.6313 -1.66,0 -1.9237,-6.25 -2.065,-8.6813 -0.2587,-0.098 -0.5325,-0.1512 -0.8112,-0.1512 -1.5038,0 -1.6988,2.0162 -2.07,3.8712 -0.41,2.0563 -1.5913,4.6388 -3.345,4.6388 -1.0588,0 -1.7238,-1.02 -1.8063,-2.8563 -0.1712,-3.725 2.93,-8.14 7.7788,-6.7675 0.6337,-1.4837 -0.3625,-2.6125 -2.3738,-2.6125 -3.545,0 -6.475,2.6513 -7.7537,5.7913 -1.2988,2.8812 -3.57,7.11 -8.1888,7.11 C 6.26,21.7975 3.76,18.95 3.76,12.9787 c 0,-5.1462 3.2462,-10.035 6.7087,-10.035 2.4213,0 2.9838,2.3838 2.7688,4.62 1.255,1.005 3.31,0.067 3.31,-2.4462 0,-1.7338 -1.4063,-4.6738 -5.9513,-4.6738 C 4.9712,0.4437 0,6.055 0,13.4225 0,20.5612 3.6225,24.78 8.75,24.78 c 3.2375,0 6.2887,-1.845 8.3937,-5.2538 0.5325,2.9838 2.5638,4.2388 4.0863,4.2388 2.4662,0 4.0775,-1.5975 4.9562,-3.755 0.5475,2.1625 1.7038,3.765 3.6288,3.765 1.3525,0 2.4112,-0.6888 3.2075,-1.7875 -0.3175,7.5187 -0.7125,12.3137 3.73,11.3725 -0.6875,-2.1388 -0.9075,-6.0313 -0.9075,-9.5275 0,-9.565 1.5775,-12.7138 3.555,-12.7138 1.435,0 1.8987,1.825 1.8987,3.7738 0,1.045 -0.1025,2.2462 -0.3662,3.325 -2.4313,1.5337 -4.37,2.745 -4.37,4.2825 0,1.2162 0.9037,1.3275 1.685,1.3275 1.865,0 4.1112,-1.83 5.3512,-5.2825 1.0838,-0.6588 2.1725,-1.4113 3.2125,-2.4363 -0.034,0.3513 -0.054,0.7025 -0.054,1.0638 0,3.4275 1.4987,5.5037 3.8962,5.5037 1.88,0 3.2863,-1.3337 4.2825,-3.33 0.064,1.1513 0.1025,2.2113 0.1175,3.1825 -3.8087,1.7638 -8.0225,3.55 -8.0225,8.5213 0,2.5725 1.855,4.5062 4.2725,4.5062 5.3075,0 6.5188,-5.6 6.5675,-12.1087 1.7288,-0.7475 3.0125,-1.3238 4.4975,-2.0613 1.2688,1.5925 2.9975,2.3888 4.58,2.3888 2.9925,0 5.2438,-1.5875 7.05,-4.805 0.3175,2.4462 0.9525,4.805 2.2563,4.805 2.3725,0 2.8562,-12.4125 4.6187,-12.4125 1.3525,0 0.245,13.4275 3.8138,13.4275 3.0562,0 3.6275,-11.8163 5.1175,-11.8163 1.055,0 1.1325,10.8013 4.4625,10.8013 1.6362,0 3.4137,-1.9688 4.3012,-6.09 0.42,2.745 1.8025,6.09 4.5075,6.09 1.5775,0 2.935,-1.5975 3.9838,-3.7163 0.2887,2.1825 0.9037,3.7163 2.1,3.7163 3.11,0 3.0075,-12.3838 5.4687,-12.3838 1.9188,0 1.3288,12.3838 5.8988,12.3838 2.1725,0 3.2025,-1.8513 3.8187,-4.18 0.8388,3.4225 2.2013,4.18 3.315,4.18 0.7075,0 1.245,-0.25 1.9488,-1.085 -3.5363,-1.5325 -3.2375,-7.1138 -3.2375,-10.7175 m -74.8438,21.27 c -1.0987,0 -1.68,-1.045 -1.68,-2.2225 0,-3.1788 2.3338,-4.8625 5.205,-6.3125 -0.1275,6.9425 -1.7437,8.535 -3.525,8.535 m 14.2775,-22.51 c 1.0688,0 1.6788,0.9812 1.5713,2.3925 -0.1213,1.655 -1.3275,3.555 -3.4275,5.0437 -1.0938,-3.115 -0.2775,-7.4362 1.8562,-7.4362 M 99.6722,6.035 c 1.0162,-0.034 1.7287,-0.9075 1.7337,-1.9475 0.01,-1.04 -0.6987,-1.8613 -1.7187,-1.8225 -1.02,0.035 -1.85,0.9087 -1.855,1.9487 -0.01,1.04 0.82,1.855 1.84,1.8213 m 25.3325,0.5275 c 0.9275,-0.034 1.685,-0.8638 1.685,-1.855 0,-0.9913 -0.7425,-1.7675 -1.67,-1.7388 -0.9288,0.034 -1.685,0.8688 -1.69,1.86 -0.01,0.9913 0.7475,1.7675 1.675,1.7338 m 34.4387,8.2425 c -0.079,-3.9263 -1.9437,-7.2363 -4.825,-9.8788 -2.1875,-1.9962 -4.785,-3.515 -7.5087,-4.6575 -0.215,-0.092 -0.44,-0.1812 -0.66,-0.2687 -3.3538,4.0187 -14.965,7.0162 -14.965,15.44 0,3.29 2.08,6.3712 5.1312,7.6075 1.7725,0.6687 3.54,0.7025 5.3125,0.1062 1.5775,-0.5175 2.8713,-1.4937 3.95,-2.68 3.4088,-3.775 4.795,-9.6187 8.98,-9.6187 3.8275,0 4.345,2.7237 4.59,4.1987 0,-0.01 0,-0.1075 -0.01,-0.2487`;function Mc({rail:e=!1}){let{mode:t}=D();return e?(0,z.jsx)(`img`,{src:kc,alt:`Capgemini`,"data-tip":`Capgemini`,"data-tip-side":`left`,className:`mb-1 size-8 flex-none object-contain`}):(0,z.jsxs)(`svg`,{viewBox:`-1.06668594 -1.06668594 161.58207188 37.68956988`,role:`img`,"aria-label":`Capgemini`,className:`ml-2 h-8 w-auto max-w-[180px] flex-none overflow-visible`,shapeRendering:`geometricPrecision`,children:[(0,z.jsx)(`path`,{fill:t===`dark`?`#fff`:`#12ABDB`,fillRule:`evenodd`,d:Ac}),(0,z.jsx)(`path`,{fill:t===`dark`?`#fff`:`#0070AD`,fillRule:`evenodd`,d:jc})]})}function Nc({item:e}){return e.agent?(0,z.jsx)(C,{agent:e.agent,px:18,decorative:!0}):(0,z.jsx)(d,{name:b[e.id]||x[e.id]||`feature`,px:18})}var Pc={id:`settings`,label:`Settings`};function Fc(){let e=(e,t,n,r,i)=>({id:e,label:t,meta:n,href:r,words:i,kind:`page`});return[...On.filter(e=>e.item.path[0]!==`settings`).map(t=>e(t.item.id,t.item.label,`${t.category.label} · ${t.area.label}`,En(t.item),[t.item.words,t.item.about].filter(Boolean).join(` `))),e(Pc.id,Pc.label,`Every setting`,n(Pc.id))]}var Ic=Fc(),Lc=(0,R.lazy)(()=>p(()=>import(`./CommandPalette-B7YPDCOk.js`),__vite__mapDeps([10,2,3,11,8,9,12,4,5,13,0,1,6]))),Rc=()=>typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent),zc=()=>Rc()?`⌘K`:`Ctrl K`;function Bc({route:e}){let{find:t}=(0,R.useContext)(Wc),n=Sa(e);return(0,z.jsxs)(`header`,{className:`hidden h-(--top-bar) flex-none items-center gap-6 bg-canvas px-8 md:flex`,children:[(0,z.jsx)(`nav`,{"aria-label":`Where you are`,className:`flex min-w-0 flex-[1_1_0] items-center gap-2 text-body-sm`,children:n&&(0,z.jsxs)(z.Fragment,{children:[[n.parent,...n.middle?[n.middle]:[]].map(e=>(0,z.jsxs)(R.Fragment,{children:[e.href?(0,z.jsx)(`a`,{href:e.href,className:`flex-none text-muted no-underline hover:text-ink`,children:e.label}):(0,z.jsx)(`span`,{className:`flex-none text-muted`,children:e.label}),(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted`,children:`/`})]},e.href??e.label)),n.here.href?(0,z.jsx)(`a`,{href:n.here.href,"aria-current":`page`,className:`min-w-0 truncate font-medium text-ink no-underline hover:text-accent-fg`,children:n.here.label}):(0,z.jsx)(`span`,{"aria-current":`page`,className:`min-w-0 truncate font-medium text-ink`,children:n.here.label})]})}),(0,z.jsxs)(L,{variant:`field`,onClick:t,"aria-keyshortcuts":Rc()?`Meta+K`:`Control+K`,"aria-label":`Search pages, agents and settings`,className:`w-full max-w-[560px] flex-[0_1_560px]`,children:[(0,z.jsx)(He,{size:16,strokeWidth:1.8,"aria-hidden":`true`,className:`text-icon`}),(0,z.jsx)(`span`,{className:`flex-1 truncate text-left`,children:`Search`}),(0,z.jsx)(Fi,{children:zc()})]}),(0,z.jsx)(`span`,{className:`flex-[1_1_0]`,"aria-hidden":`true`})]})}function Vc(){let{find:e}=(0,R.useContext)(Wc);return(0,z.jsx)(L,{variant:`icon`,size:`icon`,"aria-label":`Search (${zc()})`,"data-tip":`Search`,onClick:e,className:`size-9 flex-none`,children:(0,z.jsx)(He,{strokeWidth:1.8,"aria-hidden":`true`})})}var Hc=_a,Uc=va,Wc=(0,R.createContext)({hidden:!1,open:()=>{},setChat:()=>{},find:()=>{}});function Gc(e){let{setChat:t}=(0,R.useContext)(Wc),n=JSON.stringify(e);(0,R.useEffect)(()=>(t(e),()=>t(null)),[n,t])}var Kc=`forgeqe-sidebar`,qc=()=>{try{return localStorage.getItem(Kc)===`closed`}catch{return!1}};function Jc({className:e}){let{open:t}=(0,R.useContext)(Wc);return(0,z.jsx)(L,{variant:`icon`,size:`icon`,"aria-label":`Open the sidebar`,"data-tip":`Open the sidebar`,onClick:t,className:h(`inline-flex md:hidden`,e),children:(0,z.jsx)(Me,{strokeWidth:1.8,"aria-hidden":`true`})})}function Yc(){return(0,z.jsxs)(`div`,{className:`theme-side sticky top-0 z-20 flex items-center gap-1 px-4 py-2 md:hidden`,children:[(0,z.jsx)(Jc,{}),(0,z.jsx)(`span`,{className:`ml-1 flex min-w-0 flex-1`,children:(0,z.jsx)(ml,{compact:!0})}),(0,z.jsx)(Vc,{})]})}function Xc({item:e,current:t}){let r=t===e.id;return(0,z.jsxs)(`a`,{href:n(e.id),"aria-current":r?`page`:void 0,className:h(Hc,Uc(r)),children:[(0,z.jsx)(Nc,{item:e}),(0,z.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label})]})}function Zc({current:e,rail:t=!1}){let r=!e;return t?(0,z.jsx)(`a`,{href:n(),"aria-label":`New chat`,"data-tip":`New chat`,"data-tip-side":`right`,"aria-current":r?`page`:void 0,className:h(ol,`mt-2`,r&&`bg-(--side-current-bg) text-(--side-current-ink) hover:bg-(--side-current-bg) hover:text-(--side-current-ink)`),children:(0,z.jsx)(zt,{strokeWidth:1.8,"aria-hidden":`true`,className:`size-[18px]`})}):(0,z.jsxs)(`a`,{href:n(),"aria-current":r?`page`:void 0,className:h(Hc,Uc(r)),children:[(0,z.jsx)(zt,{strokeWidth:1.8,"aria-hidden":`true`,className:`size-[18px]`}),`New chat`]})}function Qc(e){let t=Dn(e);return t&&t.item.path.length?{category:t.category.id,area:bn(t.area)?t.area.id:void 0}:{}}var $c=`forgeqe-sidebar-unfold`;function el(e){let t=`c:${e}`;try{let e=nl(localStorage.getItem(tl));e.includes(t)||localStorage.setItem(tl,JSON.stringify([...e,t]))}catch{}window.dispatchEvent(new CustomEvent($c,{detail:t}))}var tl=`forgeqe-sidebar-open`;function nl(e){let t=new Set([...Tn.flatMap(e=>[`c:${e.id}`,...e.areas.map(t=>`a:${e.id}/${t.id}`)])]);try{let n=JSON.parse(e||`[]`);return Array.isArray(n)?[...new Set(n.filter(e=>typeof e==`string`&&t.has(e)))]:[]}catch{return[]}}var rl=()=>{try{return nl(localStorage.getItem(tl))}catch{return[]}};function il(e){let t=Qc(e);return[t.category&&`c:${t.category}`,t.category&&t.area&&`a:${t.category}/${t.area}`].filter(e=>!!e)}function al({current:e,route:t,place:n=t,onClose:r}){let i=t.join(`/`),a=n.join(`/`),[o,s]=(0,R.useState)(()=>new Set([...rl(),...il(n)])),c=(0,R.useRef)(a);(0,R.useEffect)(()=>{if(c.current===a)return;c.current=a;let e=il(n);if(e.length){s(new Set(e));try{localStorage.setItem(tl,JSON.stringify(e))}catch{}}},[i,a]),(0,R.useEffect)(()=>{let e=e=>{let t=nl(JSON.stringify([e.detail]))[0];t&&s(e=>e.has(t)?e:new Set([...e,t]))};return window.addEventListener($c,e),()=>window.removeEventListener($c,e)},[]);let l=e=>t=>s(n=>{let r=new Set(n);t?r.add(e):r.delete(e);try{localStorage.setItem(tl,JSON.stringify([...r]))}catch{}return r}),{pins:u,toggle:f}=Cn(),p=Dn(n)?.item.id,m=u.map(e=>On.find(t=>t.item.id===e)).filter(e=>!!e),h=e=>p===e.id&&!(e.id===`chats`&&t[1]),g=e=>{let t=u.includes(e.id),n=`${t?`Unpin`:`Pin`} ${e.label}`;return(0,z.jsx)(L,{variant:`icon`,size:`icon`,"aria-label":n,"aria-pressed":t,"data-tip":n,"data-tip-side":`right`,onClick:()=>f(e.id),className:`absolute top-1/2 right-1 z-20 size-6 -translate-y-1/2 text-muted opacity-0 group-hover:opacity-100 hover:text-ink focus-visible:opacity-100`,children:(0,z.jsx)(St,{size:13,strokeWidth:1.8,fill:t?`currentColor`:`none`,"aria-hidden":`true`})})},_=e=>(0,z.jsx)(ua,{href:En(e),label:e.label,current:h(e),icon:(0,z.jsx)(d,{name:e.icon,px:18}),after:g(e)},e.id),v=e=>(0,z.jsx)(ua,{href:En(e),label:e.label,current:p===e.id,icon:(0,z.jsx)(d,{name:e.icon,px:18}),after:g(e)},e.id);return(0,z.jsxs)(`nav`,{"aria-label":`ForgeQE`,className:`theme-side flex h-full w-[248px] min-[1440px]:w-[264px] flex-col px-4 py-4 short:py-2`,children:[(0,z.jsxs)(`div`,{className:`flex min-h-10 items-center gap-1 pl-2`,children:[(0,z.jsx)(ml,{}),(0,z.jsx)(L,{variant:`icon`,size:`icon`,"aria-label":`Close the sidebar`,"data-tip":`Close the sidebar`,onClick:r,className:`size-8 flex-none`,children:(0,z.jsx)(Ie,{strokeWidth:1.8,"aria-hidden":`true`})})]}),(0,z.jsx)(`div`,{className:`mt-4 flex flex-col gap-px short:mt-2`,children:(0,z.jsx)(Zc,{current:e})}),(0,z.jsx)(`div`,{className:`-mx-4 mt-2 flex min-h-0 flex-1 flex-col overflow-y-auto px-4 pb-6 [mask-image:linear-gradient(to_bottom,black_calc(100%-28px),transparent)]`,children:(0,z.jsxs)(ga,{routeKey:`${i}|${a}`,className:`gap-4 short:gap-2`,children:[(0,z.jsx)(pa,{label:`Pinned`,children:m.length?m.map(e=>v(e.item)):(0,z.jsx)(`span`,{className:`px-2 text-body-sm text-muted`,children:`Star a page below to pin it here.`})}),(0,z.jsxs)(`div`,{className:`flex flex-col gap-px`,children:[(0,z.jsx)(`span`,{className:`flex h-7 short:h-6 items-center px-2 text-body-sm font-medium text-muted`,children:`Browse`}),Tn.map(e=>(0,z.jsx)(ha,{label:e.label,icon:(0,z.jsx)(d,{name:e.icon,px:18}),lines:ra,open:o.has(`c:${e.id}`),onOpenChange:l(`c:${e.id}`),children:e.areas.map(t=>bn(t)?(0,z.jsx)(ma,{label:t.label,badge:!o.has(`a:${e.id}/${t.id}`)&&(0,z.jsx)(`span`,{className:`text-body-sm text-muted tabular-nums`,children:Sn(t).length}),open:o.has(`a:${e.id}/${t.id}`),onOpenChange:l(`a:${e.id}/${t.id}`),children:Sn(t).map(_)},t.id):Sn(t).map(_))},e.id))]})]})}),(0,z.jsxs)(`div`,{className:`flex flex-none items-center gap-1 pt-2 short:pt-1`,children:[(0,z.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,z.jsx)(Xc,{item:Pc,current:e})}),(0,z.jsx)(ll,{}),(0,z.jsx)(dl,{icon:!0})]})]})}var ol=h(ue({variant:`icon`,size:`icon`}),`size-9 flex-none`);function sl({item:e,current:t}){let r=t===e.id;return(0,z.jsx)(`a`,{href:n(e.id),"aria-current":r?`page`:void 0,"aria-label":e.label,"data-tip":e.label,"data-tip-side":`right`,className:h(ol,r&&`bg-(--side-current-bg) text-(--side-current-ink) hover:bg-(--side-current-bg) hover:text-(--side-current-ink)`),children:(0,z.jsx)(Nc,{item:e})})}function cl({current:e,route:t,onOpen:r}){let{theme:i}=D(),{pins:a}=Cn(),o=i.name||`ForgeQE`,s=Dn(t),c=s?.item.path.length?s.category.id:``,l=(e,t,n,r)=>(0,z.jsx)(`a`,{href:e,"aria-current":r?`page`:void 0,"aria-label":t,"data-tip":t,"data-tip-side":`right`,className:h(ol,r&&`bg-(--side-current-bg) text-(--side-current-ink) hover:bg-(--side-current-bg) hover:text-(--side-current-ink)`),children:(0,z.jsx)(d,{name:n,px:18})},e),u=a.map(e=>On.find(t=>t.item.id===e)).filter(e=>!!e);return(0,z.jsxs)(`nav`,{"aria-label":`ForgeQE`,className:`theme-side flex h-full w-16 flex-col items-center gap-px py-4`,children:[(0,z.jsx)(`a`,{href:n(),"aria-label":`${o}, home`,"data-tip":o,"data-tip-side":`right`,className:`mb-1 flex min-h-10 items-center justify-center no-underline`,children:(0,z.jsx)(Oc,{theme:i})}),(0,z.jsx)(L,{variant:`icon`,size:`icon`,"aria-label":`Open the sidebar`,"data-tip":`Open the sidebar`,"data-tip-side":`right`,onClick:r,className:`size-9`,children:(0,z.jsx)(Me,{strokeWidth:1.8,"aria-hidden":`true`})}),(0,z.jsx)(Zc,{current:e,rail:!0}),(0,z.jsxs)(`div`,{className:`flex min-h-0 flex-1 flex-col items-center gap-px overflow-y-auto`,children:[(0,z.jsxs)(`div`,{role:`group`,"aria-label":`Browse`,className:`flex flex-col items-center gap-px`,children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`my-2 h-px w-6 bg-line`}),Tn.map(e=>(0,z.jsx)(`button`,{type:`button`,"aria-label":e.label,"data-tip":e.label,"data-tip-side":`right`,"aria-current":c===e.id?`true`:void 0,onClick:()=>{el(e.id),r()},className:h(ol,`cursor-pointer`,c===e.id&&`bg-(--side-current-bg) text-(--side-current-ink) hover:bg-(--side-current-bg) hover:text-(--side-current-ink)`),children:(0,z.jsx)(d,{name:e.icon,px:18})},e.id))]}),u.length>0&&(0,z.jsxs)(`div`,{role:`group`,"aria-label":`Pinned`,className:`flex flex-col items-center gap-px`,children:[(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`my-2 h-px w-6 bg-line`}),u.map(e=>l(En(e.item),e.item.label,e.item.icon,s?.item.id===e.item.id))]})]}),(0,z.jsxs)(`div`,{className:`flex flex-none flex-col items-center gap-px pt-2`,children:[(0,z.jsx)(ll,{rail:!0}),(0,z.jsx)(dl,{icon:!0,rail:!0}),(0,z.jsx)(sl,{item:Pc,current:e})]})]})}function ll({rail:e=!1}){return(0,z.jsx)(`a`,{href:`/help/guide`,target:`_blank`,rel:`noreferrer noopener`,"aria-label":`Help`,"data-tip":`Help`,"data-tip-side":e?`right`:void 0,className:ol,children:(0,z.jsx)(d,{name:b.help,px:18})})}var ul=[{id:`system`,label:`System`},{id:`light`,label:`Light`},{id:`dark`,label:`Dark`}];function dl({icon:e=!1,rail:t=!1}){let{choice:n,setChoice:r}=D(),i=ul.findIndex(e=>e.id===n),a=ul[i],o=ul[(i+1)%ul.length],s=`Dark/Light: now ${a.label===`System`?`as the computer is`:a.label.toLowerCase()}. Switch to ${o.label===`System`?`as the computer is`:o.label.toLowerCase()}`;return(0,z.jsxs)(`button`,{type:`button`,"aria-label":s,"data-tip":s,"data-tip-side":t?`right`:void 0,onClick:()=>r(o.id),className:e?ol:h(Hc,Uc(!1),`w-full cursor-pointer border-0 bg-transparent text-left`),children:[(0,z.jsx)(d,{name:b.theme,px:18}),!e&&(0,z.jsxs)(`span`,{className:`flex flex-1 items-baseline justify-between gap-2`,children:[`Dark/Light`,(0,z.jsx)(`span`,{className:`text-body-sm text-muted`,children:a.label===`System`?`Auto`:a.label})]})]})}function fl(e){return[{id:`env`,label:`Environment`},...e?[{id:`chat`,label:`This chat`}]:[],{id:`usage`,label:`This project`},...e?.commands?.length?[{id:`commands`,label:`Commands · ${e.commands.length}`}]:[],...e?.changes?.length?[{id:`changes`,label:`Changes · ${e.changes.length}`}]:[],...e?.outputs?.length?[{id:`outputs`,label:`Outputs · ${e.outputs.length}`}]:[]]}function pl({stats:e,onOpen:t}){return(0,z.jsxs)(`aside`,{"aria-label":`Workspace`,className:`flex h-full w-14 flex-col items-center gap-1 bg-canvas py-4`,children:[(0,z.jsx)(Mc,{rail:!0}),(0,z.jsx)(L,{variant:`icon`,size:`icon`,"aria-label":`Show the workspace panel`,"data-tip":`Show the workspace panel`,"data-tip-side":`left`,onClick:()=>t(),children:(0,z.jsx)(Lt,{strokeWidth:1.8,"aria-hidden":`true`})}),(0,z.jsx)(`span`,{"aria-hidden":`true`,className:`my-1 h-px w-6 bg-line`}),fl(e).map(e=>(0,z.jsx)(L,{variant:`icon`,size:`icon`,"aria-label":e.label,"data-tip":e.label,"data-tip-side":`left`,onClick:()=>t(e.id),className:`size-9 flex-none`,children:(0,z.jsx)(Nc,{item:e})},e.id)),(0,z.jsx)(`span`,{className:`flex-1`}),(0,z.jsx)(Rr,{rail:!0})]})}function ml({compact:e=!1}){let{theme:t}=D(),r=t.name||`ForgeQE`;return(0,z.jsx)(`a`,{href:n(),"aria-label":`${r}, home`,className:`-ml-2 flex min-h-9 min-w-0 flex-1 items-center gap-2 pl-2 text-body-lg font-medium text-ink no-underline hover:text-ink`,children:(0,z.jsx)(Dc,{theme:t,compact:e})})}function hl(){let[e,t]=(0,R.useState)(!1);return(0,R.useEffect)(()=>{let e=()=>t(!0);return window.addEventListener(oe,e),()=>window.removeEventListener(oe,e)},[]),e?(0,z.jsx)(`p`,{role:`alert`,className:h(le.fail,`mx-4 mt-4 mb-0`),children:ae()}):null}function gl({stats:e,onClose:t,focus:n}){let r=(0,R.useRef)(null);return(0,R.useEffect)(()=>{n&&(r.current?.querySelector(`#panel-${n.id}`))?.scrollIntoView({block:`start`,behavior:window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches?`auto`:`smooth`})},[n]),(0,z.jsxs)(`aside`,{"aria-label":`Workspace`,className:`flex h-full w-[264px] flex-col bg-canvas`,children:[(0,z.jsxs)(`div`,{className:`flex items-center gap-2 px-4 pt-4`,children:[(0,z.jsx)(Mc,{}),(0,z.jsx)(`span`,{className:`flex-1`}),(0,z.jsx)(L,{variant:`icon`,size:`icon`,"aria-label":`Close the workspace panel`,"data-tip":`Close the workspace panel`,"data-tip-side":`left`,onClick:t,children:(0,z.jsx)(Ze,{strokeWidth:1.8,"aria-hidden":`true`})})]}),(0,z.jsx)(`div`,{ref:r,className:`min-h-0 flex-1 overflow-y-auto px-4 pt-1 pb-4`,children:(0,z.jsx)(rc,{chat:e})}),(0,z.jsx)(`div`,{className:`px-4 py-4`,children:(0,z.jsx)(Rr,{})})]})}var _l=`forgeqe-workspace-panel`,vl=`forgeqe:workspace-fold`,yl=()=>{try{return localStorage.getItem(_l)!==`closed`}catch{return!0}},bl=220;function xl({open:e,side:t,label:n,wideAt:r,onClose:i,className:a,children:o}){let c=(0,R.useRef)(null),l=s(e,150);(0,R.useEffect)(()=>{let t=c.current;t&&(e&&!t.open?t.showModal():!l&&t.open&&t.close())},[e,l]),(0,R.useEffect)(()=>{if(!e)return;let t=window.matchMedia(r);if(t.matches)return i();let n=()=>t.matches&&i();return t.addEventListener(`change`,n),()=>t.removeEventListener(`change`,n)},[e,r,i]);let u=t===`left`?`aside`:`div`;return(0,z.jsx)(`dialog`,{ref:c,"aria-label":n,onCancel:e=>{e.target===c.current&&(e.preventDefault(),i())},className:h(`drawer fixed inset-0 z-40 m-0 h-auto max-h-none w-auto max-w-none overflow-hidden border-0 bg-transparent p-0 text-ink backdrop:bg-transparent`,!e&&`is-closing`,a),children:l&&(0,z.jsxs)(`div`,{inert:!e||void 0,className:`absolute inset-0`,children:[(0,z.jsx)(`div`,{"aria-hidden":`true`,className:`drawer-dim absolute inset-0 bg-[rgba(15,23,42,0.28)]`,onClick:i}),(0,z.jsx)(u,{className:h(`drawer-box absolute inset-y-0 max-w-[85vw] shadow-menu`,t===`left`?`drawer-left left-0`:`right-0`),children:o})]})})}function Sl(e,t,n){let r=(e??``).replace(/\s+/g,` `).trim().slice(0,80);return n||!r?t:`${r} · ${t}`}function Cl(e,t,n){(0,R.useEffect)(()=>{let e=document.querySelector(`[data-screen]`);if(!e)return;let t=0,n=()=>{t=0;let n=e.querySelector(`h1`),r=Sl(n?.textContent,O(),!!n?.hasAttribute(`data-app-title`));document.title!==r&&(document.title=r)},r=()=>t||=requestAnimationFrame(n);r();let i=new MutationObserver(r);return i.observe(e,{subtree:!0,childList:!0,characterData:!0}),()=>{i.disconnect(),t&&cancelAnimationFrame(t)}},[e,t,n])}function wl(e){e.preventDefault();let t=document.querySelector(`[data-screen] main`)??document.querySelector(`[data-screen]`);t&&(t.hasAttribute(`tabindex`)||t.setAttribute(`tabindex`,`-1`),t.focus())}function Tl({current:e,route:t=e?[e]:[],children:n}){let[r,i]=(0,R.useState)(qc),[a,o]=(0,R.useState)(null),[c,l]=(0,R.useState)(!1),[u,d]=(0,R.useState)(yl),[f,p]=(0,R.useState)(!1),m=(0,R.useCallback)(()=>l(!1),[]),g=(0,R.useCallback)(()=>p(!1),[]),[_,v]=(0,R.useState)(!1),[y,b]=(0,R.useState)(!1),[x,S]=(0,R.useState)(``),C=t.join(`/`);(0,R.useEffect)(()=>wn(t),[C]);let{theme:w}=D();Cl(e,C,w.appName);let T=ci(t),E=()=>{l(!1),S(``),b(!0),v(!0)},O=(0,R.useCallback)(e=>{l(!1),S(e),b(!0),v(!0)},[]);(0,R.useEffect)(()=>{let e=e=>{(e.ctrlKey||e.metaKey)&&!e.altKey&&!e.shiftKey&&e.key.toLowerCase()===`k`&&(e.preventDefault(),S(``),b(!0),v(e=>!e))};return window.addEventListener(`keydown`,e),()=>window.removeEventListener(`keydown`,e)},[]);let k=s(!r,bl),A=s(u,bl),[j,M]=(0,R.useState)(null),ee=()=>window.matchMedia(`(min-width: 1600px)`).matches,N=e=>{d(e);try{localStorage.setItem(_l,e?`open`:`closed`)}catch{}};(0,R.useEffect)(()=>{let e=e=>d(e.detail!==!0&&yl());return window.addEventListener(vl,e),()=>window.removeEventListener(vl,e)},[]),(0,R.useEffect)(()=>{if(!f)return;let e=()=>p(!1);return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[f]);let te=e=>{i(e);try{localStorage.setItem(Kc,e?`closed`:`open`)}catch{}};(0,R.useEffect)(()=>{if(!c)return;let e=()=>l(!1);return window.addEventListener(`hashchange`,e),()=>window.removeEventListener(`hashchange`,e)},[c]);let ne=()=>window.matchMedia(`(min-width: 768px)`).matches,{setChoice:re}=D(),ie=async(e,t,n)=>e===`theme`?(re(t),`The look is ${t} now.`):e===`talk`?(window.dispatchEvent(new Event(`forgeqe:talk-off`)),`Talk is ending.`):e===`sidebar`?(ne()?te(t===`closed`):l(t===`open`),`The sidebar is ${t}.`):n?(await ce.settings(n,{headed:t===`shown`}),`Browser runs in this chat are ${t} now.`):`Browser runs are set per chat: open one first.`,ae=e===`settings`||e===`welcome`,oe=e=>{ee()?N(!0):p(!0),M(e?{id:e,at:Date.now()}:null)};return(0,z.jsx)(Wc.Provider,{value:{hidden:r,open:()=>ne()?te(!1):l(!0),setChat:o,find:E},children:(0,z.jsx)(br,{pages:Ic,find:O,set:ie,children:(0,z.jsx)(Fr,{children:(0,z.jsxs)(`div`,{className:`flex min-h-(--screen) bg-canvas`,children:[(0,z.jsx)(`a`,{href:`#content`,onClick:wl,className:`sr-only focus:not-sr-only focus:fixed focus:top-2 focus:left-2 focus:z-[70] focus:rounded-sm focus:bg-accent focus:px-4 focus:py-2 focus:text-body-sm focus:font-medium focus:text-accent-ink focus:no-underline`,children:`Skip to content`}),(0,z.jsxs)(`aside`,{style:{viewTransitionName:`app-sidebar`},className:h(`side-box sticky top-0 h-(--screen) flex-none overflow-hidden`,r?`w-16`:`w-[248px] min-[1440px]:w-[264px]`,ae?`hidden`:`hidden md:block`),children:[(0,z.jsx)(`div`,{className:h(`side-layer absolute inset-y-0 left-0`,r&&`invisible opacity-0`),children:k&&(0,z.jsx)(al,{current:e,route:t,place:T,onClose:()=>te(!0)})}),(0,z.jsx)(`div`,{className:h(`side-layer absolute inset-y-0 left-0`,!r&&`invisible opacity-0`),children:(0,z.jsx)(cl,{current:e,route:T,onOpen:()=>te(!1)})})]}),(0,z.jsx)(xl,{open:c,side:`left`,label:`Sidebar`,wideAt:`(min-width: 768px)`,onClose:m,className:`md:hidden`,children:(0,z.jsx)(al,{current:e,route:t,place:T,onClose:()=>l(!1)})}),(0,z.jsxs)(`div`,{"data-screen":!0,className:`relative flex min-w-0 flex-1 flex-col`,children:[e!==`welcome`&&(0,z.jsx)(Bc,{route:t}),(0,z.jsx)(hl,{}),(0,z.jsx)(`div`,{"data-page-area":!0,className:`flex min-w-0 flex-1 flex-col`,children:n}),(0,z.jsx)(L,{variant:`icon`,size:`icon`,"aria-label":`Show the workspace panel`,"data-tip":`Show the workspace panel`,onClick:()=>oe(),className:h(`absolute top-2 right-3 z-30 md:hidden`,ae&&`hidden`),children:(0,z.jsx)(Lt,{strokeWidth:1.8,"aria-hidden":`true`})})]}),(0,z.jsxs)(`div`,{style:{viewTransitionName:`app-panel`},className:h(`side-box sticky top-0 h-(--screen) w-14 flex-none overflow-hidden`,u&&`min-[1600px]:w-[264px]`,ae?`hidden`:`hidden md:block`),children:[(0,z.jsx)(`div`,{className:h(`side-layer absolute inset-y-0 right-0 hidden min-[1600px]:block`,!u&&`invisible opacity-0`),children:A&&(0,z.jsx)(gl,{stats:a,focus:j,onClose:()=>N(!1)})}),(0,z.jsx)(`div`,{className:h(`side-layer absolute inset-y-0 right-0`,u&&`min-[1600px]:invisible min-[1600px]:opacity-0`),children:(0,z.jsx)(pl,{stats:a,onOpen:oe})})]}),y&&(0,z.jsx)(R.Suspense,{fallback:null,children:(0,z.jsx)(Lc,{open:_,onClose:()=>v(!1),pages:Ic,query:x})}),(0,z.jsx)(xl,{open:f,side:`right`,label:`Workspace panel`,wideAt:`(min-width: 1600px)`,onClose:g,className:`min-[1600px]:hidden`,children:(0,z.jsx)(gl,{stats:a,focus:j,onClose:()=>p(!1)})}),(0,z.jsx)(zr,{})]})})})})}var El=`mx-auto box-border flex w-full max-w-[1320px] flex-col px-6 pt-8 pb-10 md:px-12 short:pt-6 short:pb-6`,Dl=`box-border flex flex-col [--frame-left:max(0px,calc((100cqw_-_1320px)/2))] ml-(--frame-left) mr-auto w-[calc(100%_-_var(--frame-left))] max-w-[1320px] px-6 pt-8 pb-10 md:px-12 short:pt-6 short:pb-6`,Ol=`[--page-w:100cqw]`,kl=`@container [--wide-w:min(var(--wide-max,100000px),calc(var(--page-w)_-_48px))] md:[--wide-w:min(var(--wide-max,100000px),calc(var(--page-w)_-_96px))] w-(--wide-w) max-w-none self-start ml-[calc((100%_-_var(--wide-w))/2)]`;export{Ma as $,$a as A,ai as At,U as B,Ir as Bt,ws as C,ui as Ct,Mo as D,Mi as Dt,Vo as E,pi as Et,To as F,Yr as Ft,Xa as G,xr as Gt,La as H,Ar as Ht,no as I,$r as It,Wa as J,In as Jt,H as K,vr as Kt,G as L,ti as Lt,co as M,ni as Mt,ao as N,ei as Nt,ho as O,ii as Ot,io as P,Xr as Pt,Na as Q,eo as R,Qr as Rt,Ds as S,hi as St,Ho as T,fi as Tt,Za as U,kr as Ut,Qa as V,Lr as Vt,Ja as W,Mr as Wt,Ba as X,kn as Xt,Ia as Y,Fn as Yt,Va as Z,As as _,ki as _t,vl as a,_a as at,Os as b,mi as bt,Tl as c,na as ct,Dc as d,Qi as dt,Aa as et,Oc as f,Xi as ft,Ss as g,Pi as gt,Cs as h,_i as ht,Ol as i,wa as it,lo as j,oi as jt,q as k,ri as kt,zc as l,Zi as lt,_c as m,vi as mt,Dl as n,ka as nt,Jc as o,va as ot,dc as p,Fi as pt,V as q,Ln as qt,kl as r,Ta as rt,Yc as s,B as st,El as t,Ca as tt,Gc as u,Yi as ut,xs as v,Ai as vt,Ro as w,di as wt,Ts as x,gi as xt,Es as y,Ni as yt,to as z,Jr as zt};