@snagset/server 0.1.3 → 0.1.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (131) hide show
  1. package/dist/app.js +37 -5
  2. package/dist/app.js.map +1 -1
  3. package/dist/db/scope.js +23 -0
  4. package/dist/db/scope.js.map +1 -0
  5. package/dist/mail/unsubscribe.js +5 -4
  6. package/dist/mail/unsubscribe.js.map +1 -1
  7. package/dist/orgs.js +87 -0
  8. package/dist/orgs.js.map +1 -0
  9. package/dist/plan.js +82 -0
  10. package/dist/plan.js.map +1 -0
  11. package/dist/projectCache.js +3 -2
  12. package/dist/projectCache.js.map +1 -1
  13. package/dist/reviewerCache.js +3 -2
  14. package/dist/reviewerCache.js.map +1 -1
  15. package/dist/routes/account.js +5 -4
  16. package/dist/routes/account.js.map +1 -1
  17. package/dist/routes/anchorReports.js +3 -2
  18. package/dist/routes/anchorReports.js.map +1 -1
  19. package/dist/routes/attachments.js +17 -6
  20. package/dist/routes/attachments.js.map +1 -1
  21. package/dist/routes/commentEdit.js +3 -2
  22. package/dist/routes/commentEdit.js.map +1 -1
  23. package/dist/routes/comments.js +7 -6
  24. package/dist/routes/comments.js.map +1 -1
  25. package/dist/routes/cors.js +5 -4
  26. package/dist/routes/cors.js.map +1 -1
  27. package/dist/routes/integrations.js +10 -5
  28. package/dist/routes/integrations.js.map +1 -1
  29. package/dist/routes/mcpAuth.js +5 -4
  30. package/dist/routes/mcpAuth.js.map +1 -1
  31. package/dist/routes/mcpToken.js +8 -7
  32. package/dist/routes/mcpToken.js.map +1 -1
  33. package/dist/routes/members.js +11 -0
  34. package/dist/routes/members.js.map +1 -1
  35. package/dist/routes/orgs.js +128 -0
  36. package/dist/routes/orgs.js.map +1 -0
  37. package/dist/routes/owner.js +34 -12
  38. package/dist/routes/owner.js.map +1 -1
  39. package/dist/routes/reviewLinks.js +11 -10
  40. package/dist/routes/reviewLinks.js.map +1 -1
  41. package/dist/routes/rounds.js +7 -6
  42. package/dist/routes/rounds.js.map +1 -1
  43. package/dist/routes/sessions.js +16 -15
  44. package/dist/routes/sessions.js.map +1 -1
  45. package/dist/routes/sites.js +45 -26
  46. package/dist/routes/sites.js.map +1 -1
  47. package/dist/routes/threads.js +7 -11
  48. package/dist/routes/threads.js.map +1 -1
  49. package/dist/serverless.js +86 -120
  50. package/dist/serverless.js.map +1 -1
  51. package/dist/storage/settings.js +8 -7
  52. package/dist/storage/settings.js.map +1 -1
  53. package/package.json +1 -1
  54. package/static/dashboard/assets/{CompositeItem-BZSyTS4P.js → CompositeItem-B5AtyrD6.js} +1 -1
  55. package/static/dashboard/assets/ConfirmDialog-ClUMXHe1.js +1 -0
  56. package/static/dashboard/assets/{CopyButton-Bm-P_uCi.js → CopyButton-DCsj-LZV.js} +1 -1
  57. package/static/dashboard/assets/{FieldItemContext-C_WMV5Y1.js → FieldItemContext-DVEWRsEB.js} +1 -1
  58. package/static/dashboard/assets/{InstallTag-C12OFWxQ.js → InstallTag-B_qg9P2r.js} +1 -1
  59. package/static/dashboard/assets/SaveState-B-6cG0nU.js +1 -0
  60. package/static/dashboard/assets/_app-DKjbkrkj.js +56 -0
  61. package/static/dashboard/assets/{_app-Cd-jUoXa.js → _app-DQfqCcnn.js} +1 -1
  62. package/static/dashboard/assets/{activity-DrwA-DtK.js → activity-D8OAqMBy.js} +1 -1
  63. package/static/dashboard/assets/{arrow-left-Bh-dAOei.js → arrow-left-D2obUiWw.js} +1 -1
  64. package/static/dashboard/assets/{avatar-CHJ9xfvK.js → avatar-DlHbKa1H.js} +1 -1
  65. package/static/dashboard/assets/{badge-B0S2TuoH.js → badge-CQoGgFU8.js} +1 -1
  66. package/static/dashboard/assets/{card-ACZ3SoSc.js → card-YnwmM74t.js} +1 -1
  67. package/static/dashboard/assets/{check-Dqp329Qx.js → check-CLHnIgiu.js} +1 -1
  68. package/static/dashboard/assets/{chevron-right-Ce6AqGTW.js → chevron-right-BX_QQNXH.js} +1 -1
  69. package/static/dashboard/assets/{copy-DYe-rWru.js → copy-ZOZ0pLVD.js} +1 -1
  70. package/static/dashboard/assets/{dialog-DC5ijHd-.js → dialog-BO8bYmy1.js} +2 -2
  71. package/static/dashboard/assets/{dropdown-menu-DJHh2D48.js → dropdown-menu-NLHjhAUe.js} +3 -3
  72. package/static/dashboard/assets/{image-off-DcirqIBd.js → image-off-Dg9jTwH7.js} +1 -1
  73. package/static/dashboard/assets/index-B7_Oj3hr.js +169 -0
  74. package/static/dashboard/assets/{index-BRTBtV91.css → index-BR4Mnw-o.css} +1 -1
  75. package/static/dashboard/assets/label-Dpq7t35_.js +1 -0
  76. package/static/dashboard/assets/{layout-grid-DiZ4lLOr.js → layout-grid-Bf2WS_DV.js} +1 -1
  77. package/static/dashboard/assets/me-DoCJgtG9.js +1 -0
  78. package/static/dashboard/assets/{parts-DIo5a0tB.js → parts-C1QjM02Y.js} +1 -1
  79. package/static/dashboard/assets/{plus-BoLdzoOl.js → plus-D247LXUb.js} +1 -1
  80. package/static/dashboard/assets/s._site-BDWAQaIb.js +1 -0
  81. package/static/dashboard/assets/{s._site.comments-Dcz9VfMC.js → s._site.comments-DEzj9S7b.js} +9 -9
  82. package/static/dashboard/assets/s._site.reviewers-DZ5GqGMU.js +1 -0
  83. package/static/dashboard/assets/s._site.settings-BIjpyBsc.js +1 -0
  84. package/static/dashboard/assets/setup-ONHVc5kM.js +1 -0
  85. package/static/dashboard/assets/sign-in-H0jNzIrs.js +1 -0
  86. package/static/dashboard/assets/sign-up-DyiLEKht.js +1 -0
  87. package/static/dashboard/assets/sites-Dnmo-2Me.js +1 -0
  88. package/static/dashboard/assets/studio-DxOnhxuB.js +1 -0
  89. package/static/dashboard/assets/studio-enyabWEx.js +1 -0
  90. package/static/dashboard/assets/studio.index-nkeq6PME.js +1 -0
  91. package/static/dashboard/assets/studio.integrations-BWPo36fJ.js +1 -0
  92. package/static/dashboard/assets/studio.members-DXS5CJK_.js +1 -0
  93. package/static/dashboard/assets/{sun-hlSpGJcg.js → sun-BzkBukC4.js} +1 -1
  94. package/static/dashboard/assets/switch-ElcxbE6-.js +1 -0
  95. package/static/dashboard/assets/{table-5N0NRM82.js → table-DdjoxL3-.js} +1 -1
  96. package/static/dashboard/assets/useAriaLabelledBy-BNUj3f_d.js +1 -0
  97. package/static/dashboard/assets/{useBaseQuery-WjLRzhGh.js → useBaseQuery-yj7uWlSz.js} +1 -1
  98. package/static/dashboard/assets/useQuery-CBgK187B.js +1 -0
  99. package/static/dashboard/assets/useRender-BHlMpPxr.js +1 -0
  100. package/static/dashboard/assets/{useValueChanged-BV1ZHBzN.js → useValueChanged-DQ0Iea1L.js} +1 -1
  101. package/static/dashboard/assets/{users-YuUR-T2d.js → users-DDrXwrCG.js} +1 -1
  102. package/static/dashboard/assets/welcome-Dg1oA1uA.js +11 -0
  103. package/static/dashboard/assets/you-CP3bZ82A.js +1 -0
  104. package/static/dashboard/assets/{zod-B5yGKD8p.js → zod-BUdBrC5l.js} +1 -1
  105. package/static/dashboard/index.html +2 -2
  106. package/vercel.json +10 -5
  107. package/static/dashboard/assets/ConfirmDialog-Db4zsosS.js +0 -1
  108. package/static/dashboard/assets/SaveState-OUJN_boO.js +0 -6
  109. package/static/dashboard/assets/_app-Cp-iO2k6.js +0 -56
  110. package/static/dashboard/assets/createBaseUIEventDetails-BwtZlnCY.js +0 -1
  111. package/static/dashboard/assets/createLucideIcon-SQ1OtOty.js +0 -36
  112. package/static/dashboard/assets/index-CqjuloQH.js +0 -129
  113. package/static/dashboard/assets/label-CW_cMhiD.js +0 -1
  114. package/static/dashboard/assets/me-DdTyFOSS.js +0 -1
  115. package/static/dashboard/assets/s._site-OuoJaDQ3.js +0 -1
  116. package/static/dashboard/assets/s._site.reviewers-yucE-ON0.js +0 -1
  117. package/static/dashboard/assets/s._site.settings-BZufAPHa.js +0 -1
  118. package/static/dashboard/assets/setup-Pp1TuCU6.js +0 -1
  119. package/static/dashboard/assets/sign-in-7aKxoHSF.js +0 -1
  120. package/static/dashboard/assets/sites-5NKVOdPZ.js +0 -1
  121. package/static/dashboard/assets/studio-BdDHdd0o.js +0 -1
  122. package/static/dashboard/assets/studio-Bj_Tddf0.js +0 -1
  123. package/static/dashboard/assets/studio.index-X6GkAcy-.js +0 -1
  124. package/static/dashboard/assets/studio.integrations-UxtgfC_i.js +0 -1
  125. package/static/dashboard/assets/studio.members-DlYCEyja.js +0 -1
  126. package/static/dashboard/assets/switch-C-FKmkAi.js +0 -1
  127. package/static/dashboard/assets/useAriaLabelledBy-Bl7Pv-JK.js +0 -1
  128. package/static/dashboard/assets/useQuery-BEI9T-AQ.js +0 -1
  129. package/static/dashboard/assets/useRender-DW4lC-HO.js +0 -1
  130. package/static/dashboard/assets/welcome-DyI_SmA2.js +0 -11
  131. package/static/dashboard/assets/you-In9on4kb.js +0 -1
@@ -1,39 +1,39 @@
1
- import{j as e,e as C,r as g,f as As,U as Ms,V as Rs,c as Ke,W as Ge,X as Ds,m as zs,E as Is,h as es,Y as Es,g as Ps,Z as ss,$ as Ts,T as He,B as R,Q as ts,A as Bs,a0 as Je,n as _s,a1 as Qe,a2 as Fs,a3 as Os,a4 as Ls,a5 as Vs,a6 as qs,a7 as Us,L as ns,z as Ws,_ as Xe,C as ie,a8 as Ks,x as he}from"./index-CqjuloQH.js";import{u as le}from"./useQuery-BEI9T-AQ.js";import{C as as}from"./check-Dqp329Qx.js";import{u as Ze,e as Gs,c as Hs,n as Js}from"./createBaseUIEventDetails-BwtZlnCY.js";import{L as Qs,M as Xs,N as Zs,A as Ys,O as et,X as st,E as rs,G as os,I as is,H as ls,J as ds,K as cs}from"./dialog-DC5ijHd-.js";import{f as tt,u as nt,a as at,b as rt,c as ot,L as Te,I as je}from"./label-CW_cMhiD.js";import{u as it}from"./FieldItemContext-C_WMV5Y1.js";import{u as lt}from"./useAriaLabelledBy-Bl7Pv-JK.js";import{u as dt}from"./useValueChanged-BV1ZHBzN.js";import{E as Ye,D as Y,i as ee,j as se,o as Be,p as X,k as ce,m as G,l as _e,n as us,S as ct}from"./dropdown-menu-DJHh2D48.js";import{A as te,a as ne}from"./avatar-CHJ9xfvK.js";import{b as Fe,S as ms,E as Ee}from"./parts-DIo5a0tB.js";import{S as ae,i as ut,a as ue,b as ve,c as fe}from"./labels--UUyt9uB.js";import{C as mt}from"./copy-DYe-rWru.js";import{I as xt}from"./image-off-DcirqIBd.js";import{c as Z}from"./createLucideIcon-SQ1OtOty.js";import{C as pt}from"./chevron-right-Ce6AqGTW.js";import{I as ht}from"./InstallTag-C12OFWxQ.js";import{u as ft}from"./me-DdTyFOSS.js";import{A as gt}from"./arrow-left-Bh-dAOei.js";import"./useBaseQuery-WjLRzhGh.js";import"./CompositeItem-BZSyTS4P.js";import"./card-ACZ3SoSc.js";/**
1
+ import{c as Q,j as e,f as C,r as g,h as As,V as Ms,W as Rs,d as Ke,X as Ge,Y as Ds,m as zs,E as Is,i as es,Z as Es,g as Ps,$ as ss,a0 as Ts,T as He,B as R,S as ts,A as Bs,a1 as Je,o as _s,a2 as Xe,a3 as Fs,a4 as Os,a5 as Ls,a6 as Vs,a7 as qs,a8 as Us,L as ns,C as Ws,_ as Ze,D as ie,a9 as Ks,y as he}from"./index-B7_Oj3hr.js";import{u as le}from"./useQuery-CBgK187B.js";import{C as as}from"./check-CLHnIgiu.js";import{f as Gs,e as Hs,h as Js,j as Xs,u as Qe,k as Zs,l as Qs,c as Ys,n as et,L as Te,I as je}from"./label-Dpq7t35_.js";import{L as st,M as tt,N as nt,A as at,O as rt,X as ot,E as rs,G as os,I as is,H as ls,J as ds,K as cs}from"./dialog-BO8bYmy1.js";import{u as it}from"./FieldItemContext-DVEWRsEB.js";import{u as lt}from"./useAriaLabelledBy-BNUj3f_d.js";import{u as dt}from"./useValueChanged-DQ0Iea1L.js";import{E as Ye,D as Y,i as ee,j as se,o as Be,p as Z,k as ce,m as G,l as _e,n as us,S as ct}from"./dropdown-menu-NLHjhAUe.js";import{A as te,a as ne}from"./avatar-DlHbKa1H.js";import{b as Fe,S as ms,E as Ee}from"./parts-C1QjM02Y.js";import{S as ae,i as ut,a as ue,b as ve,c as fe}from"./labels--UUyt9uB.js";import{C as mt}from"./copy-ZOZ0pLVD.js";import{I as xt}from"./image-off-Dg9jTwH7.js";import{C as pt}from"./chevron-right-BX_QQNXH.js";import{I as ht}from"./InstallTag-B_qg9P2r.js";import{u as ft}from"./me-DoCJgtG9.js";import{A as gt}from"./arrow-left-D2obUiWw.js";import"./useBaseQuery-yj7uWlSz.js";import"./CompositeItem-B5AtyrD6.js";import"./card-YnwmM74t.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.
5
5
  * See the LICENSE file in the root directory of this source tree.
6
- */const bt=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ge=Z("chevron-down",bt);/**
6
+ */const bt=[["path",{d:"m6 9 6 6 6-6",key:"qrunsl"}]],ge=Q("chevron-down",bt);/**
7
7
  * @license lucide-react v1.39.0 - ISC
8
8
  *
9
9
  * This source code is licensed under the ISC license.
10
10
  * See the LICENSE file in the root directory of this source tree.
11
- */const jt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],vt=Z("columns-2",jt);/**
11
+ */const jt=[["rect",{width:"18",height:"18",x:"3",y:"3",rx:"2",key:"afitv7"}],["path",{d:"M12 3v18",key:"108xh3"}]],vt=Q("columns-2",jt);/**
12
12
  * @license lucide-react v1.39.0 - ISC
13
13
  *
14
14
  * This source code is licensed under the ISC license.
15
15
  * See the LICENSE file in the root directory of this source tree.
16
- */const kt=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],yt=Z("inbox",kt);/**
16
+ */const kt=[["polyline",{points:"22 12 16 12 14 15 10 15 8 12 2 12",key:"o97t9d"}],["path",{d:"M5.45 5.11 2 12v6a2 2 0 0 0 2 2h16a2 2 0 0 0 2-2v-6l-3.45-6.89A2 2 0 0 0 16.76 4H7.24a2 2 0 0 0-1.79 1.11z",key:"oot6mr"}]],yt=Q("inbox",kt);/**
17
17
  * @license lucide-react v1.39.0 - ISC
18
18
  *
19
19
  * This source code is licensed under the ISC license.
20
20
  * See the LICENSE file in the root directory of this source tree.
21
- */const Nt=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],wt=Z("list",Nt);/**
21
+ */const Nt=[["path",{d:"M3 5h.01",key:"18ugdj"}],["path",{d:"M3 12h.01",key:"nlz23k"}],["path",{d:"M3 19h.01",key:"noohij"}],["path",{d:"M8 5h13",key:"1pao27"}],["path",{d:"M8 12h13",key:"1za7za"}],["path",{d:"M8 19h13",key:"m83p4d"}]],wt=Q("list",Nt);/**
22
22
  * @license lucide-react v1.39.0 - ISC
23
23
  *
24
24
  * This source code is licensed under the ISC license.
25
25
  * See the LICENSE file in the root directory of this source tree.
26
- */const Ct=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],St=Z("rotate-cw",Ct);/**
26
+ */const Ct=[["path",{d:"M21 12a9 9 0 1 1-9-9c2.52 0 4.93 1 6.74 2.74L21 8",key:"1p45f6"}],["path",{d:"M21 3v5h-5",key:"1q7to0"}]],St=Q("rotate-cw",Ct);/**
27
27
  * @license lucide-react v1.39.0 - ISC
28
28
  *
29
29
  * This source code is licensed under the ISC license.
30
30
  * See the LICENSE file in the root directory of this source tree.
31
- */const $t=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],At=Z("user-plus",$t);/**
31
+ */const $t=[["path",{d:"M16 21v-2a4 4 0 0 0-4-4H6a4 4 0 0 0-4 4v2",key:"1yyitq"}],["circle",{cx:"9",cy:"7",r:"4",key:"nufk8"}],["line",{x1:"19",x2:"19",y1:"8",y2:"14",key:"1bvyxn"}],["line",{x1:"22",x2:"16",y1:"11",y2:"11",key:"1shjgl"}]],At=Q("user-plus",$t);/**
32
32
  * @license lucide-react v1.39.0 - ISC
33
33
  *
34
34
  * This source code is licensed under the ISC license.
35
35
  * See the LICENSE file in the root directory of this source tree.
36
- */const Mt=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],Rt=Z("user-round",Mt);function de({className:s,...t}){return e.jsx("div",{"data-slot":"skeleton",className:C("animate-pulse rounded-md bg-muted",s),...t})}function Dt(s){if(!s)return null;for(const t of s.elements){const a=t.tagName;if(a==="BUTTON"||a==="INPUT"){const c=t;if(c.type==="submit")return c}}return null}function xs(s){return{checked(t){return s.indeterminate?{}:t?{"data-checked":""}:{"data-unchecked":""}},...tt}}const zt=g.createContext(void 0);function It(){return g.useContext(zt)}const ps=g.createContext(void 0);function Et(){const s=g.useContext(ps);if(s===void 0)throw new Error(As(14));return s}const Pt="data-parent",Tt=g.forwardRef(function(t,a){const{checked:c,className:x,defaultChecked:o=!1,"aria-labelledby":l,disabled:k=!1,form:d,id:h,indeterminate:y=!1,inputRef:i,name:f,onCheckedChange:v,parent:r=!1,readOnly:S=!1,render:F,required:$=!1,uncheckedValue:I,value:N,nativeButton:E=!1,style:B,...D}=t,{clearErrors:u}=nt(),{disabled:w,name:p,setDirty:O,setFilled:P,setFocused:_,setTouched:ke,state:A,validationMode:ye,validityData:Ne,validation:we}=at(),Ce=it(),{labelId:W,controlId:Se,registerControlId:n,getDescriptionProps:m}=rt(),j=It(),T=j?.allValues===void 0?void 0:j.parent,L=T!==void 0,M=w||Ce.disabled||j?.disabled||k,q=p??f,z=N??q,Le=Ze(),Ve=Ze();let K=h||Se;L&&(r?K=Ve:z!==void 0?K=`${T.id}-${z}`:K||=Ve);let $e={};L&&(r?$e=T.getParentProps():z!==void 0&&($e=T.getChildProps(z)));const{checked:qe=c,indeterminate:fs=y,onCheckedChange:gs,...bs}=$e,Ae=j?.value,me=g.useRef(null),xe=Ms(()=>Symbol()),Me=g.useRef(!1),{getButtonProps:js,buttonRef:vs}=Rs({disabled:M,native:E}),re=j?.validation??we,[V,ks]=Gs({controlled:z!==void 0&&Ae!==void 0&&!r?Ae.includes(z):qe,default:o,name:"Checkbox",state:"checked"}),Re=L?!!qe:V,oe=L&&fs||y;Ke(()=>{n!==Ge&&(Me.current=!0,n(xe.current,K))},[K,n,xe]),g.useEffect(()=>{const b=xe.current;return()=>{!Me.current||n===Ge||(Me.current=!1,n(b,void 0))}},[n,xe]),ot(me,Le,V,void 0,!j&&!M,f);const H=g.useRef(null),Ue=re.registerInput,We=j?z:void 0,ys=g.useCallback(b=>Ue(b,{controlRef:me,value:We}),[Ue,We]),Ns=Ds(i,H,r?void 0:ys),ws=lt(l,W,H,!E,K??void 0);Ke(()=>{H.current&&(H.current.indeterminate=oe,V&&P(!0))},[V,oe,P]),dt(V,()=>{j||(u(q),P(V),O(V!==Ne.initialValue),re.change(V))});const Cs=zs({checked:V,disabled:M,form:d,name:r?void 0:q,id:E?void 0:K??void 0,required:$,ref:Ns,style:q?Qs:Xs,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(b){if(b.nativeEvent.defaultPrevented)return;if(S){b.preventDefault();return}const U=b.currentTarget.checked,J=Hs(Js,b.nativeEvent);if(v?.(U,J),!J.isCanceled&&(gs?.(U,J),!J.isCanceled&&(ks(U),z!==void 0&&j!==void 0&&!r&&!L))){const Q=U?[...j.value,z]:j.value.filter(pe=>pe!==z);j.setValue(Q,J)}},onClick(b){b.stopPropagation()},onFocus(){me.current?.focus()}},N!==void 0?{value:(j?V&&N:N)||""}:Is,m,b=>re.getValidationProps(M,b));g.useEffect(()=>{if(!T||z===void 0)return;const b=T.disabledStatesRef.current;return b.set(z,M),()=>{b.delete(z)}},[T,M,z]);const De=g.useMemo(()=>({...A,checked:Re,disabled:M,readOnly:S,required:$,indeterminate:oe}),[A,Re,M,S,$,oe]),Ss=xs(De),$s=es("span",t,{state:De,ref:[vs,me,a],props:[{id:E?K??void 0:Le,role:"checkbox","aria-checked":oe?"mixed":Re,"aria-readonly":S||void 0,"aria-required":$||void 0,"aria-labelledby":ws,[Pt]:r?"":void 0,onFocus(){M||_(!0)},onBlur(){const b=H.current;b&&(ke(!0),_(!1),ye==="onBlur"&&re.commit(j?Ae:b.checked))},onKeyDown(b){if(b.key!=="Enter"||(b.preventBaseUIHandler(),b.defaultPrevented))return;const U=H.current?.form??null,J=b.currentTarget,Q=b.nativeEvent,pe=b.preventDefault,ze=Q.preventDefault;let Ie=!1;b.preventDefault=()=>{Ie=!0,pe.call(b)},Q.preventDefault=()=>{Ie=!0,ze.call(Q)},ze.call(Q),Ps(J).queueMicrotask(()=>{b.preventDefault=pe,Q.preventDefault=ze,Ie||Dt(U)?.click()})},onClick(b){if(S||M)return;b.preventDefault();const U=H.current;U&&Es(U,b)}},D,bs,js,m,b=>re.getValidationProps(M,b)],stateAttributesMapping:Ss});return e.jsxs(ps.Provider,{value:De,children:[$s,!V&&!j&&q&&!r&&I!==void 0&&e.jsx("input",{type:"hidden",form:d,name:q,value:I,disabled:M}),e.jsx("input",{...Cs,suppressHydrationWarning:!0})]})}),Bt=g.forwardRef(function(t,a){const{render:c,className:x,style:o,keepMounted:l=!1,...k}=t,d=Et(),h=d.checked||d.indeterminate,{mounted:y,transitionStatus:i,setMounted:f}=Zs(h),v=g.useRef(null),r={...d,transitionStatus:i};Ys({open:h,ref:v,onComplete(){h||f(!1)}});const F={...xs(d),...et},$=l||y,I=es("span",t,{ref:[a,v],state:r,stateAttributesMapping:F,props:k});return $?I:null});function _t({className:s,...t}){return e.jsx(Tt,{"data-slot":"checkbox",className:C("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary",s),...t,children:e.jsx(Bt,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:e.jsx(as,{})})})}function Ft({className:s,...t}){return e.jsx("textarea",{"data-slot":"textarea",className:C("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",s),...t})}const Ot={open:"Open",progress:"In progress",review:"In review",resolved:"Resolved"};function Lt(s,t,a={}){const c=a.fence??((u,w)=>w),x=a.statusLabel??(u=>Ot[u]??u),o=s.anchor??{},l=s.context??{},k=o.page,d=k?.route??s.route??"/",h=k?.origin??t.origin??"",y=k?.pathname??d,i=h?`${h}${y}`:y,f=typeof o.label=="string"?c("label",o.label):"",v=o.element??o,r=[];r.push(`# ${s.key}${f?` — ${f}`:""}`),r.push(""),r.push(`${t.name} · ${x(s.status)} · left by ${s.createdBy?.name?c("name",s.createdBy.name):"someone"} on ${s.createdAt.slice(0,10)}`+(s.assignee?` · assigned to ${c("name",s.assignee.name)}`:"")),r.push(""),r.push("## Where to look"),r.push(""),r.push(`- Page: ${i}`),h&&r.push(`- Open on the page: ${h}${y}?${ss("t")}=${encodeURIComponent(s.key)}`),f&&r.push(`- Element: ${f}`);const S=typeof o.css=="string"?o.css:typeof v.selector=="string"?v.selector:"";if(S&&r.push(`- Selector: \`${c("selector",S)}\``),typeof o.domid=="string"&&r.push(`- DOM id: \`#${c("selector",o.domid)}\``),typeof v.role=="string"){const u=typeof v.accessibleName=="string"?` “${c("label",v.accessibleName)}”`:"";r.push(`- Role: ${c("label",v.role)}${u}`)}typeof v.testId=="string"&&r.push(`- Test id: ${c("label",v.testId)}`);const F=o.text;F?.exact&&r.push(`- Text: “${c("label",F.exact)}”`),r.push(`- Anchor: ${s.anchorState??"unknown"}`),r.push(""),r.push("## What's wrong"),r.push("");const $=(s.comments??[]).filter(u=>u.body!==null);$.length===0&&r.push("> (no comment — a pin with no words)");for(const u of $){const w=u.author?.name?c("name",u.author.name):"Anonymous";r.push(`> **${w}${u.author?.kind==="agent"?" (agent)":""}** — ${u.createdAt.slice(0,16).replace("T"," ")}`);for(const p of c("body",String(u.body)).split(`
36
+ */const Mt=[["circle",{cx:"12",cy:"8",r:"5",key:"1hypcn"}],["path",{d:"M20 21a8 8 0 0 0-16 0",key:"rfgkzh"}]],Rt=Q("user-round",Mt);function de({className:s,...t}){return e.jsx("div",{"data-slot":"skeleton",className:C("animate-pulse rounded-md bg-muted",s),...t})}function Dt(s){if(!s)return null;for(const t of s.elements){const a=t.tagName;if(a==="BUTTON"||a==="INPUT"){const c=t;if(c.type==="submit")return c}}return null}function xs(s){return{checked(t){return s.indeterminate?{}:t?{"data-checked":""}:{"data-unchecked":""}},...Gs}}const zt=g.createContext(void 0);function It(){return g.useContext(zt)}const ps=g.createContext(void 0);function Et(){const s=g.useContext(ps);if(s===void 0)throw new Error(As(14));return s}const Pt="data-parent",Tt=g.forwardRef(function(t,a){const{checked:c,className:x,defaultChecked:o=!1,"aria-labelledby":l,disabled:k=!1,form:d,id:h,indeterminate:y=!1,inputRef:i,name:f,onCheckedChange:v,parent:r=!1,readOnly:S=!1,render:F,required:$=!1,uncheckedValue:I,value:N,nativeButton:E=!1,style:B,...D}=t,{clearErrors:u}=Hs(),{disabled:w,name:p,setDirty:O,setFilled:P,setFocused:_,setTouched:ke,state:A,validationMode:ye,validityData:Ne,validation:we}=Js(),Ce=it(),{labelId:W,controlId:Se,registerControlId:n,getDescriptionProps:m}=Xs(),j=It(),T=j?.allValues===void 0?void 0:j.parent,L=T!==void 0,M=w||Ce.disabled||j?.disabled||k,q=p??f,z=N??q,Le=Qe(),Ve=Qe();let K=h||Se;L&&(r?K=Ve:z!==void 0?K=`${T.id}-${z}`:K||=Ve);let $e={};L&&(r?$e=T.getParentProps():z!==void 0&&($e=T.getChildProps(z)));const{checked:qe=c,indeterminate:fs=y,onCheckedChange:gs,...bs}=$e,Ae=j?.value,me=g.useRef(null),xe=Ms(()=>Symbol()),Me=g.useRef(!1),{getButtonProps:js,buttonRef:vs}=Rs({disabled:M,native:E}),re=j?.validation??we,[V,ks]=Zs({controlled:z!==void 0&&Ae!==void 0&&!r?Ae.includes(z):qe,default:o,name:"Checkbox",state:"checked"}),Re=L?!!qe:V,oe=L&&fs||y;Ke(()=>{n!==Ge&&(Me.current=!0,n(xe.current,K))},[K,n,xe]),g.useEffect(()=>{const b=xe.current;return()=>{!Me.current||n===Ge||(Me.current=!1,n(b,void 0))}},[n,xe]),Qs(me,Le,V,void 0,!j&&!M,f);const H=g.useRef(null),Ue=re.registerInput,We=j?z:void 0,ys=g.useCallback(b=>Ue(b,{controlRef:me,value:We}),[Ue,We]),Ns=Ds(i,H,r?void 0:ys),ws=lt(l,W,H,!E,K??void 0);Ke(()=>{H.current&&(H.current.indeterminate=oe,V&&P(!0))},[V,oe,P]),dt(V,()=>{j||(u(q),P(V),O(V!==Ne.initialValue),re.change(V))});const Cs=zs({checked:V,disabled:M,form:d,name:r?void 0:q,id:E?void 0:K??void 0,required:$,ref:Ns,style:q?st:tt,tabIndex:-1,type:"checkbox","aria-hidden":!0,onChange(b){if(b.nativeEvent.defaultPrevented)return;if(S){b.preventDefault();return}const U=b.currentTarget.checked,J=Ys(et,b.nativeEvent);if(v?.(U,J),!J.isCanceled&&(gs?.(U,J),!J.isCanceled&&(ks(U),z!==void 0&&j!==void 0&&!r&&!L))){const X=U?[...j.value,z]:j.value.filter(pe=>pe!==z);j.setValue(X,J)}},onClick(b){b.stopPropagation()},onFocus(){me.current?.focus()}},N!==void 0?{value:(j?V&&N:N)||""}:Is,m,b=>re.getValidationProps(M,b));g.useEffect(()=>{if(!T||z===void 0)return;const b=T.disabledStatesRef.current;return b.set(z,M),()=>{b.delete(z)}},[T,M,z]);const De=g.useMemo(()=>({...A,checked:Re,disabled:M,readOnly:S,required:$,indeterminate:oe}),[A,Re,M,S,$,oe]),Ss=xs(De),$s=es("span",t,{state:De,ref:[vs,me,a],props:[{id:E?K??void 0:Le,role:"checkbox","aria-checked":oe?"mixed":Re,"aria-readonly":S||void 0,"aria-required":$||void 0,"aria-labelledby":ws,[Pt]:r?"":void 0,onFocus(){M||_(!0)},onBlur(){const b=H.current;b&&(ke(!0),_(!1),ye==="onBlur"&&re.commit(j?Ae:b.checked))},onKeyDown(b){if(b.key!=="Enter"||(b.preventBaseUIHandler(),b.defaultPrevented))return;const U=H.current?.form??null,J=b.currentTarget,X=b.nativeEvent,pe=b.preventDefault,ze=X.preventDefault;let Ie=!1;b.preventDefault=()=>{Ie=!0,pe.call(b)},X.preventDefault=()=>{Ie=!0,ze.call(X)},ze.call(X),Ps(J).queueMicrotask(()=>{b.preventDefault=pe,X.preventDefault=ze,Ie||Dt(U)?.click()})},onClick(b){if(S||M)return;b.preventDefault();const U=H.current;U&&Es(U,b)}},D,bs,js,m,b=>re.getValidationProps(M,b)],stateAttributesMapping:Ss});return e.jsxs(ps.Provider,{value:De,children:[$s,!V&&!j&&q&&!r&&I!==void 0&&e.jsx("input",{type:"hidden",form:d,name:q,value:I,disabled:M}),e.jsx("input",{...Cs,suppressHydrationWarning:!0})]})}),Bt=g.forwardRef(function(t,a){const{render:c,className:x,style:o,keepMounted:l=!1,...k}=t,d=Et(),h=d.checked||d.indeterminate,{mounted:y,transitionStatus:i,setMounted:f}=nt(h),v=g.useRef(null),r={...d,transitionStatus:i};at({open:h,ref:v,onComplete(){h||f(!1)}});const F={...xs(d),...rt},$=l||y,I=es("span",t,{ref:[a,v],state:r,stateAttributesMapping:F,props:k});return $?I:null});function _t({className:s,...t}){return e.jsx(Tt,{"data-slot":"checkbox",className:C("peer relative flex size-4 shrink-0 items-center justify-center rounded-[4px] border border-input transition-colors outline-none group-has-disabled/field:opacity-50 group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary",s),...t,children:e.jsx(Bt,{"data-slot":"checkbox-indicator",className:"grid place-content-center text-current transition-none [&>svg]:size-3.5",children:e.jsx(as,{})})})}function Ft({className:s,...t}){return e.jsx("textarea",{"data-slot":"textarea",className:C("flex field-sizing-content min-h-16 w-full rounded-lg border border-input bg-transparent px-2.5 py-2 text-base transition-colors outline-none placeholder:text-muted-foreground focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:bg-input/50 disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 md:text-sm dark:bg-input/30 dark:disabled:bg-input/80 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40",s),...t})}const Ot={open:"Open",progress:"In progress",review:"In review",resolved:"Resolved"};function Lt(s,t,a={}){const c=a.fence??((u,w)=>w),x=a.statusLabel??(u=>Ot[u]??u),o=s.anchor??{},l=s.context??{},k=o.page,d=k?.route??s.route??"/",h=k?.origin??t.origin??"",y=k?.pathname??d,i=h?`${h}${y}`:y,f=typeof o.label=="string"?c("label",o.label):"",v=o.element??o,r=[];r.push(`# ${s.key}${f?` — ${f}`:""}`),r.push(""),r.push(`${t.name} · ${x(s.status)} · left by ${s.createdBy?.name?c("name",s.createdBy.name):"someone"} on ${s.createdAt.slice(0,10)}`+(s.assignee?` · assigned to ${c("name",s.assignee.name)}`:"")),r.push(""),r.push("## Where to look"),r.push(""),r.push(`- Page: ${i}`),h&&r.push(`- Open on the page: ${h}${y}?${ss("t")}=${encodeURIComponent(s.key)}`),f&&r.push(`- Element: ${f}`);const S=typeof o.css=="string"?o.css:typeof v.selector=="string"?v.selector:"";if(S&&r.push(`- Selector: \`${c("selector",S)}\``),typeof o.domid=="string"&&r.push(`- DOM id: \`#${c("selector",o.domid)}\``),typeof v.role=="string"){const u=typeof v.accessibleName=="string"?` “${c("label",v.accessibleName)}”`:"";r.push(`- Role: ${c("label",v.role)}${u}`)}typeof v.testId=="string"&&r.push(`- Test id: ${c("label",v.testId)}`);const F=o.text;F?.exact&&r.push(`- Text: “${c("label",F.exact)}”`),r.push(`- Anchor: ${s.anchorState??"unknown"}`),r.push(""),r.push("## What's wrong"),r.push("");const $=(s.comments??[]).filter(u=>u.body!==null);$.length===0&&r.push("> (no comment — a pin with no words)");for(const u of $){const w=u.author?.name?c("name",u.author.name):"Anonymous";r.push(`> **${w}${u.author?.kind==="agent"?" (agent)":""}** — ${u.createdAt.slice(0,16).replace("T"," ")}`);for(const p of c("body",String(u.body)).split(`
37
37
  `))r.push(`> ${p}`);r.push(">")}r[r.length-1]===">"&&r.pop(),r.push(""),r.push("## Environment"),r.push("");const I=l.derived,N=l.viewport;(I?.browser||I?.os)&&r.push(`- Browser: ${[I.browser,I.os,I.device].filter(Boolean).join(" · ")}`),N?.w&&r.push(`- Viewport: ${N.w} × ${N.h}${N.dpr?` @${Math.round(N.dpr*10)/10}x`:""}`),l.prefersColorScheme&&r.push(`- Colour scheme: ${l.prefersColorScheme}`),l.language&&r.push(`- Language: ${l.language}`),l.ua&&r.push(`- User agent: ${c("label",String(l.ua))}`);const E=l.build;E&&Object.keys(E).length&&r.push(`- Build: ${Object.entries(E).map(([u,w])=>`${u}=${c("label",String(w))}`).join(", ")}`),r.push("");const B=l.breadcrumbs;if(B?.length){r.push(`## Breadcrumbs (${B.length}, oldest first)`),r.push("");for(const u of B)r.push(`- \`${String(u.t).slice(11,19)}\` ${u.type}${u.level?`/${u.level}`:""}: ${c("breadcrumb",String(u.message))}`);r.push("")}const D=s.attachments?.find(u=>u.kind==="screenshot")??s.attachments?.[0];if(D){r.push("## Screenshot"),r.push(""),r.push("Examine this screenshot for visual context — it is the viewport at the moment of the click."),r.push("");const u=D.url.startsWith("http")?D.url:`${t.dashboardOrigin??""}${D.url}`;r.push(`![${s.key}${D.width?` at ${D.width}×${D.height}`:""}](${u})`),r.push("")}return r.join(`
38
38
  `).trimEnd()+`
39
- `}function Vt(s,t){return Lt(s,t,{statusLabel:a=>ut(a)?ae[a]:a})}function qt({thread:s,site:t,onStatus:a,onReply:c,replying:x,onClose:o,pool:l,onAssign:k,onAddPerson:d,trackers:h,onCreateIssue:y,creatingIssue:i}){const f=s.anchor??{},v=s.context??{},r=typeof f.label=="string"?f.label:"",S=f.page,F=S?.route??s.route??"/",$=S?.origin??t.origin,I=$?`${$}${S?.pathname??F}?${ss("t")}=${encodeURIComponent(s.key)}`:"",N=s.attachments?.find(p=>p.kind==="screenshot")??s.attachments?.[0],[E,B]=g.useState(""),[D,u]=g.useState(""),w=()=>{navigator.clipboard?.writeText(Vt(s,{name:t.name,...$?{origin:$}:{},dashboardOrigin:location.origin})),ts.success("Copied as a brief")};return e.jsxs("article",{className:"flex min-h-0 flex-col","aria-label":`${s.key} — ${r||"a comment"}`,children:[e.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border/60 px-4 py-2.5",children:[e.jsx("span",{className:"font-mono text-[12px] text-muted-foreground",children:s.key}),e.jsx(Ut,{status:s.status,onStatus:a}),e.jsx(Jt,{assignee:s.assignee??null,pool:l,onAssign:k,onAddPerson:d}),(h??[]).map(p=>{const O=s.refs?.find(P=>P.provider===p&&P.kind===Ts[p]&&P.status!=="detached");if(O){const P=p==="github"?`Issue #${O.externalId}`:p==="jira"?O.externalId:p==="slack"?"Slack message":/\/issue\/([A-Z][A-Z0-9]*-\d+)/.exec(O.url)?.[1]??`${He[p]} issue`;return e.jsxs(R,{variant:"ghost",size:"sm",render:e.jsx("a",{href:O.url,target:"_blank",rel:"noreferrer"}),children:[e.jsx(Ye,{}),P]},p)}return y?e.jsx(R,{variant:"ghost",size:"sm",disabled:!!i,onClick:()=>y(p),children:i===p?p==="slack"?"Posting…":"Creating…":p==="slack"?"Post to Slack":`Create ${He[p]} issue`},p):null}),e.jsx("div",{className:"flex-1"}),e.jsxs(R,{variant:"ghost",size:"sm",onClick:w,children:[e.jsx(mt,{}),"Copy as brief"]}),e.jsx(R,{variant:"ghost",size:"icon-sm","aria-label":"Close",onClick:o,children:e.jsx(st,{})})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-5 overflow-auto px-4 py-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[16px] font-semibold leading-snug tracking-tight",children:r||"A comment on this page"}),e.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-[12.5px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:F}),$&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("a",{href:`${$}${S?.pathname??F}`,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-brand hover:underline",children:[$.replace(/^https?:\/\//,""),e.jsx(Ye,{className:"size-3"})]})]}),I&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("a",{href:I,target:"_blank",rel:"noreferrer",className:"text-brand hover:underline",children:"Open on the page"})]})]})]}),e.jsxs("section",{className:"flex flex-col gap-3",children:[s.comments.length===0&&e.jsx("p",{className:"m-0 text-muted-foreground",children:"A pin with no words — the element says what it is about."}),s.comments.map(p=>e.jsxs("div",{className:"flex gap-2.5",children:[e.jsx(te,{className:"size-6 shrink-0",children:e.jsx(ne,{className:C("text-[10px] font-semibold",p.author.kind==="agent"?"bg-muted text-ink-soft":"bg-brand-soft text-brand"),children:ue(p.author.name,"?")})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-baseline gap-2 text-[12px] text-muted-foreground",children:[e.jsx("b",{className:"text-[13px] font-semibold text-foreground",children:p.author.name||"Anonymous"}),p.author.kind==="agent"&&e.jsx("span",{className:"rounded-sm bg-muted px-1 text-[10.5px] font-medium uppercase tracking-wide",children:"agent"}),e.jsx("span",{children:ve(p.createdAt)})]}),e.jsx("p",{className:"m-0 whitespace-pre-wrap text-[13.5px] leading-normal",children:p.body??e.jsx("i",{className:"text-muted-foreground",children:"deleted"})})]})]},p.id)),e.jsxs("form",{className:"flex gap-2.5",onSubmit:async p=>{p.preventDefault();const O=E.trim();if(!(!O||x)){u("");try{await c(O),B("")}catch(P){u(P instanceof Error?P.message:"Could not send that reply.")}}},children:[e.jsx(te,{className:"size-6 shrink-0",children:e.jsx(ne,{className:"bg-primary text-[10px] font-semibold text-primary-foreground",children:"you"})}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2 rounded-md border border-input bg-card p-2",children:[e.jsx(Ft,{"aria-label":"Reply",placeholder:`Reply to ${s.createdBy.name||"the reviewer"}…`,value:E,onChange:p=>B(p.target.value),rows:2,className:"min-h-0 resize-none border-0 bg-transparent p-1 shadow-none focus-visible:ring-0"}),D&&e.jsx("p",{role:"alert",className:"m-0 text-[12px] text-destructive",children:D}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.status==="resolved"?e.jsx(R,{type:"button",variant:"ghost",size:"sm",onClick:()=>a("open"),children:"Reopen"}):e.jsxs(e.Fragment,{children:[s.status!=="review"&&e.jsx(R,{type:"button",variant:"ghost",size:"sm",onClick:()=>a("review"),children:"Mark in review"}),e.jsx(R,{type:"button",variant:"ghost",size:"sm",onClick:()=>a("resolved"),children:"Mark resolved"})]}),e.jsx(R,{type:"submit",size:"sm",disabled:!E.trim()||x,children:x?"Sending…":"Reply"})]})]})]})]}),e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx(Fe,{children:"Screenshot"}),N?e.jsxs(e.Fragment,{children:[e.jsx("a",{href:N.url,target:"_blank",rel:"noreferrer",className:"block overflow-hidden rounded-lg border border-border bg-background",children:e.jsx("img",{src:N.url,alt:`The page when ${s.key} was left`,width:N.width,height:N.height,loading:"lazy",className:"block h-auto w-full"})}),e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:[N.width??"?"," × ",N.height??"?",v.prefersColorScheme?` · ${v.prefersColorScheme}`:""," · taken at the click, ",ve(s.createdAt)," ·"," ",e.jsx("a",{href:N.url,target:"_blank",rel:"noreferrer",className:"text-brand hover:underline",children:"open full size"})]})]}):e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-dashed border-border px-3 py-3 text-[12.5px] text-muted-foreground",children:[e.jsx(xt,{className:"size-4 shrink-0"}),e.jsx("span",{children:"No screenshot for this one — either no bucket was connected when it was left, or the reviewer turned the picture off. The element and the environment below are unaffected."})]}),e.jsx(Kt,{ctx:v})]}),e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx(Fe,{children:"Element"}),e.jsxs("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:[r&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Label"}),e.jsx("dd",{className:"m-0",children:r})]}),typeof f.css=="string"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Selector"}),e.jsx("dd",{className:"m-0 break-all font-mono text-[12px] text-ink-soft",children:f.css})]}),typeof f.domid=="string"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"DOM id"}),e.jsxs("dd",{className:"m-0 font-mono text-[12px] text-ink-soft",children:["#",f.domid]})]}),typeof f.role=="string"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Role"}),e.jsxs("dd",{className:"m-0",children:[f.role,typeof f.accessibleName=="string"?` “${f.accessibleName}”`:""]})]}),f.text?.exact&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Text"}),e.jsxs("dd",{className:"m-0",children:["“",String(f.text.exact),"”"]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Anchor"}),e.jsx("dd",{className:"m-0",children:e.jsx(Wt,{state:s.anchorState})})]})]}),e.jsx(Gt,{ctx:v}),e.jsx(Ht,{ctx:v})]})]})}function Ut({status:s,onStatus:t}){return e.jsxs(Y,{children:[e.jsx(ee,{render:e.jsx("button",{type:"button",className:"inline-flex items-center rounded-full","aria-label":"Status"}),children:e.jsx(ms,{status:s})}),e.jsx(se,{align:"start",className:"w-[180px]",children:e.jsx(Be,{value:s,onValueChange:a=>t(a),children:fe.map(a=>e.jsx(X,{value:a,children:ae[a]},a))})})]})}function Wt({state:s}){const t=s==="anchored"?"bg-ok-soft text-ok":s==="approximate"?"bg-muted text-ink-soft":"bg-warn-soft text-destructive",a=s==="anchored"?"Anchored":s==="approximate"?"Approximate":s==="orphaned"?"Orphaned":s;return e.jsx("span",{className:C("rounded-full px-2 py-0.5 text-[11.5px] font-medium",t),children:a})}function Kt({ctx:s}){const t=s.capture;if(!t)return null;const a=[];return t.screenshot&&t.screenshot!=="ok"&&a.push(`Screenshot ${t.screenshot}${t.reasons?.length?` — ${t.reasons.join("; ")}`:""}`),t.breadcrumbs&&t.breadcrumbs!=="ok"&&a.push(`Breadcrumbs ${t.breadcrumbs}`),t.blindSpots?.length&&a.push(`${t.blindSpots.length} blind spot${t.blindSpots.length===1?"":"s"}: ${t.blindSpots.join("; ")}`),t.droppedCategories?.length&&a.push(`Dropped: ${t.droppedCategories.join(", ")}`),a.length?e.jsx("ul",{className:"m-0 list-none p-0 text-[12px] text-caution",children:a.map(c=>e.jsx("li",{children:c},c))}):null}function Gt({ctx:s}){const t=s.derived,a=s.viewport,c=s.build,x=[];return t?.browser||t?.os?x.push(["Browser",[t.browser,t.os,t.device].filter(Boolean).join(" · ")]):s.ua&&x.push(["User agent",String(s.ua)]),a?.w&&x.push(["Viewport",`${a.w} × ${a.h}${a.dpr?` @${Math.round(a.dpr*10)/10}x`:""}`]),s.language&&x.push(["Language",String(s.language)]),c&&Object.keys(c).length&&x.push(["Build",Object.entries(c).map(([o,l])=>`${o} ${String(l)}`).join(" · ")]),x.length?e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Fe,{children:"Environment"}),e.jsx("button",{type:"button",className:"text-[11.5px] text-brand hover:underline",onClick:()=>{navigator.clipboard?.writeText(JSON.stringify(s,null,2)),ts.success("Copied the environment")},children:"copy as JSON"})]}),e.jsx("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:x.map(([o,l])=>e.jsxs("span",{className:"contents",children:[e.jsx("dt",{className:"text-muted-foreground",children:o}),e.jsx("dd",{className:C("m-0",o==="Build"&&"font-mono text-[12px] text-ink-soft"),children:l})]},o))})]}):null}function Ht({ctx:s}){const t=s.breadcrumbs,[a,c]=g.useState(!1);if(!t?.length)return null;const x=t.filter(o=>o.level==="error"||o.type==="error").length;return e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsxs("button",{type:"button",className:"flex items-center gap-2 rounded-md border border-border px-3 py-2 text-left text-[13px] text-ink-soft","aria-expanded":a,onClick:()=>c(!a),children:[e.jsx(pt,{className:C("size-3.5 text-muted-foreground transition-transform",a&&"rotate-90")}),t.length," breadcrumb",t.length===1?"":"s",x>0?` · ${x} error${x===1?"":"s"} before the click`:"",e.jsx("span",{className:"ml-auto text-[12px] text-muted-foreground",children:a?"hide":"show"})]}),a&&e.jsx("ol",{className:"m-0 flex list-none flex-col gap-1 p-0 font-mono text-[11.5px]",children:t.map((o,l)=>e.jsxs("li",{className:C("flex gap-2",(o.level==="error"||o.type==="error")&&"text-destructive"),children:[e.jsx("span",{className:"shrink-0 text-muted-foreground",children:o.t.slice(11,19)}),e.jsxs("span",{className:"shrink-0 w-14 text-muted-foreground",children:[o.type,o.level?`/${o.level}`:""]}),e.jsx("span",{className:"min-w-0 break-words",children:o.message})]},l))})]})}function Jt({assignee:s,pool:t,onAssign:a,onAddPerson:c}){const[x,o]=g.useState(!1),l=t.find(i=>i.isMe),k=t.filter(i=>i.isTeam),d=t.filter(i=>!i.isTeam),h=i=>a({id:i.id,name:i.name,kind:i.kind,isTeam:i.isTeam}),y=i=>e.jsxs(G,{onClick:()=>h(i),children:[e.jsx(te,{className:"size-4",children:e.jsx(ne,{className:C("text-[8px] font-semibold",i.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ue(i.name,i.email)})}),e.jsx("span",{className:"truncate",children:i.isMe?`${i.name} (you)`:i.name}),s?.id===i.id&&e.jsx(as,{className:"ml-auto size-3.5"})]},i.id);return e.jsxs(e.Fragment,{children:[e.jsxs(Y,{children:[e.jsx(ee,{render:e.jsx(R,{variant:"ghost",size:"sm","aria-label":s?`Assignee: ${s.name}`:"Assignee"}),children:s?e.jsxs(e.Fragment,{children:[e.jsx(te,{className:"size-4",children:e.jsx(ne,{className:C("text-[8px] font-semibold",s.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ue(s.name)})}),e.jsx("span",{className:"max-w-[150px] truncate",children:s.name})]}):e.jsxs(e.Fragment,{children:[e.jsx(Rt,{}),"Assign"]})}),e.jsxs(se,{align:"start",className:"min-w-56",children:[l&&s?.id!==l.id||s?e.jsxs(ce,{children:[l&&s?.id!==l.id&&e.jsx(G,{onClick:()=>h(l),children:"Assign to me"}),s&&e.jsx(G,{onClick:()=>a(null),children:"Unassign"})]}):null,k.length>0&&e.jsxs(ce,{children:[e.jsx(_e,{children:"The studio"}),k.map(y)]}),d.length>0&&e.jsxs(ce,{children:[e.jsx(_e,{children:"People who commented"}),d.map(y)]}),e.jsx(us,{}),e.jsx(ce,{children:e.jsxs(G,{onClick:()=>o(!0),children:[e.jsx(At,{}),"Add a person…"]})})]})]}),e.jsx(Qt,{open:x,onOpenChange:o,onAdd:async i=>{const f=await c(i);h(f)}})]})}function Qt({open:s,onOpenChange:t,onAdd:a}){const[c,x]=g.useState(""),[o,l]=g.useState(""),[k,d]=g.useState(!1),[h,y]=g.useState(""),i=async f=>{if(f.preventDefault(),!(!c.trim()||k)){d(!0),y("");try{await a({name:c.trim(),...o.trim()?{email:o.trim()}:{}}),x(""),l(""),t(!1)}catch(v){y(v instanceof Bs?v.message:"Could not add the person.")}finally{d(!1)}}};return e.jsx(rs,{open:s,onOpenChange:t,children:e.jsx(os,{children:e.jsxs("form",{onSubmit:f=>void i(f),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(is,{children:[e.jsx(ls,{children:"Add a person"}),e.jsx(ds,{children:"Somebody to assign comments to who has not commented yet — your client, before they have said anything. If they later open a review link with this email, their comments join up."})]}),h&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:h}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Te,{htmlFor:"person-name",children:"Name"}),e.jsx(je,{id:"person-name",placeholder:"Sofia",value:c,onChange:f=>x(f.target.value),autoFocus:!0})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Te,{htmlFor:"person-email",children:"Email (optional)"}),e.jsx(je,{id:"person-email",type:"email",placeholder:"sofia@acme.com",value:o,onChange:f=>l(f.target.value)})]}),e.jsxs(cs,{children:[e.jsx(R,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),e.jsx(R,{type:"submit",disabled:!c.trim()||k,children:k?"Adding…":"Add and assign"})]})]})})})}function Xt({rounds:s,active:t,onPick:a,onStart:c,starting:x}){const o=s.find(i=>i.number===t),l=(s[0]?.number??0)+1,[k,d]=g.useState(!1),[h,y]=g.useState("");return e.jsxs(e.Fragment,{children:[e.jsxs(Y,{children:[e.jsxs(ee,{render:e.jsx("button",{type:"button",className:"inline-flex h-7 items-center gap-1.5 rounded-md border border-line-strong bg-muted px-2.5 text-[12.5px] font-semibold text-foreground","aria-label":"Round"}),children:[e.jsx(St,{className:"size-3.5"}),o?.name??`Round ${t}`,e.jsx(ge,{className:"size-3 text-muted-foreground"})]}),e.jsxs(se,{align:"start",className:"w-[260px]",children:[e.jsxs(ce,{children:[e.jsx(_e,{children:"Rounds"}),s.map(i=>e.jsxs(G,{onClick:()=>a(i.number),children:[e.jsx("span",{className:"truncate",children:i.name}),e.jsxs("span",{className:"ml-auto text-[11.5px] text-muted-foreground",children:[i.closed?"closed":"open",i.unresolved>0?` · ${i.unresolved} to go`:""]})]},i.id))]}),e.jsx(us,{}),e.jsxs(G,{onClick:()=>{y(`Round ${l}`),d(!0)},children:["Start a new round…",e.jsx("span",{className:"ml-auto text-[11.5px] text-muted-foreground",children:"closes this one"})]})]})]}),o&&e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[o.closed?"closed":"open",o.unresolved>0?` · ${o.unresolved} to go`:o.closed?"":" · all clear"]}),e.jsx(rs,{open:k,onOpenChange:d,children:e.jsx(os,{children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:i=>{i.preventDefault(),!(!h.trim()||x)&&(c(h.trim()),d(!1))},children:[e.jsxs(is,{children:[e.jsx(ls,{children:"Start a new round"}),e.jsxs(ds,{children:["A round is one pass of feedback. Starting the next one closes ",o?.name??"the current one","; what is still open there stays counted, not carried over."]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Te,{htmlFor:"round-name",children:"Name"}),e.jsx(je,{id:"round-name",value:h,onChange:i=>y(i.target.value),autoFocus:!0})]}),e.jsxs(cs,{children:[e.jsx(R,{type:"button",variant:"outline",onClick:()=>d(!1),children:"Cancel"}),e.jsx(R,{type:"submit",disabled:!h.trim()||x,children:x?"Starting…":"Start the round"})]})]})})})]})}Ws({thread:ie().optional(),status:ie().optional(),page:ie().optional(),q:ie().optional(),sort:Xe(["newest","oldest"]).optional(),round:Ks().int().positive().optional(),assignee:ie().optional(),view:Xe(["board"]).optional()});const hs={open:"bg-status-open",progress:"bg-status-progress",review:"bg-status-review",resolved:"bg-status-resolved"};function $n(){const{site:s}=Je.useParams(),t=Je.useSearch(),a=_s(),x=ft().projects.find(n=>n.uid===s),o=le(he.origins(s)),l=le(he.rounds(s)),k=le(he.assignees(s)),d=le(he.siteIntegrations(s)),h=k.data?.data??[],y=h.find(n=>n.isMe)?.id,i=t.round??l.data?.data[0]?.number,f=g.useMemo(()=>({...i!==void 0?{round:i}:{},...t.page?{route:t.page}:{},...t.q?{q:t.q}:{}}),[i,t.page,t.q]),v=le({...Qe(s,f),enabled:l.isSuccess}),r=Qe(s,f).queryKey,S=Fs(s,r),F=Os(r),$=Ls(s,r),I=Vs(s),N=qs(s,r),E=Us(s),[B,D]=g.useState(new Set),u=n=>void a({to:"/s/$site/comments",params:{site:s},search:m=>({...m,...n}),replace:!0}),w=v.data?.data??[],p=g.useMemo(()=>new Set((t.status??"").split(",").filter(Boolean)),[t.status]),O=g.useMemo(()=>{const n=new Map;for(const m of w)n.set(m.status,(n.get(m.status)??0)+1);return n},[w]),P=g.useMemo(()=>[...new Set(w.map(n=>Oe(n)))].sort(),[w]),_=g.useMemo(()=>{let n=p.size?w.filter(m=>p.has(m.status)):w;return t.assignee==="unassigned"?n=n.filter(m=>!m.assignee):t.assignee==="me"?n=n.filter(m=>!!y&&m.assignee?.id===y):t.assignee&&(n=n.filter(m=>m.assignee?.id===t.assignee)),t.sort==="oldest"&&(n=[...n].reverse()),n},[w,p,t.sort,t.assignee,y]),ke=g.useMemo(()=>{const n=new Map;for(const m of _){const j=Oe(m);n.has(j)||n.set(j,[]),n.get(j).push(m)}return[...n.entries()]},[_]),A=t.thread?w.find(n=>n.key===t.thread)??null:null,ye=p.size>0||!!t.page||!!t.q||!!t.assignee,Ne=(l.data?.data??[]).filter(n=>n.number!==i&&n.unresolved>0),we=n=>{const m=new Set(p);m.has(n)?m.delete(n):m.add(n),u({status:[...m].join(",")||void 0})},Ce=async n=>{const m=[...B];D(new Set);for(const j of m)await S.mutateAsync({id:j,status:n}).catch(()=>{})};g.useEffect(()=>{const n=m=>{if(m.metaKey||m.ctrlKey||m.altKey)return;const j=m.target;if(j&&(j.closest("input,textarea,select,[contenteditable]")||j.isContentEditable))return;const T=m.key.toLowerCase();if(T!=="j"&&T!=="k"&&T!=="e"||_.length===0)return;if(m.preventDefault(),T==="e"){if(!A)return;S.mutate({id:A.id,status:A.status==="resolved"?"open":"resolved"});return}const L=A?_.findIndex(z=>z.id===A.id):-1,M=T==="j"?Math.min(L+1,_.length-1):Math.max(L-1,0),q=_[L===-1?0:M];q&&u({thread:q.key})};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)});const W=t.view==="board",Se=g.useMemo(()=>fe.map(n=>({status:n,items:_.filter(m=>m.status===n)})),[_]);return e.jsxs("div",{className:"flex h-[calc(100dvh-3rem)] min-h-0 flex-col",children:[e.jsx("div",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-border/60 px-4 py-2",children:B.size>0?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-[13px] font-medium",children:[B.size," selected"]}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"Move to"}),fe.map(n=>e.jsx(R,{variant:"outline",size:"sm",onClick:()=>void Ce(n),children:ae[n]},n)),e.jsx(R,{variant:"ghost",size:"sm",onClick:()=>D(new Set),children:"Clear"})]}):e.jsxs(e.Fragment,{children:[l.data&&l.data.data.length>0&&i!==void 0&&e.jsx(Xt,{rounds:l.data.data,active:i,onPick:n=>u({round:n,thread:void 0}),onStart:n=>E.mutate(n,{onSuccess:m=>u({round:m.number,thread:void 0,status:void 0})}),starting:E.isPending}),e.jsx("span",{className:"mx-1 h-[18px] w-px bg-border"}),e.jsxs(Pe,{on:p.size===0,onClick:()=>u({status:void 0}),children:["All ",e.jsx("span",{className:"text-muted-foreground",children:w.length})]}),fe.map(n=>e.jsxs(Pe,{on:p.has(n),onClick:()=>we(n),children:[e.jsx("span",{className:C("size-[7px] rounded-full",hs[n])}),ae[n]," ",e.jsx("span",{className:"text-muted-foreground",children:O.get(n)??0})]},n)),e.jsx("div",{className:"flex-1"}),e.jsxs(Pe,{on:W,onClick:()=>u({view:W?void 0:"board"}),children:[W?e.jsx(wt,{className:"size-3.5"}):e.jsx(vt,{className:"size-3.5"}),W?"List":"Board"]}),e.jsx(Yt,{value:t.q??"",onChange:n=>u({q:n||void 0})}),P.length>1&&e.jsxs(Y,{children:[e.jsxs(ee,{render:e.jsx("button",{type:"button",className:be(!!t.page)}),children:[t.page??"All pages",e.jsx(ge,{className:"size-3 text-muted-foreground"})]}),e.jsxs(se,{align:"end",children:[e.jsx(G,{onClick:()=>u({page:void 0}),children:"All pages"}),P.map(n=>e.jsx(G,{onClick:()=>u({page:n}),children:e.jsx("span",{className:"font-mono text-[12px]",children:n})},n))]})]}),e.jsxs(Y,{children:[e.jsxs(ee,{render:e.jsx("button",{type:"button",className:be(!!t.assignee),"aria-label":"Filter by assignee"}),children:[Zt(t.assignee,h),e.jsx(ge,{className:"size-3 text-muted-foreground"})]}),e.jsx(se,{align:"end",children:e.jsxs(Be,{value:t.assignee??"any",onValueChange:n=>u({assignee:n==="any"?void 0:n}),children:[e.jsx(X,{value:"any",children:"Anyone"}),e.jsx(X,{value:"unassigned",children:"Unassigned"}),y&&e.jsx(X,{value:"me",children:"Me"}),h.filter(n=>!n.isMe).map(n=>e.jsx(X,{value:n.id,children:n.name},n.id))]})})]}),e.jsxs(Y,{children:[e.jsxs(ee,{render:e.jsx("button",{type:"button",className:be(!1)}),children:[t.sort==="oldest"?"Oldest":"Newest",e.jsx(ge,{className:"size-3 text-muted-foreground"})]}),e.jsx(se,{align:"end",children:e.jsxs(Be,{value:t.sort??"newest",onValueChange:n=>u({sort:n==="oldest"?"oldest":void 0}),children:[e.jsx(X,{value:"newest",children:"Newest first"}),e.jsx(X,{value:"oldest",children:"Oldest first"})]})})]})]})}),Ne.map(n=>e.jsxs("button",{type:"button",className:"shrink-0 border-b border-border/60 bg-brand-soft px-4 py-1.5 text-left text-[12.5px] text-foreground",onClick:()=>u({round:n.number,thread:void 0}),children:[e.jsxs("b",{className:"font-semibold",children:[n.unresolved," unresolved"]})," in ",n.name," — still open, not carried over."," ",e.jsx("span",{className:"text-brand",children:"Go there"})]},n.id)),e.jsxs("div",{className:C("grid min-h-0 flex-1",A?"grid-cols-1 lg:grid-cols-[minmax(0,1fr)_520px]":"grid-cols-1"),children:[e.jsxs("div",{className:C("min-h-0 overflow-auto lg:border-r lg:border-border",A&&"hidden lg:block"),children:[v.isPending&&e.jsx(sn,{}),v.isError&&e.jsx(Ee,{title:"Could not load the comments",children:v.error.message}),v.isSuccess&&w.length===0&&!ye&&e.jsx("div",{className:"mx-auto max-w-[560px] py-8",children:e.jsxs(Ee,{icon:e.jsx(yt,{className:"size-5"}),title:"No comments yet",children:[e.jsxs("p",{className:"m-0",children:["When someone leaves a comment on ",x.name," it appears here, grouped by page."]}),e.jsx("div",{className:"mt-4 text-left",children:e.jsx(ht,{uid:s})})]})}),v.isSuccess&&w.length>0&&_.length===0&&e.jsx(Ee,{title:"Nothing matches",action:e.jsx(R,{variant:"outline",size:"sm",onClick:()=>u({status:void 0,page:void 0,q:void 0,assignee:void 0}),children:"Show all"}),children:"No comment matches that filter."}),W&&v.isSuccess&&_.length>0&&e.jsx(tn,{columns:Se,uid:s,selectedId:A?.id??null,onMove:(n,m)=>S.mutate({id:n,status:m})}),!W&&ke.map(([n,m])=>e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-0 z-10 flex items-center gap-2 border-b border-border/60 bg-background px-4 py-2 font-mono text-[12px] text-ink-soft",children:[n," ",e.jsxs("span",{className:"font-sans text-muted-foreground",children:["· ",m.length]})]}),m.map(j=>e.jsx(en,{t:j,uid:s,on:A?.id===j.id,picked:B.has(j.id),picking:B.size>0,onPick:T=>D(L=>{const M=new Set(L);return T?M.add(j.id):M.delete(j.id),M})},j.id))]},n))]}),A&&e.jsxs("div",{className:"min-h-0 overflow-hidden bg-card",children:[e.jsx("div",{className:"lg:hidden",children:e.jsxs(R,{variant:"ghost",size:"sm",className:"m-2",onClick:()=>u({thread:void 0}),children:[e.jsx(gt,{}),"Back to the list"]})}),e.jsx(qt,{thread:A,site:{name:x.name,...o.data?.origins[0]?{origin:o.data.origins[0]}:{}},onStatus:n=>S.mutate({id:A.id,status:n}),onReply:n=>F.mutateAsync({id:A.id,body:n}),replying:F.isPending,pool:h,onAssign:n=>$.mutate({id:A.id,assignee:n}),onAddPerson:n=>I.mutateAsync(n),trackers:(d.data?.data??[]).map(n=>n.provider),onCreateIssue:n=>N.mutate({id:A.id,provider:n}),creatingIssue:N.isPending?N.variables?.provider:void 0,onClose:()=>u({thread:void 0})})]})]})]})}function Zt(s,t){return s?s==="unassigned"?"Unassigned":s==="me"?"Me":t.find(a=>a.id===s)?.name??"Assignee":"Assignee"}function Oe(s){return s.anchor?.page?.route??s.route??"/"}function be(s){return C("inline-flex h-7 items-center gap-1.5 whitespace-nowrap rounded-md border border-border bg-card px-2.5 text-[12.5px] font-medium text-ink-soft",s&&"border-line-strong bg-muted text-foreground")}function Pe({on:s,onClick:t,children:a}){return e.jsx("button",{type:"button",className:be(s),"aria-pressed":s,onClick:t,children:a})}function Yt({value:s,onChange:t}){const[a,c]=g.useState(s);return e.jsxs("form",{className:"relative",onSubmit:x=>{x.preventDefault(),t(a.trim())},children:[e.jsx(ct,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),e.jsx(je,{type:"search","aria-label":"Search comments",placeholder:"Search",value:a,onChange:x=>c(x.target.value),onBlur:()=>a.trim()!==s&&t(a.trim()),className:"h-7 w-[170px] pl-7 text-[12.5px]"})]})}function en({t:s,uid:t,on:a,picked:c,picking:x,onPick:o}){const l=s.comments[0]?.body??(typeof s.anchor?.label=="string"?s.anchor.label:"(no comment)"),k=s.comments[0]?.body&&typeof s.anchor?.label=="string"?s.anchor.label:"";return e.jsxs("div",{className:C("group grid h-12 grid-cols-[22px_56px_minmax(0,1fr)_auto] items-center gap-2.5 border-b border-border/60 bg-card px-4 hover:bg-accent/60",a&&"bg-brand-soft hover:bg-brand-soft"),children:[e.jsx("span",{className:C("flex items-center",!x&&"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),children:e.jsx(_t,{checked:c,onCheckedChange:d=>o(!!d),"aria-label":`Select ${s.key}`})}),e.jsxs(ns,{to:"/s/$site/comments",params:{site:t},search:d=>({...d,thread:s.key}),className:"contents text-foreground",children:[e.jsx("span",{className:"font-mono text-[11.5px] text-muted-foreground",children:s.key}),e.jsxs("span",{className:"truncate text-[13.5px]",children:[l,k&&e.jsx("small",{className:"ml-2 text-[12px] text-muted-foreground",children:k})]}),e.jsxs("span",{className:"flex items-center gap-2.5 text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"hidden sm:inline",children:s.createdBy.name||"someone"}),s.assignee&&e.jsx(te,{className:"size-5",title:`Assigned to ${s.assignee.name}`,children:e.jsx(ne,{className:C("text-[9px] font-semibold",s.assignee.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ue(s.assignee.name)})}),e.jsx(ms,{status:s.status}),e.jsx("span",{className:"w-11 whitespace-nowrap text-right",children:ve(s.updatedAt)})]})]})]})}function sn(){return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"flex items-center border-b border-border/60 bg-background px-4 py-2",children:e.jsx(de,{className:"h-3 w-16"})}),[70,55,80,62].map((s,t)=>e.jsxs("div",{className:"grid h-12 grid-cols-[22px_56px_minmax(0,1fr)_auto] items-center gap-2.5 border-b border-border/60 px-4",children:[e.jsx("span",{}),e.jsx(de,{className:"h-3 w-10"}),e.jsx(de,{className:"h-3",style:{width:`${s}%`}}),e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(de,{className:"h-3 w-11"}),e.jsx(de,{className:"h-[18px] w-16 rounded-full"})]})]},t))]})}function tn({columns:s,uid:t,selectedId:a,onMove:c}){const[x,o]=g.useState(null);return e.jsx("div",{className:"flex h-full min-h-0 gap-3 overflow-x-auto p-3",children:s.map(({status:l,items:k})=>e.jsxs("section",{"aria-label":ae[l],onDragOver:d=>{d.preventDefault(),o(l)},onDragLeave:()=>o(d=>d===l?null:d),onDrop:d=>{d.preventDefault(),o(null);const h=d.dataTransfer.getData("text/plain");h&&c(h,l)},className:C("flex w-[280px] shrink-0 flex-col rounded-lg border border-border bg-muted/40",x===l&&"border-brand bg-brand-soft"),children:[e.jsxs("h3",{className:"m-0 flex items-center gap-2 px-3 py-2 text-[12px] font-medium",children:[e.jsx("span",{className:C("size-[7px] rounded-full",hs[l])}),ae[l],e.jsx("span",{className:"text-muted-foreground",children:k.length})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-auto p-2 pt-0",children:[k.length===0&&e.jsx("p",{className:"m-0 px-1 py-3 text-[12px] text-muted-foreground",children:"Nothing here."}),k.map(d=>e.jsxs(ns,{to:"/s/$site/comments",params:{site:t},search:h=>({...h,thread:d.key}),draggable:!0,onDragStart:h=>{h.dataTransfer.setData("text/plain",d.id),h.dataTransfer.effectAllowed="move"},className:C("flex cursor-grab flex-col gap-1.5 rounded-md border border-border bg-card p-2.5 text-foreground no-underline active:cursor-grabbing",a===d.id&&"border-brand ring-1 ring-brand"),children:[e.jsx("span",{className:"line-clamp-3 text-[13px]",children:d.comments[0]?.body??(typeof d.anchor?.label=="string"?d.anchor.label:"(no comment)")}),e.jsxs("span",{className:"flex items-center gap-2 text-[11.5px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:d.key}),e.jsx("span",{className:"truncate",children:Oe(d)}),e.jsx("span",{className:"flex-1"}),d.assignee&&e.jsx(te,{className:"size-4",title:`Assigned to ${d.assignee.name}`,children:e.jsx(ne,{className:C("text-[8px] font-semibold",d.assignee.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ue(d.assignee.name)})}),e.jsx("span",{children:ve(d.updatedAt)})]})]},d.id))]})]},l))})}export{$n as component,ut as isStatus};
39
+ `}function Vt(s,t){return Lt(s,t,{statusLabel:a=>ut(a)?ae[a]:a})}function qt({thread:s,site:t,onStatus:a,onReply:c,replying:x,onClose:o,pool:l,onAssign:k,onAddPerson:d,trackers:h,onCreateIssue:y,creatingIssue:i}){const f=s.anchor??{},v=s.context??{},r=typeof f.label=="string"?f.label:"",S=f.page,F=S?.route??s.route??"/",$=S?.origin??t.origin,I=$?`${$}${S?.pathname??F}?${ss("t")}=${encodeURIComponent(s.key)}`:"",N=s.attachments?.find(p=>p.kind==="screenshot")??s.attachments?.[0],[E,B]=g.useState(""),[D,u]=g.useState(""),w=()=>{navigator.clipboard?.writeText(Vt(s,{name:t.name,...$?{origin:$}:{},dashboardOrigin:location.origin})),ts.success("Copied as a brief")};return e.jsxs("article",{className:"flex min-h-0 flex-col","aria-label":`${s.key} — ${r||"a comment"}`,children:[e.jsxs("div",{className:"flex shrink-0 items-center gap-2 border-b border-border/60 px-4 py-2.5",children:[e.jsx("span",{className:"font-mono text-[12px] text-muted-foreground",children:s.key}),e.jsx(Ut,{status:s.status,onStatus:a}),e.jsx(Jt,{assignee:s.assignee??null,pool:l,onAssign:k,onAddPerson:d}),(h??[]).map(p=>{const O=s.refs?.find(P=>P.provider===p&&P.kind===Ts[p]&&P.status!=="detached");if(O){const P=p==="github"?`Issue #${O.externalId}`:p==="jira"?O.externalId:p==="slack"?"Slack message":/\/issue\/([A-Z][A-Z0-9]*-\d+)/.exec(O.url)?.[1]??`${He[p]} issue`;return e.jsxs(R,{variant:"ghost",size:"sm",render:e.jsx("a",{href:O.url,target:"_blank",rel:"noreferrer"}),children:[e.jsx(Ye,{}),P]},p)}return y?e.jsx(R,{variant:"ghost",size:"sm",disabled:!!i,onClick:()=>y(p),children:i===p?p==="slack"?"Posting…":"Creating…":p==="slack"?"Post to Slack":`Create ${He[p]} issue`},p):null}),e.jsx("div",{className:"flex-1"}),e.jsxs(R,{variant:"ghost",size:"sm",onClick:w,children:[e.jsx(mt,{}),"Copy as brief"]}),e.jsx(R,{variant:"ghost",size:"icon-sm","aria-label":"Close",onClick:o,children:e.jsx(ot,{})})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-5 overflow-auto px-4 py-4",children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[16px] font-semibold leading-snug tracking-tight",children:r||"A comment on this page"}),e.jsxs("div",{className:"mt-1.5 flex flex-wrap items-center gap-x-2 gap-y-1 text-[12.5px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:F}),$&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsxs("a",{href:`${$}${S?.pathname??F}`,target:"_blank",rel:"noreferrer",className:"inline-flex items-center gap-1 text-brand hover:underline",children:[$.replace(/^https?:\/\//,""),e.jsx(Ye,{className:"size-3"})]})]}),I&&e.jsxs(e.Fragment,{children:[e.jsx("span",{children:"·"}),e.jsx("a",{href:I,target:"_blank",rel:"noreferrer",className:"text-brand hover:underline",children:"Open on the page"})]})]})]}),e.jsxs("section",{className:"flex flex-col gap-3",children:[s.comments.length===0&&e.jsx("p",{className:"m-0 text-muted-foreground",children:"A pin with no words — the element says what it is about."}),s.comments.map(p=>e.jsxs("div",{className:"flex gap-2.5",children:[e.jsx(te,{className:"size-6 shrink-0",children:e.jsx(ne,{className:C("text-[10px] font-semibold",p.author.kind==="agent"?"bg-muted text-ink-soft":"bg-brand-soft text-brand"),children:ue(p.author.name,"?")})}),e.jsxs("div",{className:"min-w-0 flex-1",children:[e.jsxs("div",{className:"flex items-baseline gap-2 text-[12px] text-muted-foreground",children:[e.jsx("b",{className:"text-[13px] font-semibold text-foreground",children:p.author.name||"Anonymous"}),p.author.kind==="agent"&&e.jsx("span",{className:"rounded-sm bg-muted px-1 text-[10.5px] font-medium uppercase tracking-wide",children:"agent"}),e.jsx("span",{children:ve(p.createdAt)})]}),e.jsx("p",{className:"m-0 whitespace-pre-wrap text-[13.5px] leading-normal",children:p.body??e.jsx("i",{className:"text-muted-foreground",children:"deleted"})})]})]},p.id)),e.jsxs("form",{className:"flex gap-2.5",onSubmit:async p=>{p.preventDefault();const O=E.trim();if(!(!O||x)){u("");try{await c(O),B("")}catch(P){u(P instanceof Error?P.message:"Could not send that reply.")}}},children:[e.jsx(te,{className:"size-6 shrink-0",children:e.jsx(ne,{className:"bg-primary text-[10px] font-semibold text-primary-foreground",children:"you"})}),e.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-2 rounded-md border border-input bg-card p-2",children:[e.jsx(Ft,{"aria-label":"Reply",placeholder:`Reply to ${s.createdBy.name||"the reviewer"}…`,value:E,onChange:p=>B(p.target.value),rows:2,className:"min-h-0 resize-none border-0 bg-transparent p-1 shadow-none focus-visible:ring-0"}),D&&e.jsx("p",{role:"alert",className:"m-0 text-[12px] text-destructive",children:D}),e.jsxs("div",{className:"flex items-center justify-end gap-2",children:[s.status==="resolved"?e.jsx(R,{type:"button",variant:"ghost",size:"sm",onClick:()=>a("open"),children:"Reopen"}):e.jsxs(e.Fragment,{children:[s.status!=="review"&&e.jsx(R,{type:"button",variant:"ghost",size:"sm",onClick:()=>a("review"),children:"Mark in review"}),e.jsx(R,{type:"button",variant:"ghost",size:"sm",onClick:()=>a("resolved"),children:"Mark resolved"})]}),e.jsx(R,{type:"submit",size:"sm",disabled:!E.trim()||x,children:x?"Sending…":"Reply"})]})]})]})]}),e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx(Fe,{children:"Screenshot"}),N?e.jsxs(e.Fragment,{children:[e.jsx("a",{href:N.url,target:"_blank",rel:"noreferrer",className:"block overflow-hidden rounded-lg border border-border bg-background",children:e.jsx("img",{src:N.url,alt:`The page when ${s.key} was left`,width:N.width,height:N.height,loading:"lazy",className:"block h-auto w-full"})}),e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:[N.width??"?"," × ",N.height??"?",v.prefersColorScheme?` · ${v.prefersColorScheme}`:""," · taken at the click, ",ve(s.createdAt)," ·"," ",e.jsx("a",{href:N.url,target:"_blank",rel:"noreferrer",className:"text-brand hover:underline",children:"open full size"})]})]}):e.jsxs("div",{className:"flex items-center gap-3 rounded-lg border border-dashed border-border px-3 py-3 text-[12.5px] text-muted-foreground",children:[e.jsx(xt,{className:"size-4 shrink-0"}),e.jsx("span",{children:"No screenshot for this one — either no bucket was connected when it was left, or the reviewer turned the picture off. The element and the environment below are unaffected."})]}),e.jsx(Kt,{ctx:v})]}),e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsx(Fe,{children:"Element"}),e.jsxs("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:[r&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Label"}),e.jsx("dd",{className:"m-0",children:r})]}),typeof f.css=="string"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Selector"}),e.jsx("dd",{className:"m-0 break-all font-mono text-[12px] text-ink-soft",children:f.css})]}),typeof f.domid=="string"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"DOM id"}),e.jsxs("dd",{className:"m-0 font-mono text-[12px] text-ink-soft",children:["#",f.domid]})]}),typeof f.role=="string"&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Role"}),e.jsxs("dd",{className:"m-0",children:[f.role,typeof f.accessibleName=="string"?` “${f.accessibleName}”`:""]})]}),f.text?.exact&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Text"}),e.jsxs("dd",{className:"m-0",children:["“",String(f.text.exact),"”"]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Anchor"}),e.jsx("dd",{className:"m-0",children:e.jsx(Wt,{state:s.anchorState})})]})]}),e.jsx(Gt,{ctx:v}),e.jsx(Ht,{ctx:v})]})]})}function Ut({status:s,onStatus:t}){return e.jsxs(Y,{children:[e.jsx(ee,{render:e.jsx("button",{type:"button",className:"inline-flex items-center rounded-full","aria-label":"Status"}),children:e.jsx(ms,{status:s})}),e.jsx(se,{align:"start",className:"w-[180px]",children:e.jsx(Be,{value:s,onValueChange:a=>t(a),children:fe.map(a=>e.jsx(Z,{value:a,children:ae[a]},a))})})]})}function Wt({state:s}){const t=s==="anchored"?"bg-ok-soft text-ok":s==="approximate"?"bg-muted text-ink-soft":"bg-warn-soft text-destructive",a=s==="anchored"?"Anchored":s==="approximate"?"Approximate":s==="orphaned"?"Orphaned":s;return e.jsx("span",{className:C("rounded-full px-2 py-0.5 text-[11.5px] font-medium",t),children:a})}function Kt({ctx:s}){const t=s.capture;if(!t)return null;const a=[];return t.screenshot&&t.screenshot!=="ok"&&a.push(`Screenshot ${t.screenshot}${t.reasons?.length?` — ${t.reasons.join("; ")}`:""}`),t.breadcrumbs&&t.breadcrumbs!=="ok"&&a.push(`Breadcrumbs ${t.breadcrumbs}`),t.blindSpots?.length&&a.push(`${t.blindSpots.length} blind spot${t.blindSpots.length===1?"":"s"}: ${t.blindSpots.join("; ")}`),t.droppedCategories?.length&&a.push(`Dropped: ${t.droppedCategories.join(", ")}`),a.length?e.jsx("ul",{className:"m-0 list-none p-0 text-[12px] text-caution",children:a.map(c=>e.jsx("li",{children:c},c))}):null}function Gt({ctx:s}){const t=s.derived,a=s.viewport,c=s.build,x=[];return t?.browser||t?.os?x.push(["Browser",[t.browser,t.os,t.device].filter(Boolean).join(" · ")]):s.ua&&x.push(["User agent",String(s.ua)]),a?.w&&x.push(["Viewport",`${a.w} × ${a.h}${a.dpr?` @${Math.round(a.dpr*10)/10}x`:""}`]),s.language&&x.push(["Language",String(s.language)]),c&&Object.keys(c).length&&x.push(["Build",Object.entries(c).map(([o,l])=>`${o} ${String(l)}`).join(" · ")]),x.length?e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx(Fe,{children:"Environment"}),e.jsx("button",{type:"button",className:"text-[11.5px] text-brand hover:underline",onClick:()=>{navigator.clipboard?.writeText(JSON.stringify(s,null,2)),ts.success("Copied the environment")},children:"copy as JSON"})]}),e.jsx("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:x.map(([o,l])=>e.jsxs("span",{className:"contents",children:[e.jsx("dt",{className:"text-muted-foreground",children:o}),e.jsx("dd",{className:C("m-0",o==="Build"&&"font-mono text-[12px] text-ink-soft"),children:l})]},o))})]}):null}function Ht({ctx:s}){const t=s.breadcrumbs,[a,c]=g.useState(!1);if(!t?.length)return null;const x=t.filter(o=>o.level==="error"||o.type==="error").length;return e.jsxs("section",{className:"flex flex-col gap-2",children:[e.jsxs("button",{type:"button",className:"flex items-center gap-2 rounded-md border border-border px-3 py-2 text-left text-[13px] text-ink-soft","aria-expanded":a,onClick:()=>c(!a),children:[e.jsx(pt,{className:C("size-3.5 text-muted-foreground transition-transform",a&&"rotate-90")}),t.length," breadcrumb",t.length===1?"":"s",x>0?` · ${x} error${x===1?"":"s"} before the click`:"",e.jsx("span",{className:"ml-auto text-[12px] text-muted-foreground",children:a?"hide":"show"})]}),a&&e.jsx("ol",{className:"m-0 flex list-none flex-col gap-1 p-0 font-mono text-[11.5px]",children:t.map((o,l)=>e.jsxs("li",{className:C("flex gap-2",(o.level==="error"||o.type==="error")&&"text-destructive"),children:[e.jsx("span",{className:"shrink-0 text-muted-foreground",children:o.t.slice(11,19)}),e.jsxs("span",{className:"shrink-0 w-14 text-muted-foreground",children:[o.type,o.level?`/${o.level}`:""]}),e.jsx("span",{className:"min-w-0 break-words",children:o.message})]},l))})]})}function Jt({assignee:s,pool:t,onAssign:a,onAddPerson:c}){const[x,o]=g.useState(!1),l=t.find(i=>i.isMe),k=t.filter(i=>i.isTeam),d=t.filter(i=>!i.isTeam),h=i=>a({id:i.id,name:i.name,kind:i.kind,isTeam:i.isTeam}),y=i=>e.jsxs(G,{onClick:()=>h(i),children:[e.jsx(te,{className:"size-4",children:e.jsx(ne,{className:C("text-[8px] font-semibold",i.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ue(i.name,i.email)})}),e.jsx("span",{className:"truncate",children:i.isMe?`${i.name} (you)`:i.name}),s?.id===i.id&&e.jsx(as,{className:"ml-auto size-3.5"})]},i.id);return e.jsxs(e.Fragment,{children:[e.jsxs(Y,{children:[e.jsx(ee,{render:e.jsx(R,{variant:"ghost",size:"sm","aria-label":s?`Assignee: ${s.name}`:"Assignee"}),children:s?e.jsxs(e.Fragment,{children:[e.jsx(te,{className:"size-4",children:e.jsx(ne,{className:C("text-[8px] font-semibold",s.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ue(s.name)})}),e.jsx("span",{className:"max-w-[150px] truncate",children:s.name})]}):e.jsxs(e.Fragment,{children:[e.jsx(Rt,{}),"Assign"]})}),e.jsxs(se,{align:"start",className:"min-w-56",children:[l&&s?.id!==l.id||s?e.jsxs(ce,{children:[l&&s?.id!==l.id&&e.jsx(G,{onClick:()=>h(l),children:"Assign to me"}),s&&e.jsx(G,{onClick:()=>a(null),children:"Unassign"})]}):null,k.length>0&&e.jsxs(ce,{children:[e.jsx(_e,{children:"The studio"}),k.map(y)]}),d.length>0&&e.jsxs(ce,{children:[e.jsx(_e,{children:"People who commented"}),d.map(y)]}),e.jsx(us,{}),e.jsx(ce,{children:e.jsxs(G,{onClick:()=>o(!0),children:[e.jsx(At,{}),"Add a person…"]})})]})]}),e.jsx(Xt,{open:x,onOpenChange:o,onAdd:async i=>{const f=await c(i);h(f)}})]})}function Xt({open:s,onOpenChange:t,onAdd:a}){const[c,x]=g.useState(""),[o,l]=g.useState(""),[k,d]=g.useState(!1),[h,y]=g.useState(""),i=async f=>{if(f.preventDefault(),!(!c.trim()||k)){d(!0),y("");try{await a({name:c.trim(),...o.trim()?{email:o.trim()}:{}}),x(""),l(""),t(!1)}catch(v){y(v instanceof Bs?v.message:"Could not add the person.")}finally{d(!1)}}};return e.jsx(rs,{open:s,onOpenChange:t,children:e.jsx(os,{children:e.jsxs("form",{onSubmit:f=>void i(f),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(is,{children:[e.jsx(ls,{children:"Add a person"}),e.jsx(ds,{children:"Somebody to assign comments to who has not commented yet — your client, before they have said anything. If they later open a review link with this email, their comments join up."})]}),h&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:h}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Te,{htmlFor:"person-name",children:"Name"}),e.jsx(je,{id:"person-name",placeholder:"Sofia",value:c,onChange:f=>x(f.target.value),autoFocus:!0})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Te,{htmlFor:"person-email",children:"Email (optional)"}),e.jsx(je,{id:"person-email",type:"email",placeholder:"sofia@acme.com",value:o,onChange:f=>l(f.target.value)})]}),e.jsxs(cs,{children:[e.jsx(R,{type:"button",variant:"outline",onClick:()=>t(!1),children:"Cancel"}),e.jsx(R,{type:"submit",loading:k,disabled:!c.trim(),children:k?"Adding…":"Add and assign"})]})]})})})}function Zt({rounds:s,active:t,onPick:a,onStart:c,starting:x}){const o=s.find(i=>i.number===t),l=(s[0]?.number??0)+1,[k,d]=g.useState(!1),[h,y]=g.useState("");return e.jsxs(e.Fragment,{children:[e.jsxs(Y,{children:[e.jsxs(ee,{render:e.jsx("button",{type:"button",className:"inline-flex h-7 items-center gap-1.5 rounded-md border border-line-strong bg-muted px-2.5 text-[12.5px] font-semibold text-foreground","aria-label":"Round"}),children:[e.jsx(St,{className:"size-3.5"}),o?.name??`Round ${t}`,e.jsx(ge,{className:"size-3 text-muted-foreground"})]}),e.jsxs(se,{align:"start",className:"w-[260px]",children:[e.jsxs(ce,{children:[e.jsx(_e,{children:"Rounds"}),s.map(i=>e.jsxs(G,{onClick:()=>a(i.number),children:[e.jsx("span",{className:"truncate",children:i.name}),e.jsxs("span",{className:"ml-auto text-[11.5px] text-muted-foreground",children:[i.closed?"closed":"open",i.unresolved>0?` · ${i.unresolved} to go`:""]})]},i.id))]}),e.jsx(us,{}),e.jsxs(G,{onClick:()=>{y(`Round ${l}`),d(!0)},children:["Start a new round…",e.jsx("span",{className:"ml-auto text-[11.5px] text-muted-foreground",children:"closes this one"})]})]})]}),o&&e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[o.closed?"closed":"open",o.unresolved>0?` · ${o.unresolved} to go`:o.closed?"":" · all clear"]}),e.jsx(rs,{open:k,onOpenChange:d,children:e.jsx(os,{children:e.jsxs("form",{className:"flex flex-col gap-4",onSubmit:i=>{i.preventDefault(),!(!h.trim()||x)&&(c(h.trim()),d(!1))},children:[e.jsxs(is,{children:[e.jsx(ls,{children:"Start a new round"}),e.jsxs(ds,{children:["A round is one pass of feedback. Starting the next one closes ",o?.name??"the current one","; what is still open there stays counted, not carried over."]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(Te,{htmlFor:"round-name",children:"Name"}),e.jsx(je,{id:"round-name",value:h,onChange:i=>y(i.target.value),autoFocus:!0})]}),e.jsxs(cs,{children:[e.jsx(R,{type:"button",variant:"outline",onClick:()=>d(!1),children:"Cancel"}),e.jsx(R,{type:"submit",disabled:!h.trim()||x,children:x?"Starting…":"Start the round"})]})]})})})]})}Ws({thread:ie().optional(),status:ie().optional(),page:ie().optional(),q:ie().optional(),sort:Ze(["newest","oldest"]).optional(),round:Ks().int().positive().optional(),assignee:ie().optional(),view:Ze(["board"]).optional()});const hs={open:"bg-status-open",progress:"bg-status-progress",review:"bg-status-review",resolved:"bg-status-resolved"};function Cn(){const{site:s}=Je.useParams(),t=Je.useSearch(),a=_s(),x=ft().projects.find(n=>n.uid===s),o=le(he.origins(s)),l=le(he.rounds(s)),k=le(he.assignees(s)),d=le(he.siteIntegrations(s)),h=k.data?.data??[],y=h.find(n=>n.isMe)?.id,i=t.round??l.data?.data[0]?.number,f=g.useMemo(()=>({...i!==void 0?{round:i}:{},...t.page?{route:t.page}:{},...t.q?{q:t.q}:{}}),[i,t.page,t.q]),v=le({...Xe(s,f),enabled:l.isSuccess}),r=Xe(s,f).queryKey,S=Fs(s,r),F=Os(r),$=Ls(s,r),I=Vs(s),N=qs(s,r),E=Us(s),[B,D]=g.useState(new Set),u=n=>void a({to:"/s/$site/comments",params:{site:s},search:m=>({...m,...n}),replace:!0}),w=v.data?.data??[],p=g.useMemo(()=>new Set((t.status??"").split(",").filter(Boolean)),[t.status]),O=g.useMemo(()=>{const n=new Map;for(const m of w)n.set(m.status,(n.get(m.status)??0)+1);return n},[w]),P=g.useMemo(()=>[...new Set(w.map(n=>Oe(n)))].sort(),[w]),_=g.useMemo(()=>{let n=p.size?w.filter(m=>p.has(m.status)):w;return t.assignee==="unassigned"?n=n.filter(m=>!m.assignee):t.assignee==="me"?n=n.filter(m=>!!y&&m.assignee?.id===y):t.assignee&&(n=n.filter(m=>m.assignee?.id===t.assignee)),t.sort==="oldest"&&(n=[...n].reverse()),n},[w,p,t.sort,t.assignee,y]),ke=g.useMemo(()=>{const n=new Map;for(const m of _){const j=Oe(m);n.has(j)||n.set(j,[]),n.get(j).push(m)}return[...n.entries()]},[_]),A=t.thread?w.find(n=>n.key===t.thread)??null:null,ye=p.size>0||!!t.page||!!t.q||!!t.assignee,Ne=(l.data?.data??[]).filter(n=>n.number!==i&&n.unresolved>0),we=n=>{const m=new Set(p);m.has(n)?m.delete(n):m.add(n),u({status:[...m].join(",")||void 0})},Ce=async n=>{const m=[...B];D(new Set);for(const j of m)await S.mutateAsync({id:j,status:n}).catch(()=>{})};g.useEffect(()=>{const n=m=>{if(m.metaKey||m.ctrlKey||m.altKey)return;const j=m.target;if(j&&(j.closest("input,textarea,select,[contenteditable]")||j.isContentEditable))return;const T=m.key.toLowerCase();if(T!=="j"&&T!=="k"&&T!=="e"||_.length===0)return;if(m.preventDefault(),T==="e"){if(!A)return;S.mutate({id:A.id,status:A.status==="resolved"?"open":"resolved"});return}const L=A?_.findIndex(z=>z.id===A.id):-1,M=T==="j"?Math.min(L+1,_.length-1):Math.max(L-1,0),q=_[L===-1?0:M];q&&u({thread:q.key})};return document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)});const W=t.view==="board",Se=g.useMemo(()=>fe.map(n=>({status:n,items:_.filter(m=>m.status===n)})),[_]);return e.jsxs("div",{className:"flex h-[calc(100dvh-3rem)] min-h-0 flex-col",children:[e.jsx("div",{className:"flex shrink-0 flex-wrap items-center gap-2 border-b border-border/60 px-4 py-2",children:B.size>0?e.jsxs(e.Fragment,{children:[e.jsxs("span",{className:"text-[13px] font-medium",children:[B.size," selected"]}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"Move to"}),fe.map(n=>e.jsx(R,{variant:"outline",size:"sm",onClick:()=>void Ce(n),children:ae[n]},n)),e.jsx(R,{variant:"ghost",size:"sm",onClick:()=>D(new Set),children:"Clear"})]}):e.jsxs(e.Fragment,{children:[l.data&&l.data.data.length>0&&i!==void 0&&e.jsx(Zt,{rounds:l.data.data,active:i,onPick:n=>u({round:n,thread:void 0}),onStart:n=>E.mutate(n,{onSuccess:m=>u({round:m.number,thread:void 0,status:void 0})}),starting:E.isPending}),e.jsx("span",{className:"mx-1 h-[18px] w-px bg-border"}),e.jsxs(Pe,{on:p.size===0,onClick:()=>u({status:void 0}),children:["All ",e.jsx("span",{className:"text-muted-foreground",children:w.length})]}),fe.map(n=>e.jsxs(Pe,{on:p.has(n),onClick:()=>we(n),children:[e.jsx("span",{className:C("size-[7px] rounded-full",hs[n])}),ae[n]," ",e.jsx("span",{className:"text-muted-foreground",children:O.get(n)??0})]},n)),e.jsx("div",{className:"flex-1"}),e.jsxs(Pe,{on:W,onClick:()=>u({view:W?void 0:"board"}),children:[W?e.jsx(wt,{className:"size-3.5"}):e.jsx(vt,{className:"size-3.5"}),W?"List":"Board"]}),e.jsx(Yt,{value:t.q??"",onChange:n=>u({q:n||void 0})}),P.length>1&&e.jsxs(Y,{children:[e.jsxs(ee,{render:e.jsx("button",{type:"button",className:be(!!t.page)}),children:[t.page??"All pages",e.jsx(ge,{className:"size-3 text-muted-foreground"})]}),e.jsxs(se,{align:"end",children:[e.jsx(G,{onClick:()=>u({page:void 0}),children:"All pages"}),P.map(n=>e.jsx(G,{onClick:()=>u({page:n}),children:e.jsx("span",{className:"font-mono text-[12px]",children:n})},n))]})]}),e.jsxs(Y,{children:[e.jsxs(ee,{render:e.jsx("button",{type:"button",className:be(!!t.assignee),"aria-label":"Filter by assignee"}),children:[Qt(t.assignee,h),e.jsx(ge,{className:"size-3 text-muted-foreground"})]}),e.jsx(se,{align:"end",children:e.jsxs(Be,{value:t.assignee??"any",onValueChange:n=>u({assignee:n==="any"?void 0:n}),children:[e.jsx(Z,{value:"any",children:"Anyone"}),e.jsx(Z,{value:"unassigned",children:"Unassigned"}),y&&e.jsx(Z,{value:"me",children:"Me"}),h.filter(n=>!n.isMe).map(n=>e.jsx(Z,{value:n.id,children:n.name},n.id))]})})]}),e.jsxs(Y,{children:[e.jsxs(ee,{render:e.jsx("button",{type:"button",className:be(!1)}),children:[t.sort==="oldest"?"Oldest":"Newest",e.jsx(ge,{className:"size-3 text-muted-foreground"})]}),e.jsx(se,{align:"end",children:e.jsxs(Be,{value:t.sort??"newest",onValueChange:n=>u({sort:n==="oldest"?"oldest":void 0}),children:[e.jsx(Z,{value:"newest",children:"Newest first"}),e.jsx(Z,{value:"oldest",children:"Oldest first"})]})})]})]})}),Ne.map(n=>e.jsxs("button",{type:"button",className:"shrink-0 border-b border-border/60 bg-brand-soft px-4 py-1.5 text-left text-[12.5px] text-foreground",onClick:()=>u({round:n.number,thread:void 0}),children:[e.jsxs("b",{className:"font-semibold",children:[n.unresolved," unresolved"]})," in ",n.name," — still open, not carried over."," ",e.jsx("span",{className:"text-brand",children:"Go there"})]},n.id)),e.jsxs("div",{className:C("grid min-h-0 flex-1",A?"grid-cols-1 lg:grid-cols-[minmax(0,1fr)_520px]":"grid-cols-1"),children:[e.jsxs("div",{className:C("min-h-0 overflow-auto lg:border-r lg:border-border",A&&"hidden lg:block"),children:[v.isPending&&e.jsx(sn,{}),v.isError&&e.jsx(Ee,{title:"Could not load the comments",children:v.error.message}),v.isSuccess&&w.length===0&&!ye&&e.jsx("div",{className:"mx-auto max-w-[560px] py-8",children:e.jsxs(Ee,{icon:e.jsx(yt,{className:"size-5"}),title:"No comments yet",children:[e.jsxs("p",{className:"m-0",children:["When someone leaves a comment on ",x.name," it appears here, grouped by page."]}),e.jsx("div",{className:"mt-4 text-left",children:e.jsx(ht,{uid:s})})]})}),v.isSuccess&&w.length>0&&_.length===0&&e.jsx(Ee,{title:"Nothing matches",action:e.jsx(R,{variant:"outline",size:"sm",onClick:()=>u({status:void 0,page:void 0,q:void 0,assignee:void 0}),children:"Show all"}),children:"No comment matches that filter."}),W&&v.isSuccess&&_.length>0&&e.jsx(tn,{columns:Se,uid:s,selectedId:A?.id??null,onMove:(n,m)=>S.mutate({id:n,status:m})}),!W&&ke.map(([n,m])=>e.jsxs("div",{children:[e.jsxs("div",{className:"sticky top-0 z-10 flex items-center gap-2 border-b border-border/60 bg-background px-4 py-2 font-mono text-[12px] text-ink-soft",children:[n," ",e.jsxs("span",{className:"font-sans text-muted-foreground",children:["· ",m.length]})]}),m.map(j=>e.jsx(en,{t:j,uid:s,on:A?.id===j.id,picked:B.has(j.id),picking:B.size>0,onPick:T=>D(L=>{const M=new Set(L);return T?M.add(j.id):M.delete(j.id),M})},j.id))]},n))]}),A&&e.jsxs("div",{className:"min-h-0 overflow-hidden bg-card",children:[e.jsx("div",{className:"lg:hidden",children:e.jsxs(R,{variant:"ghost",size:"sm",className:"m-2",onClick:()=>u({thread:void 0}),children:[e.jsx(gt,{}),"Back to the list"]})}),e.jsx(qt,{thread:A,site:{name:x.name,...o.data?.origins[0]?{origin:o.data.origins[0]}:{}},onStatus:n=>S.mutate({id:A.id,status:n}),onReply:n=>F.mutateAsync({id:A.id,body:n}),replying:F.isPending,pool:h,onAssign:n=>$.mutate({id:A.id,assignee:n}),onAddPerson:n=>I.mutateAsync(n),trackers:(d.data?.data??[]).map(n=>n.provider),onCreateIssue:n=>N.mutate({id:A.id,provider:n}),creatingIssue:N.isPending?N.variables?.provider:void 0,onClose:()=>u({thread:void 0})})]})]})]})}function Qt(s,t){return s?s==="unassigned"?"Unassigned":s==="me"?"Me":t.find(a=>a.id===s)?.name??"Assignee":"Assignee"}function Oe(s){return s.anchor?.page?.route??s.route??"/"}function be(s){return C("inline-flex h-7 items-center gap-1.5 whitespace-nowrap rounded-md border border-border bg-card px-2.5 text-[12.5px] font-medium text-ink-soft",s&&"border-line-strong bg-muted text-foreground")}function Pe({on:s,onClick:t,children:a}){return e.jsx("button",{type:"button",className:be(s),"aria-pressed":s,onClick:t,children:a})}function Yt({value:s,onChange:t}){const[a,c]=g.useState(s);return e.jsxs("form",{className:"relative",onSubmit:x=>{x.preventDefault(),t(a.trim())},children:[e.jsx(ct,{className:"pointer-events-none absolute left-2 top-1/2 size-3.5 -translate-y-1/2 text-muted-foreground"}),e.jsx(je,{type:"search","aria-label":"Search comments",placeholder:"Search",value:a,onChange:x=>c(x.target.value),onBlur:()=>a.trim()!==s&&t(a.trim()),className:"h-7 w-[170px] pl-7 text-[12.5px]"})]})}function en({t:s,uid:t,on:a,picked:c,picking:x,onPick:o}){const l=s.comments[0]?.body??(typeof s.anchor?.label=="string"?s.anchor.label:"(no comment)"),k=s.comments[0]?.body&&typeof s.anchor?.label=="string"?s.anchor.label:"";return e.jsxs("div",{className:C("group grid h-12 grid-cols-[22px_56px_minmax(0,1fr)_auto] items-center gap-2.5 border-b border-border/60 bg-card px-4 hover:bg-accent/60",a&&"bg-brand-soft hover:bg-brand-soft"),children:[e.jsx("span",{className:C("flex items-center",!x&&"opacity-0 group-hover:opacity-100 focus-within:opacity-100"),children:e.jsx(_t,{checked:c,onCheckedChange:d=>o(!!d),"aria-label":`Select ${s.key}`})}),e.jsxs(ns,{to:"/s/$site/comments",params:{site:t},search:d=>({...d,thread:s.key}),className:"contents text-foreground",children:[e.jsx("span",{className:"font-mono text-[11.5px] text-muted-foreground",children:s.key}),e.jsxs("span",{className:"truncate text-[13.5px]",children:[l,k&&e.jsx("small",{className:"ml-2 text-[12px] text-muted-foreground",children:k})]}),e.jsxs("span",{className:"flex items-center gap-2.5 text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"hidden sm:inline",children:s.createdBy.name||"someone"}),s.assignee&&e.jsx(te,{className:"size-5",title:`Assigned to ${s.assignee.name}`,children:e.jsx(ne,{className:C("text-[9px] font-semibold",s.assignee.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ue(s.assignee.name)})}),e.jsx(ms,{status:s.status}),e.jsx("span",{className:"w-11 whitespace-nowrap text-right",children:ve(s.updatedAt)})]})]})]})}function sn(){return e.jsxs("div",{className:"flex flex-col",children:[e.jsx("div",{className:"flex items-center border-b border-border/60 bg-background px-4 py-2",children:e.jsx(de,{className:"h-3 w-16"})}),[70,55,80,62].map((s,t)=>e.jsxs("div",{className:"grid h-12 grid-cols-[22px_56px_minmax(0,1fr)_auto] items-center gap-2.5 border-b border-border/60 px-4",children:[e.jsx("span",{}),e.jsx(de,{className:"h-3 w-10"}),e.jsx(de,{className:"h-3",style:{width:`${s}%`}}),e.jsxs("div",{className:"flex items-center gap-2.5",children:[e.jsx(de,{className:"h-3 w-11"}),e.jsx(de,{className:"h-[18px] w-16 rounded-full"})]})]},t))]})}function tn({columns:s,uid:t,selectedId:a,onMove:c}){const[x,o]=g.useState(null);return e.jsx("div",{className:"flex h-full min-h-0 gap-3 overflow-x-auto p-3",children:s.map(({status:l,items:k})=>e.jsxs("section",{"aria-label":ae[l],onDragOver:d=>{d.preventDefault(),o(l)},onDragLeave:()=>o(d=>d===l?null:d),onDrop:d=>{d.preventDefault(),o(null);const h=d.dataTransfer.getData("text/plain");h&&c(h,l)},className:C("flex w-[280px] shrink-0 flex-col rounded-lg border border-border bg-muted/40",x===l&&"border-brand bg-brand-soft"),children:[e.jsxs("h3",{className:"m-0 flex items-center gap-2 px-3 py-2 text-[12px] font-medium",children:[e.jsx("span",{className:C("size-[7px] rounded-full",hs[l])}),ae[l],e.jsx("span",{className:"text-muted-foreground",children:k.length})]}),e.jsxs("div",{className:"flex min-h-0 flex-1 flex-col gap-2 overflow-auto p-2 pt-0",children:[k.length===0&&e.jsx("p",{className:"m-0 px-1 py-3 text-[12px] text-muted-foreground",children:"Nothing here."}),k.map(d=>e.jsxs(ns,{to:"/s/$site/comments",params:{site:t},search:h=>({...h,thread:d.key}),draggable:!0,onDragStart:h=>{h.dataTransfer.setData("text/plain",d.id),h.dataTransfer.effectAllowed="move"},className:C("flex cursor-grab flex-col gap-1.5 rounded-md border border-border bg-card p-2.5 text-foreground no-underline active:cursor-grabbing",a===d.id&&"border-brand ring-1 ring-brand"),children:[e.jsx("span",{className:"line-clamp-3 text-[13px]",children:d.comments[0]?.body??(typeof d.anchor?.label=="string"?d.anchor.label:"(no comment)")}),e.jsxs("span",{className:"flex items-center gap-2 text-[11.5px] text-muted-foreground",children:[e.jsx("span",{className:"font-mono",children:d.key}),e.jsx("span",{className:"truncate",children:Oe(d)}),e.jsx("span",{className:"flex-1"}),d.assignee&&e.jsx(te,{className:"size-4",title:`Assigned to ${d.assignee.name}`,children:e.jsx(ne,{className:C("text-[8px] font-semibold",d.assignee.isTeam?"bg-brand-soft text-brand":"bg-muted text-ink-soft"),children:ue(d.assignee.name)})}),e.jsx("span",{children:ve(d.updatedAt)})]})]},d.id))]})]},l))})}export{Cn as component,ut as isStatus};
@@ -0,0 +1 @@
1
+ import{ar as A,r as f,j as e,B as g,as as S,f as E,at as I,y as k,P,C as L,D as y}from"./index-B7_Oj3hr.js";import{u as C}from"./useQuery-CBgK187B.js";import{u as F,a as M}from"./zod-BUdBrC5l.js";import{C as D}from"./card-YnwmM74t.js";import{X as U,E as $,G as B,I as H,H as z,J as K,K as V}from"./dialog-BO8bYmy1.js";import{L as N,I as Y}from"./label-Dpq7t35_.js";import{T as q,a as G,b as T,c as p,d as J,e as j}from"./table-DdjoxL3-.js";import{C as O}from"./ConfirmDialog-ClUMXHe1.js";import{C as Q}from"./CopyButton-DCsj-LZV.js";import{P as X,E as W}from"./parts-C1QjM02Y.js";import{b as R}from"./labels--UUyt9uB.js";import{C as Z}from"./check-CLHnIgiu.js";import{U as _}from"./users-DDrXwrCG.js";import{P as ee}from"./plus-D247LXUb.js";import"./useBaseQuery-yj7uWlSz.js";import"./copy-ZOZ0pLVD.js";function be(){const{site:s}=A.useParams(),{site:d}=A.useRouteContext(),r=C(k.links(s)),l=C(k.origins(s)),[x,n]=f.useState(!1),[t,a]=f.useState(null);f.useEffect(()=>a(null),[s]);const i=r.data?.data??[],c=l.data?.origins[0]?.replace(/\/+$/,"")??"",m=t?`${c}/${t.fragment}`:"",v=e.jsxs(g,{onClick:()=>n(!0),children:[e.jsx(ee,{}),"Add reviewer"]});return e.jsxs("div",{className:"p-7",children:[e.jsx(X,{title:"Reviewers",sub:`Each reviewer gets their own link to ${d.name}`,actions:v}),t&&e.jsxs("div",{className:"mb-4 flex max-w-[1040px] items-center gap-3 rounded-lg border border-ok bg-ok-soft px-3.5 py-3",role:"status",children:[e.jsx(Z,{className:"size-4 shrink-0 text-ok"}),e.jsxs("div",{className:"shrink-0",children:[e.jsxs("b",{className:"font-semibold",children:[t.name," added."]})," ",e.jsx("span",{className:"text-ink-soft",children:"Share this link — it is shown once."})]}),e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md border border-border bg-card px-2.5 py-1.5 font-mono text-[12.5px]",children:m}),e.jsx(Q,{text:m,label:"Copy link",withText:!0}),e.jsx(g,{variant:"ghost",size:"icon-sm","aria-label":"Dismiss",onClick:()=>a(null),children:e.jsx(U,{})})]}),r.isSuccess&&i.length===0?e.jsx(D,{className:"max-w-[1040px]",children:e.jsx(W,{icon:e.jsx(_,{className:"size-5"}),title:"No reviewers yet",action:v,children:"Add your client and send them their link. They never need an account."})}):e.jsx(D,{className:"max-w-[1040px] overflow-hidden py-0",children:e.jsxs(q,{children:[e.jsx(G,{children:e.jsxs(T,{children:[e.jsx(p,{children:"Name"}),e.jsx(p,{children:"Status"}),e.jsx(p,{children:"Uses"}),e.jsx(p,{children:"Last seen"}),e.jsx(p,{className:"w-0"})]})}),e.jsx(J,{children:i.map(u=>e.jsx(se,{link:u,uid:s,onRevoked:()=>a(h=>h?.id===u.id?null:h)},u.id))})]})}),e.jsx("p",{className:"m-0 mt-3 max-w-[1040px] text-[12.5px] text-muted-foreground",children:"Revoking ends every session minted from the link within 10 seconds. The comments a reviewer left stay."}),e.jsx(ne,{uid:s,open:x,onOpenChange:n,onMinted:a})]})}function se({link:s,uid:d,onRevoked:r}){const l=S(d),[x,n]=f.useState(!1),t=!!s.revokedAt,a=!t&&new Date(s.expiresAt).getTime()<=Date.now(),i=t||a,c=Math.max(0,Math.ceil((new Date(s.expiresAt).getTime()-Date.now())/864e5));return e.jsxs(T,{className:E(i&&"text-muted-foreground"),children:[e.jsx(j,{className:"font-medium",children:s.name}),e.jsx(j,{children:t?e.jsxs("span",{children:["Revoked ",R(s.revokedAt)]}):a?e.jsx("span",{children:"Expired"}):e.jsxs("span",{children:[e.jsx("span",{className:"rounded-full bg-ok-soft px-2 py-0.5 text-[11.5px] font-medium text-ok",children:"Active"}),e.jsxs("span",{className:"ml-2 text-[12px] text-muted-foreground",children:["expires in ",c," day",c===1?"":"s"]})]})}),e.jsx(j,{children:s.useCount}),e.jsx(j,{className:"text-muted-foreground",children:s.lastUsedAt?R(s.lastUsedAt):"never"}),e.jsxs(j,{className:"text-right",children:[!t&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>n(!0),children:"Revoke"}),e.jsx(O,{open:x,onOpenChange:n,title:`Revoke ${s.name}'s link?`,description:`Every session minted from it ends within 10 seconds. The comments ${s.name} left stay. This cannot be undone — adding them again makes a new link.`,confirmLabel:"Revoke",busy:l.isPending,onConfirm:()=>{n(!1),r(),l.mutate(s.id)}})]})]})}const te=L({name:y().trim().min(1,"Their name"),days:y(),roundId:y().optional()});function ne({uid:s,open:d,onOpenChange:r,onMinted:l}){const x=I(s),n=C({...k.rounds(s),enabled:d}),[t,a]=f.useState(""),{register:i,handleSubmit:c,formState:m,reset:v}=F({resolver:M(te),defaultValues:{days:"14",roundId:""}}),u=c(async o=>{a("");const b=Number(o.days);try{const w=await x.mutateAsync({name:o.name,...Number.isFinite(b)&&b>0?{expiresAt:new Date(Date.now()+b*864e5).toISOString()}:{},...o.roundId?{roundId:o.roundId}:{}});l(w),v(),r(!1)}catch(w){a(P(w))}}),h="h-8 w-full rounded-md border border-input bg-card px-2.5 text-[13.5px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50";return e.jsx($,{open:d,onOpenChange:r,children:e.jsx(B,{children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(H,{children:[e.jsx(z,{children:"New reviewer"}),e.jsx(K,{children:"Your client's name, as you will see it on their comments. A link is generated once and shown to you once."})]}),t&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:t}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(N,{htmlFor:"reviewer-name",children:"Name"}),e.jsx(Y,{id:"reviewer-name",placeholder:"Marta, Kilnwork","aria-invalid":!!m.errors.name,...i("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(N,{htmlFor:"reviewer-days",children:"Link expires in"}),e.jsxs("select",{id:"reviewer-days",className:h,...i("days"),children:[e.jsx("option",{value:"7",children:"7 days"}),e.jsx("option",{value:"14",children:"14 days"}),e.jsx("option",{value:"30",children:"30 days"}),e.jsx("option",{value:"90",children:"90 days"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"You can revoke it at any time before that."})]}),n.data&&n.data.data.length>0&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(N,{htmlFor:"reviewer-round",children:"Pin to a round"}),e.jsxs("select",{id:"reviewer-round",className:h,...i("roundId"),children:[e.jsx("option",{value:"",children:"Any round"}),n.data.data.map(o=>e.jsx("option",{value:o.id,children:o.name},o.id))]})]}),e.jsxs(V,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>r(!1),children:"Cancel"}),e.jsx(g,{type:"submit",loading:m.isSubmitting,children:m.isSubmitting?"Adding…":"Add reviewer"})]})]})})})}export{be as component};
@@ -0,0 +1 @@
1
+ import{r as i,h as Pe,X as ie,Y as Me,d as de,W as Be,E as ce,i as pe,j as e,Z as We,e as U,ap as ve,av as Ge,f as me,aw as qe,ax as _e,B as Z,o as Ye,ay as ze,y as Ue}from"./index-B7_Oj3hr.js";import{u as $e}from"./useQuery-CBgK187B.js";import{f as De,h as Oe,j as Ae,u as Fe,A as Je,c as Qe,n as Xe,g as ye,e as Ze,k as et,l as tt,a as st,L as $,I as he}from"./label-Dpq7t35_.js";import{O as nt,L as rt,M as ot,N as it,A as at,aL as Re,ak as Ie,ad as ae,a9 as le,aM as Ce,aN as je,ao as lt,aO as ke,aa as dt,ab as ct,aP as we,aQ as Se,aR as Ne,aS as Ee,aT as ut,aU as ft,X as pt}from"./dialog-BO8bYmy1.js";import{b as mt,u as ht,C as gt}from"./CompositeItem-B5AtyrD6.js";import{u as xt}from"./useValueChanged-DQ0Iea1L.js";import{u as bt}from"./FieldItemContext-DVEWRsEB.js";import{u as vt}from"./useAriaLabelledBy-BNUj3f_d.js";import{C as yt}from"./ConfirmDialog-ClUMXHe1.js";import{C as Rt}from"./CopyButton-DCsj-LZV.js";import{I as It}from"./InstallTag-B_qg9P2r.js";import{S as Ct}from"./switch-ElcxbE6-.js";import{P as jt,a as ue}from"./parts-C1QjM02Y.js";import{S as kt}from"./SaveState-B-6cG0nU.js";import{u as wt}from"./me-DoCJgtG9.js";import{P as St}from"./plus-D247LXUb.js";import"./useBaseQuery-yj7uWlSz.js";import"./check-CLHnIgiu.js";import"./copy-ZOZ0pLVD.js";import"./card-YnwmM74t.js";import"./labels--UUyt9uB.js";const Nt=i.createContext(void 0);function Et(t=!1){const r=i.useContext(Nt);if(!r&&!t)throw new Error(Pe(86));return r}function Pt(t,r){return t.matches(":disabled")?!1:!r||t.form===r?!0:t.form===null&&!t.hasAttribute("form")}function Mt(t){return t==null||t.hasAttribute("disabled")||t.getAttribute("aria-disabled")==="true"}const fe={checked(t){return t?{"data-checked":""}:{"data-unchecked":""}},...nt,...De},Te="data-composite-item-active",Le=i.createContext(void 0);function Dt(){return i.useContext(Le)}function Ot(t){if(t==null)return"";if(typeof t=="string")return t;try{return JSON.stringify(t)}catch{return String(t)}}const Ve=i.createContext(void 0);function At(){const t=i.useContext(Ve);if(t===void 0)throw new Error(Pe(52));return t}const Ft=i.forwardRef(function(r,n){const{render:a,className:u,disabled:p=!1,readOnly:d=!1,required:m=!1,"aria-labelledby":o,value:v,inputRef:H,nativeButton:h=!1,id:T,style:P,...O}=r,A=Dt(),{disabled:w,readOnly:_,required:x,form:K,checkedValue:y,touched:M=!1,validation:B,name:I,setCheckedValue:q=ie,setTouched:Y=ie,registerInputRef:s=ie}=A??{},{setTouched:g,setFilled:b,state:C,disabled:S}=Oe(),N=bt(),{labelId:L,getDescriptionProps:J}=Ae(),c=S||N.disabled||w||p,f=_||d,F=x||m,V=K,j=A?y===v:v==="",D=i.useRef(null),k=i.useRef(null),W=B?.registerInput,G=i.useCallback(R=>W?.(R,{controlRef:D,value:void 0}),[W]),Q=Me(H,k,s,G);de(()=>{k.current?.checked&&b(!0)},[b]),de(()=>{if(k.current){if(c&&j){s(null);return}s(k.current)}},[j,c,s]);const ee=Fe(),te=Je({id:T,implicit:!1,controlRef:D}),se=h?void 0:te,ne=vt(o,L,k,!h,se),re={role:"radio","aria-checked":j,"aria-labelledby":ne,[Te]:j?"":void 0,id:h?te:ee,onKeyDown(R){R.key==="Enter"&&R.preventDefault()},onClick(R){if(R.defaultPrevented||c||f)return;R.preventDefault();const X=k.current;X&&We(X,R)},onFocus(R){R.defaultPrevented||c||f||!M||(k.current?.click(),Y(!1))}},{getButtonProps:oe,buttonRef:l}=Be({disabled:c,native:h,composite:!1}),E={type:"radio",ref:Q,form:V,id:se,name:I,tabIndex:-1,style:I?rt:ot,"aria-hidden":!0,...v!==void 0?{value:Ot(v)}:ce,disabled:c,checked:j,required:F,readOnly:f,onChange(R){if(R.nativeEvent.defaultPrevented||c||f||v===void 0)return;const X=Qe(Xe,R.nativeEvent);q(v,X),!X.isCanceled&&g(!0)},onClick(R){R.stopPropagation()},onFocus(){D.current?.focus()}},z=i.useMemo(()=>({...C,required:F,disabled:c,readOnly:f,checked:j}),[C,c,f,j,F]),He=z,ge=A!==void 0,xe=[n,D,l],be=[re,O,oe,J,B?R=>B.getValidationProps(c,R):ce],Ke=pe("span",r,{enabled:!ge,state:z,ref:xe,props:be,stateAttributesMapping:fe});return e.jsxs(Ve.Provider,{value:He,children:[ge?e.jsx(mt,{tag:"span",render:a,className:u,style:P,state:z,refs:xe,props:be,stateAttributesMapping:fe}):Ke,e.jsx("input",{...E,suppressHydrationWarning:!0})]})}),Tt=i.forwardRef(function(r,n){const{render:a,className:u,style:p,keepMounted:d=!1,...m}=r,o=At(),v=o.checked,{mounted:H,transitionStatus:h,setMounted:T}=it(v),P={...o,transitionStatus:h},O=i.useRef(null),A=d||H,w=pe("span",r,{ref:[n,O],state:P,props:m,stateAttributesMapping:fe});return at({open:v,ref:O,onComplete(){v||T(!1)}}),A?w:null}),Lt=[];function Vt(t){const{loopFocus:r=!0,orientation:n="both",grid:a,onLoop:u,direction:p,highlightedIndex:d,onHighlightedIndexChange:m,rootRef:o,enableHomeAndEndKeys:v=!1,stopEventPropagation:H,disabledIndices:h,modifierKeys:T=Lt}=t,[P,O]=i.useState(0),A=a!=null,w=i.useRef(null),_=Me(w,o),x=i.useRef([]),K=i.useRef(!1),y=d??P,M=U((s,g=!1)=>{if((m??O)(s),g){const b=x.current[s];Re(w.current,b,p,n)}}),B=U(s=>{if(s.size===0||K.current)return;K.current=!0;const g=Array.from(s.keys()),b=g.find(S=>S?.hasAttribute(Te))??null,C=b?s.get(b)?.index??-1:-1;if(C!==-1)M(C);else if(Ie(g,y,h)){const S=ae(g,{disabledIndices:h});le(g,S)||M(S)}Re(w.current,b,p,n)});de(()=>{if(h==null||d!=null||!K.current)return;const s=x.current;if(Ie(s,y,h)){const g=ae(s,{disabledIndices:h});le(s,g)||M(g)}},[h,d,y,x,M]);const I=U((s,g,b)=>u?u(s,g,b,x):b),q=U(s=>{const g=s.key===Ce||s.key===je;if(!lt.has(s.key)||!v&&g||Ht(s,T)||!w.current)return;const C=p==="rtl",S=C?Ne:Ee,N=C?Ee:Ne,L=n==="vertical"?we:S,J=n==="vertical"?Se:N,c=ye(s.nativeEvent);if(c!=null&&ke(c)&&!Mt(c)){const k=c.selectionStart,W=c.selectionEnd,G=c.value;if(k==null||s.shiftKey||k!==W||s.key!==J&&k<G.length||s.key!==L&&k>0)return}let f=y;const F=dt(x,h),V=ct(x,h);a!=null&&(f=a({disabledIndices:h,elementsRef:x,event:s,highlightedIndex:y,loopFocus:r,maxIndex:V,minIndex:F,onLoop:I,orientation:n,rtl:C}));const j=n!=="vertical"&&s.key===S||n!=="horizontal"&&s.key===we,D=n!=="vertical"&&s.key===N||n!=="horizontal"&&s.key===Se;v&&(s.key===Ce?f=F:s.key===je&&(f=V)),f===y&&(j||D)&&(r&&f===V&&j?(f=F,u&&(f=u(s,y,f,x))):r&&f===F&&D?(f=V,u&&(f=u(s,y,f,x))):f=ae(x.current,{startingIndex:f,decrement:D,disabledIndices:h})),f!==y&&!le(x.current,f)&&(H&&s.stopPropagation(),(A||g||j||D)&&s.preventDefault(),M(f,!0),queueMicrotask(()=>{x.current[f]?.focus()}))});return{props:{ref:_,onFocus(s){const g=w.current,b=ye(s.nativeEvent);!g||b==null||!ke(b)||b.setSelectionRange(0,b.value.length)},onKeyDown:q},highlightedIndex:y,onHighlightedIndexChange:M,elementsRef:x,onMapChange:B,relayKeyboardEvent:q}}function Ht(t,r){for(const n of ut)if(!r.includes(n)&&t.getModifierState(n))return!0;return!1}function Kt(t){const{render:r,className:n,style:a,refs:u=ve,props:p=ve,state:d=ce,stateAttributesMapping:m,highlightedIndex:o,onHighlightedIndexChange:v,orientation:H,grid:h,loopFocus:T,onLoop:P,enableHomeAndEndKeys:O,onMapChange:A,stopEventPropagation:w=!0,rootRef:_,disabledIndices:x,modifierKeys:K,highlightItemOnHover:y=!1,tag:M="div",...B}=t,I=ht(),{props:q,highlightedIndex:Y,onHighlightedIndexChange:s,elementsRef:g,onMapChange:b,relayKeyboardEvent:C}=Vt({grid:h,loopFocus:T,onLoop:P,orientation:H,highlightedIndex:o,onHighlightedIndexChange:v,rootRef:_,stopEventPropagation:w,enableHomeAndEndKeys:O,direction:I,disabledIndices:x,modifierKeys:K}),S=pe(M,t,{state:d,ref:u,props:[q,...p,B],stateAttributesMapping:m}),N=i.useMemo(()=>({highlightedIndex:Y,onHighlightedIndexChange:s,highlightItemOnHover:y,relayKeyboardEvent:C}),[Y,s,y,C]);return e.jsx(Ge.Provider,{value:N,children:e.jsx(gt,{elementsRef:g,onMapChange:L=>{A?.(L),b(L)},children:S})})}const Bt=[ft],Wt=i.forwardRef(function(r,n){const{render:a,className:u,disabled:p,readOnly:d,required:m,onValueChange:o,value:v,defaultValue:H,form:h,name:T,inputRef:P,id:O,style:A,...w}=r,{setTouched:_,setFocused:x,validationMode:K,name:y,disabled:M,state:B,validation:I,setDirty:q,setFilled:Y,validityData:s}=Oe(),{labelId:g}=Ae(),{clearErrors:b,elementRef:C}=Ze(),S=Et(!0),N=M||p,L=y??T,J=Fe(O),[c,f]=et({controlled:v,default:H,name:"RadioGroup",state:"value"}),[F,V]=i.useState(!1),j=U((l,E)=>{o?.(l,E),!E.isCanceled&&f(l)}),D=I.getInputControl,k=i.useMemo(()=>({get current(){return D()}}),[D]),W=i.useRef(null),G=i.useRef(null);function Q(l){let E;return P&&(typeof P=="function"?E=P(l):P.current=l),W.current=l,E}const ee=U(l=>{if(!l||l.disabled)return;G.current||(G.current=l);const E=W.current,z=l.checked||E==null||E.disabled?Q(l):void 0;return()=>{G.current===l&&(G.current=null),W.current===l?z?(z(),W.current=null):Q(null):z?.()}}),te=U(()=>{const l=C.current;if(!l)return c??null;for(const E of I.registeredInputs.keys())if(E.checked&&Pt(E,l))return c??null;return null});tt(k,J,c??null,te,!N,T),xt(c,()=>{b(L),q(c!==s.initialValue),Y(c!=null),I.change(c);const l=G.current;c==null&&l&&!l.disabled&&Q(l)});const se=g??S?.legendId,ne={...B,disabled:N??!1,required:m??!1,readOnly:d??!1},re=i.useMemo(()=>({checkedValue:c,disabled:N,form:h,validation:I,name:L,readOnly:d,registerInputRef:ee,required:m,setCheckedValue:j,setTouched:V,touched:F}),[c,N,h,I,L,d,ee,m,j,V,F]),oe={id:O,role:"radiogroup","aria-required":m||void 0,"aria-disabled":N||void 0,"aria-readonly":d||void 0,"aria-labelledby":se,onFocus(){x(!0)},onBlur(l){st(l.currentTarget,l.relatedTarget)||(_(!0),x(!1),K==="onBlur"&&I.commit(c))},onKeyDownCapture(l){l.key.startsWith("Arrow")&&(V(!0),x(!0))}};return e.jsx(Le.Provider,{value:re,children:e.jsx(Kt,{render:a,className:u,style:A,state:ne,props:[oe,w,l=>I.getValidationProps(N??!1,l)],refs:[n],stateAttributesMapping:De,enableHomeAndEndKeys:!1,modifierKeys:Bt})})});function Gt({className:t,...r}){return e.jsx(Wt,{"data-slot":"radio-group",className:me("grid w-full gap-2",t),...r})}function qt({className:t,...r}){return e.jsx(Ft,{"data-slot":"radio-group-item",className:me("group/radio-group-item peer relative flex aspect-square size-4 shrink-0 rounded-full border border-input outline-none group-has-[:focus-visible]/field-label:ring-0 group-has-[:focus-visible]/field-label:not-data-checked:border-input after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 aria-invalid:aria-checked:border-primary dark:bg-input/30 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:border-primary data-checked:bg-primary data-checked:text-primary-foreground group-has-[:focus-visible]/field-label:data-checked:border-primary dark:data-checked:bg-primary",t),...r,children:e.jsx(Tt,{"data-slot":"radio-group-indicator",className:"flex size-4 items-center justify-center",children:e.jsx("span",{className:"absolute top-1/2 left-1/2 size-2 -translate-x-1/2 -translate-y-1/2 rounded-full bg-primary-foreground"})})})}const _t=[{id:"open",title:"Everyone on the site",note:"The toolbar appears for every visitor on the addresses above. Simplest for a staging URL nobody else knows."},{id:"link-required",title:"Only reviewers with a link",note:"You add a reviewer and send them their link. Use this when staging is publicly reachable, or when one reviewer needs revoking without shutting the whole site."}];function xs(){const{site:t}=qe.useParams(),n=wt().projects.find(o=>o.uid===t),a=$e(Ue.origins(t)),u=_e(t),[p,d]=i.useState(null),m=o=>u.mutate(o,{onSuccess:()=>d(Date.now())});return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(jt,{title:"Settings",sub:n.name,actions:e.jsx(kt,{saving:u.isPending,savedAt:p})}),e.jsxs(ue,{title:"Site",description:"Its name, its ID for the tag, and where the widget may run.",children:[e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx($,{children:"Site ID"}),e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"rounded-md bg-muted px-2.5 py-1.5 font-mono text-[12.5px] text-ink-soft",children:n.uid}),e.jsx(Rt,{text:n.uid,label:"Copy the site ID"})]})]}),e.jsx(Yt,{name:n.name,onSave:o=>m({name:o})}),e.jsx(zt,{domain:a.data?.domain??null,loaded:a.isSuccess,onSave:o=>m({domain:o})}),e.jsx(Ut,{list:a.data?.origins??[],loaded:a.isSuccess,hasDomain:!!a.data?.domain,onChange:o=>m({origins:o})})]}),e.jsxs(ue,{title:"Widget",description:"Whether it runs, who the toolbar appears for, and the tag itself.",children:[e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2.5",children:[e.jsxs("div",{children:[e.jsx($,{htmlFor:"widget-on",className:"text-[13px] font-medium",children:"Widget on this site"}),e.jsx("p",{className:"m-0 mt-0.5 text-[12px] leading-normal text-muted-foreground",children:"Off hides the toolbar for everyone and refuses new comments. The tag can stay in the site's code."})]}),e.jsx(Ct,{id:"widget-on","aria-label":"Widget on this site",checked:n.status!=="paused",onCheckedChange:o=>m({status:o?"active":"paused"})})]}),e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx($,{children:"Who can comment"}),e.jsx(Gt,{value:n.writeMode,onValueChange:o=>m({writeMode:String(o)}),className:"gap-2",children:_t.map(o=>e.jsxs("label",{className:me("flex cursor-pointer items-start gap-2.5 rounded-md border border-border px-3 py-2.5",n.writeMode===o.id&&"border-brand bg-brand-soft"),children:[e.jsx(qt,{value:o.id,className:"mt-0.5","aria-label":o.title}),e.jsxs("span",{children:[e.jsx("span",{className:"block text-[13px] font-medium",children:o.title}),e.jsx("span",{className:"block text-[12px] leading-normal text-muted-foreground",children:o.note})]})]},o.id))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx($,{children:"The tag"}),e.jsx(It,{uid:n.uid}),e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:["Paste it before ",e.jsx("code",{className:"font-mono",children:"</body>"})," on every page you want reviewed."]})]})]}),e.jsx($t,{uid:t,name:n.name})]})}function Yt({name:t,onSave:r}){const[n,a]=i.useState(t);i.useEffect(()=>a(t),[t]);const u=n.trim().length>0&&n.trim()!==t;return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:p=>{p.preventDefault(),u&&r(n.trim())},children:[e.jsx($,{htmlFor:"site-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(he,{id:"site-name",value:n,onChange:p=>a(p.target.value)}),u&&e.jsx(Z,{type:"submit",variant:"outline",children:"Save"})]})]})}function zt({domain:t,loaded:r,onSave:n}){const[a,u]=i.useState(t??"");i.useEffect(()=>u(t??""),[t]);const p=a.trim()!==(t??"");return e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:d=>{d.preventDefault(),p&&n(a.trim()||null)},children:[e.jsx($,{htmlFor:"site-domain",children:"Domain"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(he,{id:"site-domain",placeholder:"kilnwork.studio",value:a,onChange:d=>u(d.target.value),disabled:!r}),p&&e.jsx(Z,{type:"submit",variant:"outline",children:a.trim()?"Save domain":"Clear domain"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Every subdomain, scheme and port of it may run the widget — staging, previews, and localhost while you build."})]})}function Ut({list:t,loaded:r,hasDomain:n,onChange:a}){const[u,p]=i.useState("");return e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx($,{htmlFor:"site-origin-add",children:"Also allowed"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Exact addresses the domain does not cover — a client's other host, a preview on somebody else's suffix."}),e.jsxs("ul",{className:"m-0 flex list-none flex-col gap-1.5 p-0",children:[t.map(d=>e.jsxs("li",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"rounded-md border border-border px-2 py-1 font-mono text-[12px]",children:d}),e.jsx(Z,{type:"button",variant:"ghost",size:"icon-sm","aria-label":`Remove ${d}`,disabled:t.length<=1&&!n,onClick:()=>a(t.filter(m=>m!==d)),children:e.jsx(pt,{})})]},d)),r&&t.length===0&&e.jsx("li",{className:"text-[12.5px] text-muted-foreground",children:n?"None besides the domain.":"No address yet."})]}),e.jsxs("form",{className:"flex gap-2",onSubmit:d=>{d.preventDefault();const m=u.trim();m&&(a([...t,m]),p(""))},children:[e.jsx(he,{id:"site-origin-add",placeholder:"https://staging.example.com",value:u,onChange:d=>p(d.target.value)}),e.jsxs(Z,{type:"submit",variant:"outline",disabled:!u.trim(),children:[e.jsx(St,{}),"Add"]})]})]})}function $t({uid:t,name:r}){const[n,a]=i.useState(!1),u=Ye(),p=ze(t);return e.jsxs(ue,{danger:!0,title:"Delete this site",description:e.jsxs(e.Fragment,{children:["The site stops appearing and its widget stops being served."," ",e.jsx("b",{className:"font-semibold text-foreground",children:"Nothing your client wrote is destroyed"})," — the comments stay in the database, so a mistake here is recoverable."]}),children:[e.jsxs("div",{className:"flex items-center gap-4",children:[e.jsx("p",{className:"m-0 flex-1 text-[13px] text-ink-soft",children:"You will be asked to type the site's name."}),e.jsxs(Z,{type:"button",variant:"outline",className:"border-destructive text-destructive",onClick:()=>a(!0),children:["Delete ",r,"…"]})]}),e.jsx(yt,{open:n,onOpenChange:a,title:`Delete ${r}?`,description:"The site stops appearing and its widget stops being served. Nothing your client wrote is destroyed — the comments stay in the database.",confirmLabel:"Delete",confirmWord:r,busy:p.isPending,onConfirm:()=>p.mutate(void 0,{onSuccess:()=>{a(!1),u({to:"/sites"})}})})]})}export{xs as component};
@@ -0,0 +1 @@
1
+ import{R as x,o as h,r as g,p as f,x as j,z as N,A as w,j as e,G as y,B as b,C as S,D as r}from"./index-B7_Oj3hr.js";import{u as v,a as A}from"./zod-BUdBrC5l.js";import{L as o,I as i}from"./label-Dpq7t35_.js";const C=S({email:r().trim().email("An email address"),password:r().min(12,"At least 12 characters"),orgName:r().trim().max(120).optional()});function E(){const{claim:c}=x.useSearch(),d=h(),[l,n]=g.useState(""),{register:s,handleSubmit:p,formState:a}=v({resolver:A(C)}),u=p(async t=>{n("");try{await f.setup({token:c??"",orgName:t.orgName||"My studio",projectName:"",email:t.email,password:t.password,address:location.origin}),j("in"),N.clear(),d({to:"/welcome",replace:!0})}catch(m){n(m instanceof w?m.message:"Something went wrong. Try again.")}});return e.jsx(y,{width:400,children:e.jsxs("form",{onSubmit:u,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Set up Snagset"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"This instance has not been claimed yet. The account you make here is the only one, until you add another."})]}),l&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:l}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(o,{htmlFor:"email",children:"Your email"}),e.jsx(i,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!a.errors.email,...s("email")}),a.errors.email&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:a.errors.email.message})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(o,{htmlFor:"password",children:"Password"}),e.jsx(i,{id:"password",type:"password",autoComplete:"new-password","aria-invalid":!!a.errors.password,...s("password")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. There is no reset email on a fresh install — keep it."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(o,{htmlFor:"orgName",children:["Studio name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(i,{id:"orgName",placeholder:"My studio",...s("orgName")})]}),e.jsx(b,{type:"submit",size:"lg",loading:a.isSubmitting,children:a.isSubmitting?"Setting up…":"Create my account"})]})})}export{E as component};
@@ -0,0 +1 @@
1
+ import{F as w,o as y,r as l,y as d,p as N,x as S,A as C,j as e,G as k,B as F,f as E,L,C as R,D as m}from"./index-B7_Oj3hr.js";import{u as c}from"./useQuery-CBgK187B.js";import{u as A,a as I}from"./zod-BUdBrC5l.js";import{L as u,I as p}from"./label-Dpq7t35_.js";import{C as z}from"./chevron-right-BX_QQNXH.js";import"./useBaseQuery-yj7uWlSz.js";const B=R({email:m().trim().min(1,"Your email"),password:m().min(1,"Your password")});function Q(){const{redirect:x}=w.useSearch(),r=y(),[a,o]=l.useState(""),[s,h]=l.useState(!1),{register:i,handleSubmit:f,formState:t}=A({resolver:I(B)});c({...d.claimed(),enabled:!0}).data===!1&&r({to:"/setup",replace:!0});const g=c(d.setupState()),j=f(async({email:b,password:v})=>{o("");try{await N.login(b,v),S("in"),r({to:x??"/sites",replace:!0})}catch(n){o(n instanceof C?n.message:"Could not reach the server.")}});return e.jsx(k,{children:e.jsxs("form",{onSubmit:j,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Sign in"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"The studio side. Reviewers don't sign in — they open a link."})]}),a&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:a}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(u,{htmlFor:"email",children:"Email"}),e.jsx(p,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!t.errors.email,...i("email")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(u,{htmlFor:"password",children:"Password"}),e.jsx(p,{id:"password",type:"password",autoComplete:"current-password","aria-invalid":!!t.errors.password,...i("password")})]}),e.jsx(F,{type:"submit",size:"lg",loading:t.isSubmitting,children:t.isSubmitting?"Signing in…":"Sign in"}),e.jsxs("button",{type:"button",className:"flex items-center gap-2 rounded-md border border-border px-3 py-2 text-left text-[13px] text-ink-soft","aria-expanded":s,onClick:()=>h(!s),children:[e.jsx(z,{className:E("size-3.5 text-muted-foreground transition-transform",s&&"rotate-90")}),"Forgot your password?"]}),g.data?.signup&&e.jsxs("p",{className:"m-0 text-center text-[13px] text-muted-foreground",children:["New here?"," ",e.jsx(L,{to:"/sign-up",className:"text-foreground underline underline-offset-4",children:"Create a studio"})]}),s&&e.jsxs("div",{className:"flex flex-col gap-2 text-[12.5px] leading-relaxed text-muted-foreground",children:[e.jsx("p",{className:"m-0",children:"There's no reset email — a fresh install has no mail set up, and whoever has a shell on the server already holds more authority than a reset link would grant. From that machine:"}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md border border-border bg-card px-3 py-2 font-mono text-[12px] text-foreground",children:e.jsx("code",{children:`printf '%s' "$NEW" | snagset passwd you@example.com`})}),e.jsx("p",{className:"m-0",children:"Every existing session for that account is signed out when it runs."})]})]})})}export{Q as component};
@@ -0,0 +1 @@
1
+ import{o as p,r as u,p as h,x as g,z as f,A as j,j as e,G as N,B as w,L as v,C as y,D as t}from"./index-B7_Oj3hr.js";import{u as b,a as S}from"./zod-BUdBrC5l.js";import{L as o,I as i}from"./label-Dpq7t35_.js";const A=y({email:t().trim().email("An email address"),password:t().min(12,"At least 12 characters"),name:t().trim().max(120).optional(),orgName:t().trim().max(120).optional()});function k(){const d=p(),[n,l]=u.useState(""),{register:r,handleSubmit:c,formState:a}=b({resolver:S(A)}),x=c(async s=>{l("");try{await h.register({email:s.email,password:s.password,...s.name?{name:s.name}:{},orgName:s.orgName||"My studio"}),g("in"),f.clear(),d({to:"/welcome",replace:!0})}catch(m){l(m instanceof j?m.message:"Something went wrong. Try again.")}});return e.jsx(N,{width:400,children:e.jsxs("form",{onSubmit:x,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs("div",{children:[e.jsx("h1",{className:"m-0 text-[22px] font-semibold tracking-tight",children:"Create a studio"}),e.jsx("p",{className:"m-0 mt-1.5 text-muted-foreground",children:"Your account, and the studio your sites live in. Reviewers never sign up — they open a link."})]}),n&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:n}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(o,{htmlFor:"email",children:"Your email"}),e.jsx(i,{id:"email",type:"email",autoComplete:"username","aria-invalid":!!a.errors.email,...r("email")}),a.errors.email&&e.jsx("p",{className:"m-0 text-[12px] text-destructive",children:a.errors.email.message})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(o,{htmlFor:"password",children:"Password"}),e.jsx(i,{id:"password",type:"password",autoComplete:"new-password","aria-invalid":!!a.errors.password,...r("password")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters. A short phrase of real words is fine."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(o,{htmlFor:"name",children:["Your name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(i,{id:"name",autoComplete:"name",...r("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs(o,{htmlFor:"orgName",children:["Studio name ",e.jsx("span",{className:"font-normal text-muted-foreground",children:"optional"})]}),e.jsx(i,{id:"orgName",placeholder:"My studio",...r("orgName")})]}),e.jsx(w,{type:"submit",size:"lg",loading:a.isSubmitting,children:a.isSubmitting?"Creating…":"Create my studio"}),e.jsxs("p",{className:"m-0 text-center text-[13px] text-muted-foreground",children:["Already have an account?"," ",e.jsx(v,{to:"/sign-in",className:"text-foreground underline underline-offset-4",children:"Sign in"})]})]})})}export{k as component};
@@ -0,0 +1 @@
1
+ import{N as v,r as x,j as e,B as c,L as N,o as y,t as w,p as A,A as S,C as $,D as p}from"./index-B7_Oj3hr.js";import{u as k,a as C}from"./zod-BUdBrC5l.js";import{C as _}from"./card-YnwmM74t.js";import{E as D,G as E,I,H as L,J as P,K as F}from"./dialog-BO8bYmy1.js";import{L as h,I as g}from"./label-Dpq7t35_.js";import{P as z,E as H}from"./parts-C1QjM02Y.js";import{b as K}from"./labels--UUyt9uB.js";import{u as T}from"./me-DoCJgtG9.js";import{P as f}from"./plus-D247LXUb.js";import{L as q}from"./layout-grid-Bf2WS_DV.js";import{I as B}from"./image-off-Dg9jTwH7.js";import"./useBaseQuery-yj7uWlSz.js";function te(){const i=T(),{add:a}=v.useSearch(),[m,r]=x.useState(!!a);x.useEffect(()=>{a&&r(!0)},[a]);const d=i.projects.reduce((s,o)=>s+o.unresolved,0),t=i.limits.projects.limit,n=t!==null&&i.projects.length>=t;return e.jsxs("div",{className:"p-7",children:[e.jsx(z,{title:"Sites",sub:i.projects.length?`${i.projects.length}${t!==null?` of ${t}`:""} site${i.projects.length===1&&t===null?"":"s"} · ${d} open`:t!==null?`0 of ${t} sites`:void 0,actions:e.jsxs(c,{onClick:()=>r(!0),disabled:n,title:n?`This studio's plan allows ${t} sites.`:void 0,children:[e.jsx(f,{}),"Add a site"]})}),i.projects.length===0?e.jsx(_,{className:"max-w-[1100px]",children:e.jsx(H,{icon:e.jsx(q,{className:"size-5"}),title:"No sites yet",action:e.jsxs(c,{onClick:()=>r(!0),children:[e.jsx(f,{}),"Add a site"]}),children:"A site is one client website. Add it, paste the tag, and comments start arriving here."})}):e.jsx("div",{className:"grid max-w-[1100px] grid-cols-1 gap-5 md:grid-cols-2 xl:grid-cols-3",children:i.projects.map(s=>e.jsxs(N,{to:"/s/$site/comments",params:{site:s.uid},className:"block overflow-hidden rounded-lg border border-border bg-card text-foreground transition-shadow hover:shadow-[0_1px_2px_rgb(24_23_22/.06),0_8px_24px_rgb(24_23_22/.08)]",children:[e.jsx("div",{className:"flex h-[150px] items-center justify-center border-b border-border bg-background",children:s.previewUrl?e.jsx("img",{src:s.previewUrl,alt:"",className:"size-full object-cover object-top"}):e.jsxs("div",{className:"flex flex-col items-center gap-1 text-[12px] text-muted-foreground",children:[e.jsx("span",{className:"flex size-8 items-center justify-center rounded-md bg-muted",children:e.jsx(B,{className:"size-4"})}),"No screenshot yet"]})}),e.jsxs("div",{className:"px-3.5 pb-3.5 pt-3",children:[e.jsxs("div",{className:"flex items-center gap-2 text-[14px] font-semibold",children:[e.jsx("span",{className:"truncate",children:s.name}),s.status==="paused"&&e.jsx("span",{className:"rounded-sm bg-muted px-1.5 py-px text-[10.5px] font-medium uppercase tracking-wide text-muted-foreground",children:"Paused"})]}),s.domain&&e.jsx("div",{className:"mt-0.5 truncate font-mono text-[12px] text-muted-foreground",children:s.domain}),e.jsx("div",{className:"mt-2 text-[12.5px] text-ink-soft",children:s.threads===0?"Nothing filed yet":`${s.unresolved} open of ${s.threads}${s.lastActivityAt?` · ${K(s.lastActivityAt)}`:""}`})]})]},s.uid))}),e.jsx(Q,{open:m,onOpenChange:r})]})}const G=$({name:p().trim().min(1,"A name"),domain:p().trim().min(1,"Its domain")});function Q({open:i,onOpenChange:a}){const m=y(),r=w(),[d,t]=x.useState(""),{register:n,handleSubmit:s,formState:o,reset:j}=k({resolver:C(G)}),b=s(async u=>{t("");try{const l=await A.createProject(u.name,"",u.domain);await r.invalidateQueries({queryKey:["me"]}),j(),a(!1),m({to:"/s/$site/comments",params:{site:l.uid}})}catch(l){t(l instanceof S?l.message:"Could not add the site.")}});return e.jsx(D,{open:i,onOpenChange:a,children:e.jsx(E,{children:e.jsxs("form",{onSubmit:b,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(I,{children:[e.jsx(L,{children:"Add a site"}),e.jsx(P,{children:"One client website. The tag it needs is shown right after."})]}),d&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:d}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(h,{htmlFor:"site-name",children:"Name"}),e.jsx(g,{id:"site-name",placeholder:"Kilnwork","aria-invalid":!!o.errors.name,...n("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(h,{htmlFor:"site-domain",children:"Domain"}),e.jsx(g,{id:"site-domain",placeholder:"kilnwork.studio","aria-invalid":!!o.errors.domain,...n("domain")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Every subdomain, scheme and port of it may run the widget — staging, previews, and localhost while you build. Exact addresses elsewhere can be added in Settings."})]}),e.jsxs(F,{children:[e.jsx(c,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsx(c,{type:"submit",loading:o.isSubmitting,children:o.isSubmitting?"Adding…":"Add site"})]})]})})})}export{te as component};
@@ -0,0 +1 @@
1
+ import{j as t,O as o}from"./index-B7_Oj3hr.js";const n=()=>t.jsx(o,{});export{n as component};
@@ -0,0 +1 @@
1
+ import{t as y,y as s,Q as u,p as o,S as i,P as c}from"./index-B7_Oj3hr.js";function d(){const e=y(),r=s.me().queryKey;return u({mutationFn:a=>o.renameOrg(a),onMutate:async a=>{await e.cancelQueries({queryKey:r});const t=e.getQueryData(r);return t&&e.setQueryData(r,{...t,org:{...t.org,name:a}}),{was:t}},onError:(a,t,n)=>{n?.was&&e.setQueryData(r,n.was),i.error(c(a))},onSettled:()=>e.invalidateQueries({queryKey:r})})}function q(){const e=y(),r=s.me().queryKey;return u({mutationFn:a=>o.renameMe(a),onMutate:async a=>{await e.cancelQueries({queryKey:r});const t=e.getQueryData(r);return t&&e.setQueryData(r,{...t,user:{...t.user,name:a}}),{was:t}},onError:(a,t,n)=>{n?.was&&e.setQueryData(r,n.was),i.error(c(a))},onSettled:()=>{e.invalidateQueries({queryKey:r}),e.invalidateQueries({queryKey:s.members().queryKey})}})}function f(){return u({mutationFn:e=>o.changePassword(e.current,e.next)})}function l(){const e=y();return u({mutationFn:r=>o.addMember(r),onSuccess:r=>e.setQueryData(s.members().queryKey,r)})}function w(){const e=y(),r=s.members().queryKey;return u({mutationFn:a=>o.setMemberRole(a.email,a.role),onMutate:async({email:a,role:t})=>{await e.cancelQueries({queryKey:r});const n=e.getQueryData(r);return n&&e.setQueryData(r,{data:n.data.map(m=>m.email===a?{...m,role:t}:m)}),{was:n}},onSuccess:(a,{email:t})=>{e.setQueryData(r,a),a.data.find(n=>n.email===t)?.you&&e.invalidateQueries({queryKey:s.me().queryKey})},onError:(a,t,n)=>{n?.was&&e.setQueryData(r,n.was),i.error(c(a))}})}function D(){const e=y(),r=s.members().queryKey;return u({mutationFn:a=>o.removeMember(a),onMutate:async a=>{await e.cancelQueries({queryKey:r});const t=e.getQueryData(r);return t&&e.setQueryData(r,{data:t.data.filter(n=>n.email!==a)}),{was:t}},onSuccess:a=>e.setQueryData(r,a),onError:(a,t,n)=>{n?.was&&e.setQueryData(r,n.was),i.error(c(a))}})}export{f as a,d as b,w as c,D as d,l as e,q as u};
@@ -0,0 +1 @@
1
+ import{t as B,r as h,Q as v,p as y,S as b,P as C,j as e,B as g,y as S,A as K}from"./index-B7_Oj3hr.js";import{u as w}from"./useQuery-CBgK187B.js";import{L as A,I as N}from"./label-Dpq7t35_.js";import{E as M,G as $,I as T,H as I,J as U,K as L}from"./dialog-BO8bYmy1.js";import{C as _}from"./ConfirmDialog-ClUMXHe1.js";import{a as D,P as G}from"./parts-C1QjM02Y.js";import{b as F}from"./labels--UUyt9uB.js";import{u as z}from"./me-DoCJgtG9.js";import{S as O}from"./SaveState-B-6cG0nU.js";import{b as q}from"./studio-enyabWEx.js";import{c as Q}from"./update-duXzIzFS.js";import"./useBaseQuery-yj7uWlSz.js";import"./card-YnwmM74t.js";function H({owner:n}){const s=w(S.instance()),i=B(),t=()=>i.invalidateQueries({queryKey:S.instance().queryKey}),[c,l]=h.useState(!1),[p,x]=h.useState(!1),[d,u]=h.useState(null),a=v({mutationFn:y.disconnectStorage,onSuccess:()=>void t(),onError:j=>b.error(C(j))}),r=v({mutationFn:y.disconnectMail,onSuccess:()=>void t(),onError:j=>b.error(C(j))}),f=v({mutationFn:y.testMail,onSuccess:j=>b.success(`Sent to ${j.to}`),onError:j=>b.error(C(j))}),k=z(),m=s.data?.storage,o=s.data?.mail;return e.jsxs(e.Fragment,{children:[e.jsxs(D,{title:"Storage",description:"The bucket screenshots and files go to. Without one the widget runs in annotation mode.",children:[!s.data&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:s.isError?"Could not read it.":"Reading…"}),m&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(P,{tone:m.connected?"ok":m.unreadable?"bad":"off",text:m.connected?`Connected · ${m.bucket} at ${(m.endpoint??"").replace(/^https?:\/\//,"")}${m.connectedAt?` · since ${F(m.connectedAt)}`:""}`:m.unreadable?"A bucket is stored but its keys will not decrypt — the secret key changed. Connect it again.":"Not connected — annotation mode. Comments and anchors work; screenshots are not offered."}),k.limits.storage.limit!==null&&e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:[R(k.limits.storage.used)," of ",R(k.limits.storage.limit)," used across the studio's sites."]}),m.source==="env"?e.jsx(E,{what:"SNAGSET_STORAGE_S3_*"}):n?e.jsxs("div",{className:"flex gap-2",children:[e.jsx(g,{variant:"outline",size:"sm",onClick:()=>l(!0),children:m.connected||m.unreadable?"Replace…":"Connect a bucket…"}),(m.connected||m.unreadable)&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>u("storage"),children:"Disconnect"})]}):null]})]}),e.jsx(D,{title:"Mail",description:"How notifications go out. Without a transport they are off, and the instance says so.",children:o&&e.jsxs("div",{className:"flex flex-col gap-2",children:[e.jsx(P,{tone:o.configured?"ok":o.unreadable?"bad":"off",text:o.configured?`${o.scheme==="resend"?"Resend":`SMTP · ${o.host??""}`} · from ${o.from}${o.updatedAt?` · since ${F(o.updatedAt)}`:""}`:o.unreadable?"A transport is stored but its secret will not decrypt — the secret key changed. Connect it again.":"No transport — notifications are off."}),o.source==="env"?e.jsx(E,{what:"SNAGSET_MAIL_URL"}):n?e.jsxs("div",{className:"flex flex-wrap gap-2",children:[e.jsx(g,{variant:"outline",size:"sm",onClick:()=>x(!0),children:o.configured||o.unreadable?"Replace…":"Connect a transport…"}),o.configured&&e.jsx(g,{variant:"outline",size:"sm",loading:f.isPending,onClick:()=>f.mutate(),children:f.isPending?"Sending…":"Send a test email"}),(o.configured||o.unreadable)&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>u("mail"),children:"Disconnect"})]}):(o.configured&&n===!1,null)]})}),e.jsx(V,{open:c,onOpenChange:l,onDone:()=>void t()}),e.jsx(W,{open:p,onOpenChange:x,onDone:()=>void t()}),e.jsx(_,{open:d!==null,onOpenChange:j=>!j&&u(null),title:d==="storage"?"Disconnect the bucket?":"Disconnect the mail transport?",description:d==="storage"?"Screenshots stop being offered. Nothing in the bucket is deleted, and reconnecting the same bucket brings the pictures back.":"Notifications stop going out until a transport is connected again.",confirmLabel:"Disconnect",busy:a.isPending||r.isPending,onConfirm:async()=>{d==="storage"?await a.mutateAsync():await r.mutateAsync(),u(null)}})]})}function P({tone:n,text:s}){return e.jsxs("p",{className:"m-0 flex items-center gap-2 text-[13px]",children:[e.jsx("span",{className:`size-2 shrink-0 rounded-full ${n==="ok"?"bg-ok":n==="bad"?"bg-destructive":"bg-line-strong"}`,"aria-hidden":"true"}),e.jsx("span",{children:s})]})}function E({what:n}){return e.jsxs("p",{className:"m-0 text-[12px] text-muted-foreground",children:["Set by the environment (",e.jsx("code",{className:"font-mono",children:n}),"). Change it there; the dashboard shows it and does not offer to edit it."]})}function V({open:n,onOpenChange:s,onDone:i}){const[t,c]=h.useState({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),[l,p]=h.useState(""),x=v({mutationFn:y.connectStorage}),d=r=>f=>c({...t,[r]:f.target.value}),u=async r=>{r.preventDefault(),p("");try{await x.mutateAsync({endpoint:t.endpoint.trim(),bucket:t.bucket.trim(),accessKeyId:t.accessKeyId.trim(),secretAccessKey:t.secretAccessKey,...t.region.trim()?{region:t.region.trim()}:{},...t.publicBaseUrl.trim()?{publicBaseUrl:t.publicBaseUrl.trim()}:{}}),c({endpoint:"",bucket:"",region:"",accessKeyId:"",secretAccessKey:"",publicBaseUrl:""}),s(!1),i(),b.success("Bucket connected — screenshots are on")}catch(f){p(f instanceof K?f.message:"Could not reach the server.")}},a=(r,f,k,m="text",o)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{htmlFor:`st-${r}`,children:f}),e.jsx(N,{id:`st-${r}`,type:m,placeholder:k,value:t[r],onChange:d(r),autoComplete:"off"}),o&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:o})]});return e.jsx(M,{open:n,onOpenChange:s,children:e.jsx($,{children:e.jsxs("form",{onSubmit:r=>void u(r),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(T,{children:[e.jsx(I,{children:"Connect a bucket"}),e.jsx(U,{children:"Any S3-compatible bucket. It is probed — write, read, delete — before anything is saved, and the keys are stored encrypted with this instance's secret key."})]}),l&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:l}),a("endpoint","Endpoint","https://ams3.digitaloceanspaces.com"),a("bucket","Bucket","snagset"),a("region","Region","auto","text","Leave empty for providers that do not use one."),a("accessKeyId","Access key ID",""),a("secretAccessKey","Secret access key","","password"),a("publicBaseUrl","Public base URL","","text","Optional — only if the bucket is served from a CDN address."),e.jsxs(L,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(g,{type:"submit",loading:x.isPending,children:x.isPending?"Probing…":"Connect"})]})]})})})}function W({open:n,onOpenChange:s,onDone:i}){const[t,c]=h.useState(""),[l,p]=h.useState(""),[x,d]=h.useState(""),u=v({mutationFn:y.connectMail}),a=async r=>{r.preventDefault(),d("");try{await u.mutateAsync({url:t.trim(),from:l.trim()}),c(""),p(""),s(!1),i(),b.success("Transport connected — send a test email to be sure")}catch(f){d(f instanceof K?f.message:"Could not reach the server.")}};return e.jsx(M,{open:n,onOpenChange:s,children:e.jsx($,{children:e.jsxs("form",{onSubmit:r=>void a(r),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(T,{children:[e.jsx(I,{children:"Connect a mail transport"}),e.jsx(U,{children:"Resend is the easy one — the provider owns SPF and DKIM. SMTP works with any provider. The URL is stored encrypted with this instance's secret key."})]}),x&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:x}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{htmlFor:"mail-url",children:"Transport"}),e.jsx(N,{id:"mail-url",type:"password",placeholder:"resend://re_… or smtp://user:pass@host:587",value:t,onChange:r=>c(r.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(A,{htmlFor:"mail-from",children:"From"}),e.jsx(N,{id:"mail-from",placeholder:"Snagset <review@kilnwork.studio>",value:l,onChange:r=>p(r.target.value)}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"The address every notification is sent from. Resend needs a verified domain for it."})]}),e.jsxs(L,{children:[e.jsx(g,{type:"button",variant:"outline",onClick:()=>s(!1),children:"Cancel"}),e.jsx(g,{type:"submit",loading:u.isPending,disabled:!t.trim()||!l.trim(),children:u.isPending?"Saving…":"Connect"})]})]})})})}function R(n){const s=["B","KB","MB","GB","TB"];let i=n,t=0;for(;i>=1024&&t<s.length-1;)i/=1024,t+=1;return`${t===0?i:i.toFixed(i>=10?0:1)} ${s[t]}`}function ue(){const n=z(),s=w(S.meta()),i=w(S.members()),t=q(),c=n.user.role==="owner",[l,p]=h.useState(n.org.name),[x,d]=h.useState(null);h.useEffect(()=>p(n.org.name),[n.org.name]);const u=c&&l.trim().length>0&&l.trim()!==n.org.name;return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(G,{title:"General",sub:n.org.name,actions:e.jsx(O,{saving:t.isPending,savedAt:x})}),e.jsx(D,{title:"Studio",description:"The name at the top of every screen.",children:e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:a=>{a.preventDefault(),u&&t.mutate(l.trim(),{onSuccess:()=>d(Date.now())})},children:[e.jsx(A,{htmlFor:"studio-name",children:"Name"}),e.jsxs("div",{className:"flex gap-2",children:[e.jsx(N,{id:"studio-name",value:l,readOnly:!c,onChange:a=>p(a.target.value)}),u&&e.jsx(g,{type:"submit",variant:"outline",children:"Save"})]}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:c?"Shown at the top of the sidebar, above every site.":"Only an owner can change it."})]})}),e.jsx(D,{title:"This instance",description:"What is running, and where.",children:e.jsxs("dl",{className:"m-0 grid grid-cols-[130px_1fr] gap-x-3 gap-y-1.5 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Version"}),e.jsxs("dd",{className:"m-0",children:[s.data?.version??"—"," ",e.jsx(J,{version:s.data?.version??""})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Address"}),e.jsx("dd",{className:"m-0",children:e.jsx(X,{owner:c})}),s.data?.commit&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Commit"}),e.jsxs("dd",{className:"m-0 font-mono text-[12px] text-ink-soft",children:[s.data.commit.slice(0,12),s.data.modified?" · modified":""]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Sites · members"}),e.jsxs("dd",{className:"m-0",children:[n.projects.length," · ",i.data?.data.length??"—"]})]})}),e.jsx(H,{owner:c})]})}function J({version:n}){const[s,i]=h.useState({s:"idle"});return s.s==="idle"?e.jsxs(e.Fragment,{children:["·"," ",e.jsx("button",{type:"button",className:"text-brand hover:underline",onClick:()=>{i({s:"checking"}),Q(n).then(t=>i({s:"done",r:t})).catch(()=>i({s:"failed"}))},children:"Check for updates"})," ",e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"— from your browser, never from the server"})]}):s.s==="checking"?e.jsx("span",{className:"text-muted-foreground",children:"· checking…"}):s.s==="failed"?e.jsx("span",{className:"text-muted-foreground",children:"· could not reach npm"}):e.jsx("span",{className:"text-muted-foreground",children:s.r?.newer?`· ${s.r.latest} is out`:"· up to date"})}function X({owner:n}){const s=B(),i=w(S.instance()),[t,c]=h.useState(null),[l,p]=h.useState(""),x=v({mutationFn:a=>y.setAddress(a),onSuccess:a=>{s.setQueryData(S.instance().queryKey,a),c(null),p(""),b.success("Address saved — every new link is built from it")},onError:a=>p(C(a))}),d=i.data?.address;if(!d)return e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:location.origin});const u=d.source==="env";return t===null||!n||u?e.jsxs("span",{className:"flex flex-wrap items-center gap-2",children:[e.jsx("span",{className:"font-mono text-[12px] text-ink-soft",children:d.url}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:u?"· set by the environment (SNAGSET_BASE_URL)":d.source==="stored"?"· set at claim; every link is built from it":"· this machine's default"}),n&&!u&&e.jsx(g,{variant:"ghost",size:"sm",onClick:()=>c(d.url),children:"Change…"})]}):e.jsxs("form",{className:"flex flex-col gap-1.5",onSubmit:a=>{a.preventDefault(),x.mutate(t.trim())},children:[e.jsxs("span",{className:"flex items-center gap-2",children:[e.jsx(N,{"aria-label":"Address",value:t,onChange:a=>c(a.target.value),className:"h-8 max-w-[360px] font-mono text-[12px]",autoFocus:!0}),e.jsx(g,{type:"submit",size:"sm",loading:x.isPending,disabled:!t.trim(),children:x.isPending?"Saving…":"Save"}),e.jsx(g,{type:"button",variant:"ghost",size:"sm",onClick:()=>c(null),children:"Cancel"})]}),l&&e.jsx("span",{className:"text-[12px] text-destructive",children:l}),e.jsx("span",{className:"text-[12px] text-muted-foreground",children:"https:// unless it is this machine; the origin only. Review links, issues and emails are built from it."})]})}export{ue as component};
@@ -0,0 +1 @@
1
+ import{t as z,r as i,Q as P,S as A,P as J,p as T,T as W,j as e,B as N,y as G,U as ne,A as K}from"./index-B7_Oj3hr.js";import{u as B}from"./useQuery-CBgK187B.js";import{B as U}from"./badge-CQoGgFU8.js";import{E,G as $,I as O,H as R,J as D,K as L}from"./dialog-BO8bYmy1.js";import{L as C,I as F}from"./label-Dpq7t35_.js";import{S as oe}from"./switch-ElcxbE6-.js";import{C as Q}from"./ConfirmDialog-ClUMXHe1.js";import{P as ae,a as V}from"./parts-C1QjM02Y.js";import{C as _}from"./CopyButton-DCsj-LZV.js";import{b as X}from"./labels--UUyt9uB.js";import{u as re}from"./me-DoCJgtG9.js";import"./useBaseQuery-yj7uWlSz.js";import"./useRender-BHlMpPxr.js";import"./useAriaLabelledBy-BNUj3f_d.js";import"./useValueChanged-DQ0Iea1L.js";import"./card-YnwmM74t.js";import"./check-CLHnIgiu.js";import"./copy-ZOZ0pLVD.js";const ie={ok:{label:"Healthy",tone:"ok"},needs_reauth:{label:"Needs a new token",tone:"bad"},error:{label:"Failing",tone:"bad"}};function Oe(){const r=re(),c=r.user.role==="owner",u=B(G.integrations()),f=z(),g=()=>f.invalidateQueries({queryKey:["integrations"]}),[b,d]=i.useState(null),[m,h]=i.useState(null),[x,l]=i.useState(null),j=P({mutationFn:t=>T.regenerateGitHubWebhook(t),onSuccess:({webhook:t},o)=>l({site:o,provider:"github",hook:t,fresh:!1}),onError:t=>A.error(J(t))}),v=P({mutationFn:({uid:t,provider:o})=>T.testTracker(t,o).then(a=>({...a,provider:o})),onSuccess:t=>{A[t.ok?"success":"error"](t.ok?`${W[t.provider]} can see ${t.target}`:t.detail??`${W[t.provider]} refused the token`),g()},onError:t=>A.error(J(t))}),p=P({mutationFn:({uid:t,provider:o})=>T.disconnectTracker(t,o),onSuccess:()=>{h(null),g()},onError:t=>A.error(J(t))}),k=u.data?.data??[],y=t=>k.filter(o=>o.provider===t),n=t=>r.projects.filter(o=>!y(t).some(a=>a.site===o.uid));return e.jsxs("div",{className:"flex flex-col gap-10 p-7",children:[e.jsx(ae,{title:"Integrations",sub:"Mirrors converge on the comment's status here; Slack only announces"}),["github","linear","jira","slack"].map(t=>{const o=y(t),a=n(t);return e.jsxs(V,{title:W[t],description:t==="github"?"A comment becomes an issue in the site's repository, with the brief as its body; resolving it here closes the issue there, and closing it there resolves it here. A fine-grained token per site — no OAuth app to register.":t==="linear"?"A comment becomes an issue in the site's team, with the brief as its body; our status moves it between the team's workflow states by type, and a webhook from Linear moves it back. A personal API key per site — no OAuth app to register.":t==="jira"?"A comment becomes an issue in the site's Jira project, with the brief as its description; our status moves it through the workflow by status category, and a webhook from Jira moves it back. An API token with the account's email — what Atlassian gives a self-hoster.":"One message per comment in a channel, edited in place as the status moves — never a second message, never a reply. A bot token from an app you create in a click from our manifest; Slack sends nothing back.",children:[u.isPending&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:"Reading…"}),u.isSuccess&&o.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(U,{variant:"outline",children:"Not connected"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:t==="github"?"No site is connected to a repository yet.":t==="linear"?"No site is connected to a team yet.":t==="jira"?"No site is connected to a project yet.":"No site is connected to a channel yet."})]}),o.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0",children:o.map(s=>{const w=ie[s.health]??{label:s.health,tone:"warn"};return e.jsxs("li",{className:"flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md border border-border px-3 py-2.5 text-[13px]",children:[e.jsx("span",{className:"font-medium",children:s.siteName??s.site}),e.jsx("span",{className:"text-muted-foreground",children:"→"}),e.jsx("code",{className:"font-mono text-[12.5px]",children:s.provider==="github"?`${s.owner}/${s.repo}`:s.provider==="linear"?`${s.teamKey} · ${s.teamName}`:s.provider==="jira"?`${s.projectKey} · ${s.projectName}`:`#${s.channelName} · ${s.teamName}`}),e.jsx(U,{variant:"outline",className:w.tone==="ok"?"border-ok text-ok":w.tone==="bad"?"border-destructive text-destructive":"",children:w.label}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[s.provider==="slack"?s.createOn==="thread.created"?"A message for every new comment":"Messages when you ask, from the brief":s.createOn==="thread.created"?"An issue for every new comment":"Issues when you ask, from the brief",s.provider==="github"&&s.labels.length?` · labels ${s.labels.join(", ")}`:"",s.provider!=="github"&&s.provider!=="slack"&&!s.hasWebhookSecret?` · no webhook secret yet, so ${W[s.provider]} cannot move comments here`:""," · ",X(s.updatedAt)]}),s.lastError&&e.jsx("span",{className:"basis-full text-[12px] text-destructive",children:s.lastError}),c&&e.jsxs("span",{className:"ml-auto flex gap-1",children:[s.provider==="github"?e.jsx(N,{variant:"ghost",size:"sm",loading:j.isPending,onClick:()=>j.mutate(s.site),children:"Webhook…"}):s.provider==="slack"?null:e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>l({site:s.site,provider:s.provider,hook:{url:`${location.origin}/api/v1/integrations/${s.provider}/inbound`},fresh:!1}),children:"Webhook…"}),e.jsx(N,{variant:"ghost",size:"sm",loading:v.isPending,onClick:()=>v.mutate({uid:s.site,provider:s.provider}),children:"Test"}),e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>h(s),children:"Disconnect"})]})]},`${s.provider}:${s.site}`)})}),c&&a.length>0&&e.jsx("div",{children:e.jsx(N,{variant:"outline",size:"sm",onClick:()=>d(t),children:"Connect a site…"})})]},t)}),e.jsx(ue,{owner:c,sites:r.projects}),e.jsx(ce,{open:b==="github",onOpenChange:t=>!t&&d(null),sites:n("github"),onDone:(t,o)=>{g(),o&&l({site:t,provider:"github",hook:o,fresh:!0})}}),e.jsx(de,{open:b==="linear",onOpenChange:t=>!t&&d(null),sites:n("linear"),onDone:(t,o)=>{g(),l({site:t,provider:"linear",hook:o,fresh:!0})}}),e.jsx(me,{open:b==="jira",onOpenChange:t=>!t&&d(null),sites:n("jira"),onDone:(t,o)=>{g(),l({site:t,provider:"jira",hook:o,fresh:!0})}}),e.jsx(he,{open:b==="slack",onOpenChange:t=>!t&&d(null),sites:n("slack"),onDone:()=>void g()}),e.jsx(le,{state:x,onClose:()=>l(null),siteName:t=>k.find(o=>o.site===t)?.siteName??"the site"}),e.jsx(Q,{open:m!==null,onOpenChange:t=>!t&&h(null),title:`Disconnect ${m?.siteName??"this site"} from ${m?W[m.provider]:"the tracker"}?`,description:m?.provider==="slack"?e.jsx(e.Fragment,{children:"Messages already posted stay in the channel; no new ones are posted and they stop being updated. The token is forgotten."}):e.jsx(e.Fragment,{children:"Issues already made keep their links; no new ones are made and status stops mirroring. The token is forgotten."}),confirmLabel:"Disconnect",busy:p.isPending,onConfirm:async()=>{m&&await p.mutateAsync({uid:m.site,provider:m.provider})}})]})}function ce({open:r,onOpenChange:c,sites:u,onDone:f}){const[g,b]=i.useState(""),[d,m]=i.useState(""),[h,x]=i.useState(""),[l,j]=i.useState(""),[v,p]=i.useState(!1),[k,y]=i.useState(""),n=P({mutationFn:a=>T.connectTracker(a,"github",{repository:d.trim(),token:h.trim(),labels:l,createOn:v?"thread.created":"manual"})}),t=g||u[0]?.uid||"",o=async a=>{a.preventDefault(),y("");try{const s=await n.mutateAsync(t);m(""),x(""),j(""),p(!1),c(!1),f(t,s.webhook&&"secret"in s.webhook?s.webhook:void 0),A.success("GitHub connected")}catch(s){y(s instanceof K?s.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx($,{children:e.jsxs("form",{onSubmit:a=>void o(a),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(O,{children:[e.jsx(R,{children:"Connect a site to GitHub"}),e.jsxs(D,{children:["A fine-grained personal access token with ",e.jsx("b",{children:"Issues: read and write"})," on that one repository. It is checked against the repository before it is saved, and stored encrypted with this instance's secret key."]})]}),k&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:k}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-site",children:"Site"}),e.jsx("select",{id:"gh-site",value:t,onChange:a=>b(a.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:u.map(a=>e.jsx("option",{value:a.uid,children:a.name},a.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-repo",children:"Repository"}),e.jsx(F,{id:"gh-repo",placeholder:"kilnwork/site",value:d,onChange:a=>m(a.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-token",children:"Token"}),e.jsx(F,{id:"gh-token",type:"password",placeholder:"github_pat_…",value:h,onChange:a=>x(a.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"gh-labels",children:"Labels"}),e.jsx(F,{id:"gh-labels",placeholder:"review, bug",value:l,onChange:a=>j(a.target.value)}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Applied to every issue this makes. Optional."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:v,onChange:a=>p(a.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:'Off by default: a reviewer walking a site leaves twenty comments and half are "never mind". Make issues from the brief when you mean it.'})]})]}),e.jsxs(L,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:n.isPending,disabled:!d.trim()||!h.trim()||!t,children:n.isPending?"Checking…":"Connect"})]})]})})})}function le({state:r,onClose:c,siteName:u}){const f=r&&"secret"in r.hook?r.hook.secret:null;return e.jsx(E,{open:r!==null,onOpenChange:g=>!g&&c(),children:e.jsxs($,{children:[e.jsxs(O,{children:[e.jsx(R,{children:r?.fresh?"Connected — now the webhook":"Webhook for "+(r?u(r.site):"")}),e.jsx(D,{children:r?.provider==="linear"?"Issues moved in Linear move the comment here. In Linear › Settings › API › Webhooks, create one for the team with this URL and Issue events; then paste its signing secret when connecting or replacing the connection.":r?.provider==="jira"?"Issues moved in Jira move the comment here. In Jira › Settings › System › Webhooks, create one with this URL, the events Issue updated and Issue deleted, and a secret; then paste the same secret when connecting or replacing the connection.":`Issues closed or reopened on GitHub move the comment here. Add a webhook to the repository — Settings › Webhooks › Add webhook — with these values. The secret is shown this once${r?.fresh?"":", and the previous one has stopped working"}.`})]}),r&&e.jsxs("dl",{className:"m-0 grid grid-cols-[110px_1fr] gap-x-3 gap-y-2 text-[13px]",children:[e.jsx("dt",{className:"text-muted-foreground",children:"Payload URL"}),e.jsxs("dd",{className:"m-0 flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1 font-mono text-[12px]",children:r.hook.url}),e.jsx(_,{text:r.hook.url,label:"Copy the payload URL"})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Content type"}),e.jsx("dd",{className:"m-0",children:e.jsx("code",{className:"font-mono text-[12px]",children:"application/json"})}),f&&e.jsxs(e.Fragment,{children:[e.jsx("dt",{className:"text-muted-foreground",children:"Secret"}),e.jsxs("dd",{className:"m-0 flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1 font-mono text-[12px]","data-testid":"webhook-secret",children:f}),e.jsx(_,{text:f,label:"Copy the secret"})]})]}),e.jsx("dt",{className:"text-muted-foreground",children:"Events"}),e.jsx("dd",{className:"m-0",children:r.provider==="linear"?"Issues":r.provider==="jira"?"Issue: updated, deleted":"Let me select individual events → Issues"})]}),e.jsx(L,{children:e.jsx(N,{type:"button",onClick:c,children:"Done"})})]})})}function de({open:r,onOpenChange:c,sites:u,onDone:f}){const[g,b]=i.useState(""),[d,m]=i.useState(""),[h,x]=i.useState(""),[l,j]=i.useState(""),[v,p]=i.useState(!1),[k,y]=i.useState(""),n=P({mutationFn:a=>T.connectTracker(a,"linear",{team:d.trim(),apiKey:h.trim(),...l.trim()?{webhookSecret:l.trim()}:{},createOn:v?"thread.created":"manual"})}),t=g||u[0]?.uid||"",o=async a=>{a.preventDefault(),y("");try{const s=await n.mutateAsync(t);m(""),x(""),j(""),p(!1),c(!1),f(t,s.webhook??{url:`${location.origin}/api/v1/integrations/linear/inbound`}),A.success("Linear connected")}catch(s){y(s instanceof K?s.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx($,{children:e.jsxs("form",{onSubmit:a=>void o(a),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(O,{children:[e.jsx(R,{children:"Connect a site to Linear"}),e.jsx(D,{children:"A personal API key from Linear › Settings › API, belonging to a member of the team. It is checked against the team before it is saved, and stored encrypted with this instance's secret key."})]}),k&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:k}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-site",children:"Site"}),e.jsx("select",{id:"ln-site",value:t,onChange:a=>b(a.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:u.map(a=>e.jsx("option",{value:a.uid,children:a.name},a.uid))})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-team",children:"Team key"}),e.jsx(F,{id:"ln-team",placeholder:"ENG",value:d,onChange:a=>m(a.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"The prefix of the team's issues, like the ENG in ENG-123."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-key",children:"API key"}),e.jsx(F,{id:"ln-key",type:"password",placeholder:"lin_api_…",value:h,onChange:a=>x(a.target.value),autoComplete:"off"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"ln-secret",children:"Webhook signing secret"}),e.jsx(F,{id:"ln-secret",type:"password",placeholder:"from Linear's webhook, optional",value:l,onChange:a=>j(a.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Lets Linear move comments here when issues move there. The URL to give Linear is shown after connecting."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:v,onChange:a=>p(a.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Make issues from the brief when you mean it."})]})]}),e.jsxs(L,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:n.isPending,disabled:!d.trim()||!h.trim()||!t,children:n.isPending?"Checking…":"Connect"})]})]})})})}function me({open:r,onOpenChange:c,sites:u,onDone:f}){const[g,b]=i.useState(""),[d,m]=i.useState(""),[h,x]=i.useState(""),[l,j]=i.useState(""),[v,p]=i.useState(""),[k,y]=i.useState(""),[n,t]=i.useState(!1),[o,a]=i.useState(""),s=P({mutationFn:S=>T.connectTracker(S,"jira",{siteUrl:d.trim(),project:h.trim(),email:l.trim(),apiToken:v.trim(),...k.trim()?{webhookSecret:k.trim()}:{},createOn:n?"thread.created":"manual"})}),w=g||u[0]?.uid||"",H=async S=>{S.preventDefault(),a("");try{const M=await s.mutateAsync(w);x(""),p(""),y(""),t(!1),c(!1),f(w,M.webhook??{url:`${location.origin}/api/v1/integrations/jira/inbound`}),A.success("Jira connected")}catch(M){a(M instanceof K?M.message:"Could not reach the server.")}},I=(S,M,Y,Z,ee,te="text",q)=>e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:`jr-${S}`,children:M}),e.jsx(F,{id:`jr-${S}`,type:te,placeholder:ee,value:Y,onChange:se=>Z(se.target.value),autoComplete:"off"}),q&&e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:q})]});return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx($,{children:e.jsxs("form",{onSubmit:S=>void H(S),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(O,{children:[e.jsx(R,{children:"Connect a site to Jira"}),e.jsx(D,{children:"An API token from id.atlassian.com › Security, with the email of the account it belongs to. It is checked against the project before it is saved, and stored encrypted with this instance's secret key."})]}),o&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:o}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"jr-site",children:"Site"}),e.jsx("select",{id:"jr-site",value:w,onChange:S=>b(S.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:u.map(S=>e.jsx("option",{value:S.uid,children:S.name},S.uid))})]}),I("url","Jira site",d,m,"https://kilnwork.atlassian.net"),I("project","Project key",h,x,"KAN","text","The prefix of the project's issues, like the KAN in KAN-12."),I("email","Account email",l,j,"you@kilnwork.studio","email"),I("token","API token",v,p,"","password"),I("secret","Webhook secret",k,y,"the secret you typed into Jira's webhook, optional","password","Lets Jira move comments here when issues move there. The URL to give Jira is shown after connecting."),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:n,onChange:S=>t(S.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"An issue for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Make issues from the brief when you mean it."})]})]}),e.jsxs(L,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:s.isPending,disabled:!d.trim()||!h.trim()||!l.trim()||!v.trim()||!w,children:s.isPending?"Checking…":"Connect"})]})]})})})}function he({open:r,onOpenChange:c,sites:u,onDone:f}){const[g,b]=i.useState(""),[d,m]=i.useState(""),[h,x]=i.useState(""),[l,j]=i.useState(!0),[v,p]=i.useState(""),k=B({queryKey:["integrations","slack","manifest"],queryFn:()=>T.slackManifest(),enabled:r,staleTime:1/0}),y=P({mutationFn:o=>T.connectTracker(o,"slack",{channel:d.trim(),token:h.trim(),createOn:l?"thread.created":"manual"})}),n=g||u[0]?.uid||"",t=async o=>{o.preventDefault(),p("");try{await y.mutateAsync(n),m(""),x(""),j(!0),c(!1),f(n),A.success("Slack connected")}catch(a){p(a instanceof K?a.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx($,{children:e.jsxs("form",{onSubmit:o=>void t(o),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(O,{children:[e.jsx(R,{children:"Connect a site to Slack"}),e.jsx(D,{children:"Create the app in your workspace from our manifest — one click, the scopes are filled in — install it, and paste its Bot User OAuth Token. The token is checked against the channel before it is saved, and stored encrypted with this instance's secret key."})]}),v&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:v}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-site",children:"Site"}),e.jsx("select",{id:"sl-site",value:n,onChange:o=>b(o.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:u.map(o=>e.jsx("option",{value:o.uid,children:o.name},o.uid))})]}),e.jsxs("div",{className:"flex items-center gap-3 rounded-md border border-border px-3 py-2 text-[13px]",children:[e.jsxs("span",{className:"flex-1",children:[e.jsx("span",{className:"block font-medium",children:"1. Create the app"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Opens api.slack.com with the manifest pasted; then Install to Workspace."})]}),e.jsx(N,{type:"button",variant:"outline",size:"sm",disabled:!k.data,render:e.jsx("a",{href:k.data?.url??"#",target:"_blank",rel:"noreferrer"}),children:"Create app…"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-token",children:"2. Bot User OAuth Token"}),e.jsx(F,{id:"sl-token",type:"password",placeholder:"xoxb-…",value:h,onChange:o=>x(o.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"On the app's OAuth & Permissions page after installing."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"sl-channel",children:"3. Channel"}),e.jsx(F,{id:"sl-channel",placeholder:"#reviews",value:d,onChange:o=>m(o.target.value),autoComplete:"off"}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"A public channel by name; a private one needs the app invited first, then its name works too."})]}),e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:l,onChange:o=>j(o.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"A message for every new comment"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"On by default: a channel is where people are told. Turn it off to post from the brief when you mean it."})]})]}),e.jsxs(L,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:y.isPending,disabled:!d.trim()||!h.trim()||!n,children:y.isPending?"Checking…":"Connect"})]})]})})})}function ue({owner:r,sites:c}){const u=z(),f=B(G.mcpTokens()),[g,b]=i.useState(!1),[d,m]=i.useState(null),[h,x]=i.useState(null),l=P({mutationFn:n=>T.revokeMcpToken(n),onSuccess:()=>{x(null),u.invalidateQueries({queryKey:["mcp-tokens"]})},onError:n=>A.error(J(n))}),j=f.data?.data??[],v=j.filter(n=>!n.revokedAt),p=f.data?.http??null,k=P({mutationFn:n=>T.setMcpHttp(n),onSuccess:(n,t)=>{u.setQueryData(G.instance().queryKey,n),u.invalidateQueries({queryKey:["mcp-tokens"]}),A.success(t?"Remote transport on — the token dialog shows its config":"Remote transport off — the endpoint answers 404 again")},onError:n=>A.error(J(n))}),y=n=>{const t=new Set(n),o=t.has("comments:write")||t.has("threads:write");return!o&&!t.has("context:read")?"Read-only":o?`Writes: ${[t.has("comments:write")?"reply":"",t.has("threads:write")?"mark ready":""].filter(Boolean).join(", ")}`:"Read-only, with capture context"};return e.jsxs(V,{title:"MCP",description:"A coding agent — Claude Code, Cursor, any MCP client — reads the same brief this dashboard copies, maps a comment to the file in its checkout, and can reply or mark a fix ready. It never resolves: whoever reported a snag decides when it is fixed. A token per agent, shown once, revocable here.",children:[f.isPending&&e.jsx("p",{className:"m-0 text-[13px] text-muted-foreground",children:"Reading…"}),p&&e.jsxs("div",{className:"flex items-center justify-between gap-4 rounded-md border border-border px-3 py-2.5",children:[e.jsxs("div",{children:[e.jsx(C,{htmlFor:"mcp-http-on",className:"text-[13px] font-medium",children:"Remote transport"}),e.jsxs("p",{className:"m-0 mt-0.5 text-[12px] leading-normal text-muted-foreground",children:[p.enabled?e.jsxs(e.Fragment,{children:["On. An agent anywhere talks to this studio at ",e.jsx("code",{className:"font-mono text-[11.5px]",children:p.url})," with a token as a bearer. No source mapping there; a write needs a token minted for it."]}):e.jsxs(e.Fragment,{children:["Off. Agents reach this studio only from a machine with the checkout. On, ",e.jsx("code",{className:"font-mono text-[11.5px]",children:p.url})," serves the same tools to an agent anywhere, with a token as a bearer."]}),p.source==="env"?" Set by the environment (SNAGSET_MCP_HTTP_ENABLED).":""]})]}),e.jsx(oe,{id:"mcp-http-on","aria-label":"Remote transport",checked:p.enabled,disabled:!r||p.source==="env"||k.isPending,onCheckedChange:n=>k.mutate(n)})]}),f.isSuccess&&v.length===0&&e.jsxs("div",{className:"flex items-center gap-3",children:[e.jsx(U,{variant:"outline",children:"No tokens"}),e.jsx("span",{className:"text-[13px] text-muted-foreground",children:"No agent can read this studio yet."})]}),j.length>0&&e.jsx("ul",{className:"m-0 flex list-none flex-col gap-2 p-0","aria-label":"Agent tokens",children:j.map(n=>e.jsxs("li",{className:`flex flex-wrap items-center gap-x-3 gap-y-1 rounded-md border border-border px-3 py-2.5 text-[13px] ${n.revokedAt?"opacity-60":""}`,children:[e.jsx("span",{className:"font-medium",children:n.name}),e.jsxs("code",{className:"font-mono text-[12.5px] text-muted-foreground",children:[n.prefix,"…"]}),e.jsx(U,{variant:"outline",className:n.revokedAt?"":"border-ok text-ok",children:n.revokedAt?"Revoked":y(n.scopes)}),e.jsxs("span",{className:"text-[12px] text-muted-foreground",children:[n.site?n.site.name:"All sites"," · ",n.lastUsedAt?`last used ${X(n.lastUsedAt)}`:"never used",n.expiresAt&&!n.revokedAt?` · expires ${new Date(n.expiresAt).toLocaleDateString()}`:"",n.createdBy?` · by ${n.createdBy}`:""]}),r&&!n.revokedAt&&e.jsx("span",{className:"ml-auto flex gap-1",children:e.jsx(N,{variant:"ghost",size:"sm",onClick:()=>x(n),children:"Revoke"})})]},n.id))}),r&&e.jsx("div",{children:e.jsx(N,{variant:"outline",size:"sm",onClick:()=>b(!0),children:"New token…"})}),e.jsx(xe,{open:g,onOpenChange:b,sites:c,http:f.data?.http??null,onDone:n=>{u.invalidateQueries({queryKey:["mcp-tokens"]}),m(n)}}),e.jsx(pe,{state:d,http:f.data?.http??null,onClose:()=>m(null)}),e.jsx(Q,{open:h!==null,onOpenChange:n=>!n&&x(null),title:`Revoke “${h?.name??""}”?`,description:e.jsx(e.Fragment,{children:"The agent holding it loses access on its next request. Its past replies stay, under its name. This cannot be undone — mint a new token instead."}),confirmLabel:"Revoke",busy:l.isPending,onConfirm:async()=>{h&&await l.mutateAsync(h.id)}})]})}function xe({open:r,onOpenChange:c,sites:u,http:f,onDone:g}){const[b,d]=i.useState(""),[m,h]=i.useState(""),[x,l]=i.useState(["threads:read","source:map"]),[j,v]=i.useState(""),[p,k]=i.useState(!1),[y,n]=i.useState(""),t=P({mutationFn:()=>T.mintMcpToken({name:b.trim(),...m?{site:m}:{},scopes:x,...j?{expiresInDays:Number(j)}:{},...p?{allowRemoteWrites:!0}:{}})}),o=(s,w)=>l(H=>w?[...new Set([...H,s])]:H.filter(I=>I!==s)),a=async s=>{s.preventDefault(),n("");try{const w=await t.mutateAsync();d(""),h(""),l(["threads:read","source:map"]),v(""),k(!1),c(!1),g(w)}catch(w){n(w instanceof K?w.message:"Could not reach the server.")}};return e.jsx(E,{open:r,onOpenChange:c,children:e.jsx($,{children:e.jsxs("form",{onSubmit:s=>void a(s),className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(O,{children:[e.jsx(R,{children:"New agent token"}),e.jsx(D,{children:"Read-only by default, plus mapping a comment to a file in the agent's own checkout. Tick more only for an agent you want writing here — and it still cannot resolve anything."})]}),y&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:y}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-name",children:"Name"}),e.jsx(F,{id:"mcp-name",placeholder:"Claude Code",value:b,onChange:s=>d(s.target.value),autoComplete:"off",maxLength:80}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"What a client sees on the agent's replies, so name the agent, not the person."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-site",children:"Site"}),e.jsxs("select",{id:"mcp-site",value:m,onChange:s=>h(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:[e.jsx("option",{value:"",children:"All sites"}),u.map(s=>e.jsx("option",{value:s.uid,children:s.name},s.uid))]})]}),e.jsxs("fieldset",{className:"m-0 flex flex-col gap-2 border-0 p-0",children:[e.jsx("legend",{className:"mb-1 text-[13px] font-medium",children:"Scopes"}),ne.map(s=>e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:x.includes(s.scope),onChange:w=>o(s.scope,w.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:s.label}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:s.hint})]})]},s.scope))]}),f?.enabled&&(x.includes("comments:write")||x.includes("threads:write"))&&e.jsxs("label",{className:"flex cursor-pointer items-start gap-2.5 text-[13px]",children:[e.jsx("input",{type:"checkbox",className:"mt-0.5",checked:p,onChange:s=>k(s.target.checked)}),e.jsxs("span",{children:[e.jsx("span",{className:"block font-medium",children:"May write over the remote transport"}),e.jsx("span",{className:"block text-[12px] text-muted-foreground",children:"Off by default. Over POST /mcp the agent is not on a machine you can see; a write there is a decision."})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(C,{htmlFor:"mcp-expires",children:"Expires"}),e.jsxs("select",{id:"mcp-expires",value:j,onChange:s=>v(s.target.value),className:"h-8 rounded-md border border-input bg-background px-2.5 text-[13px]",children:[e.jsx("option",{value:"",children:"Never"}),e.jsx("option",{value:"30",children:"In 30 days"}),e.jsx("option",{value:"90",children:"In 90 days"}),e.jsx("option",{value:"365",children:"In a year"})]})]}),e.jsxs(L,{children:[e.jsx(N,{type:"button",variant:"outline",onClick:()=>c(!1),children:"Cancel"}),e.jsx(N,{type:"submit",loading:t.isPending,disabled:!b.trim()||x.length===0,children:t.isPending?"Minting…":"Create token"})]})]})})})}function pe({state:r,http:c,onClose:u}){const f=typeof location<"u"?location.origin:"",g={SNAGSET_MCP_TOKEN:r?.secret??"",SNAGSET_MCP_HOST:f,...r?.token.site?{SNAGSET_MCP_PROJECT:r.token.site.uid}:{}},b=JSON.stringify({mcpServers:{snagset:{command:"npx",args:["-y","@snagset/mcp"],env:g}}},null,2),d=["claude mcp add snagset",...Object.entries(g).map(([l,j])=>`-e ${l}=${j}`),"--","npx -y @snagset/mcp"].join(" "),m=`Bearer ${r?.secret??""}`,h=["claude mcp add","--transport http","snagset",c?.url??"",`--header "Authorization: ${m}"`].join(" "),x=JSON.stringify({mcpServers:{snagset:{type:"http",url:c?.url??"",headers:{Authorization:m}}}},null,2);return e.jsx(E,{open:r!==null,onOpenChange:l=>!l&&u(),children:e.jsxs($,{className:"max-w-xl",children:[e.jsxs(O,{children:[e.jsxs(R,{children:["Token for “",r?.token.name??"","”"]}),e.jsx(D,{children:"Shown this once — only its hash is stored. Put it in the agent's config, then start the agent from the site's checkout so it can map comments to files."})]}),r&&e.jsxs("div",{className:"flex flex-col gap-4 text-[13px]",children:[e.jsxs("div",{className:"flex items-center gap-2",children:[e.jsx("code",{className:"min-w-0 flex-1 truncate rounded-md bg-muted px-2 py-1.5 font-mono text-[12px]","data-testid":"mcp-token",children:r.secret}),e.jsx(_,{text:r.secret,label:"Copy the token"})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Claude Code"}),e.jsx(_,{text:d,label:"Copy the Claude Code command"})]}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:d})]}),c?.enabled&&e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Remote — an agent that is not on a machine with the checkout"}),e.jsx(_,{text:x,label:"Copy the remote config"})]}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:h}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:x}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"No source mapping there — nothing to search. Writes need the token minted with remote writes allowed."})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsxs("div",{className:"flex items-center justify-between",children:[e.jsx("span",{className:"font-medium",children:"Cursor, Claude Desktop, any MCP client"}),e.jsx(_,{text:b,label:"Copy the JSON config"})]}),e.jsx("pre",{className:"m-0 overflow-x-auto rounded-md bg-muted px-3 py-2 font-mono text-[12px]",children:b}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"Cursor reads it from .cursor/mcp.json in the project; Claude Desktop from its claude_desktop_config.json."})]})]}),e.jsx(L,{children:e.jsx(N,{type:"button",onClick:u,children:"Done"})})]})})}export{Oe as component};
@@ -0,0 +1 @@
1
+ import{j as e,f as y,r as f,B as u,P as N,C as A,D as h,_ as C,y as R}from"./index-B7_Oj3hr.js";import{u as T}from"./useQuery-CBgK187B.js";import{u as S,a as D}from"./zod-BUdBrC5l.js";import{A as M,a as $}from"./avatar-DlHbKa1H.js";import{B as E}from"./badge-CQoGgFU8.js";import{C as F}from"./card-YnwmM74t.js";import{X as P,E as k,G as B,I as H,H as I,J as O,K as z}from"./dialog-BO8bYmy1.js";import{L as d,I as p}from"./label-Dpq7t35_.js";import{T as L,a as V,b,c,d as _,e as x}from"./table-DdjoxL3-.js";import{C as q}from"./ConfirmDialog-ClUMXHe1.js";import{P as G}from"./parts-C1QjM02Y.js";import{a as J}from"./labels--UUyt9uB.js";import{u as K}from"./me-DoCJgtG9.js";import{c as Q,d as X,e as Y}from"./studio-enyabWEx.js";import{P as U}from"./plus-D247LXUb.js";import"./useBaseQuery-yj7uWlSz.js";import"./useRender-BHlMpPxr.js";function j({className:s,...a}){return e.jsx("select",{className:y("h-8 rounded-md border border-input bg-card px-2.5 text-[13.5px] text-foreground outline-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:opacity-50",s),...a})}function je(){const s=K(),a=s.user.role==="owner",n=T(R.members()),[i,o]=f.useState(!1),r=s.limits.members.limit,l=r!==null&&s.limits.members.used>=r;return e.jsxs("div",{className:"p-7",children:[e.jsx(G,{title:"Members",sub:`${a?"Owners and admins can do everything; only owners change this list.":"Owners and admins can do everything. Ask an owner to change this list."}${r!==null?` ${s.limits.members.used} of ${r} members.`:""}`,actions:a?e.jsxs(u,{onClick:()=>o(!0),disabled:l,title:l?`This studio's plan allows ${r} members.`:void 0,children:[e.jsx(U,{}),"Add member"]}):void 0}),e.jsx(F,{className:"max-w-[1040px] overflow-hidden py-0",children:e.jsxs(L,{children:[e.jsx(V,{children:e.jsxs(b,{children:[e.jsx(c,{children:"Name"}),e.jsx(c,{children:"Email"}),e.jsx(c,{children:"Role"}),a&&e.jsx(c,{className:"w-0"})]})}),e.jsx(_,{children:(n.data?.data??[]).map(t=>e.jsx(W,{m:t,owner:a},t.email))})]})}),e.jsx("p",{className:"m-0 mt-3 max-w-[1040px] text-[12.5px] text-muted-foreground",children:"There is no invitation mail: an owner sets an initial password and hands it over, and the person changes it under You."}),a&&e.jsx(ee,{open:i,onOpenChange:o})]})}function W({m:s,owner:a}){const n=Q(),i=X(),[o,r]=f.useState(!1);return e.jsxs(b,{children:[e.jsx(x,{children:e.jsxs("span",{className:"flex items-center gap-2.5",children:[e.jsx(M,{className:"size-6",children:e.jsx($,{className:"bg-brand-soft text-[10px] font-semibold text-brand",children:J(s.name,s.email)})}),e.jsx("span",{className:"font-medium",children:s.name||s.email}),s.you&&e.jsx(E,{variant:"outline",className:"text-[11px]",children:"you"})]})}),e.jsx(x,{className:"text-muted-foreground",children:s.email}),e.jsx(x,{children:a?e.jsxs(j,{"aria-label":`Role for ${s.email}`,value:s.role,onChange:l=>n.mutate({email:s.email,role:l.target.value}),children:[e.jsx("option",{value:"owner",children:"Owner"}),e.jsx("option",{value:"admin",children:"Admin"})]}):e.jsx("span",{className:"capitalize",children:s.role})}),a&&e.jsxs(x,{className:"text-right",children:[!s.you&&e.jsx(u,{variant:"ghost",size:"icon-sm","aria-label":`Remove ${s.email}`,onClick:()=>r(!0),children:e.jsx(P,{})}),e.jsx(q,{open:o,onOpenChange:r,title:`Remove ${s.name||s.email}?`,description:"Every session of theirs ends now. Nothing they wrote is destroyed.",confirmLabel:"Remove",busy:i.isPending,onConfirm:()=>{r(!1),i.mutate(s.email)}})]})]})}const Z=A({email:h().trim().email("An email address"),name:h().trim().max(120).optional(),role:C(["owner","admin"]),password:h().min(12,"At least 12 characters")});function ee({open:s,onOpenChange:a}){const n=Y(),[i,o]=f.useState(""),{register:r,handleSubmit:l,formState:t,reset:g}=S({resolver:D(Z),defaultValues:{role:"admin"}}),w=l(async m=>{o("");try{await n.mutateAsync({email:m.email,name:m.name??"",role:m.role,password:m.password}),g(),a(!1)}catch(v){o(N(v))}});return e.jsx(k,{open:s,onOpenChange:a,children:e.jsx(B,{children:e.jsxs("form",{onSubmit:w,className:"flex flex-col gap-4",noValidate:!0,children:[e.jsxs(H,{children:[e.jsx(I,{children:"Add a member"}),e.jsx(O,{children:"They sign in with this email and the password you set; there is no invitation mail, so you tell them the password yourself."})]}),i&&e.jsx("p",{role:"alert",className:"m-0 rounded-md border border-destructive/40 bg-warn-soft px-3 py-2 text-[13px] text-destructive",children:i}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(d,{htmlFor:"member-email",children:"Email"}),e.jsx(p,{id:"member-email",type:"email",autoComplete:"off","aria-invalid":!!t.errors.email,...r("email")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(d,{htmlFor:"member-name",children:"Name"}),e.jsx(p,{id:"member-name",autoComplete:"off",...r("name")})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(d,{htmlFor:"member-role",children:"Role"}),e.jsxs(j,{id:"member-role",className:"w-full",...r("role"),children:[e.jsx("option",{value:"admin",children:"Admin"}),e.jsx("option",{value:"owner",children:"Owner"})]})]}),e.jsxs("div",{className:"flex flex-col gap-1.5",children:[e.jsx(d,{htmlFor:"member-password",children:"Initial password"}),e.jsx(p,{id:"member-password",type:"text",autoComplete:"off","aria-invalid":!!t.errors.password,...r("password")}),e.jsx("p",{className:"m-0 text-[12px] text-muted-foreground",children:"At least 12 characters — a short phrase of real words is fine. They can change it afterwards."})]}),e.jsxs(z,{children:[e.jsx(u,{type:"button",variant:"outline",onClick:()=>a(!1),children:"Cancel"}),e.jsx(u,{type:"submit",loading:t.isSubmitting,children:t.isSubmitting?"Adding…":"Add"})]})]})})})}export{je as component};
@@ -1,4 +1,4 @@
1
- import{c as t}from"./createLucideIcon-SQ1OtOty.js";/**
1
+ import{c as t}from"./index-B7_Oj3hr.js";/**
2
2
  * @license lucide-react v1.39.0 - ISC
3
3
  *
4
4
  * This source code is licensed under the ISC license.