shapewall 0.3.1 → 0.3.3
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/CHANGELOG.md +142 -0
- package/NOTICE +7 -0
- package/README.md +4 -2
- package/THIRD_PARTY.md +39 -0
- package/dist/agent/package-lock.json +2 -2
- package/dist/client/assets/BoardChat-DxehB761.js +27 -0
- package/dist/client/assets/BuzzDialog-Ix9qJvim.js +1 -0
- package/dist/client/assets/ChecksPanel-pA_ueIaJ.js +1 -0
- package/dist/client/assets/History-C9N32kCv.js +1 -0
- package/dist/client/assets/LocalSettings-DawtKnvi.js +1 -0
- package/dist/client/assets/{Management-BFcKFdbp.js → Management-NVFDtSZB.js} +1 -1
- package/dist/client/assets/QuickConnect-DO1TjS1t.js +1 -0
- package/dist/client/assets/ShareDialog-By0ETg6n.js +2 -0
- package/dist/client/assets/app-update-dialog-RGIw24iZ.js +1 -0
- package/dist/client/assets/{circle-x-PRxj7kPi.js → circle-x-B6KfScOE.js} +1 -1
- package/dist/client/assets/index-CsqLdqGx.css +2 -0
- package/dist/client/assets/index-DnZarJ3U.js +37 -0
- package/dist/client/assets/{refresh-cw-aeOBDuGQ.js → refresh-cw-vkgvCCfR.js} +1 -1
- package/dist/client/assets/rolldown-runtime-XKyaHtl9.js +1 -0
- package/dist/client/assets/{shield-check-DuPBJ6H_.js → shield-check-QzwGhz0t.js} +1 -1
- package/dist/client/assets/ui-DI-FGWWK.js +41 -0
- package/dist/client/build-info.json +1 -1
- package/dist/client/index.html +4 -3
- package/dist/client/sw.js +2 -2
- package/dist/console/assets/{LocalAccountsApp-lJjkhUcH.js → LocalAccountsApp-VOCZg8dg.js} +1 -1
- package/dist/console/assets/{LocalConsole-BZHqYKnt.js → LocalConsole-CMwAW-mF.js} +1 -1
- package/dist/console/assets/{app-update-dialog-DCM9sYE3.js → app-update-dialog-Cw6UDqNP.js} +1 -1
- package/dist/console/assets/console-DgfWmUEx.js +55 -0
- package/dist/console/assets/console-Lis0vvdL.css +2 -0
- package/dist/console/build-info.json +1 -1
- package/dist/console/console.html +2 -2
- package/docs/agent-workflow.md +19 -3
- package/docs/agents.md +62 -2
- package/docs/config.md +3 -3
- package/docs/deployment.md +2 -0
- package/docs/design-system.md +20 -15
- package/docs/hosted.md +19 -0
- package/docs/pull-requests.md +4 -1
- package/docs/where-to-run.md +88 -0
- package/package.json +2 -1
- package/src/agent/agent-logos.js +81 -0
- package/src/agent/composer.js +9 -5
- package/src/agent/config.js +27 -2
- package/src/agent/context.js +3 -1
- package/src/agent/icon-store.js +100 -0
- package/src/agent/identity.js +77 -0
- package/src/agent/owner-mcp.js +19 -3
- package/src/agent/routes.js +82 -21
- package/src/agent/run.js +3 -1
- package/src/agent/settings-routes.js +233 -14
- package/src/agent/test-timing.js +14 -0
- package/src/agent/tools.js +6 -3
- package/src/agent/user-settings.js +51 -3
- package/src/capture/capture.js +3 -1
- package/src/capture/element-map.js +73 -11
- package/src/ci/settings.js +3 -3
- package/src/ci/start.js +16 -0
- package/src/ci/summary.js +8 -1
- package/src/cli/args.js +1 -0
- package/src/cli/ci.js +2 -2
- package/src/cli/comments.js +5 -4
- package/src/cli/help.js +3 -1
- package/src/cli/init.js +2 -2
- package/src/comment-fields.js +45 -0
- package/src/comments-cli.js +100 -21
- package/src/discover.js +34 -1
- package/src/doctor.js +26 -1
- package/src/event-log.js +5 -2
- package/src/feedback.js +5 -2
- package/src/github.js +4 -2
- package/src/hosted/agent-presence.js +40 -0
- package/src/hosted/app.js +6 -0
- package/src/hosted/board-routes.js +9 -1
- package/src/hosted/comments.js +11 -11
- package/src/hosted/console-routes.js +47 -1
- package/src/hosted/events.js +6 -4
- package/src/hosted/import.js +7 -4
- package/src/hosted/presence.js +1 -1
- package/src/hosted/projects.js +32 -1
- package/src/hosted/token-api.js +5 -1
- package/src/hosted/token-events.js +5 -2
- package/src/hosted/tokens.js +3 -2
- package/src/mcp.js +10 -2
- package/src/notify/messages.js +6 -4
- package/src/store.js +19 -11
- package/dist/client/assets/BoardChat-V1BCXdDB.js +0 -27
- package/dist/client/assets/BuzzDialog-Ds7Thpfe.js +0 -1
- package/dist/client/assets/ChecksPanel-Cm22bCdQ.js +0 -1
- package/dist/client/assets/History-U0bD1BjA.js +0 -1
- package/dist/client/assets/LocalSettings-DOSuW7VC.js +0 -1
- package/dist/client/assets/QuickConnect-DyfPSWbV.js +0 -1
- package/dist/client/assets/ShareDialog-BouvNraR.js +0 -2
- package/dist/client/assets/app-update-dialog-DH2Mgby8.js +0 -1
- package/dist/client/assets/index-C9S7HL_o.js +0 -37
- package/dist/client/assets/index-CXtuJi1K.css +0 -2
- package/dist/client/assets/ui-Cg4TTrec.js +0 -41
- package/dist/console/assets/console-C2LsvEco.js +0 -55
- package/dist/console/assets/console-Fp4k9iyx.css +0 -2
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{B as t,Sn as n,V as r,_ as i,a,bn as o,c as s,d as c,g as l,gn as u,i as d,jt as f,n as p,o as m,p as h,s as g,t as _,tt as v,u as y,vn as b,wn as ee,xn as x}from"./ui-DI-FGWWK.js";import{I as S,K as te,R as ne,X as C,Z as re,k as ie,nt as w,rt as T,st as ae,t as oe,tt as E}from"./index-DnZarJ3U.js";import{t as se}from"./refresh-cw-vkgvCCfR.js";import{n as D,t as O}from"./shield-check-QzwGhz0t.js";import{n as k,t as A}from"./circle-x-B6KfScOE.js";var j={name:`eye-off`,size:24,node:[[`path`,{d:`M10.733 5.076a10.744 10.744 0 0 1 11.205 6.575 1 1 0 0 1 0 .696 10.747 10.747 0 0 1-1.444 2.49`,key:`ct8e1f`}],[`path`,{d:`M14.084 14.158a3 3 0 0 1-4.242-4.242`,key:`151rxh`}],[`path`,{d:`M17.479 17.499a10.75 10.75 0 0 1-15.417-5.151 1 1 0 0 1 0-.696 10.75 10.75 0 0 1 4.446-5.143`,key:`13bj9a`}],[`path`,{d:`m2 2 20 20`,key:`1ooewy`}]]};j.node;var M=x(j),N={name:`gauge`,size:24,node:[[`path`,{d:`m12 14 4-4`,key:`9kzdfg`}],[`path`,{d:`M3.34 19a10 10 0 1 1 17.32 0`,key:`19p75a`}]]};N.node;var P=x(N),ce={name:`person-standing`,size:24,node:[[`circle`,{cx:`12`,cy:`5`,r:`1`,key:`gxeob9`}],[`path`,{d:`m9 20 3-6 3 6`,key:`se2kox`}],[`path`,{d:`m6 8 6 2 6-2`,key:`4o3us4`}],[`path`,{d:`M12 10v4`,key:`1kjpxc`}]]};ce.node;var F=x(ce),I={name:`search-check`,size:24,node:[[`path`,{d:`m8 11 2 2 4-4`,key:`1sed1v`}],[`circle`,{cx:`11`,cy:`11`,r:`8`,key:`4ej97u`}],[`path`,{d:`m21 21-4.3-4.3`,key:`1qie3q`}]]};I.node;var L=x(I),R=e(ee(),1),le={" ":278,"!":278,'"':355,"#":556,$:556,"%":889,"&":667,"'":191,"(":333,")":333,"*":389,"+":584,",":278,"-":333,".":278,"/":278,":":278,";":278,"<":584,"=":584,">":584,"?":556,"@":1015,"[":278,"]":278,_:556,"|":260,"–":556,"—":1e3,"·":278,"…":1e3,"’":222,"‘":222,"“":333,"”":333},z={A:667,B:667,C:722,D:722,E:667,F:611,G:778,H:722,I:278,J:500,K:667,L:556,M:833};Object.assign(z,{N:722,O:778,P:667,Q:778,R:722,S:667,T:611,U:722,V:667,W:944,X:667,Y:667,Z:611});var B={a:556,b:556,c:500,d:556,e:556,f:278,g:556,h:556,i:222,j:222,k:500,l:222,m:833};Object.assign(B,{n:556,o:556,p:556,q:556,r:333,s:500,t:278,u:556,v:500,w:722,x:500,y:500,z:500});function ue(e){return le[e]===void 0?z[e]===void 0?B[e]===void 0?/[0-9]/.test(e)?556:e.codePointAt(0)>=11904?1e3:/\p{Lu}/u.test(e)?700:560:B[e]:z[e]:le[e]}function de(e,t){let n=0;for(let t of String(e||``))n+=ue(t);return n*t/1e3}var V=Object.freeze({titleFont:20,titlePixels:580,titleMinChars:10,descriptionFont:14,descriptionPixels:920,descriptionMinChars:50}),H=e=>String(e||``).replace(/\s+/g,` `).trim();function fe(e,{size:t,pixels:n}){let r=H(e);if(de(r,t)<=n)return{text:r,cut:!1};let i=n-de(` ...`,t),a=0,o=0;for(let e of r){let n=a+ue(e)*t/1e3;if(n>i)break;a=n,o+=e.length}let s=r.slice(0,o),c=s.lastIndexOf(` `);return c>o*.6&&(s=s.slice(0,c)),{text:`${s.replace(/[\s,.;:–—-]+$/,``)} ...`,cut:!0}}var U=Object.freeze({"search-noindex":{level:`error`,group:`indexing`,label:`Asks search engines not to index it`,explain:`A robots "noindex" tag or header tells Google to leave this page out of search results.`,fix:`Remove the noindex robots meta tag or X-Robots-Tag header if this page should be found. If it is meant to stay private, mark the page private in the Shapewall config.`},"robots-crawl-blocked":{level:`error`,group:`indexing`,label:`Blocked by robots.txt`,explain:`The site’s robots.txt rules stop Googlebot from crawling this address, so Google can’t read its content.`,fix:`Change the Disallow rule in robots.txt that matches this path, or add a more specific Allow rule for it.`},"robots-unavailable":{level:`tip`,group:`indexing`,label:`Crawl rules could not be read`,explain:`robots.txt redirected, timed out or was too large, so crawl permission is unknown.`,fix:`Serve robots.txt directly from the site root with a 200 or 404 response.`},"missing-title":{level:`error`,group:`title`,label:`No page title`,explain:`Without a <title>, Google writes its own headline for the result, usually from text on the page.`,fix:`Add a unique <title> that says what the page is, with the brand at the end.`},"seo-title-long":{level:`tip`,group:`title`,label:`Title will be cut off`,explain:`Google shows about 580 pixels of a title (roughly 55 to 60 characters). The rest is replaced with an ellipsis.`,fix:`Put the important words first and shorten the title so it fits.`},"seo-title-short":{level:`tip`,group:`title`,label:`Title is very short`,explain:`A very short title gives searchers little reason to pick this result.`,fix:`Describe the page in a few more words, for example the product or topic and the brand.`},"duplicate-title":{level:`warning`,group:`title`,label:`Same title as another page`,explain:`Several pages share this title, so searchers can’t tell them apart and Google may pick the wrong one.`,fix:`Give each page its own title that names what is different about it.`},"seo-description":{level:`warning`,group:`description`,label:`No meta description`,explain:`Without a description, Google picks a snippet from the page text, which is often a menu or a cookie banner.`,fix:`Add <meta name="description"> with one or two sentences (about 120 to 155 characters) that sell the page.`},"seo-description-long":{level:`tip`,group:`description`,label:`Description will be cut off`,explain:`Google shows about 920 pixels of a description (roughly 150 to 160 characters) on desktop and less on phones.`,fix:`Keep the key message in the first 120 characters.`},"seo-description-short":{level:`tip`,group:`description`,label:`Description is very short`,explain:`A short description leaves room Google may fill with page text instead.`,fix:`Write one or two full sentences about what the visitor gets on this page.`},"duplicate-description":{level:`warning`,group:`description`,label:`Same description as another page`,explain:`Repeated descriptions make results look identical and tell searchers nothing about this page.`,fix:`Write a description for this page that is specific to it.`},"seo-canonical":{level:`warning`,group:`canonical`,label:`No canonical URL`,explain:`A canonical link tells search engines which address is the real one when the page is reachable at several (with tracking parameters, trailing slashes or www).`,fix:`Add <link rel="canonical" href="..."> with the page’s full preferred address.`},"canonical-invalid":{level:`warning`,group:`canonical`,label:`Canonical URL is not a full address`,explain:`The canonical link is relative or not http(s). Search engines may ignore it.`,fix:`Use an absolute https:// address in the canonical link.`},"canonical-elsewhere":{level:`error`,group:`canonical`,label:`Canonical points to another page`,explain:`The canonical link names a different address, which tells Google to show that page instead of this one.`,fix:`Point the canonical link at this page’s own address, unless this really is a copy of the other page.`},"seo-ogtitle":{level:`warning`,group:`social`,label:`No social title`,explain:`Without og:title, Slack, LinkedIn, iMessage and others guess a headline for shared links.`,fix:`Add <meta property="og:title"> with the headline you want in link previews.`},"seo-ogdescription":{level:`tip`,group:`social`,label:`No social description`,explain:`Link previews show og:description under the headline. Without it they show nothing or random text.`,fix:`Add <meta property="og:description"> with one short sentence.`},"seo-ogimage":{level:`warning`,group:`social`,label:`No social image`,explain:`Shared links without og:image show as a plain text line and get far fewer clicks.`,fix:`Add <meta property="og:image"> with an absolute URL to a 1200 × 630 image.`},"social-image-failed":{level:`error`,group:`social`,label:`Social image is broken`,explain:`The og:image address returned an error or isn’t a valid image, so previews show a blank box.`,fix:`Fix the og:image URL so it returns a PNG, JPEG or WebP image with a 200 response.`},"social-image-invalid":{level:`warning`,group:`social`,label:`Social image URL is not a full address`,explain:`og:image must be an absolute http(s) URL. Most platforms ignore relative paths.`,fix:`Use the full https:// address of the image.`},"social-image-unavailable":{level:`tip`,group:`social`,label:`Social image could not be verified`,explain:`The image is on another domain, redirected or is in a format Shapewall can’t decode, so its preview is not shown here.`,fix:`Nothing is necessarily wrong. Check a preview with the platform’s own debugger if in doubt.`},"social-image-dimensions":{level:`tip`,group:`social`,label:`Image size differs from its tags`,explain:`og:image:width and og:image:height don’t match the actual image, which can make previews crop or load late.`,fix:`Update the declared width and height to the real image size, or remove them.`}}),pe={error:0,warning:1,tip:2};function W(e){let t=e?.category===`seo`?U[e.id]:null;return t?t.level===`tip`?`advisory`:`warning`:e?.severity}Object.freeze(Object.keys(U));function G(e,t,n,r=()=>!0){let i=null;for(let a of e){if(a.pageId!==t)continue;let e=a.runs?.length?a.runs:a.report?[{runner:a.report.profile.runner,state:a.state,report:a.report}]:[];for(let t of e){let e=t.report;e&&(t.runner||e.profile.runner)===n&&r(e)&&(!i||e.auditedAt>i.report.auditedAt||e.auditedAt===i.report.auditedAt&&e.viewport.name===`desktop`)&&(i={report:e,stale:t.state===`stale`})}}return i}var me=e=>H(e).toLowerCase();function he({views:e=[],pages:t=[],snapshots:n={},privatePages:r=[]}={}){let i=new Set(r),a=t.map(t=>{let r=G(e,t.id,`playwright`,e=>e.profile.seo),a=r||G(e,t.id,`playwright`),o=G(e,t.id,`lighthouse`,e=>Number.isFinite(e.metrics?.lighthouseSeoLabScore)),s=r?.report||null,c=s&&n[s.id]||null,l=i.has(t.id)||!!s?.findings.some(e=>e.id===`seo-private-expected`),u={pageId:t.id,title:t.title||t.id,url:t.url||null,status:l?`private`:a?s?s.state===`failed`?`failed`:`checked`:`no-seo`:`not-run`,stale:!!r?.stale,report:s,snapshot:c,lighthouseSeo:o?o.report.metrics.lighthouseSeoLabScore:null,issues:[]};if(u.status===`checked`)for(let e of s.findings){let t=U[e.id];!t||e.id.startsWith(`duplicate-`)&&c||u.issues.push({id:e.id,...t,observation:e.observation,finding:e})}return u}),o={title:[],description:[]};for(let e of[`title`,`description`]){let t=new Map;for(let n of a){if(n.status!==`checked`||!n.snapshot)continue;let r=me(n.snapshot[e]);r&&(t.has(r)||t.set(r,[]),t.get(r).push(n))}for(let[,n]of t)if(!(n.length<2)){o[e].push({value:H(n[0].snapshot[e]),pageIds:n.map(e=>e.pageId)});for(let t of n){let r=n.filter(e=>e!==t).map(e=>e.title),i=`duplicate-${e}`;t.issues.push({id:i,...U[i],observation:`Also used on ${r.slice(0,3).join(`, `)}${r.length>3?` and ${r.length-3} more`:``}.`,finding:null,others:n.filter(e=>e!==t).map(e=>e.pageId)})}}}for(let e of[`title`,`description`])if(!o[e].length){let t=a.filter(t=>t.issues.some(t=>t.id===`duplicate-${e}`)).map(e=>e.pageId);t.length>1&&o[e].push({value:null,pageIds:t})}for(let e of a)e.issues.sort((e,t)=>pe[e.level]-pe[t.level]),e.errors=e.issues.filter(e=>e.level===`error`).length,e.warnings=e.issues.filter(e=>e.level===`warning`).length,e.tips=e.issues.filter(e=>e.level===`tip`).length,e.indexable=e.status===`checked`?!e.issues.some(e=>[`search-noindex`,`robots-crawl-blocked`,`canonical-elsewhere`].includes(e.id)):null;let s=a.filter(e=>e.status===`checked`),c=(e,...t)=>e.issues.some(e=>t.includes(e.id)),l=a.map(e=>e.lighthouseSeo).filter(e=>Number.isFinite(e));return{rows:a,summary:{pages:a.filter(e=>e.status!==`private`).length,checked:s.length,private:a.filter(e=>e.status===`private`).length,notChecked:a.filter(e=>[`not-run`,`no-seo`,`failed`].includes(e.status)).length,indexable:s.filter(e=>e.indexable).length,notIndexable:s.filter(e=>e.indexable===!1).length,missingTitles:s.filter(e=>c(e,`missing-title`)).length,missingDescriptions:s.filter(e=>c(e,`seo-description`)).length,duplicateTitles:o.title.reduce((e,t)=>e+t.pageIds.length,0),duplicateDescriptions:o.description.reduce((e,t)=>e+t.pageIds.length,0),socialImageProblems:s.filter(e=>c(e,`seo-ogimage`,`social-image-failed`,`social-image-invalid`)).length,canonicalIssues:s.filter(e=>c(e,`seo-canonical`,`canonical-invalid`,`canonical-elsewhere`)).length,robotsIssues:s.filter(e=>c(e,`search-noindex`,`robots-crawl-blocked`,`robots-unavailable`)).length,errors:s.reduce((e,t)=>e+t.errors,0),warnings:s.reduce((e,t)=>e+t.warnings,0),tips:s.reduce((e,t)=>e+t.tips,0),lighthouseSeo:l.length?{min:Math.min(...l),average:Math.round(l.reduce((e,t)=>e+t,0)/l.length),count:l.length}:null},duplicates:o}}function ge(e){try{let t=new URL(e),n=t.pathname.split(`/`).filter(Boolean).map(e=>{try{return decodeURIComponent(e)}catch{return e}});return{site:t.hostname.replace(/^www\./,``),origin:`${t.protocol}//${t.host}`,path:n}}catch{return{site:``,origin:``,path:[]}}}var _e=e=>JSON.stringify(e,(e,t)=>t&&typeof t==`object`&&!Array.isArray(t)?Object.fromEntries(Object.keys(t).sort().map(e=>[e,t[e]])):t),ve=(e,t)=>_e(e)===_e(t),K=e=>[`complete`,`partial`].includes(e.state),ye=e=>typeof e==`number`&&Number.isFinite(e);function be(e,t,{allowBuildChange:n=!1}={}){let r=[],i=e.profile,a=t.profile;for(let[n,i,a]of[[`page or environment`,[e.boardId,e.pageId,e.environment],[t.boardId,t.pageId,t.environment]],[`viewport`,e.viewport,t.viewport],[`observation window`,e.completeness.window,t.completeness.window],[`network coverage`,e.completeness.network,t.completeness.network],[`service worker state`,e.completeness.serviceWorker,t.completeness.serviceWorker]])ve(i,a)||r.push(`Different ${n}.`);let o=i.sourceBuild!==a.sourceBuild,s=o&&n&&!!(i.sourceBuild&&a.sourceBuild),c=[...new Set([...Object.keys(i),...Object.keys(a)])];for(let e of c)e===`sourceBuild`&&s||ve(i[e],a[e])||r.push(`Different ${e.replace(/([a-z])([A-Z])/g,`$1 $2`).toLowerCase()}.`);for(let e of[`browser`,`device`,`throttling`])i[e]&&a[e]||r.push(`Missing ${e} conditions in an older report.`);i.authRole!==`configured`&&a.authRole!==`configured`||i.authStateHash&&a.authStateHash||r.push(`Missing authentication state evidence.`),K(e)&&K(t)||r.push(`A run has no usable measurements.`);let l=r.length===0,u=[...new Set([...Object.keys(e.metrics),...Object.keys(t.metrics)])].map(n=>{let r=K(e)&&ye(e.metrics[n])?e.metrics[n]:null,i=K(t)&&ye(t.metrics[n])?t.metrics[n]:null,a=l&&r!==null&&i!==null?i-r:null,o=n.endsWith(`Ms`)?50:n.endsWith(`Bytes`)?1024:n===`cumulativeLayoutShift`?.01:1,s=a!==null&&(Math.abs(a)<o||Math.abs(a)<Math.abs(r)*.05);return{key:n,before:r,after:i,delta:a,percent:a===null||r===0?null:a/r*100,change:a===null?`unknown`:a===0?`unchanged`:s?`small`:a>0?`increased`:`decreased`}}),d=!ve(e.budgets,t.budgets),f=l&&e.state===`complete`&&t.state===`complete`&&!d,p=new Set(e.findings.map(e=>e.id)),m=new Set(t.findings.map(e=>e.id));return{comparable:l,reasons:r,buildChanged:o,declaredBuildChange:s,budgetsChanged:d,metrics:u,findingsComparable:f,added:f?t.findings.filter(e=>!p.has(e.id)):[],removed:f?e.findings.filter(e=>!m.has(e.id)):[],retained:f?t.findings.filter(e=>p.has(e.id)):[],changed:f?t.findings.filter(t=>{let n=e.findings.find(e=>e.id===t.id);return n&&(n.severity!==t.severity||n.title!==t.title)}):[]}}var q=e=>e.runs?.length?e.runs:e.report?[{report:e.report,state:e.state}]:[],xe=e=>q(e).reduce((e,t)=>e+t.report.findings.filter(e=>W(e)===`warning`).length,0),J=(e,t)=>e.state===t||q(e).some(e=>e.state===t||e.report.state===t);function Se(e,t=`problems`){let n=e=>{let t=q(e).find(e=>e.report.profile.runner===`lighthouse`),n=t?.report.metrics.largestContentfulPaintMs;return t&&K(t.report)&&ye(n)?n:-1},r=e=>J(e,`failed`)||J(e,`unsupported`)?4:xe(e)?3:J(e,`stale`)?2:+!!J(e,`partial`);return[...e].sort((e,i)=>(t===`lcp`?n(i)-n(e):r(i)-r(e)||xe(i)-xe(e))||e.pageId.localeCompare(i.pageId)||e.viewport.localeCompare(i.viewport))}var Y=[{id:`reliability`,label:`Reliability`,match:[`reliability`,`semantics`]},{id:`performance`,label:`Performance`,match:[`performance`]},{id:`accessibility`,label:`Accessibility`,match:[`accessibility`]},{id:`seo`,label:`SEO`,match:[`seo`]}],Ce=e=>Y.find(t=>t.match.includes(e.category))?.id||`reliability`,we={playwright:`Load and page basics`,lighthouse:`Lighthouse lab navigation`,"playwright-flow":`Explicit flow`,axe:`Accessibility snapshot`},Te={"not-run":`Not checked`,stale:`Stale`,failed:`Failed`,unsupported:`Unsupported`,partial:`Partial`,complete:`Complete`},X=e=>e.charAt(0).toUpperCase()+e.slice(1);function Ee(e,t=!0){let n=new Map;for(let r of e)for(let e of q(r))if(e.state!==`stale`&&e.report)for(let i of e.report.findings){let a=`${r.pageId}|${e.report.profile.runner}|${i.id}`,o=n.get(a),s=W(i);o?(o.viewports.includes(r.viewport)||o.viewports.push(r.viewport),s===`warning`&&(o.severity=`warning`)):n.set(a,{key:a,pageId:r.pageId,viewports:[r.viewport],view:r,report:e.report,finding:i,severity:s,category:Ce(i),canvasCapture:t&&r.canvasCapture!==!1})}return[...n.values()].sort((e,t)=>(e.severity===`warning`?0:1)-(t.severity===`warning`?0:1)||Y.findIndex(t=>t.id===e.category)-Y.findIndex(e=>e.id===t.category)||e.pageId.localeCompare(t.pageId))}var De=e=>{let t=e.filter(e=>typeof e==`number`&&Number.isFinite(e)).sort((e,t)=>e-t);if(!t.length)return null;let n=Math.floor(t.length/2);return Math.round(t.length%2?t[n]:(t[n-1]+t[n])/2)};function Oe(e,t){return e.map(e=>q(e).find(e=>e.report?.profile.runner===`lighthouse`&&e.state!==`stale`)).filter(e=>e&&[`complete`,`partial`].includes(e.report.state)).map(e=>e.report.metrics[t])}function ke(e,t){return Y.map(n=>{let r=t.filter(e=>e.category===n.id);return{...n,warnings:r.filter(e=>e.severity===`warning`).length,advisories:r.filter(e=>e.severity===`advisory`).length,score:n.id===`performance`?De(Oe(e,`lighthouseLabScore`)):n.id===`seo`?De(Oe(e,`lighthouseSeoLabScore`)):null}})}function Ae(e){return e==null?`Unknown`:e>=1e3?`${(e/1e3).toFixed(e>=1e4?0:1)} s`:`${Math.round(e)} ms`}function je(e){return e==null?`Unknown`:e<1024?`${Math.round(e)} B`:e<1048576?`${Math.round(e/1024)} KB`:`${(e/1024/1024).toFixed(1)} MB`}function Z(e,t){return t==null?`Unknown`:/Ms$/.test(e)?Ae(t):/Bytes$/.test(e)?je(t):e===`cumulativeLayoutShift`?t.toFixed(3).replace(/0+$/,``).replace(/\.$/,``):String(Math.round(t*100)/100)}var Me=e=>[`socialImageWidth`,`socialImageHeight`].includes(e)?`Declared social image ${e.endsWith(`Width`)?`width`:`height`}`:e===`robotsAllowed`?`Robots access (1 allowed, 0 blocked)`:e===`lighthouseLabScore`?`Lighthouse lab score (0-100)`:e===`lighthouseSeoLabScore`?`Lighthouse SEO lab score (0-100)`:X(e.replace(/Ms$/,``).replace(/Bytes$/,``).replace(/([a-z])([A-Z])/g,`$1 $2`).toLowerCase().trim()),Q=n(),Ne={reliability:O,performance:P,accessibility:F,seo:L};function Pe({score:e,size:t=36,label:n}){let r=(t-5)/2,i=2*Math.PI*r;return(0,Q.jsxs)(`span`,{className:f(`relative inline-grid shrink-0 place-items-center`,e===null?`text-faint`:e>=90?`text-ok`:e>=50?`text-warn`:`text-bad`),style:{width:t,height:t},children:[(0,Q.jsxs)(`svg`,{width:t,height:t,viewBox:`0 0 ${t} ${t}`,className:`-rotate-90`,"aria-hidden":`true`,children:[(0,Q.jsx)(`circle`,{cx:t/2,cy:t/2,r,fill:`none`,stroke:`currentColor`,strokeOpacity:`0.18`,strokeWidth:`3.5`}),e===null?null:(0,Q.jsx)(`circle`,{cx:t/2,cy:t/2,r,fill:`none`,stroke:`currentColor`,strokeWidth:`3.5`,strokeLinecap:`round`,strokeDasharray:`${i*e/100} ${i}`})]}),(0,Q.jsx)(`span`,{className:`absolute text-[11px] font-semibold text-fg tabular`,"aria-label":n,children:e===null?`--`:e})]})}function Fe({totals:e,active:t,onPick:n}){return(0,Q.jsx)(`div`,{className:`grid auto-rows-fr grid-cols-2 gap-2`,"data-sw-checks-summary":`true`,children:e.map(e=>{let r=Ne[e.id],i=e.warnings,a=t===e.id;return(0,Q.jsxs)(`button`,{type:`button`,"aria-pressed":a,onClick:()=>n(e.id),"data-sw-checks-tile":e.id,className:f(`flex min-h-16 items-center gap-2.5 rounded-lg border bg-surface px-2.5 py-2 text-left shadow-card transition-colors outline-none hover:bg-surface-2 focus-visible:outline-2 focus-visible:outline-accent`,a?`border-accent bg-accent/5`:`border-line`),children:[(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[(0,Q.jsxs)(`span`,{className:`flex items-center gap-1.5 text-[11px] font-medium text-muted`,children:[(0,Q.jsx)(r,{size:13,"aria-hidden":`true`}),e.label]}),(0,Q.jsx)(`span`,{className:`mt-0.5 block text-[15px] leading-5 font-semibold`,children:i?(0,Q.jsxs)(`span`,{className:e.id===`reliability`?`text-bad`:`text-warn`,children:[(0,Q.jsx)(`span`,{className:`tabular`,children:i}),` to fix`]}):e.unchecked?(0,Q.jsx)(`span`,{className:`text-muted`,children:`Not checked`}):(0,Q.jsx)(`span`,{className:`text-ok`,children:`No issues`})}),e.advisories?(0,Q.jsxs)(`span`,{className:`block text-[11px] text-muted`,children:[(0,Q.jsx)(`span`,{className:`tabular`,children:e.advisories}),` `,e.advisories===1?`note`:`notes`]}):null]}),e.id===`performance`||e.id===`seo`?(0,Q.jsx)(Pe,{score:e.score,label:e.score===null?`No Lighthouse score`:`Lighthouse ${e.label} ${e.score}`}):null]},e.id)})})}function Ie(e,t=Date.now()){let n=Math.max(0,(t-Date.parse(e))/1e3);return Number.isFinite(n)?n<60?`just now`:n<3600?`${Math.round(n/60)} min ago`:n<86400?`${Math.round(n/3600)} h ago`:new Date(e).toLocaleDateString():``}var Le={error:{icon:A,tone:`text-bad`,label:`Blocks search or sharing`},warning:{icon:S,tone:`text-warn`,label:`Should fix`},tip:{icon:E,tone:`text-accent`,label:`Tip`}},$=e=>e.status===`checked`?e.indexable===!1?`blocked`:e.errors||e.warnings?`work`:`ready`:e.status;function Re({command:e,local:n}){let[r,i]=(0,R.useState)(!1);return(0,Q.jsxs)(`section`,{className:`space-y-2 rounded-xl border border-dashed border-line p-3`,"data-sw-seo-not-checked":`true`,children:[(0,Q.jsxs)(`p`,{className:`flex items-center gap-2 text-sm font-medium`,children:[(0,Q.jsx)(L,{size:16,className:`text-accent`,"aria-hidden":`true`}),`SEO hasn’t been checked yet`]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted`,children:n?`Use Run checks above with Include SEO, set "checks": { "seo": true } in the config, or run:`:`Run this where the site is configured, then push the board with --include-checks:`}),(0,Q.jsxs)(`div`,{className:`flex items-stretch gap-1.5`,children:[(0,Q.jsx)(`code`,{className:`min-w-0 flex-1 rounded bg-surface-2 p-2 text-xs break-all`,children:e}),(0,Q.jsx)(t,{size:`xs`,variant:`secondary`,className:`h-11 lg:h-auto`,onClick:()=>{navigator.clipboard?.writeText(e).then(()=>i(!0),()=>i(!1))},children:r?`Copied`:`Copy`})]})]})}function ze({data:e,seo:t,pages:n,pageId:r,local:i,canComment:a,onView:o,onIssue:s,canFix:c,command:l}){let[u,d]=(0,R.useState)(`all`),f=(0,R.useMemo)(()=>he({views:e?.views||[],pages:n.map(e=>({id:e.id,title:e.title,url:e.url})),snapshots:t?.snapshots||{},privatePages:t?.privatePages||[]}),[e,t,n]),{summary:p}=f,m=f.rows.filter(e=>!r||e.pageId===r),h={all:m.length,work:m.filter(e=>[`work`,`blocked`].includes($(e))).length,ready:m.filter(e=>$(e)===`ready`).length,private:m.filter(e=>e.status===`private`).length},g={blocked:0,work:1,failed:2,"no-seo":3,"not-run":4,ready:5,private:6},v=m.filter(e=>{let t=$(e);return u===`all`||(u===`work`?[`work`,`blocked`].includes(t):u===`ready`?t===`ready`:t===u)}).sort((e,t)=>g[$(e)]-g[$(t)]||t.errors-e.errors||t.warnings-e.warnings);return(0,Q.jsxs)(`div`,{className:`sw-gutter-pad space-y-4 p-3 text-sm`,"data-sw-seo-view":`true`,children:[!p.checked&&l?(0,Q.jsx)(Re,{command:l,local:i}):null,!r&&p.checked?(0,Q.jsx)(Be,{summary:p}):null,(0,Q.jsx)(_,{label:`SEO pages`,value:u,onChange:d,variant:`underline`,options:[{id:`all`,label:`All`,count:h.all},{id:`work`,label:`Needs work`,count:h.work},{id:`ready`,label:`No issues`,count:h.ready},...h.private?[{id:`private`,label:`Private`,count:h.private}]:[]]}),v.length?null:(0,Q.jsx)(`p`,{className:`py-6 text-center text-xs text-muted`,children:`No pages match this filter.`}),v.map(e=>(0,Q.jsx)(He,{row:e,page:n.find(t=>t.id===e.pageId),local:i,canComment:a,canFix:c,onView:o,onIssue:s},e.pageId))]})}function Be({summary:e}){let{checked:t,indexable:n}=e,r=e.pages?Math.round(n/Math.max(1,e.pages)*100):0,i=e.duplicateTitles+e.duplicateDescriptions,a=[[`Missing titles`,e.missingTitles,e.missingTitles?`bad`:`ok`],[`Missing descriptions`,e.missingDescriptions,e.missingDescriptions?`warn`:`ok`],[`Duplicate titles or descriptions`,i,i?`warn`:`ok`],[`Social image problems`,e.socialImageProblems,e.socialImageProblems?`warn`:`ok`],[`Canonical issues`,e.canonicalIssues,e.canonicalIssues?`warn`:`ok`],[`Robots and indexing`,e.robotsIssues,e.robotsIssues?`bad`:`ok`]];return(0,Q.jsxs)(`section`,{className:`space-y-3 rounded-xl border border-line bg-surface p-3 shadow-card`,"data-sw-seo-summary":`true`,children:[(0,Q.jsxs)(`div`,{className:`flex items-end gap-3`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-muted`,children:`Indexable`}),(0,Q.jsxs)(`p`,{className:`mt-0.5 text-2xl leading-none font-semibold tracking-tight`,children:[(0,Q.jsx)(`span`,{className:`tabular`,"data-sw-seo-indexable":n,children:n}),(0,Q.jsxs)(`span`,{className:`text-base font-medium text-muted`,children:[` of `,e.pages,` pages`]})]})]}),(0,Q.jsxs)(`div`,{className:`text-right`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-muted`,children:`Lighthouse SEO`}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-2xl leading-none font-semibold tracking-tight tabular`,"data-sw-seo-lighthouse":`true`,children:e.lighthouseSeo?e.lighthouseSeo.average:`--`})]})]}),(0,Q.jsxs)(`div`,{className:`flex h-2 overflow-hidden rounded-full bg-surface-2`,role:`img`,"aria-label":`${n} of ${e.pages} public pages are indexable`,children:[(0,Q.jsx)(`span`,{className:`bg-ok`,style:{width:`${r}%`}}),(0,Q.jsx)(`span`,{className:`bg-bad`,style:{width:`${e.pages?e.notIndexable/e.pages*100:0}%`}})]}),(0,Q.jsxs)(`p`,{className:`text-xs text-muted`,children:[t,` of `,e.pages,` public pages checked`,e.notIndexable?` · ${e.notIndexable} kept out of search`:``,e.private?` · ${e.private} private, not meant for search`:``,e.lighthouseSeo?` · Lighthouse lowest ${e.lighthouseSeo.min}`:` · No Lighthouse SEO score yet (shapewall audit --seo)`]}),(0,Q.jsx)(`dl`,{className:`grid grid-cols-2 gap-2`,children:a.map(([e,n,r])=>(0,Q.jsxs)(`div`,{className:`rounded-lg bg-surface-2 px-2.5 py-2`,"data-sw-seo-tile":e,children:[(0,Q.jsxs)(`dt`,{className:`flex items-center gap-1.5 text-[11px] leading-4 text-muted`,children:[(0,Q.jsx)(`span`,{className:f(`size-1.5 shrink-0 rounded-full`,r===`ok`?`bg-ok`:r===`bad`?`bg-bad`:`bg-warn`),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`min-w-0`,children:e})]}),(0,Q.jsx)(`dd`,{className:`mt-0.5 text-lg leading-6 font-semibold tabular`,children:t?n:`--`})]},e))})]})}function Ve({row:e}){let t=$(e);return t===`private`?(0,Q.jsx)(v,{tone:`neutral`,children:`Private`}):t===`ready`?(0,Q.jsx)(v,{tone:`ok`,children:`No issues`}):t===`blocked`?(0,Q.jsx)(v,{tone:`bad`,children:`Not indexable`}):t===`work`?(0,Q.jsxs)(v,{tone:e.errors?`bad`:`warn`,children:[e.errors+e.warnings,` to fix`]}):t===`failed`?(0,Q.jsx)(v,{tone:`bad`,children:`Check failed`}):(0,Q.jsx)(v,{tone:`neutral`,children:`Not checked`})}function He({row:e,page:n,local:r,canComment:i,canFix:o,onView:s,onIssue:c}){let l=e.report?.viewport.name||n?.viewports?.[0]||`desktop`,u=n?.path||`/`;return(0,Q.jsxs)(`article`,{className:`overflow-hidden rounded-xl border border-line bg-surface shadow-card`,"data-sw-seo-page":e.pageId,"data-sw-seo-status":$(e),children:[(0,Q.jsxs)(`header`,{className:`flex items-start gap-2 px-3 pt-3 pb-2`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`h3`,{className:`truncate text-sm font-semibold`,children:e.title}),(0,Q.jsx)(`p`,{className:`truncate font-mono text-[11px] text-muted`,children:u})]}),e.lighthouseSeo===null?null:(0,Q.jsxs)(v,{tone:e.lighthouseSeo>=90?`ok`:e.lighthouseSeo>=50?`warn`:`bad`,className:`tabular`,children:[`SEO `,e.lighthouseSeo]}),(0,Q.jsx)(Ve,{row:e})]}),e.status===`private`?(0,Q.jsxs)(`div`,{className:`mx-3 mb-3 flex gap-2 rounded-lg bg-surface-2 p-2.5 text-xs text-muted`,children:[(0,Q.jsx)(M,{size:15,className:`mt-px shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`p`,{children:`Private, not meant for search. Search checks are skipped because this page is configured as not indexable.`})]}):e.status===`checked`?(0,Q.jsxs)(Q.Fragment,{children:[e.stale?(0,Q.jsx)(`p`,{className:`mx-3 mb-2 text-xs text-warn`,children:`The page or its settings changed since this check. Run checks again.`}):null,(0,Q.jsxs)(d,{defaultValue:`search`,className:`px-3`,children:[(0,Q.jsxs)(m,{variant:`underline`,"aria-label":`${e.title} preview`,children:[(0,Q.jsx)(g,{value:`search`,children:`Google result`}),(0,Q.jsx)(g,{value:`social`,children:`Share card`})]}),(0,Q.jsx)(a,{value:`search`,className:`pt-2`,children:e.snapshot?(0,Q.jsx)(Ge,{row:e,page:n}):(0,Q.jsx)(Ue,{local:r})}),(0,Q.jsx)(a,{value:`social`,className:`pt-2`,children:e.snapshot?(0,Q.jsx)(Ke,{row:e,page:n}):(0,Q.jsx)(Ue,{local:r})})]}),(0,Q.jsx)(`div`,{className:`space-y-2 p-3`,children:e.issues.length?(0,Q.jsx)(`ul`,{className:`space-y-2`,"aria-label":`${e.title} SEO issues`,children:e.issues.map(t=>(0,Q.jsx)(qe,{issue:t,onComment:i?()=>c(e,t,{fix:!1}):null,onFix:i&&o?()=>c(e,t,{fix:!0}):null},t.id))}):(0,Q.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-ok/10 p-2.5 text-xs`,"data-sw-seo-clean":`true`,children:[(0,Q.jsx)(k,{size:15,className:`shrink-0 text-ok`,"aria-hidden":`true`}),`Nothing to fix in the checks that ran.`]})})]}):(0,Q.jsxs)(`div`,{className:`mx-3 mb-3 flex gap-2 rounded-lg bg-surface-2 p-2.5 text-xs text-muted`,children:[(0,Q.jsx)(L,{size:15,className:`mt-px shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`p`,{children:e.status===`failed`?`The last SEO check of this page could not finish. Run checks again.`:e.status===`no-seo`?`Checked without SEO. Run checks with Include SEO to see its search result and share card.`:`Not checked yet. Run checks with Include SEO to see how this page shows in search.`})]}),(0,Q.jsxs)(`footer`,{className:`flex items-center gap-2 border-t border-line bg-surface-2/50 px-3 py-2`,children:[(0,Q.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-[11px] text-muted`,children:e.report?`Checked ${Ie(e.report.auditedAt)} · ${l}`:`No SEO check yet`}),(0,Q.jsx)(t,{size:`xs`,variant:`ghost`,className:`h-11 lg:h-7`,onClick:()=>s(e.pageId,l),children:`View page`})]})]})}function Ue({local:e}){return(0,Q.jsxs)(`div`,{className:`flex gap-2 rounded-lg border border-dashed border-line p-3 text-xs text-muted`,children:[(0,Q.jsx)(L,{size:15,className:`mt-px shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`p`,{children:e?`No preview for this check. Run checks with Include SEO to see the search result and share card.`:`Previews stay on the installation that ran the checks. The issues below came with the board.`})]})}function We(e,t){return!e.issues.some(e=>e.id===`canonical-elsewhere`)&&e.snapshot.canonical||t?.url||e.snapshot.url||``}function Ge({row:e,page:t}){let{snapshot:n}=e,r=ge(We(e,t)),i=n.social.siteName||r.site,a=n.title?fe(n.title,{size:V.titleFont,pixels:V.titlePixels}):null,o=n.description?fe(n.description,{size:V.descriptionFont,pixels:V.descriptionPixels}):null;return(0,Q.jsxs)(`figure`,{className:`rounded-lg border border-line bg-surface p-3`,"data-sw-seo-serp":e.pageId,children:[(0,Q.jsx)(`figcaption`,{className:`sr-only`,children:`Approximate Google desktop result`}),(0,Q.jsxs)(`div`,{className:`flex items-center gap-2.5`,children:[(0,Q.jsx)(`span`,{className:`grid bg-[#e8eaed] text-[#202124] [:root[data-mode=dark]_&]:bg-[#3c4043] [:root[data-mode=dark]_&]:text-[#dadce0] size-7 shrink-0 place-items-center rounded-full text-xs font-semibold uppercase`,"aria-hidden":`true`,children:(i||`?`).slice(0,1)}),(0,Q.jsxs)(`div`,{className:`min-w-0 leading-tight`,children:[(0,Q.jsx)(`p`,{className:`truncate text-[#202124] [:root[data-mode=dark]_&]:text-[#dadce0] text-[13px]`,children:i||`Unknown site`}),(0,Q.jsxs)(`p`,{className:`truncate text-[#4d5156] [:root[data-mode=dark]_&]:text-[#bdc1c6] text-[11.5px]`,children:[r.origin,r.path.length?` › ${r.path.join(` › `)}`:``]})]})]}),(0,Q.jsx)(`p`,{className:f(`mt-2 font-[Arial,Helvetica,sans-serif] text-[#1a0dab] [:root[data-mode=dark]_&]:text-[#99c3ff] line-clamp-2 text-[18px] leading-6`,!a&&`italic opacity-70`),"data-sw-seo-serp-title":`true`,children:a?a.text:`No title: Google writes one from the page`}),(0,Q.jsx)(`p`,{className:f(`mt-1 font-[Arial,Helvetica,sans-serif] text-[#474747] [:root[data-mode=dark]_&]:text-[#bfbfbf] text-ui`,!o&&`italic`),"data-sw-seo-serp-description":`true`,children:o?o.text:`No description: Google picks text from the page, often a menu or banner.`}),a?.cut||o?.cut?(0,Q.jsxs)(`p`,{className:`mt-2 text-[11px] text-muted`,children:[`Cut where Google’s desktop result is likely to cut it (`,a?.cut?`title`:``,a?.cut&&o?.cut?` and `:``,o?.cut?`description`:``,`).`]}):null]})}function Ke({row:e,page:t}){let{snapshot:n}=e,r=ge(We(e,t)),i=n.social.title||n.title,a=n.social.description||n.description,o=[!n.social.title&&n.title?`page title`:null,!n.social.description&&n.description?`meta description`:null].filter(Boolean);return(0,Q.jsxs)(`figure`,{"data-sw-seo-social":e.pageId,children:[(0,Q.jsxs)(`div`,{className:`overflow-hidden rounded-lg border border-line bg-surface`,children:[n.image?(0,Q.jsx)(`img`,{src:n.image.dataUrl,alt:`Share image for ${e.title}`,className:`aspect-[1200/630] w-full bg-surface-2 object-cover`,"data-sw-seo-social-image":`true`}):(0,Q.jsx)(`div`,{className:`grid aspect-[1200/630] w-full place-items-center bg-surface-2 text-muted`,children:(0,Q.jsxs)(`span`,{className:`flex flex-col items-center gap-1.5 text-xs`,children:[(0,Q.jsx)(T,{size:20,"aria-hidden":`true`}),n.social.image?`Image not previewed here`:`No share image`]})}),(0,Q.jsxs)(`div`,{className:`space-y-0.5 border-t border-line px-3 py-2.5`,children:[(0,Q.jsx)(`p`,{className:`truncate text-[11px] tracking-wide text-muted uppercase`,children:r.site||`unknown site`}),(0,Q.jsx)(`p`,{className:f(`line-clamp-2 text-sm leading-5 font-semibold`,!i&&`text-muted italic`),children:i||`No title`}),a?(0,Q.jsx)(`p`,{className:`line-clamp-2 text-xs leading-4 text-muted`,children:a}):null]})]}),(0,Q.jsxs)(`figcaption`,{className:`mt-1.5 text-[11px] text-muted`,children:[`Large link preview as most apps show it`,n.social.card?` · twitter:card ${n.social.card}`:``,o.length?` · using the ${o.join(` and `)}`:``,n.social.image&&!n.image?` · the image is on another site or could not be decoded`:``,`.`]})]})}function qe({issue:e,onComment:n,onFix:r}){let i=Le[e.level],a=i.icon;return(0,Q.jsxs)(`li`,{className:`rounded-lg border border-line p-2.5`,"data-sw-seo-issue":e.id,"data-sw-seo-level":e.level,children:[(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(a,{size:16,className:f(`mt-0.5 shrink-0`,i.tone),"aria-label":i.label,role:`img`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,Q.jsx)(`p`,{className:`text-sm leading-5 font-medium`,children:e.label}),(0,Q.jsx)(`p`,{className:`text-xs leading-4 text-muted`,children:e.explain}),e.id.startsWith(`duplicate-`)&&e.observation?(0,Q.jsx)(`p`,{className:`text-xs leading-4`,children:e.observation}):null,(0,Q.jsxs)(`p`,{className:`text-xs leading-4`,children:[(0,Q.jsx)(`span`,{className:`font-semibold`,children:`How to fix: `}),e.fix]})]})]}),n||r?(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-1.5`,children:[n?(0,Q.jsxs)(t,{size:`xs`,variant:`ghost`,className:`h-11 lg:h-7`,onClick:n,"data-sw-seo-comment":e.id,children:[(0,Q.jsx)(C,{size:14,"aria-hidden":`true`}),` Comment`]}):null,r?(0,Q.jsxs)(t,{size:`xs`,variant:`secondary`,className:`h-11 lg:h-7`,onClick:r,"data-sw-seo-fix-agent":e.id,children:[(0,Q.jsx)(o,{size:14,"aria-hidden":`true`}),` Fix with agent`]}):null]}):null]})}function Je({control:e,pages:n,pageId:r,tab:i}){let[a,o]=(0,R.useState)(!1),[c,l]=(0,R.useState)(r?`page`:`all`),[u,d]=(0,R.useState)(!0);if(!e||e.loading)return null;let{run:m}=e,h=e=>n.find(t=>t.id===e)?.title||e;if(m?.state===`running`){let n=m.total?Math.round(m.done/m.total*100):0;return(0,Q.jsxs)(`div`,{className:`space-y-2 rounded-lg border border-accent/40 bg-accent/5 p-3`,"data-sw-checks-run-progress":`true`,"aria-live":`polite`,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-sm`,children:[(0,Q.jsx)(`span`,{className:`text-accent`,children:(0,Q.jsx)(s,{size:14})}),(0,Q.jsx)(`p`,{className:`min-w-0 flex-1 truncate font-medium`,children:m.stopping?`Stopping…`:m.current?`Checking ${h(m.current.pageId)} · ${m.current.viewport}`:`Starting the browser…`}),(0,Q.jsxs)(`span`,{className:`text-xs text-muted tabular`,children:[m.done,` of `,m.total]}),e.canRun&&e.stop?(0,Q.jsxs)(t,{size:`xs`,variant:`ghost`,className:`h-11 px-2 lg:h-7`,disabled:e.stopping||m.stopping,onClick:e.stop,"data-sw-checks-run-stop":`true`,children:[e.stopping||m.stopping?(0,Q.jsx)(s,{size:13}):(0,Q.jsx)(ne,{size:12,"aria-hidden":`true`}),` Stop`]}):null]}),(0,Q.jsx)(`div`,{className:`h-1.5 overflow-hidden rounded-full bg-surface-2`,role:`progressbar`,"aria-label":`Checks progress`,"aria-valuemin":0,"aria-valuemax":m.total,"aria-valuenow":m.done,children:(0,Q.jsx)(`span`,{className:`block h-full rounded-full bg-accent transition-[width] duration-(--motion-slow)`,style:{width:`${Math.max(4,n)}%`}})}),(0,Q.jsxs)(`p`,{className:`text-xs text-muted`,children:[m.seo?`Page checks with SEO`:`Page checks`,` · one page at a time, reusing configured sign-in and page actions.`]})]})}if(!e.canRun)return(0,Q.jsxs)(`p`,{className:`flex gap-2 text-xs text-muted`,"data-sw-checks-run-locked":`true`,children:[(0,Q.jsx)(re,{size:14,className:`mt-px shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:e.reason||`Run checks in the installation terminal.`})]});let g=c===`page`&&r?n.filter(e=>e.id===r):n,v=g.reduce((e,t)=>e+(t.viewports?.length||1),0),y=g.filter(t=>e.privatePages.includes(t.id)).length,b=m&&m.state!==`running`?m:null;return(0,Q.jsxs)(`div`,{className:`space-y-2`,"data-sw-checks-run":`true`,children:[b&&!a?(0,Q.jsx)(Ye,{run:b}):null,e.error?(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-bad`,children:e.error}):null,a?(0,Q.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-line bg-surface-2/60 p-3`,"data-sw-checks-run-options":`true`,children:[r?(0,Q.jsx)(_,{label:`Pages to check`,value:c,onChange:l,variant:`underline`,options:[{id:`page`,label:h(r)},{id:`all`,label:`All ${n.length} pages`}]}):null,(0,Q.jsxs)(p,{pressed:u,onPressedChange:d,size:`touch`,className:`h-auto min-h-11 w-full justify-start gap-2.5 py-2 text-left whitespace-normal lg:min-h-9`,"data-sw-checks-run-seo":u?`on`:`off`,children:[(0,Q.jsx)(`span`,{className:f(`grid size-4 shrink-0 place-items-center rounded border`,u?`border-accent bg-accent text-accent-fg`:`border-line bg-surface`),"aria-hidden":`true`,children:u?(0,Q.jsx)(k,{size:12,strokeWidth:3}):null}),(0,Q.jsxs)(`span`,{className:`min-w-0`,children:[(0,Q.jsx)(`span`,{className:`block text-sm font-medium text-fg`,children:`Include SEO`}),(0,Q.jsxs)(`span`,{className:`block text-xs font-normal text-muted`,children:[`Titles, descriptions, robots, canonical and share images on public pages.`,y?` ${y} private page${y===1?` is`:`s are`} skipped.`:``]})]})]}),(0,Q.jsxs)(`p`,{className:`text-xs text-muted`,children:[v,` page view`,v===1?``:`s`,`, checked one at a time against the original site. Configured sign-in and page actions run again, so use test accounts for pages that change data.`]}),v>e.limit?(0,Q.jsxs)(`p`,{className:`text-xs text-bad`,children:[`A run from the board checks at most `,e.limit,` page views. Pick one page or use the terminal.`]}):null,(0,Q.jsxs)(`div`,{className:`flex justify-end gap-2`,children:[(0,Q.jsx)(t,{size:`xs`,variant:`ghost`,className:`h-11 lg:h-8`,onClick:()=>o(!1),children:`Cancel`}),(0,Q.jsxs)(t,{size:`xs`,variant:`default`,className:`h-11 px-3 lg:h-8`,disabled:e.starting||v>e.limit,onClick:async()=>{await e.start({pages:c===`page`&&r?[r]:null,seo:u})&&o(!1)},"data-sw-checks-run-start":`true`,children:[e.starting?(0,Q.jsx)(s,{size:13}):(0,Q.jsx)(D,{size:14,"aria-hidden":`true`}),` Start checks`]})]})]}):(0,Q.jsxs)(t,{size:`xs`,variant:i===`seo`?`default`:`secondary`,className:`h-11 w-full lg:h-8`,onClick:()=>{l(r?`page`:`all`),d(e.seoDefault!==!1),o(!0)},"data-sw-checks-run-open":`true`,children:[(0,Q.jsx)(D,{size:14,"aria-hidden":`true`}),` `,b?`Run checks again`:`Run checks`]})]})}function Ye({run:e}){let t=e.state===`complete`?`ok`:e.state===`partial`||e.state===`stopped`?`warn`:`bad`,n=t===`ok`?k:t===`warn`?S:A;return(0,Q.jsxs)(`p`,{className:f(`flex items-start gap-2 rounded-lg px-2.5 py-2 text-xs`,t===`ok`?`bg-ok/10`:t===`warn`?`bg-warn/15`:`bg-bad/10`),"data-sw-checks-run-result":e.state,role:`status`,children:[(0,Q.jsx)(n,{size:15,className:f(`mt-px shrink-0`,t===`ok`?`text-ok`:t===`warn`?`text-warn`:`text-bad`),"aria-hidden":`true`}),(0,Q.jsxs)(`span`,{className:`min-w-0 flex-1`,children:[e.message,e.finishedAt?(0,Q.jsxs)(`span`,{className:`text-muted`,children:[` · `,Ie(e.finishedAt)]}):null]})]})}function Xe({label:e,children:t,defaultOpen:n=!1,className:r,...i}){let[a,o]=(0,R.useState)(n),s=(0,R.useId)();return(0,Q.jsxs)(`div`,{className:f(`text-xs`,r),...i,children:[(0,Q.jsxs)(`button`,{type:`button`,"aria-expanded":a,"aria-controls":s,onClick:()=>o(e=>!e),className:`flex min-h-11 w-full items-center gap-1.5 rounded-md text-left font-medium text-muted outline-none hover:text-fg focus-visible:outline-2 focus-visible:outline-accent lg:min-h-7`,children:[(0,Q.jsx)(b,{size:14,className:f(`shrink-0 transition-transform`,a?`rotate-0`:`-rotate-90`),"aria-hidden":`true`}),e]}),a?(0,Q.jsx)(`div`,{id:s,className:`pt-1 pb-1`,children:t}):null]})}var Ze=e=>`${new Date(e.auditedAt).toLocaleString()} · ${e.state} · ${e.profile.sourceBuild?`build ${e.profile.sourceBuild.slice(0,8)}`:`build undeclared`} · ${e.id.slice(-4)}`;function Qe({views:e,pages:t}){let n=e.flatMap(e=>q(e).filter(e=>(e.history?.length||0)>1).map(t=>({key:`${e.pageId}|${e.viewport}|${t.report.profile.runner}`,view:e,run:t}))),[r,a]=(0,R.useState)(null),o=n.find(e=>e.key===r)||n[0];if(!o)return(0,Q.jsxs)(`div`,{className:`flex gap-2 rounded-lg border border-dashed border-line p-3 text-xs text-muted`,"data-sw-checks-history":`true`,children:[(0,Q.jsx)(te,{size:15,className:`mt-px shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`p`,{children:`No page has two retained reports from the same runner yet. Run checks again to compare before and after.`})]});let s=e=>t.find(t=>t.id===e)?.title||e;return(0,Q.jsxs)(`div`,{className:`space-y-3`,"data-sw-checks-history":`true`,children:[(0,Q.jsxs)(y,{value:o.key,onValueChange:a,children:[(0,Q.jsx)(l,{className:`h-11 w-full lg:h-8`,"aria-label":`History page and runner`,children:(0,Q.jsx)(i,{})}),(0,Q.jsx)(c,{children:n.map(e=>(0,Q.jsxs)(h,{value:e.key,children:[s(e.view.pageId),` · `,X(e.view.viewport),` · `,we[e.run.report.profile.runner]||e.run.report.profile.runner]},e.key))})]}),(0,Q.jsx)($e,{run:o.run},o.key)]})}function $e({run:e}){let[t,n]=(0,R.useState)(null),[r,a]=(0,R.useState)(`none`),[o,s]=(0,R.useState)(!1),u=e.history,d=u.find(e=>e.id===t)||e.report,f=u.find(e=>e.id===r&&e.id!==d.id);return(0,Q.jsxs)(`div`,{className:`space-y-3 rounded-lg border border-line bg-surface p-3 shadow-card text-xs`,"data-sw-check-report":d.id,children:[(0,Q.jsxs)(`p`,{className:`text-muted`,children:[u.length,` retained reports for this runner and device. Screenshots may have expired.`]}),(0,Q.jsxs)(`label`,{className:`block space-y-1`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`After`}),(0,Q.jsxs)(y,{value:d.id,onValueChange:e=>{n(e),a(`none`)},children:[(0,Q.jsx)(l,{className:`h-11 w-full lg:h-8`,"aria-label":`After report`,children:(0,Q.jsx)(i,{})}),(0,Q.jsx)(c,{children:u.map(e=>(0,Q.jsx)(h,{value:e.id,children:Ze(e)},e.id))})]})]}),(0,Q.jsxs)(`label`,{className:`block space-y-1`,children:[(0,Q.jsx)(`span`,{className:`font-medium`,children:`Before`}),(0,Q.jsxs)(y,{value:r,onValueChange:a,children:[(0,Q.jsx)(l,{className:`h-11 w-full lg:h-8`,"aria-label":`Before report`,children:(0,Q.jsx)(i,{placeholder:`Choose a baseline`})}),(0,Q.jsxs)(c,{children:[(0,Q.jsx)(h,{value:`none`,children:`Choose a baseline`}),u.filter(e=>e.id!==d.id).map(e=>(0,Q.jsx)(h,{value:e.id,children:Ze(e)},e.id))]})]})]}),d.id===e.report.id?null:(0,Q.jsx)(`p`,{className:`font-medium`,children:`Historical report; current page state is not verified.`}),d.findings.length?(0,Q.jsx)(`ul`,{className:`space-y-1`,children:d.findings.map(e=>(0,Q.jsxs)(`li`,{className:`flex gap-1.5`,children:[(0,Q.jsx)(`span`,{className:W(e)===`warning`?`text-warn`:`text-muted`,"aria-hidden":`true`,children:`•`}),(0,Q.jsx)(`span`,{children:e.title})]},e.id))}):(0,Q.jsx)(`p`,{className:`text-muted`,children:`No findings in this report.`}),f?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(p,{pressed:o,onPressedChange:s,size:`touch`,className:`h-auto min-h-11 w-full justify-start py-2 text-left whitespace-normal`,children:`Allow declared build as the changed variable`}),(0,Q.jsx)(et,{before:f,after:d,allowBuildChange:o})]}):null]})}function et({before:e,after:t,allowBuildChange:n}){let r=be(e,t,{allowBuildChange:n});return(0,Q.jsxs)(`div`,{className:`space-y-2`,"data-sw-check-comparison":`true`,"aria-live":`polite`,children:[(0,Q.jsx)(`p`,{className:`font-semibold`,children:`Before → After`}),r.comparable?(0,Q.jsxs)(`p`,{className:`text-muted`,children:[r.declaredBuildChange?`Declared build changed; all other recorded conditions match.`:`Recorded measurement conditions match.`,` `,`Repeat the same profile before calling a change a regression.`]}):(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`p`,{children:`These reports cannot be compared under the selected conditions.`}),(0,Q.jsx)(`ul`,{className:`list-disc pl-4 text-muted`,children:r.reasons.map(e=>(0,Q.jsx)(`li`,{children:e},e))})]}),(0,Q.jsx)(`div`,{className:`space-y-1.5`,children:r.metrics.map(e=>(0,Q.jsxs)(`div`,{className:`flex items-baseline gap-2 rounded-md bg-surface-2 px-2 py-1.5`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 break-words`,children:Me(e.key)}),(0,Q.jsxs)(`span`,{className:`tabular`,children:[Z(e.key,e.before),` → `,Z(e.key,e.after)]}),(0,Q.jsx)(`span`,{className:`text-muted tabular`,children:e.delta===null?`unknown`:`${e.delta>0?`+`:``}${Math.round(e.delta*100)/100}${e.change===`small`?` (small)`:``}`})]},e.key))}),r.findingsComparable?(0,Q.jsxs)(`p`,{children:[`Findings: `,r.added.length,` newly observed · `,r.removed.length,` no longer observed · `,r.retained.length,` `,`still observed.`]}):(0,Q.jsxs)(`p`,{className:`text-muted`,children:[`Finding changes are unknown:`,` `,r.budgetsChanged?`recorded budget policy changed.`:`both reports must be complete and comparable.`]})]})}function tt({issues:e,pages:n,category:r,onCategory:i,onView:a,onDraft:o,canComment:s,onSeo:c}){let l=e.filter(e=>r===`all`||e.category===r),u=l.filter(e=>e.severity===`warning`),d=l.filter(e=>e.severity!==`warning`),f=e=>n.find(t=>t.id===e)?.title||e;return(0,Q.jsxs)(`div`,{className:`space-y-3`,"data-sw-checks-issues":`true`,children:[r===`all`?null:(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 text-xs`,children:[(0,Q.jsxs)(`p`,{className:`min-w-0 flex-1 text-muted`,children:[`Showing `,(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:Y.find(e=>e.id===r)?.label}),` only`]}),(0,Q.jsx)(t,{size:`xs`,variant:`ghost`,className:`h-11 lg:h-7`,onClick:()=>i(`all`),"data-sw-checks-show-all":`true`,children:`Show all`})]}),l.length?null:(0,Q.jsxs)(`p`,{className:`flex items-center gap-2 rounded-lg bg-ok/10 p-3 text-xs`,children:[(0,Q.jsx)(k,{size:15,className:`shrink-0 text-ok`,"aria-hidden":`true`}),`No findings in the checks that ran`,r===`all`?``:` for ${Y.find(e=>e.id===r)?.label}`,`. Pages that were not checked are listed under Pages.`]}),u.length?(0,Q.jsxs)(`section`,{className:`space-y-2`,"aria-label":`Needs attention`,children:[(0,Q.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold`,children:[(0,Q.jsx)(S,{size:14,className:`text-warn`,"aria-hidden":`true`}),`Needs attention `,(0,Q.jsx)(`span`,{className:`font-normal text-muted tabular`,children:u.length})]}),u.map(e=>(0,Q.jsx)(nt,{issue:e,title:f(e.pageId),onView:a,onDraft:o,canComment:s,onSeo:c},e.key))]}):null,d.length?u.length?(0,Q.jsx)(Xe,{label:`Notes (${d.length})`,"data-sw-checks-notes":`true`,children:(0,Q.jsx)(`div`,{className:`space-y-2`,children:d.map(e=>(0,Q.jsx)(nt,{issue:e,title:f(e.pageId),onView:a,onDraft:o,canComment:s,onSeo:c},e.key))})}):(0,Q.jsxs)(`section`,{className:`space-y-2`,"aria-label":`Notes`,children:[(0,Q.jsxs)(`h3`,{className:`flex items-center gap-1.5 text-xs font-semibold`,children:[(0,Q.jsx)(w,{size:14,className:`text-muted`,"aria-hidden":`true`}),`Notes `,(0,Q.jsx)(`span`,{className:`font-normal text-muted tabular`,children:d.length})]}),d.map(e=>(0,Q.jsx)(nt,{issue:e,title:f(e.pageId),onView:a,onDraft:o,canComment:s,onSeo:c},e.key))]}):null]})}function nt({issue:e,title:n,onView:r,onDraft:i,canComment:a,onSeo:o}){let{finding:s}=e,c=e.severity===`warning`,l=c?e.category===`reliability`?A:S:w;return(0,Q.jsxs)(`article`,{className:`rounded-lg border border-line bg-surface p-2.5 shadow-card`,"data-sw-check-finding":s.id,"data-sw-check-issue":e.key,children:[(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(l,{size:16,className:f(`mt-0.5 shrink-0`,c?e.category===`reliability`?`text-bad`:`text-warn`:`text-muted`),"aria-label":c?`Needs attention`:`Note`,role:`img`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-1`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5 text-[11px] text-muted`,children:[(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:n}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Q.jsx)(`span`,{children:e.viewports.map(X).join(`, `)}),(0,Q.jsx)(v,{tone:`neutral`,shape:`tag`,children:e.category})]}),(0,Q.jsx)(`h4`,{className:`text-sm leading-5 font-medium`,children:s.title}),(0,Q.jsx)(`p`,{className:`text-xs leading-4 text-muted`,children:s.observation}),(0,Q.jsx)(`p`,{className:`text-xs leading-4`,children:s.nextAction})]})]}),(0,Q.jsxs)(`div`,{className:`mt-2 flex flex-wrap justify-end gap-1.5`,children:[e.category===`seo`&&o?(0,Q.jsx)(t,{size:`xs`,variant:`ghost`,className:`h-11 lg:h-7`,onClick:()=>o(e.pageId),children:`See in SEO`}):null,(0,Q.jsx)(t,{size:`xs`,variant:`ghost`,className:`h-11 lg:h-7`,disabled:!e.canvasCapture,onClick:()=>r(e.pageId,e.viewports[0]),children:`View page`}),a&&e.canvasCapture?(0,Q.jsx)(t,{size:`xs`,variant:`secondary`,className:`h-11 lg:h-7`,onClick:()=>i(e.view,e.report,s),children:`Create comment`}):null]})]})}var rt=e=>e===`complete`?`ok`:e===`failed`||e===`unsupported`?`bad`:e===`not-run`?`neutral`:`warn`;function it(e){let t=e.metrics;return e.profile.runner===`lighthouse`&&t.lighthouseLabScore!==void 0?`Score ${t.lighthouseLabScore??`--`} · LCP ${Z(`largestContentfulPaintMs`,t.largestContentfulPaintMs??null)}`:e.profile.runner===`axe`?`${t.violationRules??`--`} rules failing · ${t.scannedElements??`--`} elements`:e.profile.runner===`playwright-flow`?`${t.completedSteps??`--`} of ${t.configuredSteps??`--`} steps · ${Z(`flowDurationMs`,t.flowDurationMs??null)}`:`Load ${Z(`loadMs`,t.loadMs??null)} · ${t.requestCount??`--`} requests`}function at({views:e,pages:n,onView:r}){return(0,Q.jsxs)(`div`,{className:`space-y-3`,"data-sw-checks-pages":`true`,children:[e.length?null:(0,Q.jsx)(`p`,{className:`py-6 text-center text-xs text-muted`,children:`No pages match this filter.`}),e.map(e=>{let i=n.find(t=>t.id===e.pageId)?.title||e.pageId,a=q(e);return(0,Q.jsxs)(`article`,{className:`space-y-2 rounded-lg border border-line bg-surface p-3 shadow-card`,"data-sw-checks-view":`${e.pageId}|${e.viewport}`,children:[(0,Q.jsxs)(`header`,{className:`flex items-start gap-2`,children:[(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`h3`,{className:`truncate text-sm font-semibold`,children:i}),(0,Q.jsx)(`p`,{className:`text-xs text-muted`,children:X(e.viewport)})]}),(0,Q.jsx)(v,{tone:rt(e.state),children:Te[e.state]||e.state})]}),e.canvasCapture===!1?(0,Q.jsx)(`p`,{className:`text-xs text-muted`,children:`Diagnostics only: this environment is not the canvas capture, so pins are off.`}):null,e.state===`stale`?(0,Q.jsx)(`p`,{className:`text-xs text-warn`,children:`The page or its settings changed since this run. Run checks again before relying on it.`}):null,a.length?null:(0,Q.jsx)(`p`,{className:`text-xs text-muted`,children:`Not checked yet for this screen size. This does not mean it passed.`}),a.length?(0,Q.jsx)(`ul`,{className:`divide-y divide-line rounded-md border border-line`,children:a.map(e=>{let t=e.report,n=t.profile.runner,r=e.state||t.state;return(0,Q.jsxs)(`li`,{className:`space-y-1 px-2.5 py-2`,"data-sw-check-report":t.id,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,Q.jsx)(`p`,{className:`min-w-0 flex-1 truncate text-xs font-medium`,children:we[n]||n}),(0,Q.jsx)(v,{tone:rt(r),children:Te[r]||r})]}),(0,Q.jsxs)(`p`,{className:`text-xs text-muted tabular`,children:[it(t),e.actionable?` · ${e.actionable} to fix`:``]}),(0,Q.jsx)(Xe,{label:`Technical details`,children:(0,Q.jsx)(ot,{report:t})})]},n)})}):null,(0,Q.jsx)(`div`,{className:`flex justify-end`,children:(0,Q.jsx)(t,{disabled:e.canvasCapture===!1,size:`xs`,className:`h-11 lg:h-7`,variant:`secondary`,onClick:()=>r(e.pageId,e.viewport),children:`View page`})})]},`${e.pageId}-${e.viewport}`)})]})}function ot({report:e}){let t=e.profile,n=[...Object.entries(e.metrics).map(([e,t])=>[Me(e),Z(e,t)]),[`Viewport`,`${e.viewport.width} × ${e.viewport.height}`],[`Environment`,t.sourceEnvironment||e.environment],[`Checked`,new Date(e.auditedAt).toLocaleString()],[`Runner`,`${t.runner} ${t.version}`],[`Cache`,t.cache],[`Sign-in`,t.authRole===`configured`?`Configured`:`Anonymous`],[`Build`,t.sourceBuild?`${t.production} · ${t.sourceBuild.slice(0,8)}`:`${t.production} · undeclared`],[`Network`,e.completeness.network],[`Service worker`,e.completeness.serviceWorker===null?`Unknown`:e.completeness.serviceWorker?`Controlled`:`Not controlled`],...t.browser?[[`Browser`,t.browser.version]]:[],...t.throttling?[[`Throttling`,`${t.throttling.method} · ${t.throttling.rttMs??`?`} ms · ${t.throttling.throughputKbps??`?`} Kbps · CPU ${t.throttling.cpuSlowdownMultiplier??`?`}×`]]:[],[`SEO checks`,t.seo?`On`:`Off`],[`Report`,e.id],[`Capture`,e.captureVersion||`Unassociated`]];return(0,Q.jsxs)(`div`,{className:`space-y-2`,children:[(0,Q.jsx)(`dl`,{className:`grid grid-cols-[minmax(0,1fr)_auto] gap-x-3 gap-y-1`,children:n.map(([e,t])=>(0,Q.jsxs)(`div`,{className:`contents`,children:[(0,Q.jsx)(`dt`,{className:`break-words text-muted`,children:e}),(0,Q.jsx)(`dd`,{className:`max-w-48 truncate text-right tabular`,children:t})]},e))}),e.completeness.limitations.length?(0,Q.jsx)(`ul`,{className:`list-disc space-y-0.5 pl-4 text-muted`,children:e.completeness.limitations.map((e,t)=>(0,Q.jsx)(`li`,{children:e},t))}):null]})}var st=Object.freeze({ttfbMs:`Time to first byte (ms)`,loadMs:`Load (ms)`,domContentLoadedMs:`DOM content loaded (ms)`,documentTransferBytes:`Document transfer (bytes)`,resourceTransferBytes:`Resource transfer (bytes)`,resourceDecodedBytes:`Decoded resources (bytes)`,requestCount:`Requests`,largestContentfulPaintMs:`Largest contentful paint (ms)`,firstContentfulPaintMs:`First contentful paint (ms)`,totalBlockingTimeMs:`Total blocking time (ms)`,cumulativeLayoutShift:`Cumulative layout shift`,transferredResourceBytes:`Transferred resources (bytes)`,observedRequests:`Observed requests`,speedIndexMs:`Speed index (ms)`});function ct(e){return Object.entries(e.budgets?.thresholds||{}).map(([t,n])=>{let r=e.metrics[t],i=[`complete`,`partial`].includes(e.state)&&typeof r==`number`&&Number.isFinite(r)?r:null;return{metric:t,limit:n,value:i,state:i===null?`unknown`:i>n?`over`:`within`}})}var lt=[[`largestContentfulPaintMs`,`LCP`,2500,4e3],[`totalBlockingTimeMs`,`TBT`,200,600],[`cumulativeLayoutShift`,`CLS`,.1,.25]],ut=(e,t,n)=>e==null?`text-faint`:e<=t?`text-ok`:e<=n?`text-warn`:`text-bad`;function dt({views:e,pages:t}){let[n,r]=(0,R.useState)(`lcp`),i=e.map(e=>({view:e,run:q(e).find(e=>e.report?.profile.runner===`lighthouse`),load:q(e).find(e=>e.report?.profile.runner===`playwright`)})).filter(e=>e.run||e.load),a=e=>e.run?.report.metrics.largestContentfulPaintMs??-1,o=e=>e.run?.report.metrics.lighthouseLabScore??101;return i.sort((e,t)=>n===`lcp`?a(t)-a(e):o(e)-o(t)),(0,Q.jsxs)(`div`,{className:`space-y-3`,"data-sw-checks-performance":`true`,children:[(0,Q.jsx)(_,{label:`Performance order`,value:n,onChange:r,variant:`underline`,options:[{id:`lcp`,label:`Slowest LCP first`},{id:`score`,label:`Lowest score first`}]}),i.length?null:(0,Q.jsxs)(`div`,{className:`flex gap-2 rounded-lg border border-dashed border-line p-3 text-xs text-muted`,children:[(0,Q.jsx)(P,{size:15,className:`mt-px shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`p`,{children:`No performance runs yet. Lighthouse lab audits run with shapewall audit; page checks record load times.`})]}),i.map(({view:e,run:n,load:r})=>{let i=n?.report,a=i?.metrics||{},o=t.find(t=>t.id===e.pageId)?.title||e.pageId,s=i?ct(i):[];return(0,Q.jsxs)(`article`,{className:`space-y-2.5 rounded-lg border border-line bg-surface p-3 shadow-card`,"data-sw-checks-perf":`${e.pageId}|${e.viewport}`,children:[(0,Q.jsxs)(`header`,{className:`flex items-center gap-2.5`,children:[(0,Q.jsx)(Pe,{score:i?a.lighthouseLabScore??null:null,size:40,label:i?`Lighthouse score ${a.lighthouseLabScore??`unknown`}`:`No Lighthouse run`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`h3`,{className:`truncate text-sm font-semibold`,children:o}),(0,Q.jsxs)(`p`,{className:`text-xs text-muted`,children:[X(e.viewport),n?.state===`stale`?` · stale`:``,r?` · load ${Z(`loadMs`,r.report.metrics.loadMs??null)}`:``]})]})]}),i?(0,Q.jsx)(`dl`,{className:`grid grid-cols-3 gap-2`,children:lt.map(([e,t,n,r])=>(0,Q.jsxs)(`div`,{className:`rounded-md bg-surface-2 px-2 py-1.5`,children:[(0,Q.jsx)(`dt`,{className:`text-[11px] text-muted`,children:t}),(0,Q.jsx)(`dd`,{className:f(`text-sm font-semibold tabular`,ut(a[e],n,r)),children:Z(e,a[e]??null)})]},e))}):(0,Q.jsx)(`p`,{className:`text-xs text-muted`,children:`No Lighthouse audit for this view yet.`}),s.length?(0,Q.jsx)(`ul`,{className:`space-y-1.5`,"aria-label":`Recorded performance budgets`,children:s.map(e=>{let t=e.value===null?0:Math.min(1,e.value/Math.max(e.limit,1e-9));return(0,Q.jsxs)(`li`,{className:`text-xs`,"data-sw-checks-budget":e.state,children:[(0,Q.jsxs)(`div`,{className:`flex items-baseline gap-2`,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 text-muted`,children:st[e.metric]}),(0,Q.jsxs)(`span`,{className:`shrink-0 whitespace-nowrap tabular`,children:[Z(e.metric,e.value),` / `,Z(e.metric,e.limit)]}),(0,Q.jsx)(`span`,{className:f(`shrink-0 font-medium whitespace-nowrap`,e.state===`over`?`text-bad`:e.state===`within`?`text-ok`:`text-muted`),children:e.state===`over`?`Over budget`:e.state===`within`?`Within budget`:`Not measured`})]}),(0,Q.jsx)(`div`,{className:`mt-1 h-1.5 overflow-hidden rounded-full bg-surface-2`,children:(0,Q.jsx)(`span`,{className:f(`block h-full rounded-full`,e.state===`over`?`bg-bad`:`bg-ok`),style:{width:`${e.state===`over`?100:t*100}%`}})})]},e.metric)})}):null]},`${e.pageId}|${e.viewport}`)}),(0,Q.jsx)(`p`,{className:`text-xs text-muted`,children:`Lab measurements on this machine, not real-user data. Scores are never blended across pages.`})]})}var ft=[[`issues`,`Issues`],[`pages`,`Pages`],[`seo`,`SEO`],[`performance`,`Performance`],[`history`,`History`]];function pt(){let e=(0,R.useRef)(null),[t,n]=(0,R.useState)({start:!1,end:!1}),r=(0,R.useCallback)(()=>{let t=e.current;if(!t)return;let r=t.scrollLeft>1,i=t.scrollLeft+t.clientWidth<t.scrollWidth-1;n(e=>e.start===r&&e.end===i?e:{start:r,end:i})},[]);(0,R.useLayoutEffect)(()=>{if(r(),typeof ResizeObserver>`u`||!e.current)return;let t=new ResizeObserver(r);return t.observe(e.current),()=>t.disconnect()},[r]);let i=t.start||t.end?`linear-gradient(to right, ${t.start?`transparent, #000 2rem`:`#000, #000`}, ${t.end?`#000 calc(100% - 2rem), transparent`:`#000`})`:void 0;return{ref:e,edges:t,measure:r,style:i?{maskImage:i,WebkitMaskImage:i}:void 0}}function mt({data:e,error:n,loading:o,pages:s,pageId:f,viewport:p,onSelect:v,onClose:b,onRefresh:ee,onEnvironment:x,onView:S,onDraft:te,canComment:ne,command:C,local:re,tab:w=`issues`,onTab:T=()=>{},seo:E=null,run:D=null}){let[O,k]=(0,R.useState)(`all`),[A,j]=(0,R.useState)(`all`),M=(0,R.useMemo)(()=>Se((e?.views||[]).filter(e=>(!f||e.pageId===f)&&(!p||e.viewport===p)&&(O===`all`||e.viewport===O))),[e,f,p,O]),N=(0,R.useMemo)(()=>Ee(M),[M]),P=(0,R.useMemo)(()=>he({views:M,pages:s.map(e=>({id:e.id,title:e.title,url:e.url})),snapshots:E?.snapshots||{},privatePages:E?.privatePages||[]}).summary,[M,s,E]),ce=(0,R.useMemo)(()=>ke(M,N).map(e=>e.id===`seo`?{...e,warnings:P.errors+P.warnings,advisories:P.tips,unchecked:!P.checked}:e),[M,N,P]),F=[...new Set((e?.views||[]).map(e=>e.viewport))],I=pt();(0,R.useEffect)(()=>{let e=I.ref.current,t=e?.querySelector(`[data-sw-checks-tab="${w}"]`);if(!e||!t||e.scrollWidth<=e.clientWidth)return;let n=t.offsetLeft-e.offsetLeft,r=Math.max(0,Math.min(e.scrollWidth-e.clientWidth,n+t.offsetWidth/2-e.clientWidth/2));Math.abs(r-e.scrollLeft)>1&&e.scrollTo({left:r,behavior:oe()})},[w,I.ref]);let L=s.find(e=>e.id===f),le=e=>{if(e===`seo`)return T(`seo`);j(t=>t===e&&w===`issues`?`all`:e),T(`issues`)},z=(e,t,{fix:n})=>te({pageId:e.pageId,viewport:e.report.viewport.name},e.report,{title:n?`@agent please fix on this page: ${t.label}`:t.label,observation:`${t.explain}${t.id.startsWith(`duplicate-`)&&t.observation?` ${t.observation}`:``}`,nextAction:`How to fix: ${t.fix}`}),B=e?.demo?`Fictional demo reports; no live audit was run.`:e?.imported?`Imported with the board; sign-in and page state can’t be verified here.`:null;return(0,Q.jsxs)(`section`,{className:`flex flex-col lg:min-h-0 lg:flex-1`,"data-sw-checks-panel":`true`,children:[(0,Q.jsx)(`header`,{className:`hidden border-b border-line lg:block`,children:(0,Q.jsx)(ie,{icon:ae,title:`Checks`,onClose:b,closeLabel:`Close checks`,children:(0,Q.jsx)(r,{className:`ml-auto`,label:`Refresh checks`,onClick:ee,children:(0,Q.jsx)(se,{size:15,"aria-hidden":`true`})})})}),(0,Q.jsxs)(`div`,{className:`lg:relative lg:min-h-0 lg:flex-1 lg:overflow-y-auto lg:overscroll-contain`,"data-sw-checks-results":`true`,children:[(0,Q.jsxs)(`div`,{className:`sw-gutter-pad space-y-3 p-3`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[L?(0,Q.jsxs)(t,{size:`xs`,variant:`secondary`,className:`h-11 max-w-full lg:h-7`,onClick:()=>v(null,null),children:[(0,Q.jsxs)(`span`,{className:`truncate`,children:[`This page: `,L.title]}),(0,Q.jsx)(u,{size:13,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Show all pages`})]}):null,e?.environments?.length>1&&x?(0,Q.jsxs)(y,{value:e.environment,onValueChange:x,children:[(0,Q.jsx)(l,{className:`h-11 min-w-0 flex-1 lg:h-7`,"aria-label":`Checks environment`,children:(0,Q.jsx)(i,{})}),(0,Q.jsx)(c,{children:e.environments.map(e=>(0,Q.jsxs)(h,{value:e.id,children:[e.id,e.captured?` · canvas capture`:` · diagnostics`]},e.id))})]}):null,F.length>1?(0,Q.jsx)(_,{label:`Checks screen size`,value:O,onChange:k,variant:`underline`,className:`w-full basis-full`,options:[{id:`all`,label:`All`},...F.map(e=>({id:e,label:X(e)}))]}):null,(0,Q.jsx)(t,{"data-autofocus":!0,size:`icon`,variant:`ghost`,className:`lg:hidden`,"aria-label":`Refresh checks`,onClick:ee,children:(0,Q.jsx)(se,{size:15})})]}),o?(0,Q.jsx)(`p`,{role:`status`,className:`text-xs text-muted`,children:`Loading checks…`}):null,n?(0,Q.jsx)(`p`,{role:`alert`,className:`text-xs text-bad`,children:`Checks are unavailable for this view. Refresh or check access to this board.`}):null,e?(0,Q.jsx)(Fe,{totals:ce,active:w===`seo`?`seo`:A,onPick:le}):null,(0,Q.jsx)(Je,{control:D,pages:s,pageId:f,tab:w}),e?(0,Q.jsxs)(`p`,{className:`text-xs text-muted`,"data-sw-checks-coverage":`true`,children:[e.checked,` of `,e.total,` page/device views checked`,B?` · ${B}`:``]}):null]}),(0,Q.jsxs)(d,{value:w,onValueChange:T,children:[(0,Q.jsx)(`div`,{className:`sw-gutter-pad sticky top-0 z-10 border-t border-line bg-surface px-3`,children:(0,Q.jsx)(m,{variant:`underline`,ref:I.ref,onScroll:I.measure,style:I.style,"aria-label":`Checks view`,"data-sw-checks-tabs-more":I.edges.start&&I.edges.end?`both`:I.edges.end?`end`:I.edges.start?`start`:`none`,children:ft.map(([e,t])=>(0,Q.jsxs)(g,{value:e,"data-sw-checks-tab":e,children:[t,e===`issues`&&N.some(e=>e.severity===`warning`)?(0,Q.jsx)(`span`,{className:`ml-1 text-faint tabular`,children:N.filter(e=>e.severity===`warning`).length}):null]},e))})}),(0,Q.jsx)(a,{value:`issues`,className:`sw-gutter-pad p-3`,children:(0,Q.jsx)(tt,{issues:N,pages:s,category:A,onCategory:j,onView:S,onDraft:te,canComment:ne,onSeo:e=>{T(`seo`),e&&e!==f&&v(e,null)}})}),(0,Q.jsx)(a,{value:`pages`,className:`sw-gutter-pad p-3`,children:(0,Q.jsx)(at,{views:M,pages:s,onView:S})}),(0,Q.jsx)(a,{value:`seo`,children:(0,Q.jsx)(ze,{data:e,seo:E,pages:s,pageId:f,local:re,canComment:ne,canFix:!0,onIssue:z,onView:S,command:C})}),(0,Q.jsx)(a,{value:`performance`,className:`sw-gutter-pad p-3`,children:(0,Q.jsx)(dt,{views:M,pages:s})}),(0,Q.jsx)(a,{value:`history`,className:`sw-gutter-pad p-3`,children:(0,Q.jsx)(Qe,{views:M,pages:s})})]})]}),(0,Q.jsxs)(`footer`,{className:`space-y-1 border-t border-line px-3 py-2 text-xs text-muted`,children:[re?(0,Q.jsxs)(Xe,{label:D?.canRun?`Run from the terminal instead`:`Run checks from the terminal`,children:[(0,Q.jsx)(`p`,{className:`mb-1.5`,children:`Runs reuse configured sign-in and replay page actions, one page at a time.`}),C?(0,Q.jsx)(`code`,{className:`block rounded bg-surface-2 p-2 break-all text-fg`,children:C}):null]}):(0,Q.jsx)(`p`,{children:`Checks run on your computer or in CI and are sent with the board.`}),(0,Q.jsx)(`p`,{children:`Findings never send work to an agent automatically.`})]})]})}export{mt as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{B as t,It as n,Mt as r,O as i,R as a,Sn as o,cn as s,jt as c,n as l,nt as u,t as d,tt as f,wn as p}from"./ui-DI-FGWWK.js";import{K as m,N as h,Q as g,Y as _,ft as v,g as y,t as b,z as x}from"./index-DnZarJ3U.js";var S=e(p(),1);function C(e,t,n,r,i,a={}){let{threshold:o=.1,alpha:s=.1,aaColor:c=[255,255,0],diffColor:l=[255,0,0],checkerboard:u=!0,windowSize:d=1/0,includeAA:f,diffColorAlt:p,diffMask:m,ignoreMask:h}=a;if(!w(e)||!w(t)||n&&!w(n)||h&&!w(h))throw Error(`Image data: Uint8Array, Uint8ClampedArray or Buffer expected.`);if(e.length!==t.length||n&&n.length!==e.length)throw Error(`Image sizes do not match. Image 1 size: ${e.length}, image 2 size: ${t.length}`);let g=r*i;if(e.length!==g*4)throw Error(`Image data size does not match width/height. Expecting ${g*4}. Got ${e.length}`);if(h&&h.length!==g)throw Error(`Ignore mask size does not match image width/height. Expecting ${g}. Got ${h.length}`);let _=new Uint32Array(e.buffer,e.byteOffset,g),v=new Uint32Array(t.buffer,t.byteOffset,g),y=!0;for(let e=0;e<g;e++)if(_[e]!==v[e]&&(!h||!h[e])){y=!1;break}if(y){if(n&&!m)for(let t=0,r=0;t<g;t++,r+=4)se(n,r,e,s);return 0}let[b,x,S]=c,[C,E,D]=l,[O,k,A]=p||l,j=0,M=Number.isFinite(d)?new Uint8Array(g):null,N=-1,P=0;for(let a=0,c=0;a<g;a++,c+=4){let l=_[a]===v[a]||h&&h[a]?0:ne(e,t,c,u,o);if(l){let o=a%r,s=a/r|0;!f&&(T(e,o,s,r,i,_,v)||T(t,o,s,r,i,v,_))?(n&&!m&&J(n,c,b,x,S),M&&(M[a]=2)):(n&&(l<0?J(n,c,O,k,A):J(n,c,C,E,D)),M&&(M[a]=1,N<0&&(N=s),P=s),j++)}else n&&!m&&se(n,c,e,s)}if(!M||!j)return j;let F=Math.min(Math.max(Math.floor(d),1),r,i),I=new Uint16Array(r),L=0,R=0,z=Math.min(i-1,P+F-1);for(let e=N;e<=z;e++){let t=e*r,n=e-F;if(n>=0){let e=n*r;for(let n=0;n<r;n++){let r=(M[t+n]&1)-(M[e+n]&1);I[n]+=r,R+=r}}else{for(let e=0;e<r;e++){let n=M[t+e]&1;I[e]+=n,R+=n}if(e<F-1)continue}if(R<=L)continue;let i=0;for(let e=0;e<F-1;e++)i+=I[e];for(let e=F-1;e<r;e++)i+=I[e],i>L&&(L=i),i-=I[e-F+1]}return L}function w(e){return ArrayBuffer.isView(e)&&e.BYTES_PER_ELEMENT===1}function T(e,t,n,r,i,a,o){let s=t>0?t-1:0,c=n>0?n-1:0,l=t<r-1?t+1:r-1,u=n<i-1?n+1:i-1,d=(n*r+t)*4,f=e[d],p=e[d+1],m=e[d+2],h=e[d+3],g=+(t===s||t===l||n===c||n===u),_=0,v=0,y=0,b=0,x=0,S=0,C=r*4;for(let i=s;i<=l;i++){let a=(c*r+i)*4;for(let r=c;r<=u;r++,a+=C){if(i===t&&r===n)continue;let o=oe(e,a,f,p,m,h);if(o===0){if(g++,g>2)return!1}else o<_?(_=o,y=i,b=r):o>v&&(v=o,x=i,S=r)}}return _===0||v===0?!1:E(a,y,b,r,i)&&E(o,y,b,r,i)||E(a,x,S,r,i)&&E(o,x,S,r,i)}function E(e,t,n,r,i){let a=n*r+t,o=e[a];if(t>0&&t<r-1&&n>0&&n<i-1)return+(o===e[a-r-1])+ +(o===e[a-1])+ +(o===e[a+r-1])+ +(o===e[a-r])+ +(o===e[a+r])+ +(o===e[a-r+1])+ +(o===e[a+1])+ +(o===e[a+r+1])>2;let s=t>0?t-1:0,c=n>0?n-1:0,l=t<r-1?t+1:r-1,u=n<i-1?n+1:i-1,d=+(t===s||t===l||n===c||n===u);for(let i=s;i<=l;i++){let a=c*r+i;for(let s=c;s<=u;s++,a+=r)if((i!==t||s!==n)&&(d+=+(o===e[a]),d>2))return!0}return!1}var D=new Float64Array(257);for(let e=0;e<256;e++){let t=e/255;D[e]=t<=.04045?t/12.92:((t+.055)/1.055)**2.4}D[256]=D[255];var O=new Float64Array(256),k=new Float64Array(256),A=new Float64Array(256),j=new Float64Array(256),M=new Float64Array(256),N=new Float64Array(256),P=new Float64Array(256),F=new Float64Array(256),I=new Float64Array(256);for(let e=0;e<256;e++){let t=D[e];O[e]=.4122214708*t,j[e]=.2119034982*t,P[e]=.0883024619*t,k[e]=.5363325363*t,M[e]=.6806995451*t,F[e]=.2817188376*t,A[e]=.0514459929*t,N[e]=.1073969566*t,I[e]=.6299787005*t}function L(e){let t=e|0;return D[t]+(D[t+1]-D[t])*(e-t)}var R=4096,z=new Float64Array(4098);for(let e=0;e<=4097;e++)z[e]=Math.cbrt(e/R);var B=8;function V(e){let t=e*R,n=t|0;return n<B?Math.cbrt(e):z[n]+(z[n+1]-z[n])*(t-n)}var H=20,U=4096,W=new Uint32Array(U),G=new Float64Array(U*4),ee=.206,te=.03,K=1.206/1.03;function ne(e,t,n,r,i){let a=e[n],o=e[n+1],s=e[n+2],c=e[n+3],l=t[n],u=t[n+1],d=t[n+2],f=t[n+3];return c===255&&f===255?re(a,o,s,l,u,d,i):ie(a,o,s,c,l,u,d,f,n,r,i)}function re(e,t,n,r,i,a,o){let s=e<<16|t<<8|n,c=Math.imul(s,2654435761)>>>H,l=s+1,u=c*4,d,f,p,m;W[c]===l?(d=G[u],f=G[u+1],p=G[u+2],m=G[u+3]):(d=V(O[e]+k[t]+A[n]),f=V(j[e]+M[t]+N[n]),p=V(P[e]+F[t]+I[n]),m=q(d,f,p),W[c]=l,G[u]=d,G[u+1]=f,G[u+2]=p,G[u+3]=m);let h=r<<16|i<<8|a,g=Math.imul(h,2654435761)>>>H,_=h+1,v=g*4,y,b,x,S;return W[g]===_?(y=G[v],b=G[v+1],x=G[v+2],S=G[v+3]):(y=V(O[r]+k[i]+A[a]),b=V(j[r]+M[i]+N[a]),x=V(P[r]+F[i]+I[a]),S=q(y,b,x),W[g]=_,G[v]=y,G[v+1]=b,G[v+2]=x,G[v+3]=S),ae(m-S,d-y,f-b,p-x,o)}function ie(e,t,n,r,i,a,o,s,c,l,u){let d=255,f=255,p=255;if(l){let e=Math.imul(c>>2,2654435761);d=48+159*(e>>>31),f=48+159*(e>>>30&1),p=48+159*(e>>>29&1)}e=(e*r+d*(255-r))/255,t=(t*r+f*(255-r))/255,n=(n*r+p*(255-r))/255,i=(i*s+d*(255-s))/255,a=(a*s+f*(255-s))/255,o=(o*s+p*(255-s))/255;let m=L(e),h=L(t),g=L(n),_=L(i),v=L(a),y=L(o),b=V(.4122214708*m+.5363325363*h+.0514459929*g),x=V(.2119034982*m+.6806995451*h+.1073969566*g),S=V(.0883024619*m+.2817188376*h+.6299787005*g),C=V(.4122214708*_+.5363325363*v+.0514459929*y),w=V(.2119034982*_+.6806995451*v+.1073969566*y),T=V(.0883024619*_+.2817188376*v+.6299787005*y);return ae(q(b,x,S)-q(C,w,T),b-C,x-w,S-T,u)}function ae(e,t,n,r,i){let a=i-Math.abs(e);if(a>=0){let e=1.9779984951*t-2.428592205*n+.4505937099*r,i=.0259040371*t+.7827717662*n-.808675766*r;if(e*e+i*i<=a*a)return 0}return e>0?-1:1}function q(e,t,n){let r=.2104542553*e+.793617785*t-.0040720468*n,i=K*r-ee;return .5*(i+Math.sqrt(i*i+4*te*K*r))}function oe(e,t,n,r,i,a){let o=e[t],s=e[t+1],c=e[t+2],l=e[t+3],u=n-o,d=r-s,f=i-c,p=a-l;if(!u&&!d&&!f&&!p)return 0;if(a<255||l<255){u=(n*a-o*l-255*p)/255,d=(r*a-s*l-255*p)/255,f=(i*a-c*l-255*p)/255;let e=u*.29889531+d*.58662247+f*.11448223;return e===0&&p?p/2:e}return u*.29889531+d*.58662247+f*.11448223}function J(e,t,n,r,i){e[t]=n,e[t+1]=r,e[t+2]=i,e[t+3]=255}function se(e,t,n,r){let i=255+(n[t]*.29889531+n[t+1]*.58662247+n[t+2]*.11448223-255)*r*n[t+3]/255;J(e,t,i,i,i)}var ce=.1,Y=[239,68,68];function le(e,t,{threshold:n=ce}={}){let r=Math.max(e.width,t.width),i=Math.max(e.height,t.height),a={width:Math.min(e.width,t.width),height:Math.min(e.height,t.height)},o=e=>{if(e.width===a.width&&e.height===a.height)return e.data;let t=new Uint8Array(a.width*a.height*4);for(let n=0;n<a.height;n+=1)t.set(e.data.subarray(n*e.width*4,(n*e.width+a.width)*4),n*a.width*4);return t},s=new Uint8Array(r*i*4),c=new Uint8Array(a.width*a.height*4),l=C(o(e),o(t),c,a.width,a.height,{threshold:n,diffMask:!0,diffColor:Y,alpha:0});for(let e=0;e<a.height;e+=1)s.set(c.subarray(e*a.width*4,(e+1)*a.width*4),e*r*4);for(let e=0;e<i;e+=1)for(let t=e<a.height?a.width:0;t<r;t+=1){let n=(e*r+t)*4;s[n]=Y[0],s[n+1]=Y[1],s[n+2]=Y[2],s[n+3]=255,l+=1}let u=r*i;return{width:r,height:i,changed:l,total:u,percent:u?Math.round(l/u*1e4)/100:0,data:s}}var ue=6,X=new Map;async function de(e){let t=new Image;t.decoding=`async`,t.src=e,await t.decode();let n=document.createElement(`canvas`);n.width=t.naturalWidth,n.height=t.naturalHeight;let r=n.getContext(`2d`,{willReadFrequently:!0});return r.drawImage(t,0,0),r.getImageData(0,0,n.width,n.height)}async function fe({width:e,height:t,data:n}){let r=document.createElement(`canvas`);r.width=e,r.height=t,r.getContext(`2d`).putImageData(new ImageData(new Uint8ClampedArray(n.buffer),e,t),0,0);let i=await new Promise(e=>r.toBlob(e,`image/png`));if(!i)throw Error(`Could not draw the diff.`);return URL.createObjectURL(i)}function pe(e,t){let n=`${e}\n${t}`;if(!X.has(n)){let r=Promise.all([de(e),de(t)]).then(async([e,t])=>{let n=le(e,t);return{percent:n.percent,changed:n.changed,url:n.changed?await fe(n):null}});for(r.catch(()=>X.delete(n)),X.set(n,r);X.size>ue;){let[e,t]=X.entries().next().value;X.delete(e),t.then(e=>e.url&&URL.revokeObjectURL(e.url)).catch(()=>{})}}return X.get(n)}function me(e,t,n=!0){let r=n&&e&&t?`${e}\n${t}`:null,[i,a]=(0,S.useState)({key:null,status:`idle`});return(0,S.useEffect)(()=>{if(!r)return;let n=!0;return pe(e,t).then(e=>n&&a({key:r,status:`ok`,...e}),()=>n&&a({key:r,status:`error`})),()=>{n=!1}},[t,e,r]),r?i.key===r?i:{status:`loading`}:{status:`idle`}}var Z=o();function Q(e){return e?new Date(n(e)).toLocaleString(void 0,{month:`short`,day:`numeric`,hour:`numeric`,minute:`2-digit`}):`Unknown time`}function he(e){return e.status===`loading`?`Finding changes…`:e.status===`error`?`Could not compare these captures.`:e.status===`ok`?e.changed?`${e.percent}% changed`:`No pixel changes`:``}var $=new Map;function ge(e){if(!$.has(e)){let t=(async()=>{let t=new Image;t.src=e,await t.decode();let n=Math.min(160,t.naturalWidth),r=Math.max(1,Math.round(t.naturalHeight*n/t.naturalWidth)),i=document.createElement(`canvas`);i.width=n,i.height=r;let a=i.getContext(`2d`,{willReadFrequently:!0});a.drawImage(t,0,0,n,r);let{data:o}=a.getImageData(0,0,n,r);for(let e=0;e<r;e+=1)for(let t=0;t<n;t+=1)if(o[(e*n+t)*4+3]>0)return e/r;return null})().catch(()=>null);$.set(e,t)}return $.get(e)}function _e(e){let t=e.status===`ok`&&e.changed?e.url:null,[n,r]=(0,S.useState)({url:null,at:null});return(0,S.useEffect)(()=>{if(!t)return;let e=!0;return ge(t).then(n=>e&&r({url:t,at:n})),()=>{e=!1}},[t]),t&&n.url===t?n.at:null}function ve(e,t){e&&t!==null&&e.scrollTo({top:Math.max(0,t*e.scrollHeight-48),behavior:b()})}var ye={phone:`max-w-[400px]`,tablet:`max-w-[600px]`};function be({label:e,entry:t,urlFor:n,page:i,viewport:a,diff:o=null,onImageError:s,paneRef:l,onScroll:u}){return(0,Z.jsxs)(`figure`,{className:c(`mx-auto w-full min-w-0 flex-1`,ye[a]),"data-sw-history-side":t.version,children:[(0,Z.jsxs)(`figcaption`,{className:`mb-1.5 flex items-baseline gap-1.5 text-[11px] font-medium tracking-wide text-faint uppercase`,children:[e,(0,Z.jsxs)(`span`,{className:`truncate font-normal tracking-normal normal-case`,children:[t.current?`current capture`:Q(t.at),` · `,r(t.at)]})]}),(0,Z.jsxs)(`div`,{ref:l,onScroll:u,className:`relative max-h-[52dvh] overflow-y-auto rounded-md border border-line bg-surface-2`,children:[(0,Z.jsx)(`img`,{src:n(t,!1),alt:`${i} ${a}, ${t.current?`current capture`:`captured ${Q(t.at)}`}`,className:`block w-full select-none`,draggable:!1,onError:s}),o?.url?(0,Z.jsx)(`img`,{src:o.url,alt:``,draggable:!1,className:`pointer-events-none absolute inset-x-0 top-0 block w-full opacity-80 select-none`,"data-sw-history-diff-overlay":`true`}):null]})]})}var xe=[{id:`split`,label:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(v,{size:13,"aria-hidden":`true`}),` Side by side`]})},{id:`slider`,label:(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(x,{size:13,"aria-hidden":`true`}),` Slider`]})}],Se=[{id:`before`,label:`Earlier`},{id:`after`,label:`Current`},{id:`slider`,label:`Slider`}];function Ce({open:e,onClose:n,page:r,viewport:o,data:p,comments:v,urlFor:b,onPickComment:x,touch:C,onImageError:w}){let T=(0,S.useMemo)(()=>r?h({pageId:r.id,viewport:o,manifest:p?.manifest,captures:p?.captures,versions:p?.versions}):[],[p?.captures,p?.manifest,p?.versions,r,o]),[E,D]=(0,S.useState)(null),[O,k]=(0,S.useState)(C?`before`:`split`),A=`${r?.id}|${o}`,j=E?.key===A?E.version:null,M=T.find(e=>e.current)||T[0]||null,N=T.find(e=>e.version===j)||T.find(e=>e!==M)||null,[P,F]=(0,S.useState)(!0),I=me(N?b(N,!1):null,M?b(M,!1):null,P&&N!==M),L=_e(I);(0,S.useEffect)(()=>{e&&I.status===`error`&&w?.()},[I.status,w,e]);let R=e=>(v||[]).filter(t=>t.captureVersion===e),z=(0,S.useRef)({before:null,after:null,slider:null}),B=(0,S.useRef)(!1),V=(e,t)=>()=>{if(B.current)return;let n=z.current[e],r=z.current[t];n&&r&&(B.current=!0,r.scrollTop=n.scrollTop,window.requestAnimationFrame(()=>{B.current=!1}))},H=()=>{for(let e of Object.values(z.current))ve(e,L)},U=(0,S.useRef)(null);(0,S.useEffect)(()=>{if(L===null||U.current===`${A}|${N?.version}|${L}`)return;U.current=`${A}|${N?.version}|${L}`;let e=window.setTimeout(()=>{for(let e of Object.values(z.current))ve(e,L)},150);return()=>window.clearTimeout(e)},[N?.version,L,A]);let W=P&&I.status===`ok`?I:null,G=O===`slider`;return(0,Z.jsx)(a,{open:e,onClose:n,title:r?`History: ${r.title}`:`History`,description:r?`${o} · ${T.length} capture${T.length===1?``:`s`} kept`:``,size:`lg`,children:(0,Z.jsx)(`div`,{className:`space-y-3 p-4`,"data-sw-history":A,children:T.length<2?(0,Z.jsx)(i,{icon:m,title:`No earlier captures yet`,children:`Each recapture keeps the previous shot, so the changes to this page show up here.`}):(0,Z.jsxs)(Z.Fragment,{children:[(0,Z.jsx)(`ol`,{className:`flex gap-2.5 overflow-x-auto pb-1`,"aria-label":`Captures, newest first`,"data-sw-history-strip":`true`,children:T.map((e,t)=>{let n=R(e.version).length,r=N?.version===e.version;return(0,Z.jsx)(`li`,{className:`shrink-0`,children:(0,Z.jsxs)(`button`,{type:`button`,disabled:e.current,onClick:()=>D({key:A,version:e.version}),"aria-pressed":r,className:c(`group block w-36 rounded-lg border bg-surface p-1.5 text-left transition-colors disabled:cursor-default`,r?`border-accent ring-2 ring-accent/30`:e.current?`border-line`:`border-line hover:border-faint hover:bg-surface-2`),"data-sw-history-version":e.version,children:[(0,Z.jsxs)(`span`,{className:`relative block h-24 overflow-hidden rounded bg-surface-2`,children:[(0,Z.jsx)(`img`,{src:b(e,!0),alt:``,className:`block w-full`,draggable:!1,loading:`lazy`,onError:w}),e.current?(0,Z.jsx)(f,{tone:`solid`,className:`absolute top-1 left-1 shadow-card`,children:`Current`}):r?(0,Z.jsx)(f,{tone:`accent`,className:`absolute top-1 left-1 bg-surface shadow-card`,children:`Comparing`}):null]}),(0,Z.jsxs)(`span`,{className:`mt-1.5 flex items-center gap-1 px-0.5`,children:[(0,Z.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-[12px] font-medium text-fg`,children:e.current?`Current`:`Version ${T.length-t}`}),n?(0,Z.jsxs)(`span`,{className:`inline-flex shrink-0 items-center gap-0.5 text-[11px] text-accent tabular`,children:[(0,Z.jsx)(_,{size:11,"aria-hidden":`true`}),` `,n]}):null]}),(0,Z.jsx)(`span`,{className:`block truncate px-0.5 text-[11px] text-faint`,children:Q(e.at)})]})},e.version)})}),(0,Z.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2`,children:[(0,Z.jsx)(d,{label:`Compare`,large:C,value:O,onChange:k,className:C?`w-full`:``,itemClassName:`inline-flex items-center justify-center gap-1.5`,options:C?Se:xe}),(0,Z.jsx)(l,{size:C?`touch`:`sm`,pressed:P,onPressedChange:F,"data-sw-history-diff":P?`on`:`off`,children:`Highlight changes`}),P?(0,Z.jsx)(`span`,{className:`text-xs text-muted tabular`,role:`status`,"data-sw-history-diff-status":I.status,children:he(I)}):null,P&&L!==null?(0,Z.jsxs)(t,{size:C?`touch`:`sm`,variant:`ghost`,onClick:H,"data-sw-history-jump":`true`,children:[(0,Z.jsx)(g,{size:13,"aria-hidden":`true`}),` Jump to the change`]}):null]}),G&&N&&M?(0,Z.jsxs)(`figure`,{className:c(`mx-auto w-full min-w-0`,ye[o]),"data-sw-history-slider":`true`,children:[(0,Z.jsxs)(`figcaption`,{className:`mb-1.5 text-[11px] text-faint`,children:[`Earlier `,Q(N.at),` on the left, current on the right. Drag the divider.`]}),(0,Z.jsx)(`div`,{ref:e=>{z.current.slider=e},className:`max-h-[52dvh] overflow-y-auto rounded-md border border-line bg-surface-2`,children:(0,Z.jsx)(y,{label:`Earlier and current capture`,beforeLabel:`Earlier`,afterLabel:`Current`,before:(0,Z.jsx)(`img`,{src:b(N,!1),alt:`${r.title} ${o}, captured ${Q(N.at)}`,className:`block w-full select-none`,draggable:!1,onError:w}),after:(0,Z.jsxs)(`div`,{className:`relative`,children:[(0,Z.jsx)(`img`,{src:b(M,!1),alt:`${r.title} ${o}, current capture`,className:`block w-full select-none`,draggable:!1,onError:w}),W?.url?(0,Z.jsx)(`img`,{src:W.url,alt:``,draggable:!1,className:`pointer-events-none absolute inset-x-0 top-0 block w-full opacity-80 select-none`,"data-sw-history-diff-overlay":`true`}):null]})})})]}):(0,Z.jsxs)(`div`,{className:`flex justify-center gap-3`,children:[N&&(!C||O===`before`)?(0,Z.jsx)(be,{label:`Earlier`,entry:N,urlFor:b,page:r.title,viewport:o,onImageError:w,paneRef:e=>{z.current.before=e},onScroll:V(`before`,`after`)}):null,M&&(!C||O===`after`)?(0,Z.jsx)(be,{label:`Current`,entry:M,urlFor:b,page:r.title,viewport:o,diff:W,onImageError:w,paneRef:e=>{z.current.after=e},onScroll:V(`after`,`before`)}):null]}),N&&R(N.version).length?(0,Z.jsxs)(`div`,{children:[(0,Z.jsx)(`p`,{className:`mb-1.5 text-xs font-medium text-muted`,children:`Comments made on the earlier capture`}),(0,Z.jsx)(`ul`,{className:`flex flex-wrap gap-1.5`,children:R(N.version).map(e=>(0,Z.jsx)(`li`,{children:(0,Z.jsxs)(`button`,{type:`button`,onClick:()=>x(e),className:c(`inline-flex max-w-72 items-center gap-1.5 rounded-full border border-line px-2 text-xs text-fg transition-colors hover:bg-surface-2`,C?`h-11`:`h-7`),"data-sw-history-comment":e.id,children:[(0,Z.jsx)(u,{className:e.status===`resolved`?`bg-ok text-ok-fg`:`bg-accent text-accent-fg`,children:e.id}),(0,Z.jsx)(`span`,{className:`truncate`,children:s(e)})]})},e.id))})]}):null]})})})}export{Ce as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{B as t,R as n,Sn as r,a as i,i as a,o,s,t as c,wn as l}from"./ui-DI-FGWWK.js";import{i as u,n as d,r as f}from"./index-DnZarJ3U.js";import{i as p,o as m}from"./QuickConnect-DO1TjS1t.js";var h=e(l(),1),g=r();function _({open:e,onClose:t,info:r,boardCount:i,onSaved:a,onOpenUpdates:o,touch:s}){let c=(0,h.useRef)(!1),[l,u]=(0,h.useState)(!1);return(0,g.jsx)(n,{open:e,onClose:t,sticky:l,onCloseAutoFocus:e=>{e.preventDefault(),c.current||document.querySelector(`[data-sw-profile-menu]`)?.focus()},title:`Settings`,size:`md`,children:(0,g.jsx)(v,{info:r,boardCount:i,onSaved:a,touch:s,onDirtyChange:u,onOpenUpdates:()=>{c.current=!0,o()}})})}function v({info:e,boardCount:t,onSaved:n,onOpenUpdates:r,touch:c,onDirtyChange:l}){return(0,g.jsxs)(a,{defaultValue:`general`,className:`p-5`,children:[(0,g.jsxs)(o,{className:`mb-5 max-w-72`,"aria-label":`Settings`,children:[(0,g.jsx)(s,{value:`general`,large:c,"data-sw-settings-tab":`general`,children:`General`}),(0,g.jsx)(s,{value:`agent`,large:c,"data-sw-settings-tab":`agent`,children:`Agent`})]}),(0,g.jsx)(i,{value:`general`,children:(0,g.jsx)(y,{info:e,boardCount:t,touch:c,onOpenUpdates:r})}),(0,g.jsx)(i,{value:`agent`,children:(0,g.jsx)(b,{info:e,onSaved:n,touch:c,onDirtyChange:l})})]})}function y({info:e,boardCount:n,touch:r,onOpenUpdates:i}){let[a,o]=u();return(0,g.jsxs)(`div`,{className:`space-y-6`,"data-sw-settings":`general`,children:[(0,g.jsxs)(`section`,{className:`space-y-3`,"aria-labelledby":`sw-general-appearance`,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsx)(`h2`,{id:`sw-general-appearance`,className:`text-sm font-semibold text-fg`,children:`Appearance`}),(0,g.jsx)(`p`,{className:`mt-1 text-xs text-muted`,children:`Saved in this browser and shared with your other Shapewall tabs.`})]}),(0,g.jsxs)(`div`,{className:`space-y-1.5`,"data-sw-settings-mode":!0,children:[(0,g.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:`Mode`}),(0,g.jsx)(c,{value:a.mode,onChange:e=>o({mode:e}),options:d,label:`Appearance mode`,large:r})]}),(0,g.jsxs)(`div`,{className:`space-y-1.5`,"data-sw-settings-theme":!0,children:[(0,g.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:`Theme`}),(0,g.jsx)(c,{value:a.theme,onChange:e=>o({theme:e}),options:f,label:`Appearance theme`,large:r,className:`grid grid-cols-2 sm:flex`})]})]}),(0,g.jsxs)(`section`,{className:`space-y-2`,"aria-labelledby":`sw-general-installation`,children:[(0,g.jsx)(`h2`,{id:`sw-general-installation`,className:`text-sm font-semibold text-fg`,children:`This installation`}),(0,g.jsxs)(`dl`,{className:`space-y-1 text-xs`,children:[(0,g.jsxs)(`div`,{className:`flex flex-wrap justify-between gap-x-4 gap-y-1`,children:[(0,g.jsx)(`dt`,{className:`text-muted`,children:`Name`}),(0,g.jsx)(`dd`,{className:`min-w-0 break-words text-fg`,children:e?.title||`Shapewall`})]}),(0,g.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,g.jsx)(`dt`,{className:`text-muted`,children:`Boards`}),(0,g.jsx)(`dd`,{className:`text-fg`,children:n})]})]}),(0,g.jsx)(t,{size:r?`touch`:`md`,className:`mt-2`,onClick:i,"data-sw-settings-updates":!0,children:`About & Updates`})]})]})}function b({info:e,onSaved:t,touch:n,onDirtyChange:r,agentsHome:i=!1}){return e?.agent?.settingsEditable||e?.agent?.settingsReadonly?(0,g.jsx)(p,{onSaved:t,touch:n,buzz:!!e?.buzzAvailable,onDirtyChange:r,agents:i?`none`:`link`}):(0,g.jsxs)(`div`,{className:`space-y-2 text-sm`,"data-sw-settings-agent-unavailable":!0,children:[(0,g.jsx)(`h2`,{className:`font-semibold text-fg`,children:`Agent settings`}),(0,g.jsx)(`p`,{className:`text-muted`,children:e?.agent?.settingsLocked?(0,g.jsx)(m,{}):e?.agent?`Agent settings are managed on the computer serving this installation.`:`Agent chat is not enabled for this installation. Ask the installer to enable it if you want to connect an agent.`})]})}export{b as AgentDetails,y as GeneralSettings,v as LocalSettingsContent,_ as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{i as e}from"./QuickConnect-
|
|
1
|
+
import{i as e}from"./QuickConnect-DO1TjS1t.js";import{Rt as t,Sn as n}from"./ui-DI-FGWWK.js";var r=n();function i(){let n=t(`(max-width: 600px)`);return(0,r.jsxs)(`main`,{className:`mx-auto max-w-3xl space-y-5 p-4 sm:p-6`,"data-sw-agent-management":!0,children:[(0,r.jsxs)(`header`,{className:`space-y-2`,children:[(0,r.jsx)(`h1`,{className:`text-xl font-semibold text-fg`,children:`Shapewall agent settings`}),(0,r.jsx)(`p`,{className:`text-sm text-muted`,children:`This temporary window changes the agent for this source project. Stop active agent turns before changing connections. Your account-protected board stays separate. Close this server with Ctrl-C when finished.`})]}),(0,r.jsx)(e,{touch:n})]})}export{i as default};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{n as e,r as t}from"./rolldown-runtime-XKyaHtl9.js";import{B as n,Ct as r,Dt as i,Et as a,H as o,Ot as s,R as c,Sn as l,St as u,Tt as d,Zt as ee,_n as f,a as p,bn as m,bt as h,c as g,ct as _,dt as v,ft as y,gn as b,i as x,jt as S,kt as C,lt as w,n as te,o as T,pt as E,qt as D,s as O,t as ne,tt as re,ut as ie,w as k,wn as A,xn as j,yn as M}from"./ui-DI-FGWWK.js";import{D as ae,G as N,H as oe,I as se,J as P,L as ce,Z as F,lt as I,m as le,nt as L,q as ue}from"./index-DnZarJ3U.js";import{n as R,t as z}from"./circle-x-B6KfScOE.js";import{t as de}from"./refresh-cw-vkgvCCfR.js";var fe={name:`copy`,size:24,node:[[`rect`,{width:`14`,height:`14`,x:`8`,y:`8`,rx:`2`,ry:`2`,key:`17jyea`}],[`path`,{d:`M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2`,key:`zix9uf`}]]};fe.node;var B=j(fe),V={name:`globe`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`M12 2a14.5 14.5 0 0 0 0 20 14.5 14.5 0 0 0 0-20`,key:`13o1zl`}],[`path`,{d:`M2 12h20`,key:`9i4pu4`}]]};V.node;var pe=j(V),H={name:`image-up`,size:24,node:[[`path`,{d:`M10.3 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h14a2 2 0 0 1 2 2v10l-3.1-3.1a2 2 0 0 0-2.814.014L6 21`,key:`9csbqa`}],[`path`,{d:`m14 19.5 3-3 3 3`,key:`9vmjn0`}],[`path`,{d:`M17 22v-5.5`,key:`1aa6fl`}],[`circle`,{cx:`9`,cy:`9`,r:`2`,key:`af1f0g`}]]};H.node;var U=j(H),W={name:`key-round`,size:24,node:[[`path`,{d:`M2.586 17.414A2 2 0 0 0 2 18.828V21a1 1 0 0 0 1 1h3a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h1a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1h.172a2 2 0 0 0 1.414-.586l.814-.814a6.5 6.5 0 1 0-4-4z`,key:`1s6t7t`}],[`circle`,{cx:`16.5`,cy:`7.5`,r:`.5`,fill:`currentColor`,key:`w0ekpg`}]]};W.node;var G=j(W),me={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};me.node;var K=j(me),q=l(),J=`On the computer running Shapewall, run shapewall settings --config FILE --open with this project’s config file to open agent settings. For a direct local board, you can also use the owner link printed by shapewall serve.`;function he(){return(0,q.jsxs)(q.Fragment,{children:[`On the computer running Shapewall, run `,(0,q.jsx)(`code`,{className:`break-words font-mono`,children:`shapewall settings --config FILE --open`}),` with this project’s config file to open agent settings. For a direct local board, you can also use the owner link printed by`,` `,(0,q.jsx)(`code`,{className:`font-mono`,children:`shapewall serve`}),`.`]})}var Y=t(A(),1);function X({label:e,htmlFor:t,hint:n,problem:r,children:i,...a}){return(0,q.jsxs)(`div`,{className:`space-y-1`,...a,children:[t?(0,q.jsx)(`label`,{htmlFor:t,className:`block text-xs font-medium text-fg`,children:e}):(0,q.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:e}),i,r?(0,q.jsx)(`p`,{id:t?`${t}-problem`:void 0,className:`text-xs text-bad`,role:`alert`,"data-sw-settings-problem":`true`,children:r}):n?(0,q.jsx)(`p`,{className:`text-xs text-muted`,children:n}):null]})}function ge({text:e,label:t,touch:r}){let[i,a]=(0,Y.useState)(!1),[o,s]=(0,Y.useState)(!1),c=(0,Y.useRef)(null);return(0,Y.useEffect)(()=>{if(!i)return;let e=window.setTimeout(()=>a(!1),1500);return()=>window.clearTimeout(e)},[i]),(0,q.jsxs)(`div`,{children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-1 rounded-md border border-line bg-sunken pl-2`,"data-sw-settings-export":t,children:[(0,q.jsx)(`code`,{ref:c,className:`min-w-0 flex-1 overflow-x-auto py-1.5 font-mono text-[11.5px] whitespace-nowrap text-fg`,children:e}),(0,q.jsx)(n,{variant:`ghost`,size:r?`icon`:`icon-sm`,onClick:async()=>{try{await navigator.clipboard.writeText(e),s(!1),a(!0)}catch{if(c.current){let e=document.createRange();e.selectNodeContents(c.current);let t=window.getSelection();t.removeAllRanges(),t.addRange(e)}s(!0)}},"aria-label":i?`Copied`:`Copy the ${t} line`,children:i?(0,q.jsx)(M,{size:14,"aria-hidden":`true`}):(0,q.jsx)(B,{size:14,"aria-hidden":`true`})})]}),o?(0,q.jsx)(`p`,{className:`mt-1 text-xs text-muted`,role:`status`,children:`This browser did not allow copying. The line is selected: press Ctrl+C (or long-press) to copy it.`}):null]})}function Z({children:e}){return(0,q.jsxs)(`p`,{className:`flex items-start gap-1.5 text-xs text-fg`,"data-sw-settings-override":`true`,children:[(0,q.jsx)(se,{size:13,className:`mt-px shrink-0 text-warn`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{children:e})]})}function _e({items:e,keyVar:t,onCancel:r,onConfirm:i,busy:a,touch:o,confirmLabel:s=`Allow and save`,children:l=null,blocked:u=!1}){let d=o?`touch`:`md`;return(0,q.jsxs)(c,{open:!!e,onClose:()=>a?null:r(),title:`Allow this?`,footer:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(n,{size:d,onClick:r,disabled:a,children:`Cancel`}),(0,q.jsx)(n,{size:d,variant:`default`,onClick:i,disabled:a||u,"data-sw-settings-confirm":`true`,children:a?`Saving...`:s})]}),children:[e?l:null,(0,q.jsx)(`div`,{className:`space-y-3 p-5 text-sm`,"data-sw-settings-confirm-list":`true`,children:(e||[]).map(e=>e.kind===`command`?(0,q.jsxs)(`div`,{className:`space-y-1.5`,"data-sw-settings-confirm-item":`command`,children:[(0,q.jsxs)(`p`,{className:`flex items-center gap-1.5 font-medium text-fg`,children:[(0,q.jsx)(K,{size:14,"aria-hidden":`true`}),` Run this command on this machine, as you`]}),(0,q.jsx)(`code`,{className:`block rounded-md border border-line bg-sunken p-2 font-mono text-xs break-all text-fg`,children:e.command}),e.projectRoot?(0,q.jsxs)(`p`,{className:`text-xs text-muted`,children:[`Source folder for every board in this project:`,` `,(0,q.jsx)(`code`,{className:`font-mono break-all`,"data-sw-settings-confirm-root":!0,children:e.projectRoot})]}):null,(0,q.jsx)(`p`,{className:`text-xs text-muted`,children:`Shapewall starts it for each chat thread, with your login and a small environment. Anyone who can chat on this board drives it. Only allow a command you installed yourself.`})]},`command:${e.command}`):(0,q.jsxs)(`div`,{className:`space-y-1.5`,"data-sw-settings-confirm-item":`host`,children:[(0,q.jsxs)(`p`,{className:`flex items-center gap-1.5 font-medium text-fg`,children:[(0,q.jsx)(G,{size:14,"aria-hidden":`true`}),` Send your API key to `,e.host]}),(0,q.jsxs)(`p`,{className:`text-xs text-muted`,children:[`Every chat request carries the key in `,(0,q.jsx)(`code`,{className:`font-mono`,children:e.keyVar||t}),` to`,` `,(0,q.jsx)(`span`,{className:`font-medium text-fg`,children:e.host}),`. Allow it only if you trust that host with the key.`]})]},`host:${e.keyVar}@${e.host}`))})]})}function ve({result:e}){if(!e)return null;if(e.note)return(0,q.jsxs)(`p`,{className:`flex items-start gap-1.5 rounded-md border border-line bg-surface-2/60 p-3 text-xs text-muted`,role:`status`,"data-sw-settings-test-result":`note`,children:[(0,q.jsx)(L,{size:14,className:`mt-px shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{children:e.note})]});let t=e.ok?R:z;return(0,q.jsxs)(`div`,{className:S(`rounded-md border p-3 text-xs`,e.ok?`border-ok/40 bg-ok/10`:`border-bad/40 bg-bad/10`),role:`status`,"data-sw-settings-test-result":e.ok?`ok`:`failed`,children:[(0,q.jsxs)(`p`,{className:S(`flex items-start gap-1.5 font-medium`,e.ok?`text-fg`:`text-bad`),children:[(0,q.jsx)(t,{size:14,className:S(`mt-px shrink-0`,e.ok?`text-ok`:`text-bad`),"aria-hidden":`true`}),(0,q.jsx)(`span`,{children:e.message})]}),e.details?.length?(0,q.jsx)(`ul`,{className:`mt-1.5 list-disc space-y-0.5 pl-5 text-muted`,children:e.details.map(e=>(0,q.jsx)(`li`,{children:e},e))}):null]})}function ye(e){let t=Array.isArray(e?.profiles)?e.profiles:[],n=Array.isArray(e?.detected)?e.detected:[],r=(Array.isArray(e?.known)&&e.known.length?e.known:n).map(e=>{let r=t.find(t=>t.id===e.id),i={builtIn:e.label,logo:e.logo||null};if(r)return{kind:`connected`,id:e.id,label:r.label||e.label,profile:r,...i};let a=n.find(t=>t.id===e.id);return a?{kind:a.state===`ready`?`found`:a.state===`needs-shell`?`needs-shell`:`needs-adapter`,id:e.id,label:e.label,install:a.install||e.install||null,...i}:{kind:`missing`,id:e.id,label:e.label,...i}});for(let e of t)r.some(t=>t.id===e.id)||r.push({kind:`connected`,id:e.id,label:e.label,profile:e,builtIn:null,logo:e.logo||null});return r}async function be(e,{maxBytes:t=5242880,maxLabel:n=`5 MB`}={}){if(!e||![`image/png`,`image/jpeg`,`image/webp`].includes(e.type))throw Error(`Choose a PNG, JPEG or WebP image.`);if(e.size>t)throw Error(`Choose an image smaller than ${n}.`);let r;try{if(r=await createImageBitmap(e,{imageOrientation:`from-image`}),!r.width||!r.height)throw Error(`empty image`);let t=document.createElement(`canvas`);t.width=256,t.height=256;let n=t.getContext(`2d`);if(!n)throw Error(`no canvas`);let i=Math.min(r.width,r.height);return n.drawImage(r,(r.width-i)/2,(r.height-i)/2,i,i,0,0,256,256),t.toDataURL(`image/png`).split(`,`)[1]}catch{throw Error(`This image could not be read. Try another PNG, JPEG or WebP image.`)}finally{r?.close()}}var xe=2097152,Se=`upload:pending`,Ce=(e={})=>({name:e.label||``,icon:e.icon||null,tint:e.tint||null,png:null});function we(e,t){let n={};return t.name.trim()!==(e.label||``)&&(n.name=t.name.trim()),t.icon!==Se&&t.icon!==(e.icon||null)&&(n.icon=t.icon),t.tint!==(e.tint||null)&&(n.tint=t.tint),Object.keys(n).length?n:null}async function Q(e,t,n){let r=null,i=we(t,n);return i&&(r=await D.post(`/api/agent/settings/identity`,{id:e,...i})),n.icon===Se&&n.png&&(r=await D.post(`/api/agent/settings/identity/icon`,{id:e,png:n.png})),r}function Te({name:e,checked:t,onChange:n,label:r,children:i,className:a,...o}){return(0,q.jsxs)(`label`,{className:S(`relative inline-flex h-11 w-11 cursor-pointer items-center justify-center rounded-xl border-2 border-transparent`,`has-[:focus-visible]:outline-2 has-[:focus-visible]:outline-offset-1 has-[:focus-visible]:outline-accent`,t?`border-accent bg-accent/10`:`hover:border-line-strong`,a),title:r,...o,children:[(0,q.jsx)(`input`,{type:`radio`,name:e,className:`sr-only`,checked:t,onChange:n,"aria-label":r}),i]})}function Ee({value:e,onChange:t,label:r,logo:a=null,upload:o=!0,disabled:s=!1}){let c=(0,Y.useId)(),l=(0,Y.useRef)(null),[u,ee]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(``),m=d(a),h=e.png?`data:image/png;base64,${e.png}`:null,y=e.icon===Se||C(e.icon),b=!y&&(e.icon||!m),x=async n=>{if(n){ee(!0),p(``);try{let r=await be(n,{maxBytes:xe,maxLabel:`2 MB`});t({...e,icon:Se,png:r})}catch(e){p(e.message||`This image could not be read.`)}finally{ee(!1),l.current&&(l.current.value=``)}}},S=n=>t({...e,icon:n,png:null});return(0,q.jsxs)(`div`,{className:`space-y-3`,children:[(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`p`,{className:`text-xs font-medium text-fg`,id:`${c}-icons`,children:`Icon`}),(0,q.jsxs)(`div`,{role:`radiogroup`,"aria-labelledby":`${c}-icons`,className:`flex flex-wrap gap-1`,"data-sw-agent-icon-options":!0,children:[(0,q.jsx)(Te,{name:`${c}-icon`,checked:!e.icon,onChange:()=>S(null),label:m?`Default: the ${m.name} mark`:`Default: initials`,"data-sw-agent-icon-option":`default`,children:(0,q.jsx)(_,{label:r,logo:a,tint:e.tint,size:`lg`,className:`h-9 w-9`})}),ie.map(t=>(0,q.jsx)(Te,{name:`${c}-icon`,checked:e.icon===t,onChange:()=>S(t),label:w[t].name,"data-sw-agent-icon-option":t,children:(0,q.jsx)(_,{label:r,icon:t,tint:e.tint,size:`lg`,className:`h-9 w-9`})},t)),y?(0,q.jsx)(Te,{name:`${c}-icon`,checked:!0,onChange:()=>{},label:`Your picture`,"data-sw-agent-icon-option":`upload`,children:(0,q.jsx)(_,{label:r,icon:e.icon===Se?null:e.icon,src:h,size:`lg`,className:`h-9 w-9`})}):null]}),o?(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 pt-1`,children:[(0,q.jsxs)(n,{size:`touch`,className:`lg:h-8`,disabled:u||s,onClick:()=>l.current?.click(),children:[u?(0,q.jsx)(g,{}):(0,q.jsx)(U,{size:14,"aria-hidden":`true`}),` Upload a picture`]}),(0,q.jsx)(`p`,{className:`text-xs text-muted`,children:`PNG, JPEG or WebP, up to 2 MB. Cropped to a square.`}),(0,q.jsx)(`input`,{ref:l,type:`file`,accept:`image/png,image/jpeg,image/webp`,className:`hidden`,"aria-label":`Choose a picture for the icon`,onChange:e=>void x(e.target.files?.[0]),"data-sw-agent-icon-upload":!0})]}):null,f?(0,q.jsx)(`p`,{className:`text-xs text-bad`,role:`alert`,"data-sw-agent-icon-problem":!0,children:f}):null]}),b?(0,q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,q.jsx)(`p`,{className:`text-xs font-medium text-fg`,id:`${c}-tints`,children:`Colour`}),(0,q.jsxs)(`div`,{role:`radiogroup`,"aria-labelledby":`${c}-tints`,className:`flex flex-wrap gap-1`,"data-sw-agent-tint-options":!0,children:[(0,q.jsx)(Te,{name:`${c}-tint`,checked:!e.tint,onChange:()=>t({...e,tint:null}),label:`Default colour`,"data-sw-agent-tint-option":`default`,children:(0,q.jsx)(`span`,{className:`flex h-7 w-7 items-center justify-center rounded-full border border-line bg-surface-2 text-muted`,children:(0,q.jsx)(N,{size:13,"aria-hidden":`true`})})}),i.map(n=>(0,q.jsx)(Te,{name:`${c}-tint`,checked:e.tint===n,onChange:()=>t({...e,tint:n}),label:v[n],"data-sw-agent-tint-option":n,children:(0,q.jsx)(`span`,{className:`h-7 w-7 rounded-full`,style:{background:E(n)}})},n))]})]}):null]})}function De({value:e,onChange:t,builtIn:n=``,touch:r=!1,id:i,problem:a=null,disabled:o=!1}){return(0,q.jsx)(X,{label:`Name`,htmlFor:i,problem:a,hint:n?`Shown in chats, on its replies and on Fix buttons. Leave it empty for "${n}".`:`Shown in chats, on its replies and on Fix buttons.`,children:(0,q.jsx)(k,{id:i,size:r?`touch`:`sm`,value:e.name,onChange:n=>t({...e,name:n.target.value}),placeholder:n||`Agent`,maxLength:40,autoComplete:`off`,spellCheck:!1,disabled:o,"aria-invalid":a?`true`:void 0,"aria-describedby":a?`${i}-problem`:void 0,"data-sw-agent-name-input":!0})})}function Oe(e){let{problem:t}=s(e);return t?/control/.test(t)?`One line of plain text, without control characters.`:`At most 40 characters.`:null}function ke({value:e,onChange:t,builtIn:n,logo:r=null,upload:i=!0,touch:a=!1,disabled:o=!1}){let s=(0,Y.useId)();return(0,q.jsxs)(`div`,{className:`space-y-3 border-b border-line px-5 pt-5 pb-4`,"data-sw-connect-identity":!0,children:[(0,q.jsx)(De,{id:`${s}-name`,value:e,onChange:t,builtIn:n,touch:a,problem:Oe(e.name),disabled:o}),(0,q.jsxs)(`details`,{className:`group`,"data-sw-connect-icon":!0,children:[(0,q.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center gap-2 text-xs font-medium text-fg lg:min-h-8 [&::-webkit-details-marker]:hidden`,children:[(0,q.jsx)(f,{size:13,className:`text-muted transition-transform group-open:rotate-90`,"aria-hidden":`true`}),(0,q.jsx)(_,{label:e.name||n,icon:e.icon===Se?null:e.icon,tint:e.tint,logo:r,size:`sm`,src:e.png?`data:image/png;base64,${e.png}`:null}),`Icon (optional)`]}),(0,q.jsx)(`div`,{className:`pt-2`,children:(0,q.jsx)(Ee,{value:e,onChange:t,label:e.name||n,logo:r,upload:i,disabled:o})})]})]})}function Ae({agent:e,upload:t=!0,touch:r=!1,waiting:i=!1,onClose:a,onSaved:o}){let s=(0,Y.useId)(),[l,u]=(0,Y.useState)(Ce()),[d,ee]=(0,Y.useState)(!1),[f,p]=(0,Y.useState)(``),m=(0,Y.useRef)(null);(0,Y.useEffect)(()=>{e&&(m.current=e.id,u(Ce(e)),p(``))},[e]);let h=r?`touch`:`md`,g=Oe(l.name),v=e&&!e.builtIn&&!l.name.trim()?`Give it a name.`:null,y=e?!!we(e,l)||!!l.png:!1,b=async()=>{ee(!0),p(``);try{let t=await Q(e.id,e,l);await o?.(t),a()}catch(e){p(e.message||`It could not be saved.`)}finally{ee(!1)}},x=l.png?`data:image/png;base64,${l.png}`:null;return(0,q.jsx)(c,{open:!!e,onClose:()=>d?null:a(),title:`Name and icon`,description:`How this agent shows on the board. It keeps running; nothing is restarted.`,wrapDescription:!0,size:`md`,onCloseAutoFocus:e=>{let t=document.querySelector(`[data-sw-agent-edit="${CSS.escape(m.current||``)}"]`);t&&(e.preventDefault(),t.focus())},footer:(0,q.jsxs)(q.Fragment,{children:[(0,q.jsx)(n,{size:h,onClick:a,disabled:d,children:`Cancel`}),(0,q.jsx)(n,{size:h,variant:`default`,onClick:b,disabled:d||!y||!!(g||v),"data-sw-agent-identity-save":!0,children:d?i?`Saving when the connection test finishes...`:`Saving...`:`Save`})]}),children:(0,q.jsxs)(`form`,{className:`space-y-4 p-5`,onSubmit:e=>{e.preventDefault(),!d&&y&&!g&&!v&&b()},"data-sw-agent-identity":e?.id,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,q.jsx)(_,{label:l.name||e?.builtIn||e?.label,icon:l.icon===Se?null:l.icon,tint:l.tint,logo:e?.logo,src:x,size:`xl`,"data-sw-agent-identity-preview":!0}),(0,q.jsx)(`div`,{className:`min-w-0 flex-1`,children:(0,q.jsx)(De,{id:`${s}-name`,value:l,onChange:u,builtIn:e?.builtIn||``,touch:r,problem:g||v,disabled:d})})]}),(0,q.jsx)(Ee,{value:l,onChange:u,label:l.name||e?.builtIn||e?.label,logo:e?.logo,upload:t,disabled:d}),i&&!f?(0,q.jsx)(`p`,{className:`text-xs text-muted`,role:`status`,"data-sw-agent-identity-waiting":!0,children:`Its connection test is still running. Save waits for it to finish, then saves.`}):null,f?(0,q.jsx)(`p`,{className:`text-xs text-bad`,role:`alert`,"data-sw-agent-identity-error":!0,children:f}):null,(0,q.jsx)(`button`,{type:`submit`,className:`hidden`,tabIndex:-1,"aria-hidden":`true`})]})})}var je={claude:{text:`Install Claude Code and its adapter, then check again.`,anchor:`claude-code`},codex:{text:`Install Codex and its adapter, then check again.`,anchor:`codex`},goose:{text:`Install goose from its install guide, then check again.`,anchor:`goose`},gemini:{text:`Install Gemini CLI, then check again.`,anchor:`gemini-cli`}},Me=`In the demo nothing runs on a computer. On your install this looks for the agent again.`,Ne={connected:`Connected`,found:`Found, not connected`,"needs-adapter":`Found, but its adapter is missing`,"needs-shell":`Found, but only as a .cmd wrapper`,missing:`Not installed`};function Pe({title:e,description:t,children:n,...r}){return(0,q.jsxs)(`section`,{className:`space-y-2.5`,...r,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{className:`text-sm font-semibold text-fg`,children:e}),t?(0,q.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:t}):null]}),n]})}function Fe({view:e=null,disabled:t=!1,touch:i=!1,onBusy:a=null,onChanged:o=null,endpointForm:s=null,onOpenEndpoint:l=null,agent:d=null}){let[f,p]=(0,Y.useState)(null),[h,_]=(0,Y.useState)(null),[v,b]=(0,Y.useState)(null),[x,C]=(0,Y.useState)(null),[w,te]=(0,Y.useState)(null),[T,E]=(0,Y.useState)({}),[O,ne]=(0,Y.useState)(!1),[ie,k]=(0,Y.useState)(null),[A,j]=(0,Y.useState)(Ce());(0,Y.useEffect)(()=>a?.(!!x),[x,a]);let M=(0,Y.useCallback)(async()=>{if(d&&!d.settingsEditable)_(d.settingsReadonly?`Change agents on the computer running Shapewall.`:`owner`),b(d);else try{let e=await D.get(`/api/agent/settings`);if(e.editable===!1){_(e.message||`owner`),b(await D.get(`/api/agent/status`).catch(()=>null));return}p(e),_(null)}catch(e){e.status===404&&ee(),_(e.status===404?`owner`:e.message),b(await D.get(`/api/agent/status`).catch(()=>null))}},[d]);(0,Y.useEffect)(()=>{e||M()},[e,M]),ae(()=>{x||M()},!e);let N=e||f,oe=!!N?.testing;(0,Y.useEffect)(()=>{if(!oe||e||x)return;let t=window.setInterval(M,1500);return()=>window.clearInterval(t)},[oe,e,x,M]);let F=async t=>{t&&!e?p(t):e||await M(),await o?.()},L=(e,t)=>t?.demoNote?(te(null),E(n=>({...n,[e]:{note:t.demoNote}})),!0):!1,R=async(e,t=null)=>{C(e),E(t=>({...t,[e]:null}));try{let n=t?{name:A.name.trim(),...A.icon&&!A.png?{icon:A.icon}:{},...A.tint?{tint:A.tint}:{}}:{},r=await D.post(`/api/agent/settings/profiles/connect`,{agentId:e,confirm:t,...n});if(L(e,r))return;if(r.confirm){j(Ce({label:U.find(t=>t.id===e)?.label||``})),te({agentId:e,items:r.confirm,hash:r.confirmHash});return}if(te(null),r.connected&&t&&A.png){let t=await Q(e,{},{...A,name:``,tint:null}).catch(()=>null);t&&(r={...r,...t})}E(t=>({...t,[e]:r.result})),r.connected&&await F(r)}catch(t){te(null),E(n=>({...n,[e]:{ok:!1,message:t.message,details:[]}}))}finally{C(null)}},z=async e=>{C(e);try{let t=await D.delete(`/api/agent/settings/profiles/${encodeURIComponent(e)}`);if(L(e,t))return;await F(t),E(t=>({...t,[e]:null}))}catch(t){E(n=>({...n,[e]:{ok:!1,message:t.message,details:[]}}))}finally{C(null)}},fe=async(t,n=!1)=>{C(t),E(e=>({...e,[t]:null}));try{let r=await D.post(`/api/agent/settings/test`,n?{}:{profileId:t});if(L(t,r))return;E(e=>({...e,[t]:r})),e||await M()}catch(e){E(n=>({...n,[t]:{ok:!1,message:e.message,details:[]}}))}finally{C(null)}},B=async e=>{C(`default:${e}`);try{let t=await D.post(`/api/agent/settings/profiles/${encodeURIComponent(e)}/default`,{});if(L(`default`,t))return;await F(t)}catch(e){E(t=>({...t,default:{ok:!1,message:e.message,details:[]}}))}finally{C(null)}},V=i?`touch`:`sm`;if(h)return(0,q.jsx)(Ie,{locked:h,status:v});if(!N)return(0,q.jsxs)(`p`,{className:`flex items-center gap-2 p-1 text-sm text-muted`,"data-sw-agents-card":`loading`,children:[(0,q.jsx)(g,{}),` Looking for agents on this machine`]});let H=!!N.env?.acp,U=ye(N),W=[...U.filter(e=>e.kind===`connected`).map(e=>({id:e.id,label:e.label,state:e.profile.state,isDefault:e.profile.default,...y(e.profile),logo:e.logo})),...N.endpoint?[{id:`endpoint`,label:N.endpoint.label,state:N.endpoint.state,isDefault:N.endpoint.default,...y(N.endpoint)}]:[]],G=N.testing||null,me=G?U.find(e=>e.id===G.id)?.label||N.effective?.label||`the agent`:null,K=G?`Testing the connection to ${me}. This is available when the test finishes.`:void 0,J=!!x||t||H||!!G,he=!!x||t,X=w?U.find(e=>e.id===w.agentId):null,Z=H&&N.effective?.configured?{id:`default`,label:N.effective.label,...y(N.effective)}:null;return(0,q.jsxs)(`div`,{className:`space-y-6`,"data-sw-agents-card":N.demo?`demo`:`editable`,"data-sw-native-profiles":!0,children:[N.demo?(0,q.jsxs)(`p`,{className:`flex items-start gap-2 rounded-md border border-line bg-surface-2/60 px-3 py-2.5 text-xs text-muted`,role:`note`,"data-sw-agents-demo-note":!0,children:[(0,q.jsx)(m,{size:14,className:`mt-px shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{children:`This is a demo with sample agents on a pretend computer. The two scripted agents answer in this browser, and nothing is sent anywhere. Choosing the default, testing, removing and connecting them works here; Reset puts everything back.`})]}):null,G&&!x?(0,q.jsxs)(`p`,{className:`flex items-center gap-2 rounded-md border border-line bg-surface-2/60 px-3 py-2.5 text-xs text-fg`,role:`status`,"data-sw-agents-testing":G.id,children:[(0,q.jsx)(g,{size:12}),(0,q.jsxs)(`span`,{children:[`Testing the connection to `,me,`. Connect, Test connection, Remove and the default wait for it; a name or an icon can be changed meanwhile.`]})]}):null,H?(0,q.jsxs)(`p`,{className:`flex items-start gap-1.5 text-xs text-fg`,"data-sw-agents-override":!0,children:[(0,q.jsx)(se,{size:13,className:`mt-px shrink-0 text-warn`,"aria-hidden":`true`}),(0,q.jsxs)(`span`,{children:[`The agent command comes from `,N.env.acp===`flag`?`--agent-acp`:`SHAPEWALL_AGENT_ACP`,`, which wins over these settings. Change it there, or restart `,(0,q.jsx)(`code`,{className:`font-mono`,children:`shapewall serve`}),` without it.`]})]}):null,W.length?(0,q.jsxs)(Pe,{title:`Default agent for new chats and fixes`,description:`Chats that chose another agent keep theirs.`,children:[(0,q.jsx)(`div`,{role:`radiogroup`,"aria-label":`Default agent for new chats and fixes`,className:`grid gap-1.5`,"data-sw-agents-default":!0,children:W.map(e=>(0,q.jsxs)(`label`,{className:S(`flex min-h-11 cursor-pointer items-center gap-2.5 rounded-md border px-3 py-2 text-sm lg:min-h-10`,e.isDefault?`border-accent/50 bg-accent/10`:`border-line bg-surface hover:bg-surface-2`,J&&`cursor-default opacity-70`),title:K,"data-sw-agents-default-option":e.id,children:[(0,q.jsx)(`input`,{type:`radio`,name:`sw-default-agent`,className:`h-4 w-4 shrink-0 accent-[var(--color-accent)]`,checked:!!e.isDefault,disabled:J,onChange:()=>B(e.id)}),e.id===`endpoint`&&!e.icon&&!e.tint?(0,q.jsx)(pe,{size:16,className:`shrink-0 text-muted`,"aria-hidden":`true`}):(0,q.jsx)(le,{label:e.label,state:e.state,size:`sm`,icon:e.icon,tint:e.tint,logo:e.logo}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 truncate font-medium text-fg`,children:e.label}),x===`default:${e.id}`?(0,q.jsx)(g,{size:12}):null,e.isDefault?(0,q.jsx)(re,{tone:`accent`,children:`Default`}):null]},e.id))}),T.default?(0,q.jsx)(ve,{result:T.default}):null]}):null,(0,q.jsx)(Pe,{title:`Agents on this machine`,description:`Shapewall looks for these on this computer's PATH. It never installs or downloads anything.`,children:(0,q.jsxs)(`ul`,{className:`divide-y divide-line rounded-md border border-line`,"aria-label":`Agents on this machine`,children:[Z?(0,q.jsx)(`li`,{className:`p-3`,"data-sw-agent-row":`default`,"data-sw-agent-row-state":`fixed`,children:(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,q.jsx)(le,{label:Z.label,state:N.effective.problem?`unavailable`:`ready`,...y(Z)}),(0,q.jsxs)(`div`,{className:`min-w-[10rem] flex-1`,children:[(0,q.jsxs)(`p`,{className:`flex flex-wrap items-center gap-1.5 text-sm font-medium text-fg`,children:[Z.label,` `,(0,q.jsx)(re,{tone:`accent`,children:`Default`})]}),(0,q.jsxs)(`p`,{className:`text-xs text-muted`,children:[`Started from `,N.env.acp===`flag`?`--agent-acp`:`SHAPEWALL_AGENT_ACP`]})]}),(0,q.jsxs)(n,{size:V,disabled:he,onClick:()=>k({...Z,builtIn:N.effective.builtInLabel||Z.label}),"aria-label":`Edit ${Z.label}: name and icon`,"data-sw-agent-edit":`default`,children:[(0,q.jsx)(P,{size:13,"aria-hidden":`true`}),` Edit`]})]})}):null,U.map(e=>(0,q.jsxs)(`li`,{className:`space-y-2 p-3`,"data-sw-agent-row":e.id,"data-sw-agent-row-state":e.kind,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[(0,q.jsx)(le,{label:e.label,state:e.kind===`connected`?e.profile.state:`unavailable`,...y(e.profile),logo:e.logo}),(0,q.jsxs)(`div`,{className:`min-w-[10rem] flex-1`,children:[(0,q.jsxs)(`p`,{className:`flex flex-wrap items-center gap-1.5 text-sm font-medium text-fg`,children:[e.label,e.profile?.default?(0,q.jsx)(re,{tone:`accent`,children:`Default`}):null]}),(0,q.jsx)(`p`,{className:S(`text-xs`,e.kind===`connected`&&e.profile.state===`login`?`text-fg`:`text-muted`),children:e.kind===`connected`?e.profile.state===`testing`?`Connecting. Testing the connection...`:`Connected. ${r(e.profile)}`:Ne[e.kind]})]}),(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:e.kind===`connected`?(0,q.jsxs)(q.Fragment,{children:[(0,q.jsxs)(n,{size:V,disabled:J,title:K,onClick:()=>fe(e.id,e.profile.legacy),"data-sw-agent-test":e.id,children:[x===e.id?(0,q.jsx)(g,{}):null,` Test connection`]}),(0,q.jsxs)(n,{size:V,disabled:he,onClick:()=>k({id:e.id,label:e.label,...y(e.profile),logo:e.logo,builtIn:e.builtIn}),"aria-label":`Edit ${e.label}: name and icon`,"data-sw-agent-edit":e.id,children:[(0,q.jsx)(P,{size:13,"aria-hidden":`true`}),` Edit`]}),(0,q.jsxs)(n,{size:V,variant:`danger`,disabled:J,title:K,onClick:()=>z(e.id),"data-sw-agent-remove":e.id,children:[(0,q.jsx)(ce,{size:13,"aria-hidden":`true`}),` Remove`]})]}):e.kind===`found`?(0,q.jsxs)(n,{size:V,variant:`default`,disabled:J,title:K,onClick:()=>R(e.id),"data-sw-profile-connect":e.id,"data-sw-agent-connect-row":e.id,children:[x===e.id?(0,q.jsx)(g,{}):(0,q.jsx)(ue,{size:13,"aria-hidden":`true`}),` `,x===e.id?`Connecting...`:`Connect`]}):e.kind===`needs-adapter`||e.kind===`missing`?(0,q.jsxs)(n,{size:V,variant:`ghost`,disabled:!!x,onClick:()=>N.demo?L(e.id,{demoNote:Me}):F(),"data-sw-agent-check":e.id,children:[(0,q.jsx)(de,{size:13,"aria-hidden":`true`}),` Check again`]}):null})]}),e.kind===`connected`&&e.profile.state===`login`&&e.profile.loginHint?(0,q.jsxs)(`p`,{className:`text-xs text-muted`,"data-sw-agent-sign-in":e.id,children:[u(e.profile.loginHint),`, then test again.`]}):null,e.kind===`needs-adapter`&&e.install?(0,q.jsxs)(`div`,{className:`space-y-1`,children:[(0,q.jsx)(`p`,{className:`text-xs text-muted`,children:`Install its adapter in a terminal, then check again:`}),(0,q.jsx)(ge,{text:e.install,label:`${e.label} install`,touch:i})]}):null,e.kind===`needs-shell`?(0,q.jsxs)(`p`,{className:`text-xs text-muted`,children:[`It needs a shell, which Shapewall never starts. Under Other, set the agent command to`,` `,(0,q.jsx)(`code`,{className:`font-mono`,children:`node`}),` and the path of its script (see the docs).`]}):null,e.kind===`missing`?(0,q.jsxs)(`p`,{className:`text-xs text-muted`,children:[je[e.id]?.text||`Install it, then check again.`,` `,(0,q.jsxs)(`a`,{className:`inline-flex items-center gap-0.5 text-accent underline-offset-2 hover:underline`,href:`${Xe}#${je[e.id]?.anchor||`connect-an-agent-cli-over-acp`}`,target:`_blank`,rel:`noreferrer`,children:[`How to set it up `,(0,q.jsx)(I,{size:11,"aria-hidden":`true`})]})]}):null,(0,q.jsx)(ve,{result:T[e.id]})]},e.id)),(0,q.jsxs)(`li`,{className:`space-y-2 p-3`,"data-sw-agent-row":`endpoint`,"data-sw-agent-row-state":N.endpoint?`connected`:`none`,children:[(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[N.endpoint?.icon||N.endpoint?.tint?(0,q.jsx)(le,{label:N.endpoint.label,state:N.endpoint.state||`ready`,...y(N.endpoint)}):(0,q.jsx)(`span`,{className:`inline-flex h-7 w-7 shrink-0 items-center justify-center rounded-md border border-line bg-surface-2 text-muted`,children:(0,q.jsx)(pe,{size:14,"aria-hidden":`true`})}),(0,q.jsxs)(`div`,{className:`min-w-[10rem] flex-1`,children:[(0,q.jsxs)(`p`,{className:`flex flex-wrap items-center gap-1.5 text-sm font-medium text-fg`,children:[`Other`,N.endpoint?.default?(0,q.jsx)(re,{tone:`accent`,children:`Default`}):null]}),(0,q.jsx)(`p`,{className:`text-xs text-muted`,children:N.endpoint?`${N.endpoint.label}${N.endpoint.host?` at ${N.endpoint.host}`:``}`:`An OpenAI-compatible endpoint: OpenAI, DeepSeek, OpenRouter, Ollama, LM Studio.`})]}),(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[N.endpoint?.default?(0,q.jsxs)(n,{size:V,disabled:J,onClick:()=>fe(`endpoint`,!0),"data-sw-agent-test":`endpoint`,children:[x===`endpoint`?(0,q.jsx)(g,{}):null,` Test connection`]}):null,N.endpoint?(0,q.jsxs)(n,{size:V,disabled:he,onClick:()=>k({id:`endpoint`,label:N.endpoint.label,...y(N.endpoint),builtIn:N.endpoint.model}),"aria-label":`Name and icon of ${N.endpoint.label}`,"data-sw-agent-edit":`endpoint`,children:[(0,q.jsx)(P,{size:13,"aria-hidden":`true`}),` Name and icon`]}):null,s||l?(0,q.jsx)(n,{size:V,disabled:!!x||t,onClick:()=>l?l():ne(!0),"data-sw-agent-endpoint":!0,children:N.endpoint?`Edit`:`Set up`}):null]})]}),(0,q.jsx)(ve,{result:T.endpoint})]})]})}),(0,q.jsx)(_e,{items:w?.items||null,keyVar:``,busy:!!x,touch:i,onCancel:()=>te(null),onConfirm:()=>R(w.agentId,w.hash),confirmLabel:`Allow and connect`,blocked:!!Oe(A.name),children:(0,q.jsx)(ke,{value:A,onChange:j,builtIn:X?.builtIn||X?.label||``,logo:X?.logo,upload:N.iconUpload!==!1,touch:i,disabled:!!x})}),(0,q.jsx)(Ae,{agent:ie,waiting:!!(G&&ie&&(G.id===ie.id||ie.id==="default"&&G.id==="default")),upload:N.iconUpload!==!1,touch:i,onClose:()=>k(null),onSaved:e=>e?F(e):null}),s?(0,q.jsx)(c,{open:O,onClose:()=>{ne(!1),F()},title:`Other agent settings`,size:`md`,children:(0,q.jsx)(`div`,{className:`p-5`,children:O?s({onSaved:()=>F()}):null})}):null]})}function Ie({locked:e,status:t}){let{options:n}=h({profileId:`default`,profiles:t?.profiles||[]}),i=n.length?n:t?.configured?[{id:`default`,label:t.label||`Agent`,state:t.state||`ready`,isDefault:!0,configured:!0,...y(t)}]:[];return(0,q.jsxs)(`div`,{className:`space-y-3`,"data-sw-agents-card":`readonly`,children:[(0,q.jsxs)(`p`,{className:`flex items-start gap-2 rounded-md border border-line bg-surface-2/60 px-3 py-2.5 text-xs text-muted`,role:`note`,children:[(0,q.jsx)(F,{size:14,className:`mt-px shrink-0`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{children:e===`owner`?`To change agents, open the owner link that shapewall serve prints in your terminal (or run shapewall serve --open).`:e})]}),i.length?(0,q.jsx)(`ul`,{className:`divide-y divide-line rounded-md border border-line`,"aria-label":`Connected agents`,children:i.map(e=>(0,q.jsxs)(`li`,{className:`flex items-center gap-3 p-3`,"data-sw-agent-row":e.id,"data-sw-agent-row-state":`connected`,children:[(0,q.jsx)(le,{label:e.label,state:e.state,icon:e.icon,tint:e.tint,logo:e.logo}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`p`,{className:`flex flex-wrap items-center gap-1.5 text-sm font-medium text-fg`,children:[e.label,e.isDefault?(0,q.jsx)(re,{tone:`accent`,children:`Default`}):null]}),(0,q.jsx)(`p`,{className:`text-xs text-muted`,children:r(e)})]})]},e.id))}):(0,q.jsx)(`p`,{className:`text-xs text-muted`,children:`No agent is connected.`})]})}function $(e){let t=e?.saved||{},n=t.backend===`acp`&&t.acpCommand?(t.profiles||[]).find(e=>e.acpCommand===t.acpCommand):null;return{backend:t.backend||e?.effective?.backend||`openai-compatible`,baseUrl:t.baseUrl||``,model:t.model||``,apiKeyEnv:t.apiKeyEnv||``,label:n?.label||t.label||``,acpCommand:t.acpCommand||``,keyHosts:t.keyHosts||[],vision:typeof t.vision==`boolean`?t.vision:null}}function Le(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Re({view:e,form:t,next:n}){let r=e?!Le(t,$(e)):!1,i=$(n);return r?{view:n,form:t,stale:!Le($(e),i)&&!Le(t,i)}:{view:n,form:i,stale:!1}}var ze=e({SettingsDialog:()=>Ye}),Be=/^(SHAPEWALL_AGENT_[A-Z0-9_]+|[A-Z][A-Z0-9_]*_API_KEY)$/,Ve=new Set([`GITHUB_TOKEN`,`GH_TOKEN`,`SHAPEWALL_GITHUB_TOKEN`,`SHAPEWALL_GITHUB_WEBHOOK_SECRET`,`SHAPEWALL_WEBHOOK_SECRET`,`RESEND_API_KEY`,`SHAPEWALL_AGENT_BASE_URL`,`SHAPEWALL_AGENT_MODEL`,`SHAPEWALL_AGENT_KEY_HOSTS`]),He=[{id:`openai-compatible`,label:`OpenAI-compatible`},{id:`acp`,label:`ACP agent`}],Ue=[{label:`Claude Code`,command:`claude-agent-acp`},{label:`Codex`,command:`codex-acp`},{label:`goose`,command:`goose acp --with-builtin developer`},{label:`Gemini CLI`,command:`gemini --acp`}];function We(e){return e&&(!Be.test(e)||Ve.has(e))?`Use SHAPEWALL_AGENT_API_KEY or a name ending in _API_KEY (never another tool’s token).`:null}function Ge(e){try{let t=new URL(e);return[`http:`,`https:`].includes(t.protocol)?t.host.toLowerCase():null}catch{return null}}function Ke({onSaved:e,touch:t,buzz:r=!1,onDirtyChange:i,agents:a=`inline`}){let[o,s]=(0,Y.useState)(null),[c,l]=(0,Y.useState)(null),[u,d]=(0,Y.useState)($(null)),[f,p]=(0,Y.useState)(!1),[h,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(!1),[x,C]=(0,Y.useState)(null),[w,T]=(0,Y.useState)(!1),[E,O]=(0,Y.useState)(null),[ie,A]=(0,Y.useState)(!1),j=f||ie,[N,oe]=(0,Y.useState)(!1),P=(0,Y.useRef)(0),ce=(0,Y.useRef)(0),F=(0,Y.useRef)(!1),I=(0,Y.useRef)({view:null,form:null}),le=(0,Y.useRef)(null),L=(0,Y.useCallback)(async()=>{let e=++P.current;ce.current+=1;try{let t=await D.get(`/api/agent/settings`);if(e!==P.current)return;s(t),d($(t)),oe(!1),l(null),I.current={view:t,form:$(t)}}catch(t){if(e!==P.current)return;t.status===404&&ee(),l(t.status===404?J:t.message)}finally{--ce.current,!ce.current&&F.current&&(F.current=!1,le.current?.())}},[]);(0,Y.useEffect)(()=>{L()},[L]),le.current=async()=>{if(j||!I.current.view||c)return;if(ce.current){F.current=!0;return}let e=P.current,t;try{t=await D.get(`/api/agent/settings`)}catch{return}if(e!==P.current||ce.current||!I.current.view)return;let n=Re({view:I.current.view,form:I.current.form,next:t});s(n.view),d(n.form),n.stale&&oe(!0)},ae(()=>le.current?.());let R=e=>t=>{let n=typeof t==`string`?t:t.target.value;d(t=>({...t,[e]:n})),y(!1)};I.current={view:o,form:u};let z=o?!Le(u,$(o)):!1;(0,Y.useEffect)(()=>{z||oe(!1)},[z]),(0,Y.useEffect)(()=>(i?.(z),()=>i?.(!1)),[z,i]);let fe=()=>{d($(o)),_(null),y(!1)},B=o?.config||{},V=o?.effective||{},pe=u.backend===`acp`,H=u.apiKeyEnv.trim()||B.apiKeyEnv||o?.defaultKeyVar||`SHAPEWALL_AGENT_API_KEY`,U=We(u.apiKeyEnv.trim()),W=!!o?.keyVarsSet?.includes(H),me=o?.env?.baseUrl?V.baseUrl:u.baseUrl.trim()||B.baseUrl||``,K=Ge(me),ye=u.baseUrl.trim()&&!Ge(u.baseUrl.trim())?`An http(s) URL, such as https://api.deepseek.com`:null,be=!W&&!u.apiKeyEnv.trim()&&!B.apiKeyEnv&&/^http:/i.test(me),xe=!!o?.env?.acp,Se=(0,Y.useMemo)(()=>({backend:u.backend,baseUrl:u.baseUrl.trim()||null,model:u.model.trim()||null,apiKeyEnv:u.apiKeyEnv.trim()||null,label:u.label.trim()||null,acpCommand:u.acpCommand.trim()||null,keyHosts:u.keyHosts,vision:u.vision}),[u]),Ce=async(t=null)=>{p(!0),_(null);try{let n=await D.post(`/api/agent/settings`,{settings:Se,confirm:t});if(n.demoNote){C(null),O({note:n.demoNote});return}if(n.confirm){C({items:n.confirm,hash:n.confirmHash});return}P.current+=1,s(n),d($(n)),C(null),y(!0),O(null),e?.()}catch(e){C(null),_(e.message)}finally{p(!1)}},we=async()=>{T(!0),O(null);try{let e=await D.post(`/api/agent/settings/test`,{});O(e),typeof e.vision==`boolean`&&e.vision!==(u.vision??!0)&&d(t=>({...t,vision:e.vision}))}catch(e){O({ok:!1,message:e.message,details:[]})}finally{T(!1)}};if(c)return(0,q.jsxs)(`div`,{className:`space-y-3 p-5`,"data-sw-settings-error":`load`,children:[(0,q.jsx)(`p`,{className:`text-sm text-bad`,role:`alert`,children:c===`On the computer running Shapewall, run shapewall settings --config FILE --open with this project’s config file to open agent settings. For a direct local board, you can also use the owner link printed by shapewall serve.`?(0,q.jsx)(he,{}):`Could not load the agent settings: ${c}`}),c===`On the computer running Shapewall, run shapewall settings --config FILE --open with this project’s config file to open agent settings. For a direct local board, you can also use the owner link printed by shapewall serve.`?null:(0,q.jsx)(n,{size:t?`touch`:`sm`,onClick:()=>{l(null),L()},children:`Try again`})]});if(!o)return(0,q.jsxs)(`div`,{className:`flex items-center gap-2 p-5 text-sm text-muted`,children:[(0,q.jsx)(g,{}),` Loading`]});if(o.editable===!1)return(0,q.jsxs)(`div`,{className:`space-y-3 p-5`,"data-sw-settings-readonly":!0,children:[(0,q.jsx)(`p`,{className:`text-sm text-muted`,children:o.message}),(0,q.jsx)(`dl`,{className:`space-y-2 text-sm text-fg`,children:[[`Agent`,V.label],[`Backend`,V.backend],[`Command`,V.acpCommand],[`Model`,V.model],[`Endpoint`,V.baseUrl],[`Key variable`,V.keyVar]].filter(([,e])=>e).map(([e,t])=>(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`dt`,{className:`text-xs text-muted`,children:e}),(0,q.jsx)(`dd`,{className:`break-all`,children:t})]},e))})]});let Q=t?`touch`:`sm`,Te=e=>V.sources?.[e]===`config`?`from shapewall.config.json`:null,Ee=(e,t)=>B[e]?`${B[e]} (${Te(e)||`from the config`})`:t;return(0,q.jsxs)(`div`,{className:`space-y-5`,"data-sw-settings":`agent`,children:[a===`inline`?(0,q.jsxs)(`section`,{className:`space-y-3 rounded-md border border-line p-3`,"aria-labelledby":`sw-agents-inline`,children:[(0,q.jsxs)(`div`,{children:[(0,q.jsx)(`h3`,{id:`sw-agents-inline`,className:`text-sm font-semibold text-fg`,children:`Agents`}),(0,q.jsxs)(`p`,{className:`mt-0.5 text-xs text-muted`,children:[`Connect several agents, then choose one per chat. Each runs its own session with its own login on this computer.`,r?` Buzz conversations are separate.`:``]})]}),(0,q.jsx)(Fe,{view:o,disabled:z||f||w,touch:t,onBusy:A,onChanged:async()=>{await L(),e?.()}}),z?(0,q.jsx)(`p`,{className:`text-xs text-muted`,children:`Save or discard your changes below before changing agents.`}):null]}):a===`link`?(0,q.jsx)(Je,{view:o,touch:t}):null,o.project?.root?(0,q.jsxs)(`section`,{className:`space-y-1.5 rounded-md border border-line p-3 text-xs`,"data-sw-agent-project":!0,children:[(0,q.jsx)(`h3`,{className:`font-semibold text-fg`,children:`Source folder on the Shapewall computer`}),(0,q.jsx)(`code`,{className:`block font-mono break-all text-fg`,"data-sw-agent-project-root":!0,children:o.project.root}),(0,q.jsx)(`p`,{className:`text-muted`,children:`Native agents work in this folder for every board in this project. Capturing a website does not give access to its source. To work on another repository, serve a separate project from that checkout on the computer with your agent login.`})]}):null,N?(0,q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-2 rounded-md border border-line p-2.5 text-xs`,role:`status`,"data-sw-settings-stale":!0,children:[(0,q.jsx)(de,{size:14,className:`shrink-0 text-muted`,"aria-hidden":`true`}),(0,q.jsx)(`span`,{className:`min-w-0 flex-1 text-muted`,children:`Agent settings changed elsewhere. Reload to see them.`}),(0,q.jsx)(n,{size:t?`touch`:`xs`,variant:`secondary`,onClick:L,"data-sw-settings-stale-reload":!0,children:`Reload`})]}):null,(0,q.jsxs)(`section`,{className:`flex items-start gap-3 rounded-md border border-line bg-surface-2/60 p-3 text-xs`,"data-sw-settings-status":V.configured?`connected`:`not-connected`,children:[(0,q.jsx)(m,{size:16,className:`mt-px shrink-0 text-muted`,"aria-hidden":`true`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1 space-y-0.5`,children:[(0,q.jsx)(`p`,{className:`font-medium text-fg`,children:V.configured?(0,q.jsxs)(q.Fragment,{children:[`Chat uses `,V.label||`the agent`,V.backend===`acp`?` over ACP, on this machine`:V.host?` at ${V.host}`:``]}):`Chat is not connected yet`}),V.problem?(0,q.jsx)(`p`,{className:`text-bad`,children:V.problem}):null]}),(0,q.jsx)(re,{tone:V.configured?`ok`:`warn`,children:V.configured?V.backend===`acp`?`Command set`:`Connected`:`Not connected`})]}),xe?(0,q.jsxs)(`div`,{className:`space-y-1.5`,"data-sw-settings-acp-override":o.env.acp,children:[(0,q.jsxs)(Z,{children:[`The agent command comes from`,` `,o.env.acp===`flag`?`the --agent-acp option on the command line`:`SHAPEWALL_AGENT_ACP in the environment`,` and wins over these settings until Shapewall is started without it.`]}),(0,q.jsx)(`label`,{htmlFor:`sw-agent-acp-in-use`,className:`block text-xs font-medium text-fg`,children:`Command in use`}),(0,q.jsx)(k,{id:`sw-agent-acp-in-use`,size:Q,value:V.acpCommand||``,readOnly:!0,className:`font-mono`,"data-sw-settings-acp-in-use":`true`})]}):null,o.fileProblem?(0,q.jsx)(`p`,{className:`text-xs text-bad`,children:o.fileProblem}):null,(0,q.jsx)(X,{label:`Connect to`,children:(0,q.jsx)(ne,{label:`Connect to`,options:He,value:u.backend,onChange:e=>{R(`backend`)(e),O(null)},large:t,disabled:j,className:`max-w-sm`})}),pe?(0,q.jsxs)(`div`,{className:`space-y-4`,"data-sw-settings-backend":`acp`,children:[(0,q.jsxs)(`section`,{className:`space-y-1.5 rounded-md border border-warn/60 bg-warn/10 p-3 text-xs text-fg`,role:`note`,"data-sw-settings-acp-warning":`true`,children:[(0,q.jsxs)(`p`,{className:`flex items-center gap-1.5 font-medium`,children:[(0,q.jsx)(se,{size:14,className:`shrink-0 text-warn`,"aria-hidden":`true`}),` An ACP agent brings its own tools`]}),(0,q.jsx)(`p`,{children:`It runs with its own tools and extensions (a shell, browser control, MCP servers from its own config), and Shapewall does not sandbox them: Shapewall only asks you before its own file writes and commands. Use a restricted profile:`}),(0,q.jsxs)(`ul`,{className:`list-disc space-y-0.5 pl-5`,children:[(0,q.jsxs)(`li`,{children:[`Claude Code: permission mode `,(0,q.jsx)(`code`,{className:`font-mono`,children:`default`}),` or `,(0,q.jsx)(`code`,{className:`font-mono`,children:`plan`}),` in your Claude settings, never `,(0,q.jsx)(`code`,{className:`font-mono`,children:`bypassPermissions`}),`.`]}),(0,q.jsxs)(`li`,{children:[`Codex: `,(0,q.jsx)(`code`,{className:`font-mono`,children:`sandbox_mode = "workspace-write"`}),` or `,(0,q.jsx)(`code`,{className:`font-mono`,children:`"read-only"`}),`, never `,(0,q.jsx)(`code`,{className:`font-mono`,children:`danger-full-access`}),`.`]}),(0,q.jsxs)(`li`,{children:[`goose: `,(0,q.jsx)(`code`,{className:`font-mono`,children:`goose acp --with-builtin developer`}),` with a profile of its own that has no other extensions (`,(0,q.jsx)(`code`,{className:`font-mono`,children:`GOOSE_PATH_ROOT`}),`).`]})]})]}),(0,q.jsx)(X,{label:xe?`Saved agent command (used when Shapewall starts without the override)`:`Agent command`,htmlFor:`sw-agent-acp`,hint:`One program and its arguments, no shell. It runs on this machine, as you, with its own login; Shapewall asks you before it writes files or runs commands.`,children:(0,q.jsx)(k,{id:`sw-agent-acp`,size:Q,value:u.acpCommand,onChange:R(`acpCommand`),placeholder:`claude-agent-acp`,disabled:j,spellCheck:!1,autoCapitalize:`off`,autoComplete:`off`,className:`font-mono`,"data-sw-settings-field":`acpCommand`})}),(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,"aria-label":`Common agents`,children:Ue.map(e=>(0,q.jsx)(n,{size:t?`touch`:`xs`,variant:u.acpCommand.trim()===e.command?`default`:`secondary`,disabled:j,onClick:()=>R(`acpCommand`)(e.command),"data-sw-settings-preset":e.command,children:e.label},e.command))}),(0,q.jsxs)(`p`,{className:`text-xs text-muted`,children:[`Install the adapter first (for Claude Code:`,` `,(0,q.jsx)(`code`,{className:`font-mono`,children:`npm install -g @agentclientprotocol/claude-agent-acp`}),`). See`,` `,(0,q.jsx)(`a`,{className:`text-accent underline-offset-2 hover:underline`,href:`https://shapewall.com/docs/chat`,target:`_blank`,rel:`noreferrer`,children:`the chat docs`}),` `,`for Codex, goose and Gemini CLI.`]})]}):(0,q.jsxs)(`div`,{className:`space-y-4`,"data-sw-settings-backend":`openai-compatible`,children:[(0,q.jsxs)(X,{label:`Base URL`,htmlFor:`sw-agent-url`,problem:ye,hint:`The chat completions endpoint without /chat/completions, such as https://api.deepseek.com or https://api.openai.com/v1.`,children:[(0,q.jsx)(k,{id:`sw-agent-url`,size:Q,value:u.baseUrl,onChange:R(`baseUrl`),placeholder:Ee(`baseUrl`,`https://api.deepseek.com`),inputMode:`url`,spellCheck:!1,autoCapitalize:`off`,autoComplete:`off`,disabled:o.env.baseUrl||j,"aria-invalid":ye?!0:void 0,"aria-describedby":ye?`sw-agent-url-problem`:void 0,"data-sw-settings-field":`baseUrl`}),o.env.baseUrl?(0,q.jsx)(Z,{children:`SHAPEWALL_AGENT_BASE_URL is set in the environment and wins over this field.`}):null]}),(0,q.jsxs)(X,{label:`Model`,htmlFor:`sw-agent-model`,children:[(0,q.jsx)(k,{id:`sw-agent-model`,size:Q,value:u.model,onChange:R(`model`),placeholder:Ee(`model`,`deepseek-chat`),spellCheck:!1,autoCapitalize:`off`,autoComplete:`off`,disabled:o.env.model||j,"data-sw-settings-field":`model`}),o.env.model?(0,q.jsx)(Z,{children:`SHAPEWALL_AGENT_MODEL is set in the environment and wins over this field.`}):null]}),(0,q.jsx)(X,{label:`API key variable`,htmlFor:`sw-agent-keyvar`,problem:U,hint:`The name of the environment variable that holds the key. Not the key itself.`,children:(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(k,{id:`sw-agent-keyvar`,size:Q,value:u.apiKeyEnv,onChange:e=>R(`apiKeyEnv`)(e.target.value.toUpperCase()),placeholder:B.apiKeyEnv||o.defaultKeyVar,spellCheck:!1,autoCapitalize:`characters`,autoComplete:`off`,disabled:j,className:`font-mono`,"aria-invalid":U?!0:void 0,"aria-describedby":U?`sw-agent-keyvar-problem`:void 0,"data-sw-settings-field":`apiKeyEnv`}),be?null:(0,q.jsx)(re,{tone:W?`ok`:`warn`,"data-sw-settings-key":W?`set`:`missing`,children:W?`Set`:`Not set`})]})}),(0,q.jsxs)(`div`,{className:`space-y-1`,"data-sw-settings-host":K||`none`,children:[(0,q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs font-medium text-fg`,children:[(0,q.jsx)(ue,{size:13,"aria-hidden":`true`}),` Where the key goes`]}),(0,q.jsx)(`p`,{className:`text-xs text-muted`,children:K?W?(0,q.jsxs)(q.Fragment,{children:[`Each chat request sends the key in `,(0,q.jsx)(`code`,{className:`font-mono`,children:H}),` to`,` `,(0,q.jsx)(`span`,{className:`font-medium text-fg`,"data-sw-settings-key-host":`true`,children:K}),`, and nowhere else.`]}):be?(0,q.jsxs)(q.Fragment,{children:[`Requests go to `,(0,q.jsx)(`span`,{className:`font-medium text-fg`,children:K}),`, without a key.`]}):(0,q.jsxs)(q.Fragment,{children:[`Requests go to `,(0,q.jsx)(`span`,{className:`font-medium text-fg`,children:K}),`, without a key until`,` `,(0,q.jsx)(`code`,{className:`font-mono`,children:H}),` is set.`]}):`Set a base URL to see where requests go.`})]}),be?(0,q.jsx)(`p`,{className:`text-xs text-muted`,"data-sw-settings-key-notice":`none`,children:`No API key needed for a local server like Ollama. If yours wants one, name its variable above.`}):(0,q.jsxs)(`div`,{className:`space-y-2 rounded-md border border-line p-3`,"data-sw-settings-key-notice":`true`,children:[(0,q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs font-medium text-fg`,children:[(0,q.jsx)(G,{size:13,"aria-hidden":`true`}),` Keys stay in the environment`]}),(0,q.jsxs)(`p`,{className:`text-xs text-muted`,children:[`Shapewall never asks for your API key, saves it or shows it. Set it in the terminal that runs`,` `,(0,q.jsx)(`code`,{className:`font-mono`,children:`shapewall serve`}),`, then restart it:`]}),(0,q.jsx)(ge,{text:`export ${H}="paste-your-key-here"`,label:`shell`,touch:t}),(0,q.jsx)(ge,{text:`$env:${H} = "paste-your-key-here"`,label:`PowerShell`,touch:t})]}),u.keyHosts.length?(0,q.jsxs)(`div`,{className:`space-y-1.5`,"data-sw-settings-key-hosts":`true`,children:[(0,q.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:`Hosts you allowed the key to go to`}),(0,q.jsx)(`div`,{className:`flex flex-wrap gap-1.5`,children:u.keyHosts.map(e=>(0,q.jsxs)(`span`,{className:`inline-flex items-center gap-1 rounded-full border border-line bg-surface-2 py-0.5 pr-0.5 pl-2 text-xs`,"data-sw-settings-key-host-item":e.host,children:[e.host,` `,(0,q.jsx)(`span`,{className:`font-mono text-faint`,children:e.apiKeyEnv}),(0,q.jsx)(n,{variant:`ghost`,size:t?`icon`:`icon-xs`,disabled:j,onClick:()=>d(t=>({...t,keyHosts:t.keyHosts.filter(t=>t!==e)})),"aria-label":`Stop sending ${e.apiKeyEnv} to ${e.host}`,children:(0,q.jsx)(b,{size:12,"aria-hidden":`true`})})]},`${e.apiKeyEnv}@${e.host}`))})]}):null]}),(0,q.jsxs)(`div`,{className:`space-y-1`,"data-sw-settings-vision":u.vision===null?`auto`:String(u.vision),children:[(0,q.jsxs)(te,{size:Q,pressed:u.vision??(!pe||V.vision!==!1),disabled:j,onPressedChange:e=>{d(t=>({...t,vision:e})),y(!1)},"data-sw-settings-field":`vision`,children:[u.vision??(!pe||V.vision!==!1)?(0,q.jsx)(M,{size:13,"aria-hidden":`true`}):null,`This model takes images`]}),(0,q.jsx)(`p`,{className:`text-xs text-muted`,children:u.vision===!1?`Images are not sent; the chat says so when one is attached.`:pe&&u.vision===null?`The agent says itself whether it takes images. Test connection checks it.`:`Turn off for a text-only model (many local models): images are then left out instead of failing.`})]}),(0,q.jsx)(X,{label:`Name in the chat panel (optional)`,htmlFor:`sw-agent-label`,children:(0,q.jsx)(k,{id:`sw-agent-label`,size:Q,value:u.label,onChange:R(`label`),placeholder:B.label||(pe?`the agent’s name`:`the model name`),maxLength:40,disabled:j,"data-sw-settings-field":`label`})}),(0,q.jsxs)(`p`,{className:`text-xs text-faint`,"data-sw-settings-file":`true`,children:[`Saved for this project in `,(0,q.jsx)(`code`,{className:`font-mono break-all`,children:o.file||`your config folder`}),`, outside the repo, never in shapewall.config.json. The environment and `,(0,q.jsx)(`code`,{className:`font-mono`,children:`--agent-acp`}),` win over these settings; they win over the config.`]}),h?(0,q.jsx)(`p`,{className:`text-xs text-bad`,role:`alert`,"data-sw-settings-error":`save`,children:h}):null,(0,q.jsx)(ve,{result:E}),(0,q.jsxs)(`div`,{className:S(`flex flex-wrap items-center gap-2`,t&&`flex-col-reverse items-stretch`),children:[(0,q.jsxs)(n,{size:Q,onClick:we,disabled:w||f||z,"data-sw-settings-test":`true`,children:[w?(0,q.jsx)(g,{}):(0,q.jsx)(ue,{size:14,"aria-hidden":`true`}),` `,w?`Testing...`:`Test connection`]}),z?(0,q.jsx)(`span`,{className:`text-xs text-muted`,children:`Save to test these settings.`}):null,v&&!z?(0,q.jsx)(`span`,{className:`text-xs text-muted`,role:`status`,"data-sw-settings-saved":`true`,children:`Saved. Chat uses it now.`}):null,z?(0,q.jsx)(n,{size:Q,variant:`ghost`,className:S(!t&&`ml-auto`),onClick:fe,disabled:f,"data-sw-settings-discard":`true`,children:`Discard changes`}):null,(0,q.jsx)(n,{size:Q,variant:`default`,className:S(!t&&!z&&`ml-auto`),onClick:()=>Ce(null),disabled:f||!z||!!U||!!ye,"data-sw-settings-save":`true`,children:f?`Saving...`:`Save`})]}),(0,q.jsx)(_e,{items:x?.items||null,keyVar:H,busy:f,touch:t,onCancel:()=>C(null),onConfirm:()=>Ce(x?.hash||null)})]})}var qe=`/console?section=agents`;function Je({view:e,touch:t}){let r=e.profiles||[],i=r.find(e=>e.default);return(0,q.jsxs)(`section`,{className:`flex flex-wrap items-center gap-3 rounded-md border border-line p-3`,"data-sw-agents-link":!0,children:[(0,q.jsx)(m,{size:16,className:`shrink-0 text-muted`,"aria-hidden":`true`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1 text-xs`,children:[(0,q.jsx)(`p`,{className:`text-sm font-semibold text-fg`,children:`Agents`}),(0,q.jsxs)(`p`,{className:`text-muted`,children:[r.length?`${r.map(e=>e.label).join(`, `)} connected${i?`. New chats and fixes use ${i.label}`:``}.`:`No agent connected yet.`,` `,`Connect, remove and choose the default on the Agents page of the Workspace Console.`]})]}),(0,q.jsx)(n,{asChild:!0,size:t?`touch`:`sm`,children:(0,q.jsx)(`a`,{href:qe,"data-sw-agents-open":!0,children:`Manage agents`})})]})}function Ye({open:e,onClose:t,onSaved:n,touch:r,buzz:i=!1}){let[a,o]=(0,Y.useState)(!1);return(0,q.jsx)(c,{open:e,onClose:t,title:`Settings`,size:`md`,sticky:a,children:(0,q.jsxs)(x,{defaultValue:`agent`,className:`p-5`,children:[(0,q.jsx)(T,{className:`mb-4 max-w-40`,"aria-label":`Settings`,children:(0,q.jsx)(O,{value:`agent`,large:r,"data-sw-settings-tab":`agent`,children:`Agent`})}),(0,q.jsx)(p,{value:`agent`,children:e?(0,q.jsx)(Ke,{onSaved:n,touch:r,buzz:i,onDirtyChange:o}):null})]})})}var Xe=`https://shapewall.com/docs/chat`,Ze=`${Xe}#restrict-the-agents-own-tools`;function Qe({onOpenSettings:e,docsUrl:t,touch:r,open:i=!1}){return(0,q.jsxs)(`details`,{className:`group rounded-md border border-line text-left`,open:i,"data-sw-chat-other-options":`true`,children:[(0,q.jsxs)(`summary`,{className:`flex min-h-11 cursor-pointer list-none items-center gap-1.5 px-3 text-xs font-medium text-fg lg:min-h-9 [&::-webkit-details-marker]:hidden`,children:[(0,q.jsx)(f,{size:13,className:`text-muted transition-transform group-open:rotate-90`,"aria-hidden":`true`}),` Other options`]}),(0,q.jsxs)(`div`,{className:`space-y-2 border-t border-line p-3 text-xs text-muted`,children:[(0,q.jsx)(`p`,{children:`An OpenAI-compatible endpoint (OpenAI, DeepSeek, OpenRouter, Ollama, LM Studio) or another agent command:`}),(0,q.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[(0,q.jsxs)(n,{size:r?`touch`:`sm`,onClick:e,"data-sw-settings-open":`connect`,children:[(0,q.jsx)(oe,{size:13,"aria-hidden":`true`}),` Open agent settings`]}),(0,q.jsx)(n,{asChild:!0,variant:`ghost`,size:r?`touch`:`sm`,children:(0,q.jsxs)(`a`,{href:t||`https://shapewall.com/docs/chat`,target:`_blank`,rel:`noreferrer`,"data-sw-chat-docs":`true`,children:[(0,q.jsx)(I,{size:13,"aria-hidden":`true`}),` Chat docs`]})})]})]})]})}function $e({agent:e,touch:t,onOpenSettings:r,onConnected:i}){let[s,c]=(0,Y.useState)(null),[l,u]=(0,Y.useState)(null),[d,f]=(0,Y.useState)(null),[p,m]=(0,Y.useState)(null),[h,_]=(0,Y.useState)(null),[v,y]=(0,Y.useState)(Ce()),b=(0,Y.useCallback)(async()=>{try{c(await D.get(`/api/agent/settings`)),u(null)}catch(e){e.status===404&&ee(),u(e.status===404?J:e.message)}},[]);(0,Y.useEffect)(()=>{b()},[b]);let x=async(e,t=null)=>{f(e.id),m(null);try{let n=t?{name:v.name.trim(),...v.icon&&!v.png?{icon:v.icon}:{},...v.tint?{tint:v.tint}:{}}:{},r=await D.post(`/api/agent/settings/profiles/connect`,{agentId:e.id,confirm:t,...n});if(r.confirm){y(Ce({label:e.label})),_({item:e,items:r.confirm,hash:r.confirmHash});return}if(_(null),r.connected&&t&&v.png&&await Q(e.id,{},{...v,name:``,tint:null}).catch(()=>null),!r.connected){m({id:e.id,result:r.result}),c(r);return}i?.(r.result)}catch(t){_(null),m({id:e.id,result:{ok:!1,message:t.message,details:[]}})}finally{f(null)}};if(l)return(0,q.jsx)(`p`,{className:`text-xs text-bad`,role:`alert`,"data-sw-settings-error":`load`,children:l===`On the computer running Shapewall, run shapewall settings --config FILE --open with this project’s config file to open agent settings. For a direct local board, you can also use the owner link printed by shapewall serve.`?(0,q.jsx)(he,{}):`Could not look for agents: ${l}`});if(!s)return(0,q.jsxs)(`p`,{className:`flex items-center justify-center gap-2 text-xs text-muted`,"data-sw-chat-detect":`loading`,children:[(0,q.jsx)(g,{size:12}),` Looking for agents on this machine`]});let S=s.detected||[],C=S.filter(e=>e.state===`ready`),w=S.filter(e=>e.state===`needs-adapter`),te=S.filter(e=>e.state===`needs-shell`),T=!!s.env?.acp,E=t?`touch`:`sm`;return(0,q.jsxs)(`div`,{className:`w-full space-y-3 text-left`,"data-sw-chat-connect":`true`,children:[T?(0,q.jsxs)(`p`,{className:`flex items-start gap-1.5 text-xs text-fg`,"data-sw-chat-connect-override":`true`,children:[(0,q.jsx)(se,{size:13,className:`mt-px shrink-0 text-warn`,"aria-hidden":`true`}),(0,q.jsxs)(`span`,{children:[`The agent command comes from `,s.env.acp===`flag`?`--agent-acp`:`SHAPEWALL_AGENT_ACP`,` and wins over the board. Fix it there, or restart `,(0,q.jsx)(`code`,{className:`font-mono`,children:`shapewall serve`}),` without it.`]})]}):null,C.length?(0,q.jsx)(`ul`,{className:`space-y-2`,"aria-label":`Agents found on this machine`,children:C.map(e=>{let t=p?.id===e.id?p.result:null;return(0,q.jsxs)(`li`,{className:`space-y-2 rounded-md border border-line bg-surface-2/60 p-3`,"data-sw-chat-detected":e.id,children:[(0,q.jsxs)(`div`,{className:`flex items-center gap-2`,children:[(0,q.jsx)(R,{size:15,className:`shrink-0 text-ok`,"aria-hidden":`true`}),(0,q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,q.jsxs)(`p`,{className:`text-sm font-medium text-fg`,children:[e.label,` found on this machine`]}),(0,q.jsx)(o,{content:e.path||null,children:(0,q.jsx)(`p`,{className:`truncate font-mono text-[11px] text-muted`,children:e.command})})]}),(0,q.jsxs)(n,{variant:`default`,size:E,onClick:()=>x(e),disabled:!!d||T||!!s.testing,title:s.testing?`A connection test is running. Connect is available when it finishes.`:void 0,"data-sw-chat-connect-agent":e.id,children:[d===e.id?(0,q.jsx)(g,{}):(0,q.jsx)(ue,{size:13,"aria-hidden":`true`}),` `,d===e.id?`Connecting...`:`Connect`]})]}),t?(0,q.jsxs)(`div`,{className:`rounded-md border border-bad/40 bg-bad/10 p-2 text-xs`,role:`alert`,"data-sw-chat-connect-result":`failed`,children:[(0,q.jsxs)(`p`,{className:`flex items-start gap-1.5 font-medium text-bad`,children:[(0,q.jsx)(z,{size:13,className:`mt-px shrink-0`,"aria-hidden":`true`}),` `,t.message]}),(0,q.jsxs)(`p`,{className:`mt-1 text-muted`,children:[`Nothing was changed. `,e.login?`To log it in: ${e.login}.`:``]})]}):null]},e.id)})}):(0,q.jsxs)(`p`,{className:`text-xs text-muted`,"data-sw-chat-detected":`none`,children:[`No agent CLI with ACP found on this machine (Claude Code, Codex, goose, Gemini CLI).`,w.length?null:(0,q.jsx)(q.Fragment,{children:` For Claude Code, install its adapter in a terminal, then check again:`})]}),!C.length&&!w.length?(0,q.jsx)(ge,{text:`npm install -g @agentclientprotocol/claude-agent-acp`,label:`install`,touch:t}):null,w.map(e=>(0,q.jsxs)(`div`,{className:`space-y-1.5 text-xs text-muted`,"data-sw-chat-needs-adapter":e.id,children:[(0,q.jsxs)(`p`,{children:[(0,q.jsx)(`span`,{className:`font-medium text-fg`,children:e.label}),` is installed, but not its ACP adapter. Install it in a terminal, then check again:`]}),e.install?(0,q.jsx)(ge,{text:e.install,label:`${e.label} install`,touch:t}):null]},e.id)),te.map(e=>(0,q.jsxs)(`p`,{className:`text-xs text-muted`,"data-sw-chat-needs-shell":e.id,children:[(0,q.jsx)(`span`,{className:`font-medium text-fg`,children:e.label}),` is installed only as a `,(0,q.jsx)(`code`,{className:`font-mono`,children:`.cmd`}),` wrapper, which needs a shell, and Shapewall never starts one. In Other options, set the agent command to`,` `,(0,q.jsx)(`code`,{className:`font-mono`,children:`node`}),` and the path of its script (see the chat docs).`]},e.id)),C.length?(0,q.jsxs)(`p`,{className:`text-[11px] leading-4 text-muted`,"data-sw-chat-connect-note":`true`,children:[`Connect asks first, then runs that command on this machine, as you, with the agent’s own login. It brings its own tools (a shell, file edits), which Shapewall does not sandbox:`,` `,(0,q.jsx)(`a`,{className:`text-accent underline-offset-2 hover:underline`,href:Ze,target:`_blank`,rel:`noreferrer`,children:`use a restricted profile`}),`.`]}):null,(0,q.jsx)(`div`,{className:`flex justify-end`,children:(0,q.jsxs)(n,{variant:`ghost`,size:t?`touch`:`xs`,onClick:b,disabled:!!d,"data-sw-chat-detect-again":`true`,children:[(0,q.jsx)(de,{size:12,"aria-hidden":`true`}),` Check again`]})}),(0,q.jsx)(Qe,{onOpenSettings:r,docsUrl:e?.docsUrl,touch:t,open:!C.length&&!w.length}),(0,q.jsx)(_e,{items:h?.items||null,busy:!!d,touch:t,confirmLabel:`Allow and connect`,onCancel:()=>_(null),onConfirm:()=>x(h.item,h.hash),blocked:!!Oe(v.name),children:(0,q.jsx)(ke,{value:v,onChange:y,builtIn:h?.item.label||``,logo:a(h?.item.id),upload:s.iconUpload!==!1,touch:t,disabled:!!d})})]})}function et({result:e,onDismiss:t,touch:r}){return e?(0,q.jsxs)(`div`,{className:S(`rounded-md border border-ok/40 bg-ok/10 p-3 text-left text-xs`),role:`status`,"data-sw-chat-connected-note":`true`,children:[(0,q.jsxs)(`p`,{className:`flex items-start gap-1.5 font-medium text-fg`,children:[(0,q.jsx)(m,{size:14,className:`mt-px shrink-0 text-ok`,"aria-hidden":`true`}),(0,q.jsxs)(`span`,{className:`flex-1`,children:[`Connected to `,e.label,`. `,e.message]}),(0,q.jsx)(n,{variant:`ghost`,size:r?`icon`:`icon-xs`,onClick:t,"aria-label":`Dismiss`,className:`-mt-1 -mr-1`,children:(0,q.jsx)(b,{size:13,"aria-hidden":`true`})})]}),e.details?.length?(0,q.jsx)(`ul`,{className:`mt-1.5 list-disc space-y-0.5 pl-5 text-muted`,children:e.details.map(e=>(0,q.jsx)(`li`,{children:e},e))}):null]}):null}export{ze as a,K as c,Ke as i,G as l,Xe as n,he as o,$e as r,J as s,et as t,B as u};
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{B as t,Ht as n,R as r,Sn as i,c as a,qt as o,w as s,wn as c}from"./ui-DI-FGWWK.js";var l=e(c(),1),u=i();function d({open:e,onClose:i,boardId:c,onMoved:d}){let[f,p]=(0,l.useState)(``),[m,h]=(0,l.useState)(!1),[g,_]=(0,l.useState)(!1),[v,y]=(0,l.useState)(null),[b,x]=(0,l.useState)(null),S=n(e?`/api/share/status`:null,{pollMs:1e3}),C=S.data?.boardId&&S.data.boardId!==c?null:S.data,w=b||C?.verificationUrl;(0,l.useEffect)(()=>{C?.status===`done`&&d()},[C?.status,d]);let T=async e=>{e.preventDefault(),_(!0),y(null);try{let e=await o.post(`/api/share/start`,{remote:f,board:c});x(e.verificationUrl),h(!0),S.refetch()}catch(e){y(e.message)}finally{_(!1)}},E=C?.status===`running`;return(0,u.jsx)(r,{open:e,onClose:i,title:`Share with your team`,description:`Move captures and comment history to a shared project.`,size:`md`,children:(0,u.jsxs)(`div`,{className:`space-y-4 p-5`,"data-sw-share-dialog":!0,children:[(0,u.jsx)(`p`,{className:`text-sm text-muted`,children:`The shared board becomes the home for comments. Local captures keep working. Agent settings, chat, credentials, paired devices and local integrations stay on this machine.`}),!m&&!E?(0,u.jsxs)(`form`,{onSubmit:T,className:`space-y-3`,children:[(0,u.jsx)(`label`,{className:`block text-sm font-medium`,htmlFor:`sw-share-remote`,children:`Your Shapewall server`}),(0,u.jsx)(s,{id:`sw-share-remote`,size:`touch`,type:`url`,value:f,onChange:e=>p(e.target.value),placeholder:`https://review.example.com`,required:!0,"data-sw-share-remote":!0}),(0,u.jsxs)(t,{type:`submit`,size:`touch`,variant:`default`,disabled:g||!f.trim(),"data-sw-share-start":!0,children:[g?(0,u.jsx)(a,{}):null,` Sign in and move this board`]})]}):null,w&&E?(0,u.jsxs)(`p`,{className:`text-sm`,children:[`Open`,` `,(0,u.jsx)(`a`,{className:`text-accent underline`,href:w,target:`_blank`,rel:`noopener noreferrer`,children:`the server's sign-in page`}),`, enter the code below, pick or create a project, and check Import local comments once.`]}):null,C?.lines?.length?(0,u.jsx)(`pre`,{className:`max-h-72 overflow-auto rounded-lg border border-line bg-surface-2 p-3 font-mono text-xs whitespace-pre-wrap break-words`,"aria-live":`polite`,"data-sw-share-progress":!0,children:C.lines.join(`
|
|
2
|
+
`)}):null,E?(0,u.jsxs)(`p`,{className:`flex items-center gap-2 text-sm text-muted`,children:[(0,u.jsx)(a,{}),` Moving this board. Closing the dialog keeps progress available from the profile menu.`]}):null,v||C?.error?(0,u.jsx)(`p`,{role:`alert`,className:`text-sm text-bad`,children:v||C.error}):null,C?.status===`failed`||C?.status===`done`?(0,u.jsx)(t,{variant:`ghost`,size:`touch`,onClick:()=>h(!1),children:`Move again`}):null,C?.status===`done`?(0,u.jsxs)(`div`,{className:`space-y-3`,"data-sw-share-done":!0,children:[(0,u.jsx)(`p`,{className:`text-sm`,children:C.result?.conflicts?.length?`Some comments were changed on the shared board too. We kept the shared board's version of the comments listed above.`:`Moved. These comments won't go to an agent until a teammate sends them.`}),C.result?.urls?.map(e=>(0,u.jsxs)(`a`,{href:e,target:`_blank`,rel:`noopener noreferrer`,className:`inline-flex min-h-11 items-center break-all text-sm text-accent underline`,children:[`Open on `,new URL(e).host]},e))]}):null]})})}function f({marker:e,boardId:n,editable:r,onChange:i}){let[a,s]=(0,l.useState)(null),[c,d]=(0,l.useState)(!1);return e?(0,u.jsxs)(`div`,{className:`flex shrink-0 flex-col items-start gap-2 border-b border-line bg-accent/10 px-4 py-2 text-xs sm:flex-row sm:items-center`,"data-sw-migration-banner":!0,children:[(0,u.jsx)(`span`,{className:`min-w-0 w-full flex-1 sm:w-auto`,children:e.pending?`Moving comments to the shared board. Local comments are temporarily read-only.`:(0,u.jsxs)(u.Fragment,{children:[`Comments for this board now live at`,` `,(0,u.jsx)(`a`,{className:`break-all text-accent underline`,href:e.url,target:`_blank`,rel:`noopener noreferrer`,children:new URL(e.url).origin}),`. `,e.readOnly?`Local comments are read-only.`:`This local copy is independent.`]})}),r&&!e.pending?(0,u.jsx)(t,{size:`touch`,variant:`ghost`,onClick:async()=>{d(!0),s(null);try{await o.post(`/api/share/local-comments`,{board:n,readOnly:!e.readOnly}),i()}catch(e){s(e.message)}finally{d(!1)}},disabled:c,className:`max-w-full whitespace-normal text-left`,"data-sw-local-comments":!0,children:e.readOnly?`Keep commenting here`:`Make local read-only for comments`}):null,a?(0,u.jsx)(`span`,{role:`alert`,className:`text-bad`,children:a}):null]}):null}export{f as MigrationBanner,d as ShareDialog};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{r as e}from"./rolldown-runtime-XKyaHtl9.js";import{B as t,Kt as n,R as r,Sn as i,c as a,nn as o,qt as s,wn as c,xn as l}from"./ui-DI-FGWWK.js";import{t as u}from"./refresh-cw-vkgvCCfR.js";import{a as d,o as f}from"./index-DnZarJ3U.js";var p={name:`circle-arrow-up`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 12-4-4-4 4`,key:`177agl`}],[`path`,{d:`M12 16V8`,key:`1sbj14`}]],aliases:[`arrow-up-circle`]};p.node;var m=l(p),h=e(c(),1),g=i(),_=`/api/app-update`;function v({open:e,onClose:i,onCloseAutoFocus:c,transport:l=s}){let[p,v]=(0,h.useState)(null),[y,b]=(0,h.useState)(!1),[x,S]=(0,h.useState)(null),[C,w]=(0,h.useState)(null),[T,E]=(0,h.useState)(!1),[D,O]=(0,h.useState)(!1),k=(0,h.useRef)(!0),A=o||n;(0,h.useEffect)(()=>(k.current=!0,()=>{k.current=!1}),[]);let j=(0,h.useCallback)(async()=>{b(!0),w(null);try{let e=await l.get(_);k.current&&v(e)}catch(e){k.current&&w(e.status===404?`This installation needs a manual update before in-app updates are available.`:e.message)}finally{k.current&&b(!1)}},[l]);(0,h.useEffect)(()=>{e&&!A&&j()},[e,A,j]);let M=async e=>{S(e),w(null),O(!1);let t=e===`apply`?p?.latest:null,n=e=>t&&e.job?.state!==`running`&&e.current?.version===t.version&&(!t.revision||e.current?.revision===t.revision),r=Date.now()+(e===`apply`?96e4:9e4);try{if(e===`apply`&&(!t||!t.revision&&t.version===p?.current?.version))throw Error(`This update has no distinct build identity. Ask the installer to prepare a versioned release.`);let i=await l.post(`${_}/${e}`);if(!k.current)return;for(v(i);k.current&&(i.job?.state===`running`||e===`apply`&&i.job?.state!==`failed`&&!n(i));){if(Date.now()>=r)throw Error(`Still waiting for the update service. Reopen this panel to refresh its status.`);if(await new Promise(e=>window.setTimeout(e,1200)),!k.current)return;try{if(i=await l.get(_),!k.current)return;if(E(!1),v(i),e===`apply`&&n(i)){O(!0);return}}catch(t){if(e!==`apply`||t.status&&t.status<500)throw t;E(!0)}}if(!k.current)return;if(i.job?.state===`failed`)throw Error(i.job.error||`The update could not finish. Try again or contact the installer.`);e===`apply`&&n(i)&&O(!0)}catch(e){k.current&&w(e.message||`Could not reach Shapewall. Check your connection and try again.`)}finally{k.current&&(S(null),E(!1))}},N=x||p?.job?.state===`running`,P=D||p?.canUpdate&&p?.supported||C||p?.job?.state===`running`,F=T?`Shapewall is restarting. Reconnecting…`:x===`apply`?`Installing the update. This page may briefly disconnect.`:x===`check`?`Checking for updates…`:D?`Update installed. Reload to use the new version.`:p?.job?.state===`running`?`An update operation is running. Refresh its status in a moment.`:p?.job?.state===`failed`?`The last update operation did not finish. You can try again.`:p?.updateAvailable?`An update is available${p.latest?`: ${f(p.latest)}`:``}.`:p?.checkedAt?`You are up to date.`:`Check when you want the latest version.`;return(0,g.jsx)(r,{open:e,onClose:i,onCloseAutoFocus:c,title:`About & Updates`,description:`Shapewall`,footer:A||!P?null:(0,g.jsxs)(`div`,{className:`flex w-full flex-wrap justify-end gap-2`,children:[D?(0,g.jsxs)(t,{size:`touch`,className:`lg:h-9`,onClick:()=>window.location.reload(),"data-sw-app-reload":!0,children:[(0,g.jsx)(u,{size:15,"aria-hidden":`true`}),` Reload Shapewall`]}):null,!D&&p?.canUpdate&&p?.supported?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(t,{variant:`secondary`,size:`touch`,className:`lg:h-9`,disabled:!!(N||y),onClick:()=>M(`check`),"data-sw-app-check":!0,children:[(0,g.jsx)(u,{size:15,"aria-hidden":`true`}),` Check for updates`]}),p.updateAvailable?(0,g.jsxs)(t,{size:`touch`,className:`lg:h-9`,disabled:!!(N||y),onClick:()=>M(`apply`),"data-sw-app-update":!0,children:[(0,g.jsx)(m,{size:15,"aria-hidden":`true`}),` Update now`]}):null]}):null,!x&&(C||p?.job?.state===`running`)?(0,g.jsx)(t,{variant:`secondary`,size:`touch`,className:`lg:h-9`,disabled:y,onClick:j,children:`Refresh status`}):null]}),children:(0,g.jsxs)(`div`,{className:`space-y-4 p-5 text-sm`,"data-sw-app-updates":!0,children:[(0,g.jsxs)(`div`,{children:[(0,g.jsxs)(`p`,{className:`font-semibold text-fg`,children:[`Shapewall `,f(d)]}),(0,g.jsx)(`p`,{className:`mt-1 text-xs text-muted`,children:`Created by Dan Baruch`})]}),A?(0,g.jsxs)(`p`,{className:`text-muted`,children:[o?`This is the public demo.`:`This is a static export.`,` It cannot update a Shapewall installation. Ask the installer for a new build.`]}):(0,g.jsxs)(g.Fragment,{children:[(0,g.jsx)(`p`,{className:`text-muted`,children:`Updates are manual. Shapewall checks and installs only when you ask.`}),p?.current&&f(p.current)!==f(d)?(0,g.jsxs)(`p`,{className:`text-xs text-muted`,children:[`Server: `,f(p.current),`. Reload this page to load its current interface.`]}):null,y?(0,g.jsxs)(`p`,{className:`flex items-center gap-2 text-muted`,role:`status`,children:[(0,g.jsx)(a,{}),` Reading installation details…`]}):p?(0,g.jsxs)(g.Fragment,{children:[(0,g.jsxs)(`p`,{className:`flex items-start gap-2 text-fg`,role:`status`,"data-sw-app-update-status":!0,children:[x?(0,g.jsx)(a,{}):null,(0,g.jsx)(`span`,{children:F})]}),!p.supported||!p.canUpdate?(0,g.jsx)(`p`,{className:`text-muted`,children:p.reason||`Updates are managed by the person who installed Shapewall.`}):null,p.checkedAt?(0,g.jsxs)(`p`,{className:`text-xs text-muted`,children:[`Last checked: `,new Date(p.checkedAt).toLocaleString()]}):null]}):null,C?(0,g.jsx)(`p`,{className:`text-bad`,role:`alert`,children:C}):null]})]})})}export{v as default};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{
|
|
1
|
+
import{xn as e}from"./ui-DI-FGWWK.js";var t={name:`circle-check`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m16 9-5.5 5.5L8 12`,key:`xofnsj`}]],aliases:[`check-circle-2`]};t.node;var n=e(t),r={name:`circle-x`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`10`,key:`1mglay`}],[`path`,{d:`m15 9-6 6`,key:`1uzhvr`}],[`path`,{d:`m9 9 6 6`,key:`z0biqf`}]],aliases:[`x-circle`]};r.node;var i=e(r);export{n,i as t};
|