shapewall 0.3.3 → 0.7.0
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 +501 -0
- package/README.md +87 -4
- package/THIRD_PARTY.md +15 -0
- package/dist/agent/package-lock.json +594 -2
- package/dist/client/assets/BoardChat-WS8mAIW6.js +27 -0
- package/dist/client/assets/{BuzzDialog-Ix9qJvim.js → BuzzDialog-B-Mlr6wF.js} +1 -1
- package/dist/client/assets/ChecksPanel-Dx1ZLBR6.js +1 -0
- package/dist/client/assets/History-sXhmpcvs.js +1 -0
- package/dist/client/assets/LocalSettings-CtGzz9F3.js +1 -0
- package/dist/client/assets/{Management-NVFDtSZB.js → Management-CGHe8Wt9.js} +1 -1
- package/dist/client/assets/QuickConnect-DEk84E4A.js +1 -0
- package/dist/client/assets/{ShareDialog-By0ETg6n.js → ShareDialog-CGGx-AYK.js} +2 -2
- package/dist/client/assets/{app-update-dialog-RGIw24iZ.js → app-update-dialog-_bVp8hnC.js} +1 -1
- package/dist/client/assets/{circle-x-B6KfScOE.js → circle-x-BWoHA1QY.js} +1 -1
- package/dist/client/assets/index-Bm-Xd3YN.js +37 -0
- package/dist/client/assets/index-C7Ostk3K.css +2 -0
- package/dist/client/assets/play-BzQ3tRTv.js +1 -0
- package/dist/client/assets/{refresh-cw-vkgvCCfR.js → refresh-cw-BYBMyDKT.js} +1 -1
- package/dist/client/assets/{runtime-Bft6x_6E.js → runtime-Bvq10IhH.js} +1 -1
- package/dist/client/assets/ui-CAY6myRA.js +41 -0
- package/dist/client/build-info.json +1 -1
- package/dist/client/index.html +3 -3
- package/dist/client/sw.js +2 -2
- package/dist/console/assets/LocalAccountsApp-CWRguRRL.js +1 -0
- package/dist/console/assets/LocalConsole--I2SaIpr.js +2 -0
- package/dist/console/assets/LocalUsage-BmpCZ36k.js +1 -0
- package/dist/console/assets/app-update-dialog-B8M9plaT.js +1 -0
- package/dist/console/assets/app-version-muKrQqbL.js +1 -0
- package/dist/console/assets/console-CrhTsPbz.css +2 -0
- package/dist/console/assets/console-DxapQ9oS.js +11 -0
- package/dist/console/assets/local-agents-CoqD4dSN.js +6 -0
- package/dist/console/assets/minus-DDQ0ydcM.js +1 -0
- package/dist/console/assets/tailnet-C5Flwl_d.js +2 -0
- package/dist/console/assets/theme-DCd0qh4l.js +1 -0
- package/dist/console/assets/ui-Bry1mnCY.js +41 -0
- package/dist/console/assets/usage-CIPWnHaS.css +1 -0
- package/dist/console/assets/usage-CqVjMb7m.js +5 -0
- package/dist/console/assets/usage-D1G0GgE3.js +56 -0
- package/dist/console/build-info.json +1 -1
- package/dist/console/console.html +8 -2
- package/docs/agent-hardening.md +206 -0
- package/docs/agent-recipes.md +23 -0
- package/docs/agent-workflow.md +5 -0
- package/docs/agents.md +49 -6
- package/docs/architecture.md +10 -4
- package/docs/deployment.md +39 -17
- package/docs/design-system.md +56 -7
- package/docs/hosted.md +1800 -46
- package/docs/images/board-overview.png +0 -0
- package/docs/images/journeys.png +0 -0
- package/docs/images/live-comment.png +0 -0
- package/docs/images/phone-comment.png +0 -0
- package/docs/images/phone-overview.png +0 -0
- package/docs/images/variant.png +0 -0
- package/docs/where-to-run.md +119 -3
- package/package.json +6 -1
- package/src/agent/backends/acp.js +745 -44
- package/src/agent/branch-mode.js +17 -3
- package/src/agent/card-hash.js +65 -0
- package/src/agent/context.js +41 -0
- package/src/agent/exec-paths.js +105 -0
- package/src/agent/routes.js +23 -2
- package/src/agent/run.js +11 -1
- package/src/agent/starter/cli.js +6 -1
- package/src/agent/turn-changes.js +70 -8
- package/src/agent/usage-log.js +251 -0
- package/src/cli/args.js +37 -0
- package/src/cli/commands.js +20 -5
- package/src/cli/help.js +73 -3
- package/src/cli/init.js +2 -1
- package/src/cli/serve.js +20 -5
- package/src/cli.js +8 -0
- package/src/hosted/access-cli.js +99 -1
- package/src/hosted/activity-core.js +232 -0
- package/src/hosted/activity.js +375 -0
- package/src/hosted/admin.js +87 -13
- package/src/hosted/agent-approvals.js +29 -4
- package/src/hosted/agent-link.js +1032 -0
- package/src/hosted/agent-policy.js +10 -3
- package/src/hosted/agent-presence.js +63 -22
- package/src/hosted/agent-routes.js +135 -0
- package/src/hosted/agents.js +1206 -0
- package/src/hosted/app.js +178 -12
- package/src/hosted/auth-routes.js +156 -15
- package/src/hosted/auth.js +123 -20
- package/src/hosted/board-routes.js +129 -5
- package/src/hosted/chat-frames.js +246 -0
- package/src/hosted/chat-job.js +204 -0
- package/src/hosted/chat-permissions.js +203 -0
- package/src/hosted/chat-routes.js +1009 -0
- package/src/hosted/chat-store.js +477 -0
- package/src/hosted/comment-files.js +11 -1
- package/src/hosted/comments.js +1 -1
- package/src/hosted/console-routes.js +122 -34
- package/src/hosted/db.js +295 -0
- package/src/hosted/device-routes.js +88 -10
- package/src/hosted/device.js +54 -4
- package/src/hosted/events.js +3 -3
- package/src/hosted/guards.js +337 -27
- package/src/hosted/http.js +6 -3
- package/src/hosted/membership.js +22 -3
- package/src/hosted/operator-access.js +418 -0
- package/src/hosted/operator.js +106 -2
- package/src/hosted/ops-cli.js +238 -3
- package/src/hosted/pages.js +4 -0
- package/src/hosted/passkey-policy.js +75 -0
- package/src/hosted/permissions.js +52 -6
- package/src/hosted/presence.js +31 -2
- package/src/hosted/projects.js +30 -2
- package/src/hosted/public.js +4 -4
- package/src/hosted/ratelimit.js +14 -0
- package/src/hosted/retention.js +18 -2
- package/src/hosted/server.js +123 -11
- package/src/hosted/shares.js +2 -2
- package/src/hosted/step-up-settings.js +68 -0
- package/src/hosted/step-up.js +135 -0
- package/src/hosted/tailnet-identity.js +24 -0
- package/src/hosted/tailnet-routes.js +342 -0
- package/src/hosted/tailnet.js +220 -0
- package/src/hosted/tailscale.js +75 -9
- package/src/hosted/tenancy.js +66 -1
- package/src/hosted/token-api.js +119 -20
- package/src/hosted/token-events.js +5 -3
- package/src/hosted/tokens.js +29 -6
- package/src/hosted/turn-hub.js +152 -0
- package/src/hosted/usage-core.js +624 -0
- package/src/hosted/usage-layout.js +724 -0
- package/src/hosted/usage-routes.js +375 -0
- package/src/hosted/usage-shape.js +256 -0
- package/src/hosted/usage.js +641 -0
- package/src/remote/agent-connect.js +469 -0
- package/src/remote/agent-fix.js +611 -0
- package/src/remote/agent-job.js +216 -0
- package/src/remote/agent-link.js +906 -0
- package/src/remote/agent-policy-file.js +242 -0
- package/src/remote/credentials.js +35 -1
- package/src/remote/login.js +44 -9
- package/src/remote/share.js +1 -1
- package/src/remote/tailnet-cli.js +547 -0
- package/src/server/app.js +15 -0
- package/src/server/pairing-routes.js +34 -5
- package/src/server/tailscale.js +97 -4
- package/src/tailnet-proof.js +766 -0
- package/dist/client/assets/BoardChat-DxehB761.js +0 -27
- package/dist/client/assets/ChecksPanel-pA_ueIaJ.js +0 -1
- package/dist/client/assets/History-C9N32kCv.js +0 -1
- package/dist/client/assets/LocalSettings-DawtKnvi.js +0 -1
- package/dist/client/assets/QuickConnect-DO1TjS1t.js +0 -1
- package/dist/client/assets/index-CsqLdqGx.css +0 -2
- package/dist/client/assets/index-DnZarJ3U.js +0 -37
- package/dist/client/assets/shield-check-QzwGhz0t.js +0 -1
- package/dist/client/assets/ui-DI-FGWWK.js +0 -41
- package/dist/console/assets/LocalAccountsApp-VOCZg8dg.js +0 -1
- package/dist/console/assets/LocalConsole-CMwAW-mF.js +0 -1
- package/dist/console/assets/app-update-dialog-Cw6UDqNP.js +0 -1
- package/dist/console/assets/console-DgfWmUEx.js +0 -55
- package/dist/console/assets/console-Lis0vvdL.css +0 -2
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["assets/app-update-dialog-B8M9plaT.js","assets/ui-Bry1mnCY.js","assets/app-version-muKrQqbL.js"])))=>i.map(i=>d[i]);
|
|
2
|
+
import{$ as e,A as t,At as n,B as r,C as i,D as a,Dt as o,E as s,Et as c,F as l,Ft as u,H as d,It as f,J as p,M as m,Mt as h,O as g,Pt as _,Q as v,Rt as y,S as b,St as x,T as S,Tt as C,U as w,V as ee,Vt as T,X as te,_t as ne,b as E,bt as re,c as D,ct as O,d as k,dt as A,et as j,ft as M,g as N,gt as P,h as F,ht as I,j as ie,jt as ae,k as L,lt as R,mt as z,n as B,p as oe,pt as V,t as se,tt as H,u as U,vt as W,w as G,wt as K,x as q,xt as ce,yt as J,z as le}from"./ui-Bry1mnCY.js";import{Ct as ue,Q as de,St as fe,_ as pe,a as Y,bt as X,et as me,f as he,gt as ge,m as _e,n as ve,o as ye,p as be,r as xe,t as Se,vt as Ce,x as we,xt as Te,yt as Ee}from"./theme-DCd0qh4l.js";import{n as De,r as Oe,t as ke}from"./app-version-muKrQqbL.js";var Ae={name:`building-complex`,size:24,node:[[`path`,{d:`M10 12h4`,key:`a56b0p`}],[`path`,{d:`M10 8h4`,key:`1sr2af`}],[`path`,{d:`M14 21v-3a2 2 0 0 0-4 0v3`,key:`1rgiei`}],[`path`,{d:`M6 10H4a2 2 0 0 0-2 2v7a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2V9a2 2 0 0 0-2-2h-2`,key:`secmi2`}],[`path`,{d:`M6 21V5a2 2 0 0 1 2-2h8a2 2 0 0 1 2 2v16`,key:`16ra0t`}]],aliases:[`building-2`]};Ae.node;var je=f(Ae),Me={name:`camera`,size:24,node:[[`path`,{d:`M13.997 4a2 2 0 0 1 1.76 1.05l.486.9A2 2 0 0 0 18.003 7H20a2 2 0 0 1 2 2v9a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2h1.997a2 2 0 0 0 1.759-1.048l.489-.904A2 2 0 0 1 10.004 4z`,key:`18u6gg`}],[`circle`,{cx:`12`,cy:`13`,r:`3`,key:`1vg3eu`}]]};Me.node;var Ne=f(Me),Pe={name:`download`,size:24,node:[[`path`,{d:`M12 15V3`,key:`m9g1x1`}],[`path`,{d:`M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4`,key:`ih7n3h`}],[`path`,{d:`m7 10 5 5 5-5`,key:`brsn70`}]]};Pe.node;var Fe=f(Pe),Ie={name:`external-link`,size:24,node:[[`path`,{d:`M15 3h6v6`,key:`1q9fwt`}],[`path`,{d:`M10 14 21 3`,key:`gplh6r`}],[`path`,{d:`M18 13v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h6`,key:`a6xqqp`}]]};Ie.node;var Le=f(Ie),Re={name:`folder-kanban`,size:24,node:[[`path`,{d:`M4 20h16a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.93a2 2 0 0 1-1.66-.9l-.82-1.2A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13c0 1.1.9 2 2 2Z`,key:`1fr9dc`}],[`path`,{d:`M8 10v4`,key:`tgpxqk`}],[`path`,{d:`M12 10v2`,key:`hh53o1`}],[`path`,{d:`M16 10v6`,key:`1d6xys`}]]};Re.node;var ze=f(Re),Be={name:`git-branch`,size:24,node:[[`path`,{d:`M15 6a9 9 0 0 0-9 9V3`,key:`1cii5b`}],[`circle`,{cx:`18`,cy:`6`,r:`3`,key:`1h7g24`}],[`circle`,{cx:`6`,cy:`18`,r:`3`,key:`fqmcym`}]]};Be.node;var Ve=f(Be),He={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`}]]};He.node;var Ue=f(He),We={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`}]]};We.node;var Ge=f(We),Ke={name:`layers`,size:24,node:[[`path`,{d:`M12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83z`,key:`zw3jo`}],[`path`,{d:`M2 12a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 12`,key:`1wduqc`}],[`path`,{d:`M2 17a1 1 0 0 0 .58.91l8.6 3.91a2 2 0 0 0 1.65 0l8.58-3.9A1 1 0 0 0 22 17`,key:`kqbvx6`}]],aliases:[`layers-3`]};Ke.node;var qe=f(Ke),Je={name:`layout-dashboard`,size:24,node:[[`rect`,{width:`7`,height:`9`,x:`3`,y:`3`,rx:`1`,key:`10lvy0`}],[`rect`,{width:`7`,height:`5`,x:`14`,y:`3`,rx:`1`,key:`16une8`}],[`rect`,{width:`7`,height:`9`,x:`14`,y:`12`,rx:`1`,key:`1hutg5`}],[`rect`,{width:`7`,height:`5`,x:`3`,y:`16`,rx:`1`,key:`ldoo1y`}]]};Je.node;var Ye=f(Je),Xe={name:`log-out`,size:24,node:[[`path`,{d:`m16 17 5-5-5-5`,key:`1bji2h`}],[`path`,{d:`M21 12H9`,key:`dn1m92`}],[`path`,{d:`M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4`,key:`1uf3rs`}]]};Xe.node;var Ze=f(Xe),Qe={name:`mail`,size:24,node:[[`path`,{d:`m22 7-8.991 5.727a2 2 0 0 1-2.009 0L2 7`,key:`132q7q`}],[`rect`,{x:`2`,y:`4`,width:`20`,height:`16`,rx:`2`,key:`izxlao`}]]};Qe.node;var $e=f(Qe),et={name:`message-square-text`,size:24,node:[[`path`,{d:`M22 17a2 2 0 0 1-2 2H6.828a2 2 0 0 0-1.414.586l-2.202 2.202A.71.71 0 0 1 2 21.286V5a2 2 0 0 1 2-2h16a2 2 0 0 1 2 2z`,key:`18887p`}],[`path`,{d:`M7 11h10`,key:`1twpyw`}],[`path`,{d:`M7 15h6`,key:`d9of3u`}],[`path`,{d:`M7 7h8`,key:`af5zfr`}]]};et.node;var tt=f(et),nt={name:`monitor`,size:24,node:[[`rect`,{width:`20`,height:`14`,x:`2`,y:`3`,rx:`2`,key:`48i651`}],[`line`,{x1:`8`,x2:`16`,y1:`21`,y2:`21`,key:`1svkeh`}],[`line`,{x1:`12`,x2:`12`,y1:`17`,y2:`21`,key:`vw1qmm`}]]};nt.node;var rt=f(nt),it={name:`moon`,size:24,node:[[`path`,{d:`M20.985 12.486a9 9 0 1 1-9.473-9.472c.405-.022.617.46.402.803a6 6 0 0 0 8.268 8.268c.344-.215.825-.004.803.401`,key:`kfwtm`}]]};it.node;var at=f(it),ot={name:`panel-left-close`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m16 15-3-3 3-3`,key:`14y99z`}]],aliases:[`sidebar-close`]};ot.node;var st=f(ot),ct={name:`panel-left-open`,size:24,node:[[`rect`,{width:`18`,height:`18`,x:`3`,y:`3`,rx:`2`,key:`afitv7`}],[`path`,{d:`M9 3v18`,key:`fh3hqa`}],[`path`,{d:`m14 9 3 3-3 3`,key:`8010ee`}]],aliases:[`sidebar-open`]};ct.node;var lt=f(ct),ut={name:`pencil`,size:24,node:[[`path`,{d:`M21.174 6.812a1 1 0 0 0-3.986-3.987L3.842 16.174a2 2 0 0 0-.5.83l-1.321 4.352a.5.5 0 0 0 .623.622l4.353-1.32a2 2 0 0 0 .83-.497z`,key:`1a8usu`}],[`path`,{d:`m15 5 4 4`,key:`1mk7zo`}]]};ut.node;var dt=f(ut),ft={name:`plug`,size:24,node:[[`path`,{d:`M12 22v-5`,key:`1ega77`}],[`path`,{d:`M15 8V2`,key:`18g5xt`}],[`path`,{d:`M17 8a1 1 0 0 1 1 1v4a4 4 0 0 1-4 4h-4a4 4 0 0 1-4-4V9a1 1 0 0 1 1-1z`,key:`1xoxul`}],[`path`,{d:`M9 8V2`,key:`14iosj`}]]};ft.node;var pt=f(ft),mt={name:`rotate-ccw`,size:24,node:[[`path`,{d:`M3 12a9 9 0 1 0 9-9 9.75 9.75 0 0 0-6.74 2.74L3 8`,key:`1357e3`}],[`path`,{d:`M3 3v5h5`,key:`1xhq8a`}]]};mt.node;var ht=f(mt),gt={name:`settings`,size:24,node:[[`path`,{d:`M9.671 4.136a2.34 2.34 0 0 1 4.659 0 2.34 2.34 0 0 0 3.319 1.915 2.34 2.34 0 0 1 2.33 4.033 2.34 2.34 0 0 0 0 3.831 2.34 2.34 0 0 1-2.33 4.033 2.34 2.34 0 0 0-3.319 1.915 2.34 2.34 0 0 1-4.659 0 2.34 2.34 0 0 0-3.32-1.915 2.34 2.34 0 0 1-2.33-4.033 2.34 2.34 0 0 0 0-3.831A2.34 2.34 0 0 1 6.35 6.051a2.34 2.34 0 0 0 3.319-1.915`,key:`1i5ecw`}],[`circle`,{cx:`12`,cy:`12`,r:`3`,key:`1v7zrd`}]]};gt.node;var _t=f(gt),vt={name:`sun`,size:24,node:[[`circle`,{cx:`12`,cy:`12`,r:`4`,key:`4exip2`}],[`path`,{d:`M12 2v2`,key:`tus03m`}],[`path`,{d:`M12 20v2`,key:`1lh1kg`}],[`path`,{d:`m4.93 4.93 1.41 1.41`,key:`149t6j`}],[`path`,{d:`m17.66 17.66 1.41 1.41`,key:`ptbguv`}],[`path`,{d:`M2 12h2`,key:`1t8f8n`}],[`path`,{d:`M20 12h2`,key:`1q8mjw`}],[`path`,{d:`m6.34 17.66-1.41 1.41`,key:`1m8zz5`}],[`path`,{d:`m19.07 4.93-1.41 1.41`,key:`1shlcs`}]]};vt.node;var yt=f(vt),bt={name:`terminal`,size:24,node:[[`path`,{d:`M12 19h8`,key:`baeox8`}],[`path`,{d:`m4 17 6-6-6-6`,key:`1yngyt`}]]};bt.node;var xt=f(bt),St={name:`thumbs-down`,size:24,node:[[`path`,{d:`M9 18.12 10 14H4.17a2 2 0 0 1-1.92-2.56l2.33-8A2 2 0 0 1 6.5 2H20a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2h-2.76a2 2 0 0 0-1.79 1.11L12 22a3.13 3.13 0 0 1-3-3.88Z`,key:`m61m77`}],[`path`,{d:`M17 14V2`,key:`8ymqnk`}]]};St.node;var Ct=f(St),wt={name:`thumbs-up`,size:24,node:[[`path`,{d:`M15 5.88 14 10h5.83a2 2 0 0 1 1.92 2.56l-2.33 8A2 2 0 0 1 17.5 22H4a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h2.76a2 2 0 0 0 1.79-1.11L12 2a3.13 3.13 0 0 1 3 3.88Z`,key:`emmmcr`}],[`path`,{d:`M7 10v12`,key:`1qc93n`}]]};wt.node;var Tt=f(wt),Et={name:`trash`,size:24,node:[[`path`,{d:`M10 11v6`,key:`nco0om`}],[`path`,{d:`M14 11v6`,key:`outv1u`}],[`path`,{d:`M19 6v14a2 2 0 0 1-2 2H7a2 2 0 0 1-2-2V6`,key:`miytrc`}],[`path`,{d:`M3 6h18`,key:`d0wm0j`}],[`path`,{d:`M8 6V4a2 2 0 0 1 2-2h4a2 2 0 0 1 2 2v2`,key:`e791ji`}]],aliases:[`trash-2`]};Et.node;var Dt=f(Et),Ot={name:`wrench`,size:24,node:[[`path`,{d:`M14.7 6.3a1 1 0 0 0 0 1.4l1.6 1.6a1 1 0 0 0 1.4 0l3.106-3.105c.32-.322.863-.22.983.218a6 6 0 0 1-8.259 7.057l-7.91 7.91a1 1 0 0 1-2.999-3l7.91-7.91a6 6 0 0 1 7.057-8.259c.438.12.54.662.219.984z`,key:`1ngwbx`}]]};Ot.node;var kt=f(Ot),Z=T(y(),1),Q=ne(),At=`modulepreload`,jt=function(e){return`/_console/`+e},Mt={},Nt=function(e){return e.pathname.endsWith(`.css`)},Pt=function(e,t,n){if(t in e)return e[t];let r=n();if(!r){e[t]=void 0;return}let i=r.then(()=>{e[t]=void 0},n=>{throw e[t]=void 0,n});return e[t]=i,i},Ft=function(e,t,n){let r=Promise.resolve();if(t&&t.length>0){let e,i=document.querySelector(`meta[property=csp-nonce]`),a=i?.nonce||i?.getAttribute(`nonce`);function o(e){return Promise.all(e.map(e=>Promise.resolve(e).then(e=>({status:`fulfilled`,value:e}),e=>({status:`rejected`,reason:e}))))}function s(e){return import.meta.resolve?new URL(import.meta.resolve(e)):new URL(e,import.meta.url)}r=o(t.map(t=>{t=jt(t,n);let r=s(t),i=Nt(r);return Pt(Mt,r.href,()=>{if(e===void 0){e={all:new Set,styles:new Set};let t=document.getElementsByTagName(`link`);for(let n=t.length-1;n>=0;n--){let r=t[n];e.all.add(r.href),r.rel===`stylesheet`&&e.styles.add(r.href)}}if((i?e.styles:e.all).has(r.href))return;let t=document.createElement(`link`);if(t.rel=i?`stylesheet`:At,i||(t.as=`script`),t.crossOrigin=``,t.href=r.href,a&&t.setAttribute(`nonce`,a),document.head.appendChild(t),i)return new Promise((e,n)=>{t.addEventListener(`load`,e),t.addEventListener(`error`,()=>n(Error(`Unable to preload CSS for ${r}`)))})})}).filter(e=>e!==void 0))}function i(e){let t=new Event(`vite:preloadError`,{cancelable:!0});if(t.payload=e,window.dispatchEvent(t),!t.defaultPrevented)throw e}return r.then(t=>{for(let e of t||[])e.status===`rejected`&&i(e.reason);return e().catch(i)})},It=(0,Z.lazy)(()=>Ft(()=>import(`./app-update-dialog-B8M9plaT.js`),__vite__mapDeps([0,1,2]))),Lt=`shapewall:open-about`;function Rt(e=null){window.dispatchEvent(new CustomEvent(Lt,{detail:{opener:e}}))}function zt({transport:e,className:t,placement:n=`menu`,ref:r}){let[i,a]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(!1),l=(0,Z.useRef)(null),u=(0,Z.useRef)(null),d=e=>{u.current=e||null,c(!0),a(!0)};(0,Z.useImperativeHandle)(r,()=>({open:()=>d(document.activeElement)}),[]),(0,Z.useEffect)(()=>{let e=e=>d(e.detail?.opener||null);return window.addEventListener(Lt,e),()=>window.removeEventListener(Lt,e)},[]);let f=()=>a(!1),m=e=>{e.preventDefault(),[u.current,l.current,document.querySelector(`[data-sw-profile-menu]`)].find(e=>e?.isConnected&&e!==document.body)?.focus()},h=`About Shapewall and updates, ${Oe(ke)}, created by Dan Baruch`;return(0,Q.jsxs)(Q.Fragment,{children:[n===`footer`?(0,Q.jsx)(`footer`,{className:o(`flex shrink-0 justify-center border-t border-line bg-surface text-muted`,t),style:{paddingBottom:`env(safe-area-inset-bottom, 0px)`},children:(0,Q.jsxs)(p,{variant:`ghost`,size:`touch`,className:`gap-2 rounded-none px-3 text-[10px] font-normal lg:h-6`,onClick:()=>d(l.current),"aria-label":h,"data-sw-app-about":`footer`,ref:l,children:[(0,Q.jsx)(`span`,{children:`Created by Dan Baruch`}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Q.jsx)(`span`,{"data-sw-app-version":!0,children:Oe(ke)})]})}):n===`link`?(0,Q.jsxs)(`span`,{className:`inline-flex items-center`,children:[(0,Q.jsx)(p,{asChild:!0,variant:`ghost`,size:`touch`,className:`px-2 text-caption font-normal text-faint hover:text-fg lg:h-8`,"data-sw-app-contact":`link`,children:(0,Q.jsx)(`a`,{href:De,target:`_blank`,rel:`noopener noreferrer`,children:`Contact`})}),(0,Q.jsxs)(p,{variant:`ghost`,size:`touch`,className:o(`gap-1.5 px-2 text-caption font-normal text-faint hover:text-fg lg:h-8`,t),onClick:()=>d(l.current),"aria-label":h,"data-sw-app-about":`link`,ref:l,children:[(0,Q.jsx)(`span`,{children:`About Shapewall`}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Q.jsxs)(`span`,{className:`tabular-nums`,"data-sw-app-version":!0,children:[`v`,ke.version]})]})]}):null,s?(0,Q.jsx)(Z.Suspense,{fallback:(0,Q.jsx)(`span`,{role:`status`,className:`sr-only`,children:`Opening About & Updates…`}),children:(0,Q.jsx)(It,{open:i,onClose:f,onCloseAutoFocus:m,transport:e})}):null]})}function Bt({className:e}){let[t,n]=(0,Z.useState)(null);if((0,Z.useEffect)(()=>{if(document.querySelector(`meta[name="shapewall-local-console"]`))return;let e=!0;return de.get(`/api/legal`).then(t=>{e&&n(t)}).catch(()=>{}),()=>{e=!1}},[]),!t)return null;let r=[[`terms`,`Terms`],[`privacy`,`Privacy`],[`acceptableUse`,`Acceptable use`],[`subprocessors`,`Subprocessors`],[`report`,`Report abuse`]].filter(([e])=>t[e]&&(/^https?:\/\//.test(t[e])||t[e]===`/report`));return(0,Q.jsx)(`nav`,{"aria-label":`Legal`,className:o(`mt-6 flex flex-wrap justify-center gap-x-4 gap-y-2 text-xs text-muted`,e),children:r.map(([e,n])=>(0,Q.jsx)(`a`,{href:t[e],className:`inline-flex min-h-11 items-center px-2 underline underline-offset-2`,children:n},e))})}function Vt({transport:e,legal:t=!0,updatesRef:n,className:r}){return(0,Q.jsxs)(`footer`,{className:o(`mx-auto flex w-full max-w-6xl flex-col items-center gap-1 px-1 pt-8 sm:flex-row sm:justify-between sm:px-4`,r),style:{paddingBottom:`max(env(safe-area-inset-bottom, 0px), 1rem)`},"data-sw-console-footer":!0,children:[t?(0,Q.jsx)(Bt,{className:`mt-0 justify-start gap-x-1 text-caption text-faint`}):(0,Q.jsx)(`span`,{}),(0,Q.jsx)(zt,{ref:n,transport:e,placement:`link`})]})}var Ht=Object.freeze({id:null,pinned:!1,via:null,swap:!1});function Ut({onChange:e,openDelay:t=150,closeDelay:n=250,setTimer:r=(e,t)=>setTimeout(e,t),clearTimer:i=e=>clearTimeout(e)}={}){let a=Ht,o=null,s=()=>{o!==null&&i(o),o=null},c=(e,t)=>{s(),o=r(()=>{o=null,e()},t)},l=t=>{a=t,e?.(a)},u=()=>{s(),a.id!==null&&l(Ht)};return{get state(){return a},enterIcon(e){a.pinned||(s(),a.id!==e&&(a.id===null?c(()=>l({id:e,pinned:!1,via:`hover`,swap:!1}),t):l({id:e,pinned:!1,via:`hover`,swap:!0})))},leave(){a.pinned||(a.id===null?s():c(u,n))},enterPanel(){a.pinned||s()},toggle(e,t=`click`){s(),a.id===e&&a.pinned?u():l({id:e,pinned:!0,via:t,swap:!1})},close:u,dispose:s}}function Wt({anchorTop:e,viewportHeight:t,margin:n=8,minHeight:r=320}){let i=Math.max(0,t-n*2),a=t-Math.max(e,n)-n;return Math.round(Math.min(i,Math.max(a,Math.min(r,i))))}var Gt=`shapewall.lastBoard`,Kt=`shapewall.sidebar`,qt=`shapewall.sidebarWidth`,Jt=208,Yt=420,Xt=16,Zt=typeof navigator<`u`&&/Mac|iPhone|iPad/.test(navigator.platform||navigator.userAgent||``)?`⌘B`:`Ctrl B`;function Qt(){try{let e=window.localStorage.getItem(Gt);return e&&e.startsWith(`/`)&&!e.startsWith(`//`)?e:null}catch{return null}}function $t(e){try{let t=window.localStorage.getItem(Kt);return t===`expanded`||t!==`collapsed`&&e}catch{return e}}function en(e){let t=Math.max(Jt,Math.min(Yt,Math.floor(window.innerWidth*.4)));return Math.min(t,Math.max(Jt,Math.round(e)))}function tn(){try{let e=Number(window.localStorage.getItem(qt));return Number.isFinite(e)&&e>0?en(e):256}catch{return 256}}function nn(e){try{e===256?window.localStorage.removeItem(qt):window.localStorage.setItem(qt,String(e))}catch{}}function rn(){let[e,t]=(0,Z.useState)(tn),[n,r]=(0,Z.useState)(!1),i=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{let e=()=>t(e=>en(e));return window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[]);let a=e=>{let n=en(e);t(n),nn(n)},o={onPointerDown:t=>{t.button===0&&(t.preventDefault(),t.currentTarget.setPointerCapture(t.pointerId),i.current={x:t.clientX,width:e},r(!0))},onPointerMove:e=>{i.current&&t(en(i.current.width+e.clientX-i.current.x))},onPointerUp:e=>{i.current&&(a(i.current.width+e.clientX-i.current.x),i.current=null,r(!1))},onDoubleClick:()=>a(256),onKeyDown:t=>{let n=t.shiftKey?64:Xt;if(t.key===`ArrowRight`)a(e+n);else if(t.key===`ArrowLeft`)a(e-n);else if(t.key===`Home`)a(256);else return;t.preventDefault()}};return o.onPointerCancel=o.onPointerUp,{width:e,dragging:n,handle:o}}var an=e=>!!(e&&(e.isContentEditable||/^(INPUT|TEXTAREA|SELECT)$/.test(e.tagName)||e.closest?.(`[contenteditable="true"]`)));function on(e=!0,t=!0){let[n,r]=(0,Z.useState)(()=>$t(t)),i=(0,Z.useCallback)(()=>r(e=>{try{window.localStorage.setItem(Kt,e?`collapsed`:`expanded`)}catch{}return!e}),[]);return(0,Z.useEffect)(()=>{if(!e)return;let t=e=>{!(e.metaKey||e.ctrlKey)||e.altKey||e.shiftKey||e.key.toLowerCase()!==`b`||an(e.target)||document.querySelector(`[role="dialog"]:not([data-sw-rail-flyout])`)||(e.preventDefault(),i())};return window.addEventListener(`keydown`,t),()=>window.removeEventListener(`keydown`,t)},[e,i]),[n,i,r]}function sn(e,t){return o(`relative flex items-center rounded-md outline-none transition-colors focus-visible:outline-2 focus-visible:outline-accent`,e?`h-8 w-full gap-2.5 px-2.5 text-left text-[13px] font-medium`:`h-10 w-10 justify-center rounded-lg`,t?`bg-accent/10 text-fg`:`text-muted hover:bg-surface-2 hover:text-fg`)}function cn({item:e,expanded:t,link:n,flyouts:r}){let{id:i,label:a,icon:s,href:c,to:l,onSelect:u,active:d,count:f,shortcut:p,flyout:m,...h}=e;if(!t&&m&&r)return(0,Q.jsx)(fn,{item:e,flyouts:r});let g=(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(s,{size:t?16:19,"aria-hidden":`true`,className:o(`shrink-0`,d&&`text-accent`)}),t?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:a}):null,t&&f?(0,Q.jsx)(`span`,{className:`shrink-0 text-xs font-normal text-faint tabular`,children:f}):null]}),_={className:sn(t,d),"aria-label":t?void 0:a,"aria-current":d?`page`:void 0,"data-sw-rail-item":i,...h},v=l&&n?(0,Q.jsx)(n,{to:l,..._,children:g}):c?(0,Q.jsx)(`a`,{href:c,..._,children:g}):(0,Q.jsx)(`button`,{type:`button`,onClick:u,..._,children:g});return(0,Q.jsx)(`li`,{children:t?v:(0,Q.jsx)(te,{content:p?(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[a,(0,Q.jsx)(E,{children:p})]}):a,side:`right`,children:v})})}var ln=`a[href], button:not([disabled]), input:not([disabled]), select:not([disabled]), textarea:not([disabled]), [tabindex]:not([tabindex="-1"])`,un=e=>[...e.querySelectorAll(ln)].filter(e=>e.getClientRects().length>0);function dn(e,t){let n=un(document).filter(e=>!t?.contains(e));(n[n.indexOf(e)+1]||e).focus()}function fn({item:t,flyouts:n}){let{id:r,label:i,icon:a,active:s,flyout:c,dot:l}=t,{state:u,intent:d,width:f,disabled:p}=n,m=Object.fromEntries(Object.entries(t).filter(([e])=>e.startsWith(`data-`))),h=(0,Z.useId)(),g=(0,Z.useRef)(null),_=(0,Z.useRef)(null),y=u.id===r,[b,x]=(0,Z.useState)(null);(0,Z.useLayoutEffect)(()=>{if(!y)return;let e=()=>{let e=g.current?.getBoundingClientRect().top??0;x(Wt({anchorTop:e,viewportHeight:window.innerHeight}))};return e(),window.addEventListener(`resize`,e),()=>window.removeEventListener(`resize`,e)},[y]),(0,Z.useEffect)(()=>{if(!y)return;let e=e=>{_.current?.contains(e.target)||g.current?.contains(e.target)||d.close()};return document.addEventListener(`pointerdown`,e,!0),()=>document.removeEventListener(`pointerdown`,e,!0)},[y,d]);let S=y&&u.pinned;(0,Z.useEffect)(()=>{if(!S)return;let e=requestAnimationFrame(()=>{let e=_.current;e&&!e.contains(document.activeElement)&&(un(e)[0]||e).focus({preventScroll:!0})});return()=>cancelAnimationFrame(e)},[S]);let C=(0,Z.useCallback)(()=>{let e=!!_.current?.contains(document.activeElement);d.close(),e&&g.current?.focus({preventScroll:!0})},[d]),w=e=>t=>{t.pointerType!==`touch`&&e()},ee=e=>{if(e.key!==`Tab`||e.defaultPrevented)return;let t=un(_.current);t.length&&(e.shiftKey&&document.activeElement===t[0]?(e.preventDefault(),g.current?.focus()):!e.shiftKey&&document.activeElement===t[t.length-1]&&(e.preventDefault(),d.close(),dn(g.current,_.current)))};return(0,Q.jsx)(`li`,{children:(0,Q.jsxs)(v,{open:y,onOpenChange:e=>{e||d.close()},children:[(0,Q.jsx)(e,{asChild:!0,children:(0,Q.jsxs)(`button`,{ref:g,type:`button`,className:sn(!1,s||y),"aria-label":i,"aria-haspopup":`dialog`,"aria-expanded":y,"aria-controls":y?h:void 0,"aria-current":s?`page`:void 0,"data-sw-rail-item":r,"data-sw-rail-flyout-trigger":r,"data-state":y?u.pinned?`pinned`:`open`:`closed`,...m,onPointerEnter:w(()=>!p&&d.enterIcon(r)),onPointerLeave:w(()=>d.leave()),onClick:e=>!p&&d.toggle(r,e.detail===0?`key`:`click`),onKeyDown:e=>{e.key!==`ArrowRight`||p||(e.preventDefault(),S||d.toggle(r,`key`))},children:[(0,Q.jsx)(a,{size:19,"aria-hidden":`true`,className:o(`shrink-0`,s&&`text-accent`)}),l?(0,Q.jsx)(`span`,{className:`pointer-events-none absolute top-1.5 right-1.5 h-2 w-2 rounded-full bg-accent ring-2 ring-surface`,"aria-hidden":`true`,"data-sw-rail-dot":r}):null]})}),(0,Q.jsx)(H,{children:(0,Q.jsx)(j,{ref:_,id:h,side:`right`,align:`start`,sideOffset:12,collisionPadding:8,"aria-label":i,tabIndex:-1,className:o(`sw-rail-flyout z-40 flex flex-col overflow-y-auto overscroll-contain rounded-lg border border-line bg-surface p-2 text-fg shadow-pop outline-none`,`[&_[data-sw-pages-sidebar]]:border-t-0 [&_[data-sw-pages-sidebar]]:pt-0`,u.swap&&`sw-rail-flyout-swap`),style:{width:f,maxHeight:b??void 0},"data-sw-rail-flyout":r,onOpenAutoFocus:e=>e.preventDefault(),onCloseAutoFocus:e=>e.preventDefault(),onEscapeKeyDown:e=>{e.preventDefault();let t=u.pinned||_.current?.contains(document.activeElement);d.close(),t&&g.current?.focus({preventScroll:!0})},onInteractOutside:e=>{g.current?.contains(e.target)&&e.preventDefault()},onPointerEnter:w(()=>d.enterPanel()),onPointerLeave:w(()=>d.leave()),onKeyDown:ee,children:c({close:C})})})]})})}function pn({items:e,expanded:t,link:n,label:r,flyouts:i,flush:a}){return e.length?(0,Q.jsxs)(`div`,{className:o(`w-full`,!a&&`border-t border-line pt-2`),children:[t&&r?(0,Q.jsx)(`p`,{className:`px-2.5 pb-1 text-xs font-semibold text-faint`,children:r}):null,(0,Q.jsx)(`ul`,{className:o(`flex flex-col`,t?`gap-0.5`:`items-center gap-1`),children:e.map(e=>(0,Q.jsx)(cn,{item:e,expanded:t,link:n,flyouts:i},e.id))})]}):null}function mn(e,t,n=!1){let[r,i]=(0,Z.useState)(()=>({id:null,pinned:!1,via:null,swap:!1})),a=(0,Z.useRef)(null);return a.current||=Ut({onChange:i}),(0,Z.useEffect)(()=>()=>a.current.dispose(),[]),(0,Z.useEffect)(()=>{(e||n)&&a.current.close()},[e,n]),{state:r,intent:a.current,width:t,disabled:n}}function hn({expanded:e,onToggle:t,home:n,homeTo:r,homeLabel:i=`Shapewall`,title:a,logo:s,items:c=[],sections:l=[],sectionsLabel:u,link:d,profile:f,children:p,className:m,flyoutsDisabled:h=!1}){let g=r&&d?d:`a`,_=r&&d?{to:r}:{href:n},v=e?`Collapse sidebar`:`Expand sidebar`,{width:y,dragging:b,handle:x}=rn(),S=mn(e,y,h),C=e?[]:l.filter(e=>!e.flyout),w=C.length?c.find(e=>e.active):null,ee=w?c.map(e=>e===w?{...e,flyout:({close:t})=>(0,Q.jsx)(`div`,{onClick:e=>{e.target.closest?.(`[data-sw-rail-item]`)&&setTimeout(t,0)},children:(0,Q.jsx)(pn,{items:C,expanded:!0,link:d,label:u||e.label,flush:!0})})}:e):c,T=w?l.filter(e=>e.flyout):l;return(0,Q.jsxs)(`div`,{className:o(`relative flex shrink-0`,m),children:[(0,Q.jsxs)(`nav`,{"aria-label":`Shapewall`,className:o(`flex flex-col gap-2 overflow-hidden border-r border-line bg-surface py-2`,e?`px-2`:`w-[52px] items-center`),style:e?{width:y}:void 0,"data-sw-app-rail":e?`expanded`:`collapsed`,children:[(0,Q.jsxs)(`div`,{className:o(`flex shrink-0 items-center gap-1`,e?`h-10`:`flex-col`),children:[(0,Q.jsx)(te,{content:e?null:i,side:`right`,children:(0,Q.jsx)(g,{..._,className:`flex h-10 w-10 shrink-0 items-center justify-center rounded-lg outline-none hover:bg-surface-2 focus-visible:outline-2 focus-visible:outline-accent`,"aria-label":i,"data-sw-rail-home":`true`,children:s})}),e?(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate text-sm font-semibold text-fg`,"data-sw-rail-title":`true`,children:a||`Shapewall`}):null,(0,Q.jsx)(te,{content:(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-2`,children:[v,(0,Q.jsx)(E,{children:Zt})]}),side:`right`,children:(0,Q.jsx)(`button`,{type:`button`,onClick:t,className:`flex h-8 w-8 shrink-0 items-center justify-center rounded-md text-muted outline-none hover:bg-surface-2 hover:text-fg focus-visible:outline-2 focus-visible:outline-accent`,"aria-label":v,"aria-expanded":e,"data-sw-sidebar-toggle":`true`,children:e?(0,Q.jsx)(st,{size:17,"aria-hidden":`true`}):(0,Q.jsx)(lt,{size:17,"aria-hidden":`true`})})})]}),(0,Q.jsx)(pn,{items:ee,expanded:e,link:d,flyouts:S}),(0,Q.jsxs)(`div`,{className:o(`flex min-h-0 flex-1 flex-col gap-2`,e?`overflow-y-auto in-[.sw-scrollbars]:mr-[calc(-1*var(--scrollbar-size))]`:`w-full`),children:[(0,Q.jsx)(pn,{items:T,expanded:e,link:d,label:u,flyouts:S}),e?p:null]}),f?(0,Q.jsx)(`div`,{className:o(`w-full shrink-0 border-t border-line pt-2`,!e&&`flex justify-center`),children:f(e)}):null]}),e?(0,Q.jsx)(`div`,{role:`separator`,"aria-orientation":`vertical`,"aria-label":`Resize sidebar`,"aria-valuenow":y,"aria-valuemin":Jt,"aria-valuemax":Yt,tabIndex:0,"aria-description":`Drag or use the arrow keys to resize. Double-click or press Home to reset.`,className:`group absolute inset-y-0 -right-1.5 z-20 w-3 cursor-col-resize touch-none outline-none`,"data-sw-sidebar-handle":`true`,...x,children:(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:o(`absolute inset-y-0 left-1/2 w-0.5 -translate-x-1/2 bg-accent opacity-0 transition-opacity group-hover:opacity-60 group-focus-visible:opacity-100`,b&&`opacity-100`)})}):null,b?(0,Q.jsx)(`div`,{className:`fixed inset-0 z-50 cursor-col-resize`,"aria-hidden":`true`}):null]})}var gn=e=>e.preventDefault(),_n={light:yt,dark:at,system:rt},vn=`h-11 justify-center gap-1.5 rounded-md border border-transparent px-1 text-xs lg:h-9 data-[state=checked]:border-accent data-[state=checked]:bg-accent/10 data-[state=checked]:text-fg`;function yn({name:e,avatarUrl:n=null,detail:r=null,items:c=[],workspaces:l=null,viewAs:u=null,showName:d=!1,label:f=`Profile and appearance`,about:m=!0,triggerClassName:h,side:v=`bottom`,align:y=`end`,...b}){let[x,C]=xe(),w=(0,Z.useRef)(null);return(0,Q.jsxs)(i,{children:[(0,Q.jsx)(ie,{asChild:!0,children:(0,Q.jsxs)(p,{ref:w,variant:`ghost`,size:`touch`,className:o(`shrink-0 gap-2 px-1.5 lg:h-10`,h),"aria-label":e?`${f}: ${e}`:f,"data-sw-profile-menu":!0,...b,children:[(0,Q.jsx)(R,{name:e||`?`,src:n,className:`h-8 w-8`}),d&&e?(0,Q.jsx)(`span`,{className:`hidden max-w-40 truncate text-sm text-fg md:inline`,children:e}):null]})}),(0,Q.jsxs)(G,{className:`w-72`,side:v,align:y,"data-sw-profile-content":!0,children:[e||r?(0,Q.jsxs)(a,{className:`normal-case`,children:[e?(0,Q.jsx)(`span`,{className:`block truncate text-[13px] font-medium tracking-normal text-fg`,children:e}):null,r?(0,Q.jsx)(`span`,{className:`block truncate text-xs font-normal tracking-normal text-muted`,children:r}):null]}):null,c.length?(0,Q.jsxs)(Q.Fragment,{children:[e||r?(0,Q.jsx)(t,{}):null,(0,Q.jsx)(S,{children:c.map(({id:e,label:t,icon:n,onSelect:r,tone:i,hint:a,...o})=>(0,Q.jsxs)(Z.Fragment,{children:[(0,Q.jsxs)(s,{onSelect:r,tone:i,"data-sw-profile-item":e,"aria-describedby":a?`sw-profile-hint-`+e:void 0,...o,children:[n?(0,Q.jsx)(n,{size:14,"aria-hidden":`true`}):null,` `,t]}),a?(0,Q.jsx)(`p`,{id:`sw-profile-hint-`+e,className:`px-2 pb-1.5 text-xs text-muted`,"data-sw-profile-hint":e,children:a}):null]},e))})]}):null,l?.list?.length?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(t,{}),(0,Q.jsx)(a,{children:`Workspace`}),l.list.map(e=>(0,Q.jsxs)(s,{onSelect:()=>l.onPick(e.id),"data-sw-profile-workspace":e.id,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.name}),e.roleLabel?(0,Q.jsx)(`span`,{className:`text-xs text-faint`,children:e.roleLabel}):null,e.id===l.current?(0,Q.jsx)(_,{size:14,className:`!text-accent`,"aria-label":`Current`}):null]},e.id))]}):null,u?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(t,{}),(0,Q.jsx)(a,{children:`View as (demo)`}),(0,Q.jsx)(g,{value:u.value,onValueChange:u.onChange,children:u.options.map(e=>(0,Q.jsxs)(L,{value:e.id,"data-sw-view-as":e.id,children:[(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:e.label}),e.hint?(0,Q.jsx)(`span`,{className:`truncate text-xs text-faint`,children:e.hint}):null]},e.id))})]}):null,(0,Q.jsx)(t,{}),(0,Q.jsx)(a,{children:`Appearance`}),(0,Q.jsx)(g,{value:x.mode,onValueChange:e=>C({mode:e}),className:`grid grid-cols-3 gap-1 px-1 pb-1`,"aria-label":`Mode`,children:Se.map(e=>{let t=_n[e.id];return(0,Q.jsxs)(L,{value:e.id,indicator:!1,className:vn,onSelect:gn,"data-sw-appearance-mode":e.id,children:[(0,Q.jsx)(t,{size:14,"aria-hidden":`true`}),` `,e.label]},e.id)})}),(0,Q.jsx)(g,{value:x.theme,onValueChange:e=>C({theme:e}),className:`grid grid-cols-2 gap-1 px-1 pb-1`,"aria-label":`Theme`,children:ve.map(e=>(0,Q.jsxs)(L,{value:e.id,indicator:!1,className:o(vn,`justify-start px-2`),onSelect:gn,"data-sw-theme-option":e.id,children:[(0,Q.jsx)(`span`,{className:o(`h-4 w-4 shrink-0 rounded-full ring-1 ring-line`,`sw-swatch-${e.id}`),"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`truncate`,children:e.label})]},e.id))}),m?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(t,{}),(0,Q.jsxs)(s,{onSelect:()=>Rt(w.current),"data-sw-app-about":`menu`,children:[(0,Q.jsx)(X,{size:14,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`About Shapewall and updates`}),(0,Q.jsxs)(`span`,{className:`text-caption text-faint tabular-nums`,"data-sw-app-version":!0,children:[`v`,ke.version]})]}),(0,Q.jsx)(s,{asChild:!0,"data-sw-app-contact":`menu`,children:(0,Q.jsxs)(`a`,{href:De,target:`_blank`,rel:`noopener noreferrer`,children:[(0,Q.jsx)($e,{size:14,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{className:`min-w-0 flex-1 truncate`,children:`Contact`})]})})]}):null]})]})}async function bn(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()}}function xn({name:e,avatarUrl:t,transport:n,onSaved:r}){let i=(0,Z.useRef)(null),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(``),[l,u]=(0,Z.useState)(``),d=async e=>{if(e){o(!0),c(``),u(``);try{let t=await bn(e);await n.put(`/auth/me/avatar`,{png:t}),await r(),u(`Profile photo saved.`)}catch(e){c(e.message||`The profile photo could not be saved.`)}finally{o(!1),i.current&&(i.current.value=``)}}};return(0,Q.jsxs)(`div`,{className:`space-y-2 border-b border-line px-4 py-4 sm:px-5`,"data-sw-profile-photo":!0,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-3`,children:[(0,Q.jsx)(R,{name:e,src:t,className:`h-16 w-16 text-lg`}),(0,Q.jsxs)(`div`,{className:`min-w-0 space-y-2`,children:[(0,Q.jsx)(`p`,{className:`text-sm font-medium text-fg`,children:`Profile photo`}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-2`,children:[(0,Q.jsxs)(p,{size:`touch`,variant:`secondary`,className:`lg:h-9`,disabled:a,onClick:()=>i.current?.click(),"data-sw-profile-photo-upload":!0,children:[a?(0,Q.jsx)(D,{}):(0,Q.jsx)(Ne,{size:15,"aria-hidden":`true`}),` Upload photo`]}),t?(0,Q.jsxs)(p,{size:`touch`,variant:`ghost`,className:`lg:h-9`,disabled:a,onClick:async()=>{o(!0),c(``),u(``);try{await n.delete(`/auth/me/avatar`),await r(),u(`Profile photo removed.`)}catch(e){c(e.message||`The profile photo could not be removed.`)}finally{o(!1)}},"data-sw-profile-photo-remove":!0,children:[(0,Q.jsx)(Dt,{size:15,"aria-hidden":`true`}),` Remove photo`]}):null]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted`,children:`PNG, JPEG or WebP, up to 5 MB. Cropped to a square.`})]})]}),(0,Q.jsx)(`input`,{ref:i,type:`file`,accept:`image/png,image/jpeg,image/webp`,className:`hidden`,"aria-label":`Choose profile photo`,onChange:e=>void d(e.target.files?.[0]),"data-sw-profile-photo-file":!0}),s?(0,Q.jsx)(`p`,{className:`text-sm text-bad`,role:`alert`,children:s}):null,(0,Q.jsx)(`p`,{className:`text-xs text-muted`,role:`status`,children:l})]})}function Sn({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 Cn({text:e,label:t,touch:n}){let[r,i]=(0,Z.useState)(!1),[a,o]=(0,Z.useState)(!1),s=(0,Z.useRef)(null);return(0,Z.useEffect)(()=>{if(!r)return;let e=window.setTimeout(()=>i(!1),1500);return()=>window.clearTimeout(e)},[r]),(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:s,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)(p,{variant:`ghost`,size:n?`icon`:`icon-sm`,onClick:async()=>{try{await navigator.clipboard.writeText(e),o(!1),i(!0)}catch{if(s.current){let e=document.createRange();e.selectNodeContents(s.current);let t=window.getSelection();t.removeAllRanges(),t.addRange(e)}o(!0)}},"aria-label":r?`Copied`:`Copy the ${t} line`,children:r?(0,Q.jsx)(_,{size:14,"aria-hidden":`true`}):(0,Q.jsx)(Te,{size:14,"aria-hidden":`true`})})]}),a?(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 wn({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)(ge,{size:13,className:`mt-px shrink-0 text-warn`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:e})]})}function Tn({items:e,keyVar:t,onCancel:n,onConfirm:r,busy:i,touch:a,confirmLabel:o=`Allow and save`,children:s=null,blocked:c=!1}){let l=a?`touch`:`md`;return(0,Q.jsxs)(m,{open:!!e,onClose:()=>i?null:n(),title:`Allow this?`,footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(p,{size:l,onClick:n,disabled:i,children:`Cancel`}),(0,Q.jsx)(p,{size:l,variant:`default`,onClick:r,disabled:i||c,"data-sw-settings-confirm":`true`,children:i?`Saving...`:o})]}),children:[e?s: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)(xt,{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)(Ee,{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 En({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)(X,{size:14,className:`mt-px shrink-0`,"aria-hidden":`true`}),(0,Q.jsx)(`span`,{children:e.note})]});let t=e.ok?ue:fe;return(0,Q.jsxs)(`div`,{className:o(`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:o(`flex items-start gap-1.5 font-medium`,e.ok?`text-fg`:`text-bad`),children:[(0,Q.jsx)(t,{size:14,className:o(`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]})}var Dn=2097152,On=`upload:pending`,kn=(e={})=>({name:e.label||``,icon:e.icon||null,tint:e.tint||null,png:null});function An(e,t){let n={};return t.name.trim()!==(e.label||``)&&(n.name=t.name.trim()),t.icon!==On&&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 jn(e,t,n){let i=null,a=An(t,n);return a&&(i=await r.post(`/api/agent/settings/identity`,{id:e,...a})),n.icon===On&&n.png&&(i=await r.post(`/api/agent/settings/identity/icon`,{id:e,png:n.png})),i}function Mn({name:e,checked:t,onChange:n,label:r,children:i,className:a,...s}){return(0,Q.jsxs)(`label`,{className:o(`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,...s,children:[(0,Q.jsx)(`input`,{type:`radio`,name:e,className:`sr-only`,checked:t,onChange:n,"aria-label":r}),i]})}function Nn({value:e,onChange:t,label:n,logo:r=null,upload:i=!0,disabled:a=!1}){let o=(0,Z.useId)(),s=(0,Z.useRef)(null),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(``),m=x(r),h=e.png?`data:image/png;base64,${e.png}`:null,g=e.icon===On||c(e.icon),_=!g&&(e.icon||!m),v=async n=>{if(n){u(!0),f(``);try{let r=await bn(n,{maxBytes:Dn,maxLabel:`2 MB`});t({...e,icon:On,png:r})}catch(e){f(e.message||`This image could not be read.`)}finally{u(!1),s.current&&(s.current.value=``)}}},y=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:`${o}-icons`,children:`Icon`}),(0,Q.jsxs)(`div`,{role:`radiogroup`,"aria-labelledby":`${o}-icons`,className:`flex flex-wrap gap-1`,"data-sw-agent-icon-options":!0,children:[(0,Q.jsx)(Mn,{name:`${o}-icon`,checked:!e.icon,onChange:()=>y(null),label:m?`Default: the ${m.name} mark`:`Default: initials`,"data-sw-agent-icon-option":`default`,children:(0,Q.jsx)(A,{label:n,logo:r,tint:e.tint,size:`lg`,className:`h-9 w-9`})}),V.map(t=>(0,Q.jsx)(Mn,{name:`${o}-icon`,checked:e.icon===t,onChange:()=>y(t),label:M[t].name,"data-sw-agent-icon-option":t,children:(0,Q.jsx)(A,{label:n,icon:t,tint:e.tint,size:`lg`,className:`h-9 w-9`})},t)),g?(0,Q.jsx)(Mn,{name:`${o}-icon`,checked:!0,onChange:()=>{},label:`Your picture`,"data-sw-agent-icon-option":`upload`,children:(0,Q.jsx)(A,{label:n,icon:e.icon===On?null:e.icon,src:h,size:`lg`,className:`h-9 w-9`})}):null]}),i?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1 pt-1`,children:[(0,Q.jsxs)(p,{size:`touch`,className:`lg:h-8`,disabled:l||a,onClick:()=>s.current?.click(),children:[l?(0,Q.jsx)(D,{}):(0,Q.jsx)(Ge,{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:s,type:`file`,accept:`image/png,image/jpeg,image/webp`,className:`hidden`,"aria-label":`Choose a picture for the icon`,onChange:e=>void v(e.target.files?.[0]),"data-sw-agent-icon-upload":!0})]}):null,d?(0,Q.jsx)(`p`,{className:`text-xs text-bad`,role:`alert`,"data-sw-agent-icon-problem":!0,children:d}):null]}),_?(0,Q.jsxs)(`div`,{className:`space-y-1.5`,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg`,id:`${o}-tints`,children:`Colour`}),(0,Q.jsxs)(`div`,{role:`radiogroup`,"aria-labelledby":`${o}-tints`,className:`flex flex-wrap gap-1`,"data-sw-agent-tint-options":!0,children:[(0,Q.jsx)(Mn,{name:`${o}-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)(ht,{size:13,"aria-hidden":`true`})})}),K.map(n=>(0,Q.jsx)(Mn,{name:`${o}-tint`,checked:e.tint===n,onChange:()=>t({...e,tint:n}),label:z[n],"data-sw-agent-tint-option":n,children:(0,Q.jsx)(`span`,{className:`h-7 w-7 rounded-full`,style:{background:P(n)}})},n))]})]}):null]})}function Pn({value:e,onChange:t,builtIn:n=``,touch:r=!1,id:i,problem:a=null,disabled:o=!1,hint:s=null}){return(0,Q.jsx)(Sn,{label:`Name`,htmlFor:i,problem:a,hint:s||(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)(q,{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 Fn(e){let{problem:t}=C(e);return t?/control/.test(t)?`One line of plain text, without control characters.`:`At most 40 characters.`:null}function In({value:e,onChange:t,builtIn:n,logo:r=null,upload:i=!0,touch:a=!1,disabled:o=!1}){let s=(0,Z.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)(Pn,{id:`${s}-name`,value:e,onChange:t,builtIn:n,touch:a,problem:Fn(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)(h,{size:13,className:`text-muted transition-transform group-open:rotate-90`,"aria-hidden":`true`}),(0,Q.jsx)(A,{label:e.name||n,icon:e.icon===On?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)(Nn,{value:e,onChange:t,label:e.name||n,logo:r,upload:i,disabled:o})})]})]})}function Ln({agent:e,upload:t=!0,touch:n=!1,waiting:r=!1,onClose:i,onSaved:a}){let o=(0,Z.useId)(),[s,c]=(0,Z.useState)(kn()),[l,u]=(0,Z.useState)(!1),[d,f]=(0,Z.useState)(``),h=(0,Z.useRef)(null);(0,Z.useEffect)(()=>{e&&(h.current=e.id,c(kn(e)),f(``))},[e]);let g=n?`touch`:`md`,_=Fn(s.name),v=e&&!e.builtIn&&!s.name.trim()?`Give it a name.`:null,y=e?!!An(e,s)||!!s.png:!1,b=async()=>{u(!0),f(``);try{let t=await jn(e.id,e,s);await a?.(t),i()}catch(e){f(e.message||`It could not be saved.`)}finally{u(!1)}},x=s.png?`data:image/png;base64,${s.png}`:null;return(0,Q.jsx)(m,{open:!!e,onClose:()=>l?null:i(),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(h.current||``)}"]`);t&&(e.preventDefault(),t.focus())},footer:(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(p,{size:g,onClick:i,disabled:l,children:`Cancel`}),(0,Q.jsx)(p,{size:g,variant:`default`,onClick:b,disabled:l||!y||!!(_||v),"data-sw-agent-identity-save":!0,children:l?r?`Saving when the connection test finishes...`:`Saving...`:`Save`})]}),children:(0,Q.jsxs)(`form`,{className:`space-y-4 p-5`,onSubmit:e=>{e.preventDefault(),!l&&y&&!_&&!v&&b()},"data-sw-agent-identity":e?.id,children:[(0,Q.jsxs)(`div`,{className:`flex items-center gap-3`,children:[(0,Q.jsx)(A,{label:s.name||e?.builtIn||e?.label,icon:s.icon===On?null:s.icon,tint:s.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)(Pn,{id:`${o}-name`,value:s,onChange:c,builtIn:e?.builtIn||``,touch:n,problem:_||v,disabled:l})})]}),(0,Q.jsx)(Nn,{value:s,onChange:c,label:s.name||e?.builtIn||e?.label,logo:e?.logo,upload:t,disabled:l}),r&&!d?(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,d?(0,Q.jsx)(`p`,{className:`text-xs text-bad`,role:`alert`,"data-sw-agent-identity-error":!0,children:d}):null,(0,Q.jsx)(`button`,{type:`submit`,className:`hidden`,tabIndex:-1,"aria-hidden":`true`})]})})}var Rn=/\[\[([a-z]+):([^\]\n]{1,120})\]\]/g;function zn(e,t){let n=String(t||``).trim();return e===`comment`?/^#?\d{1,9}$/.test(n)?`comment #${n.replace(/^#/,``)}`:`comment ${n}`:e===`page`?`${n} page`:e===`journey`?`${n} journey`:e===`check`?`checks for ${n}`:n}function Bn(e,t=null){return String(e||``).replace(Rn,(e,n,r)=>t&&t(n,r)||zn(n,r))}function Vn(e,t=null){return Bn(e,t).replace(/^[^[\]]{0,120}\]\]/,``).replace(/\[\[[^\]]{0,120}$/,``).replace(/```[^\n]*\n?/g,``).replace(/!\[([^\]]*)\]\([^)]*\)/g,`$1`).replace(/\[([^\]]+)\]\([^)]*\)/g,`$1`).replace(/`([^`]*)`/g,`$1`).replace(/`/g,``).replace(/(\*\*|__)(.+?)\1/g,`$2`).replace(/(^|[\s(])[*_]([^*_\s][^*_]*?)[*_](?=[\s).,;:!?]|$)/g,`$1$2`).replace(/\*\*|__/g,``).replace(/~~(.+?)~~/g,`$1`).replace(/^[ \t]{0,3}#{1,6}[ \t]+/gm,``).replace(/^[ \t]{0,3}>[ \t]?/gm,``).replace(/^[ \t]*(?:[-*+]|\d+[.)])[ \t]+/gm,``).replace(/^[ \t]*\|?(?:\s*:?-{3,}:?\s*\|)+\s*:?-*:?\s*$/gm,``).replace(/[ \t]*\|[ \t]*/g,` `).replace(/[ \t]+/g,` `).trim()}var Hn={wrong:`Wrong`,ignored:`Didn't do what I asked`,slow:`Too slow`,unsafe:`Unsafe change`,other:`Other`},Un=[[`7`,`Last 7 days`],[`30`,`Last 30 days`],[`90`,`Last 90 days`],[`365`,`Last year`]],Wn=`__all__`,Gn=(e,t)=>t?`${Math.round(e/t*100)}%`:`–`;function Kn(e){let t=`shapewall-agent-feedback-${String(e.exportedAt||new Date().toISOString()).slice(0,10)}.json`;me(new Blob([JSON.stringify(e,null,2)],{type:`application/json`}),t)}function qn(e,t){let[n,r]=(0,Z.useState)({url:null,data:null,error:null}),[i,a]=(0,Z.useState)(0);return(0,Z.useEffect)(()=>{let n=!0;return e(t).then(e=>n&&r({url:t,data:e,error:null}),e=>n&&r(n=>({url:t,data:n.data,error:e}))),()=>{n=!1}},[t,i]),{...n,loading:n.url!==t,reload:()=>a(e=>e+1)}}function Jn({baseUrl:e,get:t,touch:n=!1,intro:r=null}){let[i,a]=(0,Z.useState)(`all`),[o,s]=(0,Z.useState)(`30`),[c,l]=(0,Z.useState)(Wn),[u,d]=(0,Z.useState)(!1),[f,m]=(0,Z.useState)(null),h=new URLSearchParams({days:o});i!==`all`&&h.set(`rating`,i),c!==Wn&&h.set(`board`,c);let g=qn(t,`${e}?${h}`),_=g.data,v=n?`touch`:`sm`;return(0,Q.jsxs)(`div`,{"data-sw-agent-feedback":!0,children:[(0,Q.jsx)(pe,{title:`Agent feedback`,description:`Thumbs up and down on chat answers, with the reasons and notes people gave. Use them to tune your agent's instructions.`,actions:(0,Q.jsxs)(p,{size:`touch`,variant:`secondary`,onClick:async()=>{d(!0),m(null);try{Kn(await t(`${e}/export`))}catch(e){m(e)}finally{d(!1)}},disabled:u,className:`lg:h-9`,"data-sw-agent-feedback-export":!0,children:[u?(0,Q.jsx)(D,{}):(0,Q.jsx)(Fe,{size:15,"aria-hidden":`true`}),` Export JSON`]})}),r,f?(0,Q.jsx)(`div`,{className:`mb-4`,children:(0,Q.jsx)(he,{error:f})}):null,(0,Q.jsxs)(`div`,{className:`mb-4 flex flex-wrap items-center gap-2`,"data-sw-agent-feedback-filters":!0,children:[(0,Q.jsx)(se,{label:`Rating`,large:n,value:i,onChange:a,options:[{id:`all`,label:`All`},{id:`up`,label:`Up`},{id:`down`,label:`Down`}]}),(0,Q.jsxs)(U,{value:o,onValueChange:s,children:[(0,Q.jsx)(F,{size:v,className:`w-40`,"aria-label":`Time range`,"data-sw-agent-feedback-range":!0,children:(0,Q.jsx)(N,{})}),(0,Q.jsx)(k,{children:Un.map(([e,t])=>(0,Q.jsx)(oe,{value:e,children:t},e))})]}),_?.boards?.length>1?(0,Q.jsxs)(U,{value:c,onValueChange:l,children:[(0,Q.jsx)(F,{size:v,className:`w-48`,"aria-label":`Board`,"data-sw-agent-feedback-board":!0,children:(0,Q.jsx)(N,{})}),(0,Q.jsxs)(k,{children:[(0,Q.jsx)(oe,{value:Wn,children:`All boards`}),_.boards.map(e=>(0,Q.jsx)(oe,{value:e.id,children:e.title},e.id))]})]}):null,g.loading&&_?(0,Q.jsx)(D,{}):null]}),!_&&g.loading?(0,Q.jsx)(Y,{children:(0,Q.jsx)(_e,{label:`Loading agent feedback`})}):g.error&&!_?(0,Q.jsx)(Y,{className:`p-4`,children:(0,Q.jsx)(be,{error:g.error,onRetry:g.reload})}):_?(0,Q.jsx)(Xn,{data:_}):null]})}function Yn({label:e,value:t,detail:n,icon:r}){return(0,Q.jsxs)(Y,{className:`p-4`,children:[(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-caption font-medium text-muted`,children:[r?(0,Q.jsx)(r,{size:13,"aria-hidden":`true`}):null,e]}),(0,Q.jsx)(`p`,{className:`mt-1 text-heading font-semibold text-fg tabular-nums`,children:t}),n?(0,Q.jsx)(`p`,{className:`text-caption text-muted`,children:n}):null]})}function Xn({data:e}){let{summary:t,items:n}=e,r=Object.entries(t.reasons||{}).filter(([,e])=>e>0).sort((e,t)=>t[1]-e[1]);return t.total?(0,Q.jsxs)(`div`,{className:`space-y-4`,children:[(0,Q.jsxs)(`div`,{className:`grid grid-cols-3 gap-2 sm:gap-3`,"data-sw-agent-feedback-totals":`${t.up}/${t.down}`,children:[(0,Q.jsx)(Yn,{label:`Ratings`,value:t.total,detail:`Last ${e.days} days`}),(0,Q.jsx)(Yn,{label:`Thumbs up`,icon:Tt,value:t.up,detail:Gn(t.up,t.total)}),(0,Q.jsx)(Yn,{label:`Thumbs down`,icon:Ct,value:t.down,detail:Gn(t.down,t.total)})]}),r.length?(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-1.5`,"data-sw-agent-feedback-reasons":!0,children:[(0,Q.jsx)(`span`,{className:`text-caption font-medium text-muted`,children:`Reasons given:`}),r.map(([e,t])=>(0,Q.jsxs)(O,{children:[Hn[e]||e,` `,(0,Q.jsx)(`span`,{className:`tabular-nums`,children:t})]},e))]}):null,(0,Q.jsxs)(`div`,{className:`grid gap-4 lg:grid-cols-2`,children:[(0,Q.jsx)(Qn,{title:`Per day`,rows:t.byDay.map(e=>({key:e.day,label:Zn(e.day),...e}))}),(0,Q.jsx)(Qn,{title:`Per agent`,rows:t.byAgent.map(e=>({key:e.agent,label:e.agent,...e}))})]}),(0,Q.jsxs)(Y,{"data-sw-agent-feedback-items":n.length,children:[(0,Q.jsx)(ye,{title:`Ratings`,description:e.more?`The newest ${n.length}; ${e.more} more in the export.`:`Newest first.`}),n.length?(0,Q.jsx)(`ul`,{className:`divide-y divide-line`,children:n.map(e=>(0,Q.jsx)($n,{item:e},`${e.boardId}/${e.threadId}/${e.messageId}/${e.rater}`))}):(0,Q.jsx)(`p`,{className:`px-4 py-6 text-sm text-muted sm:px-5`,children:`No ratings match these filters.`})]})]}):(0,Q.jsx)(Y,{children:(0,Q.jsx)(b,{icon:tt,title:`No feedback yet`,children:`When people rate the agent's answers in the board chat (thumbs up or down under an answer), the ratings show here.`})})}var Zn=e=>{let t=new Date(`${e}T12:00:00Z`);return Number.isNaN(t.getTime())?e:t.toLocaleDateString(void 0,{weekday:`short`,month:`short`,day:`numeric`})};function Qn({title:e,rows:t}){return(0,Q.jsxs)(Y,{children:[(0,Q.jsx)(ye,{title:e}),(0,Q.jsxs)(`table`,{className:`w-full text-ui`,children:[(0,Q.jsx)(`thead`,{children:(0,Q.jsxs)(`tr`,{className:`text-caption text-muted`,children:[(0,Q.jsx)(`th`,{scope:`col`,className:`px-4 py-2 text-left font-medium sm:px-5`,children:e===`Per day`?`Day`:`Agent`}),(0,Q.jsxs)(`th`,{scope:`col`,className:`px-2 py-2 text-right font-medium`,children:[(0,Q.jsx)(Tt,{size:13,"aria-hidden":`true`,className:`ml-auto`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Thumbs up`})]}),(0,Q.jsxs)(`th`,{scope:`col`,className:`px-4 py-2 text-right font-medium sm:px-5`,children:[(0,Q.jsx)(Ct,{size:13,"aria-hidden":`true`,className:`ml-auto`}),(0,Q.jsx)(`span`,{className:`sr-only`,children:`Thumbs down`})]})]})}),(0,Q.jsx)(`tbody`,{className:`divide-y divide-line`,children:t.slice(0,10).map(e=>(0,Q.jsxs)(`tr`,{children:[(0,Q.jsx)(`th`,{scope:`row`,className:`truncate px-4 py-2 text-left font-normal text-fg sm:px-5`,children:e.label}),(0,Q.jsx)(`td`,{className:`px-2 py-2 text-right text-fg tabular-nums`,children:e.up}),(0,Q.jsx)(`td`,{className:`px-4 py-2 text-right text-fg tabular-nums sm:px-5`,children:e.down})]},e.key))})]})]})}function $n({item:e}){let t=e.rating===`up`?Tt:Ct;return(0,Q.jsxs)(`li`,{className:`px-4 py-3 sm:px-5`,"data-sw-agent-feedback-item":e.rating,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-2 gap-y-1 text-caption text-muted`,children:[(0,Q.jsxs)(`span`,{className:`inline-flex items-center gap-1 font-medium text-fg`,children:[(0,Q.jsx)(t,{size:13,"aria-hidden":`true`}),e.rating===`up`?`Thumbs up`:`Thumbs down`]}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Q.jsx)(`span`,{children:e.raterName||`Someone`}),(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Q.jsx)(`span`,{children:e.agentName}),e.boardTitle?(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Q.jsx)(`span`,{children:e.boardTitle})]}):null,(0,Q.jsx)(`span`,{"aria-hidden":`true`,children:`·`}),(0,Q.jsx)(we,{value:e.updatedAt})]}),e.reasons?.length?(0,Q.jsx)(`div`,{className:`mt-1.5 flex flex-wrap gap-1`,children:e.reasons.map(e=>(0,Q.jsx)(O,{tone:`warn`,children:Hn[e]||e},e))}):null,e.note?(0,Q.jsx)(`p`,{className:`mt-1.5 text-sm break-words whitespace-pre-wrap text-fg`,children:e.note}):null,(0,Q.jsxs)(`dl`,{className:`mt-2 space-y-1 rounded-md bg-surface-2/60 px-2.5 py-2 text-ui`,children:[(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`dt`,{className:`w-16 shrink-0 text-muted`,children:`Question`}),(0,Q.jsx)(`dd`,{className:`min-w-0 break-words text-fg`,children:e.question||`(an image or an empty message)`})]}),(0,Q.jsxs)(`div`,{className:`flex gap-2`,children:[(0,Q.jsx)(`dt`,{className:`w-16 shrink-0 text-muted`,children:`Answer`}),(0,Q.jsx)(`dd`,{className:`line-clamp-3 min-w-0 break-words text-fg/90`,children:Vn(e.answer)||`(no text)`})]})]})]})}var er=new Set,tr=new Set,nr=null,rr=null,ir=2e3,ar=6e4;function or(e=`event`){for(let t of[...er])try{t(e)}catch{}}function sr(){document.visibilityState!==`visible`||rr||(rr=window.setTimeout(()=>{rr=null,or(`shown`),br(null)},50))}function cr(){return typeof document<`u`&&document.querySelector(`meta[name="shapewall-local-console"]`)?`/api/agent/events`:`api/agent/events`}var lr=null,ur=!1;function dr(e){let t=e===!0;t!==lr&&(lr=t,ur&&fr())}function fr(){pr(),lr!==!0||w||le||typeof window.fetch!=`function`||typeof window.TextDecoder!=`function`||Object.keys(d()).length&&(nr={controller:null,timer:null,delay:ir},gr(nr))}function pr(){nr&&(window.clearTimeout(nr.timer),nr.controller?.abort()),nr=null}function mr(){ur=!0,window.addEventListener(`focus`,sr),document.addEventListener(`visibilitychange`,sr),fr()}function hr(e){let t=`message`,n=``;for(let r of e.split(`
|
|
3
|
+
`))r.startsWith(`event:`)?t=r.slice(6).trim():r.startsWith(`data:`)&&(n+=r.slice(5).trim());if(t===`agents`&&or(`event`),t===`batch`)try{br(JSON.parse(n).board)}catch{}}async function gr(e){let t=new AbortController;e.controller=t;let n=Date.now(),r=!1;try{let e=await window.fetch(cr(),{headers:{Accept:`text/event-stream`,...d()},credentials:`same-origin`,cache:`no-store`,signal:t.signal});if(!e.ok||!e.body||!/text\/event-stream/.test(e.headers.get(`content-type`)||``)){r=e.status!==503;return}let n=e.body.getReader(),i=new window.TextDecoder,a=``;for(;;){let{value:e,done:t}=await n.read();if(t)break;a+=i.decode(e,{stream:!0}).replace(/\r\n?/g,`
|
|
4
|
+
`);let r;for(;(r=a.indexOf(`
|
|
5
|
+
|
|
6
|
+
`))>=0;)hr(a.slice(0,r)),a=a.slice(r+2)}}catch{}finally{nr===e&&!t.signal.aborted&&!r&&(e.delay=Date.now()-n>ar?ir:Math.min(e.delay*2,ar),e.timer=window.setTimeout(()=>nr===e&&gr(e),e.delay))}}function _r(){ur=!1,window.removeEventListener(`focus`,sr),document.removeEventListener(`visibilitychange`,sr),rr&&window.clearTimeout(rr),rr=null,pr()}var vr=()=>er.size+tr.size;function yr(e){return typeof window>`u`?()=>{}:(er.add(e),vr()===1&&mr(),()=>{er.delete(e)&&vr()===0&&_r()})}function br(e){for(let t of[...tr])try{t(e)}catch{}}function xr(e,t=!0){let n=(0,Z.useRef)(e);n.current=e,(0,Z.useEffect)(()=>{if(t)return yr(e=>n.current?.(e))},[t])}function Sr({label:e,state:t=`ready`,size:n=`md`,icon:r=null,tint:i=null,logo:a=null,className:s}){return(0,Q.jsxs)(`span`,{className:o(`relative inline-flex shrink-0`,s),"aria-hidden":`true`,children:[(0,Q.jsx)(A,{label:e,icon:r,tint:i,logo:a,size:n===`sm`?`sm`:`md`}),(0,Q.jsx)(`span`,{className:o(`absolute -right-0.5 -bottom-0.5 rounded-full ring-2 ring-surface`,n===`sm`?`h-1.5 w-1.5`:`h-2 w-2`,W[t]||W.ready)})]})}var Cr=`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 wr(){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`}),`.`]})}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 Tr(e,t){return JSON.stringify(e)===JSON.stringify(t)}function Er({view:e,form:t,next:n}){let r=e?!Tr(t,$(e)):!1,i=$(n);return r?{view:n,form:t,stale:!Tr($(e),i)&&!Tr(t,i)}:{view:n,form:i,stale:!1}}var Dr=/^(SHAPEWALL_AGENT_[A-Z0-9_]+|[A-Z][A-Z0-9_]*_API_KEY)$/,Or=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`]),kr=[{id:`openai-compatible`,label:`OpenAI-compatible`},{id:`acp`,label:`ACP agent`}],Ar=[{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 jr(e){return e&&(!Dr.test(e)||Or.has(e))?`Use SHAPEWALL_AGENT_API_KEY or a name ending in _API_KEY (never another tool’s token).`:null}function Mr(e){try{let t=new URL(e);return[`http:`,`https:`].includes(t.protocol)?t.host.toLowerCase():null}catch{return null}}function Nr({onSaved:e,touch:t,buzz:i=!1,onDirtyChange:a,agents:s=`inline`}){let[c,l]=(0,Z.useState)(null),[d,f]=(0,Z.useState)(null),[m,h]=(0,Z.useState)($(null)),[g,v]=(0,Z.useState)(!1),[y,b]=(0,Z.useState)(null),[x,S]=(0,Z.useState)(!1),[C,w]=(0,Z.useState)(null),[T,te]=(0,Z.useState)(!1),[ne,E]=(0,Z.useState)(null),[re,k]=(0,Z.useState)(!1),A=g||re,[j,M]=(0,Z.useState)(!1),N=(0,Z.useRef)(0),P=(0,Z.useRef)(0),F=(0,Z.useRef)(!1),I=(0,Z.useRef)({view:null,form:null}),ie=(0,Z.useRef)(null),L=(0,Z.useCallback)(async()=>{let e=++N.current;P.current+=1;try{let t=await r.get(`/api/agent/settings`);if(e!==N.current)return;l(t),h($(t)),M(!1),f(null),I.current={view:t,form:$(t)}}catch(t){if(e!==N.current)return;t.status===404&&ee(),f(t.status===404?Cr:t.message)}finally{--P.current,!P.current&&F.current&&(F.current=!1,ie.current?.())}},[]);(0,Z.useEffect)(()=>{L()},[L]),ie.current=async()=>{if(A||!I.current.view||d)return;if(P.current){F.current=!0;return}let e=N.current,t;try{t=await r.get(`/api/agent/settings`)}catch{return}if(e!==N.current||P.current||!I.current.view)return;let n=Er({view:I.current.view,form:I.current.form,next:t});l(n.view),h(n.form),n.stale&&M(!0)},xr(()=>ie.current?.());let R=e=>t=>{let n=typeof t==`string`?t:t.target.value;h(t=>({...t,[e]:n})),S(!1)};I.current={view:c,form:m};let z=c?!Tr(m,$(c)):!1;(0,Z.useEffect)(()=>{z||M(!1)},[z]),(0,Z.useEffect)(()=>(a?.(z),()=>a?.(!1)),[z,a]);let oe=()=>{h($(c)),b(null),S(!1)},V=c?.config||{},H=c?.effective||{},U=m.backend===`acp`,W=m.apiKeyEnv.trim()||V.apiKeyEnv||c?.defaultKeyVar||`SHAPEWALL_AGENT_API_KEY`,G=jr(m.apiKeyEnv.trim()),K=!!c?.keyVarsSet?.includes(W),ce=c?.env?.baseUrl?H.baseUrl:m.baseUrl.trim()||V.baseUrl||``,J=Mr(ce),le=m.baseUrl.trim()&&!Mr(m.baseUrl.trim())?`An http(s) URL, such as https://api.deepseek.com`:null,ue=!K&&!m.apiKeyEnv.trim()&&!V.apiKeyEnv&&/^http:/i.test(ce),de=!!c?.env?.acp,fe=(0,Z.useMemo)(()=>({backend:m.backend,baseUrl:m.baseUrl.trim()||null,model:m.model.trim()||null,apiKeyEnv:m.apiKeyEnv.trim()||null,label:m.label.trim()||null,acpCommand:m.acpCommand.trim()||null,keyHosts:m.keyHosts,vision:m.vision}),[m]),pe=async(t=null)=>{v(!0),b(null);try{let n=await r.post(`/api/agent/settings`,{settings:fe,confirm:t});if(n.demoNote){w(null),E({note:n.demoNote});return}if(n.confirm){w({items:n.confirm,hash:n.confirmHash});return}N.current+=1,l(n),h($(n)),w(null),S(!0),E(null),e?.()}catch(e){w(null),b(e.message)}finally{v(!1)}},Y=async()=>{te(!0),E(null);try{let e=await r.post(`/api/agent/settings/test`,{});E(e),typeof e.vision==`boolean`&&e.vision!==(m.vision??!0)&&h(t=>({...t,vision:e.vision}))}catch(e){E({ok:!1,message:e.message,details:[]})}finally{te(!1)}};if(d)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:d===`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)(wr,{}):`Could not load the agent settings: ${d}`}),d===`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)(p,{size:t?`touch`:`sm`,onClick:()=>{f(null),L()},children:`Try again`})]});if(!c)return(0,Q.jsxs)(`div`,{className:`flex items-center gap-2 p-5 text-sm text-muted`,children:[(0,Q.jsx)(D,{}),` Loading`]});if(c.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:c.message}),(0,Q.jsx)(`dl`,{className:`space-y-2 text-sm text-fg`,children:[[`Agent`,H.label],[`Backend`,H.backend],[`Command`,H.acpCommand],[`Model`,H.model],[`Endpoint`,H.baseUrl],[`Key variable`,H.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 X=t?`touch`:`sm`,me=e=>H.sources?.[e]===`config`?`from shapewall.config.json`:null,he=(e,t)=>V[e]?`${V[e]} (${me(e)||`from the config`})`:t;return(0,Q.jsxs)(`div`,{className:`space-y-5`,"data-sw-settings":`agent`,children:[s===`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.`,i?` Buzz conversations are separate.`:``]})]}),(0,Q.jsx)(Hr,{view:c,disabled:z||g||T,touch:t,onBusy:k,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]}):s===`link`?(0,Q.jsx)(Fr,{view:c,touch:t}):null,c.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:c.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,j?(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)(ae,{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)(p,{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":H.configured?`connected`:`not-connected`,children:[(0,Q.jsx)(u,{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:H.configured?(0,Q.jsxs)(Q.Fragment,{children:[`Chat uses `,H.label||`the agent`,H.backend===`acp`?` over ACP, on this machine`:H.host?` at ${H.host}`:``]}):`Chat is not connected yet`}),H.problem?(0,Q.jsx)(`p`,{className:`text-bad`,children:H.problem}):null]}),(0,Q.jsx)(O,{tone:H.configured?`ok`:`warn`,children:H.configured?H.backend===`acp`?`Command set`:`Connected`:`Not connected`})]}),de?(0,Q.jsxs)(`div`,{className:`space-y-1.5`,"data-sw-settings-acp-override":c.env.acp,children:[(0,Q.jsxs)(wn,{children:[`The agent command comes from`,` `,c.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)(q,{id:`sw-agent-acp-in-use`,size:X,value:H.acpCommand||``,readOnly:!0,className:`font-mono`,"data-sw-settings-acp-in-use":`true`})]}):null,c.fileProblem?(0,Q.jsx)(`p`,{className:`text-xs text-bad`,children:c.fileProblem}):null,(0,Q.jsx)(Sn,{label:`Connect to`,children:(0,Q.jsx)(se,{label:`Connect to`,options:kr,value:m.backend,onChange:e=>{R(`backend`)(e),E(null)},large:t,disabled:A,className:`max-w-sm`})}),U?(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)(ge,{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)(Sn,{label:de?`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)(q,{id:`sw-agent-acp`,size:X,value:m.acpCommand,onChange:R(`acpCommand`),placeholder:`claude-agent-acp`,disabled:A,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:Ar.map(e=>(0,Q.jsx)(p,{size:t?`touch`:`xs`,variant:m.acpCommand.trim()===e.command?`default`:`secondary`,disabled:A,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)(Sn,{label:`Base URL`,htmlFor:`sw-agent-url`,problem:le,hint:`The chat completions endpoint without /chat/completions, such as https://api.deepseek.com or https://api.openai.com/v1.`,children:[(0,Q.jsx)(q,{id:`sw-agent-url`,size:X,value:m.baseUrl,onChange:R(`baseUrl`),placeholder:he(`baseUrl`,`https://api.deepseek.com`),inputMode:`url`,spellCheck:!1,autoCapitalize:`off`,autoComplete:`off`,disabled:c.env.baseUrl||A,"aria-invalid":le?!0:void 0,"aria-describedby":le?`sw-agent-url-problem`:void 0,"data-sw-settings-field":`baseUrl`}),c.env.baseUrl?(0,Q.jsx)(wn,{children:`SHAPEWALL_AGENT_BASE_URL is set in the environment and wins over this field.`}):null]}),(0,Q.jsxs)(Sn,{label:`Model`,htmlFor:`sw-agent-model`,children:[(0,Q.jsx)(q,{id:`sw-agent-model`,size:X,value:m.model,onChange:R(`model`),placeholder:he(`model`,`deepseek-chat`),spellCheck:!1,autoCapitalize:`off`,autoComplete:`off`,disabled:c.env.model||A,"data-sw-settings-field":`model`}),c.env.model?(0,Q.jsx)(wn,{children:`SHAPEWALL_AGENT_MODEL is set in the environment and wins over this field.`}):null]}),(0,Q.jsx)(Sn,{label:`API key variable`,htmlFor:`sw-agent-keyvar`,problem:G,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)(q,{id:`sw-agent-keyvar`,size:X,value:m.apiKeyEnv,onChange:e=>R(`apiKeyEnv`)(e.target.value.toUpperCase()),placeholder:V.apiKeyEnv||c.defaultKeyVar,spellCheck:!1,autoCapitalize:`characters`,autoComplete:`off`,disabled:A,className:`font-mono`,"aria-invalid":G?!0:void 0,"aria-describedby":G?`sw-agent-keyvar-problem`:void 0,"data-sw-settings-field":`apiKeyEnv`}),ue?null:(0,Q.jsx)(O,{tone:K?`ok`:`warn`,"data-sw-settings-key":K?`set`:`missing`,children:K?`Set`:`Not set`})]})}),(0,Q.jsxs)(`div`,{className:`space-y-1`,"data-sw-settings-host":J||`none`,children:[(0,Q.jsxs)(`p`,{className:`flex items-center gap-1.5 text-xs font-medium text-fg`,children:[(0,Q.jsx)(pt,{size:13,"aria-hidden":`true`}),` Where the key goes`]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted`,children:J?K?(0,Q.jsxs)(Q.Fragment,{children:[`Each chat request sends the key in `,(0,Q.jsx)(`code`,{className:`font-mono`,children:W}),` to`,` `,(0,Q.jsx)(`span`,{className:`font-medium text-fg`,"data-sw-settings-key-host":`true`,children:J}),`, and nowhere else.`]}):ue?(0,Q.jsxs)(Q.Fragment,{children:[`Requests go to `,(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:J}),`, without a key.`]}):(0,Q.jsxs)(Q.Fragment,{children:[`Requests go to `,(0,Q.jsx)(`span`,{className:`font-medium text-fg`,children:J}),`, without a key until`,` `,(0,Q.jsx)(`code`,{className:`font-mono`,children:W}),` is set.`]}):`Set a base URL to see where requests go.`})]}),ue?(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)(Ee,{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)(Cn,{text:`export ${W}="paste-your-key-here"`,label:`shell`,touch:t}),(0,Q.jsx)(Cn,{text:`$env:${W} = "paste-your-key-here"`,label:`PowerShell`,touch:t})]}),m.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:m.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)(p,{variant:`ghost`,size:t?`icon`:`icon-xs`,disabled:A,onClick:()=>h(t=>({...t,keyHosts:t.keyHosts.filter(t=>t!==e)})),"aria-label":`Stop sending ${e.apiKeyEnv} to ${e.host}`,children:(0,Q.jsx)(n,{size:12,"aria-hidden":`true`})})]},`${e.apiKeyEnv}@${e.host}`))})]}):null]}),(0,Q.jsxs)(`div`,{className:`space-y-1`,"data-sw-settings-vision":m.vision===null?`auto`:String(m.vision),children:[(0,Q.jsxs)(B,{size:X,pressed:m.vision??(!U||H.vision!==!1),disabled:A,onPressedChange:e=>{h(t=>({...t,vision:e})),S(!1)},"data-sw-settings-field":`vision`,children:[m.vision??(!U||H.vision!==!1)?(0,Q.jsx)(_,{size:13,"aria-hidden":`true`}):null,`This model takes images`]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted`,children:m.vision===!1?`Images are not sent; the chat says so when one is attached.`:U&&m.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)(Sn,{label:`Name in the chat panel (optional)`,htmlFor:`sw-agent-label`,children:(0,Q.jsx)(q,{id:`sw-agent-label`,size:X,value:m.label,onChange:R(`label`),placeholder:V.label||(U?`the agent’s name`:`the model name`),maxLength:40,disabled:A,"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:c.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.`]}),y?(0,Q.jsx)(`p`,{className:`text-xs text-bad`,role:`alert`,"data-sw-settings-error":`save`,children:y}):null,(0,Q.jsx)(En,{result:ne}),(0,Q.jsxs)(`div`,{className:o(`flex flex-wrap items-center gap-2`,t&&`flex-col-reverse items-stretch`),children:[(0,Q.jsxs)(p,{size:X,onClick:Y,disabled:T||g||z,"data-sw-settings-test":`true`,children:[T?(0,Q.jsx)(D,{}):(0,Q.jsx)(pt,{size:14,"aria-hidden":`true`}),` `,T?`Testing...`:`Test connection`]}),z?(0,Q.jsx)(`span`,{className:`text-xs text-muted`,children:`Save to test these settings.`}):null,x&&!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)(p,{size:X,variant:`ghost`,className:o(!t&&`ml-auto`),onClick:oe,disabled:g,"data-sw-settings-discard":`true`,children:`Discard changes`}):null,(0,Q.jsx)(p,{size:X,variant:`default`,className:o(!t&&!z&&`ml-auto`),onClick:()=>pe(null),disabled:g||!z||!!G||!!le,"data-sw-settings-save":`true`,children:g?`Saving...`:`Save`})]}),(0,Q.jsx)(Tn,{items:C?.items||null,keyVar:W,busy:g,touch:t,onCancel:()=>w(null),onConfirm:()=>pe(C?.hash||null)})]})}var Pr=`/console?section=agents`;function Fr({view:e,touch:t}){let n=e.profiles||[],r=n.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)(u,{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:[n.length?`${n.map(e=>e.label).join(`, `)} connected${r?`. New chats and fixes use ${r.label}`:``}.`:`No agent connected yet.`,` `,`Connect, remove and choose the default on the Agents page of the Workspace Console.`]})]}),(0,Q.jsx)(p,{asChild:!0,size:t?`touch`:`sm`,children:(0,Q.jsx)(`a`,{href:Pr,"data-sw-agents-open":!0,children:`Manage agents`})})]})}var Ir=`https://shapewall.com/docs/chat`;function Lr(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}var Rr={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`}},zr=`In the demo nothing runs on a computer. On your install this looks for the agent again.`,Br={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 Vr({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 Hr({view:e=null,disabled:t=!1,touch:n=!1,onBusy:i=null,onChanged:a=null,endpointForm:s=null,onOpenEndpoint:c=null,agent:l=null}){let[d,f]=(0,Z.useState)(null),[h,g]=(0,Z.useState)(null),[_,v]=(0,Z.useState)(null),[y,b]=(0,Z.useState)(null),[x,S]=(0,Z.useState)(null),[C,w]=(0,Z.useState)({}),[T,te]=(0,Z.useState)(!1),[ne,E]=(0,Z.useState)(null),[k,A]=(0,Z.useState)(kn());(0,Z.useEffect)(()=>i?.(!!y),[y,i]);let j=(0,Z.useCallback)(async()=>{if(l&&!l.settingsEditable)g(l.settingsReadonly?`Change agents on the computer running Shapewall.`:`owner`),v(l);else try{let e=await r.get(`/api/agent/settings`);if(e.editable===!1){g(e.message||`owner`),v(await r.get(`/api/agent/status`).catch(()=>null));return}f(e),g(null)}catch(e){e.status===404&&ee(),g(e.status===404?`owner`:e.message),v(await r.get(`/api/agent/status`).catch(()=>null))}},[l]);(0,Z.useEffect)(()=>{e||j()},[e,j]),xr(()=>{y||j()},!e);let M=e||d,N=!!M?.testing;(0,Z.useEffect)(()=>{if(!N||e||y)return;let t=window.setInterval(j,1500);return()=>window.clearInterval(t)},[N,e,y,j]);let P=async t=>{t&&!e?f(t):e||await j(),await a?.()},F=(e,t)=>t?.demoNote?(S(null),w(n=>({...n,[e]:{note:t.demoNote}})),!0):!1,ie=async(e,t=null)=>{b(e),w(t=>({...t,[e]:null}));try{let n=t?{name:k.name.trim(),...k.icon&&!k.png?{icon:k.icon}:{},...k.tint?{tint:k.tint}:{}}:{},i=await r.post(`/api/agent/settings/profiles/connect`,{agentId:e,confirm:t,...n});if(F(e,i))return;if(i.confirm){A(kn({label:V.find(t=>t.id===e)?.label||``})),S({agentId:e,items:i.confirm,hash:i.confirmHash});return}if(S(null),i.connected&&t&&k.png){let t=await jn(e,{},{...k,name:``,tint:null}).catch(()=>null);t&&(i={...i,...t})}w(t=>({...t,[e]:i.result})),i.connected&&await P(i)}catch(t){S(null),w(n=>({...n,[e]:{ok:!1,message:t.message,details:[]}}))}finally{b(null)}},L=async e=>{b(e);try{let t=await r.delete(`/api/agent/settings/profiles/${encodeURIComponent(e)}`);if(F(e,t))return;await P(t),w(t=>({...t,[e]:null}))}catch(t){w(n=>({...n,[e]:{ok:!1,message:t.message,details:[]}}))}finally{b(null)}},R=async(t,n=!1)=>{b(t),w(e=>({...e,[t]:null}));try{let i=await r.post(`/api/agent/settings/test`,n?{}:{profileId:t});if(F(t,i))return;w(e=>({...e,[t]:i})),e||await j()}catch(e){w(n=>({...n,[t]:{ok:!1,message:e.message,details:[]}}))}finally{b(null)}},z=async e=>{b(`default:${e}`);try{let t=await r.post(`/api/agent/settings/profiles/${encodeURIComponent(e)}/default`,{});if(F(`default`,t))return;await P(t)}catch(e){w(t=>({...t,default:{ok:!1,message:e.message,details:[]}}))}finally{b(null)}},B=n?`touch`:`sm`;if(h)return(0,Q.jsx)(Ur,{locked:h,status:_});if(!M)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)(D,{}),` Looking for agents on this machine`]});let oe=!!M.env?.acp,V=Lr(M),se=[...V.filter(e=>e.kind===`connected`).map(e=>({id:e.id,label:e.label,state:e.profile.state,isDefault:e.profile.default,...I(e.profile),logo:e.logo})),...M.endpoint?[{id:`endpoint`,label:M.endpoint.label,state:M.endpoint.state,isDefault:M.endpoint.default,...I(M.endpoint)}]:[]],H=M.testing||null,U=H?V.find(e=>e.id===H.id)?.label||M.effective?.label||`the agent`:null,W=H?`Testing the connection to ${U}. This is available when the test finishes.`:void 0,G=!!y||t||oe||!!H,K=!!y||t,q=x?V.find(e=>e.id===x.agentId):null,J=oe&&M.effective?.configured?{id:`default`,label:M.effective.label,...I(M.effective)}:null;return(0,Q.jsxs)(`div`,{className:`space-y-6`,"data-sw-agents-card":M.demo?`demo`:`editable`,"data-sw-native-profiles":!0,children:[M.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)(u,{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,H&&!y?(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":H.id,children:[(0,Q.jsx)(D,{size:12}),(0,Q.jsxs)(`span`,{children:[`Testing the connection to `,U,`. Connect, Test connection, Remove and the default wait for it; a name or an icon can be changed meanwhile.`]})]}):null,oe?(0,Q.jsxs)(`p`,{className:`flex items-start gap-1.5 text-xs text-fg`,"data-sw-agents-override":!0,children:[(0,Q.jsx)(ge,{size:13,className:`mt-px shrink-0 text-warn`,"aria-hidden":`true`}),(0,Q.jsxs)(`span`,{children:[`The agent command comes from `,M.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,se.length?(0,Q.jsxs)(Vr,{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:se.map(e=>(0,Q.jsxs)(`label`,{className:o(`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`,G&&`cursor-default opacity-70`),title:W,"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:G,onChange:()=>z(e.id)}),e.id===`endpoint`&&!e.icon&&!e.tint?(0,Q.jsx)(Ue,{size:16,className:`shrink-0 text-muted`,"aria-hidden":`true`}):(0,Q.jsx)(Sr,{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}),y===`default:${e.id}`?(0,Q.jsx)(D,{size:12}):null,e.isDefault?(0,Q.jsx)(O,{tone:`accent`,children:`Default`}):null]},e.id))}),C.default?(0,Q.jsx)(En,{result:C.default}):null]}):null,(0,Q.jsx)(Vr,{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:[J?(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)(Sr,{label:J.label,state:M.effective.problem?`unavailable`:`ready`,...I(J)}),(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:[J.label,` `,(0,Q.jsx)(O,{tone:`accent`,children:`Default`})]}),(0,Q.jsxs)(`p`,{className:`text-xs text-muted`,children:[`Started from `,M.env.acp===`flag`?`--agent-acp`:`SHAPEWALL_AGENT_ACP`]})]}),(0,Q.jsxs)(p,{size:B,disabled:K,onClick:()=>E({...J,builtIn:M.effective.builtInLabel||J.label}),"aria-label":`Edit ${J.label}: name and icon`,"data-sw-agent-edit":`default`,children:[(0,Q.jsx)(dt,{size:13,"aria-hidden":`true`}),` Edit`]})]})}):null,V.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)(Sr,{label:e.label,state:e.kind===`connected`?e.profile.state:`unavailable`,...I(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)(O,{tone:`accent`,children:`Default`}):null]}),(0,Q.jsx)(`p`,{className:o(`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. ${ce(e.profile)}`:Br[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)(p,{size:B,disabled:G,title:W,onClick:()=>R(e.id,e.profile.legacy),"data-sw-agent-test":e.id,children:[y===e.id?(0,Q.jsx)(D,{}):null,` Test connection`]}),(0,Q.jsxs)(p,{size:B,disabled:K,onClick:()=>E({id:e.id,label:e.label,...I(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)(dt,{size:13,"aria-hidden":`true`}),` Edit`]}),(0,Q.jsxs)(p,{size:B,variant:`danger`,disabled:G,title:W,onClick:()=>L(e.id),"data-sw-agent-remove":e.id,children:[(0,Q.jsx)(Dt,{size:13,"aria-hidden":`true`}),` Remove`]})]}):e.kind===`found`?(0,Q.jsxs)(p,{size:B,variant:`default`,disabled:G,title:W,onClick:()=>ie(e.id),"data-sw-profile-connect":e.id,"data-sw-agent-connect-row":e.id,children:[y===e.id?(0,Q.jsx)(D,{}):(0,Q.jsx)(pt,{size:13,"aria-hidden":`true`}),` `,y===e.id?`Connecting...`:`Connect`]}):e.kind===`needs-adapter`||e.kind===`missing`?(0,Q.jsxs)(p,{size:B,variant:`ghost`,disabled:!!y,onClick:()=>M.demo?F(e.id,{demoNote:zr}):P(),"data-sw-agent-check":e.id,children:[(0,Q.jsx)(ae,{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:[re(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)(Cn,{text:e.install,label:`${e.label} install`,touch:n})]}):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:[Rr[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:`${Ir}#${Rr[e.id]?.anchor||`connect-an-agent-cli-over-acp`}`,target:`_blank`,rel:`noreferrer`,children:[`How to set it up `,(0,Q.jsx)(Le,{size:11,"aria-hidden":`true`})]})]}):null,(0,Q.jsx)(En,{result:C[e.id]})]},e.id)),(0,Q.jsxs)(`li`,{className:`space-y-2 p-3`,"data-sw-agent-row":`endpoint`,"data-sw-agent-row-state":M.endpoint?`connected`:`none`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap items-center gap-x-3 gap-y-2`,children:[M.endpoint?.icon||M.endpoint?.tint?(0,Q.jsx)(Sr,{label:M.endpoint.label,state:M.endpoint.state||`ready`,...I(M.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)(Ue,{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`,M.endpoint?.default?(0,Q.jsx)(O,{tone:`accent`,children:`Default`}):null]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted`,children:M.endpoint?`${M.endpoint.label}${M.endpoint.host?` at ${M.endpoint.host}`:``}`:`An OpenAI-compatible endpoint: OpenAI, DeepSeek, OpenRouter, Ollama, LM Studio.`})]}),(0,Q.jsxs)(`div`,{className:`flex flex-wrap gap-1.5`,children:[M.endpoint?.default?(0,Q.jsxs)(p,{size:B,disabled:G,onClick:()=>R(`endpoint`,!0),"data-sw-agent-test":`endpoint`,children:[y===`endpoint`?(0,Q.jsx)(D,{}):null,` Test connection`]}):null,M.endpoint?(0,Q.jsxs)(p,{size:B,disabled:K,onClick:()=>E({id:`endpoint`,label:M.endpoint.label,...I(M.endpoint),builtIn:M.endpoint.model}),"aria-label":`Name and icon of ${M.endpoint.label}`,"data-sw-agent-edit":`endpoint`,children:[(0,Q.jsx)(dt,{size:13,"aria-hidden":`true`}),` Name and icon`]}):null,s||c?(0,Q.jsx)(p,{size:B,disabled:!!y||t,onClick:()=>c?c():te(!0),"data-sw-agent-endpoint":!0,children:M.endpoint?`Edit`:`Set up`}):null]})]}),(0,Q.jsx)(En,{result:C.endpoint})]})]})}),(0,Q.jsx)(Tn,{items:x?.items||null,keyVar:``,busy:!!y,touch:n,onCancel:()=>S(null),onConfirm:()=>ie(x.agentId,x.hash),confirmLabel:`Allow and connect`,blocked:!!Fn(k.name),children:(0,Q.jsx)(In,{value:k,onChange:A,builtIn:q?.builtIn||q?.label||``,logo:q?.logo,upload:M.iconUpload!==!1,touch:n,disabled:!!y})}),(0,Q.jsx)(Ln,{agent:ne,waiting:!!(H&&ne&&(H.id===ne.id||ne.id==="default"&&H.id==="default")),upload:M.iconUpload!==!1,touch:n,onClose:()=>E(null),onSaved:e=>e?P(e):null}),s?(0,Q.jsx)(m,{open:T,onClose:()=>{te(!1),P()},title:`Other agent settings`,size:`md`,children:(0,Q.jsx)(`div`,{className:`p-5`,children:T?s({onSaved:()=>P()}):null})}):null]})}function Ur({locked:e,status:t}){let{options:n}=J({profileId:`default`,profiles:t?.profiles||[]}),r=n.length?n:t?.configured?[{id:`default`,label:t.label||`Agent`,state:t.state||`ready`,isDefault:!0,configured:!0,...I(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)(Ce,{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})]}),r.length?(0,Q.jsx)(`ul`,{className:`divide-y divide-line rounded-md border border-line`,"aria-label":`Connected agents`,children:r.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)(Sr,{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)(O,{tone:`accent`,children:`Default`}):null]}),(0,Q.jsx)(`p`,{className:`text-xs text-muted`,children:ce(e)})]})]},e.id))}):(0,Q.jsx)(`p`,{className:`text-xs text-muted`,children:`No agent is connected.`})]})}function Wr({info:e,boardCount:t,touch:n,onOpenUpdates:r}){let[i,a]=xe();return(0,Q.jsxs)(`div`,{className:`space-y-6`,"data-sw-settings":`general`,children:[(0,Q.jsxs)(`section`,{className:`space-y-3`,"aria-labelledby":`sw-general-appearance`,children:[(0,Q.jsxs)(`div`,{children:[(0,Q.jsx)(`h2`,{id:`sw-general-appearance`,className:`text-sm font-semibold text-fg`,children:`Appearance`}),(0,Q.jsx)(`p`,{className:`mt-1 text-xs text-muted`,children:`Saved in this browser and shared with your other Shapewall tabs.`})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,"data-sw-settings-mode":!0,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:`Mode`}),(0,Q.jsx)(se,{value:i.mode,onChange:e=>a({mode:e}),options:Se,label:`Appearance mode`,large:n})]}),(0,Q.jsxs)(`div`,{className:`space-y-1.5`,"data-sw-settings-theme":!0,children:[(0,Q.jsx)(`p`,{className:`text-xs font-medium text-fg`,children:`Theme`}),(0,Q.jsx)(se,{value:i.theme,onChange:e=>a({theme:e}),options:ve,label:`Appearance theme`,large:n,className:`grid grid-cols-2 sm:flex`})]})]}),(0,Q.jsxs)(`section`,{className:`space-y-2`,"aria-labelledby":`sw-general-installation`,children:[(0,Q.jsx)(`h2`,{id:`sw-general-installation`,className:`text-sm font-semibold text-fg`,children:`This installation`}),(0,Q.jsxs)(`dl`,{className:`space-y-1 text-xs`,children:[(0,Q.jsxs)(`div`,{className:`flex flex-wrap justify-between gap-x-4 gap-y-1`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Name`}),(0,Q.jsx)(`dd`,{className:`min-w-0 break-words text-fg`,children:e?.title||`Shapewall`})]}),(0,Q.jsxs)(`div`,{className:`flex justify-between gap-4`,children:[(0,Q.jsx)(`dt`,{className:`text-muted`,children:`Boards`}),(0,Q.jsx)(`dd`,{className:`text-fg`,children:t})]})]}),(0,Q.jsx)(p,{size:n?`touch`:`md`,className:`mt-2`,onClick:r,"data-sw-settings-updates":!0,children:`About & Updates`})]})]})}function Gr({info:e,onSaved:t,touch:n,onDirtyChange:r,agentsHome:i=!1}){return e?.agent?.settingsEditable||e?.agent?.settingsReadonly?(0,Q.jsx)(Nr,{onSaved:t,touch:n,buzz:!!e?.buzzAvailable,onDirtyChange:r,agents:i?`none`:`link`}):(0,Q.jsxs)(`div`,{className:`space-y-2 text-sm`,"data-sw-settings-agent-unavailable":!0,children:[(0,Q.jsx)(`h2`,{className:`font-semibold text-fg`,children:`Agent settings`}),(0,Q.jsx)(`p`,{className:`text-muted`,children:e?.agent?.settingsLocked?(0,Q.jsx)(wr,{}):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.`})]})}var Kr=`/api/agent/settings/branch-mode`;function qr({on:e,onChange:t,disabled:n,labelledBy:r,touch:i=!1,...a}){return(0,Q.jsx)(`button`,{type:`button`,role:`switch`,"aria-checked":e,"aria-labelledby":r,disabled:n,onClick:()=>t(!e),className:o(`relative inline-flex shrink-0 items-center justify-center rounded-full focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-accent disabled:opacity-50`,i?`h-11 w-14`:`h-6 w-10`),...a,children:(0,Q.jsx)(`span`,{"aria-hidden":`true`,className:o(`relative inline-flex items-center rounded-full border transition-colors`,i?`h-7 w-12`:`h-5 w-9`,e?`border-accent bg-accent`:`border-line-strong bg-surface-2`),children:(0,Q.jsx)(`span`,{className:o(`absolute rounded-full bg-white shadow-card transition-transform duration-(--motion-fast)`,i?`size-5`:`size-3.5`,e?i?`translate-x-6`:`translate-x-4.5`:`translate-x-0.5`)})})})}function Jr(){let[e,t]=(0,Z.useState)(null),[n,i]=(0,Z.useState)(``),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(null),[l,u]=(0,Z.useState)([]),d=(0,Z.useRef)(!1),f=(0,Z.useRef)(!0),p=(0,Z.useCallback)(async()=>{try{let e=await r.get(Kr);if(!f.current)return;t(e),d.current||i(e?.prefix||``)}catch{f.current&&t(null)}r.get(`/api/agent/branches`).then(e=>f.current&&u(Array.isArray(e?.branches)?e.branches:[])).catch(()=>{})},[]);return(0,Z.useEffect)(()=>(f.current=!0,p(),()=>{f.current=!1}),[p]),xr(()=>{a||p()}),{state:e,prefix:n,setPrefix:i,busy:a,error:s,branches:l,save:async n=>{o(!0),c(null);try{let e=await r.post(Kr,n);t(e),i(e?.prefix||``)}catch(t){c(t.message||`Not saved.`),i(e?.prefix||``)}finally{o(!1)}},editing:d}}function Yr({mode:e,disabled:t,className:n,touch:r,...i}){let{state:a,prefix:s,setPrefix:c,save:l,editing:u}=e;return(0,Q.jsx)(q,{value:s,onChange:e=>c(e.target.value),onFocus:()=>{u.current=!0},onBlur:()=>{u.current=!1,s!==a.prefix&&l({enabled:!!a.enabled,prefix:s||a.defaultPrefix})},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},disabled:t||a.sources?.prefix===`env`,placeholder:a.defaultPrefix,maxLength:40,spellCheck:!1,size:r?`touch`:`sm`,className:o(`min-w-0 font-mono`,n),...i})}var Xr=(e,t)=>`${t?`Fixes and chat turns run in a separate folder and are committed on a branch. Your checkout changes only when you apply one. Uncommitted changes in your checkout are not carried over.`:`Off: the agent edits your checkout directly.`}${t&&!e.acp?` It applies to a coding agent connected over ACP; this agent edits the checkout as before.`:``}${e.sources?.enabled===`env`?` Set by SHAPEWALL_AGENT_BRANCH_MODE.`:``}`;function Zr({state:e,className:t}){let n=Array.isArray(e.filters)?e.filters.slice(0,4):[];if(!n.length)return null;let r=n.includes(`lfs`);return(0,Q.jsxs)(`p`,{className:o(`text-warn`,t),"data-sw-branch-mode-filters":n.join(` `),children:[`This repository uses `,r?`Git LFS`:`the Git filter ${n.join(`, `)}`,`. On a branch, the agent sees those files as Git stores them`,r?` (small pointer files)`:``,`, not as you see them, and Apply refuses a change to one.`]})}function Qr({touch:e=!1,disabled:t=!1}){let n=Jr(),{state:r,busy:i,error:a,save:o}=n;if(!r)return null;let s=r.sources?.enabled===`env`,c=!!r.enabled;return(0,Q.jsxs)(`li`,{className:`space-y-2 p-3`,"data-sw-agents-branch-mode":c?`on`:`off`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(Ve,{size:16,className:`mt-0.5 shrink-0 text-muted`,"aria-hidden":`true`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{id:`sw-agents-branch-mode-label`,className:`text-sm font-medium text-fg`,children:`Work on a branch`}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:Xr(r,c)}),(0,Q.jsx)(Zr,{state:r,className:`mt-1 text-xs`})]}),(0,Q.jsx)(qr,{on:c,onChange:e=>o({enabled:e}),disabled:i||t||s,labelledBy:`sw-agents-branch-mode-label`,touch:e,"data-sw-agents-branch-mode-switch":`true`})]}),c?(0,Q.jsxs)(`label`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5 pl-7 text-xs text-muted`,children:[(0,Q.jsx)(`span`,{className:`shrink-0`,children:`Branch prefix (optional)`}),(0,Q.jsx)(Yr,{mode:n,disabled:i||t,touch:e,className:`w-48 max-w-full`,"data-sw-agents-branch-prefix":`true`})]}):null,a?(0,Q.jsx)(`p`,{role:`alert`,className:`pl-7 text-xs text-bad`,"data-sw-agents-branch-mode-error":`true`,children:a}):null]})}var $r=`/api/agent/settings/batch-fixes`;function ei(){let[e,t]=(0,Z.useState)(null),[n,i]=(0,Z.useState)(``),[a,o]=(0,Z.useState)(!1),[s,c]=(0,Z.useState)(null),l=(0,Z.useRef)(!1),u=(0,Z.useCallback)(async()=>{try{let e=await r.get($r);t(e),l.current||i(String(e?.max??``))}catch{t(null)}},[]);return(0,Z.useEffect)(()=>{u()},[u]),xr(()=>{a||u()}),{state:e,max:n,setMax:i,busy:a,error:s,save:async n=>{o(!0),c(null);try{let e=await r.post($r,n);t(e),i(String(e?.max??``))}catch(t){c(t.message||`Not saved.`),i(String(e?.max??``))}finally{o(!1)}},editing:l}}function ti({touch:e=!1,disabled:t=!1}){let{state:n,max:r,setMax:i,busy:a,error:o,save:s,editing:c}=ei();if(!n)return null;let l=!!n.enabled,u=n.ceiling||20;return(0,Q.jsxs)(`li`,{className:`space-y-2 p-3`,"data-sw-agents-batch-fixes":l?`on`:`off`,children:[(0,Q.jsxs)(`div`,{className:`flex items-start gap-3`,children:[(0,Q.jsx)(qe,{size:16,className:`mt-0.5 shrink-0 text-muted`,"aria-hidden":`true`}),(0,Q.jsxs)(`div`,{className:`min-w-0 flex-1`,children:[(0,Q.jsx)(`p`,{id:`sw-agents-batch-label`,className:`text-sm font-medium text-fg`,children:`Fix several comments at once`}),(0,Q.jsx)(`p`,{className:`mt-0.5 text-xs text-muted`,children:l?`The comments list gets Select: pick open comments and the agent fixes them one after another, each as its own fix with its own Undo. A batch stops when you cancel it or after two failures in a row.`:`Off: Fix with agent works on one comment at a time.`})]}),(0,Q.jsx)(qr,{on:l,onChange:e=>s({enabled:e}),disabled:a||t,labelledBy:`sw-agents-batch-label`,touch:e,"data-sw-agents-batch-switch":`true`})]}),l?(0,Q.jsxs)(`label`,{className:`flex flex-wrap items-center gap-x-3 gap-y-1.5 pl-7 text-xs text-muted`,children:[(0,Q.jsxs)(`span`,{className:`shrink-0`,children:[`At most this many in one batch (1 to `,u,`)`]}),(0,Q.jsx)(q,{type:`number`,inputMode:`numeric`,min:1,max:u,value:r,onChange:e=>i(e.target.value.slice(0,2)),onFocus:()=>{c.current=!0},onBlur:()=>{c.current=!1;let e=Number(r);!Number.isInteger(e)||e<1||e>u?i(String(n.max)):e!==n.max&&s({enabled:l,max:e})},onKeyDown:e=>{e.key===`Enter`&&e.currentTarget.blur()},disabled:a||t,size:e?`touch`:`sm`,className:`w-20 tabular-nums`,"data-sw-agents-batch-max":`true`})]}):null,o?(0,Q.jsx)(`p`,{role:`alert`,className:`pl-7 text-xs text-bad`,"data-sw-agents-batch-error":`true`,children:o}):null]})}function ni({touch:e=!1,Card:t,CardHeader:n}){return(0,Q.jsxs)(t,{className:`scroll-mt-20`,"data-sw-agents-work":!0,children:[(0,Q.jsx)(n,{icon:kt,title:`How fixes run`,description:`Where the agent makes its changes, and whether it takes several comments in one go.`}),(0,Q.jsx)(`div`,{className:`px-4 py-4 sm:px-5`,children:(0,Q.jsxs)(`ul`,{className:`divide-y divide-line rounded-md border border-line empty:hidden`,"aria-label":`How fixes run`,children:[(0,Q.jsx)(Qr,{touch:e}),(0,Q.jsx)(ti,{touch:e})]})})]})}var ri=`The coding agents that chat and fix comments on this computer, and how they connect.`;function ii({agent:e=null,touch:t,onChanged:n,onOpenEndpoint:r=null}){return(0,Q.jsxs)(Y,{id:`agents`,className:`scroll-mt-20`,"data-sw-local-console-agents":!0,children:[(0,Q.jsx)(ye,{icon:u,title:`Connected agents`,description:`Connect, test and remove agents, and choose the one new chats and fixes use.`}),(0,Q.jsx)(`div`,{className:`px-4 py-4 sm:px-5`,children:(0,Q.jsx)(Hr,{touch:t,agent:e,onChanged:n,onOpenEndpoint:r})})]})}function ai({info:e,touch:t,onChanged:n}){return(0,Q.jsxs)(`div`,{className:`grid grid-cols-[minmax(0,1fr)] gap-5`,children:[e?.agent?(0,Q.jsx)(ii,{agent:e.agent,touch:t,onChanged:async()=>{or(`local`),await n?.()},onOpenEndpoint:()=>document.querySelector(`[data-sw-local-console-agent-details]`)?.scrollIntoView({block:`start`})}):null,e?.agent?.settingsEditable?(0,Q.jsx)(ni,{touch:t,Card:Y,CardHeader:ye}):null,(0,Q.jsxs)(Y,{className:`scroll-mt-20`,"data-sw-local-console-agent-details":!0,children:[(0,Q.jsx)(ye,{icon:pt,title:`Chat connection`,description:`What the board chat uses now, the source folder agents work in, and an OpenAI-compatible endpoint.`}),(0,Q.jsx)(`div`,{className:`px-4 py-4 sm:px-5`,children:(0,Q.jsx)(Gr,{info:e,onSaved:n,touch:t,agentsHome:!!e?.agent})})]})]})}var oi={agent:{settingsEditable:!0}};function si(){let e=l(`(min-width: 1024px)`);return(0,Q.jsxs)(Q.Fragment,{children:[(0,Q.jsx)(pe,{title:`Agents`,description:ri}),(0,Q.jsx)(ai,{info:oi,touch:!e,onChanged:()=>{}})]})}export{Ue as A,pt as C,$e as D,tt as E,Fe as M,je as N,Ze as O,ht as S,rt as T,Ft as _,dr as a,xt as b,Nn as c,xn as d,yn as f,Vt as g,on as h,Wr as i,ze as j,Ye as k,Pn as l,Qt as m,ai as n,xr as o,hn as p,si as r,Jn as s,ri as t,Fn as u,kt as v,dt as w,_t as x,Dt as y};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{It as e}from"./ui-Bry1mnCY.js";var t={name:`minus`,size:24,node:[[`path`,{d:`M5 12h14`,key:`1ays0h`}]]};t.node;var n=e(t);export{n as t};
|