@capagents/forgeqe 3.1.1 → 3.1.2
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.
- package/HOW_TO_USE.md +435 -78
- package/README.md +21 -6
- package/THIRD_PARTY_NOTICES.md +210 -1
- package/dist/docs-site/CREDITS.md +6 -0
- package/dist/docs-site/architecture-map/index.html +1 -1
- package/dist/docs-site/docs/app-theme.css +100 -8
- package/dist/docs-site/docs/architecture/index.html +210 -214
- package/dist/docs-site/docs/area-api/index.html +350 -0
- package/dist/docs-site/docs/area-automated-tests/index.html +967 -0
- package/dist/docs-site/docs/area-browser/index.html +430 -0
- package/dist/docs-site/docs/area-data/index.html +605 -0
- package/dist/docs-site/docs/area-desktop/index.html +755 -0
- package/dist/docs-site/docs/area-mobile/index.html +631 -0
- package/dist/docs-site/docs/area-operations/index.html +1069 -0
- package/dist/docs-site/docs/area-pull-requests/index.html +208 -0
- package/dist/docs-site/docs/area-quality/index.html +365 -0
- package/dist/docs-site/docs/area-release/index.html +320 -0
- package/dist/docs-site/docs/area-setup/index.html +1192 -0
- package/dist/docs-site/docs/area-systems/index.html +207 -0
- package/dist/docs-site/docs/area-test-cases/index.html +694 -0
- package/dist/docs-site/docs/containers/index.html +97 -104
- package/dist/docs-site/docs/cost-architecture/index.html +108 -112
- package/dist/docs-site/docs/custom-agents-first-run/index.html +19 -23
- package/dist/docs-site/docs/desktop/index.html +172 -162
- package/dist/docs-site/docs/desktop-ci/index.html +26 -33
- package/dist/docs-site/docs/evidence/index.html +253 -257
- package/dist/docs-site/docs/feature-test-prompts/index.html +66 -70
- package/dist/docs-site/docs/get-started/index.html +495 -0
- package/dist/docs-site/docs/graphify/index.html +42 -46
- package/dist/docs-site/docs/guardrails/index.html +17 -21
- package/dist/docs-site/docs/index.html +17 -6729
- package/dist/docs-site/docs/mobile/index.html +155 -162
- package/dist/docs-site/docs/model-routing/index.html +44 -51
- package/dist/docs-site/docs/overview/index.html +176 -0
- package/dist/docs-site/docs/product-graph/index.html +52 -55
- package/dist/docs-site/docs/product-knowledge/index.html +11 -15
- package/dist/docs-site/docs/product-views/index.html +53 -57
- package/dist/docs-site/docs/reference/index.html +379 -0
- package/dist/docs-site/docs/search.js +1 -1
- package/dist/docs-site/docs/using/index.html +480 -0
- package/dist/docs-site/docs/web-app/index.html +147 -93
- package/dist/docs-site/security/index.html +930 -0
- package/dist/docs-site/security/security-theme.css +161 -0
- package/dist/docs-site/security/security.js +1465 -0
- package/dist/docs-site/vendor/react-18.3.1.production.min.js +31 -0
- package/dist/docs-site/vendor/react-dom-18.3.1.production.min.js +267 -0
- package/dist/docs-site/vendor/reactflow-11.11.4.umd.js +10 -0
- package/dist/forgeqe.js +1902 -1895
- package/dist/web/THIRD_PARTY_NOTICES.md +0 -136
- package/dist/web/assets/Agent-CPhmZdFX.js +8 -0
- package/dist/web/assets/AgentWork-BXdN9xgi.js +2 -0
- package/dist/web/assets/ApiTests-Do3xLjfB.js +10 -0
- package/dist/web/assets/Browse-WVkJT6Bs.js +2 -0
- package/dist/web/assets/Chat-CDc9UcQX.js +3 -0
- package/dist/web/assets/CommandPalette-BAZm62lV.js +1 -0
- package/dist/web/assets/Compare-Br6n9T9L.js +1 -0
- package/dist/web/assets/Cost-BBUyBu3Y.js +1 -0
- package/dist/web/assets/Data-Ch2DPEWp.js +6 -0
- package/dist/web/assets/Desktop-Qzoq-cQv.js +1 -0
- package/dist/web/assets/DesktopReview-CF_jQYAM.js +1 -0
- package/dist/web/assets/Evidence-C72Lj5_Q.js +1 -0
- package/dist/web/assets/Explore-ObkEpUyS.js +2 -0
- package/dist/web/assets/Features-CQzNo_WP.js +1 -0
- package/dist/web/assets/Flags-0-RniPJm.js +2 -0
- package/dist/web/assets/Flaky-BPJvNLCA.js +1 -0
- package/dist/web/assets/Impact-CfccsL_k.js +3 -0
- package/dist/web/assets/Jobs-T6m4zhDy.js +5 -0
- package/dist/web/assets/KindPage-BDUvWe2p.js +6 -0
- package/dist/web/assets/Migration-Dqeh4x5u.js +2 -0
- package/dist/web/assets/PageAgent-DNjzIgeY.js +1 -0
- package/dist/web/assets/Product-nYV_scOV.js +7 -0
- package/dist/web/assets/Production-CGSbEWVa.js +1 -0
- package/dist/web/assets/Quality-BIypojZm.js +1 -0
- package/dist/web/assets/Readiness-BlRjwJRg.js +1 -0
- package/dist/web/assets/Record-v2KLI-_Z.js +1 -0
- package/dist/web/assets/Regression-B-jSt4Jz.js +5 -0
- package/dist/web/assets/RelationGraph-8J98lOVG.js +1 -0
- package/dist/web/assets/Reports-GI4u6SyW.js +2 -0
- package/dist/web/assets/Response-mhBThq2b.js +9 -0
- package/dist/web/assets/Responsive-DXu7Ra7K.js +3 -0
- package/dist/web/assets/RunDiff-D0SHDNp0.js +1 -0
- package/dist/web/assets/Runs-C1Gjdi9M.js +2 -0
- package/dist/web/assets/Settings-BGGeuvyF.js +21 -0
- package/dist/web/assets/Steps-D-YG0eJy.js +2 -0
- package/dist/web/assets/TestCases-DC4w77eQ.js +1 -0
- package/dist/web/assets/TestData-CvKWRVVV.js +2 -0
- package/dist/web/assets/TestDebt-D8YzN29_.js +1 -0
- package/dist/web/assets/TestManagement-C5cDCqrD.js +1 -0
- package/dist/web/assets/Tosca-BGUv3RiJ.js +3 -0
- package/dist/web/assets/WhatsNew-B_Gyuv8O.js +1 -0
- package/dist/web/assets/agents-C0Jg2pN8.js +1 -0
- package/dist/web/assets/coverage-BMP6ELFJ.js +5 -0
- package/dist/web/assets/dataParts-DbeCj9ga.js +3 -0
- package/dist/web/assets/diff-BStuTmsN.js +2 -0
- package/dist/web/assets/families-BBFFrUlo.js +1 -0
- package/dist/web/assets/filters-CnAMr286.js +1 -0
- package/dist/web/assets/fold-D_O_VZui.js +1 -0
- package/dist/web/assets/head-CRo48rPt.js +1 -0
- package/dist/web/assets/highlight-BcFZIf59.js +4 -0
- package/dist/web/assets/index-B3JsM7tv.js +64 -0
- package/dist/web/assets/index-CafApcbZ.css +2 -0
- package/dist/web/assets/input-CtzK50ZF.js +1 -0
- package/dist/web/assets/jsx-runtime-LKYXHABd.js +1 -0
- package/dist/web/assets/line-icons-rdF8DYDJ.js +1 -0
- package/dist/web/assets/logos-D4oVWzqa.js +1 -0
- package/dist/web/assets/palette-DAaGSao7.js +1 -0
- package/dist/web/assets/paletteCommands-Co-RlQ8q.js +1 -0
- package/dist/web/assets/parts-D357Wolo.js +1 -0
- package/dist/web/assets/productParts-B8oHRCJF.js +1 -0
- package/dist/web/assets/qualityParts-BLkmIfDY.js +1 -0
- package/dist/web/assets/recordTest-Cez2sDJO.js +1 -0
- package/dist/web/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/dist/web/assets/route-BloYJWgw.js +1 -0
- package/dist/web/index.html +12 -6
- package/docs/ARCHITECTURE.md +1 -1
- package/docs/BASAL.md +1 -1
- package/docs/DESKTOP.md +20 -1
- package/docs/EVIDENCE.md +1 -1
- package/docs/MOBILE.md +4 -4
- package/docs/PRODUCT_KNOWLEDGE.md +2 -0
- package/docs/WEB_APP.md +114 -51
- package/docs/user-guide.html +404 -81
- package/forgeqe.example.yaml +3 -3
- package/package.json +1 -1
- package/prompts/page-differs.md +1 -1
- package/prompts/requests-rule.md +1 -1
- package/prompts/test-reviewer.md +1 -1
- package/prompts/test-rules.md +3 -4
- package/skills/web-guidance/LICENSE +202 -0
- package/skills/web-guidance/SKILL.md +76 -0
- package/skills/web-guidance/UPSTREAM +67 -0
- package/skills/web-guidance/references/accessibility/accessibility.md +585 -0
- package/skills/web-guidance/references/accessibility/accessible-error-announcement.md +302 -0
- package/skills/web-guidance/references/accessibility/accessible-generated-content.md +41 -0
- package/skills/web-guidance/references/accessibility/respect-os-text-scale.md +127 -0
- package/skills/web-guidance/references/css/responsive-design.md +16 -0
- package/skills/web-guidance/references/forms/autofill-address-form.md +86 -0
- package/skills/web-guidance/references/forms/autofill-payment-form.md +142 -0
- package/skills/web-guidance/references/forms/autofill-sign-in-form.md +145 -0
- package/skills/web-guidance/references/forms/autofill-sign-up-form.md +155 -0
- package/skills/web-guidance/references/forms/forms.md +415 -0
- package/skills/web-guidance/references/forms/ime-safe-enter-submit.md +115 -0
- package/skills/web-guidance/references/forms/required-field-feedback.md +317 -0
- package/skills/web-guidance/references/forms/select-menu-interaction.md +310 -0
- package/skills/web-guidance/references/forms/slider.md +184 -0
- package/skills/web-guidance/references/forms/sms-otp-form.md +208 -0
- package/skills/web-guidance/references/forms/switch.md +60 -0
- package/skills/web-guidance/references/forms/validate-input-after-interaction.md +406 -0
- package/skills/web-guidance/references/performance/break-up-long-tasks.md +64 -0
- package/skills/web-guidance/references/performance/identify-heavy-scripts.md +69 -0
- package/skills/web-guidance/references/performance/identify-inp-causes.md +105 -0
- package/skills/web-guidance/references/performance/interaction-paint-timing.md +200 -0
- package/skills/web-guidance/references/performance/optimize-image-priority.md +73 -0
- package/skills/web-guidance/references/performance/performance.md +384 -0
- package/skills/web-guidance/references/privacy/privacy.md +247 -0
- package/skills/web-guidance/references/security/passkey-authentication.md +218 -0
- package/skills/web-guidance/references/security/passkey-management.md +310 -0
- package/skills/web-guidance/references/security/passkey-reauthentication.md +142 -0
- package/skills/web-guidance/references/security/passkey-registration.md +186 -0
- package/skills/web-guidance/references/security/passkeys.md +39 -0
- package/skills/web-guidance/references/security/sanitize-untrusted-html.md +105 -0
- package/skills/web-guidance/references/security/secure-external-subresources.md +202 -0
- package/skills/web-guidance/references/security/security.md +390 -0
- package/skills/web-guidance/references/security/trusted-types.md +141 -0
- package/skills/web-guidance/references/security/validate-origins.md +197 -0
- package/skills/web-guidance/references/security/verify-email-ownership.md +235 -0
- package/skills/web-guidance/references/ui-atoms/position-aware-tooltips.md +173 -0
- package/skills/web-guidance/references/ui-atoms/responsive-table.md +122 -0
- package/skills/web-guidance/references/ui-atoms/viewport-aware-dropdowns.md +178 -0
- package/skills/web-guidance/references/ui-behaviors/drag-and-drop.md +108 -0
- package/skills/web-guidance/references/ui-behaviors/light-dismiss-a-dialog.md +89 -0
- package/skills/web-guidance/references/ui-behaviors/motion.md +97 -0
- package/skills/web-guidance/references/ui-behaviors/platform-controls-dismiss-dialog.md +40 -0
- package/skills/web-guidance/references/ui-behaviors/prevent-page-scroll-under-modal-dialog.md +59 -0
- package/skills/web-guidance/references/ui-behaviors/search-hidden-content.md +141 -0
- package/skills/web-guidance/references/ui-behaviors/sortable-table.md +140 -0
- package/skills/web-guidance/references/ui-components/accordion.md +343 -0
- package/skills/web-guidance/references/ui-components/breadcrumbs.md +168 -0
- package/skills/web-guidance/references/ui-components/carousel.md +206 -0
- package/skills/web-guidance/references/ui-components/checkbox.md +144 -0
- package/skills/web-guidance/references/ui-components/dialog.md +218 -0
- package/skills/web-guidance/references/ui-components/hovercard.md +391 -0
- package/skills/web-guidance/references/ui-components/menu.md +415 -0
- package/skills/web-guidance/references/ui-components/navbar.md +281 -0
- package/skills/web-guidance/references/ui-components/navigation-drawer.md +429 -0
- package/skills/web-guidance/references/ui-components/persistent-toast-notifications.md +185 -0
- package/skills/web-guidance/references/ui-components/progress.md +181 -0
- package/skills/web-guidance/references/ui-components/spinner.md +179 -0
- package/skills/web-guidance/references/ui-components/tabs.md +371 -0
- package/skills/web-guidance/references/ui-components/toolbar.md +277 -0
- package/skills/web-guidance/references/user-experience/form-factor-adaptation.md +120 -0
- package/skills/web-guidance/references/user-experience/natural-interactions.md +155 -0
- package/skills/web-guidance/references/visual-design/color.md +43 -0
- package/skills/web-guidance/references/visual-design/dark-mode.md +350 -0
- package/dist/web/assets/AgentWork-DwAI0_Of.js +0 -2
- package/dist/web/assets/ApiTests-C0vFSHmM.js +0 -10
- package/dist/web/assets/Browse-5jfdtRc5.js +0 -2
- package/dist/web/assets/Chat-B3uhI94O.js +0 -3
- package/dist/web/assets/CommandPalette-D2J4nf5y.js +0 -1
- package/dist/web/assets/Compare-CN75w1p9.js +0 -1
- package/dist/web/assets/Cost-QoxyjR95.js +0 -1
- package/dist/web/assets/Data-BAvkcBVt.js +0 -6
- package/dist/web/assets/Desktop-BXdOIalN.js +0 -1
- package/dist/web/assets/DesktopReview-Bl2SrPP0.js +0 -1
- package/dist/web/assets/Evidence-BJ_I52CD.js +0 -1
- package/dist/web/assets/Explore-D9AuyTip.js +0 -2
- package/dist/web/assets/Features-CusGMDR9.js +0 -1
- package/dist/web/assets/Flags-CycGFuUP.js +0 -2
- package/dist/web/assets/Flaky-BcSzJogN.js +0 -1
- package/dist/web/assets/Impact-CJHnyZ21.js +0 -3
- package/dist/web/assets/Jobs-4xcFzEFo.js +0 -5
- package/dist/web/assets/KindPage-BielEIej.js +0 -6
- package/dist/web/assets/Migration-NwanKpJg.js +0 -2
- package/dist/web/assets/PageAgent-CNw4NXva.js +0 -1
- package/dist/web/assets/Product-DS3LJZ4P.js +0 -7
- package/dist/web/assets/Production-D3zsyNIS.js +0 -1
- package/dist/web/assets/Quality-Ctj2YpC4.js +0 -1
- package/dist/web/assets/Readiness-DGcRr_co.js +0 -1
- package/dist/web/assets/Record-Cc-wGe_Y.js +0 -1
- package/dist/web/assets/Regression-DcsbrRa1.js +0 -5
- package/dist/web/assets/Reports-BkCn0-Sf.js +0 -2
- package/dist/web/assets/Response-BP0UwQcW.js +0 -9
- package/dist/web/assets/Responsive-C8U7dumd.js +0 -3
- package/dist/web/assets/RunDiff-BhABuhF_.js +0 -1
- package/dist/web/assets/Runs-OwdWEYBv.js +0 -2
- package/dist/web/assets/Steps-BvzbQyoD.js +0 -2
- package/dist/web/assets/TestCases-CLq_6JA5.js +0 -1
- package/dist/web/assets/TestData-B0oKAhp6.js +0 -2
- package/dist/web/assets/TestDebt-8NLQ5YV_.js +0 -1
- package/dist/web/assets/TestManagement-2LYQ7vsN.js +0 -1
- package/dist/web/assets/Tosca-DfvMpPTG.js +0 -3
- package/dist/web/assets/WhatsNew-BGFNGwqN.js +0 -1
- package/dist/web/assets/families-DYlN5v0i.js +0 -1
- package/dist/web/assets/filters-faaSnoIq.js +0 -1
- package/dist/web/assets/fold-CUjwWAK3.js +0 -1
- package/dist/web/assets/frame-BLPdAXUq.js +0 -13
- package/dist/web/assets/head-CsTxBsO0.js +0 -1
- package/dist/web/assets/index-CxiCvGZq.js +0 -78
- package/dist/web/assets/index-dOIsrzhD.css +0 -2
- package/dist/web/assets/line-icons-CwZWt93L.js +0 -1
- package/dist/web/assets/logos-dGuc1jIM.js +0 -1
- package/dist/web/assets/markdown-BI3F-SJ1.js +0 -10
- package/dist/web/assets/paletteCommands-QJiCuUEr.js +0 -1
- package/dist/web/assets/parts-CdF1f7yS.js +0 -1
- package/dist/web/assets/productParts-hNLD9fN0.js +0 -1
- package/dist/web/assets/qualityParts-CT25lBWU.js +0 -1
- package/dist/web/assets/recordTest-P792aBUt.js +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{In as t,Lr as n,Pr as r,rr as i}from"./line-icons-rdF8DYDJ.js";import{t as a}from"./jsx-runtime-LKYXHABd.js";import{A as o}from"./input-CtzK50ZF.js";import{d as s}from"./filters-CnAMr286.js";function c(e){let t=+this._x.call(null,e),n=+this._y.call(null,e);return l(this.cover(t,n),t,n,e)}function l(e,t,n,r){if(isNaN(t)||isNaN(n))return e;var i,a=e._root,o={data:r},s=e._x0,c=e._y0,l=e._x1,u=e._y1,d,f,p,m,h,g,_,v;if(!a)return e._root=o,e;for(;a.length;)if((h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f,i=a,!(a=a[_=g<<1|h]))return i[_]=o,e;if(p=+e._x.call(null,a.data),m=+e._y.call(null,a.data),t===p&&n===m)return o.next=a,i?i[_]=o:e._root=o,e;do i=i?i[_]=[,,,,]:e._root=[,,,,],(h=t>=(d=(s+l)/2))?s=d:l=d,(g=n>=(f=(c+u)/2))?c=f:u=f;while((_=g<<1|h)==(v=(m>=f)<<1|p>=d));return i[v]=a,i[_]=o,e}function u(e){Array.isArray(e)||(e=Array.from(e));let t=e.length,n=new Float64Array(t),r=new Float64Array(t),i=1/0,a=i,o=-i,s=o;for(let c=0,l,u,d;c<t;++c)isNaN(u=+this._x.call(null,l=e[c]))||isNaN(d=+this._y.call(null,l))?n[c]=NaN:(n[c]=u,r[c]=d,u<i&&(i=u),u>o&&(o=u),d<a&&(a=d),d>s&&(s=d));if(i>o||a>s)return this;this.cover(i,a).cover(o,s);for(let i=0;i<t;++i)l(this,n[i],r[i],e[i]);return this}function d(e,t){if(isNaN(e=+e)||isNaN(t=+t))return this;var n=this._x0,r=this._y0,i=this._x1,a=this._y1;if(isNaN(n))i=(n=Math.floor(e))+1,a=(r=Math.floor(t))+1;else{for(var o=i-n||1,s=this._root,c,l;n>e||e>=i||r>t||t>=a;)switch(l=(t<r)<<1|e<n,c=[,,,,],c[l]=s,s=c,o*=2,l){case 0:i=n+o,a=r+o;break;case 1:n=i-o,a=r+o;break;case 2:i=n+o,r=a-o;break;case 3:n=i-o,r=a-o}this._root&&this._root.length&&(this._root=s)}return this._x0=n,this._y0=r,this._x1=i,this._y1=a,this}function f(){var e=[];return this.visit(function(t){if(!t.length)do e.push(t.data);while(t=t.next)}),e}function p(e){return arguments.length?this.cover(+e[0][0],+e[0][1]).cover(+e[1][0],+e[1][1]):isNaN(this._x0)?void 0:[[this._x0,this._y0],[this._x1,this._y1]]}function m(e,t,n,r,i){this.node=e,this.x0=t,this.y0=n,this.x1=r,this.y1=i}function h(e,t,n){var r,i=this._x0,a=this._y0,o,s,c,l,u=this._x1,d=this._y1,f=[],p=this._root,h,g;for(p&&f.push(new m(p,i,a,u,d)),n==null?n=1/0:(i=e-n,a=t-n,u=e+n,d=t+n,n*=n);h=f.pop();)if(!(!(p=h.node)||(o=h.x0)>u||(s=h.y0)>d||(c=h.x1)<i||(l=h.y1)<a)){if(p.length){var _=(o+c)/2,v=(s+l)/2;f.push(new m(p[3],_,v,c,l),new m(p[2],o,v,_,l),new m(p[1],_,s,c,v),new m(p[0],o,s,_,v)),(g=(t>=v)<<1|e>=_)&&(h=f[f.length-1],f[f.length-1]=f[f.length-1-g],f[f.length-1-g]=h)}else{var y=e-+this._x.call(null,p.data),b=t-+this._y.call(null,p.data),x=y*y+b*b;if(x<n){var S=Math.sqrt(n=x);i=e-S,a=t-S,u=e+S,d=t+S,r=p.data}}}return r}function g(e){if(isNaN(u=+this._x.call(null,e))||isNaN(d=+this._y.call(null,e)))return this;var t,n=this._root,r,i,a,o=this._x0,s=this._y0,c=this._x1,l=this._y1,u,d,f,p,m,h,g,_;if(!n)return this;if(n.length)for(;;){if((m=u>=(f=(o+c)/2))?o=f:c=f,(h=d>=(p=(s+l)/2))?s=p:l=p,t=n,!(n=n[g=h<<1|m]))return this;if(!n.length)break;(t[g+1&3]||t[g+2&3]||t[g+3&3])&&(r=t,_=g)}for(;n.data!==e;)if(i=n,!(n=n.next))return this;return(a=n.next)&&delete n.next,i?(a?i.next=a:delete i.next,this):t?(a?t[g]=a:delete t[g],(n=t[0]||t[1]||t[2]||t[3])&&n===(t[3]||t[2]||t[1]||t[0])&&!n.length&&(r?r[_]=n:this._root=n),this):(this._root=a,this)}function _(e){for(var t=0,n=e.length;t<n;++t)this.remove(e[t]);return this}function v(){return this._root}function y(){var e=0;return this.visit(function(t){if(!t.length)do++e;while(t=t.next)}),e}function b(e){var t=[],n,r=this._root,i,a,o,s,c;for(r&&t.push(new m(r,this._x0,this._y0,this._x1,this._y1));n=t.pop();)if(!e(r=n.node,a=n.x0,o=n.y0,s=n.x1,c=n.y1)&&r.length){var l=(a+s)/2,u=(o+c)/2;(i=r[3])&&t.push(new m(i,l,u,s,c)),(i=r[2])&&t.push(new m(i,a,u,l,c)),(i=r[1])&&t.push(new m(i,l,o,s,u)),(i=r[0])&&t.push(new m(i,a,o,l,u))}return this}function x(e){var t=[],n=[],r;for(this._root&&t.push(new m(this._root,this._x0,this._y0,this._x1,this._y1));r=t.pop();){var i=r.node;if(i.length){var a,o=r.x0,s=r.y0,c=r.x1,l=r.y1,u=(o+c)/2,d=(s+l)/2;(a=i[0])&&t.push(new m(a,o,s,u,d)),(a=i[1])&&t.push(new m(a,u,s,c,d)),(a=i[2])&&t.push(new m(a,o,d,u,l)),(a=i[3])&&t.push(new m(a,u,d,c,l))}n.push(r)}for(;r=n.pop();)e(r.node,r.x0,r.y0,r.x1,r.y1);return this}function S(e){return e[0]}function C(e){return arguments.length?(this._x=e,this):this._x}function w(e){return e[1]}function T(e){return arguments.length?(this._y=e,this):this._y}function E(e,t,n){var r=new D(t??S,n??w,NaN,NaN,NaN,NaN);return e==null?r:r.addAll(e)}function D(e,t,n,r,i,a){this._x=e,this._y=t,this._x0=n,this._y0=r,this._x1=i,this._y1=a,this._root=void 0}function ee(e){for(var t={data:e.data},n=t;e=e.next;)n=n.next={data:e.data};return t}var O=E.prototype=D.prototype;O.copy=function(){var e=new D(this._x,this._y,this._x0,this._y0,this._x1,this._y1),t=this._root,n,r;if(!t)return e;if(!t.length)return e._root=ee(t),e;for(n=[{source:t,target:e._root=[,,,,]}];t=n.pop();)for(var i=0;i<4;++i)(r=t.source[i])&&(r.length?n.push({source:r,target:t.target[i]=[,,,,]}):t.target[i]=ee(r));return e},O.add=c,O.addAll=u,O.cover=d,O.data=f,O.extent=p,O.find=h,O.remove=g,O.removeAll=_,O.root=v,O.size=y,O.visit=b,O.visitAfter=x,O.x=C,O.y=T;function k(e){return function(){return e}}function A(e){return(e()-.5)*1e-6}function te(e){return e.x+e.vx}function ne(e){return e.y+e.vy}function re(e){var t,n,r,i=1,a=1;typeof e!=`function`&&(e=k(e==null?1:+e));function o(){for(var e,o=t.length,c,l,u,d,f,p,m=0;m<a;++m)for(c=E(t,te,ne).visitAfter(s),e=0;e<o;++e)l=t[e],f=n[l.index],p=f*f,u=l.x+l.vx,d=l.y+l.vy,c.visit(h);function h(e,t,n,a,o){var s=e.data,c=e.r,m=f+c;if(s){if(s.index>l.index){var h=u-s.x-s.vx,g=d-s.y-s.vy,_=h*h+g*g;_<m*m&&(h===0&&(h=A(r),_+=h*h),g===0&&(g=A(r),_+=g*g),_=(m-(_=Math.sqrt(_)))/_*i,l.vx+=(h*=_)*(m=(c*=c)/(p+c)),l.vy+=(g*=_)*m,s.vx-=h*(m=1-m),s.vy-=g*m)}}else return t>u+m||a<u-m||n>d+m||o<d-m}}function s(e){if(e.data)return e.r=n[e.data.index];for(var t=e.r=0;t<4;++t)e[t]&&e[t].r>e.r&&(e.r=e[t].r)}function c(){if(t){var r,i=t.length,a;for(n=Array(i),r=0;r<i;++r)a=t[r],n[a.index]=+e(a,r,t)}}return o.initialize=function(e,n){t=e,r=n,c()},o.iterations=function(e){return arguments.length?(a=+e,o):a},o.strength=function(e){return arguments.length?(i=+e,o):i},o.radius=function(t){return arguments.length?(e=typeof t==`function`?t:k(+t),c(),o):e},o}function ie(e){return e.index}function j(e,t){var n=e.get(t);if(!n)throw Error(`node not found: `+t);return n}function ae(e){var t=ie,n=d,r,i=k(30),a,o,s,c,l,u=1;e??=[];function d(e){return 1/Math.min(s[e.source.index],s[e.target.index])}function f(t){for(var n=0,i=e.length;n<u;++n)for(var o=0,s,d,f,p,m,h,g;o<i;++o)s=e[o],d=s.source,f=s.target,p=f.x+f.vx-d.x-d.vx||A(l),m=f.y+f.vy-d.y-d.vy||A(l),h=Math.sqrt(p*p+m*m),h=(h-a[o])/h*t*r[o],p*=h,m*=h,f.vx-=p*(g=c[o]),f.vy-=m*g,d.vx+=p*(g=1-g),d.vy+=m*g}function p(){if(o){var n,i=o.length,l=e.length,u=new Map(o.map((e,n)=>[t(e,n,o),e])),d;for(n=0,s=Array(i);n<l;++n)d=e[n],d.index=n,typeof d.source!=`object`&&(d.source=j(u,d.source)),typeof d.target!=`object`&&(d.target=j(u,d.target)),s[d.source.index]=(s[d.source.index]||0)+1,s[d.target.index]=(s[d.target.index]||0)+1;for(n=0,c=Array(l);n<l;++n)d=e[n],c[n]=s[d.source.index]/(s[d.source.index]+s[d.target.index]);r=Array(l),m(),a=Array(l),h()}}function m(){if(o)for(var t=0,i=e.length;t<i;++t)r[t]=+n(e[t],t,e)}function h(){if(o)for(var t=0,n=e.length;t<n;++t)a[t]=+i(e[t],t,e)}return f.initialize=function(e,t){o=e,l=t,p()},f.links=function(t){return arguments.length?(e=t,p(),f):e},f.id=function(e){return arguments.length?(t=e,f):t},f.iterations=function(e){return arguments.length?(u=+e,f):u},f.strength=function(e){return arguments.length?(n=typeof e==`function`?e:k(+e),m(),f):n},f.distance=function(e){return arguments.length?(i=typeof e==`function`?e:k(+e),h(),f):i},f}var oe={value:()=>{}};function M(){for(var e=0,t=arguments.length,n={},r;e<t;++e){if(!(r=arguments[e]+``)||r in n||/[\s.]/.test(r))throw Error(`illegal type: `+r);n[r]=[]}return new N(n)}function N(e){this._=e}function P(e,t){return e.trim().split(/^|\s+/).map(function(e){var n=``,r=e.indexOf(`.`);if(r>=0&&(n=e.slice(r+1),e=e.slice(0,r)),e&&!t.hasOwnProperty(e))throw Error(`unknown type: `+e);return{type:e,name:n}})}N.prototype=M.prototype={constructor:N,on:function(e,t){var n=this._,r=P(e+``,n),i,a=-1,o=r.length;if(arguments.length<2){for(;++a<o;)if((i=(e=r[a]).type)&&(i=se(n[i],e.name)))return i}else{if(t!=null&&typeof t!=`function`)throw Error(`invalid callback: `+t);for(;++a<o;)if(i=(e=r[a]).type)n[i]=F(n[i],e.name,t);else if(t==null)for(i in n)n[i]=F(n[i],e.name,null);return this}},copy:function(){var e={},t=this._;for(var n in t)e[n]=t[n].slice();return new N(e)},call:function(e,t){if((i=arguments.length-2)>0)for(var n=Array(i),r=0,i,a;r<i;++r)n[r]=arguments[r+2];if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(a=this._[e],r=0,i=a.length;r<i;++r)a[r].value.apply(t,n)},apply:function(e,t,n){if(!this._.hasOwnProperty(e))throw Error(`unknown type: `+e);for(var r=this._[e],i=0,a=r.length;i<a;++i)r[i].value.apply(t,n)}};function se(e,t){for(var n=0,r=e.length,i;n<r;++n)if((i=e[n]).name===t)return i.value}function F(e,t,n){for(var r=0,i=e.length;r<i;++r)if(e[r].name===t){e[r]=oe,e=e.slice(0,r).concat(e.slice(r+1));break}return n!=null&&e.push({name:t,value:n}),e}var I=0,L=0,R=0,z=1e3,B,V,H=0,U=0,W=0,G=typeof performance==`object`&&performance.now?performance:Date,ce=typeof window==`object`&&window.requestAnimationFrame?window.requestAnimationFrame.bind(window):function(e){setTimeout(e,17)};function K(){return U||=(ce(le),G.now()+W)}function le(){U=0}function q(){this._call=this._time=this._next=null}q.prototype=J.prototype={constructor:q,restart:function(e,t,n){if(typeof e!=`function`)throw TypeError(`callback is not a function`);n=(n==null?K():+n)+(t==null?0:+t),!this._next&&V!==this&&(V?V._next=this:B=this,V=this),this._call=e,this._time=n,me()},stop:function(){this._call&&(this._call=null,this._time=1/0,me())}};function J(e,t,n){var r=new q;return r.restart(e,t,n),r}function ue(){K(),++I;for(var e=B,t;e;)(t=U-e._time)>=0&&e._call.call(void 0,t),e=e._next;--I}function de(){U=(H=G.now())+W,I=L=0;try{ue()}finally{I=0,pe(),U=0}}function fe(){var e=G.now(),t=e-H;t>z&&(W-=t,H=e)}function pe(){for(var e,t=B,n,r=1/0;t;)t._call?(r>t._time&&(r=t._time),e=t,t=t._next):(n=t._next,t._next=null,t=e?e._next=n:B=n);V=e,me(r)}function me(e){I||(L&&=clearTimeout(L),e-U>24?(e<1/0&&(L=setTimeout(de,Math.ceil(e-G.now()-W)+1)),R&&=clearInterval(R)):(R||=(H=G.now(),setInterval(fe,z)),I=1,ce(de)))}function Y(e,t,n){var r=new q;return t=t==null?0:+t,r.restart(n=>{r.stop(),e(n+t)},t,n),r}var X=1664525,he=1013904223,Z=4294967296;function ge(){let e=1;return()=>(e=(X*e+he)%Z)/Z}function _e(e){return e.x}function ve(e){return e.y}var ye=10,be=Math.PI*(3-Math.sqrt(5));function xe(e){var t,n=1,r=.001,i=1-r**(1/300),a=0,o=.6,s=new Map,c=J(d),l=M(`tick`,`end`),u=ge();e??=[];function d(){f(),l.call(`tick`,t),n<r&&(c.stop(),l.call(`end`,t))}function f(r){var c,l=e.length,u;r===void 0&&(r=1);for(var d=0;d<r;++d)for(n+=(a-n)*i,s.forEach(function(e){e(n)}),c=0;c<l;++c)u=e[c],u.fx==null?u.x+=u.vx*=o:(u.x=u.fx,u.vx=0),u.fy==null?u.y+=u.vy*=o:(u.y=u.fy,u.vy=0);return t}function p(){for(var t=0,n=e.length,r;t<n;++t){if(r=e[t],r.index=t,r.fx!=null&&(r.x=r.fx),r.fy!=null&&(r.y=r.fy),isNaN(r.x)||isNaN(r.y)){var i=ye*Math.sqrt(.5+t),a=t*be;r.x=i*Math.cos(a),r.y=i*Math.sin(a)}(isNaN(r.vx)||isNaN(r.vy))&&(r.vx=r.vy=0)}}function m(t){return t.initialize&&t.initialize(e,u),t}return p(),t={tick:f,restart:function(){return c.restart(d),t},stop:function(){return c.stop(),t},nodes:function(n){return arguments.length?(e=n,p(),s.forEach(m),t):e},alpha:function(e){return arguments.length?(n=+e,t):n},alphaMin:function(e){return arguments.length?(r=+e,t):r},alphaDecay:function(e){return arguments.length?(i=+e,t):+i},alphaTarget:function(e){return arguments.length?(a=+e,t):a},velocityDecay:function(e){return arguments.length?(o=1-e,t):1-o},randomSource:function(e){return arguments.length?(u=e,s.forEach(m),t):u},force:function(e,n){return arguments.length>1?(n==null?s.delete(e):s.set(e,m(n)),t):s.get(e)},find:function(t,n,r){var i=0,a=e.length,o,s,c,l,u;for(r==null?r=1/0:r*=r,i=0;i<a;++i)l=e[i],o=t-l.x,s=n-l.y,c=o*o+s*s,c<r&&(u=l,r=c);return u},on:function(e,n){return arguments.length>1?(l.on(e,n),t):l.on(e)}}}function Se(){var e,t,n,r,i=k(-30),a,o=1,s=1/0,c=.81;function l(n){var i,a=e.length,o=E(e,_e,ve).visitAfter(d);for(r=n,i=0;i<a;++i)t=e[i],o.visit(f)}function u(){if(e){var t,n=e.length,r;for(a=Array(n),t=0;t<n;++t)r=e[t],a[r.index]=+i(r,t,e)}}function d(e){var t=0,n,r,i=0,o,s,c;if(e.length){for(o=s=c=0;c<4;++c)(n=e[c])&&(r=Math.abs(n.value))&&(t+=n.value,i+=r,o+=r*n.x,s+=r*n.y);e.x=o/i,e.y=s/i}else{n=e,n.x=n.data.x,n.y=n.data.y;do t+=a[n.data.index];while(n=n.next)}e.value=t}function f(e,i,l,u){if(!e.value)return!0;var d=e.x-t.x,f=e.y-t.y,p=u-i,m=d*d+f*f;if(p*p/c<m)return m<s&&(d===0&&(d=A(n),m+=d*d),f===0&&(f=A(n),m+=f*f),m<o&&(m=Math.sqrt(o*m)),t.vx+=d*e.value*r/m,t.vy+=f*e.value*r/m),!0;if(!(e.length||m>=s)){(e.data!==t||e.next)&&(d===0&&(d=A(n),m+=d*d),f===0&&(f=A(n),m+=f*f),m<o&&(m=Math.sqrt(o*m)));do e.data!==t&&(p=a[e.data.index]*r/m,t.vx+=d*p,t.vy+=f*p);while(e=e.next)}}return l.initialize=function(t,r){e=t,n=r,u()},l.strength=function(e){return arguments.length?(i=typeof e==`function`?e:k(+e),u(),l):i},l.distanceMin=function(e){return arguments.length?(o=e*e,l):Math.sqrt(o)},l.distanceMax=function(e){return arguments.length?(s=e*e,l):Math.sqrt(s)},l.theta=function(e){return arguments.length?(c=e*e,l):Math.sqrt(c)},l}function Ce(e){var t=k(.1),n,r,i;typeof e!=`function`&&(e=k(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t<a;++t)o=n[t],o.vx+=(i[t]-o.x)*r[t]*e}function o(){if(n){var a,o=n.length;for(r=Array(o),i=Array(o),a=0;a<o;++a)r[a]=isNaN(i[a]=+e(n[a],a,n))?0:+t(n[a],a,n)}}return a.initialize=function(e){n=e,o()},a.strength=function(e){return arguments.length?(t=typeof e==`function`?e:k(+e),o(),a):t},a.x=function(t){return arguments.length?(e=typeof t==`function`?t:k(+t),o(),a):e},a}function we(e){var t=k(.1),n,r,i;typeof e!=`function`&&(e=k(e==null?0:+e));function a(e){for(var t=0,a=n.length,o;t<a;++t)o=n[t],o.vy+=(i[t]-o.y)*r[t]*e}function o(){if(n){var a,o=n.length;for(r=Array(o),i=Array(o),a=0;a<o;++a)r[a]=isNaN(i[a]=+e(n[a],a,n))?0:+t(n[a],a,n)}}return a.initialize=function(e){n=e,o()},a.strength=function(e){return arguments.length?(t=typeof e==`function`?e:k(+e),o(),a):t},a.y=function(t){return arguments.length?(e=typeof t==`function`?t:k(+t),o(),a):e},a}var Q=e(n(),1);function Te(e,t){let n=[];for(let r of e)for(let e=0;e<12;e++)n.push({x:r.x+Math.cos(e/12*2*Math.PI)*t,y:r.y+Math.sin(e/12*2*Math.PI)*t});if(n.length<3)return n;let r=n.toSorted((e,t)=>e.x-t.x||e.y-t.y),i=(e,t,n)=>(t.x-e.x)*(n.y-e.y)-(t.y-e.y)*(n.x-e.x),a=[];for(let e of r){for(;a.length>=2&&i(a[a.length-2],a[a.length-1],e)<=0;)a.pop();a.push(e)}let o=[];for(let e of r.toReversed()){for(;o.length>=2&&i(o[o.length-2],o[o.length-1],e)<=0;)o.pop();o.push(e)}return[...a.slice(0,-1),...o.slice(0,-1)]}function Ee(e,t,n=3){let r=new Map;for(let t of e)t.from!==t.to&&r.set(t.to,[...r.get(t.to)||[],t.from]);let i=new Map,a=[t];for(let e=1;e<=n&&a.length;e++){let n=[];for(let o of a)for(let a of r.get(o)||[])a===t||i.has(a)||(i.set(a,e),n.push(a));a=n}return i}var De=e=>{let t=new Map;for(let n of e)n.from!==n.to&&(t.set(n.from,(t.get(n.from)||0)+1),t.set(n.to,(t.get(n.to)||0)+1));return t};function Oe(e,t=[]){let n=[...new Set(e.map(e=>e.type))];return[...t.filter(e=>n.includes(e)),...n.filter(e=>!t.includes(e)).sort((e,t)=>e.localeCompare(t))]}function ke(e,t,n=[],r={},i=1.6){let a=r.left||[],o=r.right||[],s=Oe(e,n),c=s.filter(e=>!a.includes(e)&&!o.includes(e)),l={left:s.filter(e=>a.includes(e)),right:s.filter(e=>o.includes(e))},u=t=>e.filter(e=>e.type===t).sort((e,t)=>e.id.localeCompare(t.id)),d=e=>u(e).every(e=>e.r<=3.5),f=e=>d(e)?26:130,p=e=>d(e)?26:92,m=(e,t)=>Math.max(1,Math.ceil(u(e).length/Math.max(2,Math.floor(t/f(e))))),h=e=>c.reduce((t,n)=>t+m(n,e)*p(n)+34+(d(n)?10:0),0),g=Math.max(0,...[...l.left,...l.right].map(e=>u(e).length*70+34)),_=Math.max(520,Math.max(...c.map(e=>Math.min(u(e).length,6)*f(e)),0));for(let e=0;e<3;e++)_=Math.max(520,Math.max(h(_),g)*i-(l.left.length?190:0)-(l.right.length?190:0));let v=Math.max(h(_),g,126),y=new Map;for(let e of t)e.from!==e.to&&(y.set(e.from,[...y.get(e.from)||[],e.to]),y.set(e.to,[...y.get(e.to)||[],e.from]));let b=new Map,x=[],S=[],C=-v/2;for(let e of c){let t=u(e),n=m(e,_),r=p(e),i=n*r+34+(d(e)?10:0);S.push({t:e,list:t,y0:C,lines:n,lineH:r}),x.push({type:e,x0:-_/2,x1:_/2,y0:C,y1:C+i-8}),C+=i}let w=e=>{let t=Math.ceil(e.list.length/e.lines);e.list.forEach((n,r)=>{let i=Math.floor(r/t),a=Math.min(t,e.list.length-i*t),o=r-i*t;b.set(n.id,{x:-_/2+(o+.5)*_/a,y:e.y0+34+(e.lineH<92?4:16)+i*e.lineH})})};S.forEach(w);let T={left:-_/2-24-95,right:_/2+24+95};for(let e of[`left`,`right`])l[e].forEach((t,n,r)=>{let i=u(t),a=v/r.length,o=-v/2+n*a;x.push({type:t,x0:T[e]-95,x1:T[e]+95,y0:o,y1:o+a-8,side:e}),i.forEach((t,n)=>b.set(t.id,{x:T[e],y:o+34+(n+.5)*(a-34-8)/i.length}))});for(let e=0;e<6;e++)for(let e of S){let t=new Set(e.list.map(e=>e.id)),n=e=>{let n=(y.get(e.id)||[]).filter(e=>!t.has(e)&&b.has(e));return n.length?n.reduce((e,t)=>e+b.get(t).x,0)/n.length:b.get(e.id).x},r=e.list.map(e=>({n:e,k:n(e)}));r.sort((e,t)=>e.k-t.k||e.n.id.localeCompare(t.n.id)),e.list=r.map(e=>e.n),w(e)}return{at:b,tiers:x,extent:{x0:l.left.length?T.left-95:-_/2,x1:l.right.length?T.right+95:_/2,y0:-v/2,y1:v/2}}}function Ae(e,t,n=[],r=1.6){let i=Oe(e,n),a=De(t),o=Math.max(3,...e.map(e=>e.r)),s=(2*o+7)*.58,c=i.map(t=>{let n=e.filter(e=>e.type===t).sort((e,t)=>(a.get(t.id)||0)-(a.get(e.id)||0)||e.id.localeCompare(t.id));return{type:t,spots:n.map((e,t)=>{let r=s*Math.sqrt(t+(n.length>1?.5:0)),i=t*2.39996323;return{id:e.id,x:Math.cos(i)*r,y:Math.sin(i)*r}}),r:(n.length>1?s*Math.sqrt(n.length-.5):0)+o+14}}),l=Math.max(1,Math.min(c.length,Math.round(Math.sqrt(c.length*r)))),u=[];for(let e=0;e<c.length;e+=l)u.push(c.slice(e,e+l));let d=u.map(e=>2*Math.max(...e.map(e=>e.r))+46),f=d.reduce((e,t)=>e+t,0),p=new Map,m=[],h=-f/2,g=0;u.forEach((e,t)=>{let n=e.reduce((e,t)=>e+2*t.r+46,0);g=Math.max(g,n);let r=-n/2,i=h+d[t]/2;for(let t of e){let e=r+t.r+23;m.push({type:t.type,x:e,y:i,r:t.r});for(let n of t.spots)p.set(n.id,{x:e+n.x,y:i+n.y});r+=2*t.r+46}h+=d[t]});let _=new Set(c.flatMap(e=>e.spots[0]?[e.spots[0].id]:[]));return{at:p,areas:m,extent:{x0:-g/2,x1:g/2,y0:-f/2-10,y1:f/2},hubs:_}}var je={ArrowLeft:`left`,ArrowRight:`right`,ArrowUp:`up`,ArrowDown:`down`};function Me(e,t,n){let r=e.find(e=>e.id===t);if(!r)return e[0]?.id??t;let i=null;for(let a of e){if(a.id===t)continue;let e=a.x-r.x,o=a.y-r.y,s=n===`right`?e:n===`left`?-e:n===`down`?o:-o,c=Math.abs(n===`left`||n===`right`?o:e);if(s<=.5)continue;let l=s+2*c;(!i||l<i.score)&&(i={id:a.id,score:l})}return i?.id??t}function Ne(e){if(!e.length)return null;let t=e.reduce((e,t)=>e+t.x,0)/e.length,n=e.reduce((e,t)=>e+t.y,0)/e.length;return e.reduce((e,r)=>Math.hypot(r.x-t,r.y-n)<Math.hypot(e.x-t,e.y-n)?r:e,e[0]).id}var Pe=(e,t)=>e.filter(e=>e.from===t||e.to===t);function Fe(e,t){let n=Pe(e,t.node);if(!n.length)return{node:t.node};let r=n[(t.edge?n.findIndex(e=>e.id===t.edge):-1)+1];return r?{node:t.node,edge:r.id}:{node:t.node}}function Ie(e,t){let n=e.find(e=>e.id===t.edge);return n?{node:n.from===t.node?n.to:n.from}:t}function Le(e,t,n,r=48){let i=e.x+t.x*e.k,a=e.y+t.y*e.k;return i>=r&&i<=n.w-r&&a>=r&&a<=n.h-r?e:{...e,x:n.w/2-t.x*e.k,y:n.h/2-t.y*e.k}}function Re(e,t,n){let r=Math.min(4,Math.max(.1,e.k*t)),i=n.w/2,a=n.h/2;return{k:r,x:i-(i-e.x)/e.k*r,y:a-(a-e.y)/e.k*r}}var $=a(),ze=[`#ef6c35`,`#1f4e8c`,`#2b9b74`,`#e2447a`,`#7b8190`,`#f2a33a`,`#3f7fd8`,`#8e5bd6`,`#14a1b5`,`#b8456b`,`#5c8d3e`,`#c27c2c`],Be=`#e2447a`,Ve=`var(--color-muted)`,He=150,Ue=14,We=40;function Ge({title:e,nodes:n,edges:a,colourOfType:c,types:l,typesTitle:u,picked:d,onPick:f,detail:p,onRefresh:m,refreshing:h,ringOf:g,groupByType:_,edgesPickable:v=!0,height:y,hint:b,bare:x,colourOf:S,legend:C,lit:w,onHover:T,namedOf:E,outlines:D,outlineColourOf:ee,onGroupPick:O,spacing:k=1,layout:A=`force`,order:te,sides:ne,quietLines:ie}){let j=(0,Q.useRef)(null),[,oe]=(0,Q.useState)(0),[M,N]=(0,Q.useState)({x:0,y:0,k:1}),[P,se]=(0,Q.useState)(!1),F=(0,Q.useRef)(!1),I=(0,Q.useRef)(!1),L=(0,Q.useRef)(()=>{}),R=(0,Q.useRef)(null),z=(0,Q.useRef)({}),[B,V]=(0,Q.useState)(null),[H,U]=(0,Q.useState)(null),[W,G]=(0,Q.useState)(!1),[ce,K]=(0,Q.useState)(``),le=(0,Q.useId)(),{nodes:q,edges:J}=(0,Q.useMemo)(()=>{let e=n.map((e,t)=>({id:e.id,n:e,x:Math.cos(t*2.4)*(40+t*1.5),y:Math.sin(t*2.4)*(40+t*1.5)})),t=new Set(e.map(e=>e.id)),r=new Set;return{nodes:e,edges:a.filter(e=>t.has(e.from)&&t.has(e.to)&&!r.has(e.id)&&!!r.add(e.id)).map(e=>({id:e.id,source:e.from,target:e.to,from:e.from,to:e.to,label:e.label}))}},[n,a]);(0,Q.useEffect)(()=>{if(A!==`force`){let e=q.map(e=>({id:e.id,type:e.n.type,r:e.n.r??6})),t=J.map(e=>({from:e.from,to:e.to})),n=j.current,r=n&&n.clientHeight>260?n.clientWidth/(n.clientHeight-150):1.6,i=A===`tiers`?ke(e,t,te,ne,Math.min(3.2,Math.max(.8,r))):Ae(e,t,te);for(let e of q){let t=i.at.get(e.id);t&&(e.x=t.x,e.y=t.y,e.vx=0,e.vy=0)}z.current={extent:i.extent,...`tiers`in i?{tiers:i.tiers}:{areas:i.areas,hubs:i.hubs}};let a=xe(q).alpha(0).stop(),o=0;return a.on(`tick`,()=>{cancelAnimationFrame(o),o=requestAnimationFrame(()=>oe(e=>e+1))}),R.current=a,F.current=!1,oe(e=>e+1),()=>{a.stop(),cancelAnimationFrame(o)}}z.current={};let e=[...new Set(q.map(e=>e.n.type))],t=!!(_&&e.length>1),n=new Map,r=new Map,i=new Map;for(let e of q)n.set(e.n.type,(n.get(e.n.type)||0)+1),r.set(e.n.type,(r.get(e.n.type)||0)+(e.n.r??6)),i.set(e.n.type,Math.max(i.get(e.n.type)||0,e.n.r??6));let a=e=>Math.sqrt(n.get(e)||1)*(2*((r.get(e)||6)/(n.get(e)||1))+14)+2*(i.get(e)||6)+(D?60:30),o=e.reduce((e,t)=>e+a(t),0),s=Math.max(140,o/(2*Math.PI)),c=0,l=new Map(e.map(e=>{let n=c+a(e)/2;c+=a(e);let r=n/o*2*Math.PI;return[e,t?{x:Math.cos(r)*s,y:Math.sin(r)*s}:{x:0,y:0}]})),u=t?D?.3:.12:.07,d=xe(q).force(`link`,ae(J).id(e=>e.id).distance(80*k).strength(e=>t&&e.source.n.type!==e.target.n.type?D?.01:.05:t?.12:.3)).force(`charge`,Se().strength((q.length>300?-60:-150)*k).distanceMax(360*k)).force(`collide`,re(e=>(e.n.r??6)+10)).force(`x`,Ce(e=>l.get(e.n.type).x).strength(u)).force(`y`,we(e=>l.get(e.n.type).y).strength(u)).alphaDecay(.028);d.stop(),d.tick(260),F.current=!1;let f=0;return d.on(`tick`,()=>{cancelAnimationFrame(f),f=requestAnimationFrame(()=>oe(e=>e+1))}),d.on(`end`,()=>{I.current||L.current()}),d.alpha(.2).restart(),R.current=d,oe(e=>e+1),()=>{d.stop(),cancelAnimationFrame(f)}},[q,J,_,D,k,A,te?.join(`\0`),JSON.stringify(ne??{}),A!==`force`&&P]);let ue=()=>{let e=j.current;if(!e||!q.length)return;let t=q.map(e=>e.x??0),n=q.map(e=>e.y??0),r=z.current.extent,[i,a,o,s]=r?[r.x0-30,r.x1+30,r.y0-30,r.y1+120]:[Math.min(...t)-40,Math.max(...t)+120,Math.min(...n)-60,Math.max(...n)+40],c=Math.max(r?.3:.75,Math.min(1.6,e.clientWidth/Math.max(1,a-i),e.clientHeight/Math.max(1,s-o)));N({k:c,x:e.clientWidth/2-(i+a)/2*c,y:e.clientHeight/2-(o+s)/2*c})};L.current=ue,(0,Q.useEffect)(()=>{!F.current&&q.length&&j.current?.clientWidth&&(F.current=!0,ue())}),(0,Q.useEffect)(()=>{F.current=!1},[P]),(0,Q.useEffect)(()=>{let e=j.current;if(!e)return;let t=t=>{I.current=!0,t.preventDefault();let n=e.getBoundingClientRect(),r=t.clientX-n.left,i=t.clientY-n.top;N(e=>{let n=Math.min(4,Math.max(.1,e.k*Math.exp(-t.deltaY*(t.ctrlKey?.01:.0015))));return{k:n,x:r-(r-e.x)/e.k*n,y:i-(i-e.y)/e.k*n}})};return e.addEventListener(`wheel`,t,{passive:!1}),()=>e.removeEventListener(`wheel`,t)},[]);let de=(0,Q.useRef)(null),fe=(e,t)=>{I.current=!0,e.stopPropagation(),G(!1),e.target.setPointerCapture?.(e.pointerId),de.current={kind:t?`node`:`pan`,id:t,sx:e.clientX,sy:e.clientY,vx:M.x,vy:M.y,moved:!1}},pe=e=>{let t=de.current;if(!t)return;let n=e.clientX-t.sx,r=e.clientY-t.sy;if(Math.abs(n)+Math.abs(r)>3&&(t.moved=!0),t.kind===`pan`)N(e=>({...e,x:t.vx+n,y:t.vy+r}));else if(t.moved){let n=q.find(e=>e.id===t.id),r=j.current.getBoundingClientRect();n&&(n.fx=(e.clientX-r.left-M.x)/M.k,n.fy=(e.clientY-r.top-M.y)/M.k,R.current?.alphaTarget(.15).restart())}},me=()=>{let e=de.current;if(de.current=null,e){if(e.kind===`node`){let t=q.find(t=>t.id===e.id);t&&(t.fx=null,t.fy=null),R.current?.alphaTarget(0),e.moved||(f(d?.kind===`node`&&d.id===e.id?null:{kind:`node`,id:e.id}),V({node:e.id}))}else e.moved||f(null)}},Y=new Map(q.map(e=>[e.id,e])),X=new Set,he=new Set,Z=w===void 0?d?.kind===`node`?d.id:!d&&H?H:null:null;if(w){for(let e of w)X.add(e);for(let e of J)w.has(e.from)&&w.has(e.to)&&he.add(e.id)}else if(w!==null){if(Z){X.add(Z);for(let e of J)(e.from===Z||e.to===Z)&&(he.add(e.id),X.add(e.from),X.add(e.to))}else if(d?.kind===`edge`){let e=J.find(e=>e.id===d.id);e&&(he.add(e.id),X.add(e.from),X.add(e.to))}}let ge=w===void 0?!!(Z||d):!!w,_e=q.length<=(A===`areas`?40:He),ve=J.length<=We,ye=e=>`M ${e.x-e.r} ${e.y} a ${e.r} ${e.r} 0 1 0 ${2*e.r} 0 a ${e.r} ${e.r} 0 1 0 ${-2*e.r} 0 Z`,be=D&&z.current.areas?z.current.areas.map(e=>({t:e.type,d:ye(e),top:{x:e.x,y:e.y-e.r-6/M.k},colour:ee?.(e.type)??c(e.type)})):D?[...new Set(q.map(e=>e.n.type))].map(e=>{let t=q.filter(t=>t.n.type===e),n=Math.max(...t.map(e=>e.n.r??6))+12,r=Te(t.map(e=>({x:e.x??0,y:e.y??0})),n),i=r.reduce((e,t)=>t.y<e.y?t:e,r[0]??{x:0,y:0});return{t:e,d:r.length>2?`M ${r.map(e=>`${e.x.toFixed(1)} ${e.y.toFixed(1)}`).join(` L `)} Z`:``,top:{x:i.x,y:i.y-6/M.k},colour:ee?.(e)??c(e)}}):[],Ee=new Map,De=e=>{let t=Y.get(e.from),n=Y.get(e.to);if(!t||!n)return null;let r=[e.from,e.to].sort().join(`|`),i=Ee.get(r)??0;Ee.set(r,i+1);let[a,o,s,c]=[t.x??0,t.y??0,n.x??0,n.y??0];if(A===`tiers`){let e=i*12,t=Math.abs(s-a)>Math.abs(c-o)*1.4,[n,r,l,u]=Math.abs(c-o)<1?[a,o-46-e,s,c-46-e]:t?[(a+s)/2,o+e,(a+s)/2,c+e]:[a+e,(o+c)/2,s+e,(o+c)/2];return{d:`M${a},${o} C${n},${r} ${l},${u} ${s},${c}`,mx:.125*a+.375*n+.375*l+.125*s,my:.125*o+.375*r+.375*u+.125*c}}let l=s-a,u=c-o,d=Math.hypot(l,u)||1,f=((A===`areas`?.1:.18)+i*.14)*d,p=(a+s)/2-u/d*f,m=(o+c)/2+l/d*f;return{d:`M${a},${o} Q${p},${m} ${s},${c}`,mx:.25*a+.5*p+.25*s,my:.25*o+.5*m+.25*c}},Oe=e=>Y.get(e)?.n.name??e,ze=e=>{if(!e)return K(``);let t=Y.get(e.node);if(!t)return K(``);let n=Pe(J,e.node),r=e.edge?n.find(t=>t.id===e.edge):void 0;if(r){let t=r.from===e.node?r.to:r.from;return K(`${r.label}: ${Oe(r.from)} to ${Oe(r.to)}, ${n.indexOf(r)+1} of ${n.length}. F goes to ${Oe(t)}.`)}K(`${t.n.name}, ${t.n.type}. ${n.length} relationship${n.length===1?``:`s`}.`)},Ge=()=>({w:j.current?.clientWidth??0,h:j.current?.clientHeight??0}),Ke=e=>{V(e),T?.(e?.node??null),ze(e);let t=e&&Y.get(e.node);t&&N(e=>Le(e,{x:t.x??0,y:t.y??0},Ge()))},qe=()=>q.map(e=>({id:e.id,x:e.x??0,y:e.y??0})),Je=e=>{if(e.target!==e.currentTarget||e.altKey||e.ctrlKey||e.metaKey)return;G(!0);let t=B&&Y.has(B.node)?B:null,n=je[e.key],r=!0;if((n&&e.shiftKey||[`+`,`=`,`-`,`_`].includes(e.key))&&(I.current=!0),n&&e.shiftKey)N(e=>({...e,x:e.x+(n===`left`?60:n===`right`?-60:0),y:e.y+(n===`up`?60:n===`down`?-60:0)}));else if(n){let e=t?.node??Ne(qe());e&&Ke(t?{node:Me(qe(),e,n)}:{node:e})}else if(e.key===`Home`){let e=Ne(qe());e&&Ke({node:e})}else if(e.key===`r`||e.key===`R`)t?Ke(Fe(J,t)):r=!1;else if(e.key===`f`||e.key===`F`)t?.edge?Ke(Ie(J,t)):r=!1;else if(e.key===`Enter`||e.key===` `){if(t){let e=t.edge?{kind:`edge`,id:t.edge}:{kind:`node`,id:t.node},n=d?.kind!==e.kind||d.id!==e.id;f(n?e:null),K(n?`Details of ${t.edge?`the relationship`:Oe(t.node)} are open beside the graph. Escape closes them.`:`Details closed.`)}else{let e=Ne(qe());e&&Ke({node:e})}}else e.key===`Escape`?d?(f(null),K(`Details closed.`)):P?se(!1):r=!1:e.key===`+`||e.key===`=`?N(e=>Re(e,1.25,Ge())):e.key===`-`||e.key===`_`?N(e=>Re(e,.8,Ge())):e.key===`0`?ue():r=!1;r&&e.preventDefault()},Ye=W&&B&&Y.has(B.node)?B:null;return(0,$.jsxs)(`div`,{className:o(`flex flex-col overflow-hidden border border-line bg-bg`,P?`fixed inset-0 z-50`:x?`relative size-full border-0`:`relative rounded-[12px]`),style:P||x?void 0:{height:y??`max(600px, calc(var(--screen) - 280px))`},children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-line-soft px-4 py-2`,children:[(0,$.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col`,children:[(0,$.jsx)(`h3`,{className:`m-0 text-[13px] font-semibold text-ink`,children:e}),b&&(0,$.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:b})]}),m&&(0,$.jsxs)(s,{size:`sm`,disabled:h,onClick:m,"data-tip":`Read the population again`,children:[(0,$.jsx)(t,{"aria-hidden":`true`}),`Refresh`]}),(0,$.jsx)(s,{size:`icon-sm`,variant:`outline`,"aria-pressed":P,"aria-label":P?`Leave full screen`:`Full screen`,"data-tip":P?`Leave full screen`:`Full screen`,onClick:()=>se(e=>!e),children:(0,$.jsx)(i,{"aria-hidden":`true`})})]}),(0,$.jsxs)(`div`,{ref:j,tabIndex:0,role:`application`,"aria-roledescription":`graph`,"aria-label":`${e}: ${q.length} nodes and ${J.length} relationships`,"aria-describedby":le,className:`relative flex-1 touch-none overflow-hidden select-none focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-accent`,onKeyDown:Je,onBlur:e=>{e.target===e.currentTarget&&(G(!1),T?.(null))},style:{backgroundImage:`radial-gradient(var(--color-line) 1px, transparent 1px)`,backgroundSize:`18px 18px`},onPointerDown:e=>fe(e),onPointerMove:pe,onPointerUp:me,onPointerCancel:me,children:[(0,$.jsx)(`svg`,{"aria-hidden":`true`,className:`absolute inset-0 size-full`,children:(0,$.jsxs)(`g`,{transform:`translate(${M.x},${M.y}) scale(${M.k})`,children:[(z.current.tiers||[]).map(e=>{let t=c(e.type);return(0,$.jsxs)(`g`,{className:`pointer-events-none`,opacity:ge?.55:1,children:[(0,$.jsx)(`rect`,{x:e.x0,y:e.y0,width:e.x1-e.x0,height:e.y1-e.y0,rx:14,fill:t,fillOpacity:.05,stroke:t,strokeOpacity:.3,strokeWidth:1.2/M.k}),(0,$.jsx)(`text`,{x:e.x0+14,y:e.y0+20,fill:t,fontWeight:600,fontSize:11,style:{letterSpacing:`0.06em`,textTransform:`uppercase`},children:e.type})]},`tier:${e.type}`)}),be.map(e=>(0,$.jsxs)(`g`,{className:`pointer-events-none`,opacity:ge?.4:1,children:[e.d&&(0,$.jsx)(`path`,{d:e.d,fill:e.colour,fillOpacity:.05,stroke:e.colour,strokeOpacity:.45,strokeWidth:1.2/M.k,strokeLinejoin:`round`}),(0,$.jsx)(`text`,{x:e.top.x,y:e.top.y,textAnchor:`middle`,fill:e.colour,fontWeight:600,fontSize:Math.max(10,12/M.k),className:O?`pointer-events-auto cursor-pointer hover:underline`:void 0,onPointerDown:O?e=>e.stopPropagation():void 0,onClick:O?()=>O(e.t):void 0,"data-tip":O?`Open ${e.t}`:void 0,style:{paintOrder:`stroke`,stroke:`var(--color-bg)`,strokeWidth:4/M.k},children:e.t})]},`hull:${e.t}`)),J.map(e=>{let t=De(e);if(!t)return null;let n=he.has(e.id);return(0,$.jsxs)(`g`,{opacity:ge&&!n?.35:1,children:[(0,$.jsx)(`path`,{d:t.d,fill:`none`,stroke:n?Be:Ve,strokeOpacity:n?1:ie?.2:A===`areas`?J.length>60?.12:.22:A===`tiers`&&J.length>60?.14:.45,strokeWidth:n?2.2:1}),Ye?.edge===e.id&&(0,$.jsx)(`path`,{d:t.d,fill:`none`,stroke:`var(--color-ink)`,strokeWidth:2.5,strokeDasharray:`4 3`}),v&&(0,$.jsx)(`path`,{d:t.d,fill:`none`,stroke:`transparent`,strokeWidth:10,className:`cursor-pointer`,onPointerDown:e=>e.stopPropagation(),onClick:t=>(t.stopPropagation(),f(d?.kind===`edge`&&d.id===e.id?null:{kind:`edge`,id:e.id}))}),(ve&&A!==`areas`&&!ie||n)&&e.label&&(0,$.jsx)(`text`,{x:t.mx,y:t.my,textAnchor:`middle`,fontSize:A===`tiers`?9.5:8,fill:n?Be:`var(--color-muted)`,className:`pointer-events-none`,style:{paintOrder:`stroke`,stroke:`var(--color-bg)`,strokeWidth:3},children:e.label})]},e.id)}),q.map(e=>{let t=X.has(e.id),n=ge&&!t,r=e.n.r??6,i=g?.(e.id),a=A===`areas`?t||M.k>=3||!!z.current.hubs?.has(e.id)||Ye?.node===e.id||!!E?.(e.id):A===`tiers`?r>3.5&&_e||t||M.k>=2||Ye?.node===e.id||!!E?.(e.id):_e||t||M.k>=1.3||r>=12||Ye?.node===e.id||!!E?.(e.id);return(0,$.jsxs)(`g`,{transform:`translate(${e.x??0},${e.y??0})`,opacity:n?i?.75:.3:1,className:`cursor-pointer`,onPointerDown:t=>fe(t,e.id),onPointerEnter:()=>(U(e.id),T?.(e.id)),onPointerLeave:()=>(U(t=>t===e.id?null:t),T?.(null)),children:[i&&(0,$.jsx)(`circle`,{r:r+3.5,fill:`none`,stroke:i,strokeWidth:2.5}),d?.kind===`node`&&d.id===e.id&&(0,$.jsx)(`circle`,{r:r+5,fill:`none`,stroke:Be,strokeWidth:2}),Ye?.node===e.id&&(0,$.jsx)(`circle`,{r:r+9,fill:`none`,stroke:`var(--color-ink)`,strokeWidth:2,strokeDasharray:Ye.edge?`2 3`:void 0}),(0,$.jsx)(`circle`,{r,fill:S?S(e.id):c(e.n.type),stroke:`var(--color-bg)`,strokeWidth:2}),a&&(0,$.jsx)(`text`,{x:A===`tiers`?0:r+4,y:A===`tiers`?r+15:3,textAnchor:A===`tiers`?`middle`:void 0,fontSize:A===`tiers`?12:9,fill:`var(--color-ink-2)`,style:{paintOrder:`stroke`,stroke:`var(--color-bg)`,strokeWidth:3},children:e.n.name})]},e.id)})]})}),p&&(0,$.jsxs)(`section`,{"aria-label":p.title,className:`absolute top-3 right-3 z-10 flex max-h-[calc(100%-24px)] w-[300px] max-w-[calc(100%-24px)] flex-col overflow-y-auto rounded-[12px] border border-line bg-bg shadow-lg`,onPointerDown:e=>e.stopPropagation(),children:[(0,$.jsxs)(`div`,{className:`flex items-center gap-2 border-b border-line-soft px-4 py-4`,children:[(0,$.jsx)(`h4`,{className:`m-0 flex-1 text-[13px] font-semibold text-ink`,children:p.title}),p.pill&&(0,$.jsx)(`span`,{className:`rounded-full px-2 py-1 text-[13px] font-medium text-white`,style:{background:p.pill.colour},children:p.pill.text}),(0,$.jsx)(s,{variant:`icon`,size:`icon-sm`,"aria-label":`Close the details`,"data-tip":`Close the details`,onClick:()=>f(null),children:(0,$.jsx)(r,{"aria-hidden":`true`})})]}),(0,$.jsx)(`div`,{className:`flex flex-col gap-4 px-4 py-4 text-[13px]`,children:p.body})]}),(0,$.jsxs)(`section`,{"aria-label":u,className:`absolute bottom-3 left-3 z-10 max-w-[calc(100%-24px)] rounded-[12px] border border-line bg-bg px-4 py-4 shadow-md`,onPointerDown:e=>e.stopPropagation(),children:[(0,$.jsx)(`h4`,{className:`m-0 mb-2 text-[13px] font-semibold tracking-[0.08em] text-[color:var(--color-warn)] uppercase`,children:u}),(0,$.jsxs)(`ul`,{className:`m-0 grid list-none grid-cols-1 gap-x-4 gap-y-2 p-0 text-[13px] text-ink-2 @md:grid-cols-2 @2xl:grid-cols-3`,children:[C?C.map(e=>(0,$.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:o(`size-2.5 flex-none rounded-full`,e.ring&&`size-3 border-2`),style:e.ring?{borderColor:e.colour}:{background:e.colour}}),e.label,e.n!==void 0&&(0,$.jsx)(`span`,{className:`text-muted tabular-nums`,children:e.n})]},e.label)):l.slice(0,Ue).map(e=>(0,$.jsxs)(`li`,{className:`flex items-center gap-2`,children:[(0,$.jsx)(`span`,{"aria-hidden":`true`,className:`size-2.5 flex-none rounded-full`,style:{background:c(e)}}),e]},e)),!C&&l.length>Ue&&(0,$.jsxs)(`li`,{className:`text-muted`,children:[`and `,l.length-Ue,` more`]})]})]}),(0,$.jsx)(`p`,{id:le,className:o(`absolute top-3 left-3 z-10 m-0 max-w-[calc(100%-340px)] rounded-[8px] border border-line bg-bg px-4 py-2 text-[13px] text-ink-2 shadow-md`,!W&&`sr-only`),children:`Arrows move to the nearest one · R its relationships · F follows one · Enter details · Escape closes · + − zoom · 0 fits · Shift+arrows pan`})]}),(0,$.jsx)(`p`,{"aria-live":`polite`,className:`sr-only`,children:ce})]})}function Ke({label:e,children:t}){return(0,$.jsxs)(`div`,{className:`grid grid-cols-[96px_1fr] gap-2`,children:[(0,$.jsxs)(`span`,{className:`text-muted`,children:[e,`:`]}),(0,$.jsx)(`span`,{className:`min-w-0 text-ink [overflow-wrap:anywhere]`,children:t})]})}function qe({title:e,children:t}){return(0,$.jsxs)(`div`,{className:`flex flex-col gap-2 border-t border-line-soft pt-4`,children:[(0,$.jsxs)(`span`,{className:`font-semibold text-ink`,children:[e,`:`]}),t]})}var Je=({children:e})=>(0,$.jsx)(`span`,{className:`rounded-full border border-line px-2 py-1 text-[13px] text-ink-2`,children:e});export{ze as a,Y as c,Ge as i,J as l,Ke as n,Ee as o,qe as r,K as s,Je as t,M as u};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{E as t,In as n,It as r,Lr as i,M as a,N as o,R as s,_t as c,ct as l,fn as u}from"./line-icons-rdF8DYDJ.js";import{r as d}from"./route-BloYJWgw.js";import{t as f}from"./jsx-runtime-LKYXHABd.js";import{A as p,Dt as m,j as h,n as g}from"./input-CtzK50ZF.js";import{c as _,d as v,f as y,i as b,o as x,s as S}from"./filters-CnAMr286.js";import{$ as C}from"./palette-DAaGSao7.js";import{D as w,Fn as T,Gt as E,H as D,In as O,J as k,Sn as A,U as j,Ut as M,Wt as N,_ as P,g as F,xt as I,yt as L}from"./index-B3JsM7tv.js";import{n as R}from"./families-BBFFrUlo.js";var z=e(i(),1),B=f(),V={suite:`Suite`,monitor:`Monitor round`,run:`Browser run`,explore:`Exploration`,api:`API run`,desktop:`Desktop run`,mobile:`Mobile run`,page:`Report page`},H=e=>{if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString([],{month:`short`,day:`numeric`,...t.getFullYear()===new Date().getFullYear()?{}:{year:`numeric`},hour:`numeric`,minute:`2-digit`})},U=e=>{if(!e)return``;let t=Math.round(e/1e3);return t<60?`${t}s`:t<3600?`${Math.floor(t/60)}m ${t%60}s`:`${Math.floor(t/3600)}h ${Math.floor(t%3600/60)}m`};function W(e){return e.scope===`page`?{tone:`neutral`,label:`Report`}:e.counts.total?e.counts.failed?{tone:`fail`,label:`${e.counts.failed} failed`}:e.stopped||e.counts.other?{tone:`warn`,label:e.stopped?`Stopped`:`${e.counts.other} not run`}:{tone:`pass`,label:`Passed`}:{tone:`neutral`,label:`No results`}}var G=50;function K({r:e}){let t=W(e),n=e.scope===`page`?c:t.tone===`pass`?a:t.tone===`fail`?s:o;return(0,B.jsx)(n,{size:16,"aria-label":t.label,className:p(`flex-none`,t.tone===`pass`?`text-pass`:t.tone===`fail`?`text-fail`:t.tone===`warn`?`text-warn`:`text-muted`)})}var q=e=>{let t=new Date(`${e}T12:00:00`);return Number.isNaN(t.getTime())?e:t.toLocaleDateString([],{day:`numeric`,month:`short`})},J=e=>{let t=e.reduce((e,t)=>e+t.cases,0);return t?Math.round(e.reduce((e,t)=>e+t.passed,0)/t*100):null};function Y({title:e,note:t,children:n,className:r}){return(0,B.jsxs)(`section`,{className:p(`flex min-w-0 flex-col rounded-[14px] card border px-4 py-4`,r),children:[(0,B.jsx)(`h3`,{className:`m-0 text-[16px] font-semibold`,children:e}),t&&(0,B.jsx)(`p`,{className:`m-0 mt-1 text-[13px] text-muted`,children:t}),(0,B.jsx)(`div`,{className:`mt-4 flex min-w-0 flex-col`,children:n})]})}function X({part:e,whole:t,tone:n,label:r}){return(0,B.jsxs)(`span`,{className:`flex flex-none items-center gap-2`,children:[(0,B.jsx)(`span`,{"aria-hidden":`true`,className:`h-1.5 w-16 flex-none overflow-hidden rounded-full bg-surface-strong`,children:(0,B.jsx)(`span`,{className:p(`block h-full rounded-full transition-[width] duration-200 ease-out`,n===`pass`?`bg-pass`:n===`fail`?`bg-fail`:`bg-accent`),style:{width:`${t?Math.max(4,e/t*100):0}%`}})}),(0,B.jsx)(`span`,{className:`text-[13px] whitespace-nowrap text-ink-2 tabular-nums`,children:r})]})}function Z({days:e}){let[t,n]=(0,z.useState)(null),r=e.slice(-30);if(!r.length)return(0,B.jsx)(`p`,{className:`m-0 py-6 text-sm text-muted`,children:`No runs with results yet.`});let i=Math.max(1,...r.map(e=>e.cases)),a=i<=4?1:Math.ceil(i/4/5)*5||1,o=Math.ceil(i/a)*a,s=[o,Math.round(o/2),0],c=Math.ceil(r.length/8),l=t===null?null:r[t];return(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,B.jsxs)(`div`,{"aria-hidden":`true`,className:`flex gap-4 text-[13px] text-ink-2`,children:[(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`size-2.5 rounded-[3px] bg-pass`}),` Passed`]}),(0,B.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`size-2.5 rounded-[3px] bg-fail`}),` Failed`]})]}),(0,B.jsxs)(`div`,{className:`relative grid grid-cols-[32px_minmax(0,1fr)] gap-x-2`,children:[(0,B.jsx)(`div`,{"aria-hidden":`true`,className:`flex h-[180px] flex-col justify-between text-right text-[13px] text-muted tabular-nums`,children:s.map(e=>(0,B.jsx)(`span`,{className:`-translate-y-1/2 first:translate-y-0 last:translate-y-0`,children:e},e))}),(0,B.jsxs)(`div`,{className:`relative h-[180px]`,onMouseLeave:()=>n(null),children:[s.map((e,t)=>(0,B.jsx)(`span`,{"aria-hidden":`true`,className:p(`absolute inset-x-0 border-t`,t===s.length-1?`border-line`:`border-line-soft`),style:{top:`${(1-e/o)*100}%`}},e)),(0,B.jsx)(`div`,{className:`absolute inset-0 flex items-end gap-1`,children:r.map((e,r)=>{let i=e.cases-e.passed;return(0,B.jsx)(`div`,{className:`flex h-full min-w-0 flex-1 cursor-default flex-col justify-end`,onMouseEnter:()=>n(r),children:(0,B.jsxs)(`div`,{className:p(`flex w-full flex-col justify-end gap-1 transition-opacity`,t!==null&&t!==r&&`opacity-50`),style:{height:`${e.cases/o*100}%`},children:[i>0&&(0,B.jsx)(`span`,{className:`min-h-[2px] w-full rounded-t-[4px] bg-fail`,style:{flexGrow:i}}),e.passed>0&&(0,B.jsx)(`span`,{className:p(`min-h-[2px] w-full bg-pass`,!i&&`rounded-t-[4px]`),style:{flexGrow:e.passed}})]})},e.day)})}),l&&(0,B.jsxs)(`div`,{role:`status`,className:`pointer-events-none absolute z-[2] w-max max-w-[220px] -translate-x-1/2 -translate-y-[calc(100%+8px)] rounded-[10px] border border-line-soft bg-surface-muted px-4 py-2 text-[13px] shadow-composer`,style:{left:`${Math.min(88,Math.max(12,(t+.5)/r.length*100))}%`,top:`${(1-l.cases/o)*100}%`},children:[(0,B.jsx)(`b`,{className:`block text-ink`,children:q(l.day)}),(0,B.jsxs)(`span`,{className:`block text-ink-2 tabular-nums`,children:[l.passed,` passed, `,l.cases-l.passed,` failed · `,J([l]),`%`]}),(0,B.jsx)(`span`,{className:`block text-muted`,children:h(l.runs,`run`)})]})]}),(0,B.jsx)(`span`,{}),(0,B.jsx)(`div`,{"aria-hidden":`true`,className:`mt-1 flex gap-1 text-[13px] text-muted`,children:r.map((e,t)=>(0,B.jsx)(`span`,{className:`min-w-0 flex-1 text-center whitespace-nowrap`,children:t%c===0&&(0,B.jsx)(`span`,{className:p(t/c%2==1&&`hidden @2xl:inline`),children:q(e.day)})},e.day))})]}),(0,B.jsxs)(`table`,{className:`sr-only`,children:[(0,B.jsx)(`caption`,{children:`Cases by day`}),(0,B.jsx)(`thead`,{children:(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`th`,{scope:`col`,children:`Day`}),(0,B.jsx)(`th`,{scope:`col`,children:`Runs`}),(0,B.jsx)(`th`,{scope:`col`,children:`Passed`}),(0,B.jsx)(`th`,{scope:`col`,children:`Failed`})]})}),(0,B.jsx)(`tbody`,{children:r.map(e=>(0,B.jsxs)(`tr`,{children:[(0,B.jsx)(`td`,{children:e.day}),(0,B.jsx)(`td`,{children:e.runs}),(0,B.jsx)(`td`,{children:e.passed}),(0,B.jsx)(`td`,{children:e.cases-e.passed})]},e.day))})]})]})}function Q({project:e,build:t,onBuilt:i}){let[a,o]=(0,z.useState)(t),[c,f]=(0,z.useState)(``),g=!!a?.running;(0,z.useEffect)(()=>{if(!g)return;let e=O(async()=>{try{let e=await m.buildStatus();o(e),e&&!e.running&&i()}catch{}},1200);return()=>T(e)},[g,i]);let b=e.cases?Math.round(e.passed/e.cases*100):null,C=J(e.days.slice(-7)),w=J(e.days.slice(-14,-7)),E=C!==null&&w!==null?C-w:null,D=[{label:`Runs`,value:String(e.runs),sub:e.runs?`${q(String(e.from).slice(0,10))} – ${q(String(e.to).slice(0,10))}`:void 0},{label:`Cases run`,value:String(e.cases),sub:(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(`span`,{className:`text-pass`,children:[e.passed,` passed`]}),` · `,(0,B.jsxs)(`span`,{className:p(e.failed&&`text-fail`),children:[e.failed,` failed`]})]})},{label:`Tokens`,value:I(e.tokens),sub:e.cost?L(e.cost.amount,e.cost.currency):void 0}];return(0,B.jsxs)(`section`,{"aria-labelledby":`project-h`,className:`flex min-w-0 flex-col gap-4`,children:[(0,B.jsx)(`h2`,{id:`project-h`,className:`sr-only`,children:`Project report`}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(`span`,{className:`min-w-0 flex-[1_1_240px] text-[13px] text-muted`,children:e.page?`The HTML report was built ${H(e.page.builtAt)}.`:`Every run, taken together. The HTML report has not been built yet.`}),e.page&&(0,B.jsxs)(v,{size:`sm`,"data-tip":`Open the HTML report`,onClick:async()=>f(await S(e.page.file)),children:[(0,B.jsx)(l,{"aria-hidden":`true`}),`Report`]}),(0,B.jsx)(v,{size:`sm`,variant:`outline`,disabled:g,"data-tip":e.page?`Build the HTML report again`:`Build the HTML report`,onClick:async()=>{f(``);try{o(await m.build())}catch(e){f(e.message)}},children:g?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(_,{state:`working`,px:14}),`Building…`]}):e.page?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(n,{"aria-hidden":`true`}),`Rebuild`]}):(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(r,{"aria-hidden":`true`}),`Build`]})})]}),c&&(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:c}),a&&(a.running||a.ok===!1)&&(0,B.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[!a.running&&(0,B.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:`forgeqe bi build stopped with a problem; its output is below.`}),(0,B.jsx)(`pre`,{"aria-label":`forgeqe bi build output`,"aria-live":`polite`,className:`m-0 max-h-[200px] overflow-auto rounded-[12px] bg-surface-muted px-4 py-4 font-mono text-[13px] leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:a.lines.length?a.lines.join(`
|
|
2
|
+
`):`Starting…`})]}),e.runs?(0,B.jsxs)(B.Fragment,{children:[(0,B.jsxs)(N,{label:`Project numbers`,children:[(0,B.jsx)(M,{label:`Pass rate`,big:!0,value:b===null?`–`:`${b}%`,tone:b!==null&&b<80?`text-fail`:void 0,change:E===null?void 0:{text:E===0?`Same`:`${E>0?`+`:`−`}${Math.abs(E)} ${Math.abs(E)===1?`point`:`points`}`,dir:E>0?`up`:E<0?`down`:`same`,good:E>0,against:E===0?`as the week before`:`on the week before`}}),D.map(e=>(0,B.jsx)(M,{label:e.label,value:e.value,note:e.sub},e.label))]}),(0,B.jsx)(Y,{title:`Cases by day`,note:`The last ${h(Math.min(30,e.days.length),`day`)} with runs. Hover a day for its pass rate.`,children:(0,B.jsx)(Z,{days:e.days})}),(0,B.jsxs)(`div`,{className:`grid gap-4 @3xl:grid-cols-2`,children:[(0,B.jsx)(Y,{title:`Fails most`,note:`Cases that failed in the most runs.`,children:e.failing.length===0?(0,B.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`No case has failed.`}):(0,B.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.failing.slice(0,8).map(e=>(0,B.jsxs)(`li`,{className:`flex flex-col gap-1 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,B.jsxs)(`span`,{className:`flex min-w-0 items-center gap-2`,children:[(0,B.jsx)(s,{size:14,"aria-hidden":`true`,className:`flex-none text-fail`}),(0,B.jsxs)(`span`,{className:`min-w-0 flex-1 truncate text-[13px]`,"data-tip":e.title,children:[e.id&&(0,B.jsx)(`span`,{className:`font-mono text-[13px] text-ink-2`,children:e.id}),` `,e.title]}),(0,B.jsx)(`span`,{className:`flex-none text-[13px] text-muted`,children:F(e.lastFailed)})]}),(0,B.jsxs)(`span`,{className:`flex min-w-0 items-center gap-4 pl-6`,children:[(0,B.jsx)(X,{part:e.failed,whole:e.runs,tone:`fail`,label:`failed ${e.failed} of ${e.runs}`}),e.summary&&(0,B.jsx)(`span`,{className:`min-w-0 truncate text-[13px] text-muted`,children:e.summary.replace(/[*_`#>[\]]/g,``)})]})]},e.id||e.title))})}),(0,B.jsx)(Y,{title:`Defects`,note:`Failures grouped by their cause.`,children:e.defects.length===0?(0,B.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`None found.`}):(0,B.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.defects.slice(0,8).map(e=>(0,B.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-4 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,B.jsx)(`span`,{className:`min-w-0 truncate text-[13px]`,"data-tip":e.title,children:e.title}),(0,B.jsxs)(`span`,{className:`text-[13px] whitespace-nowrap text-muted tabular-nums`,children:[h(e.cases,`case`),` · `,h(e.runs,`run`),e.lastSeen?` · ${F(e.lastSeen)}`:``]})]},e.title))})}),(0,B.jsx)(Y,{title:`Flaky`,note:`Cases that both passed and failed.`,children:e.flaky.length===0?(0,B.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`None.`}):(0,B.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.flaky.slice(0,8).map(e=>(0,B.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto] items-center gap-x-4 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,B.jsxs)(`span`,{className:`min-w-0 truncate text-[13px]`,"data-tip":e.title,children:[e.id&&(0,B.jsx)(`span`,{className:`font-mono text-[13px] text-ink-2`,children:e.id}),` `,e.title]}),(0,B.jsx)(X,{part:e.failed,whole:e.runs,tone:`fail`,label:`${e.failed}/${e.runs} failed`})]},e.id||e.title))})}),(0,B.jsx)(Y,{title:`By kind`,note:`Each kind of run and how often its cases passed.`,children:e.kinds.length===0?(0,B.jsx)(`p`,{className:`m-0 py-2 text-sm text-muted`,children:`No runs with results yet.`}):(0,B.jsx)(`ul`,{className:`m-0 list-none p-0`,children:e.kinds.map(e=>(0,B.jsxs)(`li`,{className:`grid grid-cols-[minmax(0,1fr)_auto_auto] items-center gap-x-4 border-t border-line-soft py-2 first:border-t-0 first:pt-0`,children:[(0,B.jsx)(`span`,{className:`min-w-0 truncate text-[13px]`,children:V[e.scope]||e.scope}),(0,B.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:h(e.runs,`run`)}),(0,B.jsx)(X,{part:e.passed,whole:e.cases,tone:`pass`,label:e.cases?`${Math.round(e.passed/e.cases*100)}% passed`:`no cases`})]},e.scope))})})]})]}):(0,B.jsx)(x,{icon:l,title:`No runs yet`,action:(0,B.jsxs)(`a`,{className:y({size:`sm`}),href:d(),"data-tip":`Start a chat`,children:[(0,B.jsx)(u,{"aria-hidden":`true`}),`Chat`]}),children:`Runs, suites and monitor rounds are taken together here once there are some: pass rate by day, the cases that fail most, flaky cases and defects.`})]})}function $({sub:e}){let[n,r]=(0,z.useState)(null),[i,a]=(0,z.useState)(``),[o,s]=(0,z.useState)(``),[c,u]=(0,z.useState)(``),[d,f]=(0,z.useState)(`all`),[h,_]=(0,z.useState)(G),[y,x]=(0,z.useState)(``),T=(0,z.useCallback)(()=>{m.list().then(r,e=>a(e.message))},[]);(0,z.useEffect)(T,[T]);let O=e===`project`?`project`:`execution`,M=n?.rows??null,N=c.toLowerCase().split(/\s+/).filter(Boolean),I=(0,z.useMemo)(()=>(M||[]).filter(e=>(!o||e.scope===o)&&N.every(t=>`${e.title} ${e.id} ${V[e.scope]}`.toLowerCase().includes(t))),[M,o,c]),L=I.filter(e=>W(e).tone===`fail`).length,q=d===`failed`?I.filter(e=>W(e).tone===`fail`):I;(0,z.useEffect)(()=>_(G),[o,c,d]);let J=[...new Set((M||[]).map(e=>e.scope))];return(0,B.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,B.jsx)(k,{}),(0,B.jsxs)(`main`,{className:p(j,`@container flex-auto gap-4`),children:[(0,B.jsx)(D,{}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-end gap-x-6 gap-y-2`,children:[(0,B.jsx)(A,{pixel:C.reports,size:`lg`}),(0,B.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Reports`}),(0,B.jsx)(E,{label:`Runs and reports`,links:R,current:O===`project`?`reports-project`:`reports`})]}),i&&(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:i}),!n&&!i&&(0,B.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),n&&O===`project`&&(0,B.jsx)(Q,{project:n.project,build:n.build,onBuilt:T}),n&&O===`execution`&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Every report ForgeQE generated, newest first. Open one to see it in full in a new tab.`}),(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,B.jsx)(b,{id:`report-search`,label:`Find a report`,value:c,onChange:u}),[[`all`,`All`,I.length],[`failed`,`Failed`,L]].map(([e,t,n])=>(0,B.jsxs)(`button`,{type:`button`,"aria-pressed":d===e,onClick:()=>f(e),className:p(`inline-flex min-h-8 cursor-pointer items-center gap-1 rounded-[8px] border px-4 text-[13px] font-medium`,d===e?`border-accent bg-accent-soft text-ink`:`border-transparent bg-surface-strong text-ink-2 hover:bg-line hover:text-ink`),children:[t,(0,B.jsx)(`span`,{className:p(`tabular-nums`,e===`failed`&&n?`text-fail`:``),children:n})]},e)),J.length>1&&(0,B.jsxs)(B.Fragment,{children:[(0,B.jsx)(`label`,{htmlFor:`report-kind`,className:`sr-only`,children:`Kind`}),(0,B.jsxs)(g,{size:`sm`,id:`report-kind`,value:o,onChange:e=>s(e.target.value),className:`w-auto pr-8 pl-4`,children:[(0,B.jsx)(`option`,{value:``,children:`Every kind`}),J.map(e=>(0,B.jsx)(`option`,{value:e,children:V[e]},e))]})]})]}),y&&(0,B.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:y}),(0,B.jsxs)(`div`,{className:`rounded-[14px] card border`,children:[(0,B.jsxs)(`div`,{"aria-hidden":`true`,className:`hidden grid-cols-[minmax(0,1fr)_110px_150px_100px_128px] items-center gap-x-4 border-b border-line-soft px-4 py-2 text-[13px] font-semibold text-muted @3xl:grid`,children:[(0,B.jsx)(`span`,{children:`Report`}),(0,B.jsx)(`span`,{children:`Kind`}),(0,B.jsx)(`span`,{children:`Result`}),(0,B.jsx)(`span`,{className:`text-right`,children:`When`}),(0,B.jsx)(`span`,{})]}),(0,B.jsxs)(`ul`,{"aria-label":`Execution reports`,className:`m-0 list-none p-2`,children:[q.length===0&&(0,B.jsx)(`li`,{className:`px-4 py-4 text-sm text-muted`,children:n.rows.length?`Nothing matches.`:`No reports yet. Runs, suites and monitor rounds show here once they have run.`}),q.slice(0,h).map((e,t,n)=>{let r=P(e.startedAt),i=W(e);return(0,B.jsxs)(`li`,{className:`contents`,children:[(t===0||P(n[t-1].startedAt)!==r)&&(0,B.jsx)(`span`,{className:`block px-4 pt-4 pb-1 text-[13px] font-semibold text-muted`,children:r}),(0,B.jsxs)(`div`,{className:`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-4 rounded-[10px] px-4 py-2 hover:bg-surface-muted @3xl:grid-cols-[auto_minmax(0,1fr)_110px_150px_100px_128px] @3xl:gap-x-4`,children:[(0,B.jsx)(K,{r:e}),(0,B.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,B.jsx)(`span`,{className:`truncate text-[13px] font-medium`,"data-tip":e.title,children:e.title}),(0,B.jsx)(`span`,{className:`truncate text-[13px] text-muted @3xl:hidden`,children:[V[e.scope],e.scope===`page`||!e.counts.total?``:`${e.counts.passed}/${e.counts.total} passed`,F(e.startedAt)].filter(Boolean).join(` · `)})]}),(0,B.jsx)(`span`,{className:`hidden truncate text-[13px] text-muted @3xl:block`,children:V[e.scope]}),(0,B.jsxs)(`span`,{className:`hidden truncate text-[13px] text-muted tabular-nums @3xl:block`,children:[(0,B.jsx)(`span`,{className:p(i.tone===`fail`&&`text-fail`),children:e.scope===`page`?`Report`:e.counts.total?`${e.counts.passed}/${e.counts.total} passed`:i.label}),U(e.ms)?` · ${U(e.ms)}`:``]}),(0,B.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,"data-tip":H(e.startedAt),children:F(e.startedAt)}),(0,B.jsx)(`span`,{className:`flex min-w-0 justify-end`,children:e.report?(0,B.jsx)(v,{variant:`icon`,size:`icon-sm`,"aria-label":`Open the report of ${e.title} in a new tab`,"data-tip":`Open the report of ${e.title} in a new tab`,onClick:async()=>x(await S(e.report)),children:(0,B.jsx)(l,{"aria-hidden":`true`})}):(0,B.jsx)(w,{path:e.folder,onNote:x,children:`Folder`})})]})]},e.key)})]}),(q.length>h||n.total>n.rows.length)&&(0,B.jsxs)(`div`,{className:`flex flex-wrap items-center justify-between gap-4 border-t border-line-soft px-4 py-2 text-[13px] text-muted`,children:[(0,B.jsxs)(`span`,{children:[`Showing `,Math.min(h,q.length),` of `,q.length,n.total>n.rows.length?` (the newest ${n.rows.length} of ${n.total})`:``]}),q.length>h&&(0,B.jsxs)(v,{size:`sm`,onClick:()=>_(h+G),children:[(0,B.jsx)(t,{"aria-hidden":`true`}),`More (`,Math.min(G,q.length-h),`)`]})]})]})]})]})]})}export{$ as Reports};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{B as t,E as n,Et as r,Gn as i,Jn as a,Lr as o,Nr as s,Ot as c,Pr as l,Pt as u,Q as d,Wn as f,Y as p,Zn as m,_t as h,an as g,dn as _,ht as v,in as y,j as ee,jt as te,mt as ne,nt as re,o as ie,pr as ae,pt as oe,qn as se,sr as ce,w as b,xn as le,xt as x,zn as ue}from"./line-icons-rdF8DYDJ.js";import{f as S,r as C,y as w}from"./agents-C0Jg2pN8.js";import{t as de}from"./jsx-runtime-LKYXHABd.js";import{A as T,j as E,l as fe}from"./input-CtzK50ZF.js";import{a as pe,c as D,d as O,l as k}from"./filters-CnAMr286.js";import{$ as me,C as he,w as A,x as j}from"./palette-DAaGSao7.js";import{A as ge,D as M,Fn as _e,In as ve,O as N,Pn as P,ct as ye,et as F,it as be,k as I,nt as xe,ot as Se,st as L,v as R}from"./index-B3JsM7tv.js";import{t as z}from"./diff-BStuTmsN.js";import{t as Ce}from"./fold-D_O_VZui.js";var B=e(o(),1),V=de();function H({review:e,className:t}){return(0,V.jsxs)(`div`,{className:T(`flex flex-col gap-2 text-[13px] leading-relaxed`,t),children:[e.summary&&(0,V.jsx)(`p`,{className:`m-0 text-ink-2 [overflow-wrap:anywhere]`,children:e.summary}),e.issues.length>0&&(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-2 p-0`,children:e.issues.map((e,t)=>(0,V.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2`,children:[(0,V.jsx)(`span`,{className:T(`mt-px flex-none rounded-full px-2 py-px text-[13px] font-medium`,e.kind===`correctness`?`bg-fail-soft text-fail`:`bg-surface-strong text-ink-2`),children:e.kind===`correctness`?`Correctness`:`Standards`}),(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[e.file&&(0,V.jsx)(`span`,{className:`font-mono text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.file}),(0,V.jsx)(`span`,{className:`text-ink [overflow-wrap:anywhere]`,children:e.problem}),e.fix&&(0,V.jsxs)(`span`,{className:`text-muted [overflow-wrap:anywhere]`,children:[`Fix: `,e.fix]})]})]},t))})]})}var we={done:`border-pass/35`,active:`border-accent/35`,pending:`border-line-strong`,failed:`border-fail/35`,skipped:`border-line-strong`,note:`border-line-strong`};function U({status:e,orb:t,px:n=20,spin:r=!1}){let i={width:n,height:n};return e===`active`&&r?(0,V.jsx)(`span`,{role:`img`,"aria-label":`At work`,className:`flex flex-none items-center justify-center`,style:i,children:(0,V.jsx)(g,{size:n-2,strokeWidth:2.5,"aria-hidden":`true`,className:`animate-spin text-accent-fg motion-reduce:animate-none`})}):e===`active`?(0,V.jsx)(D,{state:t,px:n,label:`At work`}):e===`done`?(0,V.jsx)(`span`,{role:`img`,"aria-label":`Done`,className:`flex flex-none items-center justify-center rounded-full bg-pass`,style:i,children:(0,V.jsx)(b,{size:n*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-bg`})}):e===`failed`?(0,V.jsx)(`span`,{role:`img`,"aria-label":`Failed`,className:`flex flex-none items-center justify-center rounded-full bg-fail`,style:i,children:(0,V.jsx)(l,{size:n*.6,strokeWidth:3,"aria-hidden":`true`,className:`text-bg`})}):e===`note`?(0,V.jsx)(`span`,{role:`img`,"aria-label":`Note`,className:`flex flex-none items-center justify-center`,style:i,children:(0,V.jsx)(`span`,{className:`size-1.5 rounded-full bg-line-strong`})}):(0,V.jsx)(`span`,{role:`img`,"aria-label":e===`skipped`?`Skipped`:`To come`,className:T(`box-border block flex-none rounded-full border-2 border-line-strong`,e===`skipped`&&`border-dashed`),style:i})}var Te=(e,t)=>e.status===`running`?t?`active`:`done`:e.status===`ok`?`done`:e.status===`fail`?`failed`:`note`,Ee={read:h,search:i,list:r,edit:ne,run:ae,element:d,outline:y,references:te,impact:le,find:v,testfile:x,web:u,environment:a,cases:t,browser:u,post:se,test:x,retry:ue,review:m,task:c,work:s},De={done:`text-pass`,failed:`text-fail`,active:`text-accent-fg animate-pulse motion-reduce:animate-none`,pending:`text-muted`,skipped:`text-muted`,note:`text-muted`},W={done:`Done`,failed:`Failed`,active:`At work`,pending:`To come`,skipped:`Skipped`,note:`Note`};function Oe({kind:e,status:t}){let n=T(`mt-px flex size-4 flex-none items-center justify-center`,De[t]);if(e===`skill`)return(0,V.jsxs)(`span`,{role:`img`,"aria-label":W[t],className:T(n,`relative`),children:[(0,V.jsx)(fe,{name:me.skills,px:15}),(t===`done`||t===`failed`)&&(0,V.jsx)(`span`,{"aria-hidden":`true`,className:T(`absolute -right-0.5 -bottom-0.5 size-1.5 rounded-full ring-1 ring-bg`,t===`done`?`bg-pass`:`bg-fail`)})]});let r=Ee[e];return(0,V.jsx)(`span`,{role:`img`,"aria-label":W[t],className:n,children:(0,V.jsx)(r,{size:15,strokeWidth:2,"aria-hidden":`true`})})}function ke({status:e}){return e===`active`?(0,V.jsx)(g,{size:12,strokeWidth:2.5,"aria-label":`At work`,className:`mt-1 flex-none animate-spin text-accent-fg motion-reduce:animate-none`}):(0,V.jsx)(`span`,{role:`img`,"aria-label":W[e],className:T(`mt-2 size-2 flex-none rounded-full`,e===`done`?`bg-pass`:e===`failed`?`bg-fail`:`bg-line-strong`)})}function G({text:e,label:t}){let[n,r]=(0,B.useState)(!1);return(0,V.jsx)(`button`,{type:`button`,"aria-label":n?`Copied`:t,"data-tip":n?`Copied`:t,onClick:async()=>{try{await navigator.clipboard.writeText(e),r(!0),setTimeout(()=>r(!1),1500)}catch{}},className:`flex size-6 flex-none cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted opacity-0 group-hover:opacity-100 hover:bg-surface-strong hover:text-ink focus-visible:opacity-100`,children:n?(0,V.jsx)(b,{size:13,"aria-hidden":`true`,className:`text-pass`}):(0,V.jsx)(p,{size:13,"aria-hidden":`true`})})}function Ae({step:e,failed:t}){return(0,V.jsxs)(`div`,{className:`flex flex-col gap-1 py-1 font-mono text-[13px] leading-relaxed`,children:[e.command&&(0,V.jsxs)(`div`,{className:`group flex min-w-0 items-start gap-2 text-muted`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`flex-none select-none`,children:`$`}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 whitespace-pre-wrap [overflow-wrap:anywhere]`,children:e.command}),(0,V.jsx)(G,{text:e.command,label:`Copy the command`})]}),e.output&&(0,V.jsxs)(`div`,{className:`group flex min-w-0 items-start gap-2`,children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`flex-none text-muted select-none`,children:`⎿`}),(0,V.jsx)(`pre`,{className:T(`m-0 max-h-56 min-w-0 flex-1 overflow-auto font-mono text-[13px] leading-relaxed whitespace-pre-wrap [overflow-wrap:anywhere]`,t?`text-fail`:`text-ink-2`),children:e.output}),(0,V.jsx)(G,{text:e.output,label:`Copy the output`})]}),e.shell?.exit!==void 0&&e.shell.exit!==0&&(0,V.jsxs)(`span`,{className:`text-fail`,children:[`Exit code `,e.shell.exit]})]})}var je=e=>/[/\\]|\.\w{1,5}$|^\$ /.test(e)&&!/\s{2,}/.test(e);function K({text:e}){return(0,V.jsx)(`span`,{className:T(`min-w-0 max-w-full truncate rounded-md bg-surface-strong px-2 py-1 text-[13px] text-ink-2`,je(e)&&`font-mono text-[13px]`),children:e})}function Me(e){return{count:e.length,failed:e.filter(e=>e.ok===!1).length,latest:e[e.length-1]}}function q({line:e}){return(0,V.jsxs)(`li`,{className:T(`flex gap-2 [overflow-wrap:anywhere]`,e.ok===!0?`text-pass`:e.ok===!1?`text-fail`:`text-ink-2`),children:[e.ok!==void 0&&(0,V.jsx)(`span`,{"aria-hidden":`true`,children:e.ok?`✓`:`✗`}),(0,V.jsx)(N,{text:e.text,className:`min-w-0 text-[13px] leading-relaxed text-inherit [&_p]:my-0`})]})}function Ne({step:e}){let[t,r]=(0,B.useState)(!1),i=e.lines.length>3&&!t,{count:a,failed:o,latest:s}=Me(e.lines);return(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[e.lines.length>3&&(0,V.jsxs)(`button`,{type:`button`,"aria-expanded":t,onClick:()=>r(!t),className:`flex w-fit cursor-pointer items-center gap-1 rounded-md border-0 bg-transparent p-0 text-[13px] text-muted hover:text-ink-2`,children:[(0,V.jsxs)(`span`,{children:[t?`Hide`:`Show`,` `,a,` lines`,o>0&&(0,V.jsxs)(`span`,{className:`text-fail`,children:[` · `,o,` failed`]})]}),(0,V.jsx)(n,{size:13,"aria-hidden":`true`,className:T(`transition-transform`,t&&`rotate-180`)})]}),(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] leading-relaxed`,children:i?s&&(0,V.jsx)(q,{line:s}):e.lines.map((e,t)=>(0,V.jsx)(q,{line:e},t))})]})}function J({agent:e,named:t=!0,working:n=!1,state:r,orb:i}){let a=S(e),o=he(e);return(0,V.jsxs)(`span`,{className:`inline-flex flex-none items-center gap-2`,"data-tip":a.name,children:[(0,V.jsx)(j,{agent:e,px:24,decorative:t,working:n,state:r,activity:n?A(i):void 0}),t&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{className:`font-medium`,style:{color:o},children:a.name}),(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted`,children:`·`})]})]})}var Y=e=>e===`active`?`thinking`:e===`failed`?`failed`:e===`done`?`done`:`idle`;function X({step:e,from:t,to:n,live:r}){let i=S(n),a=he(n),o=r?`thinking`:e.status===`fail`?`failed`:e.status===`ok`?`done`:`idle`,s=[...e.children??[]].reverse().find(e=>e.status===`running`)?.orb??(e.orb===`handing`?void 0:e.orb);return(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,V.jsx)(j,{agent:t,px:24,activity:r?`handing`:void 0}),(0,V.jsxs)(`span`,{role:`img`,"aria-label":`hands off to`,className:T(`handoff-flow flex-none`,r&&`is-live`),style:{color:a},children:[(0,V.jsx)(`span`,{}),(0,V.jsx)(`span`,{}),(0,V.jsx)(`span`,{})]}),(0,V.jsx)(j,{agent:n,px:28,decorative:!0,state:o,activity:r?A(s):void 0,className:`handoff-in`}),(0,V.jsx)(`span`,{className:`font-medium`,style:{color:a},children:i.name}),!e.handoff&&(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`span`,{"aria-hidden":`true`,className:`text-muted`,children:`·`}),(0,V.jsx)(`span`,{className:T(`[overflow-wrap:anywhere]`,r?`text-ink`:`text-ink-2`),children:e.label})]}),e.arg&&(0,V.jsx)(K,{text:e.arg})]})}function Z({step:e,working:t,from:r=C}){let i=e.agent||r,a=Pe(e),o=Te(e,t),[s,c]=(0,B.useState)(null),l=s??((!!e.handoff||!!e.agent||!!e.shell||e.key.startsWith(`try:`))&&o===`active`),u=(0,V.jsxs)(V.Fragment,{children:[e.handoff||i!==r?(0,V.jsx)(U,{status:o,orb:e.orb,px:14,spin:!0}):!e.icon&&(0,V.jsx)(ke,{status:o}),e.handoff||i!==r?(0,V.jsx)(X,{step:e,from:r,to:e.handoff?.agent??i,live:o===`active`}):(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1`,children:[e.icon?(0,V.jsx)(Oe,{kind:e.icon,status:o}):(0,V.jsx)(J,{agent:i,named:!1,working:o===`active`,state:Y(o),orb:e.orb}),(0,V.jsx)(`span`,{className:T(`[overflow-wrap:anywhere]`,o===`active`?`text-ink`:`text-ink-2`),children:e.label}),e.arg&&(0,V.jsx)(K,{text:e.arg}),e.change&&(0,V.jsxs)(`span`,{className:`font-mono text-[13px] tabular-nums`,children:[(0,V.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.change.added]}),` `,(0,V.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.change.removed]})]})]}),a&&(0,V.jsx)(n,{size:14,"aria-hidden":`true`,className:T(`mt-1 ml-auto flex-none text-muted transition-transform`,l&&`rotate-180`)})]});return(0,V.jsxs)(`li`,{className:`flex flex-col`,children:[a?(0,V.jsx)(`button`,{type:`button`,"aria-expanded":l,onClick:()=>c(!l),className:`flex min-h-8 w-full cursor-pointer items-start gap-2 rounded-lg border-0 bg-transparent px-2 py-2 text-left text-[13px] hover:bg-surface-muted`,children:u}):(0,V.jsx)(`div`,{className:`flex min-h-8 items-start gap-2 px-2 py-2 text-[13px]`,children:u}),a&&(0,V.jsx)(P,{open:l,children:(0,V.jsx)(Fe,{step:e,working:t,from:r,className:`mb-1 ml-4`})})]})}var Pe=e=>e.lines.length>0||(e.children?.length??0)>0||!!e.handoff?.result||!!e.change||!!e.output||!!e.command||!!e.review;function Fe({step:e,working:t,from:n,className:r}){let i=e.children||[],a=e.handoff?.agent||e.agent;return(0,V.jsxs)(`div`,{className:T(`flex flex-col gap-2 border-l border-dotted py-1 pl-4`,r),style:{borderColor:a?`${S(a).hue}59`:`var(--color-line-strong)`},children:[(e.output||e.command)&&(0,V.jsx)(Ae,{step:e,failed:e.status===`fail`}),e.review&&(0,V.jsx)(H,{review:e.review}),e.lines.length>0&&(0,V.jsx)(Ne,{step:e}),e.change&&(0,V.jsx)(z,{diff:e.change.diff}),i.length>0&&(0,V.jsx)(`ul`,{"aria-label":a?`What ${w(S(a).name)} did`:`Steps`,className:`m-0 flex list-none flex-col p-0`,children:i.map(e=>(0,V.jsx)(Z,{step:e,working:t,from:a||n},e.key))}),e.handoff?.result&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-1 text-[13px]`,children:[(0,V.jsxs)(`span`,{className:`text-muted`,children:[w(S(e.handoff.agent).name,!0),` answered`]}),(0,V.jsx)(N,{text:e.handoff.result.length>1200?`${e.handoff.result.slice(0,1199)}…`:e.handoff.result,className:`text-[13px] text-ink-2 [&_p]:my-0`})]})]})}function Ie({node:e,last:t,working:r,now:i,orbed:a}){let o=e.step?[]:e.steps,s=e.step,c=o.length>0||!!i||!!s&&Pe(s),[l,u]=(0,B.useState)(null),d=l??(e.status===`active`||e.status===`failed`),f=s?.orb??o.findLast(e=>e.status===`running`)?.orb??i?.orb??`thinking`;return(0,V.jsxs)(`li`,{className:`flex gap-4`,children:[(0,V.jsxs)(`div`,{className:`flex flex-none flex-col items-center`,children:[(0,V.jsx)(`span`,{className:`mt-1`,children:(0,V.jsx)(U,{status:e.status,orb:f,spin:!a})}),!t&&(0,V.jsx)(`span`,{"aria-hidden":`true`,className:T(`mt-2 min-h-4 w-0 flex-1 border-l border-dotted`,we[e.status])})]}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col pb-2`,children:[c?(0,V.jsxs)(`button`,{type:`button`,"aria-expanded":d,onClick:()=>u(!d),className:`flex min-h-7 w-full cursor-pointer items-start gap-2 border-0 bg-transparent p-0 text-left`,children:[(0,V.jsx)(Le,{node:e,orb:f}),(0,V.jsx)(n,{size:14,"aria-hidden":`true`,className:T(`mt-1 flex-none text-muted transition-transform`,d&&`rotate-180`)}),e.status===`active`&&(0,V.jsx)(`span`,{className:`mt-1 ml-1 flex-none rounded-full border border-accent-line bg-accent-soft px-2 py-px text-[13px] font-medium text-accent-fg`,children:`In progress`})]}):(0,V.jsx)(`div`,{className:`min-h-7`,children:(0,V.jsx)(Le,{node:e,orb:f})}),c&&(0,V.jsx)(P,{open:d,className:`mt-1`,children:s?(0,V.jsx)(Fe,{step:s,working:r,from:`forgeqe`,className:`mt-1`}):(0,V.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[o.map(e=>(0,V.jsx)(Z,{step:e,working:r},e.key)),i&&(0,V.jsx)(`li`,{children:(0,V.jsx)(Q,{live:i,className:`px-2`})})]})})]})]})}function Le({node:e,orb:t}){let n=e.status===`active`?`text-ink`:e.status===`pending`||e.status===`skipped`?`text-muted`:e.status===`failed`?`text-fail`:`text-ink-2`,r=e.step;return r?.handoff||r?.agent&&r.agent!==`forgeqe`?(0,V.jsx)(X,{step:r,from:C,to:r.handoff?.agent??r.agent,live:e.status===`active`}):(0,V.jsxs)(`span`,{className:T(`flex min-w-0 flex-wrap items-center gap-x-2 gap-y-1 text-sm font-medium`,n,e.status===`skipped`&&`line-through`),children:[r&&(0,V.jsx)(J,{agent:r.agent||`forgeqe`,named:!!r.agent&&r.agent!==`forgeqe`,working:e.status===`active`,state:Y(e.status),orb:t}),e.status===`active`?(0,V.jsx)(`span`,{className:`shimmer [overflow-wrap:anywhere]`,children:(0,V.jsx)(`span`,{children:e.label})}):(0,V.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.label}),r?.arg&&(0,V.jsx)(K,{text:r.arg})]})}var Re={info:`text-ink-2`,ok:`text-pass`,fail:`text-fail`,warn:`text-warn`,dim:`text-muted`,say:`text-ink-2`,you:`text-accent-fg`,think:`text-muted italic`};function ze(e){let[t,n]=(0,B.useState)(()=>Date.now());(0,B.useEffect)(()=>{let e=ve(()=>n(Date.now()),1e3);return()=>_e(e)},[]);let r=e?Date.parse(e):NaN;if(Number.isNaN(r))return``;let i=Math.max(0,Math.round((t-r)/1e3));return i<2?`just now`:i<60?R(i,`second`):R(Math.floor(i/60),`minute`)}function Q({live:e,orb:t=!1,className:n}){let r=ze(e.latest?.at);return(0,V.jsxs)(`div`,{className:T(`flex min-h-8 items-start gap-2 py-1`,n),children:[(0,V.jsx)(`span`,{className:`mt-1 flex size-4 flex-none items-center justify-center`,children:t?(0,V.jsx)(D,{state:e.orb,px:20,label:`At work`}):(0,V.jsxs)(`span`,{"aria-hidden":`true`,className:`relative flex size-2`,children:[(0,V.jsx)(`span`,{className:`absolute inline-flex size-full animate-ping rounded-full bg-accent opacity-60 motion-reduce:animate-none`}),(0,V.jsx)(`span`,{className:`relative inline-flex size-2 rounded-full bg-accent`})]})}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,V.jsx)(`span`,{className:`shimmer text-[13px] font-medium text-muted`,children:(0,V.jsx)(`span`,{"aria-live":`polite`,children:e.text})}),e.latest&&(0,V.jsxs)(`button`,{type:`button`,onClick:e.onLog,"data-tip":`Open the activity log`,className:`flex w-full min-w-0 cursor-pointer items-baseline gap-2 border-0 bg-transparent p-0 text-left hover:underline`,children:[(0,V.jsx)(`span`,{className:T(`min-w-0 truncate font-mono text-[13px]`,Re[e.latest.tone]),children:e.latest.plain}),(0,V.jsxs)(`span`,{className:`flex-none text-[13px] whitespace-nowrap text-muted tabular-nums`,children:[r,r&&` · `,e.events,` `,e.events===1?`event`:`events`]})]})]})]})}function Be({turn:e,working:t,live:n,folded:r=!1}){if(r)return(0,V.jsx)(Q,{live:n,orb:!0});let i=xe(e,t),a=e.plan.length>0&&t?i.find(e=>e.status===`active`)??null:null,o=t&&!a?[{key:`now`,label:n.text,status:`active`,steps:[]}]:[],s=[...i,...o],c=i.findLast(e=>e.status===`active`);return(0,V.jsx)(`ol`,{"aria-label":`What ForgeQE did`,className:`m-0 flex list-none flex-col p-0 pt-1`,children:s.map((e,r)=>e.key===`now`?(0,V.jsx)(`li`,{className:`flex gap-4`,children:(0,V.jsx)(Q,{live:n,orb:!c,className:`-mt-1 min-w-0 flex-1 py-0`})},`now`):(0,V.jsx)(Ie,{node:e,last:r===s.length-1,working:t,now:a===e?n:void 0,orbed:c===e},e.key))})}var Ve={passed:`Passed`,failed:`Failed`,stopped:`Stopped`,blocked:`Blocked`};function $({label:e,children:t}){return(0,V.jsxs)(V.Fragment,{children:[(0,V.jsx)(`dt`,{className:`pt-1 text-[13px] text-muted`,children:e}),(0,V.jsx)(`dd`,{className:`m-0 min-w-0 text-[13px] [overflow-wrap:anywhere]`,children:t})]})}function He({text:e}){let[t,n]=(0,B.useState)(!1);return(0,V.jsxs)(`div`,{className:`flex items-start gap-2 rounded-[10px] bg-surface-muted px-4 py-2`,children:[(0,V.jsx)(k,{icon:ce,size:14,className:`mt-1 flex-none text-muted`}),(0,V.jsx)(`code`,{className:`min-w-0 flex-1 font-mono text-[13px] break-all whitespace-pre-wrap text-ink`,children:e}),(0,V.jsx)(`button`,{type:`button`,"aria-label":t?`Copied`:`Copy the command`,"data-tip":t?`Copied`:`Copy the command`,onClick:async()=>{await ge(e)&&(n(!0),setTimeout(()=>n(!1),1500))},className:`inline-flex size-7 flex-none cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted hover:bg-surface-strong hover:text-ink`,children:t?(0,V.jsx)(b,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,V.jsx)(p,{size:14,"aria-hidden":`true`})})]})}function Ue(e){if(e.runs===void 0)return e.attempts===void 0?``:E(e.attempts,`attempt`);let t=`${E(e.runs,`test run`)}${e.failedRuns?` (${e.failedRuns} failed)`:``}`;return e.reviews?`${t} · ${E(e.reviews,`review`)}`:t}function We({name:e}){let t=e.lastIndexOf(`.`),n=t>0?e.slice(t+1):e,r=t>0?e.slice(0,t):``;return(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col`,"data-tip":e,children:[(0,V.jsx)(`span`,{className:`font-mono text-[13px] text-ink [overflow-wrap:anywhere]`,children:n}),r&&(0,V.jsx)(`span`,{className:`font-mono text-[13px] text-muted [overflow-wrap:anywhere]`,children:r})]})}function Ge({t:e}){let t=Ue(e);return(0,V.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,V.jsx)(x,{size:17,strokeWidth:2,"aria-hidden":`true`,className:e.ok?`text-pass`:e.status===`stopped`?`text-muted`:`text-fail`}),(0,V.jsx)(`span`,{className:`text-[16px] font-semibold`,children:e.ok?`Test written`:`Test not finished`}),(0,V.jsx)(pe,{tone:e.ok?`pass`:e.status===`stopped`?`neutral`:`fail`,children:Ve[e.status]||e.status||`Not written`}),t&&(0,V.jsx)(`span`,{className:`text-[13px] text-muted`,children:t})]}),(0,V.jsxs)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-6 gap-y-1 sm:grid-cols-[96px_minmax(0,1fr)] sm:gap-y-4`,children:[(e.testFile||e.testName)&&(0,V.jsx)($,{label:`Test`,children:(0,V.jsxs)(`span`,{className:`flex min-w-0 flex-col gap-1`,children:[e.testFile&&(0,V.jsx)(M,{path:e.testFile}),e.testName&&(0,V.jsx)(We,{name:e.testName})]})}),e.command&&(0,V.jsx)($,{label:`Run it`,children:(0,V.jsx)(He,{text:e.command})}),e.review&&(0,V.jsx)($,{label:e.review.approved?`Review`:`Review asked`,children:(0,V.jsx)(H,{review:e.review})}),e.runDir&&(0,V.jsx)($,{label:`From the run`,children:(0,V.jsx)(M,{path:e.runDir})}),e.reused.length>0&&(0,V.jsx)($,{label:`Reused`,children:(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:e.reused.map(e=>(0,V.jsx)(`li`,{className:`min-w-0`,children:(0,V.jsx)(M,{path:e})},e))})})]}),e.error&&(0,V.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:e.error})]})}function Ke({c:e}){let[t,r]=(0,B.useState)(!1);return(0,V.jsxs)(`li`,{className:`flex flex-col`,children:[(0,V.jsxs)(`div`,{className:`flex min-h-9 items-center gap-2`,children:[(0,V.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":`${t?`Hide`:`Show`} the changes to ${e.path}`,"data-tip":`${t?`Hide`:`Show`} the changes to ${e.path}`,onClick:()=>r(!t),className:`inline-flex size-7 flex-none cursor-pointer items-center justify-center rounded-md border-0 bg-transparent text-muted hover:bg-surface-strong hover:text-ink`,children:(0,V.jsx)(n,{size:15,"aria-hidden":`true`,className:T(`transition-transform`,!t&&`-rotate-90`)})}),(0,V.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,V.jsx)(M,{path:e.path})}),(0,V.jsxs)(`span`,{className:`flex-none font-mono text-[13px] tabular-nums`,children:[(0,V.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,V.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),(0,V.jsx)(P,{open:t,children:(0,V.jsx)(z,{diff:e.diff,className:`mb-2 ml-10`})})]})}function qe({turn:e}){let t=e.reports.filter((e,t,n)=>n.findIndex(t=>t.path===e.path)===t),n=new Set(e.changes.map(e=>e.path)),r=[...new Set(e.tests.flatMap(e=>e.changed))].filter(e=>!n.has(e)&&![...n].some(t=>t.endsWith(e)||e.endsWith(t)));return!e.tests.length&&!t.length&&!e.changes.length&&!r.length?null:(0,V.jsxs)(`section`,{"aria-label":`Result`,className:`flex flex-col gap-4 border-t border-line-soft pt-4`,children:[e.tests.map((e,t)=>(0,V.jsx)(Ge,{t:e},t)),t.length>0&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsx)(`span`,{className:`text-sm font-medium`,children:`Reports`}),(0,V.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-sm`,children:t.map(e=>(0,V.jsxs)(`li`,{className:`flex flex-wrap items-baseline gap-2`,children:[(0,V.jsx)(`span`,{className:`text-ink-2`,children:e.label}),(0,V.jsx)(M,{path:e.path})]},e.path))})]}),(e.changes.length>0||r.length>0)&&(0,V.jsxs)(`div`,{className:T(`flex flex-col gap-1`,(e.tests.length>0||t.length>0)&&`border-t border-line-soft pt-4`),children:[(0,V.jsxs)(`span`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,V.jsx)(oe,{size:15,"aria-hidden":`true`,className:`text-muted`}),`Files changed`,(0,V.jsxs)(`span`,{className:`font-normal text-muted`,children:[E(e.changes.length+r.length,`file`),e.changes.length>0&&(0,V.jsxs)(V.Fragment,{children:[` · `,(0,V.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.changes.reduce((e,t)=>e+t.added,0)]}),` `,(0,V.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.changes.reduce((e,t)=>e+t.removed,0)]})]})]})]}),(0,V.jsxs)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:[e.changes.map(e=>(0,V.jsx)(Ke,{c:e},e.path)),r.map(e=>(0,V.jsx)(`li`,{className:`flex min-h-9 items-center gap-2 pl-10`,children:(0,V.jsx)(M,{path:e})},e))]})]})]})}var Je=/^\s*(?:[-*>]\s*)?(?:\*\*|__)?\s*(?:sources?|evidence|references?|refs?)\s*(?:\*\*|__)?\s*:/i;function Ye(e){let t=[],n=[],r=!1;for(let i of e.split(`
|
|
2
|
+
`))/^\s*(```|~~~)/.test(i)&&(r=!r),!r&&Je.test(i)?n.push(i.trim()):t.push(i);return{body:t.join(`
|
|
3
|
+
`).replace(/\n{3,}/g,`
|
|
4
|
+
|
|
5
|
+
`).trimEnd(),sources:n.join(`
|
|
6
|
+
|
|
7
|
+
`)}}var Xe=1.5;function Ze(e,t){if(e>=t)return t;let n=t-e;return Math.min(t,e+Math.max(Xe,n/45))}function Qe(e,t){return Math.min(Math.floor(t),e.length)}var $e=()=>typeof window<`u`&&!!window.matchMedia?.(`(prefers-reduced-motion: reduce)`).matches;function et(e,t){let n=(0,B.useRef)(t);t&&(n.current=!0);let r=n.current&&!$e(),[i,a]=(0,B.useState)(()=>r?0:e.length),o=(0,B.useRef)(i),s=(0,B.useRef)(e);s.current!==e&&(o.current=Qe(e,o.current),s.current=e),r||(o.current=e.length),(0,B.useEffect)(()=>{if(!r||o.current>=e.length){a(o.current);return}let t=0,n=()=>{o.current=Ze(o.current,e.length),a(o.current),o.current<e.length&&(t=requestAnimationFrame(n))};return t=requestAnimationFrame(n),()=>cancelAnimationFrame(t)},[e,r]);let c=Math.min(Math.floor(r?i:e.length),e.length);return{shown:e.slice(0,c),typing:c<e.length}}var tt={info:`text-ink-2`,ok:`text-pass`,fail:`text-fail`,warn:`text-warn`,dim:`text-muted`,say:`text-ink`,you:`text-accent-fg`,think:`text-muted italic`};function nt({line:e,start:t}){let[n,r]=(0,B.useState)(!1),i=e.plain.length>160;return e.kind===`head`?(0,V.jsxs)(`li`,{className:`mt-4 flex items-baseline gap-4 border-b border-line-soft pb-1 first:mt-0`,children:[(0,V.jsx)(`span`,{className:`w-12 flex-none font-mono text-[13px] text-muted tabular-nums`,children:L(t,e.at)}),(0,V.jsx)(N,{text:e.md,className:T(`min-w-0 text-[13px] font-semibold text-ink [&_p]:my-0`,I)})]}):(0,V.jsxs)(`li`,{className:T(`flex items-baseline gap-4 py-1`,e.kind===`sub`&&`pl-4`),children:[(0,V.jsx)(`span`,{className:`w-12 flex-none font-mono text-[13px] text-muted tabular-nums`,children:L(t,e.at)}),e.kind===`out`?(0,V.jsx)(`pre`,{className:`m-0 min-w-0 flex-1 font-mono text-[13px] leading-relaxed whitespace-pre-wrap text-ink-2 [overflow-wrap:anywhere]`,children:e.plain}):(0,V.jsx)(`button`,{type:`button`,disabled:!i,"aria-expanded":i?n:void 0,onClick:()=>r(!n),"data-tip":i&&!n?`Show all of it`:void 0,className:T(`min-w-0 flex-1 border-0 bg-transparent p-0 text-left`,i&&`cursor-pointer`),children:(0,V.jsx)(N,{text:e.md,className:T(`text-[13px] leading-relaxed [overflow-wrap:anywhere] [&_code]:text-[13px] [&_p]:my-0`,I,tt[e.tone],i&&!n&&`line-clamp-2`)})})]})}function rt({lines:e,start:t,live:n,name:r,timeline:i=!1}){let a=(0,B.useRef)(null),o=(0,B.useRef)(!0),[s,c]=(0,B.useState)(!1),l=(0,B.useMemo)(()=>Se(e,t),[e,t]);(0,B.useEffect)(()=>{o.current&&a.current&&(a.current.scrollTop=a.current.scrollHeight)},[l]);let u=`inline-flex min-h-8 cursor-pointer items-center gap-2 rounded-lg border-0 bg-transparent px-2 text-[13px] font-medium text-muted hover:bg-surface-strong hover:text-ink`;return(0,V.jsxs)(`div`,{className:`overflow-hidden`,children:[(0,V.jsxs)(`div`,{className:`flex min-h-9 items-center gap-1 border-b border-line-soft text-[13px] text-muted`,children:[(0,V.jsxs)(`span`,{className:`flex-1`,children:[i?``:`Markdown · `,e.length,` event`,e.length===1?``:`s`,n&&` · live`]}),(0,V.jsx)(`button`,{type:`button`,"aria-label":s?`Copied`:`Copy the activity log as Markdown`,"data-tip":s?`Copied`:`Copy the activity log as Markdown`,onClick:async()=>{try{await navigator.clipboard.writeText(l),c(!0),setTimeout(()=>c(!1),1500)}catch{}},className:u,children:s?(0,V.jsx)(b,{size:14,"aria-hidden":`true`,className:`text-pass`}):(0,V.jsx)(p,{size:14,"aria-hidden":`true`})}),(0,V.jsx)(`button`,{type:`button`,"aria-label":`Download the activity log as a Markdown file`,"data-tip":`Download the activity log as a Markdown file`,onClick:()=>{let e=URL.createObjectURL(new Blob([l],{type:`text/markdown;charset=utf-8`})),t=document.createElement(`a`);t.href=e,t.download=r,t.click(),setTimeout(()=>URL.revokeObjectURL(e),1e3)},className:u,children:(0,V.jsx)(k,{icon:re,size:14})})]}),(0,V.jsx)(`div`,{ref:a,role:`log`,"aria-label":`Activity log`,onScroll:e=>{let t=e.currentTarget;o.current=t.scrollTop+t.clientHeight>=t.scrollHeight-24},className:T(`overflow-y-auto py-2`,i?`max-h-[calc(var(--screen)-260px)] min-h-[320px]`:`max-h-[360px] border-b border-line-soft`),children:i?(0,V.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,children:e.map((e,n)=>(0,V.jsx)(nt,{line:e,start:t},n))}):(0,V.jsx)(N,{text:l,className:T(`text-[13px] leading-[1.6] [&_code]:text-[13px] [&_h4]:mt-4 [&_h4]:mb-1 [&_h6]:mt-4 [&_h6]:mb-1 [&_h6]:text-ink [&_li]:my-1 [&_pre]:text-[13px] [&_ul]:my-1`,I)})})]})}function it({ask:e,live:t,onAnswer:n}){let r=t&&e.answer===void 0;return(0,V.jsxs)(`div`,{className:T(`flex flex-col gap-4`,r?`rounded-[14px] border border-accent-line bg-accent-soft px-4 py-4`:`py-1`),children:[(0,V.jsxs)(`div`,{className:`flex items-start gap-2`,children:[(0,V.jsx)(_,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none text-accent-fg`}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,V.jsx)(`span`,{className:`font-medium`,children:e.title}),e.detail&&(0,V.jsx)(`span`,{className:`text-sm text-ink-2`,children:e.detail}),e.lines.map((e,t)=>(0,V.jsx)(`span`,{className:`text-sm text-ink-2 [overflow-wrap:anywhere]`,children:e},t))]})]}),r?(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[e.options.map(e=>(0,V.jsx)(O,{size:`sm`,onClick:()=>n(e.id),children:e.label},e.id)),!e.options.some(e=>e.id===`cancel`||e.label.trim().toLowerCase()===`cancel`)&&(0,V.jsxs)(O,{size:`sm`,variant:`ghost`,onClick:()=>n(null),children:[(0,V.jsx)(l,{"aria-hidden":`true`}),`Cancel`]})]}):(0,V.jsx)(`span`,{className:`text-sm text-muted`,children:e.answer===void 0?`Not answered`:`You chose: ${e.answer}`})]})}function at({wait:e,live:t,onProceed:n}){let r=t&&e.answer===void 0;return(0,V.jsxs)(`div`,{className:T(`flex flex-col gap-4`,r?`rounded-[14px] border border-accent-line bg-accent-soft px-4 py-4`:`py-1`),children:[(0,V.jsxs)(`span`,{className:`flex items-start gap-2`,children:[(0,V.jsx)(ee,{size:18,"aria-hidden":`true`,className:`mt-1 flex-none text-accent-fg`}),(0,V.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.prompt})]}),r?(0,V.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,V.jsxs)(O,{size:`sm`,variant:`primary`,"data-tip":`Done, continue`,onClick:()=>n(!0),children:[(0,V.jsx)(ie,{"aria-hidden":`true`}),`Continue`]}),(0,V.jsxs)(O,{size:`sm`,onClick:()=>n(!1),children:[(0,V.jsx)(l,{"aria-hidden":`true`}),`Cancel`]})]}):(0,V.jsx)(`span`,{className:`text-sm text-muted`,children:e.answer===void 0?`Not done`:e.answer?`You continued`:`You cancelled`})]})}function ot(e,t){let[n,r]=(0,B.useState)(!1),i=(0,B.useRef)(t);return(0,B.useEffect)(()=>{let n=t>i.current;if(i.current=t,!e||!n)return void(e||r(!1));r(!0);let a=setTimeout(()=>r(!1),900);return()=>clearTimeout(a)},[e,t]),n}function st({turn:e,live:t,onAnswer:r,onProceed:i}){let a=t&&!e.outcome,[o,s]=(0,B.useState)(null),c=o??a,l=F(e),u=a?l.text:be(e),d=e.parts.map(e=>ye(e.text)).filter(Boolean),p=et(e.outcome&&e.reply?e.reply:d.join(`
|
|
8
|
+
|
|
9
|
+
`),a),m=(0,B.useMemo)(()=>Ye(p.shown),[p.shown]),h=ot(a,d.reduce((e,t)=>e+t.length,0)),g=p.typing||h,[_,v]=(0,B.useState)(!1),y=e.log.findLast(e=>e.tone!==`you`&&e.tone!==`say`);return(0,V.jsxs)(`div`,{className:`flex gap-4`,children:[(0,V.jsx)(`div`,{className:`size-9 flex-none`,"aria-hidden":`true`,children:(0,V.jsx)(j,{agent:`forgeqe`,px:34,working:a,state:g?`speaking`:a?`thinking`:e.outcome===`done`?`done`:e.outcome===`failed`?`failed`:`idle`,activity:a&&!g?A(F(e).orb):void 0,className:`mt-1`})}),(0,V.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-4 pt-2`,children:[(e.steps.length>0||a||e.log.length>0)&&(0,V.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,V.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,V.jsxs)(`button`,{type:`button`,"aria-expanded":c,disabled:!e.steps.length&&!e.plan.length,onClick:()=>s(!c),className:T(`flex cursor-pointer items-center gap-2 border-0 bg-transparent p-0 text-sm font-medium text-muted hover:text-ink disabled:cursor-default`,a&&`shimmer`),children:[(0,V.jsx)(`span`,{"aria-live":`polite`,children:u}),(e.steps.length>0||e.plan.length>0)&&(0,V.jsx)(n,{size:16,"aria-hidden":`true`,className:T(`transition-transform`,c&&`rotate-180`)})]}),e.log.length>0&&(0,V.jsxs)(`button`,{type:`button`,"aria-expanded":_,onClick:()=>v(!_),className:`ml-auto inline-flex min-h-8 cursor-pointer items-center gap-2 rounded-lg border-0 bg-transparent px-2 text-[13px] font-medium text-muted hover:bg-surface-muted hover:text-ink`,children:[(0,V.jsx)(k,{icon:f,size:14}),`Activity log`,(0,V.jsx)(`span`,{className:`tabular-nums`,children:e.log.length})]})]}),(0,V.jsx)(P,{open:(c||a)&&(e.steps.length>0||e.plan.length>0||a),children:(0,V.jsx)(Be,{turn:e,working:a,folded:!c,live:{...l,latest:y,events:e.log.length,onLog:()=>v(!0)}})}),(0,V.jsx)(P,{open:_,children:(0,V.jsx)(rt,{lines:e.log,start:e.started||e.log[0]?.at,live:a,name:`forgeqe-activity-${e.id}.md`})})]}),e.asks.map(e=>(0,V.jsx)(it,{ask:e,live:a,onAnswer:t=>r(e.id,t)},e.id)),e.waits.map(e=>(0,V.jsx)(at,{wait:e,live:a,onProceed:t=>i(e.id,t)},e.id)),m.body&&(0,V.jsx)(N,{text:m.body,className:T((p.typing||a)&&`typing-caret`)}),m.sources&&!p.typing&&!a&&(0,V.jsx)(Ce,{title:`Sources`,children:(0,V.jsx)(N,{text:m.sources,className:`text-muted`})}),(0,V.jsx)(qe,{turn:e}),e.error&&(0,V.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e.error}),e.outcome===`stopped`&&!e.reply&&(0,V.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Stopped.`})]})]})}export{st as n,He as r,rt as t};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$n as t,B as n,Dt as r,Gn as i,Gt as a,Lr as o,M as s,Pn as c,Pr as l,R as u,Sr as d,T as f,Xt as p,_n as m,_r as h,_t as g,a as _,br as v,dr as y,jn as b,o as x,rr as S,w as C}from"./line-icons-rdF8DYDJ.js";import{r as w}from"./route-BloYJWgw.js";import{l as T}from"./agents-C0Jg2pN8.js";import{t as E}from"./jsx-runtime-LKYXHABd.js";import{A as D,X as O,j as k,mt as A,n as ee,r as te,t as j}from"./input-CtzK50ZF.js";import{a as M,d as N,i as ne,l as P,o as F,t as I}from"./filters-CnAMr286.js";import{p as re}from"./palette-DAaGSao7.js";import{Bt as L,Fn as ie,Ht as R,In as ae,It as z,Kt as oe,Lt as B,Rt as se,Vn as V,Vt as ce,g as H,i as U,o as le,qt as ue,r as de,u as fe,zt as W}from"./index-B3JsM7tv.js";import{o as G,r as K,t as pe}from"./parts-D357Wolo.js";var q=e(o(),1),J={browserstack:`BrowserStack`,testmu:`TestMu AI`},me=/^rsp-\d{8}-\d{6}-[0-9a-f]{4}$/,Y={info:()=>O(`GET`,`/api/responsive`),runs:()=>O(`GET`,`/api/responsive/runs`),run:e=>O(`GET`,`/api/responsive/runs/${encodeURIComponent(e)}`),shot:(e,t)=>A(`/api/responsive/runs/${encodeURIComponent(e)}/shots/${encodeURIComponent(t)}`,`image/jpeg`),start:e=>O(`POST`,`/api/responsive/runs`,e),stop:e=>O(`POST`,`/api/responsive/runs/${encodeURIComponent(e)}/stop`,{}),flows:()=>O(`GET`,`/api/responsive/flows`),saveFlow:(e,t,n=!1)=>O(`POST`,`/api/responsive/flows`,{label:e,prompt:t,replace:n}),cloudDevices:(e,t=!1)=>O(`GET`,`/api/responsive/clouds/${e}/devices${t?`?fresh=1`:``}`),cases:e=>O(`GET`,`/api/responsive/cases?q=${encodeURIComponent(e)}`),caseSteps:e=>O(`GET`,`/api/responsive/case?key=${encodeURIComponent(e)}`)};function he(e,t=`600px`){let[n,r]=(0,q.useState)(()=>typeof IntersectionObserver>`u`);return(0,q.useEffect)(()=>{let i=e.current;if(n||!i)return;let a=new IntersectionObserver(e=>{e.some(e=>e.isIntersecting)&&(r(!0),a.disconnect())},{rootMargin:t});return a.observe(i),()=>a.disconnect()},[e,n,t]),n}var X=E(),Z={phone:t,tablet:y,desktop:m};function ge({devices:e,picked:t,max:n,onChange:r,drawnBy:i,real:a}){let[o,s]=(0,q.useState)(``),[c,l]=(0,q.useState)(`all`),u=o.trim().toLowerCase(),d=e.filter(e=>(c===`all`||e.category===c)&&(!u||`${e.label} ${e.os??``} ${e.width}x${e.height} ${e.width}×${e.height}`.toLowerCase().includes(u))),f=t.length>=n,p=t=>e.filter(e=>e.category===t).length;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-4`,children:[(0,X.jsx)(ne,{id:`rp-search`,label:`Search devices`,value:o,onChange:s,placeholder:`iPhone, Pixel, 1920…`,className:`flex-none`}),(0,X.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,role:`group`,"aria-label":`Which devices to list`,children:(0,X.jsx)(I,{value:c,onChange:l,items:[{id:`all`,label:`All`,n:e.length},{id:`phone`,label:`Phones`,n:p(`phone`)},{id:`tablet`,label:`Tablets`,n:p(`tablet`)},...a?[]:[{id:`desktop`,label:`Desktops`,n:p(`desktop`)}]]})})]}),(0,X.jsxs)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:[t.length,` of `,n,` picked`,f?`: remove one to add another.`:`.`,` `,a?`Real devices on ${a}, as it lists them now: each is its own session of your plan, and a real browser (Safari on iOS, Chrome on Android).`:(0,X.jsxs)(X.Fragment,{children:[`Each is emulated in full (size, pixel ratio, touch, user agent)`,i?` and drawn by ${i}.`:` and drawn by Chromium, so a Safari-only difference does not show.`]})]}),d.length?(0,X.jsx)(`ul`,{className:`m-0 grid list-none grid-cols-1 gap-2 p-0 @3xl:grid-cols-2`,children:d.map(e=>{let n=t.includes(e.id);return(0,X.jsx)(`li`,{children:(0,X.jsxs)(`label`,{className:D(`flex items-center gap-2 rounded-[8px] px-2 py-1 text-sm`,!n&&f?`cursor-not-allowed text-muted`:`cursor-pointer hover:bg-surface-muted`),children:[(0,X.jsx)(fe,{checked:n,disabled:!n&&f,onCheckedChange:n=>r(n?[...t,e.id]:t.filter(t=>t!==e.id))}),(0,X.jsx)(P,{icon:Z[e.category],size:16,className:`flex-none text-muted`}),(0,X.jsx)(`span`,{className:`min-w-0 truncate`,children:e.label}),(0,X.jsx)(`span`,{className:`ml-auto flex-none text-[13px] text-muted`,children:e.os??`${e.width}×${e.height} · ${e.scale}x`})]})},e.id)})}):(0,X.jsxs)(F,{children:[`No device matches “`,o,`”.`]})]})}function _e({results:e}){return(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px]`,"aria-label":`What happened on each device`,children:e.map(e=>(0,X.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2`,children:[(0,X.jsx)(P,{icon:e.skipped?a:e.ok?s:u,size:16,className:D(`mt-1 flex-none`,e.skipped?`text-muted`:e.ok?`text-pass`:`text-fail`)}),(0,X.jsxs)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[(0,X.jsx)(`strong`,{className:`font-semibold`,children:e.label}),(0,X.jsxs)(`span`,{className:`text-muted`,children:[` `,`· `,e.skipped?`nothing to do on this layout`:`${e.done} of ${k(e.of,`step`)}`]}),e.error&&(0,X.jsx)(`span`,{className:`block text-muted`,children:e.error})]})]},e.device))})}var ve={running:{label:`Running`,tone:`running`},done:{label:`Done`,tone:`pass`},stopped:{label:`Stopped`,tone:`neutral`},failed:{label:`Failed`,tone:`fail`}},ye=e=>{try{let t=new URL(e);return`${t.host}${t.pathname===`/`?``:t.pathname}`}catch{return e}},be=e=>e.status===`running`?`running`:e.findings?`findings`:`clean`;function xe({rows:e}){let[t,n]=(0,q.useState)(`all`),r=t=>t===`all`?e.length:e.filter(e=>be(e)===t).length,i=e.filter(e=>t===`all`||be(e)===t),a=e=>location.hash=w(`responsive`,e);return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(G,{children:[(0,X.jsx)(K,{label:`All`,value:r(`all`),onClick:()=>n(`all`),on:t===`all`}),(0,X.jsx)(K,{label:`Running`,value:r(`running`),onClick:()=>n(`running`),on:t===`running`}),(0,X.jsx)(K,{label:`With findings`,value:r(`findings`),tone:r(`findings`)?`text-warn`:void 0,onClick:()=>n(`findings`),on:t===`findings`}),(0,X.jsx)(K,{label:`Clean`,value:r(`clean`),tone:r(`clean`)?`text-pass`:void 0,onClick:()=>n(`clean`),on:t===`clean`})]}),(0,X.jsx)(z,{label:`Runs`,placeholder:`Find a run`,empty:t===`all`?`No runs.`:`None here.`,resetKey:t,head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{scope:`col`,className:W,children:`Page`}),(0,X.jsx)(`th`,{scope:`col`,className:D(W,`hidden @xl:table-cell`),children:`Devices`}),(0,X.jsx)(`th`,{scope:`col`,className:D(W,`hidden @3xl:table-cell`),children:`How`}),(0,X.jsx)(`th`,{scope:`col`,className:W,children:`Findings`}),(0,X.jsx)(`th`,{scope:`col`,className:W,children:`Status`}),(0,X.jsx)(`th`,{scope:`col`,className:D(W,`hidden @xl:table-cell`),children:`When`})]}),children:i.map(e=>{let t=ve[e.status];return(0,X.jsxs)(`tr`,{onClick:()=>a(e.id),className:R,children:[(0,X.jsxs)(`td`,{className:B,children:[(0,X.jsx)(`a`,{href:w(`responsive`,e.id),onClick:e=>e.stopPropagation(),className:`font-medium text-ink no-underline [overflow-wrap:anywhere] hover:underline`,children:ye(e.url)}),(0,X.jsx)(`span`,{className:`block text-[13px] text-muted`,children:e.id})]}),(0,X.jsxs)(`td`,{className:D(B,`hidden text-[13px] text-ink-2 @xl:table-cell`),children:[e.devices,e.on?(0,X.jsxs)(`span`,{className:`block text-muted`,children:[`on `,J[e.on]]}):null]}),(0,X.jsx)(`td`,{className:D(B,`hidden text-[13px] text-ink-2 @3xl:table-cell`),children:e.mode===`guided`?`Guided, ${e.steps} step${e.steps===1?``:`s`}`:`Interactive${e.steps?`, ${e.steps} instruction${e.steps===1?``:`s`}`:``}`}),(0,X.jsx)(`td`,{className:D(B,`text-[13px] whitespace-nowrap`),children:e.findings?(0,X.jsxs)(`span`,{className:e.high?`text-fail`:`text-warn`,children:[e.findings,e.high?` · ${e.high} high`:``]}):e.status===`running`?(0,X.jsx)(`span`,{className:`text-muted`,children:`So far none`}):(0,X.jsx)(`span`,{className:`text-pass`,children:`None`})}),(0,X.jsx)(`td`,{className:D(B,`whitespace-nowrap`),children:(0,X.jsx)(M,{tone:t.tone,children:t.label})}),(0,X.jsx)(`td`,{className:D(B,`hidden text-[13px] whitespace-nowrap text-muted @xl:table-cell`),children:H(e.endedAt||e.startedAt)})]},e.id)})})]})}var Se={high:{label:`High`,tone:`fail`},medium:{label:`Medium`,tone:`warn`},low:{label:`Low`,tone:`neutral`}},Ce=1500,we={chrome:`Chrome`,edge:`Edge`,firefox:`Firefox`,webkit:`WebKit`};function Te({id:e,file:t,label:n,className:r,onOpen:i,thumb:a}){let[o,s]=(0,q.useState)(``),[c,l]=(0,q.useState)(!1),u=(0,q.useRef)(null),d=he(u);(0,q.useEffect)(()=>{if(!d)return;let n=!1;return Y.shot(e,t).then(e=>!n&&s(e),()=>!n&&l(!0)),()=>{n=!0}},[e,t,d]);let f=c?(0,X.jsx)(`span`,{className:`grid min-h-24 place-items-center text-[13px] text-muted`,children:`No picture`}):o?(0,X.jsx)(`img`,{src:o,alt:`${n} screenshot`,className:D(`block w-full object-top`,a?`h-24 object-cover`:`object-contain`)}):(0,X.jsx)(`span`,{className:`block min-h-24 bg-surface-muted`});return i?(0,X.jsx)(`button`,{ref:u,type:`button`,onClick:i,"aria-label":`Show the ${n} screenshot larger`,"data-tip":`Show larger`,className:D(`block cursor-zoom-in overflow-hidden rounded-[12px] border border-line-soft bg-surface-muted p-0 hover:border-line-strong`,r),children:f}):(0,X.jsx)(`div`,{ref:u,className:D(`overflow-hidden rounded-[12px] border border-line-soft bg-surface-muted`,r),children:f})}var Ee=[`high`,`medium`,`low`],De={sideways:`Scrolls sideways`,small_text:`Text under 12px`,small_targets:`Tap targets under 24px`,broken_images:`Broken images`},Q=e=>e.check.startsWith(`custom-`),$=e=>Q(e)?e.title:De[e.check]??e.title,Oe=e=>{let t=e.steps.filter(e=>e>0);return t.length?`${t.length<e.steps.length?`Start, step`:`Step`}${t.length>1?`s`:``} ${t.join(`, `)}`:`At the start`};function ke({run:e,onOpen:t}){let[n,r]=(0,q.useState)(`all`),i=t=>t===`all`?e.findings.length:e.findings.filter(e=>e.severity===t).length;if(!e.findings.length)return(0,X.jsx)(F,{icon:f,title:e.status===`running`?`Nothing found so far`:`Nothing found`,children:e.status===`running`?`Each device is checked after every step; findings show here as they are made.`:`Every device passed the checks at each of the run's ${k(e.steps.length,`step`)}.`});let a=e.findings.filter(e=>n===`all`||e.severity===n).sort((e,t)=>Ee.indexOf(e.severity)-Ee.indexOf(t.severity)||Math.min(...e.steps)-Math.min(...t.steps));return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,role:`group`,"aria-label":`Which findings to show`,children:(0,X.jsx)(I,{value:n,onChange:r,items:[{id:`all`,label:`All`,n:i(`all`)},{id:`high`,label:`High`,n:i(`high`)},{id:`medium`,label:`Medium`,n:i(`medium`)},{id:`low`,label:`Low`,n:i(`low`)}]})}),(0,X.jsx)(z,{label:`Findings`,placeholder:`Find a finding`,empty:`None here.`,resetKey:n,head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{scope:`col`,className:W,children:`Finding`}),(0,X.jsx)(`th`,{scope:`col`,className:W,children:`Severity`}),(0,X.jsx)(`th`,{scope:`col`,className:W,children:`Device`}),(0,X.jsx)(`th`,{scope:`col`,className:D(W,`hidden @xl:table-cell`),children:`When`})]}),children:a.map(e=>{let n=Se[e.severity];return(0,X.jsxs)(`tr`,{onClick:()=>t(e),className:R,children:[(0,X.jsxs)(`td`,{className:B,children:[(0,X.jsx)(`button`,{type:`button`,onClick:n=>(n.stopPropagation(),t(e)),className:`cursor-pointer border-0 bg-transparent p-0 text-left font-medium text-ink [overflow-wrap:anywhere] hover:underline`,children:Q(e)?`“${$(e)}”`:$(e)}),(0,X.jsx)(`span`,{className:`block text-[13px] text-muted [overflow-wrap:anywhere]`,children:Q(e)?`Your check`:e.title===$(e)?e.detail:e.title})]}),(0,X.jsx)(`td`,{className:D(B,`whitespace-nowrap`),children:(0,X.jsx)(M,{tone:n.tone,icon:!1,children:n.label})}),(0,X.jsx)(`td`,{className:D(B,`text-[13px] whitespace-nowrap`),children:(0,X.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,X.jsx)(P,{icon:Z[e.layout],size:16,className:`flex-none text-muted`}),e.label]})}),(0,X.jsx)(`td`,{className:D(B,`hidden text-[13px] whitespace-nowrap text-muted @xl:table-cell`),children:Oe(e)})]},e.id)})})]})}function Ae({f:e,run:t,onOpen:n}){let r=t.findings.filter(t=>t.check===e.check&&t.id!==e.id);return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 pt-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,X.jsx)(M,{tone:Se[e.severity].tone,icon:!1,children:Se[e.severity].label}),(0,X.jsx)(P,{icon:Z[e.layout],size:16,className:`flex-none text-muted`}),(0,X.jsx)(`strong`,{className:`font-semibold`,children:e.label}),(0,X.jsx)(`span`,{className:`text-[13px] text-muted`,children:Oe(e)})]}),e.title!==$(e)&&(0,X.jsx)(`p`,{className:`m-0 text-sm font-medium [overflow-wrap:anywhere]`,children:e.title}),e.detail&&(0,X.jsx)(`p`,{className:`m-0 text-sm text-ink-2 [overflow-wrap:anywhere]`,children:e.detail}),e.quote&&(0,X.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-2 text-[13px] [overflow-wrap:anywhere]`,children:[`On the screen: “`,e.quote,`”`]}),(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] text-ink-2`,children:e.steps.map(e=>(0,X.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e?`Step ${e}: ${t.steps.find(t=>t.n===e)?.instruction??``}`:`When the page opened`},e))}),e.shot?(0,X.jsx)(Te,{id:t.id,file:e.shot,label:e.label},e.shot):(0,X.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`No screenshot for this finding.`}),r.length>0&&(0,X.jsxs)(`section`,{"aria-labelledby":`rp-others`,className:`flex flex-col gap-2`,children:[(0,X.jsxs)(`h3`,{id:`rp-others`,className:`m-0 text-base font-semibold`,children:[`Also on `,k(new Set(r.map(e=>e.device)).size,`other device`)]}),(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-wrap gap-2 p-0`,children:r.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(N,{size:`sm`,onClick:()=>n(e),"data-tip":`Show it on ${e.label}`,children:[(0,X.jsx)(P,{icon:Z[e.layout],size:16,"aria-hidden":`true`}),e.label]})},e.id))})]})]})}function je({run:e,onShot:t}){let n=e.spec;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[n.prompt&&(0,X.jsxs)(`section`,{"aria-labelledby":`rp-prompt`,className:`flex min-w-0 flex-col gap-2 rounded-[14px] card border px-4 py-4`,children:[(0,X.jsx)(`h3`,{id:`rp-prompt`,className:`m-0 text-base font-semibold`,children:`Your prompt`}),(0,X.jsx)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-2 text-sm whitespace-pre-wrap [overflow-wrap:anywhere]`,children:n.prompt}),n.attachments&&n.attachments.length>0&&(0,X.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Attached: `,n.attachments.join(`, `)]}),(0,X.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`Read as `,k(n.steps.length,`step`),n.custom.length?`, with ${k(n.custom.length,`check`)} of your own`:``,`: `,n.steps.join(` → `)||`none`]})]}),(0,X.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:e.steps.map(n=>{let r=e.shots.filter(e=>e.step===n.n),i=e.findings.filter(e=>e.steps.includes(n.n)).length;return(0,X.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-4 rounded-[14px] card border px-4 py-4`,children:[(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(`span`,{className:`inline-flex size-6 flex-none items-center justify-center rounded-full bg-surface-strong text-[13px] font-semibold tabular-nums`,children:n.n}),(0,X.jsx)(`h3`,{className:`m-0 min-w-0 flex-1 text-base font-semibold [overflow-wrap:anywhere]`,children:n.instruction}),(0,X.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[i?`${k(i,`finding`)}`:`No findings`,` · `,H(n.at)]})]}),n.plan.length>0&&(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0 text-[13px] text-muted`,children:n.plan.map(e=>(0,X.jsx)(`li`,{className:`[overflow-wrap:anywhere]`,children:e},e))}),n.results.length>0&&(0,X.jsx)(_e,{results:n.results}),!n.results.length&&n.note&&n.by!==`check`&&n.by!==`open`&&(0,X.jsx)(`p`,{className:`m-0 text-[13px] text-warn [overflow-wrap:anywhere]`,children:n.note}),r.length>0&&(0,X.jsx)(`div`,{className:`flex gap-2 overflow-x-auto pb-2`,"aria-label":`Screenshots after step ${n.n}`,children:r.map(r=>{let i=e.spec.devices.includes(r.device)?r.device:`device`;return(0,X.jsx)(Te,{id:e.id,file:r.file,label:i,className:`w-[120px] flex-none`,onOpen:()=>t(r.file,`${i}, step ${n.n}`)},r.file)})})]},`${n.n}-${n.at}`)})})]})}function Me({run:e,onShot:t}){let n=[...new Set(e.shots.map(e=>e.step))];return n.length?(0,X.jsx)(`div`,{className:`flex flex-col gap-6`,children:n.map(n=>{let r=e.steps.find(e=>e.n===n);return(0,X.jsxs)(`section`,{"aria-labelledby":`rp-shots-${n}`,className:`flex flex-col gap-2`,children:[(0,X.jsx)(`h3`,{id:`rp-shots-${n}`,className:`m-0 text-base font-semibold [overflow-wrap:anywhere]`,children:n?`Step ${n}: ${r?.instruction??``}`:`When the page opened`}),(0,X.jsx)(`ul`,{className:`m-0 grid list-none grid-cols-2 gap-4 p-0 @3xl:grid-cols-4 @5xl:grid-cols-6`,children:e.shots.filter(e=>e.step===n).map(r=>(0,X.jsxs)(`li`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,X.jsx)(Te,{id:e.id,file:r.file,label:r.device,onOpen:()=>t(r.file,`${r.device}, ${n?`step ${n}`:`start`}`)}),(0,X.jsx)(`span`,{className:`truncate text-[13px] text-muted`,children:r.device})]},r.file))})]},n)})}):(0,X.jsx)(F,{children:`No screenshots were kept.`})}function Ne({log:e}){let[t,n]=(0,q.useState)(`all`),r=e.filter(e=>e.level!==`info`),i=t===`all`?e:r;return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsx)(`div`,{className:`flex flex-wrap items-center gap-2`,role:`group`,"aria-label":`Which lines to show`,children:(0,X.jsx)(I,{value:t,onChange:n,items:[{id:`all`,label:`Everything`,n:e.length},{id:`problems`,label:`Errors and warnings`,n:r.length}]})}),i.length?(0,X.jsx)(`ol`,{className:`m-0 flex list-none flex-col p-0`,"aria-label":`Log`,children:i.map((e,t)=>(0,X.jsxs)(`li`,{className:`flex min-w-0 items-start gap-2 border-t border-line-soft py-2 text-[13px] first:border-t-0`,children:[(0,X.jsx)(P,{icon:e.level===`error`?u:e.level===`warn`?v:a,size:16,className:D(`mt-1 flex-none`,e.level===`error`?`text-fail`:e.level===`warn`?`text-warn`:`text-muted`)}),(0,X.jsx)(`span`,{className:`w-[72px] flex-none text-muted tabular-nums`,children:new Date(e.at).toLocaleTimeString()}),(0,X.jsx)(`span`,{className:`min-w-0 flex-1 [overflow-wrap:anywhere]`,children:e.text})]},`${e.at}-${t}`))}):(0,X.jsx)(F,{children:t===`all`?`Nothing logged yet.`:`No errors or warnings.`})]})}function Pe({run:e}){let t=e.steps.toReversed();return(0,X.jsx)(z,{label:`Devices`,placeholder:`Find a device`,empty:`No devices.`,head:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(`th`,{scope:`col`,className:W,children:`Device`}),(0,X.jsx)(`th`,{scope:`col`,className:W,children:`Last step`}),(0,X.jsx)(`th`,{scope:`col`,className:L,children:`Findings`})]}),children:e.spec.devices.map(n=>{let r=t.find(e=>e.results.some(e=>e.device===n)),i=r?.results.find(e=>e.device===n),o=e.findings.filter(e=>e.device===n).length,c=i?.label||e.spec.labels?.[n]||e.findings.find(e=>e.device===n)?.label||n,l=e.shots.some(e=>e.device===n);return(0,X.jsxs)(`tr`,{className:ce,children:[(0,X.jsx)(`td`,{className:D(B,`font-medium whitespace-nowrap`),children:c}),(0,X.jsx)(`td`,{className:D(B,`text-[13px]`),children:i?(0,X.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2`,children:[(0,X.jsx)(P,{icon:i.skipped?a:i.ok?s:u,size:16,className:D(`mt-1 flex-none`,i.skipped?`text-muted`:i.ok?`text-pass`:`text-fail`)}),(0,X.jsxs)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:[`Step `,r.n,`: `,i.skipped?`nothing to do on this layout`:i.ok?`done`:i.error||`did not finish`]})]}):(0,X.jsx)(`span`,{className:`text-muted`,children:l?`Page opened`:`Opening…`})}),(0,X.jsx)(`td`,{className:D(se,`text-[13px]`,o?`text-warn`:`text-muted`),children:o})]},n)})})}function Fe({id:e}){let[t,n]=(0,q.useState)(null),[r,i]=(0,q.useState)([]),[a,o]=(0,q.useState)(!1),[s,c]=(0,q.useState)(null),[u,d]=(0,q.useState)(``),[f,p]=(0,q.useState)(!1),[m,h]=(0,q.useState)(null),[g,v]=(0,q.useState)(null),y=(0,q.useCallback)(()=>{Y.run(e).then(e=>{n(e.run),i(e.log),o(e.live)},e=>d(e.message))},[e]);(0,q.useEffect)(y,[y]),(0,q.useEffect)(()=>{if(!a)return;let e=ae(y,Ce);return()=>ie(e)},[a,y]);let b=async()=>{p(!0),d(``);try{await Y.stop(e),y()}catch(e){d(e.message)}finally{p(!1)}};if(!t)return u?(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:u}):(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`});let x=ve[t.status],C=r.filter(e=>e.level!==`info`).length,T=a?[{id:`findings`,label:`Findings`,n:t.findings.length,tone:t.findings.length?`text-warn`:void 0},{id:`devices`,label:`Devices`,n:t.spec.devices.length},{id:`log`,label:`Log and errors`,n:C||void 0,tone:C?`text-fail`:void 0}]:[{id:`steps`,label:`Steps`,n:t.steps.length},{id:`findings`,label:`Findings`,n:t.findings.length,tone:t.findings.length?`text-warn`:void 0},{id:`shots`,label:`Screenshots`,n:t.shots.length},{id:`log`,label:`Log and errors`,n:C||void 0,tone:C?`text-fail`:void 0}],E=s&&T.some(e=>e.id===s)?s:T[0].id,D=t.steps.filter(e=>e.by===`plan`||e.by===`words`).length,O=t.spec.steps.length;return(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`a`,{href:w(`responsive`,`runs`),className:`inline-flex items-center gap-2 self-start text-sm`,children:[(0,X.jsx)(_,{size:16,"aria-hidden":`true`}),`All runs`]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-4 @3xl:flex-row @3xl:items-start`,children:[(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,X.jsx)(`h2`,{className:`m-0 text-[20px] leading-snug font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:ye(t.spec.url)}),(0,X.jsxs)(`p`,{className:`m-0 text-sm text-muted`,children:[k(t.spec.devices.length,`device`),t.spec.on?` on ${J[t.spec.on]} (${t.spec.real?`real devices`:we[t.spec.browser??`chrome`]})`:``,` · `,t.spec.mode===`guided`?`${O?k(O,`step`):`reading the prompt`}${t.spec.source?.label?` from ${t.spec.source.label}`:``}`:`interactive (an earlier kind of run)`,` · started `,H(t.startedAt)]})]}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsx)(M,{tone:x.tone,children:x.label}),a&&(0,X.jsxs)(N,{variant:`danger`,disabled:f,onClick:()=>void b(),"data-tip":`Stop now; what was done is kept`,children:[(0,X.jsx)(S,{fill:`currentColor`,"aria-hidden":`true`}),`Stop`]})]})]}),a&&(0,X.jsxs)(`div`,{className:`flex items-center gap-4 rounded-[12px] card border px-4 py-2`,children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm`,children:O?D<O?`Step ${Math.min(D+1,O)} of ${O}: ${t.spec.steps[D]??``}`:`Last checks…`:`Reading your prompt as steps…`}),(0,X.jsx)(`span`,{className:`w-[160px] flex-none`,children:(0,X.jsx)(pe,{value:D/Math.max(1,O)*100,label:`Steps done`})})]}),t.error&&(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:t.error}),u&&(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:u}),(0,X.jsx)(oe,{prefix:`rtab`,className:`mb-0`,tabs:T,current:E,onPick:c,label:`Run`}),(0,X.jsxs)(`div`,{role:`tabpanel`,id:`rtab-panel-${E}`,"aria-labelledby":`rtab-${E}`,className:`flex min-w-0 flex-col gap-4`,children:[E===`devices`&&a&&(0,X.jsx)(Pe,{run:t}),E===`steps`&&(0,X.jsx)(je,{run:t,onShot:(e,t)=>h({file:e,label:t})}),E===`findings`&&(0,X.jsx)(ke,{run:t,onOpen:v}),E===`shots`&&(0,X.jsx)(Me,{run:t,onShot:(e,t)=>h({file:e,label:t})}),E===`log`&&(0,X.jsx)(Ne,{log:r})]}),(0,X.jsx)(V,{open:!!m,onClose:()=>h(null),wide:!0,title:m?.label??`Screenshot`,footer:(0,X.jsxs)(N,{onClick:()=>h(null),children:[(0,X.jsx)(l,{"aria-hidden":`true`}),`Close`]}),children:m&&(0,X.jsx)(Te,{id:t.id,file:m.file,label:m.label})}),(0,X.jsx)(V,{open:!!g,onClose:()=>v(null),wide:!0,title:g?Q(g)?`“${$(g)}”`:$(g):`Finding`,...g&&Q(g)?{description:`A check of your own`}:{},footer:(0,X.jsxs)(N,{onClick:()=>v(null),children:[(0,X.jsx)(l,{"aria-hidden":`true`}),`Close`]}),children:g&&(0,X.jsx)(Ae,{f:g,run:t,onOpen:v})})]})}function Ie({steps:e,at:t,reached:n,onGo:r,label:i=`Steps`}){return(0,X.jsx)(`nav`,{"aria-label":i,children:(0,X.jsx)(`ol`,{className:`m-0 flex list-none items-center gap-2 p-0`,children:e.map((i,a)=>{let o=a<=n,s=a===t,c=a<n&&!s;return(0,X.jsxs)(`li`,{className:D(`flex items-center gap-2`,a<e.length-1&&`flex-1`),children:[(0,X.jsxs)(`button`,{type:`button`,disabled:!o,"aria-current":s?`step`:void 0,onClick:()=>r(a),"aria-label":i.name,"data-tip":i.tip,className:D(`inline-flex min-h-8 flex-none items-center gap-2 rounded-[8px] border-0 bg-transparent px-1 text-[13px] whitespace-nowrap`,o&&!s?`cursor-pointer hover:bg-surface-strong`:``),children:[(0,X.jsx)(`span`,{"aria-hidden":`true`,className:D(`inline-flex size-6 flex-none items-center justify-center rounded-full text-[13px] font-semibold tabular-nums`,c?`bg-pass text-white`:s?`bg-accent text-accent-ink`:`border border-line bg-bg text-muted`),children:c?(0,X.jsx)(C,{size:13,strokeWidth:3}):a+1}),(0,X.jsx)(`span`,{className:D(s?`font-medium text-ink`:o?`text-ink-2`:`text-muted`,!s&&`hidden @xl:inline`),children:i.name})]}),a<e.length-1&&(0,X.jsx)(`span`,{"aria-hidden":`true`,className:`h-0.5 min-w-4 flex-1 overflow-hidden rounded-full bg-line @xl:min-w-8`,children:(0,X.jsx)(`span`,{className:D(`block h-full rounded-full bg-pass transition-[width] duration-250 ease-out`,a<n?`w-full`:`w-0`)})})]},i.name)})})})}var Le=[{name:`Page and devices`,tip:`The page and the devices to show it on`},{name:`What to do`,tip:`Your prompt, files or a test case`},{name:`What to check`,tip:`Built-in checks and your own`},{name:`Review`,tip:`Check and start`}],Re=8,ze=[`The main menu can be opened`,`Sign in is visible without scrolling`,`The page title is shown`,`Prices show next to each product`],Be=`forgeqe:responsive`;function Ve(){try{let e=JSON.parse(localStorage.getItem(Be)||`{}`);return e&&typeof e==`object`?e:{}}catch{return{}}}function He(e){try{localStorage.setItem(Be,JSON.stringify({...Ve(),...e}))}catch{}}function Ue({id:e,label:t,help:n,children:r}){return(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`label`,{htmlFor:e,className:`text-sm font-medium`,children:t}),r,n&&(0,X.jsx)(`span`,{className:`text-[13px] text-muted`,children:n})]})}function We({busy:e,onBack:t,next:n,onNext:r,disabled:i,aside:a}){return(0,X.jsxs)(`div`,{className:`sticky bottom-0 flex flex-wrap items-center gap-4 border-t border-line-soft bg-bg py-4`,children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 text-[13px]`,children:a}),t&&(0,X.jsxs)(N,{variant:`ghost`,disabled:e,onClick:t,children:[(0,X.jsx)(_,{"aria-hidden":`true`}),`Back`]}),(0,X.jsx)(N,{variant:`primary`,disabled:e||i,onClick:r,children:n})]})}var Ge=`inline-flex min-h-8 cursor-pointer items-center gap-2 rounded-[8px] border-0 bg-surface-strong px-2 text-[13px] text-ink hover:bg-line disabled:cursor-default disabled:opacity-50`,Ke=4e3,qe=3,Je=5e4,Ye=`Search for pliers, open the first result and add it to the cart, then open the cart.
|
|
2
|
+
The cart should show 1 item and its total should be visible without scrolling.`;function Xe({prompt:e,setPrompt:t,files:a,setFiles:o,source:s,setSource:c,flows:u,onFlowsChanged:f,onError:p}){let[m,h]=(0,q.useState)(!1),[_,v]=(0,q.useState)(``),[y,b]=(0,q.useState)(null),[x,S]=(0,q.useState)(``),[C,w]=(0,q.useState)(``),[T,E]=(0,q.useState)(``),D=(0,q.useRef)(null),O=(e,n)=>{t(e.slice(0,Ke)),c(n),p(``)},A=async t=>{try{let n=await Y.saveFlow(x.trim(),e,t);E(``),w(n.flow.label),S(``),f()}catch(e){let n=e.message;!t&&/saved already/.test(n)?E(n):p(n)}},M=async e=>{let t=[...e??[]];if(!t.length)return;if(a.length+t.length>qe)return p(`Attach at most ${qe} files.`);let n=[...a];for(let e of t){if(!/\.(txt|md|csv|feature)$/i.test(e.name)||e.size>262144)return p(`Attach .txt, .md, .csv or .feature files of at most 256 KB.`);let t=await e.text();if(t.length>Je)return p(`${e.name} is longer than ${Je/1e3}k characters.`);n.some(t=>t.name===e.name)||n.push({name:e.name.replace(/[^\w .()-]/g,`_`).slice(-80),text:t})}o(n),p(``)};return(0,X.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,X.jsx)(Ue,{id:`rp-prompt`,label:`What should ForgeQE do on every device?`,help:`Write it as you would tell a tester: what to do, in order, and what should be true. Attached files are read too. ${e.length}/${Ke}`,children:(0,X.jsx)(te,{id:`rp-prompt`,value:e,rows:6,maxLength:Ke,placeholder:Ye,onChange:e=>t(e.target.value)})}),a.length>0&&(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-wrap gap-2 p-0`,"aria-label":`Attached files`,children:a.map(e=>(0,X.jsxs)(`li`,{className:`inline-flex min-h-8 items-center gap-2 rounded-[8px] bg-surface-strong pr-1 pl-2 text-[13px] text-ink`,children:[(0,X.jsx)(g,{size:13,"aria-hidden":`true`}),(0,X.jsx)(`span`,{className:`max-w-[240px] truncate`,children:e.name}),(0,X.jsx)(`button`,{type:`button`,"aria-label":`Remove ${e.name}`,"data-tip":`Remove ${e.name}`,onClick:()=>o(a.filter(t=>t.name!==e.name)),className:`inline-flex size-6 cursor-pointer items-center justify-center rounded-[8px] border-0 bg-transparent p-0 text-muted hover:bg-line hover:text-ink`,children:(0,X.jsx)(l,{size:13,"aria-hidden":`true`})})]},e.name))}),(0,X.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,X.jsxs)(N,{size:`sm`,disabled:a.length>=qe,onClick:()=>D.current?.click(),"data-tip":`Attach a test case, notes or a feature file (.txt, .md, .csv, .feature), read in this browser`,children:[(0,X.jsx)(d,{"aria-hidden":`true`}),`Attach`]}),(0,X.jsx)(`input`,{ref:D,type:`file`,multiple:!0,accept:`.txt,.md,.csv,.feature,text/plain,text/markdown,text/csv`,className:`hidden`,onChange:e=>{M(e.target.files),e.target.value=``}}),(0,X.jsxs)(N,{size:`sm`,"aria-expanded":m,onClick:()=>h(!m),"data-tip":`Fill the prompt from a test case of test management`,children:[(0,X.jsx)(n,{"aria-hidden":`true`}),`Test case`]}),(0,X.jsxs)(ee,{"aria-label":`A saved prompt`,size:`sm`,value:``,disabled:!u.length,onChange:e=>{let t=u.find(t=>t.name===e.target.value);t&&O(t.prompt,{kind:`flow`,label:t.label})},className:`min-w-0 flex-[0_1_220px]`,children:[(0,X.jsx)(`option`,{value:``,children:u.length?`A saved prompt…`:`No saved prompts yet`}),u.map(e=>(0,X.jsx)(`option`,{value:e.name,children:e.label},e.name))]}),(0,X.jsx)(`span`,{className:`flex-1`}),(0,X.jsx)(j,{"aria-label":`Name for the prompt`,size:`sm`,value:x,maxLength:80,placeholder:`Name to save as`,onChange:e=>S(e.target.value),className:`min-w-0 flex-[0_1_200px]`}),(0,X.jsxs)(N,{size:`sm`,disabled:!x.trim()||!e.trim(),"data-tip":`Save this prompt to use again`,onClick:()=>void A(!1),children:[(0,X.jsx)(r,{"aria-hidden":`true`}),`Save`]})]}),m&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 rounded-[12px] bg-surface-muted p-4`,children:[(0,X.jsxs)(`form`,{className:`flex flex-wrap items-center gap-2`,onSubmit:async e=>{e.preventDefault();try{b((await Y.cases(_)).cases)}catch(e){p(e.message)}},children:[(0,X.jsx)(j,{"aria-label":`Find a test case`,autoFocus:!0,value:_,maxLength:100,placeholder:`checkout, ADO-12…`,onChange:e=>v(e.target.value),className:`min-w-0 flex-[1_1_200px] bg-bg`}),(0,X.jsxs)(N,{size:`sm`,type:`submit`,"data-tip":`Find test cases from test management`,children:[(0,X.jsx)(i,{"aria-hidden":`true`}),`Find`]})]}),y&&(y.length?(0,X.jsx)(`ul`,{className:`m-0 flex list-none flex-col gap-1 p-0`,children:y.map(e=>(0,X.jsx)(`li`,{children:(0,X.jsxs)(`button`,{type:`button`,className:`flex w-full cursor-pointer items-center gap-2 rounded-[8px] border-0 bg-transparent px-2 py-1 text-left text-sm text-ink hover:bg-surface-strong`,onClick:async()=>{try{let t=await Y.caseSteps(e.key),n=t.key.split(`:`)[1];O(`Test case ${n}: ${t.title}\n${t.steps.map((e,t)=>`${t+1}. ${e}`).join(`
|
|
3
|
+
`)}`,{kind:`case`,label:`${n} ${t.title}`}),h(!1),b(null)}catch(e){p(e.message)}},children:[(0,X.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.title}),(0,X.jsxs)(`span`,{className:`flex-none text-[13px] text-muted`,children:[e.key.split(`:`)[1],` · `,k(e.steps,`step`)]})]})},e.key))}):(0,X.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`No test case with steps matches. Test management lists the cases of the plans Settings connects.`}))]}),s.kind!==`typed`&&s.label&&(0,X.jsxs)(`p`,{className:`m-0 text-[13px] text-muted`,children:[`From `,s.kind===`flow`?`the saved prompt`:`the test case`,` `,(0,X.jsx)(`strong`,{className:`font-medium text-ink-2`,children:s.label}),`; change it as you like.`]}),C&&(0,X.jsxs)(`p`,{role:`status`,className:`m-0 text-[13px] text-pass`,children:[`Saved as “`,C,`”.`]}),(0,X.jsx)(V,{open:!!T,onClose:()=>E(``),title:`Replace the saved prompt?`,description:T,footer:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(N,{onClick:()=>E(``),children:[(0,X.jsx)(l,{"aria-hidden":`true`}),`Cancel`]}),(0,X.jsxs)(N,{variant:`primary`,onClick:()=>void A(!0),children:[(0,X.jsx)(r,{"aria-hidden":`true`}),`Replace`]})]}),children:(0,X.jsx)(`p`,{className:`m-0 text-sm text-ink-2`,children:`The saved prompt's old text is not kept.`})})]})}function Ze({info:e,url:t,named:n,where:r,prompt:i,files:a,checks:o,custom:s}){let c=(e,t)=>(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 border-b border-line-soft py-4 first:pt-0 last:border-b-0 last:pb-0`,children:[(0,X.jsx)(`span`,{className:`text-[13px] font-medium text-muted`,children:e}),(0,X.jsx)(`div`,{className:`text-sm`,children:t})]});return(0,X.jsxs)(`aside`,{"aria-label":`Summary`,className:`flex flex-col rounded-[14px] card border p-6`,children:[c(`Page`,t.trim()?(0,X.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:ye(t.trim())}):(0,X.jsx)(`span`,{className:`text-muted`,children:`Not given yet`})),c(`Devices`,n.length?(0,X.jsx)(`span`,{children:n.join(`, `)}):(0,X.jsx)(`span`,{className:`text-muted`,children:`None picked`})),c(`Runs on`,r),c(`What to do`,i.trim()?`Your prompt${a?` and ${k(a,`file`)}`:``}`:(0,X.jsx)(`span`,{className:`text-muted`,children:`No prompt yet`})),c(`Checks`,o.length+s.filter(e=>e.trim()).length?(0,X.jsx)(`span`,{children:[...o.map(t=>e.checks.find(e=>e.id===t)?.label??t),...s.filter(e=>e.trim())].join(` · `)}):(0,X.jsx)(`span`,{className:`text-muted`,children:`None yet`}))]})}function Qe({info:e,onStarted:t}){let n=Ve(),r=(n.devices??[]).filter(t=>e.devices.some(e=>e.id===t)).slice(0,e.maxPanes),[i,a]=(0,q.useState)(0),[o,s]=(0,q.useState)(0),[l,u]=(0,q.useState)(n.address??e.start),[d,f]=(0,q.useState)(r.length?r:e.defaults),[p,m]=(0,q.useState)(``),[g,_]=(0,q.useState)([]),[v,y]=(0,q.useState)({kind:`typed`}),[S,C]=(0,q.useState)((n.checks??[]).filter(t=>e.checks.some(e=>e.id===t)).length?n.checks.filter(t=>e.checks.some(e=>e.id===t)):e.checks.map(e=>e.id)),[w,T]=(0,q.useState)([]),[E,O]=(0,q.useState)(n.on&&n.on!==`local`&&e.clouds[n.on]?.ready?n.on:`local`),[k,A]=(0,q.useState)(e.browsers.some(e=>e.id===n.browser)?n.browser:`chrome`),te=e.browsers.find(e=>e.id===k)?.label??k,[M,ne]=(0,q.useState)(n.kind===`browser`?`browser`:`real`),[P,F]=(0,q.useState)(null),[I,re]=(0,q.useState)(``),[L,ie]=(0,q.useState)([]),R=E!==`local`&&M===`real`;(0,q.useEffect)(()=>{if(!R||P?.cloud===E)return;let e=!1;return re(``),ie([]),Y.cloudDevices(E).then(t=>!e&&F({cloud:E,devices:t.devices,max:t.max}),t=>!e&&re(t.message)),()=>{e=!0}},[R,E,P?.cloud]);let ae=P?.cloud===E?P.devices.map(e=>({id:e.id,label:e.name,category:e.category,width:0,height:0,scale:1,os:`${e.platform===`ios`?`iOS`:`Android`} ${e.version}`})):[],z=R?L:d,oe=R?L.map(e=>P?.devices.find(t=>t.id===e)?.label??e):d.map(t=>e.devices.find(e=>e.id===t)?.label??t),B=E===`local`?`This computer (Chromium)`:R?`${J[E]}: real devices, one session each`:`${J[E]}: ${te}`,[se,V]=(0,q.useState)([]),[ce,H]=(0,q.useState)(``),[U,le]=(0,q.useState)(!1),de=()=>void Y.flows().then(e=>V(e.flows),()=>{});(0,q.useEffect)(de,[]);let W=e=>{H(``),a(e),s(t=>Math.max(t,e)),window.scrollTo({top:0})},G=w.map(e=>e.trim()).filter(Boolean),K=/^(https?:\/\/)?[^\s/]+\.[^\s]+|^https?:\/\/(localhost|127\.0\.0\.1)/i.test(l.trim()),pe=async()=>{le(!0),H(``);let e={url:l.trim(),devices:z,prompt:p.trim(),attachments:g,source:v,checks:S,custom:G,...E===`local`?{}:R?{on:E,real:!0}:{on:E,browser:k}};try{He({...R?{}:{devices:d},address:l.trim(),checks:S,on:E,browser:k,kind:M}),t((await Y.start(e)).id)}catch(e){H(e.message),le(!1)}};return(0,X.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-6`,children:[(0,X.jsx)(Ie,{steps:Le,at:i,reached:o,onGo:e=>!U&&W(e)}),(0,X.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] items-start gap-6 @5xl:grid-cols-[minmax(0,1fr)_280px]`,children:[(0,X.jsxs)(`section`,{"aria-labelledby":`rp-step`,className:`flex min-w-0 flex-col gap-6`,children:[(0,X.jsx)(`h2`,{id:`rp-step`,className:`m-0 text-[20px] font-semibold tracking-[-0.01em]`,children:[`Which page, on which devices?`,`What should ForgeQE do?`,`What should be checked?`,`Check and start`][i]}),ce&&(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:ce}),i===0&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(Ue,{id:`rp-url`,label:`Page address`,help:e.start&&l.trim()===e.start?`The active environment's web app, from env.yaml.`:`An http or https address; sign in on the page itself.`,children:(0,X.jsx)(j,{id:`rp-url`,type:`url`,value:l,placeholder:`https://your-app.example.com`,spellCheck:!1,onChange:e=>u(e.target.value)})}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`span`,{id:`rp-on`,className:`text-sm font-medium`,children:`Run on`}),(0,X.jsx)(ue,{labelledBy:`rp-on`,value:E,onChange:O,options:[{id:`local`,label:`This computer`,tip:`ForgeQE's own browser, in the background`},...[`browserstack`,`testmu`].map(t=>({id:t,label:J[t],disabled:!e.clouds[t]?.ready,tip:e.clouds[t]?.ready?`A real browser on ${J[t]}: one session for every device`:`Not signed in: ${e.clouds[t]?.missing??`no sign-in`}. Save it in Settings › Secrets.`}))]}),E!==`local`&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 pt-2`,children:[(0,X.jsxs)(`span`,{id:`rp-kind`,className:`text-sm font-medium`,children:[`Devices on `,J[E]]}),(0,X.jsx)(ue,{labelledBy:`rp-kind`,value:M,onChange:ne,options:[{id:`real`,label:`Real devices`,tip:`Phones and tablets ${J[E]} lists now, each its own session`},{id:`browser`,label:`Emulated in a browser`,tip:`The device list emulated in one desktop browser on the cloud`}]})]}),E!==`local`&&!R&&(0,X.jsxs)(`div`,{className:`flex flex-col gap-2 pt-2`,children:[(0,X.jsxs)(`label`,{htmlFor:`rp-browser`,className:`text-sm font-medium`,children:[`Browser on `,J[E]]}),(0,X.jsx)(ee,{id:`rp-browser`,value:k,onChange:e=>A(e.target.value),className:`max-w-[360px]`,children:e.browsers.map(e=>(0,X.jsx)(`option`,{value:e.id,children:e.label},e.id))}),(0,X.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`One `,J[E],` session for the whole run, each device in its own window of it. It takes longer to start than this computer, and counts against your `,J[E],` plan. A page on this computer or your own network cannot be reached from there.`]})]})]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium`,children:`Devices`}),R?I?(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:I}):P?.cloud===E?(0,X.jsx)(ge,{devices:ae,picked:L,max:P.max,onChange:ie,real:J[E]}):(0,X.jsxs)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:[`Asking `,J[E],` for its devices…`]}):(0,X.jsx)(ge,{devices:e.devices,picked:d,max:e.maxPanes,onChange:f,...E===`local`?{}:{drawnBy:`${te} on ${J[E]}`}})]}),(0,X.jsx)(We,{busy:U,next:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(x,{"aria-hidden":`true`}),`Continue`]}),onNext:()=>W(1),disabled:!K||!z.length,aside:K?void 0:(0,X.jsx)(`span`,{className:`text-muted`,children:`Enter the page's address.`})})]}),i===1&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:[`ForgeQE reads your prompt as steps and does each on every device in its own browser in the background, planned for each layout from what its screen shows (a phone's menu is often behind a button). After every step it checks every device and keeps a screenshot of each. What the prompt asks to verify becomes a check. It goes on if you leave the page.`,e.planner?``:` No model is set up, so the prompt is read line by line and only plain steps work (click …, scroll down, go back, press Enter).`]}),(0,X.jsx)(Xe,{prompt:p,setPrompt:m,files:g,setFiles:_,source:v,setSource:y,flows:se,onFlowsChanged:de,onError:H}),(0,X.jsx)(We,{busy:U,onBack:()=>W(0),next:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(x,{"aria-hidden":`true`}),`Continue`]}),onNext:()=>W(2),disabled:!p.trim(),aside:p.trim()?void 0:(0,X.jsx)(`span`,{className:`text-muted`,children:`Say what to do.`})})]}),i===2&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`fieldset`,{className:`m-0 flex flex-col gap-2 border-0 p-0`,children:[(0,X.jsx)(`legend`,{className:`mb-2 p-0 text-sm font-medium`,children:`Checked by ForgeQE on every device`}),e.checks.map(e=>(0,X.jsxs)(`label`,{className:`flex cursor-pointer items-start gap-2 rounded-[8px] px-2 py-1 hover:bg-surface-muted`,children:[(0,X.jsx)(fe,{className:`mt-1`,checked:S.includes(e.id),onCheckedChange:t=>C(t?[...S,e.id]:S.filter(t=>t!==e.id))}),(0,X.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,X.jsx)(`span`,{className:`text-sm`,children:e.label}),(0,X.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.about})]})]},e.id))]}),(0,X.jsxs)(`div`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`span`,{className:`text-sm font-medium`,children:`Your own checks`}),(0,X.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`In plain words, judged on each layout from what its screen shows; a finding always quotes the screen.`,e.planner?``:` No model is set up, so these are not judged.`]}),w.map((e,t)=>(0,X.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,X.jsx)(j,{"aria-label":`Your check ${t+1}`,value:e,maxLength:300,placeholder:`The cart total shows without scrolling`,onChange:e=>T(w.map((n,r)=>r===t?e.target.value:n)),className:`min-w-0 flex-1`}),(0,X.jsx)(N,{variant:`icon`,size:`icon`,"aria-label":`Remove your check ${t+1}`,"data-tip":`Remove`,onClick:()=>T(w.filter((e,n)=>n!==t)),children:(0,X.jsx)(h,{"aria-hidden":`true`})})]},t)),(0,X.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,X.jsxs)(`button`,{type:`button`,className:Ge,disabled:w.length>=Re,onClick:()=>T([...w,``]),children:[(0,X.jsx)(c,{size:13,"aria-hidden":`true`}),`Add a check`]}),ze.map(e=>(0,X.jsxs)(`button`,{type:`button`,className:Ge,disabled:w.includes(e)||w.length>=Re,onClick:()=>T([...w.filter(e=>e.trim()),e]),children:[(0,X.jsx)(c,{size:13,"aria-hidden":`true`}),e]},e))]})]}),(0,X.jsx)(We,{busy:U,onBack:()=>W(1),next:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(x,{"aria-hidden":`true`}),`Continue`]}),onNext:()=>W(3),aside:!S.length&&!G.length?(0,X.jsx)(`span`,{className:`text-muted`,children:`Only what your prompt asks to verify will be checked.`}):void 0})]}),i===3&&(0,X.jsxs)(X.Fragment,{children:[(0,X.jsxs)(`dl`,{className:`m-0 grid grid-cols-[minmax(0,1fr)] gap-4 @xl:grid-cols-[160px_minmax(0,1fr)]`,children:[(0,X.jsx)(`dt`,{className:`text-[13px] font-medium text-muted`,children:`Page`}),(0,X.jsx)(`dd`,{className:`m-0 text-sm [overflow-wrap:anywhere]`,children:l.trim()}),(0,X.jsx)(`dt`,{className:`text-[13px] font-medium text-muted`,children:`Devices`}),(0,X.jsx)(`dd`,{className:`m-0 text-sm`,children:oe.join(`, `)}),(0,X.jsx)(`dt`,{className:`text-[13px] font-medium text-muted`,children:`Runs on`}),(0,X.jsx)(`dd`,{className:`m-0 text-sm`,children:B}),(0,X.jsx)(`dt`,{className:`text-[13px] font-medium text-muted`,children:`What to do`}),(0,X.jsx)(`dd`,{className:`m-0 text-sm`,children:(0,X.jsxs)(`span`,{className:`flex flex-col gap-2`,children:[(0,X.jsx)(`span`,{className:`rounded-[12px] bg-surface-muted px-4 py-2 whitespace-pre-wrap [overflow-wrap:anywhere]`,children:p.trim()}),g.length>0&&(0,X.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[`Attached: `,g.map(e=>e.name).join(`, `)]}),(0,X.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Read as steps and checks when the run starts; the run's page shows how.`})]})}),(0,X.jsx)(`dt`,{className:`text-[13px] font-medium text-muted`,children:`Checks`}),(0,X.jsxs)(`dd`,{className:`m-0 flex flex-col gap-1 text-sm`,children:[S.map(t=>(0,X.jsx)(`span`,{children:e.checks.find(e=>e.id===t)?.label},t)),G.map(t=>(0,X.jsxs)(`span`,{className:D(!e.planner&&`text-muted`),children:[`“`,t,`”`,e.planner?``:` (not judged: no model)`]},t))]})]}),(0,X.jsx)(We,{busy:U,onBack:()=>W(2),next:(0,X.jsxs)(X.Fragment,{children:[(0,X.jsx)(b,{"aria-hidden":`true`}),U?`Starting…`:`Start`]}),onNext:()=>void pe(),aside:(0,X.jsx)(`span`,{className:`text-muted`,children:`Opens in ForgeQE's own browser on this computer; screenshots and findings are kept with the run.`})})]})]}),(0,X.jsx)(`div`,{className:`@5xl:sticky @5xl:top-6`,children:(0,X.jsx)(Ze,{info:e,url:l,named:oe,where:B,prompt:p,files:g.length,checks:S,custom:w})})]})]})}function $e({tab:e,wide:t,action:n,children:r}){let i=T(`responsive`);return(0,X.jsx)(U,{title:re(`responsive`),page:i,label:`Responsive`,current:e,onPick:e=>location.hash=e===`agent`?w(`responsive`):w(`responsive`,`runs`),tabs:[{id:`runs`,label:`Runs`}],below:(0,X.jsx)(le,{page:i}),...t?{wide:t}:{},...n?{end:n}:{},children:r})}function et({sub:e}){let[t,n]=(0,q.useState)(null),[r,i]=(0,q.useState)(null),[a,o]=(0,q.useState)(``),s=(0,q.useCallback)(()=>{Promise.all([Y.info(),Y.runs()]).then(([e,t])=>{n(e),i(t.runs),o(``)},e=>o(e.message))},[]);(0,q.useEffect)(s,[s,e]);let l=!!r?.some(e=>e.status===`running`);(0,q.useEffect)(()=>{if(!l||e!==`runs`)return;let t=ae(s,3e3);return()=>ie(t)},[l,e,s]);let u=()=>location.hash=w(`responsive`,`new`),d=a&&(0,X.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:a}),f=!t&&!a&&(0,X.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`});if(e===`new`)return(0,X.jsxs)($e,{tab:`runs`,children:[d,f,t&&(0,X.jsx)(Qe,{info:t,onStarted:e=>location.hash=w(`responsive`,e)})]});if(e&&me.test(e))return(0,X.jsxs)($e,{tab:`runs`,wide:!0,children:[d,f,(0,X.jsx)(Fe,{id:e},e)]});if(e!==`runs`)return(0,X.jsx)($e,{tab:de});let m=r?.find(e=>e.status===`running`);return(0,X.jsxs)($e,{tab:`runs`,action:r&&!r.length?void 0:(0,X.jsxs)(N,{variant:`primary`,disabled:!t||!!m,onClick:u,"data-tip":m?`A run is going: finish or stop it first`:`New run`,children:[(0,X.jsx)(c,{"aria-hidden":`true`}),`New`]}),children:[d,f,t&&r&&(r.length?(0,X.jsx)(xe,{rows:r}):(0,X.jsx)(F,{icon:p,title:`No runs yet`,action:(0,X.jsxs)(N,{size:`sm`,onClick:u,"data-tip":`New run`,children:[(0,X.jsx)(c,{"aria-hidden":`true`}),`New`]}),children:`Pick a page and the phones, tablets and desktops to show it on, say in a prompt what to do (or start from a test case or a saved prompt), and say what to check. The run goes on by itself, and each device is checked after every step, with a screenshot of each.`}))]})}export{et as Responsive};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{E as t,Lr as n,M as r,P as i,R as a,br as o,fn as s,pt as c}from"./line-icons-rdF8DYDJ.js";import{n as l,r as u}from"./route-BloYJWgw.js";import{t as d}from"./jsx-runtime-LKYXHABd.js";import{A as f,Ot as p,Z as m,a as h,n as g}from"./input-CtzK50ZF.js";import{d as _,f as v,o as y,t as b}from"./filters-CnAMr286.js";import{$ as x}from"./palette-DAaGSao7.js";import{Gt as S,H as C,J as w,Pn as T,Sn as E,U as D,g as O}from"./index-B3JsM7tv.js";import{n as k}from"./families-BBFFrUlo.js";import{_ as A,o as j}from"./qualityParts-BLkmIfDY.js";var M=e(n(),1),N=d(),P={server:{label:`The server answered differently`,hint:`A call returned another status: likely a product or backend change, not the test. File it as a defect if the first run was right.`},locator:{label:`An element was not found`,hint:`The page likely changed under the test. If the change was intended, heal the test; if not, it is a product bug.`},navigation:{label:`It reached another page`,hint:`A redirect, a sign-in, a feature flag or the environment's settings may differ between the runs.`},path:{label:`It took another path`,hint:`The run did something else here: the flow changed, or the agent found another way through it.`},data:{label:`Same step, another outcome`,hint:`The step was the same but ended otherwise: the test data, the account or what the page held likely differs.`},timing:{label:`Only the timing differs`,hint:`A slow environment, or a wait that races the page: a likely cause of flaky failures.`},errors:{label:`New browser errors`,hint:`The page raised errors in the second run that it did not in the first.`},missing:{label:`A step only one run did`,hint:`One run has a step the other does not: a dialog, a retry or a changed flow.`}},F=e=>`${(e/1e3).toFixed(1)}s`,I=e=>`${e.goal.slice(0,80)} · ${e.status} · ${O(e.at)}`;function L(e,t){let n=e.find(e=>e.id===t),r=e.filter(e=>e.id!==t);if(!n)return{same:[],other:r};let i=n.goal.trim().toLowerCase();return{same:r.filter(e=>e.goal.trim().toLowerCase()===i),other:r.filter(e=>e.goal.trim().toLowerCase()!==i)}}function R({run:e,step:t}){let[n,r]=(0,M.useState)(``),[i,a]=(0,M.useState)(!1);return(0,M.useEffect)(()=>{let n=!1;return r(``),a(!1),t?.shot&&p.shot(e,t.n,t.shot).then(e=>!n&&r(e),()=>!n&&a(!0)),()=>{n=!0}},[e,t?.n,t?.shot]),t?!t.shot||i?(0,N.jsx)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-6 text-center text-[13px] text-muted`,children:`No screenshot`}):n?(0,N.jsx)(`img`,{src:n,alt:`Step ${t.n} of ${e}`,className:`max-h-[420px] w-full rounded-[12px] border border-line-soft object-contain object-top`}):(0,N.jsx)(`div`,{className:`min-h-24 rounded-[12px] bg-surface-muted`}):(0,N.jsx)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-6 text-center text-[13px] text-muted`,children:`Not in this run`})}function z({step:e,other:t}){if(!e)return(0,N.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Not in this run`});let n=e.ok?r:a,i=new Set((t?.calls??[]).map(e=>`${e.method} ${e.path} ${e.status}`)),o=t?e.calls.filter(e=>!i.has(`${e.method} ${e.path} ${e.status}`)):[];return(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,N.jsxs)(`span`,{className:`flex min-w-0 items-start gap-2`,children:[(0,N.jsx)(n,{size:14,"aria-label":e.ok?`Passed`:`Failed`,className:f(`mt-1 flex-none`,e.ok?`text-pass`:`text-fail`)}),(0,N.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:e.action||`–`})]}),(0,N.jsxs)(`span`,{className:`truncate text-[13px] text-muted`,"data-tip":e.title?`${e.title} · ${e.page}`:e.page,children:[e.page,typeof e.ms==`number`?` · ${F(e.ms)}`:``]}),e.error&&(0,N.jsx)(`span`,{className:`text-[13px] text-fail [overflow-wrap:anywhere]`,children:e.error}),o.slice(0,3).map(e=>(0,N.jsxs)(`span`,{className:f(`truncate font-mono text-[13px]`,e.status>=400||e.failed?`text-fail`:`text-muted`),"data-tip":`${e.method} ${e.path}`,children:[e.method,` `,e.path,` `,e.failed?`no answer`:e.status]},`${e.method} ${e.path}`)),e.problems.slice(0,2).map(e=>(0,N.jsx)(`span`,{className:`truncate text-[13px] text-warn`,"data-tip":e,children:e},e))]})}function B({row:e,i:n,a:r,b:i,focus:a,open:o,onToggle:s}){let c=e.a?.n,l=e.b?.n;return(0,N.jsxs)(`li`,{id:a?`look-here`:void 0,className:f(`border-t border-line-soft`,!e.same&&`bg-warn-soft/40`,a&&`outline-2 -outline-offset-2 outline-warn`),children:[(0,N.jsxs)(`div`,{className:`grid grid-cols-[2.5rem_minmax(0,1fr)_minmax(0,1fr)_2.5rem] items-start gap-4 px-4 py-2 text-[13px]`,children:[(0,N.jsx)(`span`,{className:`pt-1 text-muted tabular-nums`,"data-tip":c!==void 0&&l!==void 0&&c!==l?`Step ${c} of the first run, ${l} of the second`:void 0,children:c!==void 0&&l!==void 0&&c!==l?`${c}·${l}`:c??l??n+1}),(0,N.jsx)(z,{step:e.a,other:e.b}),(0,N.jsx)(z,{step:e.b,other:e.a}),(0,N.jsx)(_,{variant:`icon`,size:`icon-sm`,"aria-label":o?`Hide screenshots`:`Show screenshots`,"aria-expanded":o,onClick:s,"data-tip":o?`Hide screenshots`:`Show screenshots`,children:(0,N.jsx)(t,{"aria-hidden":`true`,className:f(`transition-transform`,o&&`rotate-180`)})})]}),!e.same&&(0,N.jsxs)(`div`,{className:`flex flex-col gap-1 px-4 pb-2 pl-[3.75rem] text-[13px] text-ink-2`,children:[a&&e.kind&&(0,N.jsxs)(`span`,{className:`font-medium text-warn`,children:[`Look here first: `,P[e.kind].label]}),e.differences.map(e=>(0,N.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e},e))]}),(0,N.jsx)(T,{open:o,children:(0,N.jsxs)(`div`,{className:`grid grid-cols-1 items-start gap-4 px-4 pb-4 @2xl:grid-cols-2`,children:[(0,N.jsx)(R,{run:r,step:e.a}),(0,N.jsx)(R,{run:i,step:e.b})]})})]})}function V({runs:e,a:t,b:n}){let[r,i]=(0,M.useState)(t??``),[a,o]=(0,M.useState)(n??``);(0,M.useEffect)(()=>{i(t??``),o(n??``)},[t,n]);let{same:s,other:l}=L(e,r);return(0,N.jsxs)(`form`,{className:`flex flex-wrap items-end gap-2`,onSubmit:e=>{e.preventDefault(),r&&a&&r!==a&&(location.hash=u(`run-diff`,`${encodeURIComponent(r)}~${encodeURIComponent(a)}`))},children:[(0,N.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1 text-[13px] font-medium`,children:[`First run (as expected)`,(0,N.jsxs)(g,{size:`sm`,value:r,onChange:e=>i(e.target.value),children:[(0,N.jsx)(`option`,{value:``,children:`Pick a run`}),e.map(e=>(0,N.jsx)(`option`,{value:e.id,children:I(e)},e.id))]})]}),(0,N.jsxs)(`label`,{className:`flex min-w-0 flex-[1_1_280px] flex-col gap-1 text-[13px] font-medium`,children:[`Second run`,(0,N.jsxs)(g,{size:`sm`,value:a,onChange:e=>o(e.target.value),disabled:!r,children:[(0,N.jsx)(`option`,{value:``,children:r?`Pick a run to compare`:`Pick the first run`}),s.length>0&&(0,N.jsx)(`optgroup`,{label:`Same test`,children:s.map(e=>(0,N.jsx)(`option`,{value:e.id,children:I(e)},e.id))}),(0,N.jsx)(`optgroup`,{label:s.length?`Other runs`:`Runs`,children:l.map(e=>(0,N.jsx)(`option`,{value:e.id,children:I(e)},e.id))})]})]}),(0,N.jsxs)(_,{size:`sm`,variant:`primary`,type:`submit`,disabled:!r||!a||r===a,children:[(0,N.jsx)(c,{"aria-hidden":`true`}),`Compare`]})]})}function H({sub:e}){let[t,n]=(0,M.useState)(null),[r,a]=(0,M.useState)(null),[c,d]=(0,M.useState)(``),[g,T]=(0,M.useState)(`all`),[O,I]=(0,M.useState)(new Set),[L,R]=(0,M.useState)(``),[z,H]=(0,M.useMemo)(()=>{let t=(e?l(e):``).split(`~`);return t.length===2&&t[0]&&t[1]?[t[0],t[1]]:[void 0,void 0]},[e]);(0,M.useEffect)(()=>{p.runs().then(e=>n(e.runs),e=>d(e.message))},[]),(0,M.useEffect)(()=>{let e=!1;if(a(null),R(``),z&&H)return p.diff(z,H).then(t=>{e||(a(t),d(``),I(new Set(t.focus===void 0?[]:[t.focus])))},t=>!e&&d(t.message)),()=>{e=!0}},[z,H]);let U=async()=>{if(r)try{let{id:e}=await m.start(`Compare the browser runs ${r.a.id} and ${r.b.id} in the reports folder, step by step (their steps.json, network.json and screenshots). Say where they first differ and whether that is a product bug, a test that needs healing, test data or the environment, and what to do next.`,{});location.hash=u(`chats`,e)}catch(e){R(e.message)}},W=r?.rows??[],G=W.map((e,t)=>({r:e,i:t})).filter(({r:e})=>g===`all`||!e.same),K=e=>e===void 0?void 0:W[e]?.b?.n??W[e]?.a?.n,q=K(r?.first),J=K(r?.focus);return(0,N.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,N.jsx)(w,{}),(0,N.jsxs)(`main`,{className:f(D,`@container flex-auto gap-4`),children:[(0,N.jsx)(C,{}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,N.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,N.jsx)(E,{pixel:x[`run-diff`],size:`lg`}),(0,N.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Run diff`})]}),(0,N.jsx)(S,{label:`Runs and reports`,links:k,current:`run-diff`})]}),(0,N.jsx)(`p`,{className:`m-0 text-[13px] leading-relaxed text-ink-2`,children:`Two browser runs side by side, step by step: a run that passed and one that failed, the same test on two environments or devices, or a test before and after it was healed. Steps are lined up by page and action, and the first one that differs is marked with what it likely means.`}),c&&(0,N.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-[13px] text-fail [overflow-wrap:anywhere]`,children:c}),!t&&!c&&(0,N.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Loading…`}),t&&t.length<2&&(0,N.jsx)(y,{icon:o,title:`Two runs are needed`,action:(0,N.jsxs)(`a`,{className:v({size:`sm`}),href:u(`record`),"data-tip":`Record a flow`,children:[(0,N.jsx)(i,{"aria-hidden":`true`}),`Record`]}),children:`Every browser run keeps its steps in the reports folder. Run a flow from a chat or the Record page twice, or a test case on two environments, and compare them here.`}),t&&t.length>=2&&(0,N.jsx)(V,{runs:t,a:z,b:H}),z&&H&&!r&&!c&&(0,N.jsx)(`p`,{role:`status`,className:`m-0 text-[13px] text-muted`,children:`Comparing…`}),r&&(0,N.jsxs)(`section`,{"aria-label":`Comparison`,className:`flex min-w-0 flex-col gap-4`,children:[(0,N.jsxs)(`div`,{className:`grid grid-cols-2 overflow-hidden border-y border-line-soft @xl:grid-cols-3 @4xl:grid-cols-6 @4xl:divide-x @4xl:divide-line-soft`,children:[(0,N.jsx)(j,{label:`Verdict`,value:r.first===void 0?`Same`:`Differ`,tone:r.first===void 0?`text-pass`:`text-warn`,sub:r.first===void 0?`every step alike`:`from step ${q??`?`}`}),(0,N.jsx)(j,{label:`Steps differing`,value:r.counts.differing,tone:r.counts.differing?`text-warn`:void 0,sub:`of ${W.length} lined up`}),(0,N.jsx)(j,{label:`Steps`,value:`${r.a.steps} · ${r.b.steps}`,sub:`first · second`}),(0,N.jsx)(j,{label:`Time`,value:`${F(r.a.ms)} · ${F(r.b.ms)}`,sub:`first · second`}),(0,N.jsx)(j,{label:`Calls answered otherwise`,value:r.counts.calls,tone:r.counts.calls?`text-fail`:void 0,sub:`steps with a different status`}),(0,N.jsx)(j,{label:`New browser errors`,value:r.counts.errors,tone:r.counts.errors?`text-fail`:void 0,sub:`steps with new errors`})]}),(0,N.jsx)(`div`,{className:`grid grid-cols-1 gap-2 text-[13px] @2xl:grid-cols-2`,children:[r.a,r.b].map((e,t)=>(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,N.jsx)(`span`,{className:`text-[13px] text-muted`,children:t?`Second run`:`First run`}),(0,N.jsx)(`span`,{className:`truncate font-medium`,"data-tip":e.goal,children:e.goal}),(0,N.jsxs)(`span`,{className:`truncate text-[13px] text-muted`,"data-tip":e.startUrl??e.id,children:[e.status,` · `,A(e.at),` · `,e.host??e.id]})]},e.id))}),!r.sameGoal&&(0,N.jsx)(`p`,{className:`m-0 text-[13px] text-warn`,children:`These runs had different goals: they may not be the same test.`}),r.kind&&(0,N.jsxs)(`div`,{className:`flex flex-wrap items-start gap-4 rounded-[12px] bg-warn-soft px-4 py-2 text-[13px]`,children:[(0,N.jsx)(o,{size:16,"aria-hidden":`true`,className:`mt-1 flex-none text-warn`}),(0,N.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_300px] flex-col gap-1`,children:[(0,N.jsxs)(`span`,{className:`font-medium`,children:[`Look at step `,J??`?`,` of the second run: `,P[r.kind].label]}),(0,N.jsx)(`span`,{className:`text-ink-2`,children:P[r.kind].hint}),r.first!==r.focus&&r.first!==void 0&&W[r.first]?.kind&&(0,N.jsxs)(`span`,{className:`text-ink-2`,children:[`They first differ at step `,q,`: `,P[W[r.first].kind].label.toLowerCase(),`.`]})]}),(0,N.jsx)(`a`,{href:`#look-here`,onClick:e=>(e.preventDefault(),document.getElementById(`look-here`)?.scrollIntoView({behavior:h(),block:`center`})),className:`self-center text-[13px]`,children:`Go to it`})]}),(0,N.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,N.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:(0,N.jsx)(b,{items:[{id:`all`,label:`All steps`,n:W.length},{id:`diff`,label:`Only differences`,n:r.counts.differing,alert:!0}],value:g,onChange:T})}),(0,N.jsxs)(_,{size:`sm`,variant:`ghost`,"data-tip":`Ask in a chat`,onClick:()=>void U(),className:`ml-auto`,children:[(0,N.jsx)(s,{"aria-hidden":`true`}),`Chat`]})]}),L&&(0,N.jsx)(`p`,{className:`m-0 text-[13px] text-fail`,children:L}),(0,N.jsxs)(`div`,{className:`overflow-hidden rounded-[10px] border border-line`,children:[(0,N.jsxs)(`div`,{className:`grid grid-cols-[2.5rem_minmax(0,1fr)_minmax(0,1fr)_2.5rem] gap-4 bg-surface-muted px-4 py-2 text-[13px] text-muted`,children:[(0,N.jsx)(`span`,{children:`Step`}),(0,N.jsx)(`span`,{children:`First run`}),(0,N.jsx)(`span`,{children:`Second run`}),(0,N.jsx)(`span`,{className:`sr-only`,children:`Screenshots`})]}),G.length?(0,N.jsx)(`ol`,{className:`m-0 list-none p-0`,children:G.map(({r:e,i:t})=>(0,N.jsx)(B,{row:e,i:t,a:r.a.id,b:r.b.id,focus:t===r.focus,open:O.has(t),onToggle:()=>{let e=new Set(O);e.has(t)?e.delete(t):e.add(t),I(e)}},t))}):(0,N.jsx)(`p`,{className:`m-0 border-t border-line-soft px-4 py-4 text-[13px] text-muted`,children:`Nothing differs.`})]})]})]})]})}export{P as KIND_TEXT,H as RunDiff,L as choicesFor};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{$t as t,At as n,E as r,Ft as i,Gn as a,Ln as o,Lr as s,M as c,N as l,Nr as u,O as d,Pr as f,R as p,W as m,a as ee,b as h,ct as g,fn as _,k as v,on as y,or as b,p as x,pr as S,rr as C,sr as te,st as w,tr as ne,v as re,xt as T,yt as E,zn as ie}from"./line-icons-rdF8DYDJ.js";import{n as ae,r as D}from"./route-BloYJWgw.js";import{f as oe}from"./agents-C0Jg2pN8.js";import{t as se}from"./jsx-runtime-LKYXHABd.js";import{A as O,Z as ce,i as le,j as k,kt as A,n as ue}from"./input-CtzK50ZF.js";import{a as j,d as de,f as fe,i as pe,l as M,n as me,o as he,s as ge,t as _e}from"./filters-CnAMr286.js";import{$ as ve}from"./palette-DAaGSao7.js";import{D as N,Fn as ye,Gt as be,H as xe,In as P,J as Se,Kt as Ce,O as F,Pn as we,Sn as Te,U as Ee,Ut as I,Wt as De,_ as Oe,at as ke,bt as Ae,ct as je,g as Me,k as Ne,xt as L}from"./index-B3JsM7tv.js";import{r as Pe,t as Fe}from"./Response-mhBThq2b.js";import{n as Ie}from"./families-BBFFrUlo.js";var R=e(s(),1),z=se(),B={execution:`Execution`,report:`Report`,coding:`Coding`,chat:`Chat`},Le={execution:T,report:w,coding:m,chat:_};function Re({kind:e}){let t=Le[e];return(0,z.jsx)(M,{icon:t,size:14,className:`flex-none text-muted`})}var ze={passed:{label:`Passed`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},error:{label:`Error`,tone:`fail`},skipped:{label:`Skipped`,tone:`neutral`},stopped:{label:`Stopped`,tone:`neutral`},blocked:{label:`Blocked`,tone:`warn`}},V=e=>ze[e]||{label:e?e.charAt(0).toUpperCase()+e.slice(1).replace(/_/g,` `):`–`,tone:`neutral`},Be={suite:`Suite`,monitor:`Monitor round`,run:`Browser run`,explore:`Exploration`,api:`API run`,desktop:`Desktop run`,mobile:`App run`},Ve=e=>{if(!e)return``;let t=Math.round(e/1e3);return t<60?`${t}s`:`${Math.floor(t/60)}m ${t%60}s`};function H({title:e,icon:t,children:n,aside:r,className:i}){return(0,z.jsxs)(`section`,{className:O(`flex flex-col gap-4 border-t border-line-soft pt-6`,i),children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsxs)(`h3`,{className:`m-0 flex flex-1 items-center gap-2 text-base font-semibold`,children:[(0,z.jsx)(`span`,{className:`text-accent-fg`,children:t}),e]}),r]}),n]})}function He({path:e,label:t=`Report`}){let[n,r]=(0,R.useState)(``);return(0,z.jsxs)(`span`,{className:`inline-flex flex-wrap items-center gap-2`,children:[(0,z.jsxs)(de,{"data-tip":`Open the report`,onClick:async()=>r(await ge(e)),children:[(0,z.jsx)(g,{"aria-hidden":`true`}),t]}),n&&(0,z.jsx)(`span`,{className:`text-[13px] text-fail`,children:n})]})}function U({items:e,first:t,render:n}){let[i,a]=(0,R.useState)(!1);return(0,z.jsxs)(z.Fragment,{children:[(i?e:e.slice(0,t)).map(n),e.length>t&&(0,z.jsxs)(`button`,{type:`button`,"aria-expanded":i,onClick:()=>a(!i),className:`inline-flex min-h-8 cursor-pointer items-center gap-1 self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:[i?(0,z.jsx)(v,{size:14,"aria-hidden":`true`}):(0,z.jsx)(r,{size:14,"aria-hidden":`true`}),i?`Less`:`All (${e.length})`]})]})}function Ue({c:e}){if(!e.total)return null;let t=t=>`${t/e.total*100}%`;return(0,z.jsxs)(`div`,{role:`img`,"aria-label":`${e.passed} passed, ${e.failed} failed, ${e.other} other, of ${e.total}`,className:`flex h-2 overflow-hidden rounded-full bg-surface-strong`,children:[(0,z.jsx)(`div`,{className:`bg-pass transition-[width] duration-200 ease-out`,style:{width:t(e.passed)}}),(0,z.jsx)(`div`,{className:`bg-fail transition-[width] duration-200 ease-out`,style:{width:t(e.failed)}}),(0,z.jsx)(`div`,{className:`bg-warn transition-[width] duration-200 ease-out`,style:{width:t(e.other)}})]})}function We({e}){let t=e.counts.total?Math.round(e.counts.passed/e.counts.total*100):0;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-line-soft pt-4 first:border-t-0 first:pt-0`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,children:[(0,z.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,z.jsx)(`span`,{className:`text-[13px] text-muted`,children:[Be[e.scope]||e.scope,Ve(e.ms),e.tokens?`${L(e.tokens)} tokens`:``,e.stopped?`stopped early`:``].filter(Boolean).join(` · `)})]}),e.report&&(0,z.jsx)(He,{path:e.report})]}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,z.jsxs)(`span`,{className:`text-[20px] font-semibold tabular-nums`,children:[t,`%`]}),(0,z.jsx)(`span`,{className:`text-muted`,children:`passed`}),(0,z.jsxs)(j,{tone:`pass`,children:[e.counts.passed,` passed`]}),e.counts.failed>0&&(0,z.jsxs)(j,{tone:`fail`,children:[e.counts.failed,` failed`]}),e.counts.other>0&&(0,z.jsxs)(j,{tone:`warn`,children:[e.counts.other,` other`]}),(0,z.jsxs)(`span`,{className:`text-muted`,children:[`of `,e.counts.total]})]}),(0,z.jsx)(Ue,{c:e.counts}),e.cases.length>0&&(0,z.jsx)(`ul`,{"aria-label":`Cases of ${e.title}`,className:`m-0 flex list-none flex-col p-0`,children:(0,z.jsx)(U,{items:e.cases.toSorted((e,t)=>Number(V(t.status).tone===`fail`)-Number(V(e.status).tone===`fail`)),first:6,render:(e,t)=>(0,z.jsxs)(`li`,{className:`flex min-w-0 items-start gap-4 border-t border-line-soft py-2 text-sm`,children:[(0,z.jsx)(`span`,{className:`w-[76px] flex-none`,children:(0,z.jsx)(j,{tone:V(e.status).tone,children:V(e.status).label})}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-1 flex-col gap-1`,children:[(0,z.jsxs)(`span`,{className:`[overflow-wrap:anywhere]`,children:[e.id&&(0,z.jsx)(`span`,{className:`mr-2 font-mono text-[13px] text-muted`,children:e.id}),e.title,e.device&&(0,z.jsxs)(`span`,{className:`text-muted`,children:[` · `,e.device]})]}),e.summary&&(0,z.jsx)(`span`,{className:`line-clamp-2 text-[13px] text-muted`,children:e.summary})]}),(0,z.jsx)(`span`,{className:`flex-none text-[13px] text-muted tabular-nums`,children:Ve(e.ms)})]},`${e.id}-${t}`)})}),e.folder&&!e.report&&(0,z.jsxs)(`span`,{className:`text-sm`,children:[`Kept in `,(0,z.jsx)(N,{path:e.folder})]})]})}function Ge({list:e,className:t}){let n=e.reduce((e,t)=>({total:e.total+t.counts.total,passed:e.passed+t.counts.passed,failed:e.failed+t.counts.failed}),{total:0,passed:0,failed:0});return(0,z.jsx)(H,{...t?{className:t}:{},title:`Execution summary`,icon:(0,z.jsx)(M,{icon:T,size:18}),aside:e.length>1?(0,z.jsxs)(`span`,{className:`text-sm text-muted`,children:[k(e.length,`run`),` · `,n.passed,` of `,n.total,` passed`]}):void 0,children:e.length?e.map((e,t)=>(0,z.jsx)(We,{e},`${e.folder||e.title}-${t}`)):(0,z.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No results found for this run yet: they appear once its report is written.`})})}function Ke({list:e,className:t}){return(0,z.jsxs)(H,{...t?{className:t}:{},title:`Report summary`,icon:(0,z.jsx)(M,{icon:w,size:18}),children:[e.length===0&&(0,z.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No report was written in this run.`}),e.map((e,t)=>(0,z.jsxs)(`div`,{className:`flex flex-col gap-4 border-t border-line-soft pt-4 first:border-t-0 first:pt-0`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-2`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_240px] flex-col gap-1`,children:[(0,z.jsx)(`span`,{className:`font-medium [overflow-wrap:anywhere]`,children:e.title}),(0,z.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.builtAt?`Written ${new Date(e.builtAt).toLocaleString([],{dateStyle:`medium`,timeStyle:`short`})}`:e.path?``:`Its page is not there any more`})]}),e.path&&(0,z.jsx)(He,{path:e.path})]}),e.stats&&(0,z.jsx)(`dl`,{className:`m-0 grid grid-cols-[repeat(auto-fit,minmax(110px,1fr))] gap-2`,children:e.stats.map(e=>(0,z.jsxs)(`div`,{className:`rounded-[10px] bg-surface-muted px-4 py-2`,children:[(0,z.jsx)(`dt`,{className:`text-[13px] text-muted`,children:e.label}),(0,z.jsx)(`dd`,{className:`m-0 text-[20px] font-semibold tabular-nums`,children:e.value})]},e.label))}),e.markdown&&(0,z.jsx)(qe,{text:e.markdown})]},`${e.path||e.title}-${t}`))]})}function qe({text:e,height:t=220}){let[n,i]=(0,R.useState)(!1),[a,o]=(0,R.useState)(!0),[s,c]=(0,R.useState)(t),l=(0,R.useRef)(null);return(0,R.useLayoutEffect)(()=>{l.current&&!n&&o(l.current.scrollHeight>t+8)},[e,t,n]),(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`div`,{ref:l,style:s===void 0?void 0:{maxHeight:s},onTransitionEnd:e=>e.target===e.currentTarget&&n&&c(void 0),className:O(`transition-[max-height] duration-200 ease-out`,s!==void 0&&`relative overflow-hidden`),children:[(0,z.jsx)(F,{text:e,className:O(`text-sm`,Ne)}),!n&&a&&(0,z.jsx)(`div`,{className:`pointer-events-none absolute inset-x-0 bottom-0 h-12 bg-gradient-to-t from-bg to-transparent`})]}),(n||a)&&(0,z.jsxs)(`button`,{type:`button`,"aria-expanded":n,onClick:()=>{let e=l.current?.scrollHeight??t;if(i(!n),le())return c(n?t:void 0);c(e),n&&requestAnimationFrame(()=>requestAnimationFrame(()=>c(t)))},className:`inline-flex min-h-8 cursor-pointer items-center gap-1 self-start border-0 bg-transparent px-0 text-[13px] font-medium text-accent-fg hover:underline`,children:[n?(0,z.jsx)(v,{size:14,"aria-hidden":`true`}):(0,z.jsx)(r,{size:14,"aria-hidden":`true`}),n?`Less`:`More`]})]})}function Je(e){let t=e.join(`
|
|
2
|
+
`),n=Math.max(2,...(t.match(/`+/g)||[]).map(e=>e.length)),r="`".repeat(n+1);return`${r}diff\n${t}\n${r}`}function Ye({e}){let[t,n]=(0,R.useState)(!1),r=e.action===`write`?`New`:`Edited`;return(0,z.jsxs)(`li`,{className:`border-t border-line-soft`,children:[(0,z.jsxs)(`div`,{className:`flex min-h-[44px] min-w-0 items-center gap-2 py-2 text-sm`,children:[(0,z.jsx)(`button`,{type:`button`,"aria-expanded":t,"aria-label":`${t?`Hide`:`Show`} the diff of ${e.path}`,"data-tip":`${t?`Hide`:`Show`} the diff of ${e.path}`,disabled:!e.diffs.length,onClick:()=>n(!t),className:`inline-flex size-8 flex-none cursor-pointer items-center justify-center rounded-lg border-0 bg-transparent text-muted hover:bg-surface-strong disabled:cursor-default disabled:opacity-40`,children:(0,z.jsx)(d,{size:16,"aria-hidden":`true`,className:O(`transition-transform duration-200`,t&&`rotate-90`)})}),(0,z.jsx)(`span`,{className:`w-[52px] flex-none text-[13px] text-muted`,children:r}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,z.jsx)(N,{path:e.path})}),(0,z.jsxs)(`span`,{className:`flex-none font-mono text-[13px] tabular-nums`,children:[(0,z.jsxs)(`span`,{className:`text-pass`,children:[`+`,e.added]}),` `,(0,z.jsxs)(`span`,{className:`text-fail`,children:[`−`,e.removed]})]})]}),(0,z.jsx)(we,{open:t,className:`pb-4 pl-10 [&_pre]:max-h-[420px] [&_pre]:overflow-auto`,children:e.diffs.length?(0,z.jsx)(F,{text:Je(e.diffs),className:Ne}):null})]})}var Xe={write:`New`,edit:`Edited`,delete:`Deleted`,"test written":`Test`};function W({label:e,children:t}){return(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(`dt`,{className:`pt-1 text-[13px] text-muted`,children:e}),(0,z.jsx)(`dd`,{className:`m-0 min-w-0 text-sm [overflow-wrap:anywhere]`,children:t})]})}function Ze({c:e,files:t,className:n}){let r=e.edits.reduce((e,t)=>e+t.added,0),i=e.edits.reduce((e,t)=>e+t.removed,0),a=e.tests.filter(e=>!e.ok).length,o=e.reviews.at(-1),s=e.edits.length?[]:t.filter(e=>e.action&&e.action!==`read`);return(0,z.jsxs)(H,{...n?{className:n}:{},title:`Code changes`,icon:(0,z.jsx)(M,{icon:m,size:18}),aside:e.edits.length?(0,z.jsxs)(`span`,{className:`font-mono text-[13px] tabular-nums`,children:[k(e.edits.length,`file`),` · `,(0,z.jsxs)(`span`,{className:`text-pass`,children:[`+`,r]}),` `,(0,z.jsxs)(`span`,{className:`text-fail`,children:[`−`,i]})]}):s.length?(0,z.jsx)(`span`,{className:`text-[13px] text-muted`,children:k(s.length,`file`)}):void 0,children:[e.results.map((t,n)=>{let r=t.status===`passed`||t.status===`done`,i=t.status===`error`||t.status===`failed`;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-4 border-b border-line-soft pb-4 last:border-b-0 last:pb-0`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1`,children:[(0,z.jsx)(T,{size:17,strokeWidth:2,"aria-hidden":`true`,className:r?`text-pass`:i?`text-fail`:`text-warn`}),(0,z.jsx)(`span`,{className:`text-[16px] font-semibold`,children:r?`Test written`:i?`Test not finished`:V(t.status).label}),(0,z.jsx)(j,{tone:r?`pass`:i?`fail`:`warn`,children:V(t.status).label}),e.tests.length>0&&(0,z.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[k(e.tests.length,`test run`),a?` (${a} failed)`:``,e.reviews.length?` · ${k(e.reviews.length,`review`)}`:``]})]}),(0,z.jsxs)(`dl`,{className:`m-0 grid grid-cols-1 gap-x-6 gap-y-1 sm:grid-cols-[110px_minmax(0,1fr)] sm:gap-y-4`,children:[t.testFile&&(0,z.jsx)(W,{label:`Test`,children:(0,z.jsx)(N,{path:t.testFile})}),t.command&&(0,z.jsx)(W,{label:`Run it`,children:(0,z.jsx)(Pe,{text:t.command})}),(t.review||o)&&(0,z.jsx)(W,{label:`Review`,children:(0,z.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,z.jsx)(`span`,{children:(0,z.jsx)(j,{tone:(t.review??o).approved?`pass`:`warn`,children:(t.review??o).approved?`Approved`:`Changes asked`})}),(t.review?.summary||o?.summary)&&(0,z.jsx)(`span`,{className:`text-ink-2`,children:t.review?.summary||o?.summary})]})}),t.notes&&(0,z.jsx)(W,{label:`Notes`,children:(0,z.jsx)(F,{text:t.notes,className:O(`text-sm text-ink-2 [&_p]:my-0 [&_p+p]:mt-2`,`[&_p]:max-w-none [&_ul]:max-w-none [&_ol]:max-w-none [&_blockquote]:max-w-none [&_h1]:max-w-none [&_h2]:max-w-none [&_h3]:max-w-none [&_h4]:max-w-none [&_h5]:max-w-none [&_h6]:max-w-none`)})})]}),t.error&&(0,z.jsx)(`p`,{className:`m-0 rounded-[10px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:t.error})]},n)}),e.edits.length>0&&(0,z.jsxs)(`div`,{className:`flex flex-col`,children:[(0,z.jsx)(`h4`,{className:`m-0 text-[13px] font-medium text-muted`,children:`Files changed`}),(0,z.jsx)(`ul`,{"aria-label":`Files changed`,className:`m-0 flex list-none flex-col p-0`,children:(0,z.jsx)(U,{items:e.edits,first:8,render:e=>(0,z.jsx)(Ye,{e},e.path)})})]}),s.length>0&&(0,z.jsxs)(`div`,{className:`flex flex-col gap-1`,children:[(0,z.jsx)(`h4`,{className:`m-0 text-[13px] font-medium text-muted`,children:`Files changed`}),(0,z.jsx)(`ul`,{"aria-label":`Files changed`,className:`m-0 flex list-none flex-col p-0`,children:s.map(e=>(0,z.jsxs)(`li`,{className:`flex min-h-9 min-w-0 items-center gap-4 border-t border-line-soft text-sm first:border-t-0`,children:[(0,z.jsx)(`span`,{className:`w-[52px] flex-none text-[13px] text-muted`,children:Xe[e.action]||e.action.charAt(0).toUpperCase()+e.action.slice(1)}),(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:(0,z.jsx)(N,{path:e.path})})]},e.path))}),(0,z.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`Their diffs were not kept for this run.`})]}),!e.edits.length&&!s.length&&!e.results.length&&(0,z.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`No files changed.`}),e.edits.some(e=>!e.diffs.length)&&(0,z.jsx)(`p`,{className:`m-0 text-[13px] text-muted`,children:`A file without a diff was changed before ForgeQE kept diffs, or is a hidden or credential file, whose text is not kept.`})]})}function Qe({final:e,answer:t,className:n}){let r=e.from===`agent`?t?.files??[]:[],i=e.from!==`agent`,a=Math.max(2,...(e.text.match(/`+/g)||[]).map(e=>e.length)),o="`".repeat(a+1);return(0,z.jsxs)(H,{...n?{className:n}:{},title:`Final message`,icon:(0,z.jsx)(E,{size:18,"aria-hidden":`true`}),aside:(0,z.jsx)(`span`,{className:`text-[13px] text-muted`,children:e.from===`agent`?`The agent's last reply`:e.from===`job`?`The end of the job's output`:`What the command said at the end`}),children:[(0,z.jsx)(qe,{text:i?`${o}text\n${e.text}\n${o}`:je(e.text),height:420}),r.length>0&&(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 text-sm`,children:[(0,z.jsx)(`span`,{className:`text-muted`,children:`Files it names:`}),r.map(e=>(0,z.jsx)(N,{path:e},e))]})]})}var $e={rule:{icon:x,label:`Rulebook`},decision:{icon:n,label:`Test decisions`},memory:{icon:re,label:`Page memory`},replay:{icon:o,label:`Replays`},model:{icon:ne,label:`Model`},skill:{icon:i,label:`Skills`}};function et({list:e,className:n}){let r=Object.keys($e).filter(t=>e.some(e=>e.kind===t));return(0,z.jsx)(H,{...n?{className:n}:{},title:`Learnings`,icon:(0,z.jsx)(M,{icon:t,size:18}),aside:e.length?(0,z.jsxs)(`span`,{className:`text-[13px] text-muted`,children:[e.length,` from this session`]}):void 0,children:e.length===0?(0,z.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing learned or decided in this session: no rules, test decisions, page memory or model switches in its log.`}):(0,z.jsx)(`div`,{className:`grid grid-cols-[repeat(auto-fit,minmax(280px,1fr))] gap-x-6 gap-y-4`,children:r.map(t=>{let{icon:n,label:r}=$e[t];return(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-col gap-1`,children:[(0,z.jsxs)(`h4`,{className:`m-0 flex items-center gap-2 text-[13px] font-medium text-muted`,children:[(0,z.jsx)(M,{icon:n,size:14}),r]}),(0,z.jsx)(`ul`,{className:`m-0 flex list-none flex-col p-0`,children:e.filter(e=>e.kind===t).map((e,t)=>(0,z.jsxs)(`li`,{className:`flex flex-col gap-1 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,z.jsx)(`span`,{className:`[overflow-wrap:anywhere]`,children:e.text}),e.note&&(0,z.jsx)(`span`,{className:`text-[13px] text-muted [overflow-wrap:anywhere]`,children:e.note})]},t))})]},t)})})})}function tt({run:e,className:t}){let n=[],r=t?{className:t}:{};return(e.executions.length||e.kind===`execution`)&&n.push({kind:`execution`,node:(0,z.jsx)(Ge,{list:e.executions,...r},`e`)}),(e.reports.length||e.kind===`report`)&&n.push({kind:`report`,node:(0,z.jsx)(Ke,{list:e.reports,...r},`r`)}),e.coding&&(e.coding.edits.length||e.coding.results.length||e.kind===`coding`)&&n.push({kind:`coding`,node:(0,z.jsx)(Ze,{c:e.coding,files:e.files,...r},`c`)}),n.sort((t,n)=>Number(n.kind===e.kind)-Number(t.kind===e.kind)),(0,z.jsx)(z.Fragment,{children:n.map(e=>e.node)})}var G={running:{label:`Running`,tone:`running`},done:{label:`Done`,tone:`pass`},failed:{label:`Failed`,tone:`fail`},stopped:{label:`Stopped`,tone:`neutral`}},nt={chat:`Chat`,suite:`Suite`,monitor:`Monitor`,run:`Browser run`,start:`Chat`,heal:`Heal`,"pr-tests":`PR tests`,pack:`Pack`,pipeline:`Pipeline watch`,explore:`Explore`,api:`API tests`,generate:`Generate`,jobs:`Jobs service`},rt=e=>nt[e]||e.charAt(0).toUpperCase()+e.slice(1),K=e=>{if(!e)return``;let t=new Date(e);return Number.isNaN(t.getTime())?e:t.toLocaleString([],{month:`short`,day:`numeric`,...t.getFullYear()===new Date().getFullYear()?{}:{year:`numeric`},hour:`numeric`,minute:`2-digit`})},q=(e,t)=>Math.max(0,Math.round(((e.status===`running`?t:Date.parse(e.lastAt))-Date.parse(e.startedAt))/1e3)),J=e=>Number.isFinite(e)?e<60?`${e}s`:e<3600?`${Math.floor(e/60)}m ${e%60}s`:`${Math.floor(e/3600)}h ${Math.floor(e%3600/60)}m`:`–`,Y=e=>e.usage.input+e.usage.output;function it(e){let[t,n]=(0,R.useState)(Date.now());return(0,R.useEffect)(()=>{if(!e)return;let t=P(()=>n(Date.now()),1e3);return()=>ye(t)},[e]),t}function at({r:e}){return e.origin.kind===`web`?(0,z.jsxs)(`a`,{href:D(`chats`,e.origin.chat),className:`inline-flex items-center gap-2`,children:[(0,z.jsx)(M,{icon:_,size:14}),`Web chat`]}):e.origin.kind===`job`?(0,z.jsxs)(`a`,{href:D(`jobs`,encodeURIComponent(e.origin.job)),className:`inline-flex items-center gap-2`,children:[(0,z.jsx)(M,{icon:h,size:14}),`Job`]}):(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-2 text-muted`,children:[(0,z.jsx)(M,{icon:S,size:14}),`Terminal`]})}var ot=e=>G[e].label;function st({status:e}){let t=G[e].label;return e===`running`?(0,z.jsx)(y,{size:16,"aria-label":t,className:`flex-none animate-spin text-accent-fg`}):e===`done`?(0,z.jsx)(c,{size:16,"aria-label":t,className:`flex-none text-pass`}):e===`failed`?(0,z.jsx)(p,{size:16,"aria-label":t,className:`flex-none text-fail`}):(0,z.jsx)(l,{size:16,"aria-label":t,className:`flex-none text-muted`})}var X=e=>e.status!==`running`&&!e.tools&&!e.turns&&!Y(e)&&!e.files.length&&!e.outputs.length&&q(e,0)<2;function ct(e){return/^forgeqe(-|$)|^engine$/.test(e)?oe(e).name:e&&e.charAt(0).toUpperCase()+e.slice(1)}function Z({label:e,children:t,stacked:n=!1}){return n?(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-col border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,z.jsx)(`span`,{className:`text-[13px] text-muted`,children:e}),(0,z.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:t})]}):(0,z.jsxs)(`div`,{className:`grid grid-cols-[120px_minmax(0,1fr)] items-baseline gap-4 border-t border-line-soft py-2 text-sm first:border-t-0`,children:[(0,z.jsx)(`span`,{className:`text-[13px] text-muted`,children:e}),(0,z.jsx)(`span`,{className:`min-w-0 [overflow-wrap:anywhere]`,children:t})]})}function Q({title:e,children:t}){return(0,z.jsxs)(`section`,{className:`flex min-w-0 flex-col`,children:[(0,z.jsx)(`h3`,{className:`m-0 mb-1 text-[13px] font-semibold`,children:e}),t]})}var lt=8,ut=e=>e===`write`?`Written`:e===`edit`?`Edited`:e===`delete`?`Deleted`:e?e.charAt(0).toUpperCase()+e.slice(1):`Changed`;function dt({run:e,now:t,running:n,events:r}){let i=G[e.status],a=e.executions.reduce((e,t)=>({total:e.total+t.counts.total,passed:e.passed+t.counts.passed,failed:e.failed+t.counts.failed}),{total:0,passed:0,failed:0}),o=e.coding?.results.at(-1),s=e.coding?.tests.length??0,c=e.coding?.tests.filter(e=>!e.ok).length??0,l=e.coding?.edits??[],u=l.reduce((e,t)=>e+t.added,0),d=l.reduce((e,t)=>e+t.removed,0),f=l.length||e.files.filter(e=>e.action&&e.action!==`read`).length;return(0,z.jsxs)(De,{label:`How this run went`,children:[(0,z.jsx)(I,{compact:!0,label:`Outcome`,value:i.label,tone:i.tone===`fail`?`text-fail`:i.tone===`pass`?`text-pass`:void 0,...o?.attempts?{note:`attempt ${o.attempts}${o.maxAttempts?` of ${o.maxAttempts}`:``}`}:{}}),(0,z.jsx)(I,{label:n?`Running for`:`Took`,value:J(q(e,t)),...r?{note:k(r,`event`)}:{}}),a.total>0&&(0,z.jsx)(I,{label:`Cases`,value:`${a.passed}/${a.total}`,...a.failed?{tone:`text-fail`}:a.passed===a.total?{tone:`text-pass`}:{},note:`passed`}),s>0&&(0,z.jsx)(I,{label:`Test runs`,value:s,...c?{note:`${c} failed`}:{}}),f>0&&(0,z.jsx)(I,{label:`Files changed`,value:f,...u+d?{note:`+${u} −${d}`}:{}}),Y(e)>0&&(0,z.jsx)(I,{label:`Tokens`,value:L(Y(e)),note:`${L(e.usage.input)} in · ${L(e.usage.output)} out`})]})}var ft={rerun:ie,write_test:b,investigate:a,fix_test:u},pt={rerun:`Retry`,write_test:`Write`,investigate:`Investigate`,fix_test:`Fix`};function mt({actions:e}){let[t,n]=(0,R.useState)(``),[r,i]=(0,R.useState)(``);if(!e.length)return null;let a=async e=>{n(e.prompt),i(``);try{let{id:t}=await ce.start(e.prompt,{});location.hash=D(`chats`,t)}catch(e){i(e.message),n(``)}};return(0,z.jsxs)(`section`,{"aria-label":`Next steps`,className:`flex flex-col gap-2`,children:[(0,z.jsx)(`div`,{className:`flex flex-wrap gap-2`,children:e.map((e,n)=>(0,z.jsxs)(de,{disabled:!!t,onClick:()=>void a(e),"data-tip":e.note?`${e.label}: ${e.note}`:e.label,className:`max-w-full min-w-0`,children:[(0,z.jsx)(M,{icon:ft[e.kind],size:16,className:`flex-none`}),(0,z.jsx)(`span`,{className:`min-w-0 truncate`,children:t===e.prompt?`Opening…`:pt[e.kind]}),e.note&&(0,z.jsx)(`span`,{className:`min-w-0 flex-[1_1_0] truncate font-normal text-ink-2`,children:e.note})]},n))}),(0,z.jsx)(`span`,{className:`text-[13px] text-muted`,children:`Each opens a chat with the request; it asks before it changes anything.`}),r&&(0,z.jsx)(`p`,{className:`m-0 text-sm text-fail`,children:r})]})}var ht=e=>`\`${e.replace(/`/g,``)}\``,gt=[`summary`,`conversation`,`activity`,`details`],_t=e=>gt.find(t=>t===e)??`summary`;function vt({name:e,tab:t}){let[n,r]=(0,R.useState)(null),[i,a]=(0,R.useState)(``),[o,s]=(0,R.useState)(!1),c=_t(t),l=t=>location.hash=t===`summary`?D(`runs`,encodeURIComponent(e)):D(`runs`,encodeURIComponent(e),t),u=(0,R.useCallback)(()=>{A.detail(e).then(e=>{r(e),a(``)},e=>a(e.message))},[e]);(0,R.useEffect)(u,[u]);let d=n?.status===`running`;(0,R.useEffect)(()=>{if(!d)return;let e=P(u,2e3);return()=>ye(e)},[u,d]);let p=it(d),m=(0,R.useMemo)(()=>(n?.events??[]).map(ke).filter(e=>!!e),[n?.events]),h=async()=>{s(!0),a(``);try{await A.cancel(e),u()}catch(e){a(e.message)}finally{s(!1)}},g=(0,z.jsxs)(`a`,{href:D(`runs`),className:`inline-flex items-center gap-2 text-sm`,children:[(0,z.jsx)(ee,{size:16,"aria-hidden":`true`}),`All runs`]});if(!n)return(0,z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[g,i?(0,z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail`,children:i}):(0,z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`})]});let _=G[n.status],v=!n.replies.length,y=!!n.final||n.executions.length>0||n.reports.length>0||!!(n.coding&&(n.coding.edits.length||n.coding.results.length))||n.learnings.length>0||n.outputs.length>0||n.files.length>0,b=[{id:`summary`,label:`Summary`},{id:`conversation`,label:v?`Command`:`Conversation`,n:n.replies.length||void 0},{id:`activity`,label:`Activity`,n:m.length||void 0},{id:`details`,label:`Details`}],x=new Set([...n.reports.map(e=>e.path),...n.executions.flatMap(e=>[e.report,e.folder])].filter(Boolean)),S=n.outputs.filter(e=>!x.has(e.path)),te=n.context?.limit?Math.round(n.context.tokens/n.context.limit*100):null,w=S.length>0||n.files.length>0?`@3xl:col-span-3`:`@3xl:col-span-4`;return(0,z.jsxs)(`div`,{className:`flex flex-col gap-6`,children:[g,(0,z.jsxs)(`div`,{className:`flex flex-wrap items-start gap-x-4 gap-y-4`,children:[(0,z.jsxs)(`div`,{className:`flex min-w-0 flex-[1_1_320px] flex-col gap-2`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-4 gap-y-1`,children:[(0,z.jsx)(`h2`,{className:`m-0 min-w-0 text-[20px] font-semibold tracking-[-0.01em] [overflow-wrap:anywhere]`,children:n.title}),(0,z.jsx)(j,{tone:_.tone,children:_.label})]}),(0,z.jsxs)(`span`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-[13px] text-muted`,children:[(0,z.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[(0,z.jsx)(Re,{kind:n.kind}),B[n.kind]]}),`· `,(0,z.jsx)(at,{r:n}),`· `,K(n.startedAt),` · `,d?`running for `:`took `,J(q(n,p)),` · `,L(Y(n)),` tokens`,n.profile?.model?` · ${n.profile.model}`:``]})]}),n.cancel&&(0,z.jsxs)(de,{variant:`danger`,disabled:o,"data-tip":n.cancel===`chat`?`Stop this chat's work`:`Cancel this job's run`,onClick:()=>void h(),children:[n.cancel===`chat`?(0,z.jsx)(C,{fill:`currentColor`,"aria-hidden":`true`}):(0,z.jsx)(f,{"aria-hidden":`true`}),o?`Stopping…`:n.cancel===`chat`?`Stop`:`Cancel`]})]}),i&&(0,z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:i}),n.error&&(0,z.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:[(0,z.jsx)(`strong`,{children:`What went wrong:`}),` `,n.error]}),!d&&(0,z.jsx)(mt,{actions:n.actions??[]}),(0,z.jsx)(Ce,{prefix:`run`,label:`This run`,className:`mb-0`,current:c,onPick:l,tabs:b}),(0,z.jsxs)(`div`,{role:`tabpanel`,id:`run-panel-${c}`,"aria-labelledby":`run-${c}`,className:`flex min-w-0 flex-col gap-6`,children:[c===`summary`&&(0,z.jsxs)(z.Fragment,{children:[y&&(0,z.jsx)(dt,{run:n,now:p,running:d,events:m.length}),(0,z.jsxs)(`div`,{className:`grid items-start gap-x-12 gap-y-6 @3xl:grid-cols-4 @3xl:[grid-auto-flow:dense]`,children:[n.final&&(0,z.jsx)(Qe,{final:n.final,answer:n.answer,className:w}),(0,z.jsx)(tt,{run:n,className:w}),S.length>0&&(0,z.jsx)(`section`,{className:`flex min-w-0 flex-col border-t border-line-soft pt-6 @3xl:col-span-1`,children:(0,z.jsx)(Q,{title:`What it produced (${S.length})`,children:S.map(e=>(0,z.jsx)(Z,{label:e.label,stacked:!0,children:(0,z.jsx)(N,{path:e.path,children:e.path.split(`/`).pop()})},e.path))})}),n.files.length>0&&(0,z.jsx)(`section`,{className:`flex min-w-0 flex-col border-t border-line-soft pt-6 @3xl:col-span-1`,children:(0,z.jsx)(Q,{title:`Files worked on (${n.files.length})`,children:(0,z.jsx)(U,{items:[...n.files].sort((e,t)=>Number(e.action===`read`)-Number(t.action===`read`)),first:lt,render:e=>(0,z.jsx)(Z,{label:ut(e.action),stacked:!0,children:e.action===`delete`?(0,z.jsx)(`span`,{className:`font-mono text-[13px]`,children:e.path.split(`/`).pop()}):(0,z.jsx)(N,{path:e.path,children:e.path.split(`/`).pop()})},e.path)})})}),n.learnings.length>0&&(0,z.jsx)(et,{list:n.learnings,className:`@3xl:col-span-4`})]}),!y&&(0,z.jsx)(he,{className:`py-4`,children:d?`Still working: its answer and what it produces show here when it ends.`:`This run left no answer, results or files. Its Activity shows what it did.`})]}),c===`conversation`&&(v?(0,z.jsx)(F,{text:ht(n.prompt),className:`text-sm [&_p]:my-0`}):(0,z.jsx)(`ol`,{className:`m-0 flex list-none flex-col gap-4 p-0`,children:n.replies.map((e,t)=>(0,z.jsxs)(`li`,{className:`flex flex-col gap-2`,children:[(0,z.jsx)(`div`,{className:`self-end rounded-[14px] bg-surface-strong px-4 py-2 text-sm max-w-[85%]`,children:(0,z.jsx)(F,{text:e.ask,className:`[&_p]:my-1`})}),e.text&&(0,z.jsx)(F,{text:je(e.text),className:`text-sm`}),e.error&&(0,z.jsx)(`p`,{className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:e.error})]},t))})),c===`activity`&&(n.archived?(0,z.jsxs)(`p`,{className:`m-0 rounded-[12px] bg-surface-muted px-4 py-4 text-sm text-ink-2`,children:[`ForgeQE keeps the newest session logs only, and this run's is gone. Its summary, final message and learnings were kept in `,(0,z.jsx)(`code`,{className:`font-mono text-[13px]`,children:`.forgeqe/runs`}),`; its step-by-step activity was not.`]}):m.length?(0,z.jsx)(Fe,{timeline:!0,lines:m,start:n.startedAt,live:d,name:`forgeqe-run-${n.name.replace(/\.log$/,``)}.md`}):(0,z.jsx)(`p`,{className:`m-0 text-sm text-muted`,children:`Nothing logged yet.`})),c===`details`&&(0,z.jsxs)(yt,{children:[(0,z.jsxs)(Q,{title:`Numbers`,children:[(0,z.jsx)(Z,{label:d?`Running for`:`Took`,children:J(q(n,p))}),(0,z.jsx)(Z,{label:`Tokens`,children:(0,z.jsxs)(`span`,{className:`flex flex-col gap-1`,children:[(0,z.jsxs)(`span`,{children:[L(Y(n)),` `,(0,z.jsxs)(`span`,{className:`text-muted`,children:[`· `,Ae(n.usage)]})]}),(n.byAgent?.length??0)>1&&(0,z.jsx)(`span`,{className:`flex flex-col gap-1 text-[13px]`,children:n.byAgent.map(e=>(0,z.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-ink-2`,children:ct(e.agent)}),(0,z.jsx)(`span`,{className:`text-muted tabular-nums`,children:L(e.input+e.output)})]},e.agent))})]})}),(0,z.jsxs)(Z,{label:`Context`,children:[n.context?L(n.context.tokens):`–`,te!==null&&(0,z.jsxs)(`span`,{className:`text-muted`,children:[` of `,L(n.context.limit),` (`,te,`%)`]})]}),(0,z.jsxs)(Z,{label:`Tool calls`,children:[n.tools,` `,(0,z.jsxs)(`span`,{className:`text-muted`,children:[`in `,k(n.turns,`turn`)]})]})]}),(0,z.jsxs)(Q,{title:`Session`,children:[(0,z.jsx)(Z,{label:`Started by`,children:(0,z.jsx)(at,{r:n})}),(0,z.jsx)(Z,{label:`Command`,children:rt(n.command)}),(0,z.jsx)(Z,{label:`Model`,children:n.profile?[n.profile.name,n.profile.model].filter(Boolean).join(` · `):`–`}),(0,z.jsx)(Z,{label:`Agents`,children:n.agents.length?(0,z.jsx)(`span`,{className:`flex flex-col gap-1`,children:n.agents.map(e=>(0,z.jsxs)(`span`,{className:`flex items-baseline gap-2`,children:[(0,z.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:ct(e.name)}),(0,z.jsx)(`span`,{className:`text-[13px] text-muted tabular-nums`,children:k(e.calls,`call`)})]},e.name))}):(0,z.jsx)(`span`,{className:`text-muted`,children:`None`})}),(0,z.jsxs)(Z,{label:`Log`,children:[n.archived?(0,z.jsx)(`span`,{className:`text-muted`,children:`No longer kept: ForgeQE keeps the newest logs only`}):(0,z.jsx)(N,{path:`.forgeqe/logs/${n.name}`}),n.truncated&&(0,z.jsx)(`span`,{className:`block text-[13px] text-muted`,children:`Very long: only its start is shown.`})]})]}),n.job&&(0,z.jsxs)(Q,{title:`Job`,children:[(0,z.jsx)(Z,{label:`Job`,children:(0,z.jsx)(`a`,{href:D(`jobs`,encodeURIComponent(n.origin.kind===`job`?n.origin.job:n.job.name)),children:n.job.name})}),(0,z.jsx)(Z,{label:`Runs`,children:(0,z.jsx)(F,{text:ht(n.job.command),className:`text-sm [&_p]:my-0`})}),(0,z.jsxs)(Z,{label:`Schedule`,children:[n.job.schedule,!n.job.enabled&&` (disabled)`,n.job.nextAt&&n.job.enabled?` · next ${K(n.job.nextAt)}`:``]}),n.job.run&&(0,z.jsxs)(Z,{label:`This run`,children:[n.job.run.reason===`asked`?`Asked for`:`On schedule`,`, `,n.job.run.status.replace(`_`,` `),n.job.run.exitCode!==void 0&&n.job.run.exitCode!==null?`, exit ${n.job.run.exitCode}`:``]})]}),(0,z.jsx)(Q,{title:`Notifications`,children:n.notifications.length?n.notifications.map(e=>(0,z.jsx)(Z,{label:e.event.replace(/_/g,` `),children:e.channels.length?e.channels.join(`, `):(0,z.jsx)(`span`,{className:`text-muted`,children:`No channel takes it`})},e.event)):(0,z.jsx)(`p`,{className:`m-0 py-1 text-sm text-muted`,children:n.origin.kind===`terminal`||n.origin.kind===`web`?`None: notify channels go with jobs, suites and the monitor.`:`No notify channels are set up (Settings, Notify).`})})]})]})]})}function yt({children:e}){let t=R.Children.toArray(e).filter(Boolean),n=t.length%2==1;return(0,z.jsx)(`div`,{className:`grid items-start gap-x-12 gap-y-6 @3xl:grid-cols-4 @3xl:[grid-auto-flow:dense]`,children:t.map((e,r)=>(0,z.jsx)(`section`,{className:O(`flex min-w-0 flex-col border-t border-line-soft pt-6`,n&&r===t.length-1?`@3xl:col-span-4`:`@3xl:col-span-2`),children:e},r))})}var $=25;function bt({runs:e}){let t=it(e.some(e=>e.status===`running`)),[n,r]=(0,R.useState)(``),[i,a]=(0,R.useState)(`all`),[o,s]=(0,R.useState)(``),[c,l]=(0,R.useState)(``),[u,d]=(0,R.useState)(!1),[f,p]=(0,R.useState)(0);(0,R.useEffect)(()=>p(0),[n,i,o,c,u]);let m=e.filter(X).length,ee=n.toLowerCase().split(/\s+/).filter(Boolean),h=e.filter(e=>(u||!X(e))&&(!o||e.kind===o)&&(!c||e.origin.kind===c)&&ee.every(t=>`${e.title} ${e.command} ${e.error||``}`.toLowerCase().includes(t))),g={all:h.length,running:h.filter(e=>e.status===`running`).length,failed:h.filter(e=>e.status===`failed`).length},v=i===`all`?h:h.filter(e=>e.status===i),y=Math.max(1,Math.ceil(v.length/$)),b=Math.min(f,y-1),x=v.slice(b*$,b*$+$),S=e.filter(e=>e.status!==`running`&&!X(e)),C=S.filter(e=>e.status===`failed`).length,w=S.length?S.reduce((e,n)=>e+q(n,t),0)/S.length:NaN,ne=e.reduce((e,t)=>e+Y(t),0),re=[...new Set(e.map(e=>e.kind))],T=[...new Set(e.map(e=>e.origin.kind))],E={web:`Web chat`,job:`Job`,terminal:`Terminal`};return e.length===0?(0,z.jsx)(he,{icon:te,title:`No runs yet`,action:(0,z.jsxs)(`a`,{className:fe({size:`sm`}),href:D(),"data-tip":`Start a chat`,children:[(0,z.jsx)(_,{"aria-hidden":`true`}),`Chat`]}),children:`A chat here, a job, or a ForgeQE command in this project adds one.`}):(0,z.jsxs)(`div`,{className:`flex flex-col gap-4`,children:[(0,z.jsxs)(`div`,{className:`flex flex-wrap gap-x-6 gap-y-1 text-[13px] text-muted`,children:[(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{className:`text-ink tabular-nums`,children:e.length-m}),` runs`]}),e.some(e=>e.status===`running`)&&(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{className:`text-accent-fg tabular-nums`,children:e.filter(e=>e.status===`running`).length}),` running now`]}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{className:O(`tabular-nums`,C?`text-fail`:`text-ink`),children:C}),` failed`,S.length?` (${Math.round(C/S.length*100)}%)`:``]}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{className:`text-ink tabular-nums`,children:L(ne)}),` tokens`]}),(0,z.jsxs)(`span`,{children:[(0,z.jsx)(`b`,{className:`text-ink tabular-nums`,children:J(Math.round(w))}),` on average`]})]}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,z.jsx)(pe,{id:`run-search`,label:`Find a run`,value:n,onChange:r,placeholder:`Find a run by what was asked`}),(0,z.jsx)(_e,{items:[{id:`all`,label:`All`,n:g.all},{id:`running`,label:`Running`,n:g.running},{id:`failed`,label:`Failed`,n:g.failed,alert:!0}],value:i,onChange:a}),re.length>1&&(0,z.jsxs)(ue,{size:`sm`,"aria-label":`What it did`,value:o,onChange:e=>s(e.target.value),className:`w-auto pr-8 pl-4`,children:[(0,z.jsx)(`option`,{value:``,children:`Any kind`}),re.map(e=>(0,z.jsx)(`option`,{value:e,children:B[e]},e))]}),T.length>1&&(0,z.jsxs)(ue,{size:`sm`,"aria-label":`Started by`,value:c,onChange:e=>l(e.target.value),className:`w-auto pr-8 pl-4`,children:[(0,z.jsx)(`option`,{value:``,children:`Started anywhere`}),T.map(e=>(0,z.jsx)(`option`,{value:e,children:E[e]||e},e))]})]}),(0,z.jsxs)(`div`,{className:`rounded-[14px] card border`,children:[(0,z.jsxs)(`div`,{"aria-hidden":`true`,className:`hidden grid-cols-[auto_minmax(0,1fr)_104px_104px_72px_64px_92px] items-center gap-x-4 border-b border-line-soft px-4 py-2 text-[13px] font-semibold text-muted @3xl:grid`,children:[(0,z.jsx)(`span`,{className:`w-4`}),(0,z.jsx)(`span`,{children:`Run`}),(0,z.jsx)(`span`,{children:`Kind`}),(0,z.jsx)(`span`,{children:`Started by`}),(0,z.jsx)(`span`,{className:`text-right`,children:`Took`}),(0,z.jsx)(`span`,{className:`text-right`,children:`Tokens`}),(0,z.jsx)(`span`,{className:`text-right`,children:`When`})]}),(0,z.jsxs)(`ul`,{"aria-label":`Runs`,className:`m-0 list-none p-2`,children:[x.length===0&&(0,z.jsx)(`li`,{className:`px-4 py-4 text-sm text-muted`,children:`Nothing matches.`}),x.map((e,n)=>{let r=Oe(e.startedAt);return(0,z.jsxs)(`li`,{className:`contents`,children:[(n===0||Oe(x[n-1].startedAt)!==r)&&(0,z.jsx)(`span`,{className:`block px-4 pt-4 pb-1 text-[13px] font-semibold text-muted`,children:r}),(0,z.jsxs)(`a`,{href:D(`runs`,encodeURIComponent(e.name)),className:`grid min-h-12 grid-cols-[auto_minmax(0,1fr)_auto] items-center gap-x-4 rounded-[10px] px-4 py-2 text-ink no-underline hover:bg-surface-muted hover:text-ink @3xl:grid-cols-[auto_minmax(0,1fr)_104px_104px_72px_64px_92px] @3xl:gap-x-4`,children:[(0,z.jsx)(st,{status:e.status}),(0,z.jsxs)(`span`,{className:`flex min-w-0 flex-col`,children:[(0,z.jsx)(`span`,{className:`truncate text-[13px] font-medium`,"data-tip":e.title,children:e.title}),e.error?(0,z.jsx)(`span`,{className:`truncate text-[13px] text-fail`,children:e.error}):(0,z.jsx)(`span`,{className:`truncate text-[13px] text-muted @3xl:hidden`,children:[B[e.kind],E[e.origin.kind],J(q(e,t)),`${L(Y(e))} tokens`].join(` · `)})]}),(0,z.jsxs)(`span`,{className:`hidden min-w-0 items-center gap-2 text-[13px] text-ink-2 @3xl:inline-flex`,children:[(0,z.jsx)(Re,{kind:e.kind}),B[e.kind]]}),(0,z.jsx)(`span`,{className:`hidden text-[13px] text-ink-2 @3xl:block`,children:E[e.origin.kind]||e.origin.kind}),(0,z.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:J(q(e,t))}),(0,z.jsx)(`span`,{className:`hidden text-right text-[13px] text-muted tabular-nums @3xl:block`,children:L(Y(e))}),(0,z.jsx)(`span`,{className:`text-right text-[13px] text-muted tabular-nums`,"data-tip":K(e.startedAt),children:Me(e.startedAt)})]})]},e.name)})]}),(0,z.jsx)(me,{page:b,size:$,total:v.length,onPage:p,label:`Pages of runs`,children:m>0&&(0,z.jsxs)(z.Fragment,{children:[` · `,(0,z.jsx)(`button`,{type:`button`,onClick:()=>d(!u),className:`cursor-pointer border-0 bg-transparent p-0 text-[13px] text-accent-fg hover:underline`,children:u?`Hide the ${k(m,`empty session`)}`:`${k(m,`empty session`)} hidden`})]})})]})]})}function xt({sub:e}){let[t,n]=(0,R.useState)(null),[r,i]=(0,R.useState)(``),a=(0,R.useCallback)(()=>{A.list().then(e=>{n(e.runs),i(``)},e=>i(e.message))},[]);(0,R.useEffect)(a,[a]);let o=t?.some(e=>e.status===`running`);(0,R.useEffect)(()=>{if(e)return;let t=P(a,o?3e3:2e4);return()=>ye(t)},[a,o,e]);let[s,c]=(e||``).split(`/`),l=s?ae(s):``;return(0,z.jsxs)(`div`,{className:`flex min-h-(--screen) flex-col`,children:[(0,z.jsx)(Se,{}),(0,z.jsx)(`main`,{className:O(Ee,`@container flex-auto gap-4`),children:l?(0,z.jsx)(vt,{name:l,tab:c},l):(0,z.jsxs)(z.Fragment,{children:[(0,z.jsx)(xe,{}),(0,z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-6 gap-y-2`,children:[(0,z.jsxs)(`span`,{className:`flex items-center gap-4`,children:[(0,z.jsx)(Te,{pixel:ve.runs,size:`lg`}),(0,z.jsx)(`h1`,{className:`m-0 text-[25px] font-semibold tracking-[-0.01em]`,children:`Runs`})]}),(0,z.jsx)(be,{label:`Runs and reports`,links:Ie,current:`runs`})]}),(0,z.jsx)(`p`,{className:`m-0 text-sm leading-relaxed text-ink-2`,children:`Every ForgeQE session in this project: chats here, jobs' runs, and commands typed in a terminal, newest first. Open one for how it went and what it produced.`}),r&&(0,z.jsx)(`p`,{role:`alert`,className:`m-0 rounded-[12px] bg-fail-soft px-4 py-2 text-sm text-fail [overflow-wrap:anywhere]`,children:r}),!t&&!r&&(0,z.jsx)(`p`,{role:`status`,className:`m-0 text-sm text-muted`,children:`Loading…`}),t&&(0,z.jsx)(bt,{runs:t})]})})]})}export{xt as Runs,st as StatusIcon,X as empty,_t as runTab,ot as statusLabel};
|