@snagset/server 0.1.9 → 0.1.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/app.js +5 -0
- package/dist/app.js.map +1 -1
- package/dist/config.generated.js +2 -1
- package/dist/config.generated.js.map +1 -1
- package/dist/db/migrations/0008_outbox_org_rows.sql +29 -0
- package/dist/jobs/set.js +15 -4
- package/dist/jobs/set.js.map +1 -1
- package/dist/mail/digest.js +291 -0
- package/dist/mail/digest.js.map +1 -0
- package/dist/mail/links.js +41 -0
- package/dist/mail/links.js.map +1 -0
- package/dist/mail/notify.js +126 -25
- package/dist/mail/notify.js.map +1 -1
- package/dist/net/publicFetch.js +202 -0
- package/dist/net/publicFetch.js.map +1 -0
- package/dist/routes/commentEdit.js +20 -5
- package/dist/routes/commentEdit.js.map +1 -1
- package/dist/routes/imageProxy.js +77 -0
- package/dist/routes/imageProxy.js.map +1 -0
- package/dist/routes/threads.js +182 -42
- package/dist/routes/threads.js.map +1 -1
- package/dist/serverless.js +11 -1
- package/dist/serverless.js.map +1 -1
- package/package.json +3 -3
- package/static/dashboard/assets/CompositeItem-Bg_GF93m.js +1 -0
- package/static/dashboard/assets/{ConfirmDialog-eCzw7vjK.js → ConfirmDialog-WnZ92dk2.js} +1 -1
- package/static/dashboard/assets/{CopyButton-lcjux1TA.js → CopyButton-rL26RLOJ.js} +1 -1
- package/static/dashboard/assets/{FieldItemContext-i5zdyQYl.js → FieldItemContext-BFJSEdB-.js} +1 -1
- package/static/dashboard/assets/{InstallTag-Eqs3RM9e.js → InstallTag-BKIArjPk.js} +1 -1
- package/static/dashboard/assets/{SaveState-Cf_bnJmg.js → SaveState-DVHi0zeB.js} +1 -1
- package/static/dashboard/assets/{_app-CuKLSKZ2.js → _app-D2r-zfbF.js} +1 -1
- package/static/dashboard/assets/_app-iK-weT5A.js +56 -0
- package/static/dashboard/assets/activity-CCqTW3Th.js +1 -0
- package/static/dashboard/assets/{arrow-left-CQUHEFUP.js → arrow-left-BEHXEKLy.js} +1 -1
- package/static/dashboard/assets/{avatar-CWT37Ivf.js → avatar-BnPBt2UW.js} +1 -1
- package/static/dashboard/assets/{badge-thtKAJ0h.js → badge-B2rHdH8b.js} +1 -1
- package/static/dashboard/assets/{card-CsXE7vKD.js → card-BNGTf8dq.js} +1 -1
- package/static/dashboard/assets/{check-Bc_1fmPx.js → check-C3gaSIDM.js} +1 -1
- package/static/dashboard/assets/{chevron-right-neQQkaOt.js → chevron-right-CLLS6JcX.js} +1 -1
- package/static/dashboard/assets/{copy-O3USBatC.js → copy-Dy7nBeu2.js} +1 -1
- package/static/dashboard/assets/{dialog-MC-TOvQV.js → dialog-q6J2VL2H.js} +2 -2
- package/static/dashboard/assets/{dropdown-menu-C2ZhmONu.js → dropdown-menu-DFZrgFpI.js} +1 -1
- package/static/dashboard/assets/{image-off-Bu6l8gP5.js → image-off-Bug-3iC-.js} +1 -1
- package/static/dashboard/assets/index-ClhJtAFR.css +1 -0
- package/static/dashboard/assets/index-CtyJ8ep7.js +169 -0
- package/static/dashboard/assets/{label-BTdAT39L.js → label-DoQ07Q_y.js} +1 -1
- package/static/dashboard/assets/{layout-grid-rYWIGaIJ.js → layout-grid-B3BkFR60.js} +1 -1
- package/static/dashboard/assets/me-NFjosbdz.js +1 -0
- package/static/dashboard/assets/{parts-kPNZVO9H.js → parts-BTWw4Uv-.js} +1 -1
- package/static/dashboard/assets/{plus-CcJ1Zwa7.js → plus-DqdyxL8q.js} +1 -1
- package/static/dashboard/assets/s._site-kVvU6ucw.js +1 -0
- package/static/dashboard/assets/s._site.comments-kEGEpFR2.js +54 -0
- package/static/dashboard/assets/{s._site.reviewers-Djq2t6Dx.js → s._site.reviewers-C1LLoSS5.js} +1 -1
- package/static/dashboard/assets/s._site.settings-CeKMuuRo.js +1 -0
- package/static/dashboard/assets/{setup-D748SEIm.js → setup-CdZYVZmd.js} +1 -1
- package/static/dashboard/assets/{sign-in-CKSiZWCo.js → sign-in-CvstpETe.js} +1 -1
- package/static/dashboard/assets/{sign-up-BX9j_Ya2.js → sign-up-Cq7YvdYN.js} +1 -1
- package/static/dashboard/assets/sites-CUWMKMCM.js +1 -0
- package/static/dashboard/assets/{studio-HH_J6PPv.js → studio-BfA8kzFc.js} +1 -1
- package/static/dashboard/assets/studio-uAl1i7Nd.js +1 -0
- package/static/dashboard/assets/studio.index-BTF7YIX-.js +1 -0
- package/static/dashboard/assets/studio.integrations-Nr_jBcXh.js +1 -0
- package/static/dashboard/assets/{studio.members-DTbKcrEI.js → studio.members-BtbPt4iX.js} +1 -1
- package/static/dashboard/assets/{sun-CWPmS6_O.js → sun-s_t6Zx3r.js} +1 -1
- package/static/dashboard/assets/switch-DbqX1mWE.js +1 -0
- package/static/dashboard/assets/{table-CiZO2uuW.js → table-CrWNqpP8.js} +1 -1
- package/static/dashboard/assets/{useAriaLabelledBy-oZFqC809.js → useAriaLabelledBy-CgL3SaJd.js} +1 -1
- package/static/dashboard/assets/{useBaseQuery-CHgLQD-M.js → useBaseQuery-CBTINzcX.js} +1 -1
- package/static/dashboard/assets/useQuery-BPuxCfhJ.js +1 -0
- package/static/dashboard/assets/useRender-BCpbp3WG.js +1 -0
- package/static/dashboard/assets/{useValueChanged-Dvr7PvAV.js → useValueChanged-B20GM2vK.js} +1 -1
- package/static/dashboard/assets/{users-Ci-ogubz.js → users-CQwkq_Tk.js} +1 -1
- package/static/dashboard/assets/{welcome-BDWw5Qlv.js → welcome-W1YxYlGW.js} +1 -1
- package/static/dashboard/assets/{you-DAUNHAFI.js → you-DXZRdbGS.js} +1 -1
- package/static/dashboard/assets/{zod-CtjFmGX5.js → zod-DWEgoEmm.js} +1 -1
- package/static/dashboard/index.html +2 -2
- package/static/widget/snag.capture.js +1 -1
- package/static/widget/snag.dock.js +1 -1
- package/static/widget/snag.runtime.js +2 -2
- package/static/widget/snag.screenshot.js +1 -1
- package/static/dashboard/assets/CompositeItem-Db_8iHSG.js +0 -1
- package/static/dashboard/assets/_app-qNVG5lsX.js +0 -56
- package/static/dashboard/assets/activity-CQLBFIV4.js +0 -1
- package/static/dashboard/assets/index-BR4Mnw-o.css +0 -1
- package/static/dashboard/assets/index-C6gyyLd5.js +0 -169
- package/static/dashboard/assets/me-CI9giaT9.js +0 -1
- package/static/dashboard/assets/s._site-D0HRtia-.js +0 -1
- package/static/dashboard/assets/s._site.comments-D3ACsr3a.js +0 -39
- package/static/dashboard/assets/s._site.settings-D0b6vJci.js +0 -1
- package/static/dashboard/assets/sites-QwJy87Y8.js +0 -1
- package/static/dashboard/assets/studio-B_ma5JGA.js +0 -1
- package/static/dashboard/assets/studio.index-DrtJF7DT.js +0 -1
- package/static/dashboard/assets/studio.integrations-Cv34ukzT.js +0 -1
- package/static/dashboard/assets/switch-CzijGUed.js +0 -1
- package/static/dashboard/assets/useQuery-C6FyjMS-.js +0 -1
- package/static/dashboard/assets/useRender-D5jZ1wns.js +0 -1
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as r,Q as u,d as s}from"./useBaseQuery-CHgLQD-M.js";import{y as t}from"./index-C6gyyLd5.js";function a(e,o){return r({...e,enabled:!0,suspense:!0,throwOnError:s,placeholderData:void 0},u)}function i(){return a(t.me()).data}export{i as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t,O as o}from"./index-C6gyyLd5.js";const n=()=>t.jsx(o,{});export{n as component};
|
|
@@ -1,39 +0,0 @@
|
|
|
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-C6gyyLd5.js";import{u as le}from"./useQuery-C6FyjMS-.js";import{C as as}from"./check-Bc_1fmPx.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-BTdAT39L.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-MC-TOvQV.js";import{u as it}from"./FieldItemContext-i5zdyQYl.js";import{u as lt}from"./useAriaLabelledBy-oZFqC809.js";import{u as dt}from"./useValueChanged-Dvr7PvAV.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-C2ZhmONu.js";import{A as te,a as ne}from"./avatar-CWT37Ivf.js";import{b as Fe,S as ms,E as Ee}from"./parts-kPNZVO9H.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-O3USBatC.js";import{I as xt}from"./image-off-Bu6l8gP5.js";import{C as pt}from"./chevron-right-neQQkaOt.js";import{I as ht}from"./InstallTag-Eqs3RM9e.js";import{u as ft}from"./me-CI9giaT9.js";import{A as gt}from"./arrow-left-CQUHEFUP.js";import"./useBaseQuery-CHgLQD-M.js";import"./CompositeItem-Db_8iHSG.js";import"./card-CsXE7vKD.js";/**
|
|
2
|
-
* @license lucide-react v1.39.0 - ISC
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the ISC license.
|
|
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=Q("chevron-down",bt);/**
|
|
7
|
-
* @license lucide-react v1.39.0 - ISC
|
|
8
|
-
*
|
|
9
|
-
* This source code is licensed under the ISC license.
|
|
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=Q("columns-2",jt);/**
|
|
12
|
-
* @license lucide-react v1.39.0 - ISC
|
|
13
|
-
*
|
|
14
|
-
* This source code is licensed under the ISC license.
|
|
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=Q("inbox",kt);/**
|
|
17
|
-
* @license lucide-react v1.39.0 - ISC
|
|
18
|
-
*
|
|
19
|
-
* This source code is licensed under the ISC license.
|
|
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=Q("list",Nt);/**
|
|
22
|
-
* @license lucide-react v1.39.0 - ISC
|
|
23
|
-
*
|
|
24
|
-
* This source code is licensed under the ISC license.
|
|
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=Q("rotate-cw",Ct);/**
|
|
27
|
-
* @license lucide-react v1.39.0 - ISC
|
|
28
|
-
*
|
|
29
|
-
* This source code is licensed under the ISC license.
|
|
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=Q("user-plus",$t);/**
|
|
32
|
-
* @license lucide-react v1.39.0 - ISC
|
|
33
|
-
*
|
|
34
|
-
* This source code is licensed under the ISC license.
|
|
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=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
|
-
`))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(``),r.push("")}return r.join(`
|
|
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(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};
|
|
@@ -1 +0,0 @@
|
|
|
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-C6gyyLd5.js";import{u as $e}from"./useQuery-C6FyjMS-.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-BTdAT39L.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-MC-TOvQV.js";import{b as mt,u as ht,C as gt}from"./CompositeItem-Db_8iHSG.js";import{u as xt}from"./useValueChanged-Dvr7PvAV.js";import{u as bt}from"./FieldItemContext-i5zdyQYl.js";import{u as vt}from"./useAriaLabelledBy-oZFqC809.js";import{C as yt}from"./ConfirmDialog-eCzw7vjK.js";import{C as Rt}from"./CopyButton-lcjux1TA.js";import{I as It}from"./InstallTag-Eqs3RM9e.js";import{S as Ct}from"./switch-CzijGUed.js";import{P as jt,a as ue}from"./parts-kPNZVO9H.js";import{S as kt}from"./SaveState-Cf_bnJmg.js";import{u as wt}from"./me-CI9giaT9.js";import{P as St}from"./plus-CcJ1Zwa7.js";import"./useBaseQuery-CHgLQD-M.js";import"./check-Bc_1fmPx.js";import"./copy-O3USBatC.js";import"./card-CsXE7vKD.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};
|
|
@@ -1 +0,0 @@
|
|
|
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-C6gyyLd5.js";import{u as k,a as C}from"./zod-CtjFmGX5.js";import{C as _}from"./card-CsXE7vKD.js";import{E as D,G as E,I,H as L,J as P,K as F}from"./dialog-MC-TOvQV.js";import{L as h,I as g}from"./label-BTdAT39L.js";import{P as z,E as H}from"./parts-kPNZVO9H.js";import{b as K}from"./labels--UUyt9uB.js";import{u as T}from"./me-CI9giaT9.js";import{P as f}from"./plus-CcJ1Zwa7.js";import{L as q}from"./layout-grid-rYWIGaIJ.js";import{I as B}from"./image-off-Bu6l8gP5.js";import"./useBaseQuery-CHgLQD-M.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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{j as t,O as o}from"./index-C6gyyLd5.js";const n=()=>t.jsx(o,{});export{n as component};
|
|
@@ -1 +0,0 @@
|
|
|
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-C6gyyLd5.js";import{u as w}from"./useQuery-C6FyjMS-.js";import{L as A,I as N}from"./label-BTdAT39L.js";import{E as M,G as $,I as T,H as I,J as U,K as L}from"./dialog-MC-TOvQV.js";import{C as _}from"./ConfirmDialog-eCzw7vjK.js";import{a as D,P as G}from"./parts-kPNZVO9H.js";import{b as F}from"./labels--UUyt9uB.js";import{u as z}from"./me-CI9giaT9.js";import{S as O}from"./SaveState-Cf_bnJmg.js";import{b as q}from"./studio-HH_J6PPv.js";import{c as Q}from"./update-duXzIzFS.js";import"./useBaseQuery-CHgLQD-M.js";import"./card-CsXE7vKD.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};
|
|
@@ -1 +0,0 @@
|
|
|
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-C6gyyLd5.js";import{u as B}from"./useQuery-C6FyjMS-.js";import{B as U}from"./badge-thtKAJ0h.js";import{E,G as $,I as O,H as R,J as D,K as L}from"./dialog-MC-TOvQV.js";import{L as C,I as F}from"./label-BTdAT39L.js";import{S as oe}from"./switch-CzijGUed.js";import{C as Q}from"./ConfirmDialog-eCzw7vjK.js";import{P as ae,a as V}from"./parts-kPNZVO9H.js";import{C as _}from"./CopyButton-lcjux1TA.js";import{b as X}from"./labels--UUyt9uB.js";import{u as re}from"./me-CI9giaT9.js";import"./useBaseQuery-CHgLQD-M.js";import"./useRender-D5jZ1wns.js";import"./useAriaLabelledBy-oZFqC809.js";import"./useValueChanged-Dvr7PvAV.js";import"./card-CsXE7vKD.js";import"./check-Bc_1fmPx.js";import"./copy-O3USBatC.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};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{r as i,h as ae,Y as re,d as se,W as ie,E as ne,i as M,j as f,Z as oe,f as de}from"./index-C6gyyLd5.js";import{f as ce,e as le,h as ue,j as fe,u as pe,A as he,k as be,l as ge,c as me,n as ve}from"./label-BTdAT39L.js";import{L as ke,M as xe}from"./dialog-MC-TOvQV.js";import{u as we}from"./useAriaLabelledBy-oZFqC809.js";import{u as ye}from"./useValueChanged-Dvr7PvAV.js";const j=i.createContext(void 0);function Ce(){const r=i.useContext(j);if(r===void 0)throw new Error(ae(63));return r}const D={...ce,checked(r){return r?{"data-checked":""}:{"data-unchecked":""}}},Re=i.forwardRef(function(s,o){const{checked:k,className:F,defaultChecked:x,"aria-labelledby":m,form:p,id:L,inputRef:T,name:w,nativeButton:h=!1,onCheckedChange:V,readOnly:d=!1,required:b=!1,disabled:N=!1,render:ze,uncheckedValue:y,value:C,style:Ee,...A}=s,{clearErrors:H}=le(),{state:R,setTouched:W,setDirty:q,validityData:O,setFilled:v,setFocused:P,validationMode:Y,disabled:J,name:U,validation:c}=ue(),{labelId:Z}=fe(),t=J||N,l=U??w,n=i.useRef(null),_=re(n,T,c.inputRef),g=i.useRef(null),z=pe(),E=he({id:L,implicit:!1,controlRef:g}),B=h?void 0:E,[a,G]=be({controlled:k,default:!!x,name:"Switch",state:"checked"});ge(g,z,a,void 0,!t,w),se(()=>{n.current&&v(n.current.checked)},[v]),ye(a,()=>{H(l),q(a!==O.initialValue),v(a),c.change(a)});const{getButtonProps:K,buttonRef:Q}=ie({disabled:t,native:h}),X=we(m,Z,n,!h,B),$={id:h?E:z,role:"switch","aria-checked":a,"aria-readonly":d||void 0,"aria-required":b||void 0,"aria-labelledby":X,onFocus(){t||P(!0)},onBlur(){const e=n.current;!e||t||(W(!0),P(!1),Y==="onBlur"&&c.commit(e.checked))},onClick(e){if(d||t)return;e.preventDefault();const u=n.current;u&&oe(u,e)}},ee={...c.getValidationProps(t),checked:a,disabled:t,form:p,id:B,name:l,required:b,style:l?ke:xe,tabIndex:-1,type:"checkbox","aria-hidden":!0,ref:_,onChange(e){if(e.nativeEvent.defaultPrevented)return;if(d){e.preventDefault();return}const u=e.currentTarget.checked,S=me(ve,e.nativeEvent);V?.(u,S),!S.isCanceled&&G(u)},onClick(e){e.stopPropagation()},onFocus(){g.current?.focus()},...C!==void 0?{value:C}:ne},I=i.useMemo(()=>({...R,checked:a,disabled:t,readOnly:d,required:b}),[R,a,t,d,b]),te=M("span",s,{state:I,ref:[o,g,Q],props:[$,A,K,e=>c.getValidationProps(t,e)],stateAttributesMapping:D});return f.jsxs(j.Provider,{value:I,children:[te,!a&&l&&y!==void 0&&f.jsx("input",{type:"hidden",form:p,name:l,value:y,disabled:t}),f.jsx("input",{...ee,suppressHydrationWarning:!0})]})}),Pe=i.forwardRef(function(s,o){const{render:k,className:F,style:x,...m}=s,p=Ce();return M("span",s,{state:p,ref:o,stateAttributesMapping:D,props:m})});function De({className:r,size:s="default",...o}){return f.jsx(Re,{"data-slot":"switch","data-size":s,className:de("peer group/switch relative inline-flex shrink-0 items-center rounded-full border border-transparent transition-all outline-none group-has-[:focus-visible]/field-label:border-transparent group-has-[:focus-visible]/field-label:ring-0 after:absolute after:-inset-x-3 after:-inset-y-2 focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 data-[size=default]:h-[18.4px] data-[size=default]:w-[32px] data-[size=sm]:h-[14px] data-[size=sm]:w-[24px] dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 data-checked:bg-primary data-unchecked:bg-input dark:data-unchecked:bg-input/80 data-disabled:cursor-not-allowed data-disabled:opacity-50",r),...o,children:f.jsx(Pe,{"data-slot":"switch-thumb",className:"pointer-events-none block rounded-full bg-background ring-0 transition-transform group-data-[size=default]/switch:size-4 group-data-[size=sm]/switch:size-3 group-data-[size=default]/switch:data-checked:translate-x-[calc(100%-2px)] group-data-[size=sm]/switch:data-checked:translate-x-[calc(100%-2px)] dark:data-checked:bg-primary-foreground group-data-[size=default]/switch:data-unchecked:translate-x-0 group-data-[size=sm]/switch:data-unchecked:translate-x-0 dark:data-unchecked:bg-foreground"})})}export{De as S};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{u as r,Q as u}from"./useBaseQuery-CHgLQD-M.js";function a(e,s){return r(e,u)}export{a as u};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
import{i as n}from"./index-C6gyyLd5.js";function u(e){return n(e.defaultTagName??"div",e,e)}export{u};
|